Jump to content

Recommended Posts

Posted

I've got every part of my furnace working except for the fire and smoke particles. I've copied across the vanilla furnace randomDisplayTick method and changed it to match my custom furnace, but they just wont spawn. I added a print to one of the directions and its show random numbers as it should, also the tile entity isn't throwing a null exception so it can't be related to the world variable either as that is used to access the tile entity.

 

Here's the method:

// Random Display Tick:
@Override
@SideOnly(Side.CLIENT)
public void randomDisplayTick(World world, int x, int y, int z, Random random) {
	TileEntityMachine tileEntity = (TileEntityMachine) world.getBlockTileEntity(x, y, z);
        if(tileEntity.isActive()) {
        	float zPos = (float)z + 0.5F;
        float yPos = (float)y + 0.0F + random.nextFloat() * 6.0F / 16.0F;
        float xPos = (float)z + 0.5F;
        float fixed = 0.52F;
        float random2 = random.nextFloat() * 0.6F - 0.3F;

        switch(tileEntity.facing) {
        	case 2:
        		world.spawnParticle("smoke", (double)(zPos + random2), (double)yPos, (double)(xPos - fixed), 0.0D, 0.0D, 0.0D);
	            world.spawnParticle("flame", (double)(zPos + random2), (double)yPos, (double)(xPos - fixed), 0.0D, 0.0D, 0.0D);
	            System.out.println(random2);
	            break;
        	case 3:
        		world.spawnParticle("smoke", (double)(zPos + random2), (double)yPos, (double)(xPos + fixed), 0.0D, 0.0D, 0.0D);
	            world.spawnParticle("flame", (double)(zPos + random2), (double)yPos, (double)(xPos + fixed), 0.0D, 0.0D, 0.0D);
	            break;
        	case 4:
        		world.spawnParticle("smoke", (double)(zPos - fixed), (double)yPos, (double)(xPos + random2), 0.0D, 0.0D, 0.0D);
	            world.spawnParticle("flame", (double)(zPos - fixed), (double)yPos, (double)(xPos + random2), 0.0D, 0.0D, 0.0D);
	            break;
        	case 5:
        		world.spawnParticle("smoke", (double)(zPos + fixed), (double)yPos, (double)(xPos + random2), 0.0D, 0.0D, 0.0D);
	            world.spawnParticle("flame", (double)(zPos + fixed), (double)yPos, (double)(xPos + random2), 0.0D, 0.0D, 0.0D);
	            break;
        }
        }
    }

 

And some of the random numbers that are continuously printed from case 2:

2013-02-01 18:39:04 [iNFO] [sTDOUT] 4.042685E-4

2013-02-01 18:39:04 [iNFO] [sTDOUT] -0.29456174

2013-02-01 18:39:04 [iNFO] [sTDOUT] -0.079445824

2013-02-01 18:39:05 [iNFO] [sTDOUT] 0.2750967

2013-02-01 18:39:05 [iNFO] [sTDOUT] 0.16858378

2013-02-01 18:39:05 [iNFO] [sTDOUT] -0.14373022

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.