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

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.

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.

  • Author

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.

  • Author

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

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.