BuildCraft now also working without shipping API
This commit is contained in:
parent
611d4c8f52
commit
8ddda5d0dc
16 changed files with 40 additions and 29 deletions
|
@ -57,9 +57,7 @@ public class PartUniversalCable extends PartTransmitter<EnergyNetwork> implement
|
|||
|
||||
if(MekanismUtils.useBuildCraft())
|
||||
{
|
||||
powerHandler = new PowerHandler(this, PowerHandler.Type.STORAGE);
|
||||
powerHandler.configurePowerPerdition(0, 0);
|
||||
powerHandler.configure(0, 0, 0, 0);
|
||||
configure();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -135,7 +133,8 @@ public class PartUniversalCable extends PartTransmitter<EnergyNetwork> implement
|
|||
{
|
||||
super.refreshTransmitterNetwork();
|
||||
|
||||
reconfigure();
|
||||
if(MekanismUtils.useBuildCraft())
|
||||
reconfigure();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -369,27 +368,31 @@ public class PartUniversalCable extends PartTransmitter<EnergyNetwork> implement
|
|||
return world();
|
||||
}
|
||||
|
||||
@Method(modid = "BuildCraftAPI|power")
|
||||
private void configure()
|
||||
{
|
||||
powerHandler = new PowerHandler(this, PowerHandler.Type.STORAGE);
|
||||
powerHandler.configurePowerPerdition(0, 0);
|
||||
powerHandler.configure(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
@Method(modid = "BuildCraftAPI|power")
|
||||
private void reconfigure()
|
||||
{
|
||||
if(MekanismUtils.useBuildCraft())
|
||||
{
|
||||
float needed = (float)(getTransmitterNetwork().getEnergyNeeded()*Mekanism.TO_BC);
|
||||
powerHandler.configure(1, needed, 0, needed);
|
||||
}
|
||||
float needed = (float)(getTransmitterNetwork().getEnergyNeeded()*Mekanism.TO_BC);
|
||||
powerHandler.configure(1, needed, 0, needed);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(modid = "BuildCraftAPI|power")
|
||||
public void doWork(PowerHandler workProvider)
|
||||
{
|
||||
if(MekanismUtils.useBuildCraft())
|
||||
if(powerHandler.getEnergyStored() > 0)
|
||||
{
|
||||
if(powerHandler.getEnergyStored() > 0)
|
||||
{
|
||||
getTransmitterNetwork().emit(powerHandler.getEnergyStored()*Mekanism.FROM_BC);
|
||||
}
|
||||
|
||||
powerHandler.setEnergy(0);
|
||||
reconfigure();
|
||||
getTransmitterNetwork().emit(powerHandler.getEnergyStored()*Mekanism.FROM_BC);
|
||||
}
|
||||
|
||||
powerHandler.setEnergy(0);
|
||||
reconfigure();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -62,13 +62,18 @@ public abstract class TileEntityElectricBlock extends TileEntityContainerBlock i
|
|||
MAX_ELECTRICITY = maxEnergy;
|
||||
|
||||
if(MekanismUtils.useBuildCraft())
|
||||
{
|
||||
powerHandler = new PowerHandler(this, PowerHandler.Type.STORAGE);
|
||||
powerHandler.configurePowerPerdition(0, 0);
|
||||
powerHandler.configure(0, 0, 0, 0);
|
||||
}
|
||||
configure();
|
||||
}
|
||||
|
||||
@Method(modid = "BuildCraftAPI|power")
|
||||
public void configure()
|
||||
{
|
||||
powerHandler = new PowerHandler(this, PowerHandler.Type.STORAGE);
|
||||
powerHandler.configurePowerPerdition(0, 0);
|
||||
powerHandler.configure(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
|
||||
@Method(modid = "IC2API")
|
||||
public void register()
|
||||
{
|
||||
|
@ -98,7 +103,8 @@ public abstract class TileEntityElectricBlock extends TileEntityContainerBlock i
|
|||
@Override
|
||||
public void onUpdate()
|
||||
{
|
||||
reconfigure();
|
||||
if(MekanismUtils.useBuildCraft())
|
||||
reconfigure();
|
||||
}
|
||||
|
||||
public EnumSet<ForgeDirection> getOutputtingSides()
|
||||
|
@ -156,7 +162,7 @@ public abstract class TileEntityElectricBlock extends TileEntityContainerBlock i
|
|||
public void onChunkUnload()
|
||||
{
|
||||
if(MekanismUtils.useIC2())
|
||||
deregister();
|
||||
deregister();
|
||||
|
||||
super.onChunkUnload();
|
||||
}
|
||||
|
@ -167,7 +173,7 @@ public abstract class TileEntityElectricBlock extends TileEntityContainerBlock i
|
|||
super.invalidate();
|
||||
|
||||
if(MekanismUtils.useIC2())
|
||||
deregister();
|
||||
deregister();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -176,7 +182,9 @@ public abstract class TileEntityElectricBlock extends TileEntityContainerBlock i
|
|||
super.readFromNBT(nbtTags);
|
||||
|
||||
electricityStored = nbtTags.getDouble("electricityStored");
|
||||
reconfigure();
|
||||
|
||||
if(MekanismUtils.useBuildCraft())
|
||||
reconfigure();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -199,12 +207,10 @@ public abstract class TileEntityElectricBlock extends TileEntityContainerBlock i
|
|||
return null;
|
||||
}
|
||||
|
||||
@Method(modid = "BuildCraftAPI|power")
|
||||
protected void reconfigure()
|
||||
{
|
||||
if(MekanismUtils.useBuildCraft())
|
||||
{
|
||||
powerHandler.configure(1, (float)((getMaxEnergy()-getEnergy())*Mekanism.TO_BC), 0, (float)(getMaxEnergy()*Mekanism.TO_BC));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -18,6 +18,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
|||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import cpw.mods.fml.common.Optional.Method;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import dan200.computercraft.api.peripheral.IComputerAccess;
|
||||
|
@ -269,6 +270,7 @@ public abstract class TileEntityGenerator extends TileEntityElectricBlock implem
|
|||
}
|
||||
|
||||
@Override
|
||||
@Method(modid = "BuildCraftAPI|power")
|
||||
protected void reconfigure()
|
||||
{
|
||||
powerHandler.configure(0, 0, 0, 0);
|
||||
|
|
Loading…
Reference in a new issue