Jump to content

[1.8][TESR]Change Texture of Tile Entity Based on Property


AnZaNaMa

Recommended Posts

So, I have a tile entity called TileEntityEnergizer and I have a TESR that renders it just fine, but I want to have it change the texture based on the isMultiblock() and getMultiblockSize() properties of my TileEntityEnergizer. For some reason, when I print out isMultiblock() and getMultiblockSize() from the TESR, they end up with values they never should have, such as 0 for getMultiblockSize(). I know that the method updateTileEntityAt() is passing me a TileEntityEnergizer because I had it check it and it worked. I'm not sure why im not getting the correct values from my methods...

 

TESR:

https://github.com/AnZaNaMa/ExpTools/blob/master/src/main/java/com/AnZaNaMa/ExpTools/Entity/TileEntity/EnergyToolsTESR.java

 

TileEntityEnergizer:

https://github.com/AnZaNaMa/ExpTools/blob/master/src/main/java/com/AnZaNaMa/ExpTools/Entity/TileEntity/TileEntityEnergizer.java

- Just because things are the way they are doesn't mean they can't be the way you want them to be. Unless they're aspen trees. You can tell they're aspens 'cause the way they are.

Link to comment
Share on other sites

if(some_value == something) {
  //bind texture 1
}
else {
  //bind texture 2
}

 

Now then, here's your code.

 

 if(tileEntity instanceof TileEntityEnergizer){ //this should be true
  TileEntityEnergizer energizer = (TileEntityEnergizer)tileEntity;
  LogHelper.info(energizer.getMultiplier()); //lets just not do anything useful with this value
  image = new ResourceLocation(Reference.MODID + ":textures/blocks/energizer.png"); //bind texture 1
}
else{ //this will never happen
  image = new ResourceLocation(Reference.MODID + ":textures/blocks/energizer.png"); //bind texture 2
}

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.

Link to comment
Share on other sites

oh sorry i changed my code when i was troubleshooting. I originally had

 

if(tileEntity instanceof TileEntityEnergizer){
    TileEntityEnergizer energizer = (TileEntityEnergizer)tileEntity;

    if(energizer.getMultiblockSize() == 3){
        image = new ResourceLocation(Reference.MODID + ":textures/blocks/energizer2.png");
    }

    else if(energizer.getMultiblockSize() == 5){
        image = new ResourceLocation(Reference.MODID + ":textures/blocks/energizer3.png");
    }

    else if(energizer.getMultiblockSize() == 7){
        image = new ResourceLocation(Reference.MODID + ":textures/blocks/energizer4.png");
    }

    else{
        image = new ResourceLocation(Reference.MODID + ":textures/blocks/energizer.png");
    }
}

- Just because things are the way they are doesn't mean they can't be the way you want them to be. Unless they're aspen trees. You can tell they're aspens 'cause the way they are.

Link to comment
Share on other sites

thanks diesieben and GreyGhost. I used the tutorial on the forge wiki to sync client and server and got it working.

- Just because things are the way they are doesn't mean they can't be the way you want them to be. Unless they're aspen trees. You can tell they're aspens 'cause the way they are.

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



×
×
  • Create New...

Important Information

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