<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="zh-Hans-CN">
	<id>https://mcbbs.wiki/index.php?action=history&amp;feed=atom&amp;title=%E7%94%A8%E6%88%B7%3AMashKJo%2F1.12.2%E6%A8%A1%E7%BB%84%E5%BC%80%E5%8F%91%E6%95%99%E7%A8%8B%2F15.%E9%AB%98%E7%BA%A7%E7%89%A9%E5%93%81%EF%BC%88%E4%B8%89%EF%BC%89_-_%E7%9B%94%E7%94%B2</id>
	<title>用户:MashKJo/1.12.2模组开发教程/15.高级物品（三） - 盔甲 - 版本历史</title>
	<link rel="self" type="application/atom+xml" href="https://mcbbs.wiki/index.php?action=history&amp;feed=atom&amp;title=%E7%94%A8%E6%88%B7%3AMashKJo%2F1.12.2%E6%A8%A1%E7%BB%84%E5%BC%80%E5%8F%91%E6%95%99%E7%A8%8B%2F15.%E9%AB%98%E7%BA%A7%E7%89%A9%E5%93%81%EF%BC%88%E4%B8%89%EF%BC%89_-_%E7%9B%94%E7%94%B2"/>
	<link rel="alternate" type="text/html" href="https://mcbbs.wiki/index.php?title=%E7%94%A8%E6%88%B7:MashKJo/1.12.2%E6%A8%A1%E7%BB%84%E5%BC%80%E5%8F%91%E6%95%99%E7%A8%8B/15.%E9%AB%98%E7%BA%A7%E7%89%A9%E5%93%81%EF%BC%88%E4%B8%89%EF%BC%89_-_%E7%9B%94%E7%94%B2&amp;action=history"/>
	<updated>2026-05-06T06:50:43Z</updated>
	<subtitle>本wiki上该页面的版本历史</subtitle>
	<generator>MediaWiki 1.40.3</generator>
	<entry>
		<id>https://mcbbs.wiki/index.php?title=%E7%94%A8%E6%88%B7:MashKJo/1.12.2%E6%A8%A1%E7%BB%84%E5%BC%80%E5%8F%91%E6%95%99%E7%A8%8B/15.%E9%AB%98%E7%BA%A7%E7%89%A9%E5%93%81%EF%BC%88%E4%B8%89%EF%BC%89_-_%E7%9B%94%E7%94%B2&amp;diff=55039&amp;oldid=prev</id>
		<title>MashKJo：​/* ISpecialArmor */ // Edit via Wikiplus</title>
		<link rel="alternate" type="text/html" href="https://mcbbs.wiki/index.php?title=%E7%94%A8%E6%88%B7:MashKJo/1.12.2%E6%A8%A1%E7%BB%84%E5%BC%80%E5%8F%91%E6%95%99%E7%A8%8B/15.%E9%AB%98%E7%BA%A7%E7%89%A9%E5%93%81%EF%BC%88%E4%B8%89%EF%BC%89_-_%E7%9B%94%E7%94%B2&amp;diff=55039&amp;oldid=prev"/>
		<updated>2025-01-20T15:36:55Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;ISpecialArmor：​&lt;/span&gt; // Edit via Wikiplus&lt;/span&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;zh-Hans-CN&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;←上一版本&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;2025年1月20日 (一) 23:36的版本&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l21&quot;&gt;第21行：&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;第21行：&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   &lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     void damageArmor(EntityLivingBase entity, @Nonnull ItemStack stack, DamageSource source, int damage, int slot);&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     void damageArmor(EntityLivingBase entity, @Nonnull ItemStack stack, DamageSource source, int damage, int slot);&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt; &lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt; &lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     ...&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     ...&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  }&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  }&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;通过实现该接口，我们可以设定：该盔甲的ArmorProperties，穿戴后在HUD中显示的护甲值的多少，等等。&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;通过实现该接口，我们可以设定：该盔甲的ArmorProperties，穿戴后在HUD中显示的护甲值的多少，等等。&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key mcbbs_wiki:diff::1.12:old-55038:rev-55039 --&gt;
&lt;/table&gt;</summary>
		<author><name>MashKJo</name></author>
	</entry>
	<entry>
		<id>https://mcbbs.wiki/index.php?title=%E7%94%A8%E6%88%B7:MashKJo/1.12.2%E6%A8%A1%E7%BB%84%E5%BC%80%E5%8F%91%E6%95%99%E7%A8%8B/15.%E9%AB%98%E7%BA%A7%E7%89%A9%E5%93%81%EF%BC%88%E4%B8%89%EF%BC%89_-_%E7%9B%94%E7%94%B2&amp;diff=55038&amp;oldid=prev</id>
		<title>MashKJo：​创建页面，内容为“== ArmorMaterial == 和武器/工具的类类似，盔甲对应的类ItemArmor的构造方法也需要一个类似于“质地”的东西——ItemArmor.ArmorMaterial。该类同样为枚举类，因此，类似于ToolMaterial，我们这样来构造新的ArmorMaterial：  public static final ItemArmor.ArmorMaterial MY_CUSTOM_ARMOR_MATERIAL = EnumHelper.addArmorMaterial(name, textureName, durability, reductionAmounts, enchantability, soundOnEquip, toughness);…”</title>
		<link rel="alternate" type="text/html" href="https://mcbbs.wiki/index.php?title=%E7%94%A8%E6%88%B7:MashKJo/1.12.2%E6%A8%A1%E7%BB%84%E5%BC%80%E5%8F%91%E6%95%99%E7%A8%8B/15.%E9%AB%98%E7%BA%A7%E7%89%A9%E5%93%81%EF%BC%88%E4%B8%89%EF%BC%89_-_%E7%9B%94%E7%94%B2&amp;diff=55038&amp;oldid=prev"/>
		<updated>2025-01-20T15:36:04Z</updated>

		<summary type="html">&lt;p&gt;创建页面，内容为“== ArmorMaterial == 和武器/工具的类类似，盔甲对应的类ItemArmor的构造方法也需要一个类似于“质地”的东西——ItemArmor.ArmorMaterial。该类同样为枚举类，因此，类似于ToolMaterial，我们这样来构造新的ArmorMaterial：  public static final ItemArmor.ArmorMaterial MY_CUSTOM_ARMOR_MATERIAL = EnumHelper.addArmorMaterial(name, textureName, durability, reductionAmounts, enchantability, soundOnEquip, toughness);…”&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新页面&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== ArmorMaterial ==&lt;br /&gt;
和武器/工具的类类似，盔甲对应的类ItemArmor的构造方法也需要一个类似于“质地”的东西——ItemArmor.ArmorMaterial。该类同样为枚举类，因此，类似于ToolMaterial，我们这样来构造新的ArmorMaterial：&lt;br /&gt;
 public static final ItemArmor.ArmorMaterial MY_CUSTOM_ARMOR_MATERIAL = EnumHelper.addArmorMaterial(name, textureName, durability, reductionAmounts, enchantability, soundOnEquip, toughness);&lt;br /&gt;
&lt;br /&gt;
其中，name应该由小写字母和下划线组成；textureName看似是指代该盔甲穿在玩家身上时的贴图，但实则起到一个充当该ArmorMaterial的唯一标识符的作用，你应该填入&amp;lt;code&amp;gt;&amp;quot;modid:armor_material_name&amp;quot;&amp;lt;/code&amp;gt;；durability即盔甲各部件的耐久值；reductionAmounts是一个长度为4的int数组，用于指定盔甲4个部件各自对伤害的免疫程度，其实就是护甲值；enchantability指盔甲的附魔能力；soundOnEquip是一个SoundEvent参数，用于指定该盔甲被穿上时的音效，关于SoundEvent的知识后续会有专门讲解，你可以先复用原版的SoundEvent，它们均位于SoundEvents类中；toughness指的是盔甲韧性值。&lt;br /&gt;
&lt;br /&gt;
== 创建一套新盔甲 ==&lt;br /&gt;
我们首先看看ItemArmor类的构造方法：&amp;lt;code&amp;gt;(ItemArmor.ArmorMaterial materialIn, int renderIndexIn, EntityEquipmentSlot equipmentSlotIn)&amp;lt;/code&amp;gt;。其中renderIndex在原版中没有任何实际用途，乱填一个就好，而最后一个EntityEquipmentSlot参数代表了它是头盔/胸甲/护腿/靴子中的哪一种。因此，要创建一整套新盔甲，你需要new ItemArmor类或其子类4次。&lt;br /&gt;
&lt;br /&gt;
原版的ItemArmor类的自定义空间几乎为0，不过Forge在Item类中patch了一些专门针对盔甲的方法：&lt;br /&gt;
* &amp;lt;code&amp;gt;void onArmorTick(World world, EntityPlayer player, ItemStack stack)&amp;lt;/code&amp;gt;：这个方法会在盔甲穿上后每一tick都会被调用一次，通常你可以用这个方法来给盔甲加上穿戴药水效果之类的东西。&lt;br /&gt;
* &amp;lt;code&amp;gt;String getArmorTexture(ItemStack stack, Entity entity, EntityEquipmentSlot slot, String type)&amp;lt;/code&amp;gt;：这个方法用于确定盔甲穿在身上对应的纹理，返回一个String，实际上这个String的格式类似于ResourceLocation用于指代具体文件时的格式（且路径被写全了）。例：原版的铁套护腿的材质的路径为&amp;lt;code&amp;gt;assets/minecraft/textures/models/armor/iron_layer_2.png&amp;lt;/code&amp;gt;，那么体现在这里，返回的String应为&amp;lt;code&amp;gt;&amp;quot;minecraft:textures/models/armor/iron_layer_2.png&amp;quot;&amp;lt;/code&amp;gt;。看起来你可以很自由地指定材质文件，实则不然——除非你给盔甲自定义一个新的模型，否则盔甲会自动使用原版默认模型，那么材质文件必须有2份——其中一张包含头盔、胸甲、靴子的贴图，另外一张包含护腿的贴图，且实际的贴图在材质文件中对应的UV坐标有严格限制。因此如果你不指定自定义模型，那么在这里是要判断传入的EntityEquipmentSlot，并根据情况返回2个路径；至于材质文件，你基本上只能在原版的基础上修改。&lt;br /&gt;
* &amp;lt;code&amp;gt;ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack stack, EntityEquipmentSlot armorSlot, ModelBiped _default)&amp;lt;/code&amp;gt;：这个方法用于给盔甲指定自定义模型，指定后我们就可以自由地根据自己的需求调整材质文件的方方面面了。注意到返回一个ModelBiped，它实际上是ModelBase的子类，关于ModelBase的相关知识，详见后续教程内容。&lt;br /&gt;
&lt;br /&gt;
=== ISpecialArmor ===&lt;br /&gt;
Forge提供了一个接口：ISpecialArmor，通过让我们的ItemArmor子类实现该接口，就能实现对盔甲各方面属性的更精细的调控。该接口有一个静态内部类：ArmorProperties，主要用于阐明盔甲的伤害吸收能力。&lt;br /&gt;
 public interface ISpecialArmor{&lt;br /&gt;
    ArmorProperties getProperties(EntityLivingBase player, @Nonnull ItemStack armor, DamageSource source, double damage, int slot);&lt;br /&gt;
 &lt;br /&gt;
    int getArmorDisplay(EntityPlayer player, @Nonnull ItemStack armor, int slot);&lt;br /&gt;
 &lt;br /&gt;
    void damageArmor(EntityLivingBase entity, @Nonnull ItemStack stack, DamageSource source, int damage, int slot);&lt;br /&gt;
&lt;br /&gt;
    ...&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
通过实现该接口，我们可以设定：该盔甲的ArmorProperties，穿戴后在HUD中显示的护甲值的多少，等等。&lt;/div&gt;</summary>
		<author><name>MashKJo</name></author>
	</entry>
</feed>