From fb33dda932b0578ce550a6ec4a4bc6cece792451 Mon Sep 17 00:00:00 2001 From: modmuss50 Date: Mon, 10 Aug 2015 14:32:01 +0100 Subject: [PATCH] Changes the way heat is calculated. --- .../multiblock/MultiblockControllerBase.java | 2 +- .../techreborn/blocks/BlockMachineCasing.java | 6 +- .../multiblocks/MultiBlockCasing.java | 213 +++++++++--------- .../techreborn/tiles/TileBlastFurnace.java | 22 +- 4 files changed, 125 insertions(+), 118 deletions(-) diff --git a/src/main/java/erogenousbeef/coreTR/multiblock/MultiblockControllerBase.java b/src/main/java/erogenousbeef/coreTR/multiblock/MultiblockControllerBase.java index d73f74fbf..e28a796b7 100644 --- a/src/main/java/erogenousbeef/coreTR/multiblock/MultiblockControllerBase.java +++ b/src/main/java/erogenousbeef/coreTR/multiblock/MultiblockControllerBase.java @@ -35,7 +35,7 @@ public abstract class MultiblockControllerBase { protected AssemblyState assemblyState; - protected HashSet connectedParts; + public HashSet connectedParts; /** * This is a deterministically-picked coordinate that identifies this diff --git a/src/main/java/techreborn/blocks/BlockMachineCasing.java b/src/main/java/techreborn/blocks/BlockMachineCasing.java index 4d25c8935..0ad5fd6db 100644 --- a/src/main/java/techreborn/blocks/BlockMachineCasing.java +++ b/src/main/java/techreborn/blocks/BlockMachineCasing.java @@ -82,11 +82,11 @@ public class BlockMachineCasing extends BlockMultiblockBase { public static int getHeatFromMeta(int meta) { switch (meta) { case 0: - return 1020; + return 1020 / 25; case 1: - return 1700; + return 1700 / 25; case 2: - return 2380; + return 2380 / 25; } return 0; } diff --git a/src/main/java/techreborn/multiblocks/MultiBlockCasing.java b/src/main/java/techreborn/multiblocks/MultiBlockCasing.java index 96ba4fc50..367ef9125 100644 --- a/src/main/java/techreborn/multiblocks/MultiBlockCasing.java +++ b/src/main/java/techreborn/multiblocks/MultiBlockCasing.java @@ -22,6 +22,8 @@ public class MultiBlockCasing extends RectangularMultiblockControllerBase { super(world); } + + /** * @return True if the machine is "whole" and should be assembled. False * otherwise. @@ -191,6 +193,7 @@ public class MultiBlockCasing extends RectangularMultiblockControllerBase { } } + @Override public void onAttachedPartWithMultiblockData(IMultiblockPart part, NBTTagCompound data) { @@ -317,110 +320,110 @@ public class MultiBlockCasing extends RectangularMultiblockControllerBase { } - /** - * This is horrible code, don't look at this - * - * @param x - * @param y - * @param z - * @return - */ - - public boolean checkIfStarShape(int x, int y, int z) { - boolean isSolid = true; - - TileEntity te; - {//corners - te = this.worldObj.getTileEntity(x, y, z); - isSolid = checkTeIsCorner(te); - if (!isSolid) { - return false; - } - - te = this.worldObj.getTileEntity(x + 2, y, z); - isSolid = checkTeIsCorner(te); - if (!isSolid) { - return false; - } - - te = this.worldObj.getTileEntity(x, y, z + 2); - isSolid = checkTeIsCorner(te); - if (!isSolid) { - return false; - } - - te = this.worldObj.getTileEntity(x + 2, y, z + 2); - isSolid = checkTeIsCorner(te); - if (!isSolid) { - return false; - } - - te = this.worldObj.getTileEntity(x, y + 2, z); - isSolid = checkTeIsCorner(te); - if (!isSolid) { - return false; - } - - te = this.worldObj.getTileEntity(x + 2, y + 2, z); - isSolid = checkTeIsCorner(te); - if (!isSolid) { - return false; - } - - te = this.worldObj.getTileEntity(x, y + 2, z + 2); - isSolid = checkTeIsCorner(te); - if (!isSolid) { - return false; - } - - te = this.worldObj.getTileEntity(x + 2, y + 2, z + 2); - isSolid = checkTeIsCorner(te); - if (!isSolid) { - return false; - } - } - {//middle blocks - for (int i = 0; i < 3; i++) { - System.out.println(this.worldObj.getBlock(x, y - 1, z)); - te = this.worldObj.getTileEntity(x + 1, y + i, z); - isSolid = checkTeIsCenter(te); - if (!isSolid) { - return false; - } - te = this.worldObj.getTileEntity(x, y + i, z + 1); - isSolid = checkTeIsCenter(te); - if (!isSolid) { - return false; - } - - te = this.worldObj.getTileEntity(x + 1, y + i, z + 1); - isSolid = checkTeIsCenter(te); - if (!isSolid) { - return false; - } - - te = this.worldObj.getTileEntity(x + 2, y + i, z + 1); - isSolid = checkTeIsCenter(te); - if (!isSolid) { - return false; - } - - te = this.worldObj.getTileEntity(x + 1, y + i, z + 2); - isSolid = checkTeIsCenter(te); - if (!isSolid) { - return false; - } - } - } - return isSolid; - } - - public boolean checkTeIsCorner(TileEntity te) { - return (te.blockType instanceof BlockMachineCasing && te.blockMetadata == 0); - } - - public boolean checkTeIsCenter(TileEntity te) { - return (te.blockType instanceof BlockMachineCasing && te.blockMetadata == 1); - } +// /** +// * This is horrible code, don't look at this +// * +// * @param x +// * @param y +// * @param z +// * @return +// */ +// +// public boolean checkIfStarShape(int x, int y, int z) { +// boolean isSolid = true; +// +// TileEntity te; +// {//corners +// te = this.worldObj.getTileEntity(x, y, z); +// isSolid = checkTeIsCorner(te); +// if (!isSolid) { +// return false; +// } +// +// te = this.worldObj.getTileEntity(x + 2, y, z); +// isSolid = checkTeIsCorner(te); +// if (!isSolid) { +// return false; +// } +// +// te = this.worldObj.getTileEntity(x, y, z + 2); +// isSolid = checkTeIsCorner(te); +// if (!isSolid) { +// return false; +// } +// +// te = this.worldObj.getTileEntity(x + 2, y, z + 2); +// isSolid = checkTeIsCorner(te); +// if (!isSolid) { +// return false; +// } +// +// te = this.worldObj.getTileEntity(x, y + 2, z); +// isSolid = checkTeIsCorner(te); +// if (!isSolid) { +// return false; +// } +// +// te = this.worldObj.getTileEntity(x + 2, y + 2, z); +// isSolid = checkTeIsCorner(te); +// if (!isSolid) { +// return false; +// } +// +// te = this.worldObj.getTileEntity(x, y + 2, z + 2); +// isSolid = checkTeIsCorner(te); +// if (!isSolid) { +// return false; +// } +// +// te = this.worldObj.getTileEntity(x + 2, y + 2, z + 2); +// isSolid = checkTeIsCorner(te); +// if (!isSolid) { +// return false; +// } +// } +// {//middle blocks +// for (int i = 0; i < 3; i++) { +// System.out.println(this.worldObj.getBlock(x, y - 1, z)); +// te = this.worldObj.getTileEntity(x + 1, y + i, z); +// isSolid = checkTeIsCenter(te); +// if (!isSolid) { +// return false; +// } +// te = this.worldObj.getTileEntity(x, y + i, z + 1); +// isSolid = checkTeIsCenter(te); +// if (!isSolid) { +// return false; +// } +// +// te = this.worldObj.getTileEntity(x + 1, y + i, z + 1); +// isSolid = checkTeIsCenter(te); +// if (!isSolid) { +// return false; +// } +// +// te = this.worldObj.getTileEntity(x + 2, y + i, z + 1); +// isSolid = checkTeIsCenter(te); +// if (!isSolid) { +// return false; +// } +// +// te = this.worldObj.getTileEntity(x + 1, y + i, z + 2); +// isSolid = checkTeIsCenter(te); +// if (!isSolid) { +// return false; +// } +// } +// } +// return isSolid; +// } +// +// public boolean checkTeIsCorner(TileEntity te) { +// return (te.blockType instanceof BlockMachineCasing && te.blockMetadata == 0); +// } +// +// public boolean checkTeIsCenter(TileEntity te) { +// return (te.blockType instanceof BlockMachineCasing && te.blockMetadata == 1); +// } } diff --git a/src/main/java/techreborn/tiles/TileBlastFurnace.java b/src/main/java/techreborn/tiles/TileBlastFurnace.java index ef8bbe203..308a32e38 100644 --- a/src/main/java/techreborn/tiles/TileBlastFurnace.java +++ b/src/main/java/techreborn/tiles/TileBlastFurnace.java @@ -1,5 +1,6 @@ package techreborn.tiles; +import erogenousbeef.coreTR.multiblock.IMultiblockPart; import ic2.api.energy.tile.IEnergyTile; import ic2.api.tile.IWrenchable; import net.minecraft.entity.player.EntityPlayer; @@ -18,6 +19,7 @@ import techreborn.config.ConfigTechReborn; import techreborn.init.ModBlocks; import techreborn.lib.Location; import techreborn.lib.Reference; +import techreborn.multiblocks.MultiBlockCasing; import techreborn.powerSystem.TilePowerAcceptor; import techreborn.util.Inventory; @@ -84,16 +86,18 @@ public class TileBlastFurnace extends TilePowerAcceptor implements IWrenchable, TileEntity tileEntity = worldObj.getTileEntity(xCoord + direction.offsetX, yCoord + direction.offsetY, zCoord + direction.offsetZ); if (tileEntity instanceof TileMachineCasing) { if (((TileMachineCasing) tileEntity).isConnected()) { - if ((tileEntity.getBlockType() instanceof BlockMachineCasing)) { - int heat; - heat = BlockMachineCasing.getHeatFromMeta(tileEntity.getBlockMetadata()); - Location location = new Location(xCoord, yCoord, zCoord, direction); - location.modifyPositionFromSide(direction, 1); - if (worldObj.getBlock(location.getX(), location.getY(), location.getZ()).getUnlocalizedName().equals("tile.lava")) { - heat += 500; - } - return heat; + MultiBlockCasing casing = ((TileMachineCasing) tileEntity).getMultiblockController(); + int heat = 0; + + for (IMultiblockPart part : casing.connectedParts) { + heat += BlockMachineCasing.getHeatFromMeta(part.getWorldObj().getBlockMetadata(part.getWorldLocation().x, part.getWorldLocation().y, part.getWorldLocation().z)); } + Location location = new Location(xCoord, yCoord, zCoord, direction); + location.modifyPositionFromSide(direction, 1); + if (worldObj.getBlock(location.getX(), location.getY(), location.getZ()).getUnlocalizedName().equals("tile.lava") && worldObj.getBlock(location.getX(), location.getY() + 1, location.getZ()).getUnlocalizedName().equals("tile.lava")) { + heat += 500; + } + return heat; } } }