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:
parent
4bb292d32a
commit
4f5ce2f9e9
18 changed files with 674 additions and 670 deletions
|
@ -135,7 +135,7 @@ public class Sound
|
|||
{
|
||||
synchronized(Mekanism.audioHandler.sounds)
|
||||
{
|
||||
if(entityplayer.worldObj == tileEntity.worldObj)
|
||||
if(entityplayer != null && tileEntity != null && entityplayer.worldObj == tileEntity.worldObj)
|
||||
{
|
||||
float volume = 0;
|
||||
|
||||
|
|
|
@ -143,12 +143,11 @@ public class EnergyTransferProtocol
|
|||
{
|
||||
loopThrough(pointer);
|
||||
|
||||
boolean fill = FMLCommonHandler.instance().getEffectiveSide().isServer();
|
||||
|
||||
Collections.shuffle(availableAcceptors);
|
||||
|
||||
if(fill)
|
||||
{
|
||||
double prevNeeded = neededEnergy();
|
||||
double prevSending = energyToSend;
|
||||
|
||||
if(!availableAcceptors.isEmpty())
|
||||
{
|
||||
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)
|
||||
{
|
||||
|
@ -199,7 +195,6 @@ public class EnergyTransferProtocol
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return energyToSend;
|
||||
}
|
||||
|
|
|
@ -50,6 +50,12 @@ public class EntityObsidianTNT extends Entity
|
|||
return !isDead;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBePushed()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate()
|
||||
{
|
||||
|
|
|
@ -58,7 +58,7 @@ public class ItemBlockTransmitter extends ItemBlock
|
|||
else if(itemstack.getItemDamage() == 2)
|
||||
{
|
||||
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)");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -150,7 +150,6 @@ public class LiquidTransferProtocol
|
|||
{
|
||||
loopThrough(pointer);
|
||||
|
||||
boolean fill = FMLCommonHandler.instance().getEffectiveSide().isServer();
|
||||
Collections.shuffle(availableAcceptors);
|
||||
|
||||
int liquidSent = 0;
|
||||
|
@ -187,7 +186,7 @@ public class LiquidTransferProtocol
|
|||
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 {
|
||||
|
@ -195,13 +194,13 @@ public class LiquidTransferProtocol
|
|||
{
|
||||
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)
|
||||
{
|
||||
|
@ -212,8 +211,6 @@ public class LiquidTransferProtocol
|
|||
((IMechanicalPipe)tileEntity).onTransfer(sendStack);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
return liquidSent;
|
||||
|
|
|
@ -74,8 +74,8 @@ public abstract class TileEntityAdvancedElectricMachine extends TileEntityBasicM
|
|||
{
|
||||
super.onUpdate();
|
||||
|
||||
boolean testActive = operatingTicks > 0;
|
||||
|
||||
if(!worldObj.isRemote)
|
||||
{
|
||||
if(inventory[3] != null)
|
||||
{
|
||||
if(electricityStored < MekanismUtils.getEnergy(energyMultiplier, MAX_ELECTRICITY))
|
||||
|
@ -163,11 +163,8 @@ public abstract class TileEntityAdvancedElectricMachine extends TileEntityBasicM
|
|||
electricityStored -= ENERGY_PER_TICK;
|
||||
}
|
||||
else if((operatingTicks+1) >= MekanismUtils.getTicks(speedMultiplier, TICKS_REQUIRED))
|
||||
{
|
||||
if(!worldObj.isRemote)
|
||||
{
|
||||
operate();
|
||||
}
|
||||
|
||||
operatingTicks = 0;
|
||||
secondaryEnergyStored -= SECONDARY_ENERGY_PER_TICK;
|
||||
|
@ -180,8 +177,6 @@ public abstract class TileEntityAdvancedElectricMachine extends TileEntityBasicM
|
|||
operatingTicks = 0;
|
||||
}
|
||||
|
||||
if(!worldObj.isRemote)
|
||||
{
|
||||
if(canOperate() && electricityStored >= ENERGY_PER_TICK && secondaryEnergyStored >= SECONDARY_ENERGY_PER_TICK)
|
||||
{
|
||||
setActive(true);
|
||||
|
|
|
@ -35,12 +35,10 @@ public abstract class TileEntityBasicBlock extends TileEntityDisableable impleme
|
|||
if(!worldObj.isRemote)
|
||||
{
|
||||
if(playersUsing > 0)
|
||||
{
|
||||
if(packetTick % 3 == 0)
|
||||
{
|
||||
PacketHandler.sendTileEntityPacketToClients(this, 50, getNetworkedData(new ArrayList()));
|
||||
}
|
||||
}
|
||||
|
||||
packetTick++;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,10 +34,6 @@ public abstract class TileEntityElectricBlock extends TileEntityContainerBlock i
|
|||
/** BuildCraft power provider. */
|
||||
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,
|
||||
* 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());
|
||||
setJoules(getJoules()+electricityPack.getWatts());
|
||||
|
||||
if(prevFull != (getMaxEnergy() == getEnergy()) || prevEmpty != (getEnergy() == 0))
|
||||
{
|
||||
PacketHandler.sendTileEntityPacketToClients(this, 50, getNetworkedData(new ArrayList()));
|
||||
}
|
||||
|
||||
prevFull = getMaxEnergy() == getEnergy();
|
||||
prevEmpty = getEnergy() == 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -43,6 +43,13 @@ public abstract class TileEntityElectricMachine extends TileEntityBasicMachine
|
|||
{
|
||||
super.onUpdate();
|
||||
|
||||
if(worldObj.isRemote)
|
||||
{
|
||||
System.out.println(electricityStored);
|
||||
}
|
||||
|
||||
if(!worldObj.isRemote)
|
||||
{
|
||||
ChargeUtils.discharge(1, this);
|
||||
|
||||
if(inventory[3] != null)
|
||||
|
@ -101,11 +108,8 @@ public abstract class TileEntityElectricMachine extends TileEntityBasicMachine
|
|||
electricityStored -= ENERGY_PER_TICK;
|
||||
}
|
||||
else if(canOperate() && (operatingTicks+1) >= MekanismUtils.getTicks(speedMultiplier, TICKS_REQUIRED))
|
||||
{
|
||||
if(!worldObj.isRemote)
|
||||
{
|
||||
operate();
|
||||
}
|
||||
|
||||
operatingTicks = 0;
|
||||
electricityStored -= ENERGY_PER_TICK;
|
||||
|
@ -117,8 +121,6 @@ public abstract class TileEntityElectricMachine extends TileEntityBasicMachine
|
|||
operatingTicks = 0;
|
||||
}
|
||||
|
||||
if(!worldObj.isRemote)
|
||||
{
|
||||
if(canOperate() && electricityStored >= ENERGY_PER_TICK)
|
||||
{
|
||||
setActive(true);
|
||||
|
|
|
@ -67,6 +67,8 @@ public class TileEntityEnergyCube extends TileEntityElectricBlock implements IEn
|
|||
ChargeUtils.charge(0, this);
|
||||
ChargeUtils.discharge(1, this);
|
||||
|
||||
if(!worldObj.isRemote)
|
||||
{
|
||||
TileEntity tileEntity = VectorHelper.getTileEntityFromSide(worldObj, new Vector3(this), ForgeDirection.getOrientation(facing));
|
||||
|
||||
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))));
|
||||
return;
|
||||
}
|
||||
|
||||
if(!worldObj.isRemote)
|
||||
{
|
||||
if((tileEntity instanceof IEnergyConductor || tileEntity instanceof IEnergyAcceptor) && Mekanism.hooks.IC2Loaded)
|
||||
else if((tileEntity instanceof IEnergyConductor || tileEntity instanceof IEnergyAcceptor) && Mekanism.hooks.IC2Loaded)
|
||||
{
|
||||
if(electricityStored >= tier.OUTPUT)
|
||||
{
|
||||
|
@ -97,9 +96,8 @@ public class TileEntityEnergyCube extends TileEntityElectricBlock implements IEn
|
|||
setJoules(electricityStored - transferEnergy);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!worldObj.isRemote && tileEntity instanceof IConductor)
|
||||
if(tileEntity instanceof IConductor)
|
||||
{
|
||||
ForgeDirection outputDirection = ForgeDirection.getOrientation(facing);
|
||||
ArrayList<IElectricityNetwork> inputNetworks = new ArrayList<IElectricityNetwork>();
|
||||
|
@ -135,6 +133,7 @@ public class TileEntityEnergyCube extends TileEntityElectricBlock implements IEn
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isStackValidForSlot(int slotID, ItemStack itemstack)
|
||||
|
|
|
@ -104,16 +104,8 @@ public class TileEntityFactory extends TileEntityElectricBlock implements IEnerg
|
|||
Mekanism.proxy.registerSound(this);
|
||||
}
|
||||
|
||||
boolean testActive = false;
|
||||
|
||||
for(int i : progress)
|
||||
if(!worldObj.isRemote)
|
||||
{
|
||||
if(i > 0)
|
||||
{
|
||||
testActive = true;
|
||||
}
|
||||
}
|
||||
|
||||
ChargeUtils.discharge(1, this);
|
||||
|
||||
if(inventory[0] != null)
|
||||
|
@ -174,11 +166,8 @@ public class TileEntityFactory extends TileEntityElectricBlock implements IEnerg
|
|||
electricityStored -= ENERGY_PER_TICK;
|
||||
}
|
||||
else if(canOperate(getInputSlot(process), getOutputSlot(process)) && (progress[process]+1) >= MekanismUtils.getTicks(speedMultiplier, TICKS_REQUIRED))
|
||||
{
|
||||
if(!worldObj.isRemote)
|
||||
{
|
||||
operate(getInputSlot(process), getOutputSlot(process));
|
||||
}
|
||||
|
||||
progress[process] = 0;
|
||||
electricityStored -= ENERGY_PER_TICK;
|
||||
|
@ -213,6 +202,7 @@ public class TileEntityFactory extends TileEntityElectricBlock implements IEnerg
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean func_102008_b(int slotID, ItemStack itemstack, int side)
|
||||
|
|
|
@ -25,13 +25,15 @@ public class TileEntityMechanicalPipe extends TileEntity implements IMechanicalP
|
|||
{
|
||||
public LiquidTank dummyTank = new LiquidTank(LiquidContainerRegistry.BUCKET_VOLUME);
|
||||
|
||||
public LiquidStack prevLiquid;
|
||||
|
||||
public LiquidStack refLiquid = null;
|
||||
|
||||
public boolean isActive = false;
|
||||
|
||||
public float liquidScale;
|
||||
|
||||
public float prevRoundedScale;
|
||||
public float prevScale;
|
||||
|
||||
@Override
|
||||
public boolean canTransferLiquids(TileEntity fromTile)
|
||||
|
@ -56,6 +58,17 @@ public class TileEntityMechanicalPipe extends TileEntity implements IMechanicalP
|
|||
@Override
|
||||
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)
|
||||
{
|
||||
liquidScale -= .01;
|
||||
|
@ -64,18 +77,6 @@ public class TileEntityMechanicalPipe extends TileEntity implements IMechanicalP
|
|||
refLiquid = null;
|
||||
}
|
||||
|
||||
if(worldObj.isRemote)
|
||||
{
|
||||
float roundedScale = liquidScale*16F;
|
||||
|
||||
if(roundedScale != prevRoundedScale)
|
||||
{
|
||||
worldObj.updateAllLightTypes(xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
prevRoundedScale = roundedScale;
|
||||
}
|
||||
|
||||
if(isActive)
|
||||
{
|
||||
ITankContainer[] connectedAcceptors = PipeUtils.getConnectedAcceptors(this);
|
||||
|
@ -96,6 +97,7 @@ public class TileEntityMechanicalPipe extends TileEntity implements IMechanicalP
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUpdate()
|
||||
|
@ -118,12 +120,30 @@ public class TileEntityMechanicalPipe extends TileEntity implements IMechanicalP
|
|||
public void handlePacketData(ByteArrayDataInput dataStream)
|
||||
{
|
||||
isActive = dataStream.readBoolean();
|
||||
liquidScale = dataStream.readFloat();
|
||||
|
||||
if(dataStream.readInt() == 1)
|
||||
{
|
||||
refLiquid = new LiquidStack(dataStream.readInt(), LiquidContainerRegistry.BUCKET_VOLUME, dataStream.readInt());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList getNetworkedData(ArrayList data)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -106,8 +106,8 @@ public class TileEntityMetallurgicInfuser extends TileEntityElectricBlock implem
|
|||
Mekanism.proxy.registerSound(this);
|
||||
}
|
||||
|
||||
boolean testActive = operatingTicks > 0;
|
||||
|
||||
if(!worldObj.isRemote)
|
||||
{
|
||||
ChargeUtils.discharge(4, this);
|
||||
|
||||
if(inventory[0] != null)
|
||||
|
@ -189,11 +189,8 @@ public class TileEntityMetallurgicInfuser extends TileEntityElectricBlock implem
|
|||
electricityStored -= ENERGY_PER_TICK;
|
||||
}
|
||||
else if(canOperate() && (operatingTicks+1) >= MekanismUtils.getTicks(speedMultiplier, TICKS_REQUIRED))
|
||||
{
|
||||
if(!worldObj.isRemote)
|
||||
{
|
||||
operate();
|
||||
}
|
||||
|
||||
operatingTicks = 0;
|
||||
electricityStored -= ENERGY_PER_TICK;
|
||||
|
@ -211,8 +208,6 @@ public class TileEntityMetallurgicInfuser extends TileEntityElectricBlock implem
|
|||
type = InfusionType.NONE;
|
||||
}
|
||||
|
||||
if(!worldObj.isRemote)
|
||||
{
|
||||
if(canOperate() && electricityStored >= ENERGY_PER_TICK)
|
||||
{
|
||||
setActive(true);
|
||||
|
|
|
@ -2,6 +2,8 @@ package mekanism.common;
|
|||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
|
@ -14,15 +16,17 @@ import universalelectricity.core.vector.VectorHelper;
|
|||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraftforge.liquids.LiquidContainerRegistry;
|
||||
import net.minecraftforge.liquids.LiquidStack;
|
||||
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 float liquidScale;
|
||||
|
||||
public float prevRoundedScale;
|
||||
public float prevScale;
|
||||
|
||||
public TileEntityUniversalCable()
|
||||
{
|
||||
|
@ -36,22 +40,45 @@ public class TileEntityUniversalCable extends TileEntity implements IUniversalCa
|
|||
@Override
|
||||
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)
|
||||
{
|
||||
liquidScale -= .01;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validate()
|
||||
{
|
||||
super.validate();
|
||||
|
||||
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
|
||||
|
|
|
@ -85,6 +85,8 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp
|
|||
{
|
||||
super.onUpdate();
|
||||
|
||||
if(!worldObj.isRemote)
|
||||
{
|
||||
ChargeUtils.discharge(3, this);
|
||||
|
||||
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)
|
||||
{
|
||||
waterTank.drain(2, true);
|
||||
setJoules(electricityStored - 10);
|
||||
setEnergy(electricityStored - 10);
|
||||
setGas(EnumGas.OXYGEN, oxygenStored + 1);
|
||||
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))));
|
||||
|
||||
|
@ -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))
|
||||
{
|
||||
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();
|
||||
prevTankEmpty = waterTank.getLiquid() == null;
|
||||
}
|
||||
|
||||
if(dumpType != EnumGas.NONE && getGas(dumpType) > 0)
|
||||
{
|
||||
if(!worldObj.isRemote)
|
||||
{
|
||||
setGas(dumpType, (getGas(dumpType) - 8));
|
||||
}
|
||||
|
||||
spawnParticle();
|
||||
}
|
||||
}
|
||||
|
||||
public void spawnParticle()
|
||||
|
|
|
@ -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));
|
||||
|
||||
if(electricityStored > 0)
|
||||
|
@ -138,6 +139,7 @@ public abstract class TileEntityGenerator extends TileEntityElectricBlock implem
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected EnumSet<ForgeDirection> getConsumingSides()
|
||||
|
|
|
@ -54,6 +54,8 @@ public class TileEntityHeatGenerator extends TileEntityGenerator implements ITan
|
|||
{
|
||||
super.onUpdate();
|
||||
|
||||
if(!worldObj.isRemote)
|
||||
{
|
||||
ChargeUtils.charge(1, this);
|
||||
|
||||
if(inventory[0] != null)
|
||||
|
@ -102,24 +104,16 @@ public class TileEntityHeatGenerator extends TileEntityGenerator implements ITan
|
|||
setJoules(electricityStored + getEnvironmentBoost());
|
||||
|
||||
if(canOperate())
|
||||
{
|
||||
if(!worldObj.isRemote)
|
||||
{
|
||||
setActive(true);
|
||||
}
|
||||
|
||||
lavaTank.drain(10, true);
|
||||
setJoules(electricityStored + GENERATION);
|
||||
}
|
||||
else {
|
||||
if(!worldObj.isRemote)
|
||||
{
|
||||
setActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
if(!worldObj.isRemote)
|
||||
{
|
||||
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()));
|
||||
|
|
|
@ -43,6 +43,8 @@ public class TileEntityHydrogenGenerator extends TileEntityGenerator implements
|
|||
{
|
||||
super.onUpdate();
|
||||
|
||||
if(!worldObj.isRemote)
|
||||
{
|
||||
ChargeUtils.charge(1, this);
|
||||
|
||||
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(!worldObj.isRemote)
|
||||
{
|
||||
setActive(true);
|
||||
}
|
||||
|
||||
hydrogenStored-=2;
|
||||
setJoules(electricityStored + 200);
|
||||
}
|
||||
else {
|
||||
if(!worldObj.isRemote)
|
||||
{
|
||||
setActive(false);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue