Fixed Legacy code
This commit is contained in:
parent
f92576ed36
commit
593d889468
2 changed files with 21 additions and 9 deletions
|
@ -30,6 +30,8 @@ import buildcraft.core.proxy.CoreProxy;
|
||||||
import buildcraft.core.utils.Utils;
|
import buildcraft.core.utils.Utils;
|
||||||
import buildcraft.energy.gui.ContainerEngine;
|
import buildcraft.energy.gui.ContainerEngine;
|
||||||
import net.minecraft.inventory.ICrafting;
|
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 {
|
public abstract class TileEngine extends TileBuildCraft implements IPowerReceptor, IInventory, IOverrideDefaultTriggers, IPipeConnection {
|
||||||
|
|
||||||
|
@ -233,7 +235,6 @@ public abstract class TileEngine extends TileBuildCraft implements IPowerRecepto
|
||||||
// float heatLevel = getIdealHeatLevel();
|
// float heatLevel = getIdealHeatLevel();
|
||||||
// return getCurrentOutput() * heatLevel;
|
// return getCurrentOutput() * heatLevel;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
protected void burn() {
|
protected void burn() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -284,7 +285,10 @@ public abstract class TileEngine extends TileBuildCraft implements IPowerRecepto
|
||||||
orientation = ForgeDirection.getOrientation(data.getInteger("orientation"));
|
orientation = ForgeDirection.getOrientation(data.getInteger("orientation"));
|
||||||
progress = data.getFloat("progress");
|
progress = data.getFloat("progress");
|
||||||
energy = data.getFloat("energyF");
|
energy = data.getFloat("energyF");
|
||||||
heat = data.getFloat("heat");
|
NBTBase tag = data.getTag("heat");
|
||||||
|
if (tag instanceof NBTTagFloat) {
|
||||||
|
heat = data.getFloat("heat");
|
||||||
|
}
|
||||||
inv.readFromNBT(data);
|
inv.readFromNBT(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
*/
|
*/
|
||||||
package buildcraft.energy;
|
package buildcraft.energy;
|
||||||
|
|
||||||
import buildcraft.BuildCraftEnergy;
|
|
||||||
import buildcraft.core.DefaultProps;
|
import buildcraft.core.DefaultProps;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
@ -21,18 +20,27 @@ import net.minecraft.tileentity.TileEntity;
|
||||||
*/
|
*/
|
||||||
public class TileEngineLegacy extends TileEngine {
|
public class TileEngineLegacy extends TileEngine {
|
||||||
|
|
||||||
|
private NBTTagCompound nbt;
|
||||||
|
|
||||||
public TileEngineLegacy() {
|
public TileEngineLegacy() {
|
||||||
super(0);
|
super(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity() {
|
public void updateEntity() {
|
||||||
int meta = getBlockMetadata();
|
worldObj.removeBlockTileEntity(xCoord, yCoord, zCoord);
|
||||||
NBTTagCompound nbt = new NBTTagCompound();
|
TileEntity newTile = worldObj.getBlockTileEntity(xCoord, yCoord, zCoord);
|
||||||
writeToNBT(nbt);
|
|
||||||
TileEntity newTile = BuildCraftEnergy.engineBlock.createTileEntity(worldObj, meta);
|
|
||||||
newTile.readFromNBT(nbt);
|
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
|
@Override
|
||||||
|
|
Loading…
Add table
Reference in a new issue