Did what I could with mj6
This commit is contained in:
@@ -13,7 +13,7 @@ import appeng.transformer.annotations.integration.Interface;
|
||||
import appeng.util.Platform;
|
||||
|
||||
@Interface(iname = "IC2", iface = "ic2.api.energy.tile.IEnergySink")
|
||||
public abstract class IC2 extends MinecraftJoules implements IEnergySink
|
||||
public abstract class IC2 extends MinecraftJoules5 implements IEnergySink
|
||||
{
|
||||
|
||||
boolean isInIC2 = false;
|
||||
|
||||
@@ -4,7 +4,7 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import appeng.api.config.PowerUnits;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.integration.abstraction.IMJ;
|
||||
import appeng.integration.abstraction.IMJ5;
|
||||
import appeng.integration.abstraction.helpers.BaseMJperdition;
|
||||
import appeng.transformer.annotations.integration.Interface;
|
||||
import appeng.transformer.annotations.integration.Method;
|
||||
@@ -13,20 +13,20 @@ import buildcraft.api.power.IPowerReceptor;
|
||||
import buildcraft.api.power.PowerHandler;
|
||||
import buildcraft.api.power.PowerHandler.PowerReceiver;
|
||||
|
||||
@Interface(iname = "BC", iface = "buildcraft.api.power.IPowerReceptor")
|
||||
public abstract class MinecraftJoules extends AERootPoweredTile implements IPowerReceptor
|
||||
@Interface(iname = "MJ5", iface = "buildcraft.api.power.IPowerReceptor")
|
||||
public abstract class MinecraftJoules5 extends AERootPoweredTile implements IPowerReceptor
|
||||
{
|
||||
|
||||
BaseMJperdition bcPowerWrapper;
|
||||
|
||||
public MinecraftJoules() {
|
||||
public MinecraftJoules5() {
|
||||
if ( Platform.isServer() )
|
||||
{
|
||||
try
|
||||
{
|
||||
if ( AppEng.instance.isIntegrationEnabled( "MJ" ) )
|
||||
if ( AppEng.instance.isIntegrationEnabled( "MJ5" ) )
|
||||
{
|
||||
IMJ mjIntegration = (IMJ) AppEng.instance.getIntegration( "MJ" );
|
||||
IMJ5 mjIntegration = (IMJ5) AppEng.instance.getIntegration( "MJ5" );
|
||||
if ( mjIntegration != null )
|
||||
{
|
||||
addNewHandler( bcPowerWrapper = (BaseMJperdition) mjIntegration.createPerdition( this ) );
|
||||
@@ -43,7 +43,7 @@ public abstract class MinecraftJoules extends AERootPoweredTile implements IPowe
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(iname = "BC")
|
||||
@Method(iname = "MJ5")
|
||||
final public PowerReceiver getPowerReceiver(ForgeDirection side)
|
||||
{
|
||||
if ( internalCanAcceptPower && getPowerSides().contains( side ) && bcPowerWrapper != null )
|
||||
@@ -52,7 +52,7 @@ public abstract class MinecraftJoules extends AERootPoweredTile implements IPowe
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(iname = "BC")
|
||||
@Method(iname = "MJ5")
|
||||
final public void doWork(PowerHandler workProvider)
|
||||
{
|
||||
float requred = (float) getExternalPowerDemand( PowerUnits.MJ );
|
||||
@@ -62,7 +62,7 @@ public abstract class MinecraftJoules extends AERootPoweredTile implements IPowe
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(iname = "BC")
|
||||
@Method(iname = "MJ5")
|
||||
final public World getWorld()
|
||||
{
|
||||
return worldObj;
|
||||
@@ -0,0 +1,87 @@
|
||||
package appeng.tile.powersink;
|
||||
|
||||
import appeng.api.config.PowerUnits;
|
||||
import appeng.transformer.annotations.integration.Interface;
|
||||
import appeng.transformer.annotations.integration.InterfaceList;
|
||||
import appeng.transformer.annotations.integration.Method;
|
||||
import buildcraft.api.mj.IBatteryObject;
|
||||
import buildcraft.api.mj.IBatteryProvider;
|
||||
|
||||
@InterfaceList(value = { @Interface(iname = "MJ6", iface = "buildcraft.api.mj.IBatteryProvider"),
|
||||
@Interface(iname = "MJ6", iface = "buildcraft.api.mj.IBatteryObject") })
|
||||
public abstract class MinecraftJoules6 extends AERootPoweredTile implements IBatteryProvider, IBatteryObject
|
||||
{
|
||||
|
||||
@Override
|
||||
@Method(iname = "MJ6")
|
||||
public double getEnergyRequested()
|
||||
{
|
||||
return getExternalPowerDemand( PowerUnits.MJ );
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(iname = "MJ6")
|
||||
public double addEnergy(double amount)
|
||||
{
|
||||
double overflow = PowerUnits.MJ.convertTo( PowerUnits.AE, injectExternalPower( PowerUnits.MJ, amount ) );
|
||||
return amount - overflow;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(iname = "MJ6")
|
||||
public double addEnergy(double amount, boolean ignoreCycleLimit)
|
||||
{
|
||||
double overflow = PowerUnits.MJ.convertTo( PowerUnits.AE, injectExternalPower( PowerUnits.MJ, amount ) );
|
||||
return amount - overflow;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(iname = "MJ6")
|
||||
public double getEnergyStored()
|
||||
{
|
||||
return PowerUnits.AE.convertTo( PowerUnits.MJ, internalCurrentPower );
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(iname = "MJ6")
|
||||
public void setEnergyStored(double mj)
|
||||
{
|
||||
internalCurrentPower = PowerUnits.MJ.convertTo( PowerUnits.AE, mj );
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(iname = "MJ6")
|
||||
public double maxCapacity()
|
||||
{
|
||||
return PowerUnits.AE.convertTo( PowerUnits.MJ, internalMaxPower );
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(iname = "MJ6")
|
||||
public double minimumConsumption()
|
||||
{
|
||||
return 0.1;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(iname = "MJ6")
|
||||
public double maxReceivedPerCycle()
|
||||
{
|
||||
return 999999.0;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(iname = "MJ6")
|
||||
public IBatteryObject reconfigure(double maxCapacity, double maxReceivedPerCycle, double minimumConsumption)
|
||||
{
|
||||
return getMjBattery();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(iname = "MJ6")
|
||||
public IBatteryObject getMjBattery()
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user