Posted December 26, 201410 yr Hi, I have a block with a single model and two textures. One texture is for when the slot is filled with an item. The other is for when the slot is empty. When i try to change the texture resource location for the model it changes the textures for all the blocks. I tried a packetHandler but it seems that changing the resource location inside the Renderer is only ever going to change all the blocks. Here is my renderer class without all the different attempts. Please leave your suggestions or solutions Thank You public class SandFilterRenderer extends TileEntitySpecialRenderer { private ModelSandFilter model; public static boolean renderFilter; public SandFilterRenderer () { model = new ModelSandFilter(); } @Override public void renderTileEntityAt(TileEntity tileEnt, double x, double y, double z, float scale) { World world = tileEnt.getWorldObj(); GL11.glPushMatrix(); GL11.glTranslatef((float) x, (float) y, (float) z); TileEntitySandFilter tileEntityBlock = (TileEntitySandFilter) world.getTileEntity((int) x, (int) y, (int) z); //FMLClientHandler.instance().getClient().renderEngine.bindTexture(ModelSandFilter.TEXTURE); renderBlock(tileEntityBlock, tileEnt.getWorldObj(), tileEnt.xCoord, tileEnt.yCoord, tileEnt.zCoord, ModBlocks.sandFilter); GL11.glPopMatrix(); } @SuppressWarnings({"cast"}) public void renderBlock(TileEntitySandFilter tileSand, World world, int x, int y,int z, Block block) { tileSand = (TileEntitySandFilter) world.getTileEntity(x, y, z); Tessellator tessellator = Tessellator.instance; float f = block.getLightOpacity(world, x, y, z); int l = world.getLightBrightnessForSkyBlocks(x, y, z, 0); int l1 = l % 65536; int l2 = l / 65536; tessellator.setColorOpaque_F(f, f, f); OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit,(float) l1, (float) l2); GL11.glPushMatrix(); float scale = 0.8F; GL11.glScalef(scale, scale-0.05F, scale); GL11.glTranslatef(0.62F,0.58F,0.62F); FMLClientHandler.instance().getClient().renderEngine.bindTexture(ModelSandFilter.TEXTURE); this.model.render(); GL11.glPopMatrix(); } }
December 26, 201410 yr Sounds like you need a public String getModelTexture(...) { } method! Because it's not a static method, the TE instance has the properties (world, position, etc) already necessary to figure out what its own texture should be. Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
December 26, 201410 yr Author Sounds like you need a public String getModelTexture(...) { } method! Because it's not a static method, the TE instance has the properties (world, position, etc) already necessary to figure out what its own texture should be. Im half following you here. Should I put the getterMethod in the SandFilterRenderer renderBlock() ? Also when i do get the texture to bind do i use the FMLClientHandler.instance().getClient().renderEngine.bindTexture(TEXTURE); to bind it. Or should i set the texture another way?
December 26, 201410 yr No, inside your TileEntity. Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
December 26, 201410 yr Author Yea, Draco i think i'm gonna need it spelled out a little more =/ I've been beating my head at this for two days now. I might not thinking as clearly as usual. I tried using a getTexture method but its not writing the texture from the TileEntity class I really dont know anymore. The only solution i can think of is making a different block when the filterItem is used on the sandFilterBlock. But that shouldn't be necessary.
December 27, 201410 yr What does your TE class look like? Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
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.