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

I have this animation setup in the special renderer and it checks for changes in some variables to see if it should render it. But it only begins to render the animation when opening the GUI. I am sending the variables with a message and I'm also marking the block for update. I've searched around but i can't find the problem.

Show your rendering code

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

Here it is.  :D

@SideOnly(Side.CLIENT)
public class RendererWashingTable extends TileEntitySpecialRenderer<TileEntityWashingTable>
{
private static final ResourceLocation WATER_TEXTURE = new ResourceLocation("textures/blocks/water_still.png");

public void renderTileEntityAt(TileEntityWashingTable tileEntity, double x, double y, double z, float f, int destroyStage)
{
	GL11.glPushMatrix();
        GL11.glTranslated((float)x + 0.5f,  y, (float)z + 0.5f);
        GL11.glScaled(0.5f, 0.5f, 0.5f);
        this.bindTexture(WATER_TEXTURE);
        renderWater(tileEntity);
        GL11.glPopMatrix();
}

public void renderWater(TileEntityWashingTable tileEntityWashingTable)
    {
	int deviceWashTime = tileEntityWashingTable.getDeviceWashTime();
	int waterAvailable = tileEntityWashingTable.getWaterAvailable();

	if(deviceWashTime > 0)
    	{			
    	final double[] beginVertices = {0.75, 2};
    	final double[] midVertices = {0.75, 1.875};
    	final double[] endVertices = {0.125, 1.5};
    	
    	double x ;
    	double y ;
    	
    	double a = (endVertices[1]-midVertices[1]/endVertices[0]-midVertices[0]);
    	double b = (endVertices[0]*midVertices[1]-endVertices[1]*midVertices[0]/endVertices[0]-midVertices[0]);
    	
    	double washScale = (100 - (double)tileEntityWashingTable.getDeviceWashTime())/ 100;
    	
    	double height = beginVertices[1] - endVertices[1];
    	
    	y = beginVertices[1] - (height * washScale);
    	
    	if(y <= midVertices[1] && y >= endVertices[1])
    	{
    		x = Math.abs((y-b)/a);
    	}
    	else
    	{
    		x = beginVertices[0];	
    	}
        
    	RenderHelper.disableStandardItemLighting();
    	
    	GL11.glEnable(GL11.GL_BLEND);
    	GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    	
    	GL11.glBegin(GL11.GL_TRIANGLES);
    		GL11.glTexCoord2d(0, 0);
			GL11.glVertex3d(x, y, x);
			GL11.glTexCoord2d(0, 0.0234375);
    			GL11.glVertex3d(x, y, -x);
    			GL11.glTexCoord2d(0.75, 0);
    			GL11.glVertex3d(-x, y, x);
    			GL11.glTexCoord2d(0.75, 0);
    			GL11.glVertex3d(-x, y, x);
    			GL11.glTexCoord2d(0, 0.0234375);
    			GL11.glVertex3d(x, y, -x);
    			GL11.glTexCoord2d(0.75, 0.0234375);
    			GL11.glVertex3d(-x, y, -x);
    			
    			GL11.glTexCoord2d(0, 0);
    			GL11.glVertex3d(0.125, 1.5, 0.125);
    			GL11.glTexCoord2d(0.125, 0);
    			GL11.glVertex3d(-0.125, 1.5, 0.125);
    			GL11.glTexCoord2d(0, 0.03125);
    			GL11.glVertex3d(0.125, 0.125, 0.125);
    			GL11.glTexCoord2d(0, 0.03125);
    			GL11.glVertex3d(0.125, 0.125, 0.125);
    			GL11.glTexCoord2d(0.125, 0);
    			GL11.glVertex3d(-0.125, 1.5, 0.125);
    			GL11.glTexCoord2d(0.125, 0.03125);
    			GL11.glVertex3d(-0.125, 0.125, 0.125);
    			
    			GL11.glTexCoord2d(0, 0);
    			GL11.glVertex3d(0.125, 1.5, 0.125);
    			GL11.glTexCoord2d(0, 0.03125);
    			GL11.glVertex3d(0.125, 0.125, 0.125);
    			GL11.glTexCoord2d(0.125, 0);
    			GL11.glVertex3d(0.125, 1.5, -0.125);
    			GL11.glTexCoord2d(0, 0.03125);
    			GL11.glVertex3d(0.125, 0.125, 0.125);
    			GL11.glTexCoord2d(0.125, 0.03125);
    			GL11.glVertex3d(0.125, 0.125, -0.125);
    			GL11.glTexCoord2d(0.125, 0);
    			GL11.glVertex3d(0.125, 1.5, -0.125);
    			
    			GL11.glTexCoord2d(0, 0);
    			GL11.glVertex3d(-0.125, 1.5, -0.125);
    			GL11.glTexCoord2d(0.125, 0);
    			GL11.glVertex3d(0.125, 1.5, -0.125);
    			GL11.glTexCoord2d(0, 0.03125);
    			GL11.glVertex3d(-0.125, 0.125, -0.125);
    			GL11.glTexCoord2d(0, 0.03125);
    			GL11.glVertex3d(-0.125, 0.125, -0.125);
    			GL11.glTexCoord2d(0.125, 0);
    			GL11.glVertex3d(0.125, 1.5, -0.125);
    			GL11.glTexCoord2d(0.125, 0.03125);
    			GL11.glVertex3d(0.125, 0.125, -0.125);
    			
    			GL11.glTexCoord2d(0, 0);
    			GL11.glVertex3d(-0.125, 1.5, -0.125);
    			GL11.glTexCoord2d(0, 0.03125);
    			GL11.glVertex3d(-0.125, 0.125, -0.125);
    			GL11.glTexCoord2d(0.125, 0);
    			GL11.glVertex3d(-0.125, 1.5, 0.125);
    			GL11.glTexCoord2d(0, 0.03125);
    			GL11.glVertex3d(-0.125, 0.125, -0.125);
    			GL11.glTexCoord2d(0.125, 0.03125);
    			GL11.glVertex3d(-0.125, 0.125, 0.125);
    			GL11.glTexCoord2d(0.125, 0);
    			GL11.glVertex3d(-0.125, 1.5, 0.125);
    			
    		GL11.glTexCoord2d(0, 0);
			GL11.glVertex3d(0.625, 0.125+(height * washScale) , 0.625);
			GL11.glTexCoord2d(0, 0.01953125);
    			GL11.glVertex3d(0.625, 0.125+(height * washScale), -0.625);
    			GL11.glTexCoord2d(0.625, 0);
    			GL11.glVertex3d(-0.625, 0.125+(height * washScale), 0.625);
    			GL11.glTexCoord2d(0.625, 0);
    			GL11.glVertex3d(-0.625, 0.125+(height * washScale), 0.625);
    			GL11.glTexCoord2d(0, 0.01953125);
    			GL11.glVertex3d(0.625, 0.125+(height * washScale), -0.625);
    			GL11.glTexCoord2d(0.625, 0.01953125);
    			GL11.glVertex3d(-0.625, 0.125+(height * washScale), -0.625);
    		GL11.glEnd();
    		
    		GL11.glDisable(GL11.GL_BLEND);
    		
    		RenderHelper.enableStandardItemLighting();
    	}

	if(waterAvailable == 3)
	{
		RenderHelper.disableStandardItemLighting();
    	
    	GL11.glEnable(GL11.GL_BLEND);
    	GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    	
    	GL11.glBegin(GL11.GL_TRIANGLES);
    		GL11.glTexCoord2d(0, 0);
			GL11.glVertex3d(0.625, 0.625, 0.625);
			GL11.glTexCoord2d(0, 0.01953125);
			GL11.glVertex3d(0.625, 0.625, -0.625);
			GL11.glTexCoord2d(0.625, 0);
			GL11.glVertex3d(-0.625, 0.625, 0.625);
			GL11.glTexCoord2d(0.625, 0);
			GL11.glVertex3d(-0.625, 0.625, 0.625);
			GL11.glTexCoord2d(0, 0.01953125);
			GL11.glVertex3d(0.625, 0.625, -0.625);
			GL11.glTexCoord2d(0.625, 0.01953125);
			GL11.glVertex3d(-0.625, 0.625, -0.625);
		GL11.glEnd();

		GL11.glDisable(GL11.GL_BLEND);

		RenderHelper.enableStandardItemLighting();
	}
    }
}

I bet the value returned by getDeviceWashTime() is only calculated server side and synced south detectAndSemdChanges()

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

Found the problem, i am still really confused. I changed a value on the client side only in onBlockActivated when i do it for both it works. But i don't know why it doesn't want to sync when server side only or client side only because i send a message when updating.

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.