update textures #2
This commit is contained in:
parent
a3ceadd0ff
commit
3c7f2cf874
62 changed files with 83 additions and 99 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue