Fixed Issue with DSU API,
Re-added support for MJ Re-added support for pipe Re-added support for BC-Facades.
This commit is contained in:
parent
ca738e6065
commit
dc095749b7
15 changed files with 72 additions and 45 deletions
|
@ -8,11 +8,13 @@ import net.minecraftforge.common.util.ForgeDirection;
|
|||
import appeng.api.storage.IExternalStorageHandler;
|
||||
import appeng.api.storage.IExternalStorageRegistry;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.core.features.registries.entries.ExternalIInv;
|
||||
|
||||
public class ExternalStorageRegistry implements IExternalStorageRegistry
|
||||
{
|
||||
|
||||
List<IExternalStorageHandler> Handlers;
|
||||
final ExternalIInv lastHandler = new ExternalIInv();
|
||||
|
||||
public ExternalStorageRegistry() {
|
||||
Handlers = new ArrayList();
|
||||
|
@ -26,6 +28,10 @@ public class ExternalStorageRegistry implements IExternalStorageRegistry
|
|||
if ( x.canHandle( te, d, chan ) )
|
||||
return x;
|
||||
}
|
||||
|
||||
if ( lastHandler.canHandle( te, d, chan ) )
|
||||
return lastHandler;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
29
core/features/registries/entries/ExternalIInv.java
Normal file
29
core/features/registries/entries/ExternalIInv.java
Normal file
|
@ -0,0 +1,29 @@
|
|||
package appeng.core.features.registries.entries;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import appeng.api.storage.IExternalStorageHandler;
|
||||
import appeng.api.storage.IMEInventory;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.me.storage.MEMonitorIInventory;
|
||||
|
||||
public class ExternalIInv implements IExternalStorageHandler
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean canHandle(TileEntity te, ForgeDirection d, StorageChannel channel)
|
||||
{
|
||||
return channel == StorageChannel.ITEMS && te instanceof IInventory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMEInventory getInventory(TileEntity te, ForgeDirection d, StorageChannel channel)
|
||||
{
|
||||
if ( channel == StorageChannel.ITEMS && te instanceof IInventory )
|
||||
return new MEMonitorIInventory( (IInventory) te, d );
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
|
@ -4,6 +4,7 @@ import io.netty.buffer.ByteBuf;
|
|||
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
@ -63,7 +64,7 @@ public class FacadeContainer implements IFacadeContainer
|
|||
if ( isBC && AppEng.instance.isIntegrationEnabled( "BC" ) )
|
||||
{
|
||||
IBC bc = (IBC) AppEng.instance.getIntegration( "BC" );
|
||||
facades[x] = bc.createFacadePart( ids, side );
|
||||
facades[x] = bc.createFacadePart( (Block) Block.blockRegistry.getObjectById( ids[0] ), ids[1], side );
|
||||
}
|
||||
else if ( !isBC )
|
||||
{
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package appeng.integration.abstraction;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
@ -33,7 +34,7 @@ public interface IBC
|
|||
|
||||
void registerLiquidsP2P();
|
||||
|
||||
IFacadePart createFacadePart(int[] ids, ForgeDirection side);
|
||||
IFacadePart createFacadePart(Block blk, int meta, ForgeDirection side);
|
||||
|
||||
IFacadePart createFacadePart(ItemStack held, ForgeDirection side);
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
package appeng.integration.abstraction;
|
||||
|
||||
import appeng.integration.abstraction.helpers.BaseBCperdition;
|
||||
import appeng.integration.abstraction.helpers.BaseMJperdition;
|
||||
import appeng.tile.powersink.BuildCraft;
|
||||
|
||||
public interface IMJ
|
||||
{
|
||||
|
||||
BaseBCperdition createPerdition(BuildCraft buildCraft);
|
||||
BaseMJperdition createPerdition(BuildCraft buildCraft);
|
||||
|
||||
}
|
||||
|
|
|
@ -5,10 +5,10 @@ import appeng.tile.events.TileEventType;
|
|||
import buildcraft.api.power.PowerHandler.PowerReceiver;
|
||||
import cpw.mods.fml.common.Optional.Method;
|
||||
|
||||
public abstract class BaseBCperdition extends AETileEventHandler
|
||||
public abstract class BaseMJperdition extends AETileEventHandler
|
||||
{
|
||||
|
||||
public BaseBCperdition() {
|
||||
public BaseMJperdition() {
|
||||
super( TileEventType.TICK, TileEventType.WORLD_NBT );
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package appeng.integration.modules.dead;
|
||||
package appeng.integration.modules;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
@ -14,16 +14,16 @@ import appeng.api.parts.IFacadePart;
|
|||
import appeng.facade.FacadePart;
|
||||
import appeng.integration.IIntegrationModule;
|
||||
import appeng.integration.abstraction.IBC;
|
||||
import appeng.integration.modules.helpers.dead.BCPipeHandler;
|
||||
import appeng.integration.modules.helpers.BCPipeHandler;
|
||||
import buildcraft.BuildCraftEnergy;
|
||||
import buildcraft.BuildCraftTransport;
|
||||
import buildcraft.api.tools.IToolWrench;
|
||||
import buildcraft.api.transport.FacadeManager;
|
||||
import buildcraft.api.transport.IPipeTile;
|
||||
import buildcraft.api.transport.IPipeTile.PipeType;
|
||||
import buildcraft.transport.ItemFacade;
|
||||
import buildcraft.transport.PipeIconProvider;
|
||||
import buildcraft.transport.TileGenericPipe;
|
||||
import cpw.mods.fml.common.event.FMLInterModComms;
|
||||
|
||||
public class BC implements IIntegrationModule, IBC
|
||||
{
|
||||
|
@ -33,10 +33,8 @@ public class BC implements IIntegrationModule, IBC
|
|||
@Override
|
||||
public void addFacade(ItemStack item)
|
||||
{
|
||||
// Myrathi :
|
||||
// FMLInterModComms.sendMessage("BuildCraft|Transport", "add-facade",
|
||||
// <your block ID> + "@" + <your block meta>);
|
||||
FacadeManager.addFacade( item );
|
||||
int blkId = Block.blockRegistry.getIDForObject( Block.getBlockFromItem( item.getItem() ) );
|
||||
FMLInterModComms.sendMessage( "BuildCraft|Transport", "add-facade", blkId + "@" + item.getItemDamage() );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -188,9 +186,9 @@ public class BC implements IIntegrationModule, IBC
|
|||
}
|
||||
|
||||
@Override
|
||||
public IFacadePart createFacadePart(int[] ids, ForgeDirection side)
|
||||
public IFacadePart createFacadePart(Block blk, int meta, ForgeDirection side)
|
||||
{
|
||||
ItemStack fs = ItemFacade.getStack( ids[0], ids[1] );
|
||||
ItemStack fs = ItemFacade.getStack( blk, meta );
|
||||
return new FacadePart( fs, side );
|
||||
}
|
||||
|
||||
|
@ -203,7 +201,8 @@ public class BC implements IIntegrationModule, IBC
|
|||
@Override
|
||||
public ItemStack getTextureForFacade(ItemStack facade)
|
||||
{
|
||||
return new ItemStack( Block.blocksList[ItemFacade.getBlockId( facade )], 1, ItemFacade.getMetaData( facade ) );
|
||||
Block blk = ItemFacade.getBlock( facade );
|
||||
return new ItemStack( blk, 1, ItemFacade.getMetaData( facade ) );
|
||||
}
|
||||
|
||||
@Override
|
|
@ -1,9 +1,9 @@
|
|||
package appeng.integration.modules.dead;
|
||||
package appeng.integration.modules;
|
||||
|
||||
import appeng.integration.IIntegrationModule;
|
||||
import appeng.integration.abstraction.IMJ;
|
||||
import appeng.integration.modules.helpers.BaseBCperdition;
|
||||
import appeng.integration.modules.helpers.dead.BCPerdition;
|
||||
import appeng.integration.abstraction.helpers.BaseMJperdition;
|
||||
import appeng.integration.modules.helpers.MJPerdition;
|
||||
import appeng.tile.powersink.BuildCraft;
|
||||
import buildcraft.api.power.IPowerReceptor;
|
||||
|
||||
|
@ -13,17 +13,17 @@ public class MJ implements IIntegrationModule, IMJ
|
|||
public static MJ instance;
|
||||
|
||||
@Override
|
||||
public BaseBCperdition createPerdition(BuildCraft buildCraft)
|
||||
public BaseMJperdition createPerdition(BuildCraft buildCraft)
|
||||
{
|
||||
if ( buildCraft instanceof IPowerReceptor )
|
||||
return new BCPerdition( buildCraft );
|
||||
return new MJPerdition( buildCraft );
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Init() throws Throwable
|
||||
{
|
||||
if ( ((Object) this) instanceof BCPerdition )
|
||||
if ( ((Object) this) instanceof MJPerdition )
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -32,7 +32,6 @@ public class MJ implements IIntegrationModule, IMJ
|
|||
@Override
|
||||
public void PostInit() throws Throwable
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package appeng.integration.modules.helpers.dead;
|
||||
package appeng.integration.modules.helpers;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
|
@ -1,4 +1,4 @@
|
|||
package appeng.integration.modules.helpers.dead;
|
||||
package appeng.integration.modules.helpers;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
|
@ -1,17 +1,18 @@
|
|||
package appeng.integration.modules.helpers.dead;
|
||||
package appeng.integration.modules.helpers;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import appeng.integration.abstraction.helpers.BaseMJperdition;
|
||||
import buildcraft.api.power.IPowerReceptor;
|
||||
import buildcraft.api.power.PowerHandler;
|
||||
import buildcraft.api.power.PowerHandler.PowerReceiver;
|
||||
import buildcraft.api.power.PowerHandler.Type;
|
||||
|
||||
public class BCPerdition extends BaseBCperdition
|
||||
public class MJPerdition extends BaseMJperdition
|
||||
{
|
||||
|
||||
final protected PowerHandler bcPowerHandler;
|
||||
|
||||
public BCPerdition(IPowerReceptor te) {
|
||||
public MJPerdition(IPowerReceptor te) {
|
||||
bcPowerHandler = new PowerHandler( te, Type.MACHINE );
|
||||
}
|
||||
|
|
@ -1,6 +1,5 @@
|
|||
package appeng.me.storage;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import appeng.api.implementations.tiles.ITileStorageMonitorable;
|
||||
|
@ -21,9 +20,6 @@ public class AEExternalHandler implements IExternalStorageHandler
|
|||
if ( channel == StorageChannel.ITEMS && te instanceof ITileStorageMonitorable )
|
||||
return true;
|
||||
|
||||
if ( channel == StorageChannel.ITEMS && te instanceof IInventory )
|
||||
return true;
|
||||
|
||||
return te instanceof TileCondenser;
|
||||
}
|
||||
|
||||
|
@ -58,11 +54,6 @@ public class AEExternalHandler implements IExternalStorageHandler
|
|||
}
|
||||
}
|
||||
|
||||
if ( channel == StorageChannel.ITEMS && te instanceof IInventory )
|
||||
{
|
||||
return new MEMonitorIInventory( (IInventory) te, d );
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -72,7 +72,7 @@ public class PartP2PBCPower extends PartP2PTunnel<PartP2PBCPower> implements IPo
|
|||
PowerReceiver tp = target.getPowerReceiver( side.getOpposite() );
|
||||
if ( tp != null )
|
||||
{
|
||||
float howmuch = tp.powerRequest();
|
||||
double howmuch = tp.powerRequest();
|
||||
|
||||
if ( howmuch > tp.getMaxEnergyReceived() )
|
||||
howmuch = tp.getMaxEnergyReceived();
|
||||
|
@ -88,7 +88,7 @@ public class PartP2PBCPower extends PartP2PTunnel<PartP2PBCPower> implements IPo
|
|||
if ( totalRequiredPower < 0.1 )
|
||||
return TickRateModulation.SLOWER;
|
||||
|
||||
float currentTotal = pp.getEnergyStored();
|
||||
double currentTotal = pp.getEnergyStored();
|
||||
if ( currentTotal < 0.01 )
|
||||
return TickRateModulation.SLOWER;
|
||||
|
||||
|
@ -100,15 +100,15 @@ public class PartP2PBCPower extends PartP2PTunnel<PartP2PBCPower> implements IPo
|
|||
PowerReceiver tp = target.getPowerReceiver( side.getOpposite() );
|
||||
if ( tp != null )
|
||||
{
|
||||
float howmuch = tp.powerRequest(); // orientation.getOpposite()
|
||||
double howmuch = tp.powerRequest(); // orientation.getOpposite()
|
||||
// );
|
||||
if ( howmuch > tp.getMaxEnergyReceived() )
|
||||
howmuch = tp.getMaxEnergyReceived();
|
||||
|
||||
if ( howmuch > 0.01 && howmuch > tp.getMinEnergyReceived() )
|
||||
{
|
||||
float toPull = currentTotal * (howmuch / totalRequiredPower);
|
||||
float pulled = pp.useEnergy( 0, toPull, true );
|
||||
double toPull = currentTotal * (howmuch / totalRequiredPower);
|
||||
double pulled = pp.useEnergy( 0, toPull, true );
|
||||
QueueTunnelDrain( PowerUnits.MJ, pulled * AEConfig.TunnelPowerLoss );
|
||||
|
||||
tp.receiveEnergy( Type.PIPE, pulled, o.side.getOpposite() );
|
||||
|
|
|
@ -311,7 +311,7 @@ public class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicState
|
|||
renderLights( x, y, z, rh, renderer );
|
||||
}
|
||||
|
||||
protected void QueueTunnelDrain(PowerUnits mj, float f)
|
||||
protected void QueueTunnelDrain(PowerUnits mj, double f)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ import net.minecraftforge.common.util.ForgeDirection;
|
|||
import appeng.api.config.PowerUnits;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.integration.abstraction.IMJ;
|
||||
import appeng.integration.abstraction.helpers.BaseBCperdition;
|
||||
import appeng.integration.abstraction.helpers.BaseMJperdition;
|
||||
import appeng.util.Platform;
|
||||
import buildcraft.api.power.IPowerReceptor;
|
||||
import buildcraft.api.power.PowerHandler;
|
||||
|
@ -17,7 +17,7 @@ import cpw.mods.fml.common.Optional.Method;
|
|||
public abstract class BuildCraft extends AERootPoweredTile implements IPowerReceptor
|
||||
{
|
||||
|
||||
BaseBCperdition bcPowerWrapper;
|
||||
BaseMJperdition bcPowerWrapper;
|
||||
|
||||
public BuildCraft() {
|
||||
if ( Platform.isServer() )
|
||||
|
|
Loading…
Reference in a new issue