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:
@@ -8,11 +8,13 @@ import net.minecraftforge.common.util.ForgeDirection;
|
|||||||
import appeng.api.storage.IExternalStorageHandler;
|
import appeng.api.storage.IExternalStorageHandler;
|
||||||
import appeng.api.storage.IExternalStorageRegistry;
|
import appeng.api.storage.IExternalStorageRegistry;
|
||||||
import appeng.api.storage.StorageChannel;
|
import appeng.api.storage.StorageChannel;
|
||||||
|
import appeng.core.features.registries.entries.ExternalIInv;
|
||||||
|
|
||||||
public class ExternalStorageRegistry implements IExternalStorageRegistry
|
public class ExternalStorageRegistry implements IExternalStorageRegistry
|
||||||
{
|
{
|
||||||
|
|
||||||
List<IExternalStorageHandler> Handlers;
|
List<IExternalStorageHandler> Handlers;
|
||||||
|
final ExternalIInv lastHandler = new ExternalIInv();
|
||||||
|
|
||||||
public ExternalStorageRegistry() {
|
public ExternalStorageRegistry() {
|
||||||
Handlers = new ArrayList();
|
Handlers = new ArrayList();
|
||||||
@@ -26,6 +28,10 @@ public class ExternalStorageRegistry implements IExternalStorageRegistry
|
|||||||
if ( x.canHandle( te, d, chan ) )
|
if ( x.canHandle( te, d, chan ) )
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( lastHandler.canHandle( te, d, chan ) )
|
||||||
|
return lastHandler;
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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 java.io.IOException;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
@@ -63,7 +64,7 @@ public class FacadeContainer implements IFacadeContainer
|
|||||||
if ( isBC && AppEng.instance.isIntegrationEnabled( "BC" ) )
|
if ( isBC && AppEng.instance.isIntegrationEnabled( "BC" ) )
|
||||||
{
|
{
|
||||||
IBC bc = (IBC) AppEng.instance.getIntegration( "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 )
|
else if ( !isBC )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package appeng.integration.abstraction;
|
package appeng.integration.abstraction;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
@@ -33,7 +34,7 @@ public interface IBC
|
|||||||
|
|
||||||
void registerLiquidsP2P();
|
void registerLiquidsP2P();
|
||||||
|
|
||||||
IFacadePart createFacadePart(int[] ids, ForgeDirection side);
|
IFacadePart createFacadePart(Block blk, int meta, ForgeDirection side);
|
||||||
|
|
||||||
IFacadePart createFacadePart(ItemStack held, ForgeDirection side);
|
IFacadePart createFacadePart(ItemStack held, ForgeDirection side);
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
package appeng.integration.abstraction;
|
package appeng.integration.abstraction;
|
||||||
|
|
||||||
import appeng.integration.abstraction.helpers.BaseBCperdition;
|
import appeng.integration.abstraction.helpers.BaseMJperdition;
|
||||||
import appeng.tile.powersink.BuildCraft;
|
import appeng.tile.powersink.BuildCraft;
|
||||||
|
|
||||||
public interface IMJ
|
public interface IMJ
|
||||||
{
|
{
|
||||||
|
|
||||||
BaseBCperdition createPerdition(BuildCraft buildCraft);
|
BaseMJperdition createPerdition(BuildCraft buildCraft);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -5,10 +5,10 @@ import appeng.tile.events.TileEventType;
|
|||||||
import buildcraft.api.power.PowerHandler.PowerReceiver;
|
import buildcraft.api.power.PowerHandler.PowerReceiver;
|
||||||
import cpw.mods.fml.common.Optional.Method;
|
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 );
|
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.block.Block;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
@@ -14,16 +14,16 @@ import appeng.api.parts.IFacadePart;
|
|||||||
import appeng.facade.FacadePart;
|
import appeng.facade.FacadePart;
|
||||||
import appeng.integration.IIntegrationModule;
|
import appeng.integration.IIntegrationModule;
|
||||||
import appeng.integration.abstraction.IBC;
|
import appeng.integration.abstraction.IBC;
|
||||||
import appeng.integration.modules.helpers.dead.BCPipeHandler;
|
import appeng.integration.modules.helpers.BCPipeHandler;
|
||||||
import buildcraft.BuildCraftEnergy;
|
import buildcraft.BuildCraftEnergy;
|
||||||
import buildcraft.BuildCraftTransport;
|
import buildcraft.BuildCraftTransport;
|
||||||
import buildcraft.api.tools.IToolWrench;
|
import buildcraft.api.tools.IToolWrench;
|
||||||
import buildcraft.api.transport.FacadeManager;
|
|
||||||
import buildcraft.api.transport.IPipeTile;
|
import buildcraft.api.transport.IPipeTile;
|
||||||
import buildcraft.api.transport.IPipeTile.PipeType;
|
import buildcraft.api.transport.IPipeTile.PipeType;
|
||||||
import buildcraft.transport.ItemFacade;
|
import buildcraft.transport.ItemFacade;
|
||||||
import buildcraft.transport.PipeIconProvider;
|
import buildcraft.transport.PipeIconProvider;
|
||||||
import buildcraft.transport.TileGenericPipe;
|
import buildcraft.transport.TileGenericPipe;
|
||||||
|
import cpw.mods.fml.common.event.FMLInterModComms;
|
||||||
|
|
||||||
public class BC implements IIntegrationModule, IBC
|
public class BC implements IIntegrationModule, IBC
|
||||||
{
|
{
|
||||||
@@ -33,10 +33,8 @@ public class BC implements IIntegrationModule, IBC
|
|||||||
@Override
|
@Override
|
||||||
public void addFacade(ItemStack item)
|
public void addFacade(ItemStack item)
|
||||||
{
|
{
|
||||||
// Myrathi :
|
int blkId = Block.blockRegistry.getIDForObject( Block.getBlockFromItem( item.getItem() ) );
|
||||||
// FMLInterModComms.sendMessage("BuildCraft|Transport", "add-facade",
|
FMLInterModComms.sendMessage( "BuildCraft|Transport", "add-facade", blkId + "@" + item.getItemDamage() );
|
||||||
// <your block ID> + "@" + <your block meta>);
|
|
||||||
FacadeManager.addFacade( item );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -188,9 +186,9 @@ public class BC implements IIntegrationModule, IBC
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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 );
|
return new FacadePart( fs, side );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -203,7 +201,8 @@ public class BC implements IIntegrationModule, IBC
|
|||||||
@Override
|
@Override
|
||||||
public ItemStack getTextureForFacade(ItemStack facade)
|
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
|
@Override
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
package appeng.integration.modules.dead;
|
package appeng.integration.modules;
|
||||||
|
|
||||||
import appeng.integration.IIntegrationModule;
|
import appeng.integration.IIntegrationModule;
|
||||||
import appeng.integration.abstraction.IMJ;
|
import appeng.integration.abstraction.IMJ;
|
||||||
import appeng.integration.modules.helpers.BaseBCperdition;
|
import appeng.integration.abstraction.helpers.BaseMJperdition;
|
||||||
import appeng.integration.modules.helpers.dead.BCPerdition;
|
import appeng.integration.modules.helpers.MJPerdition;
|
||||||
import appeng.tile.powersink.BuildCraft;
|
import appeng.tile.powersink.BuildCraft;
|
||||||
import buildcraft.api.power.IPowerReceptor;
|
import buildcraft.api.power.IPowerReceptor;
|
||||||
|
|
||||||
@@ -13,17 +13,17 @@ public class MJ implements IIntegrationModule, IMJ
|
|||||||
public static MJ instance;
|
public static MJ instance;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseBCperdition createPerdition(BuildCraft buildCraft)
|
public BaseMJperdition createPerdition(BuildCraft buildCraft)
|
||||||
{
|
{
|
||||||
if ( buildCraft instanceof IPowerReceptor )
|
if ( buildCraft instanceof IPowerReceptor )
|
||||||
return new BCPerdition( buildCraft );
|
return new MJPerdition( buildCraft );
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void Init() throws Throwable
|
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
|
@Override
|
||||||
public void PostInit() throws Throwable
|
public void PostInit() throws Throwable
|
||||||
{
|
{
|
||||||
// TODO Auto-generated method stub
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package appeng.integration.modules.helpers.dead;
|
package appeng.integration.modules.helpers;
|
||||||
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package appeng.integration.modules.helpers.dead;
|
package appeng.integration.modules.helpers;
|
||||||
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
+4
-3
@@ -1,17 +1,18 @@
|
|||||||
package appeng.integration.modules.helpers.dead;
|
package appeng.integration.modules.helpers;
|
||||||
|
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import appeng.integration.abstraction.helpers.BaseMJperdition;
|
||||||
import buildcraft.api.power.IPowerReceptor;
|
import buildcraft.api.power.IPowerReceptor;
|
||||||
import buildcraft.api.power.PowerHandler;
|
import buildcraft.api.power.PowerHandler;
|
||||||
import buildcraft.api.power.PowerHandler.PowerReceiver;
|
import buildcraft.api.power.PowerHandler.PowerReceiver;
|
||||||
import buildcraft.api.power.PowerHandler.Type;
|
import buildcraft.api.power.PowerHandler.Type;
|
||||||
|
|
||||||
public class BCPerdition extends BaseBCperdition
|
public class MJPerdition extends BaseMJperdition
|
||||||
{
|
{
|
||||||
|
|
||||||
final protected PowerHandler bcPowerHandler;
|
final protected PowerHandler bcPowerHandler;
|
||||||
|
|
||||||
public BCPerdition(IPowerReceptor te) {
|
public MJPerdition(IPowerReceptor te) {
|
||||||
bcPowerHandler = new PowerHandler( te, Type.MACHINE );
|
bcPowerHandler = new PowerHandler( te, Type.MACHINE );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
package appeng.me.storage;
|
package appeng.me.storage;
|
||||||
|
|
||||||
import net.minecraft.inventory.IInventory;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
import appeng.api.implementations.tiles.ITileStorageMonitorable;
|
import appeng.api.implementations.tiles.ITileStorageMonitorable;
|
||||||
@@ -21,9 +20,6 @@ public class AEExternalHandler implements IExternalStorageHandler
|
|||||||
if ( channel == StorageChannel.ITEMS && te instanceof ITileStorageMonitorable )
|
if ( channel == StorageChannel.ITEMS && te instanceof ITileStorageMonitorable )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if ( channel == StorageChannel.ITEMS && te instanceof IInventory )
|
|
||||||
return true;
|
|
||||||
|
|
||||||
return te instanceof TileCondenser;
|
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;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ public class PartP2PBCPower extends PartP2PTunnel<PartP2PBCPower> implements IPo
|
|||||||
PowerReceiver tp = target.getPowerReceiver( side.getOpposite() );
|
PowerReceiver tp = target.getPowerReceiver( side.getOpposite() );
|
||||||
if ( tp != null )
|
if ( tp != null )
|
||||||
{
|
{
|
||||||
float howmuch = tp.powerRequest();
|
double howmuch = tp.powerRequest();
|
||||||
|
|
||||||
if ( howmuch > tp.getMaxEnergyReceived() )
|
if ( howmuch > tp.getMaxEnergyReceived() )
|
||||||
howmuch = tp.getMaxEnergyReceived();
|
howmuch = tp.getMaxEnergyReceived();
|
||||||
@@ -88,7 +88,7 @@ public class PartP2PBCPower extends PartP2PTunnel<PartP2PBCPower> implements IPo
|
|||||||
if ( totalRequiredPower < 0.1 )
|
if ( totalRequiredPower < 0.1 )
|
||||||
return TickRateModulation.SLOWER;
|
return TickRateModulation.SLOWER;
|
||||||
|
|
||||||
float currentTotal = pp.getEnergyStored();
|
double currentTotal = pp.getEnergyStored();
|
||||||
if ( currentTotal < 0.01 )
|
if ( currentTotal < 0.01 )
|
||||||
return TickRateModulation.SLOWER;
|
return TickRateModulation.SLOWER;
|
||||||
|
|
||||||
@@ -100,15 +100,15 @@ public class PartP2PBCPower extends PartP2PTunnel<PartP2PBCPower> implements IPo
|
|||||||
PowerReceiver tp = target.getPowerReceiver( side.getOpposite() );
|
PowerReceiver tp = target.getPowerReceiver( side.getOpposite() );
|
||||||
if ( tp != null )
|
if ( tp != null )
|
||||||
{
|
{
|
||||||
float howmuch = tp.powerRequest(); // orientation.getOpposite()
|
double howmuch = tp.powerRequest(); // orientation.getOpposite()
|
||||||
// );
|
// );
|
||||||
if ( howmuch > tp.getMaxEnergyReceived() )
|
if ( howmuch > tp.getMaxEnergyReceived() )
|
||||||
howmuch = tp.getMaxEnergyReceived();
|
howmuch = tp.getMaxEnergyReceived();
|
||||||
|
|
||||||
if ( howmuch > 0.01 && howmuch > tp.getMinEnergyReceived() )
|
if ( howmuch > 0.01 && howmuch > tp.getMinEnergyReceived() )
|
||||||
{
|
{
|
||||||
float toPull = currentTotal * (howmuch / totalRequiredPower);
|
double toPull = currentTotal * (howmuch / totalRequiredPower);
|
||||||
float pulled = pp.useEnergy( 0, toPull, true );
|
double pulled = pp.useEnergy( 0, toPull, true );
|
||||||
QueueTunnelDrain( PowerUnits.MJ, pulled * AEConfig.TunnelPowerLoss );
|
QueueTunnelDrain( PowerUnits.MJ, pulled * AEConfig.TunnelPowerLoss );
|
||||||
|
|
||||||
tp.receiveEnergy( Type.PIPE, pulled, o.side.getOpposite() );
|
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 );
|
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
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import net.minecraftforge.common.util.ForgeDirection;
|
|||||||
import appeng.api.config.PowerUnits;
|
import appeng.api.config.PowerUnits;
|
||||||
import appeng.core.AppEng;
|
import appeng.core.AppEng;
|
||||||
import appeng.integration.abstraction.IMJ;
|
import appeng.integration.abstraction.IMJ;
|
||||||
import appeng.integration.abstraction.helpers.BaseBCperdition;
|
import appeng.integration.abstraction.helpers.BaseMJperdition;
|
||||||
import appeng.util.Platform;
|
import appeng.util.Platform;
|
||||||
import buildcraft.api.power.IPowerReceptor;
|
import buildcraft.api.power.IPowerReceptor;
|
||||||
import buildcraft.api.power.PowerHandler;
|
import buildcraft.api.power.PowerHandler;
|
||||||
@@ -17,7 +17,7 @@ import cpw.mods.fml.common.Optional.Method;
|
|||||||
public abstract class BuildCraft extends AERootPoweredTile implements IPowerReceptor
|
public abstract class BuildCraft extends AERootPoweredTile implements IPowerReceptor
|
||||||
{
|
{
|
||||||
|
|
||||||
BaseBCperdition bcPowerWrapper;
|
BaseMJperdition bcPowerWrapper;
|
||||||
|
|
||||||
public BuildCraft() {
|
public BuildCraft() {
|
||||||
if ( Platform.isServer() )
|
if ( Platform.isServer() )
|
||||||
|
|||||||
Reference in New Issue
Block a user