Jump to content

[1.8.9] Animation only updates when opening GUI


Laseph

Recommended Posts

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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();
	}
    }
}

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.