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

My model has a binded texture and when I press a button from my gui class I want it to rebind the texture

I'll be just as concise as you are.

 

Use an event for your binded key. Set a value with that. Take that value with a switch and bind the texture you want.

Just make sure you open & close your matrix/tessellator/... in each statement.

  • Author

I'll be just as concise as you are.

 

Use an event for your binded key. Set a value with that. Take that value with a switch and bind the texture you want.

Just make sure you open & close your matrix/tessellator/... in each statement.

 

I'm sorry, I dont know what you mean

What part do you not understand? Also, post your code.

Check out my mod, Realms of Chaos, here.

 

If I helped you, be sure to press the "Thank You" button!

  • Author

What part do you not understand? Also, post your code.

 

@Override
public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float f) {
	TileEntityTelevision cannonTile = (TileEntityTelevision)tileentity;
    	int direction = tileentity.getWorldObj().getBlockMetadata(tileentity.xCoord, tileentity.yCoord, tileentity.zCoord);
    	if (direction == 3) direction = 1;
    	else if (direction == 1) direction = 3;
    	else if (direction == 0) direction = 2;
    	else if (direction == 2) direction = 0;
	GL11.glPushMatrix();
    GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
    
    
   
    if(Television.combinedLocation.exists()){
    	 this.bindTexture(combinedTexture);
    } else {
    	this.bindTexture(texture);
    }
    
    GL11.glPushMatrix();
	GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F);
	GL11.glRotatef(direction * 90.0F, 0.0F, 1.0F, 0.0F);
	this.model.renderAll();
	GL11.glPopMatrix();
	GL11.glPopMatrix();

	}
	}

 

So, I basically want to rerun this method when I press a button

  • Author

That method is run every frame anyways, so there is no point in running in manually.

 

Well, when I press a button on my gui the texture changes, but the texture doesnt update in game, unless I reset the game. How do I make the texture update without reseting the game?

  • Author
public static ResourceLocation combinedTexture = new ResourceLocation("tvmod:textures/blocks/combined.png");

if(Television.combinedLocation.exists()){
    	 this.bindTexture(combinedTexture);
    }

  • Author

What is

Television.combinedLocation

? What does the exists method do?

Telvision.combinedLocation is a file linking to textures/blocks/combined.png

  • Author

Then I have no idea what you are doing there... Under which conditions should the texture change?

Ok, so you have the combined texture. So then when I press a button in the gui the combined texture changes into two combined textures. But when it does change, it doesnt change ingame, unless I reset the game that is

  • Author

To do things from a Gui you'll need to send packets to change the data on the server.

 

How would I handle the packet from within the bindTexture method?

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.