Résolu TESR, la texture ne s'affiche pas.
-
Bonjour! Donc, mon problème est assez simple, la texture de mon TESR ne s’affiche pas, j’ai vérifier le lien de mon image plusieurs fois. J’ai aussi vérifier sa présence sur ecplise comme précisé dans le tutoriel vidéo mais rien…
Screenshots
Model
:::
Model:package diabolicatrix.base.models; import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; public class ModelReinforcedChest extends ModelBase { ModelRenderer Bottom; ModelRenderer Top; ModelRenderer Lock; ModelRenderer Skull; public ModelReinforcedChest() { textureWidth = 128; textureHeight = 128; Bottom = new ModelRenderer(this, 0, 0); Bottom.addBox(0F, 0F, 0F, 14, 10, 14); Bottom.setRotationPoint(-7F, 14F, -7F); Bottom.setTextureSize(128, 128); Bottom.mirror = true; setRotation(Bottom, 0F, 0F, 0F); Top = new ModelRenderer(this, 0, 45); Top.addBox(0F, 0F, 0F, 14, 4, 14); Top.setRotationPoint(-7F, 10F, -7F); Top.setTextureSize(128, 128); Top.mirror = true; setRotation(Top, 0F, 0F, 0F); Lock = new ModelRenderer(this, 0, 74); Lock.addBox(6F, 2F, -1F, 2, 4, 1); Lock.setRotationPoint(-7F, 10F, -7F); Lock.setTextureSize(128, 128); Lock.mirror = true; setRotation(Lock, 0F, 0F, 0F); Skull = new ModelRenderer(this, 0, 30); Skull.addBox(3F, -1F, 3F, 8, 2, 8); Skull.setRotationPoint(-7F, 10F, -7F); Skull.setTextureSize(128, 128); Skull.mirror = true; setRotation(Skull, 0F, 0F, 0F); } public void renderAll() { Bottom.render(0.0625F); Top.render(0.0625F); Lock.render(0.0625F); Skull.render(0.0625F); } private void setRotation(ModelRenderer model, float x, float y, float z) { model.rotateAngleX = x; model.rotateAngleY = y; model.rotateAngleZ = z; } }
:::
#Tile Entity(Tile Entity)
:::
Tile Entity:package diabolicatrix.base.tileentity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.tileentity.TileEntity; import net.minecraftforge.common.util.Constants; public class TileEntityBlockChest extends TileEntity implements IInventory { private ItemStack[] contents = new ItemStack[27]; private String customName; @Override public void readFromNBT(NBTTagCompound compound) { super.readFromNBT(compound); if (compound.hasKey("CustomName", Constants.NBT.TAG_STRING)) { this.customName = compound.getString("CustomName"); } NBTTagList nbttaglist = compound.getTagList("Items", 10); this.contents = new ItemStack[this.getSizeInventory()]; for (int i = 0; i < nbttaglist.tagCount(); ++i) { NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i); int j = nbttagcompound1.getByte("Slot") & 255; if (j >= 0 && j < this.contents.length) { this.contents[j] = ItemStack.loadItemStackFromNBT(nbttagcompound1); } } } @Override public void writeToNBT(NBTTagCompound compound) { super.writeToNBT(compound); NBTTagList nbttaglist = new NBTTagList(); for (int i = 0; i < this.contents.length; ++i) { if (this.contents* != null) { NBTTagCompound nbttagcompound1 = new NBTTagCompound(); nbttagcompound1.setByte("Slot", (byte)i); this.contents*.writeToNBT(nbttagcompound1); nbttaglist.appendTag(nbttagcompound1); } } compound.setTag("Items", nbttaglist); if (this.hasCustomInventoryName()) { compound.setString("CustomName", this.customName); } } @Override public int getSizeInventory() { return this.contents.length; } @Override public ItemStack getStackInSlot(int slotIndex) { return this.contents[slotIndex]; } @Override public ItemStack decrStackSize(int slotIndex, int amount) { if (this.contents[slotIndex] != null) { ItemStack itemstack; if (this.contents[slotIndex].stackSize <= amount) { itemstack = this.contents[slotIndex]; this.contents[slotIndex] = null; this.markDirty(); return itemstack; } else { itemstack = this.contents[slotIndex].splitStack(amount); if (this.contents[slotIndex].stackSize == 0) { this.contents[slotIndex] = null; } this.markDirty(); return itemstack; } } else { return null; } } @Override public ItemStack getStackInSlotOnClosing(int slotIndex) { if (this.contents[slotIndex] != null) { ItemStack itemstack = this.contents[slotIndex]; this.contents[slotIndex] = null; return itemstack; } else { return null; } } @Override public void setInventorySlotContents(int slotIndex, ItemStack stack) { this.contents[slotIndex] = stack; if (stack != null && stack.stackSize > this.getInventoryStackLimit()) { stack.stackSize = this.getInventoryStackLimit(); } this.markDirty(); } @Override public String getInventoryName() { return this.hasCustomInventoryName() ? this.customName : "tile.testchest"; } @Override public boolean hasCustomInventoryName() { return this.customName != null && !this.customName.isEmpty(); } public void setCustomName(String customName) { this.customName = customName; } @Override public int getInventoryStackLimit() { return 64; } @Override public boolean isUseableByPlayer(EntityPlayer player) { return this.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord) != this ? false : player.getDistanceSq((double)this.xCoord + 0.5D, (double)this.yCoord + 0.5D, (double)this.zCoord + 0.5D) <= 64.0D; } @Override public void openInventory() {} @Override public void closeInventory() {} @Override public boolean isItemValidForSlot(int slotIndex, ItemStack stack) { return true; } }
:::
#Tile Entity Special Renderer(Tile Entity Special Renderer)
:::
Tile Entity Special Renderer:package diabolicatrix.base.proxy; import org.lwjgl.opengl.GL11; import diabolicatrix.base.Base; import diabolicatrix.base.models.ModelReinforcedChest; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntityChest; import net.minecraft.util.ResourceLocation; public class TileEntityChestSpecialRenderer extends TileEntitySpecialRenderer { public static ModelReinforcedChest model = new ModelReinforcedChest(); private ResourceLocation textures = new ResourceLocation("t4", "textures/models/blocks/netherchest.png"); @Override public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float partialRenderTick) { this.renderTileEntityChestAt((TileEntityChest)tile, x, y, z, partialRenderTick); } private void renderTileEntityChestAt(TileEntityChest tile, double x, double y, double z, float partialRenderTick) { GL11.glPushMatrix(); GL11.glTranslated(x, y + 1.5F, z); this.bindTexture(this.textures); GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); model.renderAll(); GL11.glPopMatrix(); } }
:::
Block
:::
Block:package diabolicatrix.base.block; import diabolicatrix.base.Base; import diabolicatrix.base.tileentity.TileEntityBlockChest; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntityChest; import net.minecraft.util.MathHelper; import net.minecraft.world.World; public class BlockTestChest extends Block { public BlockTestChest(Material material) { super(material); } @Override public TileEntity createTileEntity(World world, int metadata) { return new TileEntityBlockChest(); } @Override public boolean hasTileEntity(int metadata) { return true; } public void breakBlock(World world, int x, int y, int z, Block block, int metadata) { TileEntity tileentity = world.getTileEntity(x, y, z); if (tileentity instanceof IInventory) { IInventory inv = (IInventory)tileentity; for (int i1 = 0; i1 < inv.getSizeInventory(); ++i1) { ItemStack itemstack = inv.getStackInSlot(i1); if (itemstack != null) { float f = world.rand.nextFloat() * 0.8F + 0.1F; float f1 = world.rand.nextFloat() * 0.8F + 0.1F; EntityItem entityitem; for (float f2 = world.rand.nextFloat() * 0.8F + 0.1F; itemstack.stackSize > 0; world.spawnEntityInWorld(entityitem)) { int j1 = world.rand.nextInt(21) + 10; if (j1 > itemstack.stackSize) { j1 = itemstack.stackSize; } itemstack.stackSize -= j1; entityitem = new EntityItem(world, (double)((float)x + f), (double)((float)y + f1), (double)((float)z + f2), new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage())); float f3 = 0.05F; entityitem.motionX = (double)((float)world.rand.nextGaussian() * f3); entityitem.motionY = (double)((float)world.rand.nextGaussian() * f3 + 0.2F); entityitem.motionZ = (double)((float)world.rand.nextGaussian() * f3); if (itemstack.hasTagCompound()) { entityitem.getEntityItem().setTagCompound((NBTTagCompound)itemstack.getTagCompound().copy()); } } } } world.func_147453_f(x, y, z, block); } super.breakBlock(world, x, y, z, block, metadata); } public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase living, ItemStack stack) { if(stack.getItemDamage() == 0) { TileEntity tile = world.getTileEntity(x, y, z); if(tile instanceof TileEntityBlockChest) { if(stack.hasDisplayName()) { ((TileEntityBlockChest)tile).setCustomName(stack.getDisplayName()); } } } } public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { if (world.isRemote) { return true; } else { player.openGui(Base.instance, 0, world, x, y, z); return true; } } public boolean isOpaqueCube() { return false; } public boolean renderAsNormalBlock() { return false; } public int getRenderType() { return -1; } }
:::
-
Ce n’est pas un problème de texture, c’est tout le rendu qui ne se fait pas. Tu l’as bien enregistré dans le client proxy ?
-
Ah l’erreuur de merde… En regardant dans mon Client Proxy j’ai remarqué que la premier paramètre était TileEntityChest(celui de minecraft) et non TileEntityBlockChest(le mien), pareil pour mon cast dans le TESR… Merci pour ton aide!
-
Il faut mettre la balise résolu si ton problème est résolu.