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

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.