Fixed Legacy code

This commit is contained in:
CovertJaguar 2013-06-29 02:21:54 -07:00
parent f92576ed36
commit 593d889468
2 changed files with 21 additions and 9 deletions

View file

@ -30,6 +30,8 @@ import buildcraft.core.proxy.CoreProxy;
import buildcraft.core.utils.Utils;
import buildcraft.energy.gui.ContainerEngine;
import net.minecraft.inventory.ICrafting;
import net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.NBTTagFloat;
public abstract class TileEngine extends TileBuildCraft implements IPowerReceptor, IInventory, IOverrideDefaultTriggers, IPipeConnection {
@ -227,13 +229,12 @@ public abstract class TileEngine extends TileBuildCraft implements IPowerRecepto
}
}
}
// Uncomment out for constant power
// public float getActualOutput() {
// float heatLevel = getIdealHeatLevel();
// return getCurrentOutput() * heatLevel;
// }
protected void burn() {
}
@ -284,7 +285,10 @@ public abstract class TileEngine extends TileBuildCraft implements IPowerRecepto
orientation = ForgeDirection.getOrientation(data.getInteger("orientation"));
progress = data.getFloat("progress");
energy = data.getFloat("energyF");
heat = data.getFloat("heat");
NBTBase tag = data.getTag("heat");
if (tag instanceof NBTTagFloat) {
heat = data.getFloat("heat");
}
inv.readFromNBT(data);
}

View file

@ -7,7 +7,6 @@
*/
package buildcraft.energy;
import buildcraft.BuildCraftEnergy;
import buildcraft.core.DefaultProps;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
@ -21,18 +20,27 @@ import net.minecraft.tileentity.TileEntity;
*/
public class TileEngineLegacy extends TileEngine {
private NBTTagCompound nbt;
public TileEngineLegacy() {
super(0);
}
@Override
public void updateEntity() {
int meta = getBlockMetadata();
NBTTagCompound nbt = new NBTTagCompound();
writeToNBT(nbt);
TileEntity newTile = BuildCraftEnergy.engineBlock.createTileEntity(worldObj, meta);
worldObj.removeBlockTileEntity(xCoord, yCoord, zCoord);
TileEntity newTile = worldObj.getBlockTileEntity(xCoord, yCoord, zCoord);
newTile.readFromNBT(nbt);
worldObj.setBlockTileEntity(xCoord, yCoord, zCoord, newTile);
sendNetworkUpdate();
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
@Override
public void readFromNBT(NBTTagCompound data) {
nbt = (NBTTagCompound) data.copy();
this.xCoord = data.getInteger("x");
this.yCoord = data.getInteger("y");
this.zCoord = data.getInteger("z");
}
@Override