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'm using this code to determine temperature

if(isPowered())
				temperature += 1.0F;
			temperature -= getCoolant(worldObj, xCoord, yCoord - 1, zCoord);
			temperature = ((float) Math.ceil(temperature * 5) / 5.0F);
			if(temperature < 0.0F)
				temperature = 0.0F;

and here's the getCoolant() method

 

public float getCoolant(World world, int x, int y, int z)
{
	float coolant = 0.0F;
	for(int i = -1; i < 2; i++)
	{
		for(int j = -1; j < 2; j++)
		{
			int block = world.getBlockId(x + i, y, z + j);
			if(block == Block.waterMoving.blockID || block == Block.waterStill.blockID)
			{
				coolant += 0.2F;
			}
			else if(block == Block.lavaMoving.blockID || block == Block.lavaStill.blockID)
			{
				coolant -= 0.2F;
			}
			else if(Block.blocksList[block] != null && Block.blocksList[block] instanceof BlockFluidBase)
			{
				BlockFluidBase liquid = (BlockFluidBase) Block.blocksList[block];
				Fluid fluid = liquid.getFluid();
				if(fluid != null)
				{
					if((float) fluid.getTemperature(world, x + i, y, z + j) < getTemperature())
						coolant += 0.2F;
					else
						coolant -= 0.2F;
				}
			}
		}
	}
	return coolant;
}

 

but in the gui it shows up as x.6 then x.2 then x.0 then x.6 then x.2 then x.0 then... so I was wondering if anyone knows how I could get this to work better correctly? currently 2/9 spots are obstructed if that helps. also, the liquid being used is water, so the BlockFluidBase part of the method doesn't matter.

  • Author

funny thing, I was looking on the internet for such a solution and didn't find a working one. :-( I'll try again. but let me know if you come up with anything.

I figured out a solution on my own.

 

 

Would you mind sharing the concept behind your solution? I can't be bothered to work it out from scratch xD

I am Mew. The Legendary Psychic. I behave oddly and am always playing practical jokes.

 

I have also found that I really love making extremely long and extremely but sometimes not so descriptive variables. Sort of like what I just did there xD

well logicly its roughly

 

float x = wtv;

round = ((int)((wtv+0.1)*5))/5f;

how to debug 101:http://www.minecraftforge.net/wiki/Debug_101

-hydroflame, author of the forge revolution-

you need flow control if the temperature is negative though :\ like i said that "roughly" the formula

how to debug 101:http://www.minecraftforge.net/wiki/Debug_101

-hydroflame, author of the forge revolution-

or dont have negative temperature (degree kelvin ?)

how to debug 101:http://www.minecraftforge.net/wiki/Debug_101

-hydroflame, author of the forge revolution-

problem solved ! :)

how to debug 101:http://www.minecraftforge.net/wiki/Debug_101

-hydroflame, author of the forge revolution-

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.