本帖最后由 真滴瓜 于 2019-10-10 02:17 编辑
首先来一首BGM
注意
③部分内容需求一定代码知识,全程注意中文转码
④本帖部分教程来自*大佬的教程贴*,本帖为补全内容以及我的个人小教程
⑤这是资源包教程,肯定要先准备材质和资源包腌啊
⑥所有 文件夹/文件 都必须小写英文或数字,不支持中文,空格尽量不用!
一、准备一个资源包:
选项:
①只用于添加额外的物品→不用准备新资源包,下面有我提供的示例资源包[可能会迟一点更新],不想看教程的可以直接开包查看
②包含其他材质(修改原版材质)→创建文件夹目录,请逐一创建目录为 资源包目录\assets\minecraft\mcpatcher\cit 一共4个文件夹
二、准备好材质并放在指定位置: \cit [所有材质存放在此文件夹下!可以在此新开文件夹] ×无选项
三、代入材质:
到了我们激动人心的代码环节,首先我先解释一下如何将我们的材质文件偷偷的代入到游戏里。 我目前主要介绍两种方式:Name判断 / Lore判断 判断方式不止这两种!!! 以后看情况更新其他方式!!
*代码部分原文
- ###############################################################################
- # General properties used by all types:
- ###############################################################################
- # (Optional) Type of texture replacement.
- # item: Simple item texture replacement. Applies to items in GUI, held
- # in hand, and in the world. If multiple properties files match
- # the same item, only the first (sorted by weight, then by
- # filename) is used.
- # enchantment: Overlay texture for enchantments (replaces misc/glint.png). If
- # multiple properties files match the same item, they are blended
- # together using rules specified in the global cit.properties
- # file.
- # armor: Armor texture replacement. Applies to armor models worn by
- # players and mobs. If multiple properties files match the same
- # item, only the first (sorted by weight, then by filename) is
- # used.
- # elytra: Elytra texture replacement. Applies to elytra model worn by
- # players and mobs. If multiple properties files match the same
- # item, only the first (sorted by weight, then by filename) is
- # used.
- # The default type is item. Each type has additional properties defined in
- # later sections of this template.
- type=<item | enchantment | armor | elytra>
- # (Optional for type=enchantment, required for other types) List of items to
- # apply the replacement texture to.
- items=<list of item IDs>
- # (Optional) Replacement texture. Can be a full path or just a name:
- # mytextures/excalibur.png -> mytextures/excalibur.png
- # excalibur -> optifine/cit/excalibur.png
- # Texture format including animation is handled differently depending on the
- # type. See the type-specific sections below.
- #
- # If no texture is provided, OptiFine will use the name of the properties file,
- # optifine/cit/excalibur.properties -> optifine/cit/excalibur.png
- texture=<replacement texture>
- # (Optional) Replacement model.
- # A json item model in vanilla format ([url]http://minecraft.gamepedia.com/Model#Item_models[/url])
- # item/mymodel -> /assets/minecraft/models/item/mymodel.json
- # ./mymodel -> mymodel.json from the same folder as the properties file
- # The model may reference textures from the same folder, for example: "./mytexture"
- model=<replacement model>
- # (Optional) List of damage values. Use the replacement texture only when the
- # item damage is a certain value or range.
- #
- # For items with durability, damage starts at 0 for a new item and increases as
- # it gets damaged. The max damage an item can take varies, see
- # [url]http://www.minecraftwiki.net/wiki/Item_durability[/url]
- #
- # For other items, damage represents different properties like potion type or
- # wool color. See [url]http://www.minecraftwiki.net/wiki/Data_values[/url] for specifics.
- damage=<damage values 0-65535>
- # Damage can also be given as a percentage:
- # damage=0-50%
- #
- # An optional bitmask applied to the item's damage before checking it against
- # the list of eligible damage values. Examples,
- # Match any Fire Resistance potion:
- # damage=3
- # damageMask=15
- # Match any non-splash Fire Resistance potion:
- # damage=3
- # damageMask=16399
- # Match non-splash Fire Resistance I potion only:
- # damage=3
- # damageMask=16447
- # Match splash Fire Resistance II potion only:
- # damage=16403
- # damageMask=16447
- # For a simpler way to do potions, see the section at the end of this file.
- damageMask=<bitmask>
- # (Optional) List of stack sizes. Use the replacement texture only when the
- # stack size is a certain value or range.
- stackSize=<stack sizes 0-65535>
- # (Optional) List of enchantment names.
- # The enchantment names may be short ("flame") or full ("minecraft:flame").
- # For example:
- # enchantments=minecraft:silk_touch sharpness smite
- # The legacy property "enchantmentIDs" is also recognized.
- enchantments=<enchantment names>
- # (Optional) List of enchantment levels.
- enchantmentLevels=<enchantment levels 0-255>
- # (Optional) Hand
- # Hand in which the item is rendered (main hand, off hand)
- # When rendered in the GUI the item is considered to be in the main hand.
- # Default is "any"
- hand=any|main|off
- # Examples:
- # Match Silk Touch, any level:
- # enchantmentIDs=33
- # Match Flame or Fire Aspect, level 3 or higher:
- # enchantmentIDs=flame minecraft:fire_aspect
- # enchantmentLevels=3-
- # Match any enchantment, with 8-10 total levels across all enchantments:
- # enchantmentLevels=8-10
- # (Optional) NBT-based rule. Use the replacement texture only when an NBT tag
- # has a specific value. If multiple rules are provided, all of them must
- # match. Use a utility like NBTExplorer to view the NBT tags for various
- # items.
- nbt.<tag>=<value>
- # Currently, only the following NBT types are supported:
- # - String, Integer, Short, Long, Double, Float - match exact value only
- # - Compound - Can match a specific tag or any tag (*).
- # - List - Can match a specific index (starting at 0) or any index (*).
- # A value starting with "!" performs a negative match (not).
- # Integer values can also be specified as hex color, for example #ff99cc.
- # The list size is named "count".
复制代码 |
那么,这些具体讲的是啥捏,我接下来会简单的讲解一下 但是首先得准备一个 properties 文件 就是txt文档然后改个后缀名然后用Notepad打开
①锁定物品类型 Item为物品贴图、Enchantment为附魔、 Armor为铠甲贴图、Elytra为翅翼贴图 *此贴主要为type=item
- type=<item | enchantment | armor | elytra>
复制代码*必须填写
②锁定物品ID 物品ID支持数字ID和英文ID
注意一定一定一定不要大写字母和中文 需将代码和材质放入同一文件夹 仅需填写材质名即可!
⑤检测主副手 any为任何手,main为主手,off为副手
默认为any
⑥先后权重 此代码不是很常用 用处是一个物品同时被两个贴图所替换的先后顺序 数值越大越优先 但是某一些场合我会用到 比如 Skillapi技能图标
*默认数值是 0
|
*接下来到我们的主要部分* *运用Name改变物品材质*
①基础Name检测代码
这一条代表检测物品的名字 *只有名字为 123 时才会改变材质
②Pattern检测代码 - nbt.display.Name=pattern:A123*
复制代码*检测名字为 A123... 的物品
如 A123456, A123 0987
不检测 a123, 不检测 a12345, 不检测 1 A123,
同时我们也可以这样写 - nbt.display.Name=pattern:*A123*
复制代码
这样可以使得检测方式变为这样
1A1234,AAA123
*意思为名字中含有A123的都会被修改材质
同时还可以这样玩 - nbt.display.Name=pattern:*A*B*
复制代码
这样的话捏,你就会发现一个神奇的事情 你的物品名字可以这样写 111A222B333 ③Ipattern检测代码 - nbt.display.Name=ipattern:Abc*
复制代码
这串代码和pattern非常非常非常的相似 *但是最大的不同就在于--它不区分大小写 这是我常用这串的原因 同样上面可以怎么玩,它也能怎么玩
④Regex/Iregex检测代码 - nbt.display.Name=regex:Aa (BB|cc).*
- nbt.display.Name=iregex:Aa (bb|CC).*
复制代码
这其实是两串不同的代码,但是我觉得他们只是有些微的区别,所以放在了一起讲。首先这是两个非常重要的代码(我的第二常用代码),他能同时进行多种检测。第一行,检测字符为 Aa BB* 或 Aa cc*, 这就是这个代码的神奇之处,我们可以利用这个代码来达成多个代码的用途。而这两个检测的区别就在于,regex为不包含大小写,iregex为包含大小写。括号内的用法:填空题→ ( | | | | | | | ). 注意最后还有一个点。错误用法: ( | ) 没有加点的后果你们可以试试看,反正我试过了。这个代码运用会非常非常非常非常重要,如果需要同一个材质多次使用,这个代码必须得活用。
|
示-例① - type=item
- matchItems=276
- texture=1
- nbt.display.Name=123
复制代码类型为 物品, ID是 钻石剑, 材质名字为 1, 检测名字是 123 的物品
|
示-例② - type=item
- matchItems=160
- texture=1
- nbt.display.Name=ipattern:*123*
复制代码类型为 物品, ID是 玻璃板, 材质名字为 1, 检测名字中含有 123 的物品
此处是运用在Skillapi的技能图标上,技能名称为123,所以能直接修改技能贴图。但是我想让技能升到满级后,改变技能图标,变得更帅,咋办咧?
此处需要在同一文件夹内新建一个properties文件! - type=item
- matchItems=160
- texture=2
- nbt.display.Name=ipattern:*123*5/5*
复制代码类型为 物品, ID是 玻璃板, 材质名字为 2, 检测名字中含有 123 和 5/5 的物品
Q:为什么这样就能改变呢? -因为 我的 Skillapi的技能名字在后面有 (5/5) 代表技能等级与最大等级,此处技能最大等级我设置为5,此代码检测技能名字与最大等级是否相同,相同则修改材质贴图。
Q:那不会材质重复吗? -请注意看,此处我运用了weight代码,weight可以使得两个材质不发生冲突,从而达到替换材质的效果。
|
根据Name修改材质部分 - 完
|