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 HashSet<IMultiblockPart> connectedParts;
public HashSet<IMultiblockPart> connectedParts;
/**
* 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) {
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;
}

View file

@ -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);
// }
}

View file

@ -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,19 +86,21 @@ 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());
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")) {
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;
}
}
}
}
return 0;
}