Changes the way heat is calculated.

This commit is contained in:
modmuss50 2015-08-10 14:32:01 +01:00
parent 404bbf6797
commit fb33dda932
4 changed files with 125 additions and 118 deletions

View file

@ -35,7 +35,7 @@ public abstract class MultiblockControllerBase {
protected AssemblyState assemblyState; protected AssemblyState assemblyState;
protected HashSet<IMultiblockPart> connectedParts; public HashSet<IMultiblockPart> connectedParts;
/** /**
* This is a deterministically-picked coordinate that identifies this * This is a deterministically-picked coordinate that identifies this

View file

@ -82,11 +82,11 @@ public class BlockMachineCasing extends BlockMultiblockBase {
public static int getHeatFromMeta(int meta) { public static int getHeatFromMeta(int meta) {
switch (meta) { switch (meta) {
case 0: case 0:
return 1020; return 1020 / 25;
case 1: case 1:
return 1700; return 1700 / 25;
case 2: case 2:
return 2380; return 2380 / 25;
} }
return 0; return 0;
} }

View file

@ -22,6 +22,8 @@ public class MultiBlockCasing extends RectangularMultiblockControllerBase {
super(world); super(world);
} }
/** /**
* @return True if the machine is "whole" and should be assembled. False * @return True if the machine is "whole" and should be assembled. False
* otherwise. * otherwise.
@ -191,6 +193,7 @@ public class MultiBlockCasing extends RectangularMultiblockControllerBase {
} }
} }
@Override @Override
public void onAttachedPartWithMultiblockData(IMultiblockPart part, public void onAttachedPartWithMultiblockData(IMultiblockPart part,
NBTTagCompound data) { NBTTagCompound data) {
@ -317,110 +320,110 @@ public class MultiBlockCasing extends RectangularMultiblockControllerBase {
} }
/** // /**
* This is horrible code, don't look at this // * This is horrible code, don't look at this
* // *
* @param x // * @param x
* @param y // * @param y
* @param z // * @param z
* @return // * @return
*/ // */
//
public boolean checkIfStarShape(int x, int y, int z) { // public boolean checkIfStarShape(int x, int y, int z) {
boolean isSolid = true; // boolean isSolid = true;
//
TileEntity te; // TileEntity te;
{//corners // {//corners
te = this.worldObj.getTileEntity(x, y, z); // te = this.worldObj.getTileEntity(x, y, z);
isSolid = checkTeIsCorner(te); // isSolid = checkTeIsCorner(te);
if (!isSolid) { // if (!isSolid) {
return false; // return false;
} // }
//
te = this.worldObj.getTileEntity(x + 2, y, z); // te = this.worldObj.getTileEntity(x + 2, y, z);
isSolid = checkTeIsCorner(te); // isSolid = checkTeIsCorner(te);
if (!isSolid) { // if (!isSolid) {
return false; // return false;
} // }
//
te = this.worldObj.getTileEntity(x, y, z + 2); // te = this.worldObj.getTileEntity(x, y, z + 2);
isSolid = checkTeIsCorner(te); // isSolid = checkTeIsCorner(te);
if (!isSolid) { // if (!isSolid) {
return false; // return false;
} // }
//
te = this.worldObj.getTileEntity(x + 2, y, z + 2); // te = this.worldObj.getTileEntity(x + 2, y, z + 2);
isSolid = checkTeIsCorner(te); // isSolid = checkTeIsCorner(te);
if (!isSolid) { // if (!isSolid) {
return false; // return false;
} // }
//
te = this.worldObj.getTileEntity(x, y + 2, z); // te = this.worldObj.getTileEntity(x, y + 2, z);
isSolid = checkTeIsCorner(te); // isSolid = checkTeIsCorner(te);
if (!isSolid) { // if (!isSolid) {
return false; // return false;
} // }
//
te = this.worldObj.getTileEntity(x + 2, y + 2, z); // te = this.worldObj.getTileEntity(x + 2, y + 2, z);
isSolid = checkTeIsCorner(te); // isSolid = checkTeIsCorner(te);
if (!isSolid) { // if (!isSolid) {
return false; // return false;
} // }
//
te = this.worldObj.getTileEntity(x, y + 2, z + 2); // te = this.worldObj.getTileEntity(x, y + 2, z + 2);
isSolid = checkTeIsCorner(te); // isSolid = checkTeIsCorner(te);
if (!isSolid) { // if (!isSolid) {
return false; // return false;
} // }
//
te = this.worldObj.getTileEntity(x + 2, y + 2, z + 2); // te = this.worldObj.getTileEntity(x + 2, y + 2, z + 2);
isSolid = checkTeIsCorner(te); // isSolid = checkTeIsCorner(te);
if (!isSolid) { // if (!isSolid) {
return false; // return false;
} // }
} // }
{//middle blocks // {//middle blocks
for (int i = 0; i < 3; i++) { // for (int i = 0; i < 3; i++) {
System.out.println(this.worldObj.getBlock(x, y - 1, z)); // System.out.println(this.worldObj.getBlock(x, y - 1, z));
te = this.worldObj.getTileEntity(x + 1, y + i, z); // te = this.worldObj.getTileEntity(x + 1, y + i, z);
isSolid = checkTeIsCenter(te); // isSolid = checkTeIsCenter(te);
if (!isSolid) { // if (!isSolid) {
return false; // return false;
} // }
te = this.worldObj.getTileEntity(x, y + i, z + 1); // te = this.worldObj.getTileEntity(x, y + i, z + 1);
isSolid = checkTeIsCenter(te); // isSolid = checkTeIsCenter(te);
if (!isSolid) { // if (!isSolid) {
return false; // return false;
} // }
//
te = this.worldObj.getTileEntity(x + 1, y + i, z + 1); // te = this.worldObj.getTileEntity(x + 1, y + i, z + 1);
isSolid = checkTeIsCenter(te); // isSolid = checkTeIsCenter(te);
if (!isSolid) { // if (!isSolid) {
return false; // return false;
} // }
//
te = this.worldObj.getTileEntity(x + 2, y + i, z + 1); // te = this.worldObj.getTileEntity(x + 2, y + i, z + 1);
isSolid = checkTeIsCenter(te); // isSolid = checkTeIsCenter(te);
if (!isSolid) { // if (!isSolid) {
return false; // return false;
} // }
//
te = this.worldObj.getTileEntity(x + 1, y + i, z + 2); // te = this.worldObj.getTileEntity(x + 1, y + i, z + 2);
isSolid = checkTeIsCenter(te); // isSolid = checkTeIsCenter(te);
if (!isSolid) { // if (!isSolid) {
return false; // return false;
} // }
} // }
} // }
return isSolid; // return isSolid;
} // }
//
public boolean checkTeIsCorner(TileEntity te) { // public boolean checkTeIsCorner(TileEntity te) {
return (te.blockType instanceof BlockMachineCasing && te.blockMetadata == 0); // return (te.blockType instanceof BlockMachineCasing && te.blockMetadata == 0);
} // }
//
public boolean checkTeIsCenter(TileEntity te) { // public boolean checkTeIsCenter(TileEntity te) {
return (te.blockType instanceof BlockMachineCasing && te.blockMetadata == 1); // return (te.blockType instanceof BlockMachineCasing && te.blockMetadata == 1);
} // }
} }

View file

@ -1,5 +1,6 @@
package techreborn.tiles; package techreborn.tiles;
import erogenousbeef.coreTR.multiblock.IMultiblockPart;
import ic2.api.energy.tile.IEnergyTile; import ic2.api.energy.tile.IEnergyTile;
import ic2.api.tile.IWrenchable; import ic2.api.tile.IWrenchable;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
@ -18,6 +19,7 @@ import techreborn.config.ConfigTechReborn;
import techreborn.init.ModBlocks; import techreborn.init.ModBlocks;
import techreborn.lib.Location; import techreborn.lib.Location;
import techreborn.lib.Reference; import techreborn.lib.Reference;
import techreborn.multiblocks.MultiBlockCasing;
import techreborn.powerSystem.TilePowerAcceptor; import techreborn.powerSystem.TilePowerAcceptor;
import techreborn.util.Inventory; 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); TileEntity tileEntity = worldObj.getTileEntity(xCoord + direction.offsetX, yCoord + direction.offsetY, zCoord + direction.offsetZ);
if (tileEntity instanceof TileMachineCasing) { if (tileEntity instanceof TileMachineCasing) {
if (((TileMachineCasing) tileEntity).isConnected()) { if (((TileMachineCasing) tileEntity).isConnected()) {
if ((tileEntity.getBlockType() instanceof BlockMachineCasing)) { MultiBlockCasing casing = ((TileMachineCasing) tileEntity).getMultiblockController();
int heat; int heat = 0;
heat = BlockMachineCasing.getHeatFromMeta(tileEntity.getBlockMetadata());
Location location = new Location(xCoord, yCoord, zCoord, direction); for (IMultiblockPart part : casing.connectedParts) {
location.modifyPositionFromSide(direction, 1); heat += BlockMachineCasing.getHeatFromMeta(part.getWorldObj().getBlockMetadata(part.getWorldLocation().x, part.getWorldLocation().y, part.getWorldLocation().z));
if (worldObj.getBlock(location.getX(), location.getY(), location.getZ()).getUnlocalizedName().equals("tile.lava")) {
heat += 500;
}
return heat;
} }
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;
} }
} }
} }