update textures #2

This commit is contained in:
Sen 2025-07-19 18:06:14 +02:00
parent a3ceadd0ff
commit 3c7f2cf874
Signed by: sen
GPG key ID: 3AC50A6F47D1B722
62 changed files with 83 additions and 99 deletions

View file

@ -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("");

View file

@ -49,7 +49,7 @@ public class RenderHorse extends RenderLiving<EntityHorse>
*/
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<EntityHorse>
}
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;
}

View file

@ -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)
{

View file

@ -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();
}
}
}

View file

Before

Width:  |  Height:  |  Size: 5.1 KiB

After

Width:  |  Height:  |  Size: 5.1 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 5 KiB

After

Width:  |  Height:  |  Size: 5 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 4.9 KiB

After

Width:  |  Height:  |  Size: 4.9 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 163 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 193 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 169 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 166 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 182 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 154 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 175 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 140 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 461 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 136 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 111 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 112 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 110 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 102 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 154 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 175 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 141 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 430 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 136 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 154 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 172 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 141 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 404 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 136 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

View file

@ -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;
}
/**

View file

@ -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);

View file

@ -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());
}
}