Jump to content

Recommended Posts

Posted

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.

Posted

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.

Posted

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.

Posted

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.

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

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

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