Fixed a few energy transfer issues
This commit is contained in:
parent
2b5bb53bc6
commit
bb8985b6f8
4 changed files with 23 additions and 23 deletions
|
@ -20,7 +20,6 @@ import net.minecraft.util.MathHelper;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
import cpw.mods.fml.common.Optional.Interface;
|
import cpw.mods.fml.common.Optional.Interface;
|
||||||
import cpw.mods.fml.common.Optional.Method;
|
import cpw.mods.fml.common.Optional.Method;
|
||||||
|
|
||||||
import dan200.computercraft.api.lua.ILuaContext;
|
import dan200.computercraft.api.lua.ILuaContext;
|
||||||
import dan200.computercraft.api.peripheral.IComputerAccess;
|
import dan200.computercraft.api.peripheral.IComputerAccess;
|
||||||
import dan200.computercraft.api.peripheral.IPeripheral;
|
import dan200.computercraft.api.peripheral.IPeripheral;
|
||||||
|
@ -55,22 +54,25 @@ public class TileEntityEnergyCube extends TileEntityElectricBlock implements IPe
|
||||||
{
|
{
|
||||||
super.onUpdate();
|
super.onUpdate();
|
||||||
|
|
||||||
ChargeUtils.charge(0, this);
|
if(!worldObj.isRemote)
|
||||||
ChargeUtils.discharge(1, this);
|
|
||||||
|
|
||||||
if(MekanismUtils.canFunction(this))
|
|
||||||
{
|
{
|
||||||
CableUtils.emit(this);
|
ChargeUtils.charge(0, this);
|
||||||
|
ChargeUtils.discharge(1, this);
|
||||||
|
|
||||||
|
if(MekanismUtils.canFunction(this))
|
||||||
|
{
|
||||||
|
CableUtils.emit(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
int newScale = getScaledEnergyLevel(20);
|
||||||
|
|
||||||
|
if(newScale != prevScale)
|
||||||
|
{
|
||||||
|
Mekanism.packetHandler.sendToAllAround(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList())), Coord4D.get(this).getTargetPoint(50D));
|
||||||
|
}
|
||||||
|
|
||||||
|
prevScale = newScale;
|
||||||
}
|
}
|
||||||
|
|
||||||
int newScale = getScaledEnergyLevel(20);
|
|
||||||
|
|
||||||
if(newScale != prevScale)
|
|
||||||
{
|
|
||||||
Mekanism.packetHandler.sendToAllAround(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList())), Coord4D.get(this).getTargetPoint(50D));
|
|
||||||
}
|
|
||||||
|
|
||||||
prevScale = newScale;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -46,10 +46,10 @@ public class TileEntityBioGenerator extends TileEntityGenerator implements IFlui
|
||||||
{
|
{
|
||||||
super.onUpdate();
|
super.onUpdate();
|
||||||
|
|
||||||
ChargeUtils.charge(1, this);
|
|
||||||
|
|
||||||
if(inventory[0] != null)
|
if(inventory[0] != null)
|
||||||
{
|
{
|
||||||
|
ChargeUtils.charge(1, this);
|
||||||
|
|
||||||
FluidStack fluid = FluidContainerRegistry.getFluidForFilledItem(inventory[0]);
|
FluidStack fluid = FluidContainerRegistry.getFluidForFilledItem(inventory[0]);
|
||||||
|
|
||||||
if(fluid != null && FluidRegistry.isFluidRegistered("bioethanol"))
|
if(fluid != null && FluidRegistry.isFluidRegistered("bioethanol"))
|
||||||
|
|
|
@ -15,7 +15,6 @@ import net.minecraft.world.biome.BiomeGenDesert;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
import cpw.mods.fml.common.ModAPIManager;
|
import cpw.mods.fml.common.ModAPIManager;
|
||||||
import cpw.mods.fml.common.Optional.Method;
|
import cpw.mods.fml.common.Optional.Method;
|
||||||
|
|
||||||
import dan200.computercraft.api.lua.ILuaContext;
|
import dan200.computercraft.api.lua.ILuaContext;
|
||||||
import dan200.computercraft.api.peripheral.IComputerAccess;
|
import dan200.computercraft.api.peripheral.IComputerAccess;
|
||||||
|
|
||||||
|
@ -63,10 +62,10 @@ public class TileEntitySolarGenerator extends TileEntityGenerator
|
||||||
{
|
{
|
||||||
super.onUpdate();
|
super.onUpdate();
|
||||||
|
|
||||||
ChargeUtils.charge(0, this);
|
|
||||||
|
|
||||||
if(!worldObj.isRemote)
|
if(!worldObj.isRemote)
|
||||||
{
|
{
|
||||||
|
ChargeUtils.charge(0, this);
|
||||||
|
|
||||||
if(worldObj.isDaytime() && ((!worldObj.isRaining() && !worldObj.isThundering()) || isDesert()) && !worldObj.provider.hasNoSky && worldObj.canBlockSeeTheSky(xCoord, yCoord+1, zCoord))
|
if(worldObj.isDaytime() && ((!worldObj.isRaining() && !worldObj.isThundering()) || isDesert()) && !worldObj.provider.hasNoSky && worldObj.canBlockSeeTheSky(xCoord, yCoord+1, zCoord))
|
||||||
{
|
{
|
||||||
seesSun = true;
|
seesSun = true;
|
||||||
|
|
|
@ -8,7 +8,6 @@ import mekanism.common.util.MekanismUtils;
|
||||||
import mekanism.generators.common.MekanismGenerators;
|
import mekanism.generators.common.MekanismGenerators;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import cpw.mods.fml.common.Optional.Method;
|
import cpw.mods.fml.common.Optional.Method;
|
||||||
|
|
||||||
import dan200.computercraft.api.lua.ILuaContext;
|
import dan200.computercraft.api.lua.ILuaContext;
|
||||||
import dan200.computercraft.api.peripheral.IComputerAccess;
|
import dan200.computercraft.api.peripheral.IComputerAccess;
|
||||||
|
|
||||||
|
@ -28,10 +27,10 @@ public class TileEntityWindTurbine extends TileEntityGenerator implements IBound
|
||||||
{
|
{
|
||||||
super.onUpdate();
|
super.onUpdate();
|
||||||
|
|
||||||
ChargeUtils.charge(0, this);
|
|
||||||
|
|
||||||
if(!worldObj.isRemote)
|
if(!worldObj.isRemote)
|
||||||
{
|
{
|
||||||
|
ChargeUtils.charge(0, this);
|
||||||
|
|
||||||
if(canOperate())
|
if(canOperate())
|
||||||
{
|
{
|
||||||
setActive(true);
|
setActive(true);
|
||||||
|
|
Loading…
Add table
Reference in a new issue