Posted December 8, 20186 yr I'm having problems with rendering my custom chest using animated texture. I'm using TESR with code from ender chest. The problem is that TileEntitySpecialRenderer#bindTexture() doesn't support animated textures. I also tried adding my texture to the TextureMap but I don't know how to use AtlasSprite in this renderer. Any help would be appreciated. Here is my TileEntitySpecialRenderer: Spoiler package com.d4rsorc.ultimatestorage.tile; import com.d4rsorc.ultimatestorage.UltimateStorage; import net.minecraft.client.model.ModelChest; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) public class TESRUltimateChest extends TileEntitySpecialRenderer<TileEntityInfiniteStorage> { private static final ResourceLocation ULTIMATE_CHEST_TEXTURE = new ResourceLocation(UltimateStorage.MODID + ":textures/blocks/ultimate_chest.png"); private final ModelChest modelChest = new ModelChest(); public void render(TileEntityInfiniteStorage te, double x, double y, double z, float partialTicks, int destroyStage, float alpha) { int i = 0; if (te.hasWorld()) { i = te.getBlockMetadata(); } if (destroyStage >= 0) { this.bindTexture(DESTROY_STAGES[destroyStage]); GlStateManager.matrixMode(5890); GlStateManager.pushMatrix(); GlStateManager.scale(4.0F, 4.0F, 1.0F); GlStateManager.translate(0.0625F, 0.0625F, 0.0625F); GlStateManager.matrixMode(5888); } else { this.bindTexture(ULTIMATE_CHEST_TEXTURE); } GlStateManager.pushMatrix(); GlStateManager.enableRescaleNormal(); GlStateManager.color(1.0F, 1.0F, 1.0F, alpha); GlStateManager.translate((float)x, (float)y + 1.0F, (float)z + 1.0F); GlStateManager.scale(1.0F, -1.0F, -1.0F); GlStateManager.translate(0.5F, 0.5F, 0.5F); int j = 0; if (i == 2) { j = 180; } if (i == 3) { j = 0; } if (i == 4) { j = 90; } if (i == 5) { j = -90; } GlStateManager.rotate((float)j, 0.0F, 1.0F, 0.0F); GlStateManager.translate(-0.5F, -0.5F, -0.5F); float f = te.prevLidAngle + (te.lidAngle - te.prevLidAngle) * partialTicks; f = 1.0F - f; f = 1.0F - f * f * f; this.modelChest.chestLid.rotateAngleX = -(f * ((float)Math.PI / 2F)); this.modelChest.renderAll(); GlStateManager.disableRescaleNormal(); GlStateManager.popMatrix(); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); if (destroyStage >= 0) { GlStateManager.matrixMode(5890); GlStateManager.popMatrix(); GlStateManager.matrixMode(5888); } } }
December 8, 20186 yr Author Yea, I tried that and that's what I got: Spoiler If I bind the global texture map I need somehow get only the part where my texture is. The only solution I can think of rn is to split my animation into single frames and bind different texture corresponding to frame I want to render.
December 9, 20186 yr Author I know that, but apparently UV coords are no use in java-code model, which I use. Anyway, thanks for trying to help.
December 9, 20186 yr Author Oh, thank you so much. I changed texture coordinates in every ModelBox and now it works perfectly. Thanks a lot.
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.