Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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

}

 

}

 

 

Sounds like you need a

public String getModelTexture(...) { }

method! :D

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.

  • Author

Sounds like you need a

public String getModelTexture(...) { }

method! :D

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?

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.

  • 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.

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.