v5.5.4 Golden Master #1

*Fixed Sound volume update crash, thanks Cisien.
*Obsidian TNT can now be pushed like ICBM explosives.
*Refactored TileEntities to only operate on the server-side.
*Universal Cables and Mechanical Pipes now have their render state
updated on the server-side, and it is synced to the client whenever
necessary.
*Other various improvements -- liquid & energy transfer is now
server-based only.
This commit is contained in:
Aidan Brady 2013-04-21 23:43:04 -04:00
parent 4bb292d32a
commit 4f5ce2f9e9
18 changed files with 674 additions and 670 deletions

View file

@ -135,7 +135,7 @@ public class Sound
{ {
synchronized(Mekanism.audioHandler.sounds) synchronized(Mekanism.audioHandler.sounds)
{ {
if(entityplayer.worldObj == tileEntity.worldObj) if(entityplayer != null && tileEntity != null && entityplayer.worldObj == tileEntity.worldObj)
{ {
float volume = 0; float volume = 0;

View file

@ -143,12 +143,11 @@ public class EnergyTransferProtocol
{ {
loopThrough(pointer); loopThrough(pointer);
boolean fill = FMLCommonHandler.instance().getEffectiveSide().isServer();
Collections.shuffle(availableAcceptors); Collections.shuffle(availableAcceptors);
if(fill) double prevNeeded = neededEnergy();
{ double prevSending = energyToSend;
if(!availableAcceptors.isEmpty()) if(!availableAcceptors.isEmpty())
{ {
int divider = availableAcceptors.size(); int divider = availableAcceptors.size();
@ -185,11 +184,8 @@ public class EnergyTransferProtocol
} }
} }
} }
}
else {
double needed = neededEnergy();
if(needed > 0 && energyToSend > 0) if(prevNeeded > 0 && prevSending > 0)
{ {
for(TileEntity tileEntity : iteratedCables) for(TileEntity tileEntity : iteratedCables)
{ {
@ -199,7 +195,6 @@ public class EnergyTransferProtocol
} }
} }
} }
}
return energyToSend; return energyToSend;
} }

View file

@ -50,6 +50,12 @@ public class EntityObsidianTNT extends Entity
return !isDead; return !isDead;
} }
@Override
public boolean canBePushed()
{
return true;
}
@Override @Override
public void onUpdate() public void onUpdate()
{ {

View file

@ -58,7 +58,7 @@ public class ItemBlockTransmitter extends ItemBlock
else if(itemstack.getItemDamage() == 2) else if(itemstack.getItemDamage() == 2)
{ {
list.add(EnumColor.DARK_GREY + "Capable of transferring:"); list.add(EnumColor.DARK_GREY + "Capable of transferring:");
list.add("- " + EnumColor.PURPLE + "mB " + EnumColor.GREY + "(LiquidDictionary)"); list.add("- " + EnumColor.PURPLE + "mB " + EnumColor.GREY + "(Liquid Dictionary)");
} }
} }
} }

View file

@ -150,7 +150,6 @@ public class LiquidTransferProtocol
{ {
loopThrough(pointer); loopThrough(pointer);
boolean fill = FMLCommonHandler.instance().getEffectiveSide().isServer();
Collections.shuffle(availableAcceptors); Collections.shuffle(availableAcceptors);
int liquidSent = 0; int liquidSent = 0;
@ -187,7 +186,7 @@ public class LiquidTransferProtocol
tankRemaining--; tankRemaining--;
} }
liquidSent += acceptor.fill(acceptorDirections.get(acceptor), new LiquidStack(liquidToSend.itemID, tankCurrentSending, liquidToSend.itemMeta), fill); liquidSent += acceptor.fill(acceptorDirections.get(acceptor), new LiquidStack(liquidToSend.itemID, tankCurrentSending, liquidToSend.itemMeta), true);
} }
} }
else { else {
@ -195,13 +194,13 @@ public class LiquidTransferProtocol
{ {
ILiquidTank tank = acceptor.getTank(acceptorDirections.get(acceptor), liquidToSend); ILiquidTank tank = acceptor.getTank(acceptorDirections.get(acceptor), liquidToSend);
liquidSent += acceptor.fill(acceptorDirections.get(acceptor), new LiquidStack(liquidToSend.itemID, currentSending, liquidToSend.itemMeta), fill); liquidSent += acceptor.fill(acceptorDirections.get(acceptor), new LiquidStack(liquidToSend.itemID, currentSending, liquidToSend.itemMeta), true);
} }
} }
} }
} }
if(!fill && liquidSent > 0) if(liquidSent > 0)
{ {
for(TileEntity tileEntity : iteratedPipes) for(TileEntity tileEntity : iteratedPipes)
{ {
@ -212,8 +211,6 @@ public class LiquidTransferProtocol
((IMechanicalPipe)tileEntity).onTransfer(sendStack); ((IMechanicalPipe)tileEntity).onTransfer(sendStack);
} }
} }
return 0;
} }
return liquidSent; return liquidSent;

View file

@ -74,8 +74,8 @@ public abstract class TileEntityAdvancedElectricMachine extends TileEntityBasicM
{ {
super.onUpdate(); super.onUpdate();
boolean testActive = operatingTicks > 0; if(!worldObj.isRemote)
{
if(inventory[3] != null) if(inventory[3] != null)
{ {
if(electricityStored < MekanismUtils.getEnergy(energyMultiplier, MAX_ELECTRICITY)) if(electricityStored < MekanismUtils.getEnergy(energyMultiplier, MAX_ELECTRICITY))
@ -163,11 +163,8 @@ public abstract class TileEntityAdvancedElectricMachine extends TileEntityBasicM
electricityStored -= ENERGY_PER_TICK; electricityStored -= ENERGY_PER_TICK;
} }
else if((operatingTicks+1) >= MekanismUtils.getTicks(speedMultiplier, TICKS_REQUIRED)) else if((operatingTicks+1) >= MekanismUtils.getTicks(speedMultiplier, TICKS_REQUIRED))
{
if(!worldObj.isRemote)
{ {
operate(); operate();
}
operatingTicks = 0; operatingTicks = 0;
secondaryEnergyStored -= SECONDARY_ENERGY_PER_TICK; secondaryEnergyStored -= SECONDARY_ENERGY_PER_TICK;
@ -180,8 +177,6 @@ public abstract class TileEntityAdvancedElectricMachine extends TileEntityBasicM
operatingTicks = 0; operatingTicks = 0;
} }
if(!worldObj.isRemote)
{
if(canOperate() && electricityStored >= ENERGY_PER_TICK && secondaryEnergyStored >= SECONDARY_ENERGY_PER_TICK) if(canOperate() && electricityStored >= ENERGY_PER_TICK && secondaryEnergyStored >= SECONDARY_ENERGY_PER_TICK)
{ {
setActive(true); setActive(true);

View file

@ -35,12 +35,10 @@ public abstract class TileEntityBasicBlock extends TileEntityDisableable impleme
if(!worldObj.isRemote) if(!worldObj.isRemote)
{ {
if(playersUsing > 0) if(playersUsing > 0)
{
if(packetTick % 3 == 0)
{ {
PacketHandler.sendTileEntityPacketToClients(this, 50, getNetworkedData(new ArrayList())); PacketHandler.sendTileEntityPacketToClients(this, 50, getNetworkedData(new ArrayList()));
} }
}
packetTick++; packetTick++;
} }
} }

View file

@ -34,10 +34,6 @@ public abstract class TileEntityElectricBlock extends TileEntityContainerBlock i
/** BuildCraft power provider. */ /** BuildCraft power provider. */
public IPowerProvider powerProvider; public IPowerProvider powerProvider;
public boolean prevFull;
public boolean prevEmpty;
/** /**
* The base of all blocks that deal with electricity. It has a facing state, initialized state, * The base of all blocks that deal with electricity. It has a facing state, initialized state,
* and a current amount of stored energy. * and a current amount of stored energy.
@ -73,14 +69,6 @@ public abstract class TileEntityElectricBlock extends TileEntityContainerBlock i
{ {
ElectricityPack electricityPack = ElectricityNetworkHelper.consumeFromMultipleSides(this, getConsumingSides(), getRequest()); ElectricityPack electricityPack = ElectricityNetworkHelper.consumeFromMultipleSides(this, getConsumingSides(), getRequest());
setJoules(getJoules()+electricityPack.getWatts()); setJoules(getJoules()+electricityPack.getWatts());
if(prevFull != (getMaxEnergy() == getEnergy()) || prevEmpty != (getEnergy() == 0))
{
PacketHandler.sendTileEntityPacketToClients(this, 50, getNetworkedData(new ArrayList()));
}
prevFull = getMaxEnergy() == getEnergy();
prevEmpty = getEnergy() == 0;
} }
} }

View file

@ -43,6 +43,13 @@ public abstract class TileEntityElectricMachine extends TileEntityBasicMachine
{ {
super.onUpdate(); super.onUpdate();
if(worldObj.isRemote)
{
System.out.println(electricityStored);
}
if(!worldObj.isRemote)
{
ChargeUtils.discharge(1, this); ChargeUtils.discharge(1, this);
if(inventory[3] != null) if(inventory[3] != null)
@ -101,11 +108,8 @@ public abstract class TileEntityElectricMachine extends TileEntityBasicMachine
electricityStored -= ENERGY_PER_TICK; electricityStored -= ENERGY_PER_TICK;
} }
else if(canOperate() && (operatingTicks+1) >= MekanismUtils.getTicks(speedMultiplier, TICKS_REQUIRED)) else if(canOperate() && (operatingTicks+1) >= MekanismUtils.getTicks(speedMultiplier, TICKS_REQUIRED))
{
if(!worldObj.isRemote)
{ {
operate(); operate();
}
operatingTicks = 0; operatingTicks = 0;
electricityStored -= ENERGY_PER_TICK; electricityStored -= ENERGY_PER_TICK;
@ -117,8 +121,6 @@ public abstract class TileEntityElectricMachine extends TileEntityBasicMachine
operatingTicks = 0; operatingTicks = 0;
} }
if(!worldObj.isRemote)
{
if(canOperate() && electricityStored >= ENERGY_PER_TICK) if(canOperate() && electricityStored >= ENERGY_PER_TICK)
{ {
setActive(true); setActive(true);

View file

@ -67,6 +67,8 @@ public class TileEntityEnergyCube extends TileEntityElectricBlock implements IEn
ChargeUtils.charge(0, this); ChargeUtils.charge(0, this);
ChargeUtils.discharge(1, this); ChargeUtils.discharge(1, this);
if(!worldObj.isRemote)
{
TileEntity tileEntity = VectorHelper.getTileEntityFromSide(worldObj, new Vector3(this), ForgeDirection.getOrientation(facing)); TileEntity tileEntity = VectorHelper.getTileEntityFromSide(worldObj, new Vector3(this), ForgeDirection.getOrientation(facing));
if(electricityStored > 0) if(electricityStored > 0)
@ -76,10 +78,7 @@ public class TileEntityEnergyCube extends TileEntityElectricBlock implements IEn
setJoules(electricityStored - (Math.min(electricityStored, tier.OUTPUT) - CableUtils.emitEnergyToNetwork(Math.min(electricityStored, tier.OUTPUT), this, ForgeDirection.getOrientation(facing)))); setJoules(electricityStored - (Math.min(electricityStored, tier.OUTPUT) - CableUtils.emitEnergyToNetwork(Math.min(electricityStored, tier.OUTPUT), this, ForgeDirection.getOrientation(facing))));
return; return;
} }
else if((tileEntity instanceof IEnergyConductor || tileEntity instanceof IEnergyAcceptor) && Mekanism.hooks.IC2Loaded)
if(!worldObj.isRemote)
{
if((tileEntity instanceof IEnergyConductor || tileEntity instanceof IEnergyAcceptor) && Mekanism.hooks.IC2Loaded)
{ {
if(electricityStored >= tier.OUTPUT) if(electricityStored >= tier.OUTPUT)
{ {
@ -97,9 +96,8 @@ public class TileEntityEnergyCube extends TileEntityElectricBlock implements IEn
setJoules(electricityStored - transferEnergy); setJoules(electricityStored - transferEnergy);
} }
} }
}
if(!worldObj.isRemote && tileEntity instanceof IConductor) if(tileEntity instanceof IConductor)
{ {
ForgeDirection outputDirection = ForgeDirection.getOrientation(facing); ForgeDirection outputDirection = ForgeDirection.getOrientation(facing);
ArrayList<IElectricityNetwork> inputNetworks = new ArrayList<IElectricityNetwork>(); ArrayList<IElectricityNetwork> inputNetworks = new ArrayList<IElectricityNetwork>();
@ -135,6 +133,7 @@ public class TileEntityEnergyCube extends TileEntityElectricBlock implements IEn
} }
} }
} }
}
@Override @Override
public boolean isStackValidForSlot(int slotID, ItemStack itemstack) public boolean isStackValidForSlot(int slotID, ItemStack itemstack)

View file

@ -104,16 +104,8 @@ public class TileEntityFactory extends TileEntityElectricBlock implements IEnerg
Mekanism.proxy.registerSound(this); Mekanism.proxy.registerSound(this);
} }
boolean testActive = false; if(!worldObj.isRemote)
for(int i : progress)
{ {
if(i > 0)
{
testActive = true;
}
}
ChargeUtils.discharge(1, this); ChargeUtils.discharge(1, this);
if(inventory[0] != null) if(inventory[0] != null)
@ -174,11 +166,8 @@ public class TileEntityFactory extends TileEntityElectricBlock implements IEnerg
electricityStored -= ENERGY_PER_TICK; electricityStored -= ENERGY_PER_TICK;
} }
else if(canOperate(getInputSlot(process), getOutputSlot(process)) && (progress[process]+1) >= MekanismUtils.getTicks(speedMultiplier, TICKS_REQUIRED)) else if(canOperate(getInputSlot(process), getOutputSlot(process)) && (progress[process]+1) >= MekanismUtils.getTicks(speedMultiplier, TICKS_REQUIRED))
{
if(!worldObj.isRemote)
{ {
operate(getInputSlot(process), getOutputSlot(process)); operate(getInputSlot(process), getOutputSlot(process));
}
progress[process] = 0; progress[process] = 0;
electricityStored -= ENERGY_PER_TICK; electricityStored -= ENERGY_PER_TICK;
@ -213,6 +202,7 @@ public class TileEntityFactory extends TileEntityElectricBlock implements IEnerg
} }
} }
} }
}
@Override @Override
public boolean func_102008_b(int slotID, ItemStack itemstack, int side) public boolean func_102008_b(int slotID, ItemStack itemstack, int side)

View file

@ -25,13 +25,15 @@ public class TileEntityMechanicalPipe extends TileEntity implements IMechanicalP
{ {
public LiquidTank dummyTank = new LiquidTank(LiquidContainerRegistry.BUCKET_VOLUME); public LiquidTank dummyTank = new LiquidTank(LiquidContainerRegistry.BUCKET_VOLUME);
public LiquidStack prevLiquid;
public LiquidStack refLiquid = null; public LiquidStack refLiquid = null;
public boolean isActive = false; public boolean isActive = false;
public float liquidScale; public float liquidScale;
public float prevRoundedScale; public float prevScale;
@Override @Override
public boolean canTransferLiquids(TileEntity fromTile) public boolean canTransferLiquids(TileEntity fromTile)
@ -56,6 +58,17 @@ public class TileEntityMechanicalPipe extends TileEntity implements IMechanicalP
@Override @Override
public void updateEntity() public void updateEntity()
{ {
if(!worldObj.isRemote)
{
if(liquidScale != prevScale || refLiquid != prevLiquid)
{
worldObj.updateAllLightTypes(xCoord, yCoord, zCoord);
PacketHandler.sendTileEntityPacketToClients(this, 50, getNetworkedData(new ArrayList()));
}
prevScale = liquidScale;
prevLiquid = refLiquid;
if(liquidScale > 0) if(liquidScale > 0)
{ {
liquidScale -= .01; liquidScale -= .01;
@ -64,18 +77,6 @@ public class TileEntityMechanicalPipe extends TileEntity implements IMechanicalP
refLiquid = null; refLiquid = null;
} }
if(worldObj.isRemote)
{
float roundedScale = liquidScale*16F;
if(roundedScale != prevRoundedScale)
{
worldObj.updateAllLightTypes(xCoord, yCoord, zCoord);
}
prevRoundedScale = roundedScale;
}
if(isActive) if(isActive)
{ {
ITankContainer[] connectedAcceptors = PipeUtils.getConnectedAcceptors(this); ITankContainer[] connectedAcceptors = PipeUtils.getConnectedAcceptors(this);
@ -96,6 +97,7 @@ public class TileEntityMechanicalPipe extends TileEntity implements IMechanicalP
} }
} }
} }
}
@Override @Override
public boolean canUpdate() public boolean canUpdate()
@ -118,12 +120,30 @@ public class TileEntityMechanicalPipe extends TileEntity implements IMechanicalP
public void handlePacketData(ByteArrayDataInput dataStream) public void handlePacketData(ByteArrayDataInput dataStream)
{ {
isActive = dataStream.readBoolean(); isActive = dataStream.readBoolean();
liquidScale = dataStream.readFloat();
if(dataStream.readInt() == 1)
{
refLiquid = new LiquidStack(dataStream.readInt(), LiquidContainerRegistry.BUCKET_VOLUME, dataStream.readInt());
}
} }
@Override @Override
public ArrayList getNetworkedData(ArrayList data) public ArrayList getNetworkedData(ArrayList data)
{ {
data.add(isActive); data.add(isActive);
data.add(liquidScale);
if(refLiquid != null)
{
data.add(1);
data.add(refLiquid.itemID);
data.add(refLiquid.itemMeta);
}
else {
data.add(0);
}
return data; return data;
} }

View file

@ -106,8 +106,8 @@ public class TileEntityMetallurgicInfuser extends TileEntityElectricBlock implem
Mekanism.proxy.registerSound(this); Mekanism.proxy.registerSound(this);
} }
boolean testActive = operatingTicks > 0; if(!worldObj.isRemote)
{
ChargeUtils.discharge(4, this); ChargeUtils.discharge(4, this);
if(inventory[0] != null) if(inventory[0] != null)
@ -189,11 +189,8 @@ public class TileEntityMetallurgicInfuser extends TileEntityElectricBlock implem
electricityStored -= ENERGY_PER_TICK; electricityStored -= ENERGY_PER_TICK;
} }
else if(canOperate() && (operatingTicks+1) >= MekanismUtils.getTicks(speedMultiplier, TICKS_REQUIRED)) else if(canOperate() && (operatingTicks+1) >= MekanismUtils.getTicks(speedMultiplier, TICKS_REQUIRED))
{
if(!worldObj.isRemote)
{ {
operate(); operate();
}
operatingTicks = 0; operatingTicks = 0;
electricityStored -= ENERGY_PER_TICK; electricityStored -= ENERGY_PER_TICK;
@ -211,8 +208,6 @@ public class TileEntityMetallurgicInfuser extends TileEntityElectricBlock implem
type = InfusionType.NONE; type = InfusionType.NONE;
} }
if(!worldObj.isRemote)
{
if(canOperate() && electricityStored >= ENERGY_PER_TICK) if(canOperate() && electricityStored >= ENERGY_PER_TICK)
{ {
setActive(true); setActive(true);

View file

@ -2,6 +2,8 @@ package mekanism.common;
import java.util.ArrayList; import java.util.ArrayList;
import com.google.common.io.ByteArrayDataInput;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
@ -14,15 +16,17 @@ import universalelectricity.core.vector.VectorHelper;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.AxisAlignedBB;
import net.minecraftforge.common.ForgeDirection; import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.liquids.LiquidContainerRegistry;
import net.minecraftforge.liquids.LiquidStack;
import mekanism.api.IUniversalCable; import mekanism.api.IUniversalCable;
public class TileEntityUniversalCable extends TileEntity implements IUniversalCable, IPowerReceptor public class TileEntityUniversalCable extends TileEntity implements IUniversalCable, IPowerReceptor, ITileNetwork
{ {
public CablePowerProvider powerProvider; public CablePowerProvider powerProvider;
public float liquidScale; public float liquidScale;
public float prevRoundedScale; public float prevScale;
public TileEntityUniversalCable() public TileEntityUniversalCable()
{ {
@ -36,22 +40,45 @@ public class TileEntityUniversalCable extends TileEntity implements IUniversalCa
@Override @Override
public void updateEntity() public void updateEntity()
{ {
if(!worldObj.isRemote)
{
if(liquidScale != prevScale)
{
worldObj.updateAllLightTypes(xCoord, yCoord, zCoord);
PacketHandler.sendTileEntityPacketToClients(this, 50, getNetworkedData(new ArrayList()));
}
prevScale = liquidScale;
if(liquidScale > 0) if(liquidScale > 0)
{ {
liquidScale -= .01; liquidScale -= .01;
} }
}
}
@Override
public void validate()
{
super.validate();
if(worldObj.isRemote) if(worldObj.isRemote)
{ {
float roundedScale = liquidScale*16F; PacketHandler.sendDataRequest(this);
}
}
if(roundedScale != prevRoundedScale) @Override
public void handlePacketData(ByteArrayDataInput dataStream)
{ {
worldObj.updateAllLightTypes(xCoord, yCoord, zCoord); liquidScale = dataStream.readFloat();
} }
prevRoundedScale = roundedScale; @Override
} public ArrayList getNetworkedData(ArrayList data)
{
data.add(liquidScale);
return data;
} }
@Override @Override

View file

@ -85,6 +85,8 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp
{ {
super.onUpdate(); super.onUpdate();
if(!worldObj.isRemote)
{
ChargeUtils.discharge(3, this); ChargeUtils.discharge(3, this);
if(inventory[0] != null) if(inventory[0] != null)
@ -175,12 +177,12 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp
if(oxygenStored < MAX_GAS && hydrogenStored < MAX_GAS && waterTank.getLiquid() != null && waterTank.getLiquid().amount-2 >= 0 && electricityStored-100 > 0) if(oxygenStored < MAX_GAS && hydrogenStored < MAX_GAS && waterTank.getLiquid() != null && waterTank.getLiquid().amount-2 >= 0 && electricityStored-100 > 0)
{ {
waterTank.drain(2, true); waterTank.drain(2, true);
setJoules(electricityStored - 10); setEnergy(electricityStored - 10);
setGas(EnumGas.OXYGEN, oxygenStored + 1); setGas(EnumGas.OXYGEN, oxygenStored + 1);
setGas(EnumGas.HYDROGEN, hydrogenStored + 2); setGas(EnumGas.HYDROGEN, hydrogenStored + 2);
} }
if(outputType != EnumGas.NONE && getGas(outputType) > 0 && !worldObj.isRemote) if(outputType != EnumGas.NONE && getGas(outputType) > 0)
{ {
setGas(outputType, getGas(outputType) - (Math.min(getGas(outputType), output) - GasTransmission.emitGasToNetwork(outputType, Math.min(getGas(outputType), output), this, ForgeDirection.getOrientation(facing)))); setGas(outputType, getGas(outputType) - (Math.min(getGas(outputType), output) - GasTransmission.emitGasToNetwork(outputType, Math.min(getGas(outputType), output), this, ForgeDirection.getOrientation(facing))));
@ -207,14 +209,6 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp
} }
} }
if(dumpType != EnumGas.NONE && getGas(dumpType) > 0)
{
setGas(dumpType, (getGas(dumpType) - 8));
spawnParticle();
}
if(!worldObj.isRemote)
{
if(prevTankFull != (waterTank.getLiquid() != null && waterTank.getLiquid().amount == waterTank.getCapacity()) || prevTankEmpty != (waterTank.getLiquid() == null || waterTank.getLiquid().amount == 0)) if(prevTankFull != (waterTank.getLiquid() != null && waterTank.getLiquid().amount == waterTank.getCapacity()) || prevTankEmpty != (waterTank.getLiquid() == null || waterTank.getLiquid().amount == 0))
{ {
PacketHandler.sendTileEntityPacketToClients(this, 50, getNetworkedData(new ArrayList())); PacketHandler.sendTileEntityPacketToClients(this, 50, getNetworkedData(new ArrayList()));
@ -223,6 +217,16 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp
prevTankFull = waterTank.getLiquid() != null && waterTank.getLiquid().amount == waterTank.getCapacity(); prevTankFull = waterTank.getLiquid() != null && waterTank.getLiquid().amount == waterTank.getCapacity();
prevTankEmpty = waterTank.getLiquid() == null; prevTankEmpty = waterTank.getLiquid() == null;
} }
if(dumpType != EnumGas.NONE && getGas(dumpType) > 0)
{
if(!worldObj.isRemote)
{
setGas(dumpType, (getGas(dumpType) - 8));
}
spawnParticle();
}
} }
public void spawnParticle() public void spawnParticle()

View file

@ -84,7 +84,8 @@ public abstract class TileEntityGenerator extends TileEntityElectricBlock implem
} }
} }
if(!worldObj.isRemote)
{
TileEntity tileEntity = VectorHelper.getTileEntityFromSide(worldObj, new Vector3(this), ForgeDirection.getOrientation(facing)); TileEntity tileEntity = VectorHelper.getTileEntityFromSide(worldObj, new Vector3(this), ForgeDirection.getOrientation(facing));
if(electricityStored > 0) if(electricityStored > 0)
@ -138,6 +139,7 @@ public abstract class TileEntityGenerator extends TileEntityElectricBlock implem
} }
} }
} }
}
@Override @Override
protected EnumSet<ForgeDirection> getConsumingSides() protected EnumSet<ForgeDirection> getConsumingSides()

View file

@ -54,6 +54,8 @@ public class TileEntityHeatGenerator extends TileEntityGenerator implements ITan
{ {
super.onUpdate(); super.onUpdate();
if(!worldObj.isRemote)
{
ChargeUtils.charge(1, this); ChargeUtils.charge(1, this);
if(inventory[0] != null) if(inventory[0] != null)
@ -102,24 +104,16 @@ public class TileEntityHeatGenerator extends TileEntityGenerator implements ITan
setJoules(electricityStored + getEnvironmentBoost()); setJoules(electricityStored + getEnvironmentBoost());
if(canOperate()) if(canOperate())
{
if(!worldObj.isRemote)
{ {
setActive(true); setActive(true);
}
lavaTank.drain(10, true); lavaTank.drain(10, true);
setJoules(electricityStored + GENERATION); setJoules(electricityStored + GENERATION);
} }
else { else {
if(!worldObj.isRemote)
{
setActive(false); setActive(false);
} }
}
if(!worldObj.isRemote)
{
if(prevTankFull != (lavaTank.getLiquid() != null && lavaTank.getLiquid().amount == lavaTank.getCapacity()) || prevTankEmpty != (lavaTank.getLiquid() == null || lavaTank.getLiquid().amount == 0)) if(prevTankFull != (lavaTank.getLiquid() != null && lavaTank.getLiquid().amount == lavaTank.getCapacity()) || prevTankEmpty != (lavaTank.getLiquid() == null || lavaTank.getLiquid().amount == 0))
{ {
PacketHandler.sendTileEntityPacketToClients(this, 50, getNetworkedData(new ArrayList())); PacketHandler.sendTileEntityPacketToClients(this, 50, getNetworkedData(new ArrayList()));

View file

@ -43,6 +43,8 @@ public class TileEntityHydrogenGenerator extends TileEntityGenerator implements
{ {
super.onUpdate(); super.onUpdate();
if(!worldObj.isRemote)
{
ChargeUtils.charge(1, this); ChargeUtils.charge(1, this);
if(inventory[0] != null && hydrogenStored < MAX_HYDROGEN) if(inventory[0] != null && hydrogenStored < MAX_HYDROGEN)
@ -69,24 +71,14 @@ public class TileEntityHydrogenGenerator extends TileEntityGenerator implements
} }
} }
if(hydrogenStored > MAX_HYDROGEN)
{
hydrogenStored = MAX_HYDROGEN;
}
if(canOperate()) if(canOperate())
{
if(!worldObj.isRemote)
{ {
setActive(true); setActive(true);
}
hydrogenStored-=2; hydrogenStored-=2;
setJoules(electricityStored + 200); setJoules(electricityStored + 200);
} }
else { else {
if(!worldObj.isRemote)
{
setActive(false); setActive(false);
} }
} }