diff --git a/src/main/java/resonantinduction/archaic/firebox/BlockFirebox.java b/src/main/java/resonantinduction/archaic/firebox/BlockFirebox.java index c803586fb..4354697a3 100644 --- a/src/main/java/resonantinduction/archaic/firebox/BlockFirebox.java +++ b/src/main/java/resonantinduction/archaic/firebox/BlockFirebox.java @@ -2,6 +2,7 @@ package resonantinduction.archaic.firebox; import java.util.Random; +import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.entity.player.EntityPlayer; @@ -102,24 +103,31 @@ public class BlockFirebox extends BlockRI if (((TileFirebox) tileEntity).isBurning()) { - int l = world.getBlockMetadata(x, y, z); - float f = x + 0.5F; - float f1 = y + 0.0F + par5Random.nextFloat() * 6.0F / 16.0F; - float f2 = z + 0.5F; - float f3 = 0.52F; - float f4 = par5Random.nextFloat() * 0.6F - 0.3F; + float xDisplace = x + 0.5F; + float yDisplace = y + 0.0F + par5Random.nextFloat() * 6.0F / 16.0F; + float zDisplace = z + 0.5F; + float modifier = 0.52F; + float randomValue = par5Random.nextFloat() * 0.6F - 0.3F; - world.spawnParticle("smoke", f - f3, f1, f2 + f4, 0.0D, 0.0D, 0.0D); - world.spawnParticle("flame", f - f3, f1, f2 + f4, 0.0D, 0.0D, 0.0D); + world.spawnParticle("smoke", xDisplace - modifier, yDisplace, zDisplace + randomValue, 0.0D, 0.0D, 0.0D); + world.spawnParticle("flame", xDisplace - modifier, yDisplace, zDisplace + randomValue, 0.0D, 0.0D, 0.0D); - world.spawnParticle("smoke", f + f3, f1, f2 + f4, 0.0D, 0.0D, 0.0D); - world.spawnParticle("flame", f + f3, f1, f2 + f4, 0.0D, 0.0D, 0.0D); + world.spawnParticle("smoke", xDisplace + modifier, yDisplace, zDisplace + randomValue, 0.0D, 0.0D, 0.0D); + world.spawnParticle("flame", xDisplace + modifier, yDisplace, zDisplace + randomValue, 0.0D, 0.0D, 0.0D); - world.spawnParticle("smoke", f + f4, f1, f2 - f3, 0.0D, 0.0D, 0.0D); - world.spawnParticle("flame", f + f4, f1, f2 - f3, 0.0D, 0.0D, 0.0D); + world.spawnParticle("smoke", xDisplace + randomValue, yDisplace, zDisplace - modifier, 0.0D, 0.0D, 0.0D); + world.spawnParticle("flame", xDisplace + randomValue, yDisplace, zDisplace - modifier, 0.0D, 0.0D, 0.0D); - world.spawnParticle("smoke", f + f4, f1, f2 + f3, 0.0D, 0.0D, 0.0D); - world.spawnParticle("flame", f + f4, f1, f2 + f3, 0.0D, 0.0D, 0.0D); + world.spawnParticle("smoke", xDisplace + randomValue, yDisplace, zDisplace + modifier, 0.0D, 0.0D, 0.0D); + world.spawnParticle("flame", xDisplace + randomValue, yDisplace, zDisplace + modifier, 0.0D, 0.0D, 0.0D); + + int blockIDAbove = world.getBlockId(x, y + 1, z); + + if (blockIDAbove == Block.waterStill.blockID || blockIDAbove == Block.waterMoving.blockID) + { + for (int i = 0; i < 4; i++) + world.spawnParticle("bubble", xDisplace + (par5Random.nextFloat() - 0.5), yDisplace + 1.5, zDisplace + (par5Random.nextFloat() - 0.5), 0.0D, 0.05D, 0.0D); + } } } diff --git a/src/main/java/resonantinduction/archaic/firebox/TileFirebox.java b/src/main/java/resonantinduction/archaic/firebox/TileFirebox.java index bd1e53c1b..155535c09 100644 --- a/src/main/java/resonantinduction/archaic/firebox/TileFirebox.java +++ b/src/main/java/resonantinduction/archaic/firebox/TileFirebox.java @@ -8,10 +8,16 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.packet.Packet; import net.minecraft.tileentity.TileEntityFurnace; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.fluids.FluidContainerRegistry; +import net.minecraftforge.fluids.FluidRegistry; +import net.minecraftforge.fluids.FluidStack; import resonantinduction.core.ResonantInduction; +import universalelectricity.api.vector.Vector3; import calclavia.lib.network.IPacketReceiver; import calclavia.lib.network.IPacketSender; import calclavia.lib.prefab.tile.TileExternalInventory; +import calclavia.lib.thermal.BoilEvent; import com.google.common.io.ByteArrayDataInput; @@ -24,12 +30,20 @@ import com.google.common.io.ByteArrayDataInput; public class TileFirebox extends TileExternalInventory implements IPacketSender, IPacketReceiver { /** + * One coal = 4MJ, one coal lasts 80 seconds. Therefore, we are producing 50000 watts. * The power of the firebox in terms of thermal energy. The thermal energy can be transfered * into fluids to increase their internal energy. */ - private final int POWER = 50000; + private final long POWER = 50000; private int burnTime; + /** + * + * It takes 338260 J to boile water. + */ + private final long requiredBoilWaterEnergy = 338260; + private long boilEnergy = 0; + @Override public void updateEntity() { @@ -44,6 +58,20 @@ public class TileFirebox extends TileExternalInventory implements IPacketSender, worldObj.setBlock(xCoord, yCoord + 1, zCoord, Block.fire.blockID); } + if (blockID == Block.waterStill.blockID || blockID == Block.waterMoving.blockID) + { + boilEnergy += POWER / 20; + + if (boilEnergy >= requiredBoilWaterEnergy) + { + if (FluidRegistry.getFluid("steam") != null) + MinecraftForge.EVENT_BUS.post(new BoilEvent(worldObj, new Vector3(this).translate(0, 1, 0), new FluidStack(FluidRegistry.WATER, FluidContainerRegistry.BUCKET_VOLUME), new FluidStack(FluidRegistry.getFluid("steam"), FluidContainerRegistry.BUCKET_VOLUME), 2)); + + worldObj.setBlock(xCoord, yCoord + 1, zCoord, 0); + boilEnergy = 0; + } + } + if (--burnTime == 0) { if (blockID == Block.fire.blockID)