Fixes #743 crash with plugs, fixes #942 builder integration, closes #319 BC 6 prep

This commit is contained in:
thatsIch
2014-12-21 19:08:05 +01:00
parent cdf949a557
commit e300bf93fd
31 changed files with 261 additions and 1692 deletions
@@ -18,6 +18,7 @@
package appeng.integration.abstraction;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
@@ -28,24 +29,24 @@ import net.minecraftforge.common.util.ForgeDirection;
import appeng.api.parts.IFacadePart;
public interface IBC
{
boolean isWrench( Item eq );
boolean isWrench(Item eq);
boolean canWrench( Item i, EntityPlayer p, int x, int y, int z );
boolean canWrench(Item i, EntityPlayer p, int x, int y, int z);
void wrenchUsed( Item i, EntityPlayer p, int x, int y, int z );
void wrenchUsed(Item i, EntityPlayer p, int x, int y, int z);
boolean canAddItemsToPipe( TileEntity te, ItemStack is, ForgeDirection dir );
boolean canAddItemsToPipe(TileEntity te, ItemStack is, ForgeDirection dir);
boolean addItemsToPipe( TileEntity te, ItemStack is, ForgeDirection dir );
boolean addItemsToPipe(TileEntity te, ItemStack is, ForgeDirection dir);
boolean isFacade( ItemStack is );
boolean isFacade(ItemStack is);
boolean isPipe( TileEntity te, ForgeDirection dir );
boolean isPipe(TileEntity te, ForgeDirection dir);
void addFacade(ItemStack item);
void addFacade( ItemStack item );
void registerPowerP2P();
@@ -53,12 +54,11 @@ public interface IBC
void registerLiquidsP2P();
IFacadePart createFacadePart(Block blk, int meta, ForgeDirection side);
IFacadePart createFacadePart( Block blk, int meta, ForgeDirection side );
IFacadePart createFacadePart(ItemStack held, ForgeDirection side);
IFacadePart createFacadePart( ItemStack held, ForgeDirection side );
ItemStack getTextureForFacade(ItemStack facade);
ItemStack getTextureForFacade( ItemStack facade );
IIcon getFacadeTexture();
}
@@ -1,27 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.integration.abstraction;
public interface IMJ5
{
Object createPerdition(Object buildCraft);
}
@@ -1,31 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.integration.abstraction;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
import buildcraft.api.mj.IBatteryObject;
public interface IMJ6
{
IBatteryObject provider(TileEntity te, ForgeDirection side);
}
@@ -1,43 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.integration.abstraction.helpers;
import net.minecraft.nbt.NBTTagCompound;
import buildcraft.api.power.PowerHandler.PowerReceiver;
import appeng.transformer.annotations.integration.Method;
public abstract class BaseMJPerdition
{
@Method(iname = "MJ5")
public abstract PowerReceiver getPowerReceiver();
public abstract double useEnergy(double f, double required, boolean b);
public abstract void addEnergy(float failed);
public abstract void configure(int i, int j, float f, int k);
public abstract void writeToNBT(NBTTagCompound tag);
public abstract void readFromNBT(NBTTagCompound tag);
public abstract void Tick();
}
@@ -33,14 +33,15 @@ import cpw.mods.fml.common.event.FMLInterModComms;
import buildcraft.BuildCraftEnergy;
import buildcraft.BuildCraftTransport;
import buildcraft.api.blueprints.SchematicRegistry;
import buildcraft.api.blueprints.BuilderAPI;
import buildcraft.api.blueprints.ISchematicRegistry;
import buildcraft.api.facades.IFacadeItem;
import buildcraft.api.tools.IToolWrench;
import buildcraft.api.transport.IInjectable;
import buildcraft.api.transport.IPipeConnection;
import buildcraft.api.transport.IPipeTile;
import buildcraft.api.transport.IPipeTile.PipeType;
import buildcraft.transport.ItemFacade;
import buildcraft.transport.PipeIconProvider;
import buildcraft.transport.TileGenericPipe;
import appeng.api.AEApi;
import appeng.api.config.TunnelType;
@@ -49,7 +50,6 @@ import appeng.api.features.IP2PTunnelRegistry;
import appeng.api.parts.IFacadePart;
import appeng.api.util.AEItemDefinition;
import appeng.api.util.IOrientableBlock;
import appeng.core.AppEng;
import appeng.facade.FacadePart;
import appeng.integration.BaseModule;
import appeng.integration.abstraction.IBC;
@@ -58,7 +58,7 @@ import appeng.integration.modules.BCHelpers.AEGenericSchematicTile;
import appeng.integration.modules.BCHelpers.AERotatableBlockSchematic;
import appeng.integration.modules.BCHelpers.BCPipeHandler;
public class BC extends BaseModule implements IBC
public final class BC extends BaseModule implements IBC
{
public static BC instance;
@@ -87,17 +87,8 @@ public class BC extends BaseModule implements IBC
{
if ( te instanceof IPipeTile )
{
try
{
if ( te instanceof TileGenericPipe )
if ( ((TileGenericPipe) te).hasPlug( dir.getOpposite() ) )
return false;
}
catch (Exception ignored)
{
}
return true;
final IPipeTile pipeTile = (IPipeTile) te;
return !pipeTile.hasPipePluggable( dir.getOpposite() );
}
return false;
@@ -118,15 +109,15 @@ public class BC extends BaseModule implements IBC
@Override
public boolean addItemsToPipe(TileEntity te, ItemStack is, ForgeDirection dir)
{
if ( is != null && te != null && te instanceof IPipeTile )
if ( is != null && te != null && te instanceof IInjectable )
{
IPipeTile pt = (IPipeTile) te;
if ( pt.getPipeType() == PipeType.ITEM )
IInjectable pt = (IInjectable) te;
if ( pt.canInjectItems( dir ) )
{
int amt = pt.injectItem( is, false, dir );
int amt = pt.injectItem( is, false, dir, null );
if ( amt == is.stackSize )
{
pt.injectItem( is, true, dir );
pt.injectItem( is, true, dir, null );
return true;
}
}
@@ -141,33 +132,18 @@ public class BC extends BaseModule implements IBC
if ( is == null )
return false;
try
{
return is.getItem() instanceof ItemFacade && ItemFacade.getType( is ) == ItemFacade.FacadeType.Basic;
}
catch (Throwable t)
{
try
{
return is.getItem() instanceof ItemFacade && ItemFacade.getType( is ) == ItemFacade.TYPE_BASIC;
}
catch (Throwable g)
{
return is.getItem() instanceof ItemFacade;
}
}
return is.getItem() instanceof IFacadeItem;
}
@Override
public boolean canAddItemsToPipe(TileEntity te, ItemStack is, ForgeDirection dir)
{
if ( is != null && te != null && te instanceof IPipeTile )
if ( is != null && te != null && te instanceof IInjectable )
{
IPipeTile pt = (IPipeTile) te;
if ( pt.getPipeType() == PipeType.ITEM )
IInjectable pt = (IInjectable) te;
if ( pt.canInjectItems( dir ) )
{
int amt = pt.injectItem( is, false, dir );
int amt = pt.injectItem( is, false, dir, null );
if ( amt == is.stackSize )
{
return true;
@@ -182,15 +158,15 @@ public class BC extends BaseModule implements IBC
public void registerPowerP2P()
{
IP2PTunnelRegistry reg = AEApi.instance().registries().p2pTunnel();
reg.addNewAttunement( new ItemStack( BuildCraftEnergy.engineBlock, 1, 0 ), TunnelType.BC_POWER );
reg.addNewAttunement( new ItemStack( BuildCraftEnergy.engineBlock, 1, 1 ), TunnelType.BC_POWER );
reg.addNewAttunement( new ItemStack( BuildCraftEnergy.engineBlock, 1, 2 ), TunnelType.BC_POWER );
reg.addNewAttunement( new ItemStack( BuildCraftTransport.pipePowerCobblestone ), TunnelType.BC_POWER );
reg.addNewAttunement( new ItemStack( BuildCraftTransport.pipePowerDiamond ), TunnelType.BC_POWER );
reg.addNewAttunement( new ItemStack( BuildCraftTransport.pipePowerGold ), TunnelType.BC_POWER );
reg.addNewAttunement( new ItemStack( BuildCraftTransport.pipePowerQuartz ), TunnelType.BC_POWER );
reg.addNewAttunement( new ItemStack( BuildCraftTransport.pipePowerStone ), TunnelType.BC_POWER );
reg.addNewAttunement( new ItemStack( BuildCraftTransport.pipePowerWood ), TunnelType.BC_POWER );
reg.addNewAttunement( new ItemStack( BuildCraftEnergy.engineBlock, 1, 0 ), TunnelType.RF_POWER );
reg.addNewAttunement( new ItemStack( BuildCraftEnergy.engineBlock, 1, 1 ), TunnelType.RF_POWER );
reg.addNewAttunement( new ItemStack( BuildCraftEnergy.engineBlock, 1, 2 ), TunnelType.RF_POWER );
reg.addNewAttunement( new ItemStack( BuildCraftTransport.pipePowerCobblestone ), TunnelType.RF_POWER );
reg.addNewAttunement( new ItemStack( BuildCraftTransport.pipePowerDiamond ), TunnelType.RF_POWER );
reg.addNewAttunement( new ItemStack( BuildCraftTransport.pipePowerGold ), TunnelType.RF_POWER );
reg.addNewAttunement( new ItemStack( BuildCraftTransport.pipePowerQuartz ), TunnelType.RF_POWER );
reg.addNewAttunement( new ItemStack( BuildCraftTransport.pipePowerStone ), TunnelType.RF_POWER );
reg.addNewAttunement( new ItemStack( BuildCraftTransport.pipePowerWood ), TunnelType.RF_POWER );
}
@Override
@@ -257,7 +233,7 @@ public class BC extends BaseModule implements IBC
private void initBuilderSupport()
{
SchematicRegistry.declareBlueprintSupport( AppEng.MOD_ID );
final ISchematicRegistry schematicRegistry = BuilderAPI.schematicRegistry;
Blocks blocks = AEApi.instance().blocks();
Block cable = blocks.blockMultiPart.block();
@@ -272,15 +248,15 @@ public class BC extends BaseModule implements IBC
Block myBlock = def.block();
if ( myBlock instanceof IOrientableBlock && ((IOrientableBlock) myBlock).usesMetadata() && def.entity() == null )
{
SchematicRegistry.registerSchematicBlock( myBlock, AERotatableBlockSchematic.class );
schematicRegistry.registerSchematicBlock( myBlock, AERotatableBlockSchematic.class );
}
else if ( myBlock == cable )
{
SchematicRegistry.registerSchematicBlock( myBlock, AECableSchematicTile.class );
schematicRegistry.registerSchematicBlock( myBlock, AECableSchematicTile.class );
}
else if ( def.entity() != null )
{
SchematicRegistry.registerSchematicBlock( myBlock, AEGenericSchematicTile.class );
schematicRegistry.registerSchematicBlock( myBlock, AEGenericSchematicTile.class );
}
}
}
@@ -304,18 +280,10 @@ public class BC extends BaseModule implements IBC
{
try
{
ItemStack fs = ItemFacade.getFacade( blk, meta );
return new FacadePart( fs, side );
}
catch (Throwable ignored)
{
final ItemFacade.FacadeState state = ItemFacade.FacadeState.create( blk, meta );
final ItemStack facade = ItemFacade.getFacade( state );
}
try
{
ItemStack fs = ItemFacade.getStack( blk, meta );
return new FacadePart( fs, side );
return new FacadePart( facade, side );
}
catch (Throwable ignored)
{
@@ -334,30 +302,19 @@ public class BC extends BaseModule implements IBC
@Override
public ItemStack getTextureForFacade(ItemStack facade)
{
try
{
Block[] blk = ItemFacade.getBlocks( facade );
int[] meta = ItemFacade.getMetaValues( facade );
if ( blk == null || blk.length < 1 )
return null;
final Item maybeFacadeItem = facade.getItem();
if ( blk[0] != null )
return new ItemStack( blk[0], 1, meta[0] );
}
catch (Throwable ignored)
if ( maybeFacadeItem instanceof buildcraft.api.facades.IFacadeItem)
{
final buildcraft.api.facades.IFacadeItem facadeItem = (buildcraft.api.facades.IFacadeItem) maybeFacadeItem;
}
try
{
Block blk = ItemFacade.getBlock( facade );
if ( blk != null )
return new ItemStack( blk, 1, ItemFacade.getMetaData( facade ) );
}
catch (Throwable ignored)
{
final Block[] blocks = facadeItem.getBlocksForFacade( facade );
final int[] metas = facadeItem.getMetaValuesForFacade( facade );
if ( blocks.length > 0 && metas.length > 0 )
{
return new ItemStack( blocks[0], 1, metas[0] );
}
}
return null;
@@ -24,23 +24,23 @@ import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
import buildcraft.api.blueprints.IBuilderContext;
import buildcraft.api.blueprints.SchematicTile;
import appeng.api.util.ICommonTile;
import appeng.tile.AEBaseTile;
import appeng.util.Platform;
import buildcraft.api.blueprints.IBuilderContext;
import buildcraft.api.blueprints.SchematicTile;
public class AEGenericSchematicTile extends SchematicTile
{
@Override
public void writeRequirementsToBlueprint(IBuilderContext context, int x, int y, int z)
public void storeRequirements(IBuilderContext context, int x, int y, int z)
{
TileEntity tile = context.world().getTileEntity( x, y, z );
ArrayList<ItemStack> list = new ArrayList<ItemStack>();
if ( tile instanceof AEBaseTile )
{
AEBaseTile tcb = (AEBaseTile) tile;
ICommonTile tcb = (AEBaseTile) tile;
tcb.getDrops( tile.getWorldObj(), tile.xCoord, tile.yCoord, tile.zCoord, list );
}
@@ -1,56 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.integration.modules;
import buildcraft.api.power.IPowerReceptor;
import appeng.integration.BaseModule;
import appeng.integration.abstraction.IMJ5;
import appeng.integration.modules.helpers.MJPerdition;
public class MJ5 extends BaseModule implements IMJ5
{
public static MJ5 instance;
public MJ5() {
this.testClassExistence( IPowerReceptor.class );
}
@Override
public Object createPerdition(Object buildCraft)
{
if ( buildCraft instanceof IPowerReceptor )
return new MJPerdition( (IPowerReceptor) buildCraft );
return null;
}
@Override
public void init() throws Throwable
{
}
@Override
public void postInit()
{
}
}
@@ -1,134 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.integration.modules;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
import buildcraft.api.mj.IBatteryObject;
import buildcraft.api.mj.IBatteryProvider;
import buildcraft.api.mj.ISidedBatteryProvider;
import buildcraft.api.mj.MjAPI;
import buildcraft.api.power.IPowerReceptor;
import buildcraft.api.power.PowerHandler.PowerReceiver;
import buildcraft.api.power.PowerHandler.Type;
import appeng.integration.BaseModule;
import appeng.integration.abstraction.IMJ6;
import appeng.transformer.annotations.integration.Method;
public class MJ6 extends BaseModule implements IMJ6
{
public static MJ6 instance;
public MJ6() {
this.testClassExistence( IBatteryObject.class );
this.testClassExistence( IBatteryProvider.class );
this.testClassExistence( ISidedBatteryProvider.class );
}
@Override
public void init() throws Throwable
{
}
@Override
public void postInit()
{
}
@Override
@Method(iname = "MJ5")
public IBatteryObject provider(final TileEntity te, final ForgeDirection side)
{
if ( te instanceof IPowerReceptor )
{
final IPowerReceptor receptor = (IPowerReceptor) te;
final PowerReceiver ph = receptor.getPowerReceiver( side );
if ( ph == null )
return null;
return new IBatteryObject() {
@Override
public void setEnergyStored(double mj)
{
}
@Override
public IBatteryObject reconfigure(double maxCapacity, double maxReceivedPerCycle, double minimumConsumption)
{
return this;
}
@Override
public double minimumConsumption()
{
return ph.getMinEnergyReceived();
}
@Override
public double maxReceivedPerCycle()
{
return ph.getMaxEnergyReceived();
}
@Override
public double maxCapacity()
{
return ph.getMaxEnergyStored();
}
@Override
public String kind()
{
return MjAPI.DEFAULT_POWER_FRAMEWORK;
}
@Override
public double getEnergyStored()
{
return ph.getEnergyStored();
}
@Override
public double getEnergyRequested()
{
return ph.getMaxEnergyStored() - ph.getEnergyStored();
}
@Override
public double addEnergy(double mj, boolean ignoreCycleLimit)
{
return ph.receiveEnergy( Type.PIPE, mj, side );
}
@Override
public double addEnergy(double mj)
{
return ph.receiveEnergy( Type.PIPE, mj, side );
}
};
}
return null;
}
}
@@ -43,7 +43,7 @@ public class BSCrateStorageAdaptor extends InventoryAdaptor
}
@Override
public ItemStack removeItems(int how_many, ItemStack Filter, IInventoryDestination destination)
public ItemStack removeItems(int amount, ItemStack filter, IInventoryDestination destination)
{
ItemStack target = null;
@@ -51,7 +51,7 @@ public class BSCrateStorageAdaptor extends InventoryAdaptor
{
if ( is != null )
{
if ( is.stackSize > 0 && (Filter == null || Platform.isSameItem( Filter, is )) )
if ( is.stackSize > 0 && ( filter == null || Platform.isSameItem( filter, is )) )
{
if ( destination == null || destination.canInsert( is ) )
{
@@ -65,15 +65,15 @@ public class BSCrateStorageAdaptor extends InventoryAdaptor
if ( target != null )
{
ItemStack f = Platform.cloneItemStack( target );
f.stackSize = how_many;
return this.cs.extractItems( f, how_many );
f.stackSize = amount;
return cs.extractItems( f, amount );
}
return null;
}
@Override
public ItemStack simulateRemove(int how_many, ItemStack Filter, IInventoryDestination destination)
public ItemStack simulateRemove(int amount, ItemStack filter, IInventoryDestination destination)
{
ItemStack target = null;
@@ -81,7 +81,7 @@ public class BSCrateStorageAdaptor extends InventoryAdaptor
{
if ( is != null )
{
if ( is.stackSize > 0 && (Filter == null || Platform.isSameItem( Filter, is )) )
if ( is.stackSize > 0 && ( filter == null || Platform.isSameItem( filter, is )) )
{
if ( destination == null || destination.canInsert( is ) )
{
@@ -97,8 +97,8 @@ public class BSCrateStorageAdaptor extends InventoryAdaptor
int cnt = this.cs.getItemCount( target );
if ( cnt == 0 )
return null;
if ( cnt > how_many )
cnt = how_many;
if ( cnt > amount )
cnt = amount;
ItemStack c = target.copy();
c.stackSize = cnt;
return c;
@@ -138,7 +138,7 @@ public class BSCrateStorageAdaptor extends InventoryAdaptor
}
@Override
public ItemStack simulateSimilarRemove(int how_many, ItemStack filter, FuzzyMode fuzzyMode, IInventoryDestination destination)
public ItemStack simulateSimilarRemove(int amount, ItemStack filter, FuzzyMode fuzzyMode, IInventoryDestination destination)
{
ItemStack target = null;
@@ -162,8 +162,8 @@ public class BSCrateStorageAdaptor extends InventoryAdaptor
int cnt = this.cs.getItemCount( target );
if ( cnt == 0 )
return null;
if ( cnt > how_many )
cnt = how_many;
if ( cnt > amount )
cnt = amount;
ItemStack c = target.copy();
c.stackSize = cnt;
return c;
@@ -173,17 +173,17 @@ public class BSCrateStorageAdaptor extends InventoryAdaptor
}
@Override
public ItemStack addItems(ItemStack A)
public ItemStack addItems(ItemStack toBeAdded )
{
return this.cs.insertItems( A );
return this.cs.insertItems( toBeAdded );
}
@Override
public ItemStack simulateAdd(ItemStack A)
public ItemStack simulateAdd(ItemStack toBeSimulated )
{
int items = this.cs.getSpaceForItem( A );
ItemStack B = Platform.cloneItemStack( A );
if ( A.stackSize <= items )
int items = this.cs.getSpaceForItem( toBeSimulated );
ItemStack B = Platform.cloneItemStack( toBeSimulated );
if ( toBeSimulated.stackSize <= items )
return null;
B.stackSize -= items;
return B;
@@ -1,25 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.integration.modules.helpers;
public class MJBattery
{
}
@@ -1,81 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.integration.modules.helpers;
import net.minecraft.nbt.NBTTagCompound;
import buildcraft.api.power.IPowerReceptor;
import buildcraft.api.power.PowerHandler;
import buildcraft.api.power.PowerHandler.PowerReceiver;
import buildcraft.api.power.PowerHandler.Type;
import appeng.integration.abstraction.helpers.BaseMJPerdition;
public class MJPerdition extends BaseMJPerdition
{
final protected PowerHandler bcPowerHandler;
public MJPerdition(IPowerReceptor te) {
this.bcPowerHandler = new PowerHandler( te, Type.MACHINE );
}
@Override
public void Tick()
{
this.bcPowerHandler.update();
}
@Override
public void writeToNBT(NBTTagCompound data)
{
this.bcPowerHandler.writeToNBT( data, "bcPowerHandler" );
}
@Override
public void readFromNBT(NBTTagCompound data)
{
this.bcPowerHandler.readFromNBT( data, "bcPowerHandler" );
}
@Override
public PowerReceiver getPowerReceiver()
{
return this.bcPowerHandler.getPowerReceiver();
}
@Override
public double useEnergy(double min, double max, boolean doUse)
{
return this.bcPowerHandler.useEnergy( min, max, doUse );
}
@Override
public void addEnergy(float failed)
{
this.bcPowerHandler.addEnergy( failed );
}
@Override
public void configure(int i, int j, float f, int k)
{
this.bcPowerHandler.configure( i, j, f, k );
}
}