diff --git a/client/src/main/java/client/renderer/blockmodel/ModelBakery.java b/client/src/main/java/client/renderer/blockmodel/ModelBakery.java index 9f725ca6..4d317222 100755 --- a/client/src/main/java/client/renderer/blockmodel/ModelBakery.java +++ b/client/src/main/java/client/renderer/blockmodel/ModelBakery.java @@ -30,9 +30,8 @@ public abstract class ModelBakery "blocks/destroy_stage_2", "blocks/destroy_stage_3", "blocks/destroy_stage_4", "blocks/destroy_stage_5", "blocks/destroy_stage_6", "blocks/destroy_stage_7", - "blocks/destroy_stage_8", "blocks/destroy_stage_9", - "items/empty_armor_slot_helmet", "items/empty_armor_slot_chestplate", - "items/empty_armor_slot_leggings", "items/empty_armor_slot_boots"); + "blocks/destroy_stage_8", "blocks/destroy_stage_9" + ); protected static final String MISSING = "builtin/missing"; public static final ModelBlock MODEL_GENERATED = (ModelBlock)new ModelBlock(null).add().d(""); public static final ModelBlock MODEL_ENTITY = (ModelBlock)new ModelBlock(null).add().d(""); diff --git a/client/src/main/java/client/renderer/entity/RenderHorse.java b/client/src/main/java/client/renderer/entity/RenderHorse.java index 879509aa..b3160562 100755 --- a/client/src/main/java/client/renderer/entity/RenderHorse.java +++ b/client/src/main/java/client/renderer/entity/RenderHorse.java @@ -49,7 +49,7 @@ public class RenderHorse extends RenderLiving */ protected String getEntityTexture(EntityHorse entity) { - if (!entity.func_110239_cn()) + if (!entity.hasSpecificTexture()) { switch (entity.getHorseType()) { @@ -66,15 +66,15 @@ public class RenderHorse extends RenderLiving } else { - return this.func_110848_b(entity); + return this.loadHorseTexture(entity); } } - private String func_110848_b(EntityHorse horse) + private String loadHorseTexture(EntityHorse horse) { String s = horse.getHorseTexture(); - if (!horse.func_175507_cI()) + if (!horse.hasValidTexture()) { return null; } diff --git a/client/src/main/java/client/renderer/model/ModelHorse.java b/client/src/main/java/client/renderer/model/ModelHorse.java index 9dc1003c..bea368f0 100755 --- a/client/src/main/java/client/renderer/model/ModelHorse.java +++ b/client/src/main/java/client/renderer/model/ModelHorse.java @@ -124,12 +124,12 @@ public class ModelHorse extends ModelBase this.setBoxRotation(this.head, 0.5235988F, 0.0F, 0.0F); this.field_178711_b = new ModelRenderer(this, 24, 18); this.field_178711_b.addBox(-2.0F, -10.0F, -7.0F, 4, 3, 6); - this.field_178711_b.setRotationPoint(0.0F, 3.95F, -10.0F); - this.setBoxRotation(this.field_178711_b, 0.5235988F, 0.0F, 0.0F); + this.field_178711_b.setRotationPoint(0.0F, 0.02F, 0.02F); + this.setBoxRotation(this.field_178711_b, 0.0F, 0.0F, 0.0F); this.field_178712_c = new ModelRenderer(this, 24, 27); this.field_178712_c.addBox(-2.0F, -7.0F, -6.5F, 4, 2, 5); - this.field_178712_c.setRotationPoint(0.0F, 4.0F, -10.0F); - this.setBoxRotation(this.field_178712_c, 0.5235988F, 0.0F, 0.0F); + this.field_178712_c.setRotationPoint(0.0F, 0.0F, 0.0F); + this.setBoxRotation(this.field_178712_c, 0.0F, 0.0F, 0.0F); this.head.addChild(this.field_178711_b); this.head.addChild(this.field_178712_c); this.horseLeftEar = new ModelRenderer(this, 0, 0); @@ -211,14 +211,14 @@ public class ModelHorse extends ModelBase public void render(Entity entityIn, float p_78088_2_, float p_78088_3_, float p_78088_4_, float p_78088_5_, float p_78088_6_, float scale) { EntityHorse entityhorse = (EntityHorse)entityIn; - int i = entityhorse.getHorseType(); - float f = entityhorse.getGrassEatingAmount(0.0F); - boolean flag = entityhorse.isAdultHorse(); - boolean flag1 = flag && entityhorse.isHorseSaddled(); - boolean flag2 = flag && entityhorse.isChested(); + int i = entityhorse == null ? 0 : entityhorse.getHorseType(); + float f = entityhorse == null ? 0.0f :entityhorse.getGrassEatingAmount(0.0F); + boolean flag = entityhorse == null || entityhorse.isAdultHorse(); + boolean flag1 = flag && (entityhorse == null || entityhorse.isHorseSaddled()); + boolean flag2 = flag && entityhorse != null && entityhorse.isChested(); boolean flag3 = i == 1 || i == 2; - float f1 = entityhorse.getHorseSize(); - boolean flag4 = entityhorse.passenger != null; + float f1 = entityhorse == null ? 0.5f : entityhorse.getHorseSize(); + boolean flag4 = entityhorse != null && entityhorse.passenger != null; if (flag1) { diff --git a/client/src/main/java/client/renderer/tileentity/TileEntityItemStackRenderer.java b/client/src/main/java/client/renderer/tileentity/TileEntityItemStackRenderer.java index 412dcd4a..6245ff4c 100755 --- a/client/src/main/java/client/renderer/tileentity/TileEntityItemStackRenderer.java +++ b/client/src/main/java/client/renderer/tileentity/TileEntityItemStackRenderer.java @@ -2,15 +2,19 @@ package client.renderer.tileentity; import org.lwjgl.opengl.GL11; +import client.Client; import client.renderer.GlState; import client.renderer.layers.LayerArmor; +import client.renderer.model.ModelHorse; import common.block.tech.BlockChest; import common.block.tile.BlockSign; import common.block.tile.BlockStandingSign; import common.entity.types.EntityLiving; +import common.init.ItemRegistry; import common.item.ItemStack; import common.item.block.ItemSign; import common.item.tool.ItemArmor; +import common.item.tool.ItemHorseArmor; import common.tileentity.TileEntityChest; import common.tileentity.TileEntitySign; import common.util.Facing; @@ -46,15 +50,18 @@ public class TileEntityItemStackRenderer { return ((ItemArmor)TileEntityItemStackRenderer.this.stack.getItem()).armorType.getIndex() == armorSlot ? TileEntityItemStackRenderer.this.stack : null; } }; + private final ModelHorse horse = new ModelHorse(); public void renderByItem(ItemStack stack) { if(stack.getItem() != null && stack.getItem().getBlock() instanceof BlockChest chest) { this.state = chest.getState().withProperty(BlockChest.FACING, Facing.SOUTH); TileEntityRendererDispatcher.instance.renderTileEntityAt(this.chest, 0.0D, 0.0D, 0.0D, 0.0F); + this.state = null; } else if(stack.getItem() instanceof ItemSign sign) { this.state = sign.getBlock().getState().withProperty(BlockStandingSign.ROTATION, 8); TileEntityRendererDispatcher.instance.renderTileEntityAt(this.sign, 0.0D, 0.0D, 0.0D, 0.0F); + this.state = null; } else if(stack.getItem() instanceof ItemArmor armor) { this.stack = stack; @@ -84,6 +91,21 @@ public class TileEntityItemStackRenderer { if(cull) GlState.enableCull(); GL11.glPopMatrix(); + this.stack = null; + } + else if(stack.getItem() instanceof ItemHorseArmor horseArmor) { + GL11.glPushMatrix(); + GL11.glTranslatef(0.9f, 0.5f, 0.0f); + GL11.glRotatef(180.0f, 0.0f, 1.0f, 0.0f); + GL11.glScalef(0.85f, -0.85f, 0.85f); + boolean cull = GlState.isCullEnabled(); + if(cull) + GlState.disableCull(); + Client.CLIENT.getTextureManager().bindTexture("textures/armor/" + horseArmor.getArmorTexture() + "_horse.png"); + this.horse.render(null, 0, 0, 0, 0, 0, 0.0625F); + if(cull) + GlState.enableCull(); + GL11.glPopMatrix(); } } } diff --git a/client/src/main/resources/textures/armor/horse_armor_diamond.png b/client/src/main/resources/textures/armor/diamond_horse.png similarity index 100% rename from client/src/main/resources/textures/armor/horse_armor_diamond.png rename to client/src/main/resources/textures/armor/diamond_horse.png diff --git a/client/src/main/resources/textures/armor/horse_armor_gold.png b/client/src/main/resources/textures/armor/gold_horse.png similarity index 100% rename from client/src/main/resources/textures/armor/horse_armor_gold.png rename to client/src/main/resources/textures/armor/gold_horse.png diff --git a/client/src/main/resources/textures/armor/horse_armor_iron.png b/client/src/main/resources/textures/armor/iron_horse.png similarity index 100% rename from client/src/main/resources/textures/armor/horse_armor_iron.png rename to client/src/main/resources/textures/armor/iron_horse.png diff --git a/client/src/main/resources/textures/items/ardite_boots.png b/client/src/main/resources/textures/items/ardite_boots.png deleted file mode 100755 index 9ec91961..00000000 Binary files a/client/src/main/resources/textures/items/ardite_boots.png and /dev/null differ diff --git a/client/src/main/resources/textures/items/ardite_chestplate.png b/client/src/main/resources/textures/items/ardite_chestplate.png deleted file mode 100755 index 6c198429..00000000 Binary files a/client/src/main/resources/textures/items/ardite_chestplate.png and /dev/null differ diff --git a/client/src/main/resources/textures/items/ardite_helmet.png b/client/src/main/resources/textures/items/ardite_helmet.png deleted file mode 100755 index c74ed533..00000000 Binary files a/client/src/main/resources/textures/items/ardite_helmet.png and /dev/null differ diff --git a/client/src/main/resources/textures/items/ardite_leggings.png b/client/src/main/resources/textures/items/ardite_leggings.png deleted file mode 100755 index b5313578..00000000 Binary files a/client/src/main/resources/textures/items/ardite_leggings.png and /dev/null differ diff --git a/client/src/main/resources/textures/items/chain_boots.png b/client/src/main/resources/textures/items/chain_boots.png deleted file mode 100755 index 54a4a159..00000000 Binary files a/client/src/main/resources/textures/items/chain_boots.png and /dev/null differ diff --git a/client/src/main/resources/textures/items/chain_chestplate.png b/client/src/main/resources/textures/items/chain_chestplate.png deleted file mode 100755 index cd2115a9..00000000 Binary files a/client/src/main/resources/textures/items/chain_chestplate.png and /dev/null differ diff --git a/client/src/main/resources/textures/items/chain_helmet.png b/client/src/main/resources/textures/items/chain_helmet.png deleted file mode 100755 index a1433387..00000000 Binary files a/client/src/main/resources/textures/items/chain_helmet.png and /dev/null differ diff --git a/client/src/main/resources/textures/items/chain_leggings.png b/client/src/main/resources/textures/items/chain_leggings.png deleted file mode 100755 index dae4b266..00000000 Binary files a/client/src/main/resources/textures/items/chain_leggings.png and /dev/null differ diff --git a/client/src/main/resources/textures/items/cloth_boots.png b/client/src/main/resources/textures/items/cloth_boots.png deleted file mode 100755 index 84d8fd95..00000000 Binary files a/client/src/main/resources/textures/items/cloth_boots.png and /dev/null differ diff --git a/client/src/main/resources/textures/items/cloth_boots_overlay.png b/client/src/main/resources/textures/items/cloth_boots_overlay.png deleted file mode 100755 index 4a1d868a..00000000 Binary files a/client/src/main/resources/textures/items/cloth_boots_overlay.png and /dev/null differ diff --git a/client/src/main/resources/textures/items/cloth_chestplate.png b/client/src/main/resources/textures/items/cloth_chestplate.png deleted file mode 100755 index e534aefc..00000000 Binary files a/client/src/main/resources/textures/items/cloth_chestplate.png and /dev/null differ diff --git a/client/src/main/resources/textures/items/cloth_chestplate_overlay.png b/client/src/main/resources/textures/items/cloth_chestplate_overlay.png deleted file mode 100755 index 6fa801fb..00000000 Binary files a/client/src/main/resources/textures/items/cloth_chestplate_overlay.png and /dev/null differ diff --git a/client/src/main/resources/textures/items/cloth_helmet.png b/client/src/main/resources/textures/items/cloth_helmet.png deleted file mode 100755 index 6daf551e..00000000 Binary files a/client/src/main/resources/textures/items/cloth_helmet.png and /dev/null differ diff --git a/client/src/main/resources/textures/items/cloth_helmet_overlay.png b/client/src/main/resources/textures/items/cloth_helmet_overlay.png deleted file mode 100755 index e8a0625e..00000000 Binary files a/client/src/main/resources/textures/items/cloth_helmet_overlay.png and /dev/null differ diff --git a/client/src/main/resources/textures/items/cloth_leggings.png b/client/src/main/resources/textures/items/cloth_leggings.png deleted file mode 100755 index fc38cf28..00000000 Binary files a/client/src/main/resources/textures/items/cloth_leggings.png and /dev/null differ diff --git a/client/src/main/resources/textures/items/cloth_leggings_overlay.png b/client/src/main/resources/textures/items/cloth_leggings_overlay.png deleted file mode 100755 index 22598f0a..00000000 Binary files a/client/src/main/resources/textures/items/cloth_leggings_overlay.png and /dev/null differ diff --git a/client/src/main/resources/textures/items/diamond_boots.png b/client/src/main/resources/textures/items/diamond_boots.png deleted file mode 100755 index 70d9e5f8..00000000 Binary files a/client/src/main/resources/textures/items/diamond_boots.png and /dev/null differ diff --git a/client/src/main/resources/textures/items/diamond_chestplate.png b/client/src/main/resources/textures/items/diamond_chestplate.png deleted file mode 100755 index afdff93e..00000000 Binary files a/client/src/main/resources/textures/items/diamond_chestplate.png and /dev/null differ diff --git a/client/src/main/resources/textures/items/diamond_helmet.png b/client/src/main/resources/textures/items/diamond_helmet.png deleted file mode 100755 index 1c885924..00000000 Binary files a/client/src/main/resources/textures/items/diamond_helmet.png and /dev/null differ diff --git a/client/src/main/resources/textures/items/diamond_horse_armor.png b/client/src/main/resources/textures/items/diamond_horse_armor.png deleted file mode 100755 index b281aadd..00000000 Binary files a/client/src/main/resources/textures/items/diamond_horse_armor.png and /dev/null differ diff --git a/client/src/main/resources/textures/items/diamond_leggings.png b/client/src/main/resources/textures/items/diamond_leggings.png deleted file mode 100755 index a99c8967..00000000 Binary files a/client/src/main/resources/textures/items/diamond_leggings.png and /dev/null differ diff --git a/client/src/main/resources/textures/items/empty_armor_slot_boots.png b/client/src/main/resources/textures/items/empty_armor_slot_boots.png deleted file mode 100755 index fd7e05fa..00000000 Binary files a/client/src/main/resources/textures/items/empty_armor_slot_boots.png and /dev/null differ diff --git a/client/src/main/resources/textures/items/empty_armor_slot_chestplate.png b/client/src/main/resources/textures/items/empty_armor_slot_chestplate.png deleted file mode 100755 index 6e632b9d..00000000 Binary files a/client/src/main/resources/textures/items/empty_armor_slot_chestplate.png and /dev/null differ diff --git a/client/src/main/resources/textures/items/empty_armor_slot_helmet.png b/client/src/main/resources/textures/items/empty_armor_slot_helmet.png deleted file mode 100755 index 3a455f3f..00000000 Binary files a/client/src/main/resources/textures/items/empty_armor_slot_helmet.png and /dev/null differ diff --git a/client/src/main/resources/textures/items/empty_armor_slot_leggings.png b/client/src/main/resources/textures/items/empty_armor_slot_leggings.png deleted file mode 100755 index 28b2c494..00000000 Binary files a/client/src/main/resources/textures/items/empty_armor_slot_leggings.png and /dev/null differ diff --git a/client/src/main/resources/textures/items/gold_boots.png b/client/src/main/resources/textures/items/gold_boots.png deleted file mode 100755 index f6033d25..00000000 Binary files a/client/src/main/resources/textures/items/gold_boots.png and /dev/null differ diff --git a/client/src/main/resources/textures/items/gold_chestplate.png b/client/src/main/resources/textures/items/gold_chestplate.png deleted file mode 100755 index e36076ad..00000000 Binary files a/client/src/main/resources/textures/items/gold_chestplate.png and /dev/null differ diff --git a/client/src/main/resources/textures/items/gold_helmet.png b/client/src/main/resources/textures/items/gold_helmet.png deleted file mode 100755 index 9eb89a0c..00000000 Binary files a/client/src/main/resources/textures/items/gold_helmet.png and /dev/null differ diff --git a/client/src/main/resources/textures/items/gold_horse_armor.png b/client/src/main/resources/textures/items/gold_horse_armor.png deleted file mode 100755 index 7c5c3a59..00000000 Binary files a/client/src/main/resources/textures/items/gold_horse_armor.png and /dev/null differ diff --git a/client/src/main/resources/textures/items/gold_leggings.png b/client/src/main/resources/textures/items/gold_leggings.png deleted file mode 100755 index da237713..00000000 Binary files a/client/src/main/resources/textures/items/gold_leggings.png and /dev/null differ diff --git a/client/src/main/resources/textures/items/iron_boots.png b/client/src/main/resources/textures/items/iron_boots.png deleted file mode 100755 index b69ca05c..00000000 Binary files a/client/src/main/resources/textures/items/iron_boots.png and /dev/null differ diff --git a/client/src/main/resources/textures/items/iron_chestplate.png b/client/src/main/resources/textures/items/iron_chestplate.png deleted file mode 100755 index e7993ce1..00000000 Binary files a/client/src/main/resources/textures/items/iron_chestplate.png and /dev/null differ diff --git a/client/src/main/resources/textures/items/iron_helmet.png b/client/src/main/resources/textures/items/iron_helmet.png deleted file mode 100755 index 65e64cc5..00000000 Binary files a/client/src/main/resources/textures/items/iron_helmet.png and /dev/null differ diff --git a/client/src/main/resources/textures/items/iron_horse_armor.png b/client/src/main/resources/textures/items/iron_horse_armor.png deleted file mode 100755 index 5d697d17..00000000 Binary files a/client/src/main/resources/textures/items/iron_horse_armor.png and /dev/null differ diff --git a/client/src/main/resources/textures/items/iron_leggings.png b/client/src/main/resources/textures/items/iron_leggings.png deleted file mode 100755 index ad536739..00000000 Binary files a/client/src/main/resources/textures/items/iron_leggings.png and /dev/null differ diff --git a/client/src/main/resources/textures/items/leather_boots.png b/client/src/main/resources/textures/items/leather_boots.png deleted file mode 100755 index eecca820..00000000 Binary files a/client/src/main/resources/textures/items/leather_boots.png and /dev/null differ diff --git a/client/src/main/resources/textures/items/leather_boots_overlay.png b/client/src/main/resources/textures/items/leather_boots_overlay.png deleted file mode 100755 index 4a1d868a..00000000 Binary files a/client/src/main/resources/textures/items/leather_boots_overlay.png and /dev/null differ diff --git a/client/src/main/resources/textures/items/leather_chestplate.png b/client/src/main/resources/textures/items/leather_chestplate.png deleted file mode 100755 index d11e2fd2..00000000 Binary files a/client/src/main/resources/textures/items/leather_chestplate.png and /dev/null differ diff --git a/client/src/main/resources/textures/items/leather_chestplate_overlay.png b/client/src/main/resources/textures/items/leather_chestplate_overlay.png deleted file mode 100755 index 6fa801fb..00000000 Binary files a/client/src/main/resources/textures/items/leather_chestplate_overlay.png and /dev/null differ diff --git a/client/src/main/resources/textures/items/leather_helmet.png b/client/src/main/resources/textures/items/leather_helmet.png deleted file mode 100755 index 5f90fc06..00000000 Binary files a/client/src/main/resources/textures/items/leather_helmet.png and /dev/null differ diff --git a/client/src/main/resources/textures/items/leather_helmet_overlay.png b/client/src/main/resources/textures/items/leather_helmet_overlay.png deleted file mode 100755 index e8a0625e..00000000 Binary files a/client/src/main/resources/textures/items/leather_helmet_overlay.png and /dev/null differ diff --git a/client/src/main/resources/textures/items/leather_leggings.png b/client/src/main/resources/textures/items/leather_leggings.png deleted file mode 100755 index 12203228..00000000 Binary files a/client/src/main/resources/textures/items/leather_leggings.png and /dev/null differ diff --git a/client/src/main/resources/textures/items/leather_leggings_overlay.png b/client/src/main/resources/textures/items/leather_leggings_overlay.png deleted file mode 100755 index 22598f0a..00000000 Binary files a/client/src/main/resources/textures/items/leather_leggings_overlay.png and /dev/null differ diff --git a/client/src/main/resources/textures/items/nichun_boots.png b/client/src/main/resources/textures/items/nichun_boots.png deleted file mode 100755 index 0755025b..00000000 Binary files a/client/src/main/resources/textures/items/nichun_boots.png and /dev/null differ diff --git a/client/src/main/resources/textures/items/nichun_chestplate.png b/client/src/main/resources/textures/items/nichun_chestplate.png deleted file mode 100755 index 1da9d891..00000000 Binary files a/client/src/main/resources/textures/items/nichun_chestplate.png and /dev/null differ diff --git a/client/src/main/resources/textures/items/nichun_helmet.png b/client/src/main/resources/textures/items/nichun_helmet.png deleted file mode 100755 index 23fd4171..00000000 Binary files a/client/src/main/resources/textures/items/nichun_helmet.png and /dev/null differ diff --git a/client/src/main/resources/textures/items/nichun_leggings.png b/client/src/main/resources/textures/items/nichun_leggings.png deleted file mode 100755 index df7722f1..00000000 Binary files a/client/src/main/resources/textures/items/nichun_leggings.png and /dev/null differ diff --git a/client/src/main/resources/textures/items/sign.png b/client/src/main/resources/textures/items/sign.png deleted file mode 100755 index 8ce0708d..00000000 Binary files a/client/src/main/resources/textures/items/sign.png and /dev/null differ diff --git a/client/src/main/resources/textures/items/thetium_boots.png b/client/src/main/resources/textures/items/thetium_boots.png deleted file mode 100755 index a6f0540b..00000000 Binary files a/client/src/main/resources/textures/items/thetium_boots.png and /dev/null differ diff --git a/client/src/main/resources/textures/items/thetium_chestplate.png b/client/src/main/resources/textures/items/thetium_chestplate.png deleted file mode 100755 index 2f706771..00000000 Binary files a/client/src/main/resources/textures/items/thetium_chestplate.png and /dev/null differ diff --git a/client/src/main/resources/textures/items/thetium_helmet.png b/client/src/main/resources/textures/items/thetium_helmet.png deleted file mode 100755 index 7536212b..00000000 Binary files a/client/src/main/resources/textures/items/thetium_helmet.png and /dev/null differ diff --git a/client/src/main/resources/textures/items/thetium_leggings.png b/client/src/main/resources/textures/items/thetium_leggings.png deleted file mode 100755 index dbf82eba..00000000 Binary files a/client/src/main/resources/textures/items/thetium_leggings.png and /dev/null differ diff --git a/common/src/main/java/common/entity/animal/EntityHorse.java b/common/src/main/java/common/entity/animal/EntityHorse.java index 67bce8ac..f1af09e4 100755 --- a/common/src/main/java/common/entity/animal/EntityHorse.java +++ b/common/src/main/java/common/entity/animal/EntityHorse.java @@ -20,6 +20,7 @@ import common.entity.npc.EntityNPC; import common.entity.types.EntityAnimal; import common.entity.types.EntityLiving; import common.init.Blocks; +import common.init.ItemRegistry; import common.init.Items; import common.init.SoundEvent; import common.inventory.IInvBasic; @@ -27,6 +28,7 @@ import common.inventory.InventoryBasic; import common.item.Item; import common.item.ItemStack; import common.item.spawner.ItemMobTemplate; +import common.item.tool.ItemHorseArmor; import common.pathfinding.PathNavigateGround; import common.tags.TagObject; import java.util.List; @@ -45,9 +47,6 @@ public class EntityHorse extends EntityAnimal implements IInvBasic return p_apply_1_ instanceof EntityHorse && ((EntityHorse)p_apply_1_).isBreeding(); } }; - private static final String[] horseArmorTextures = new String[] {null, "textures/armor/horse_armor_iron.png", "textures/armor/horse_armor_gold.png", "textures/armor/horse_armor_diamond.png"}; - private static final String[] HORSE_ARMOR_TEXTURES_ABBR = new String[] {"", "meo", "goo", "dio"}; - private static final int[] armorValues = new int[] {0, 5, 7, 11}; private static final String[] horseTextures = new String[] {"textures/creature/horse_white.png", "textures/creature/horse_creamy.png", "textures/creature/horse_chestnut.png", "textures/creature/horse_brown.png", "textures/creature/horse_black.png", "textures/creature/horse_gray.png", "textures/creature/horse_darkbrown.png"}; private static final String[] HORSE_TEXTURES_ABBR = new String[] {"hwh", "hcr", "hch", "hbr", "hbl", "hgr", "hdb"}; private static final String[] horseMarkingTextures = new String[] {null, "textures/creature/horse_markings_white.png", "textures/creature/horse_markings_whitefield.png", "textures/creature/horse_markings_whitedots.png", "textures/creature/horse_markings_blackdots.png"}; @@ -78,7 +77,7 @@ public class EntityHorse extends EntityAnimal implements IInvBasic private int gallopTime; private String texturePrefix; private String[] horseTexturesArray = new String[3]; - private boolean field_175508_bO = false; + private boolean validTexture = false; public EntityHorse(World worldIn) { @@ -262,28 +261,10 @@ public class EntityHorse extends EntityAnimal implements IInvBasic return this.getHorseWatchableBoolean(8); } - /** - * Returns type of armor from DataWatcher (0 = iron, 1 = gold, 2 = diamond) - */ - public int getHorseArmorIndexSynced() + public ItemHorseArmor getHorseArmorItem() { - return this.dataWatcher.getWatchableObjectInt(22); - } - - /** - * 0 = iron, 1 = gold, 2 = diamond - */ - private int getHorseArmorIndex(ItemStack itemStackIn) - { - if (itemStackIn == null) - { - return 0; - } - else - { - Item item = itemStackIn.getItem(); - return item == Items.iron_horse_armor ? 1 : (item == Items.gold_horse_armor ? 2 : (item == Items.diamond_horse_armor ? 3 : 0)); - } + Item item = ItemRegistry.byId(this.dataWatcher.getWatchableObjectInt(22)); + return item instanceof ItemHorseArmor armor ? armor : null; } public boolean isEatingHaystack() @@ -306,12 +287,9 @@ public class EntityHorse extends EntityAnimal implements IInvBasic return this.hasReproduced; } - /** - * Set horse armor stack (for example: new ItemStack(Items.iron_horse_armor)) - */ public void setHorseArmorStack(ItemStack itemStackIn) { - this.dataWatcher.updateObject(22, Integer.valueOf(this.getHorseArmorIndex(itemStackIn))); + this.dataWatcher.updateObject(22, itemStackIn != null && itemStackIn.getItem() instanceof ItemHorseArmor armor ? ItemRegistry.getId(armor) : 0); this.resetTexturePrefix(); } @@ -366,7 +344,8 @@ public class EntityHorse extends EntityAnimal implements IInvBasic */ public int getTotalArmorValue() { - return armorValues[this.getHorseArmorIndexSynced()]; + ItemHorseArmor armor = this.getHorseArmorItem(); + return armor != null ? armor.getArmorValue() : 0; } /** @@ -689,9 +668,9 @@ public class EntityHorse extends EntityAnimal implements IInvBasic return 400; } - public boolean func_110239_cn() + public boolean hasSpecificTexture() { - return this.getHorseType() == 0 || this.getHorseArmorIndexSynced() > 0; + return this.getHorseType() == 0 || this.getHorseArmorItem() != null; } private void resetTexturePrefix() @@ -699,9 +678,9 @@ public class EntityHorse extends EntityAnimal implements IInvBasic this.texturePrefix = null; } - public boolean func_175507_cI() + public boolean hasValidTexture() { - return this.field_175508_bO; + return this.validTexture; } private void setHorseTexturePaths() @@ -720,7 +699,7 @@ public class EntityHorse extends EntityAnimal implements IInvBasic if (k >= horseTextures.length) { - this.field_175508_bO = false; + this.validTexture = false; return; } @@ -729,7 +708,7 @@ public class EntityHorse extends EntityAnimal implements IInvBasic if (l >= horseMarkingTextures.length) { - this.field_175508_bO = false; + this.validTexture = false; return; } @@ -742,18 +721,19 @@ public class EntityHorse extends EntityAnimal implements IInvBasic this.texturePrefix = this.texturePrefix + "_" + i + "_"; } - int i1 = this.getHorseArmorIndexSynced(); + ItemHorseArmor i1 = this.getHorseArmorItem(); - if (i1 >= horseArmorTextures.length) - { - this.field_175508_bO = false; - } - else - { - this.horseTexturesArray[2] = horseArmorTextures[i1]; - this.texturePrefix = this.texturePrefix + HORSE_ARMOR_TEXTURES_ABBR[i1]; - this.field_175508_bO = true; - } +// if (i1 >= horseArmorTextures.length) +// { +// this.field_175508_bO = false; +// } +// else +// { + this.horseTexturesArray[2] = i1 == null ? null : "textures/armor/" + i1.getArmorTexture() + "_horse.png"; + if(i1 != null) + this.texturePrefix = this.texturePrefix + i1.getArmorTexture(); + this.validTexture = true; +// } } public String getHorseTexture() @@ -816,22 +796,7 @@ public class EntityHorse extends EntityAnimal implements IInvBasic if (this.canWearArmor()) { - int i = -1; - - if (itemstack.getItem() == Items.iron_horse_armor) - { - i = 1; - } - else if (itemstack.getItem() == Items.gold_horse_armor) - { - i = 2; - } - else if (itemstack.getItem() == Items.diamond_horse_armor) - { - i = 3; - } - - if (i >= 0) + if (itemstack.getItem() instanceof ItemHorseArmor) { if (!this.isTame()) { @@ -1757,7 +1722,7 @@ public class EntityHorse extends EntityAnimal implements IInvBasic */ public static boolean isArmorItem(Item p_146085_0_) { - return p_146085_0_ == Items.iron_horse_armor || p_146085_0_ == Items.gold_horse_armor || p_146085_0_ == Items.diamond_horse_armor; + return p_146085_0_ instanceof ItemHorseArmor; } /** diff --git a/common/src/main/java/common/item/tool/ItemArmor.java b/common/src/main/java/common/item/tool/ItemArmor.java index ca36c059..e076896d 100755 --- a/common/src/main/java/common/item/tool/ItemArmor.java +++ b/common/src/main/java/common/item/tool/ItemArmor.java @@ -14,7 +14,6 @@ import common.item.Item; import common.item.ItemStack; import common.model.Model; import common.model.ModelProvider; -import common.model.Transform; import common.tileentity.TileEntity; import common.util.BlockPos; import common.util.BoundingBox; @@ -24,23 +23,8 @@ import common.world.World; public class ItemArmor extends Item { -// public static final String[] EMPTY_SLOT_NAMES = new String[] {"items/empty_armor_slot_helmet", "items/empty_armor_slot_chestplate", "items/empty_armor_slot_leggings", "items/empty_armor_slot_boots"}; - - /** - * Stores the armor type: 0 is helmet, 1 is plate, 2 is legs and 3 is boots - */ public final UsageSlot armorType; - - /** Holds the amount of damage that the armor reduces at full durability. */ public final int damageReduceAmount; - - /** - * Used on RenderPlayer to select the correspondent armor to be rendered on the player: 0 is cloth, 1 is chain, 2 is - * iron, 3 is diamond and 4 is gold. - */ -// public final int renderIndex; - - /** The EnumArmorMaterial used for this ItemArmor */ private final ToolMaterial material; private final String texture; @@ -49,7 +33,6 @@ public class ItemArmor extends Item this.material = material; this.texture = texture; this.armorType = armorType; -// this.renderIndex = renderIndex; this.damageReduceAmount = material.getDamageReduction(armorType); this.setMaxDamage(material.getDurability(armorType)); this.setTab(CheatTab.ARMOR); diff --git a/common/src/main/java/common/item/tool/ItemHorseArmor.java b/common/src/main/java/common/item/tool/ItemHorseArmor.java index 84406435..3c0e8341 100755 --- a/common/src/main/java/common/item/tool/ItemHorseArmor.java +++ b/common/src/main/java/common/item/tool/ItemHorseArmor.java @@ -1,8 +1,11 @@ package common.item.tool; +import common.attributes.UsageSlot; import common.init.ToolMaterial; import common.item.CheatTab; import common.item.Item; +import common.model.Model; +import common.model.ModelProvider; public class ItemHorseArmor extends Item { private final ToolMaterial material; @@ -15,7 +18,19 @@ public class ItemHorseArmor extends Item { this.setTab(CheatTab.ARMOR); } + public int getArmorValue() { + return this.material.getDamageReduction(UsageSlot.BODY); + } + + public String getArmorTexture() { + return this.texture; + } + public boolean isMagnetic() { return this.material.isMagnetic(); } + + public Model getModel(ModelProvider provider, String name) { + return provider.getModel(provider.getEntityModel(), this.getTransform()); + } }