Updates BuildCraft to 7.0.9
Split dependency logic on the BuildCraft modules. Config needs to be reset, if BuildCraft was disabled actively, because now there are 3 BC modules to be taken account of Conflicts: gradle.properties src/main/java/appeng/facade/FacadeContainer.java src/main/java/appeng/facade/FacadePart.java src/main/java/appeng/integration/abstraction/IBC.java src/main/java/appeng/integration/modules/BC.java src/main/java/appeng/integration/modules/BCHelpers/BCPipeHandler.java src/main/java/appeng/integration/modules/BCHelpers/BCPipeInventory.java src/main/java/appeng/items/tools/ToolNetworkTool.java src/main/java/appeng/items/tools/quartz/ToolQuartzWrench.java src/main/java/appeng/parts/CableBusStorage.java src/main/java/appeng/parts/layers/LayerIPipeConnection.java src/main/java/appeng/parts/misc/PartStorageBus.java src/main/java/appeng/parts/p2p/PartP2PItems.java src/main/java/appeng/util/inv/AdaptorBCPipe.java src/main/java/appeng/util/inv/WrapperBCPipe.java
This commit is contained in:
@@ -19,13 +19,15 @@
|
||||
package appeng.facade;
|
||||
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.parts.IFacadeContainer;
|
||||
import appeng.api.parts.IFacadePart;
|
||||
@@ -33,7 +35,7 @@ import appeng.api.parts.IPartHost;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.integration.IntegrationRegistry;
|
||||
import appeng.integration.IntegrationType;
|
||||
import appeng.integration.abstraction.IBC;
|
||||
import appeng.integration.abstraction.IBuildCraftTransport;
|
||||
import appeng.items.parts.ItemFacade;
|
||||
import appeng.parts.CableBusStorage;
|
||||
|
||||
@@ -135,15 +137,16 @@ public class FacadeContainer implements IFacadeContainer
|
||||
boolean isBC = ids[0] < 0;
|
||||
ids[0] = Math.abs( ids[0] );
|
||||
|
||||
// TODO: BC Facade Integration!
|
||||
/*
|
||||
if( isBC && IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.BC ) )
|
||||
if( isBC && IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.BuildCraftTransport ) )
|
||||
{
|
||||
IBC bc = (IBC) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.BC );
|
||||
final IBuildCraftTransport bc = (IBuildCraftTransport) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.BuildCraftTransport );
|
||||
final IFacadePart created = bc.createFacadePart( Block.getStateById( ids[0] ), ids[1], side );
|
||||
changed = changed || this.storage.getFacade( x ) == null;
|
||||
this.storage.setFacade( x, bc.createFacadePart( Block.getStateById( id[0] ), ids[1], side ) );
|
||||
|
||||
this.storage.setFacade( x, created );
|
||||
}
|
||||
else */
|
||||
else
|
||||
if( !isBC )
|
||||
{
|
||||
for( Item facadeItem : AEApi.instance().definitions().items().facade().maybeItem().asSet() )
|
||||
@@ -188,9 +191,9 @@ public class FacadeContainer implements IFacadeContainer
|
||||
}
|
||||
else
|
||||
{
|
||||
if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.BC ) )
|
||||
if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.BuildCraftTransport ) )
|
||||
{
|
||||
IBC bc = (IBC) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.BC );
|
||||
final IBuildCraftTransport bc = (IBuildCraftTransport) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.BuildCraftTransport );
|
||||
if( bc.isFacade( is ) )
|
||||
{
|
||||
this.storage.setFacade( x, bc.createFacadePart( is, AEPartLocation.fromOrdinal( x ) ) );
|
||||
@@ -222,7 +225,7 @@ public class FacadeContainer implements IFacadeContainer
|
||||
{
|
||||
int itemID = Item.getIdFromItem( part.getItem() );
|
||||
int dmgValue = part.getItemDamage();
|
||||
out.writeInt( itemID * ( part.isBC() ? -1 : 1 ) );
|
||||
out.writeInt( itemID * ( part.notAEFacade() ? -1 : 1 ) );
|
||||
out.writeInt( dmgValue );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ package appeng.facade;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.Entity;
|
||||
@@ -50,7 +51,7 @@ import appeng.client.texture.IAESprite;
|
||||
import appeng.core.AELog;
|
||||
import appeng.integration.IntegrationRegistry;
|
||||
import appeng.integration.IntegrationType;
|
||||
import appeng.integration.abstraction.IBC;
|
||||
import appeng.integration.abstraction.IBuildCraftTransport;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
@@ -125,9 +126,9 @@ public class FacadePart implements IFacadePart, IBoxProvider
|
||||
}
|
||||
|
||||
IAESprite myIcon = null;
|
||||
if( this.isBC() )
|
||||
if( this.notAEFacade() && IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.BuildCraftTransport ) )
|
||||
{
|
||||
IBC bc = (IBC) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.BC );
|
||||
IBuildCraftTransport bc = (IBuildCraftTransport) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.BuildCraftTransport );
|
||||
myIcon = bc.getFacadeTexture();
|
||||
}
|
||||
|
||||
@@ -138,7 +139,7 @@ public class FacadePart implements IFacadePart, IBoxProvider
|
||||
|
||||
instance.setTexture( myIcon );
|
||||
|
||||
if( this.isBC() )
|
||||
if( this.notAEFacade() )
|
||||
{
|
||||
instance.setBounds( 6, 6, 10, 10, 10, 15 );
|
||||
}
|
||||
@@ -345,6 +346,124 @@ public class FacadePart implements IFacadePart, IBoxProvider
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly( Side.CLIENT )
|
||||
public void renderInventory( IPartRenderHelper instance, RenderBlocks renderer )
|
||||
{
|
||||
if( this.facade != null )
|
||||
{
|
||||
IFacadeItem fi = (IFacadeItem) this.facade.getItem();
|
||||
|
||||
try
|
||||
{
|
||||
if( fi != null )
|
||||
{
|
||||
ItemStack randomItem = fi.getTextureItem( this.facade );
|
||||
|
||||
instance.setTexture( this.facade.getIconIndex() );
|
||||
instance.setBounds( 7, 7, 4, 9, 9, 14 );
|
||||
instance.renderInventoryBox( renderer );
|
||||
instance.setTexture( null );
|
||||
|
||||
if( randomItem != null )
|
||||
{
|
||||
if( randomItem.getItem() instanceof ItemBlock )
|
||||
{
|
||||
ItemBlock ib = (ItemBlock) randomItem.getItem();
|
||||
Block blk = Block.getBlockFromItem( ib );
|
||||
|
||||
try
|
||||
{
|
||||
int color = ib.getColorFromItemStack( randomItem, 0 );
|
||||
GL11.glColor4f( 1.0f, 1.0f, 1.0f, 1.0F );
|
||||
instance.setInvColor( color );
|
||||
}
|
||||
catch( Throwable error )
|
||||
{
|
||||
GL11.glColor4f( 1.0f, 1.0f, 1.0f, 1.0F );
|
||||
instance.setInvColor( 0xffffff );
|
||||
}
|
||||
|
||||
Tessellator.instance.setBrightness( 15 << 20 | 15 << 4 );
|
||||
Tessellator.instance.setColorOpaque_F( 1, 1, 1 );
|
||||
instance.setTexture( blk.getIcon( this.side.ordinal(), ib.getMetadata( randomItem.getItemDamage() ) ) );
|
||||
|
||||
instance.setBounds( 0, 0, 14, 16, 16, 16 );
|
||||
instance.renderInventoryBox( renderer );
|
||||
|
||||
instance.setTexture( null );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch( Exception ignored )
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ForgeDirection getSide()
|
||||
{
|
||||
return this.side;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getPrimaryBox()
|
||||
{
|
||||
return Platform.getPrimaryBox( this.side, this.thickness );
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItem()
|
||||
{
|
||||
ItemStack is = this.getTexture();
|
||||
if( is == null )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return is.getItem();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemDamage()
|
||||
{
|
||||
ItemStack is = this.getTexture();
|
||||
if( is == null )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return is.getItemDamage();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean notAEFacade()
|
||||
{
|
||||
return !( this.facade.getItem() instanceof IFacadeItem );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setThinFacades( boolean useThinFacades )
|
||||
{
|
||||
this.thickness = useThinFacades ? 1 : 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTransparent()
|
||||
{
|
||||
if( AEApi.instance().partHelper().getCableRenderMode().transparentFacades )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
ItemStack is = this.getTexture();
|
||||
Block blk = Block.getBlockFromItem( is.getItem() );
|
||||
|
||||
return !blk.isOpaqueCube();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
ItemStack getTexture()
|
||||
{
|
||||
final Item maybeFacade = this.facade.getItem();
|
||||
@@ -356,9 +475,9 @@ public class FacadePart implements IFacadePart, IBoxProvider
|
||||
|
||||
return facade.getTextureItem( this.facade );
|
||||
}
|
||||
else if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.BC ) )
|
||||
else if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.BuildCraftTransport ) )
|
||||
{
|
||||
IBC bc = (IBC) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.BC );
|
||||
final IBuildCraftTransport bc = (IBuildCraftTransport) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.BuildCraftTransport );
|
||||
|
||||
return bc.getTextureForFacade( this.facade );
|
||||
}
|
||||
@@ -486,118 +605,6 @@ public class FacadePart implements IFacadePart, IBoxProvider
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly( Side.CLIENT )
|
||||
public void renderInventory( IPartRenderHelper instance, IRenderHelper renderer )
|
||||
{
|
||||
if( this.facade != null )
|
||||
{
|
||||
IFacadeItem fi = (IFacadeItem) this.facade.getItem();
|
||||
|
||||
try
|
||||
{
|
||||
ItemStack randomItem = fi.getTextureItem( this.facade );
|
||||
|
||||
instance.setTexture( renderer.getIcon( facade ) );
|
||||
instance.setBounds( 7, 7, 4, 9, 9, 14 );
|
||||
instance.renderInventoryBox( renderer );
|
||||
instance.setTexture( null );
|
||||
|
||||
if( randomItem != null )
|
||||
{
|
||||
if( randomItem.getItem() instanceof ItemBlock )
|
||||
{
|
||||
ItemBlock ib = (ItemBlock) randomItem.getItem();
|
||||
Block blk = Block.getBlockFromItem( ib );
|
||||
|
||||
try
|
||||
{
|
||||
int color = ib.getColorFromItemStack( randomItem, 0 );
|
||||
instance.setInvColor( color );
|
||||
}
|
||||
catch( Throwable error )
|
||||
{
|
||||
instance.setInvColor( 0xffffff );
|
||||
}
|
||||
|
||||
renderer.setBrightness( 15 << 20 | 15 << 4 );
|
||||
renderer.setColorOpaque_F( 1, 1, 1 );
|
||||
instance.setTexture( renderer.getIcon( blk.getDefaultState() )[ side.ordinal() ] );
|
||||
|
||||
instance.setBounds( 0, 0, 14, 16, 16, 16 );
|
||||
instance.renderInventoryBox( renderer );
|
||||
|
||||
instance.setTexture( null );
|
||||
}
|
||||
}
|
||||
}
|
||||
catch( Throwable ignored )
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AEPartLocation getSide()
|
||||
{
|
||||
return this.side;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getPrimaryBox()
|
||||
{
|
||||
return Platform.getPrimaryBox( this.side, this.thickness );
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItem()
|
||||
{
|
||||
ItemStack is = this.getTexture();
|
||||
if( is == null )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return is.getItem();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemDamage()
|
||||
{
|
||||
ItemStack is = this.getTexture();
|
||||
if( is == null )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return is.getItemDamage();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBC()
|
||||
{
|
||||
return !( this.facade.getItem() instanceof IFacadeItem );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setThinFacades( boolean useThinFacades )
|
||||
{
|
||||
this.thickness = useThinFacades ? 1 : 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTransparent()
|
||||
{
|
||||
if( AEApi.instance().partHelper().getCableRenderMode().transparentFacades )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
ItemStack is = this.getTexture();
|
||||
Block blk = Block.getBlockFromItem( is.getItem() );
|
||||
|
||||
return !blk.isOpaqueCube();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getBoxes( IPartCollisionHelper bch )
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
* Copyright (c) 2013 - 2015, 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
|
||||
@@ -21,6 +21,7 @@ package appeng.integration;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.LinkedList;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.FMLLaunchHandler;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
@@ -98,6 +99,7 @@ public enum IntegrationRegistry
|
||||
return false;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public Object getInstance( IntegrationType name )
|
||||
{
|
||||
for( IntegrationNode node : this.modules )
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
* Copyright (c) 2013 - 2015, 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
|
||||
@@ -27,7 +27,11 @@ public enum IntegrationType
|
||||
|
||||
RC( IntegrationSide.BOTH, "Railcraft", "Railcraft" ),
|
||||
|
||||
BC( IntegrationSide.BOTH, "BuildCraft", "BuildCraft|Silicon" ),
|
||||
BuildCraftCore( IntegrationSide.BOTH, "BuildCraft Core", "BuildCraft|Core" ),
|
||||
|
||||
BuildCraftTransport( IntegrationSide.BOTH, "BuildCraft Transport", "BuildCraft|Transport"),
|
||||
|
||||
BuildCraftBuilder( IntegrationSide.BOTH, "BuildCraft Builders", "BuildCraft|Builders"),
|
||||
|
||||
RF( IntegrationSide.BOTH, "RedstoneFlux Power - Tiles", "CoFHAPI" ),
|
||||
|
||||
|
||||
@@ -1,64 +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.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import appeng.api.parts.IFacadePart;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.client.texture.IAESprite;
|
||||
|
||||
|
||||
public interface IBC
|
||||
{
|
||||
boolean isWrench( Item eq );
|
||||
|
||||
boolean canWrench( 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, EnumFacing dir );
|
||||
|
||||
boolean addItemsToPipe( TileEntity te, ItemStack is, EnumFacing dir );
|
||||
|
||||
boolean isFacade( ItemStack is );
|
||||
|
||||
boolean isPipe( TileEntity te, EnumFacing dir );
|
||||
|
||||
void addFacade( ItemStack item );
|
||||
|
||||
void registerPowerP2P();
|
||||
|
||||
void registerItemP2P();
|
||||
|
||||
void registerLiquidsP2P();
|
||||
|
||||
IFacadePart createFacadePart( IBlockState state, AEPartLocation side );
|
||||
|
||||
IFacadePart createFacadePart( ItemStack held, AEPartLocation side );
|
||||
|
||||
ItemStack getTextureForFacade( ItemStack facade );
|
||||
|
||||
IAESprite getFacadeTexture();
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2015, 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 javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
|
||||
/**
|
||||
* Contains wrench behaviour
|
||||
*
|
||||
* and registers the engines as P2P attunements for RF tunnels
|
||||
* (since BC 7, they are part of BC Core)
|
||||
* The attunement is currently not public anymore,
|
||||
* because it was only used internally
|
||||
*
|
||||
* @author AlgorithmX2
|
||||
* @version rv3
|
||||
* @since rv0
|
||||
*/
|
||||
public interface IBuildCraftCore
|
||||
{
|
||||
/**
|
||||
* @param eq to be checked item, can be {@code null}
|
||||
*
|
||||
* @return {@code true} if it is an {@link buildcraft.api.tools.IToolWrench}
|
||||
*/
|
||||
boolean isWrench( @Nullable Item eq );
|
||||
|
||||
/**
|
||||
* @param wrench to be checked item, must be an {@link buildcraft.api.tools.IToolWrench}
|
||||
* @param wrencher wrenching player, can be probably {@code null}, but not sure
|
||||
* @param x x pos
|
||||
* @param y y pos
|
||||
* @param z z pos
|
||||
*
|
||||
* @return {@code true} if player can wrench with that {@code wrench}
|
||||
*
|
||||
* @throws NullPointerException if {@code wrench} is {@code null}
|
||||
* @throws ClassCastException if {@code wrench} is not an {@link buildcraft.api.tools.IToolWrench}
|
||||
*/
|
||||
boolean canWrench( @Nonnull Item wrench, EntityPlayer wrencher, int x, int y, int z );
|
||||
|
||||
/**
|
||||
* @param wrench to be checked item, must be an {@link buildcraft.api.tools.IToolWrench}
|
||||
* @param wrencher wrenching player, can be probably {@code null}, but not sure
|
||||
* @param x x pos
|
||||
* @param y y pos
|
||||
* @param z z pos
|
||||
*
|
||||
* @throws NullPointerException if {@code wrench} is {@code null}
|
||||
* @throws ClassCastException if {@code wrench} is not an {@link buildcraft.api.tools.IToolWrench}
|
||||
*/
|
||||
void wrenchUsed( @Nonnull Item wrench, EntityPlayer wrencher, int x, int y, int z );
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2015, 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 javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import appeng.api.parts.IFacadePart;
|
||||
|
||||
|
||||
/**
|
||||
* Contains facade logic to interchange BC facades with AE facades,
|
||||
*
|
||||
* pipe logic to interact between storage buses and pipes
|
||||
*
|
||||
* and using pipes for attunements
|
||||
* The attunement is currently not public anymore,
|
||||
* because it was only used internally
|
||||
*
|
||||
* @author thatsIch
|
||||
* @version rv3 - 12.06.2015
|
||||
* @since rv3 12.06.2015
|
||||
*/
|
||||
public interface IBuildCraftTransport
|
||||
{
|
||||
/**
|
||||
* @param is to be checked item
|
||||
*
|
||||
* @return {@code true} if the checked item is a {@link buildcraft.api.facades.IFacadeItem}
|
||||
*/
|
||||
boolean isFacade( @Nullable ItemStack is );
|
||||
|
||||
/**
|
||||
* @param blk block used for the ae facade
|
||||
* @param meta meta of the block
|
||||
* @param side side of the ae facade
|
||||
*
|
||||
* @return ae facade through bc facade system
|
||||
*/
|
||||
@Nullable
|
||||
IFacadePart createFacadePart( @Nullable Block blk, int meta, @Nonnull ForgeDirection side );
|
||||
|
||||
/**
|
||||
* @param held create facade for that item
|
||||
* @param side on which side should the part be rendered, should rather be not {@code null}
|
||||
*
|
||||
* @return new instance using the {@code held} and side as direct argument, no logic in between
|
||||
*
|
||||
* @throws IllegalArgumentException if {@code held} is {@code null}
|
||||
*/
|
||||
IFacadePart createFacadePart( @Nonnull ItemStack held, @Nonnull ForgeDirection side );
|
||||
|
||||
/**
|
||||
* @param facade buildcraft facade
|
||||
*
|
||||
* @return item with the block and metadata based on the facade or {@code null} if {@code facade} was not a facade
|
||||
*
|
||||
* @throws NullPointerException if {@code facade} is {@code null}
|
||||
*/
|
||||
@Nullable
|
||||
ItemStack getTextureForFacade( @Nonnull ItemStack facade );
|
||||
|
||||
/**
|
||||
* @return texture of buildcraft cobblestone structure pipe or null if something bad happens
|
||||
*/
|
||||
@Nullable
|
||||
IIcon getCobbleStructurePipeTexture();
|
||||
|
||||
/**
|
||||
* @param te the to be checked {@link TileEntity}
|
||||
* @param dir direction of the {@link TileEntity}
|
||||
*
|
||||
* @return {@code true} if {@code te} is a buildcraft pipe, but not plugged
|
||||
*
|
||||
* @throws NullPointerException if {@code dir} is {@code null}
|
||||
*/
|
||||
boolean isPipe( @Nullable TileEntity te, @Nonnull ForgeDirection dir );
|
||||
|
||||
/**
|
||||
* checks weather if the {@code te} is injectable and simulates to inject the item
|
||||
*
|
||||
* @param te preferred something like a buildcraft injectable, can handle anything, just fails that way
|
||||
* @param is to be injected item
|
||||
* @param dir direction of the pipe
|
||||
*
|
||||
* @return {@code true} if items were simulated successfully being added
|
||||
*/
|
||||
boolean canAddItemsToPipe( TileEntity te, ItemStack is, ForgeDirection dir );
|
||||
|
||||
/**
|
||||
* checks weather if the {@code te} is injectable, simulates the inject and tries to inject the item
|
||||
*
|
||||
* @param te preferred something like a buildcraft injectable, can handle anything, just fails that way
|
||||
* @param is to be injected item
|
||||
* @param dir direction of the pipe
|
||||
*
|
||||
* @return {@code true} if items were added to the buildcraft pipe
|
||||
*/
|
||||
boolean addItemsToPipe( @Nullable TileEntity te, @Nullable ItemStack is, @Nonnull ForgeDirection dir );
|
||||
}
|
||||
@@ -1,370 +0,0 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2015, 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 java.lang.reflect.Method;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.fml.common.event.FMLInterModComms;
|
||||
import buildcraft.BuildCraftEnergy;
|
||||
import buildcraft.BuildCraftTransport;
|
||||
import buildcraft.api.blueprints.BuilderAPI;
|
||||
import buildcraft.api.blueprints.IBuilderContext;
|
||||
import buildcraft.api.blueprints.ISchematicRegistry;
|
||||
import buildcraft.api.blueprints.SchematicBlock;
|
||||
import buildcraft.api.blueprints.SchematicTile;
|
||||
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.transport.ItemFacade;
|
||||
import buildcraft.transport.PipeIconProvider;
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.IAppEngApi;
|
||||
import appeng.api.config.TunnelType;
|
||||
import appeng.api.definitions.IBlockDefinition;
|
||||
import appeng.api.definitions.IBlocks;
|
||||
import appeng.api.features.IP2PTunnelRegistry;
|
||||
import appeng.api.parts.IFacadePart;
|
||||
import appeng.api.util.AEItemDefinition;
|
||||
import appeng.api.util.ForgeDirection;
|
||||
import appeng.api.util.IOrientableBlock;
|
||||
import appeng.facade.FacadePart;
|
||||
import appeng.integration.BaseModule;
|
||||
import appeng.integration.abstraction.IBC;
|
||||
import appeng.integration.modules.BCHelpers.AECableSchematicTile;
|
||||
import appeng.integration.modules.BCHelpers.AEGenericSchematicTile;
|
||||
import appeng.integration.modules.BCHelpers.AERotatableBlockSchematic;
|
||||
import appeng.integration.modules.BCHelpers.BCPipeHandler;
|
||||
|
||||
|
||||
public final class BC extends BaseModule implements IBC
|
||||
{
|
||||
|
||||
public static BC instance;
|
||||
|
||||
public BC()
|
||||
{
|
||||
this.testClassExistence( BuildCraftEnergy.class );
|
||||
this.testClassExistence( BuildCraftTransport.class );
|
||||
this.testClassExistence( BuilderAPI.class );
|
||||
this.testClassExistence( IBuilderContext.class );
|
||||
this.testClassExistence( ISchematicRegistry.class );
|
||||
this.testClassExistence( IFacadeItem.class );
|
||||
this.testClassExistence( IToolWrench.class );
|
||||
this.testClassExistence( IInjectable.class );
|
||||
this.testClassExistence( IPipeConnection.class );
|
||||
this.testClassExistence( IPipeTile.class );
|
||||
this.testClassExistence( ItemFacade.class );
|
||||
this.testClassExistence( PipeIconProvider.class );
|
||||
this.testClassExistence( SchematicTile.class );
|
||||
this.testClassExistence( SchematicBlock.class );
|
||||
this.testClassExistence( IPipeTile.PipeType.class );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isWrench( Item eq )
|
||||
{
|
||||
return eq instanceof IToolWrench;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canWrench( Item i, EntityPlayer p, int x, int y, int z )
|
||||
{
|
||||
return ( (IToolWrench) i ).canWrench( p, x, y, z );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void wrenchUsed( Item i, EntityPlayer p, int x, int y, int z )
|
||||
{
|
||||
( (IToolWrench) i ).wrenchUsed( p, x, y, z );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAddItemsToPipe( TileEntity te, ItemStack is, ForgeDirection dir )
|
||||
{
|
||||
if( is != null && te != null && te instanceof IInjectable )
|
||||
{
|
||||
IInjectable pt = (IInjectable) te;
|
||||
if( pt.canInjectItems( dir ) )
|
||||
{
|
||||
int amt = pt.injectItem( is, false, dir, null );
|
||||
if( amt == is.stackSize )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addItemsToPipe( TileEntity te, ItemStack is, ForgeDirection dir )
|
||||
{
|
||||
if( is != null && te != null && te instanceof IInjectable )
|
||||
{
|
||||
IInjectable pt = (IInjectable) te;
|
||||
if( pt.canInjectItems( dir ) )
|
||||
{
|
||||
int amt = pt.injectItem( is, false, dir, null );
|
||||
if( amt == is.stackSize )
|
||||
{
|
||||
pt.injectItem( is, true, dir, null );
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFacade( ItemStack is )
|
||||
{
|
||||
if( is == null )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return is.getItem() instanceof IFacadeItem;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPipe( TileEntity te, ForgeDirection dir )
|
||||
{
|
||||
if( te instanceof IPipeTile )
|
||||
{
|
||||
final IPipeTile pipeTile = (IPipeTile) te;
|
||||
return !pipeTile.hasPipePluggable( dir.getOpposite() );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addFacade( ItemStack item )
|
||||
{
|
||||
if( item != null )
|
||||
{
|
||||
FMLInterModComms.sendMessage( "BuildCraft|Transport", "add-facade", item );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerPowerP2P()
|
||||
{
|
||||
IP2PTunnelRegistry reg = AEApi.instance().registries().p2pTunnel();
|
||||
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
|
||||
public void registerItemP2P()
|
||||
{
|
||||
IP2PTunnelRegistry reg = AEApi.instance().registries().p2pTunnel();
|
||||
reg.addNewAttunement( new ItemStack( BuildCraftTransport.pipeItemsWood ), TunnelType.ITEM );
|
||||
reg.addNewAttunement( new ItemStack( BuildCraftTransport.pipeItemsVoid ), TunnelType.ITEM );
|
||||
reg.addNewAttunement( new ItemStack( BuildCraftTransport.pipeItemsSandstone ), TunnelType.ITEM );
|
||||
reg.addNewAttunement( new ItemStack( BuildCraftTransport.pipeItemsQuartz ), TunnelType.ITEM );
|
||||
reg.addNewAttunement( new ItemStack( BuildCraftTransport.pipeItemsObsidian ), TunnelType.ITEM );
|
||||
reg.addNewAttunement( new ItemStack( BuildCraftTransport.pipeItemsIron ), TunnelType.ITEM );
|
||||
reg.addNewAttunement( new ItemStack( BuildCraftTransport.pipeItemsGold ), TunnelType.ITEM );
|
||||
reg.addNewAttunement( new ItemStack( BuildCraftTransport.pipeItemsEmerald ), TunnelType.ITEM );
|
||||
reg.addNewAttunement( new ItemStack( BuildCraftTransport.pipeItemsDiamond ), TunnelType.ITEM );
|
||||
reg.addNewAttunement( new ItemStack( BuildCraftTransport.pipeItemsStone ), TunnelType.ITEM );
|
||||
reg.addNewAttunement( new ItemStack( BuildCraftTransport.pipeItemsCobblestone ), TunnelType.ITEM );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerLiquidsP2P()
|
||||
{
|
||||
IP2PTunnelRegistry reg = AEApi.instance().registries().p2pTunnel();
|
||||
reg.addNewAttunement( new ItemStack( BuildCraftTransport.pipeFluidsCobblestone ), TunnelType.FLUID );
|
||||
reg.addNewAttunement( new ItemStack( BuildCraftTransport.pipeFluidsEmerald ), TunnelType.FLUID );
|
||||
reg.addNewAttunement( new ItemStack( BuildCraftTransport.pipeFluidsGold ), TunnelType.FLUID );
|
||||
reg.addNewAttunement( new ItemStack( BuildCraftTransport.pipeFluidsIron ), TunnelType.FLUID );
|
||||
reg.addNewAttunement( new ItemStack( BuildCraftTransport.pipeFluidsSandstone ), TunnelType.FLUID );
|
||||
reg.addNewAttunement( new ItemStack( BuildCraftTransport.pipeFluidsStone ), TunnelType.FLUID );
|
||||
reg.addNewAttunement( new ItemStack( BuildCraftTransport.pipeFluidsVoid ), TunnelType.FLUID );
|
||||
reg.addNewAttunement( new ItemStack( BuildCraftTransport.pipeFluidsWood ), TunnelType.FLUID );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFacadePart createFacadePart( Block blk, int meta, ForgeDirection side )
|
||||
{
|
||||
try
|
||||
{
|
||||
final ItemFacade.FacadeState state = ItemFacade.FacadeState.create( blk, meta );
|
||||
final ItemStack facade = ItemFacade.getFacade( state );
|
||||
|
||||
return new FacadePart( facade, side );
|
||||
}
|
||||
catch( Throwable ignored )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFacadePart createFacadePart( ItemStack fs, ForgeDirection side )
|
||||
{
|
||||
return new FacadePart( fs, side );
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getTextureForFacade( ItemStack facade )
|
||||
{
|
||||
final Item maybeFacadeItem = facade.getItem();
|
||||
|
||||
if( maybeFacadeItem instanceof buildcraft.api.facades.IFacadeItem )
|
||||
{
|
||||
final buildcraft.api.facades.IFacadeItem facadeItem = (buildcraft.api.facades.IFacadeItem) maybeFacadeItem;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TextureAtlasSprite getFacadeTexture()
|
||||
{
|
||||
try
|
||||
{
|
||||
return BuildCraftTransport.instance.pipeIconProvider.getIcon( PipeIconProvider.TYPE.PipeStructureCobblestone.ordinal() ); // Structure
|
||||
}
|
||||
catch( Throwable ignored )
|
||||
{
|
||||
}
|
||||
return null;
|
||||
// Pipe
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init()
|
||||
{
|
||||
final IAppEngApi api = AEApi.instance();
|
||||
|
||||
api.partHelper().registerNewLayer( "appeng.parts.layers.LayerIPipeConnection", "buildcraft.api.transport.IPipeConnection" );
|
||||
api.registries().externalStorage().addExternalStorageInterface( new BCPipeHandler() );
|
||||
|
||||
final IBlocks blocks = api.definitions().blocks();
|
||||
|
||||
this.addFacadeStack( blocks.fluix() );
|
||||
this.addFacadeStack( blocks.quartz() );
|
||||
this.addFacadeStack( blocks.quartzChiseled() );
|
||||
this.addFacadeStack( blocks.quartzPillar() );
|
||||
|
||||
try
|
||||
{
|
||||
this.initBuilderSupport();
|
||||
}
|
||||
catch( Throwable builderSupport )
|
||||
{
|
||||
// not supported?
|
||||
}
|
||||
|
||||
for( Block skyStoneBlock : blocks.skyStone().maybeBlock().asSet() )
|
||||
{
|
||||
this.addFacade( new ItemStack( skyStoneBlock, 1, 0 ) );
|
||||
this.addFacade( new ItemStack( skyStoneBlock, 1, 1 ) );
|
||||
this.addFacade( new ItemStack( skyStoneBlock, 1, 2 ) );
|
||||
this.addFacade( new ItemStack( skyStoneBlock, 1, 3 ) );
|
||||
}
|
||||
}
|
||||
|
||||
private void addFacadeStack( IBlockDefinition definition )
|
||||
{
|
||||
for( ItemStack facadeStack : definition.maybeStack( 1 ).asSet() )
|
||||
{
|
||||
this.addFacade( facadeStack );
|
||||
}
|
||||
}
|
||||
|
||||
private void initBuilderSupport()
|
||||
{
|
||||
final ISchematicRegistry schematicRegistry = BuilderAPI.schematicRegistry;
|
||||
|
||||
final IBlocks blocks = AEApi.instance().definitions().blocks();
|
||||
final IBlockDefinition maybeMultiPart = blocks.multiPart();
|
||||
|
||||
for( Method blockDefinition : blocks.getClass().getMethods() )
|
||||
{
|
||||
AEItemDefinition def;
|
||||
try
|
||||
{
|
||||
def = (AEItemDefinition) blockDefinition.invoke( blocks );
|
||||
|
||||
Block myBlock = def.block();
|
||||
if( myBlock instanceof IOrientableBlock && ( (IOrientableBlock) myBlock ).usesMetadata() && def.entity() == null )
|
||||
{
|
||||
schematicRegistry.registerSchematicBlock( myBlock, AERotatableBlockSchematic.class );
|
||||
}
|
||||
else if( maybeMultiPart.isSameAs( new ItemStack( myBlock ) ) )
|
||||
{
|
||||
schematicRegistry.registerSchematicBlock( myBlock, AECableSchematicTile.class );
|
||||
}
|
||||
else if( def.entity() != null )
|
||||
{
|
||||
schematicRegistry.registerSchematicBlock( myBlock, AEGenericSchematicTile.class );
|
||||
}
|
||||
}
|
||||
catch( Throwable t )
|
||||
{
|
||||
// :P
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit()
|
||||
{
|
||||
this.registerPowerP2P();
|
||||
this.registerItemP2P();
|
||||
this.registerLiquidsP2P();
|
||||
}
|
||||
|
||||
private void registerOrientableBlocks()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
* Copyright (c) 2013 - 2015, 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
|
||||
@@ -24,8 +24,10 @@ import appeng.api.networking.security.BaseActionSource;
|
||||
import appeng.api.storage.IExternalStorageHandler;
|
||||
import appeng.api.storage.IMEInventory;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.integration.IntegrationRegistry;
|
||||
import appeng.integration.IntegrationType;
|
||||
import appeng.api.util.ForgeDirection;
|
||||
import appeng.integration.modules.BC;
|
||||
import appeng.integration.abstraction.IBuildCraftTransport;
|
||||
|
||||
|
||||
public class BCPipeHandler implements IExternalStorageHandler
|
||||
@@ -34,7 +36,14 @@ public class BCPipeHandler implements IExternalStorageHandler
|
||||
@Override
|
||||
public boolean canHandle( TileEntity te, ForgeDirection d, StorageChannel chan, BaseActionSource mySrc )
|
||||
{
|
||||
return chan == StorageChannel.ITEMS && BC.instance.isPipe( te, d );
|
||||
if ( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.BuildCraftTransport ) )
|
||||
{
|
||||
final IBuildCraftTransport bc = (IBuildCraftTransport) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.BuildCraftTransport );
|
||||
|
||||
return chan == StorageChannel.ITEMS && bc.isPipe( te, d );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
* Copyright (c) 2013 - 2015, 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
|
||||
@@ -27,7 +27,9 @@ import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.api.util.ForgeDirection;
|
||||
import appeng.integration.modules.BC;
|
||||
import appeng.integration.IntegrationRegistry;
|
||||
import appeng.integration.IntegrationType;
|
||||
import appeng.integration.abstraction.IBuildCraftTransport;
|
||||
|
||||
|
||||
public class BCPipeInventory implements IMEInventory<IAEItemStack>
|
||||
@@ -45,19 +47,25 @@ public class BCPipeInventory implements IMEInventory<IAEItemStack>
|
||||
@Override
|
||||
public IAEItemStack injectItems( IAEItemStack input, Actionable mode, BaseActionSource src )
|
||||
{
|
||||
if( mode == Actionable.SIMULATE )
|
||||
if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.BuildCraftTransport ) )
|
||||
{
|
||||
if( BC.instance.canAddItemsToPipe( this.te, input.getItemStack(), this.direction ) )
|
||||
final IBuildCraftTransport registry = (IBuildCraftTransport) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.BuildCraftTransport );
|
||||
|
||||
if( mode == Actionable.SIMULATE )
|
||||
{
|
||||
if( registry.canAddItemsToPipe( this.te, input.getItemStack(), this.direction ) )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return input;
|
||||
}
|
||||
|
||||
if( registry.addItemsToPipe( this.te, input.getItemStack(), this.direction ) )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return input;
|
||||
}
|
||||
|
||||
if( BC.instance.addItemsToPipe( this.te, input.getItemStack(), this.direction ) )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return input;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,133 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2015, 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 java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import buildcraft.api.blueprints.BuilderAPI;
|
||||
import buildcraft.api.blueprints.IBuilderContext;
|
||||
import buildcraft.api.blueprints.ISchematicRegistry;
|
||||
import buildcraft.api.blueprints.SchematicBlock;
|
||||
import buildcraft.api.blueprints.SchematicTile;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.definitions.IBlockDefinition;
|
||||
import appeng.api.definitions.IBlocks;
|
||||
import appeng.api.definitions.ITileDefinition;
|
||||
import appeng.api.util.IOrientableBlock;
|
||||
import appeng.core.AELog;
|
||||
import appeng.helpers.Reflected;
|
||||
import appeng.integration.BaseModule;
|
||||
import appeng.integration.modules.BCHelpers.AECableSchematicTile;
|
||||
import appeng.integration.modules.BCHelpers.AEGenericSchematicTile;
|
||||
import appeng.integration.modules.BCHelpers.AERotatableBlockSchematic;
|
||||
|
||||
|
||||
/**
|
||||
* The builder has no interface, because it provides no functionality
|
||||
*
|
||||
* @author thatsIch
|
||||
* @version rv3 - 12.06.2015
|
||||
* @since rv3 12.06.2015
|
||||
*/
|
||||
@Reflected
|
||||
public class BuildCraftBuilder extends BaseModule
|
||||
{
|
||||
@Reflected
|
||||
public static BuildCraftBuilder instance;
|
||||
|
||||
@Reflected
|
||||
public BuildCraftBuilder()
|
||||
{
|
||||
this.testClassExistence( BuilderAPI.class );
|
||||
this.testClassExistence( IBuilderContext.class );
|
||||
this.testClassExistence( ISchematicRegistry.class );
|
||||
this.testClassExistence( SchematicTile.class );
|
||||
this.testClassExistence( SchematicBlock.class );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() throws Throwable
|
||||
{
|
||||
try
|
||||
{
|
||||
this.initBuilderSupport();
|
||||
}
|
||||
catch( Exception builderSupport )
|
||||
{
|
||||
// not supported?
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void initBuilderSupport()
|
||||
{
|
||||
final ISchematicRegistry schematicRegistry = BuilderAPI.schematicRegistry;
|
||||
|
||||
final IBlocks blocks = AEApi.instance().definitions().blocks();
|
||||
final IBlockDefinition maybeMultiPart = blocks.multiPart();
|
||||
|
||||
for( Method blockDefinition : blocks.getClass().getMethods() )
|
||||
{
|
||||
try
|
||||
{
|
||||
final IBlockDefinition def = (IBlockDefinition) blockDefinition.invoke( blocks );
|
||||
final Optional<Block> maybeBlock = def.maybeBlock();
|
||||
if( !maybeBlock.isPresent() )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
final Block block = maybeBlock.get();
|
||||
if( block instanceof IOrientableBlock && ( (IOrientableBlock) block ).usesMetadata() && !( def instanceof ITileDefinition ) )
|
||||
{
|
||||
schematicRegistry.registerSchematicBlock( block, AERotatableBlockSchematic.class );
|
||||
}
|
||||
else if( maybeMultiPart.isSameAs( new ItemStack( block ) ) )
|
||||
{
|
||||
schematicRegistry.registerSchematicBlock( block, AECableSchematicTile.class );
|
||||
}
|
||||
else if( def instanceof ITileDefinition )
|
||||
{
|
||||
schematicRegistry.registerSchematicBlock( block, AEGenericSchematicTile.class );
|
||||
}
|
||||
}
|
||||
catch( InvocationTargetException ignore )
|
||||
{
|
||||
AELog.warning( "Encountered problems while initializing the BuildCraft Builder support. Can not invoke the method %s", blockDefinition );
|
||||
}
|
||||
catch( IllegalAccessException ignore )
|
||||
{
|
||||
AELog.warning( "Encountered problems while initializing the BuildCraft Builder support. Can not access the method %s", blockDefinition );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2015, 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 javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import buildcraft.BuildCraftTransport;
|
||||
import buildcraft.api.tools.IToolWrench;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.TunnelType;
|
||||
import appeng.api.features.IP2PTunnelRegistry;
|
||||
import appeng.helpers.Reflected;
|
||||
import appeng.integration.BaseModule;
|
||||
import appeng.integration.abstraction.IBuildCraftCore;
|
||||
|
||||
|
||||
@Reflected
|
||||
public final class BuildCraftCore extends BaseModule implements IBuildCraftCore
|
||||
{
|
||||
@Reflected
|
||||
public static BuildCraftCore instance;
|
||||
|
||||
@Reflected
|
||||
public BuildCraftCore()
|
||||
{
|
||||
this.testClassExistence( buildcraft.BuildCraftCore.class );
|
||||
this.testClassExistence( BuildCraftTransport.class );
|
||||
this.testClassExistence( IToolWrench.class );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isWrench( Item eq )
|
||||
{
|
||||
return eq instanceof IToolWrench;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canWrench( @Nonnull Item wrench, EntityPlayer wrencher, int x, int y, int z )
|
||||
{
|
||||
return ( (IToolWrench) wrench ).canWrench( wrencher, x, y, z );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void wrenchUsed( @Nonnull Item wrench, EntityPlayer wrencher, int x, int y, int z )
|
||||
{
|
||||
( (IToolWrench) wrench ).wrenchUsed( wrencher, x, y, z );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit()
|
||||
{
|
||||
this.registerPowerP2P();
|
||||
}
|
||||
|
||||
private void registerPowerP2P()
|
||||
{
|
||||
final IP2PTunnelRegistry registry = AEApi.instance().registries().p2pTunnel();
|
||||
|
||||
registry.addNewAttunement( new ItemStack( buildcraft.BuildCraftCore.engineBlock, 1, 0 ), TunnelType.RF_POWER );
|
||||
registry.addNewAttunement( new ItemStack( buildcraft.BuildCraftCore.engineBlock, 1, 1 ), TunnelType.RF_POWER );
|
||||
registry.addNewAttunement( new ItemStack( buildcraft.BuildCraftCore.engineBlock, 1, 2 ), TunnelType.RF_POWER );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,302 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2015, 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 javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import cpw.mods.fml.common.event.FMLInterModComms;
|
||||
|
||||
import buildcraft.api.facades.IFacadeItem;
|
||||
import buildcraft.api.transport.IInjectable;
|
||||
import buildcraft.api.transport.IPipeConnection;
|
||||
import buildcraft.api.transport.IPipeTile;
|
||||
import buildcraft.transport.ItemFacade;
|
||||
import buildcraft.transport.PipeIconProvider;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.IAppEngApi;
|
||||
import appeng.api.config.TunnelType;
|
||||
import appeng.api.definitions.IBlocks;
|
||||
import appeng.api.definitions.IItemDefinition;
|
||||
import appeng.api.features.IP2PTunnelRegistry;
|
||||
import appeng.api.parts.IFacadePart;
|
||||
import appeng.facade.FacadePart;
|
||||
import appeng.helpers.Reflected;
|
||||
import appeng.integration.BaseModule;
|
||||
import appeng.integration.abstraction.IBuildCraftTransport;
|
||||
import appeng.integration.modules.BCHelpers.BCPipeHandler;
|
||||
|
||||
|
||||
/**
|
||||
* @author thatsIch
|
||||
* @version rv3 - 12.06.2015
|
||||
* @since rv3 12.06.2015
|
||||
*/
|
||||
@Reflected
|
||||
public class BuildCraftTransport extends BaseModule implements IBuildCraftTransport
|
||||
{
|
||||
@Reflected
|
||||
public static BuildCraftTransport instance;
|
||||
|
||||
@Reflected
|
||||
public BuildCraftTransport()
|
||||
{
|
||||
this.testClassExistence( buildcraft.BuildCraftTransport.class );
|
||||
this.testClassExistence( IFacadeItem.class );
|
||||
this.testClassExistence( IInjectable.class );
|
||||
this.testClassExistence( IPipeConnection.class );
|
||||
this.testClassExistence( IPipeTile.class );
|
||||
this.testClassExistence( ItemFacade.class );
|
||||
this.testClassExistence( PipeIconProvider.class );
|
||||
this.testClassExistence( IPipeTile.PipeType.class );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFacade( ItemStack is )
|
||||
{
|
||||
if( is == null )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return is.getItem() instanceof IFacadeItem;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public IFacadePart createFacadePart( Block blk, int meta, @Nonnull ForgeDirection side )
|
||||
{
|
||||
try
|
||||
{
|
||||
final ItemFacade.FacadeState state = ItemFacade.FacadeState.create( blk, meta );
|
||||
final ItemStack facade = ItemFacade.getFacade( state );
|
||||
|
||||
return new FacadePart( facade, side );
|
||||
}
|
||||
catch( Exception ignored )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFacadePart createFacadePart( @Nonnull ItemStack fs, @Nonnull ForgeDirection side )
|
||||
{
|
||||
return new FacadePart( fs, side );
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public ItemStack getTextureForFacade( @Nonnull ItemStack facade )
|
||||
{
|
||||
final Item maybeFacadeItem = facade.getItem();
|
||||
|
||||
if( maybeFacadeItem instanceof IFacadeItem )
|
||||
{
|
||||
final IFacadeItem facadeItem = (IFacadeItem) maybeFacadeItem;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public IIcon getCobbleStructurePipeTexture()
|
||||
{
|
||||
try
|
||||
{
|
||||
return buildcraft.BuildCraftTransport.instance.pipeIconProvider.getIcon( PipeIconProvider.TYPE.PipeStructureCobblestone.ordinal() ); // Structure
|
||||
}
|
||||
catch( Exception ignored )
|
||||
{
|
||||
}
|
||||
return null;
|
||||
// Pipe
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPipe( TileEntity te, @Nonnull ForgeDirection dir )
|
||||
{
|
||||
if( te instanceof IPipeTile )
|
||||
{
|
||||
final IPipeTile pipeTile = (IPipeTile) te;
|
||||
return !pipeTile.hasPipePluggable( dir.getOpposite() );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAddItemsToPipe( TileEntity te, ItemStack is, ForgeDirection dir )
|
||||
{
|
||||
if( is != null && te != null && te instanceof IInjectable )
|
||||
{
|
||||
IInjectable pt = (IInjectable) te;
|
||||
if( pt.canInjectItems( dir ) )
|
||||
{
|
||||
int amt = pt.injectItem( is, false, dir, null );
|
||||
if( amt == is.stackSize )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addItemsToPipe( @Nullable TileEntity te, @Nullable ItemStack is, @Nonnull ForgeDirection dir )
|
||||
{
|
||||
if( is != null && te != null && te instanceof IInjectable )
|
||||
{
|
||||
IInjectable pt = (IInjectable) te;
|
||||
if( pt.canInjectItems( dir ) )
|
||||
{
|
||||
int amt = pt.injectItem( is, false, dir, null );
|
||||
if( amt == is.stackSize )
|
||||
{
|
||||
pt.injectItem( is, true, dir, null );
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private void addFacade( ItemStack item )
|
||||
{
|
||||
if( item != null )
|
||||
{
|
||||
FMLInterModComms.sendMessage( "BuildCraft|Transport", "add-facade", item );
|
||||
}
|
||||
}
|
||||
|
||||
private void registerPowerP2P()
|
||||
{
|
||||
final IP2PTunnelRegistry registry = AEApi.instance().registries().p2pTunnel();
|
||||
|
||||
registry.addNewAttunement( new ItemStack( buildcraft.BuildCraftTransport.pipePowerCobblestone ), TunnelType.RF_POWER );
|
||||
registry.addNewAttunement( new ItemStack( buildcraft.BuildCraftTransport.pipePowerDiamond ), TunnelType.RF_POWER );
|
||||
registry.addNewAttunement( new ItemStack( buildcraft.BuildCraftTransport.pipePowerGold ), TunnelType.RF_POWER );
|
||||
registry.addNewAttunement( new ItemStack( buildcraft.BuildCraftTransport.pipePowerQuartz ), TunnelType.RF_POWER );
|
||||
registry.addNewAttunement( new ItemStack( buildcraft.BuildCraftTransport.pipePowerStone ), TunnelType.RF_POWER );
|
||||
registry.addNewAttunement( new ItemStack( buildcraft.BuildCraftTransport.pipePowerWood ), TunnelType.RF_POWER );
|
||||
}
|
||||
|
||||
private void registerItemP2P()
|
||||
{
|
||||
final IP2PTunnelRegistry registry = AEApi.instance().registries().p2pTunnel();
|
||||
|
||||
registry.addNewAttunement( new ItemStack( buildcraft.BuildCraftTransport.pipeItemsWood ), TunnelType.ITEM );
|
||||
registry.addNewAttunement( new ItemStack( buildcraft.BuildCraftTransport.pipeItemsVoid ), TunnelType.ITEM );
|
||||
registry.addNewAttunement( new ItemStack( buildcraft.BuildCraftTransport.pipeItemsSandstone ), TunnelType.ITEM );
|
||||
registry.addNewAttunement( new ItemStack( buildcraft.BuildCraftTransport.pipeItemsQuartz ), TunnelType.ITEM );
|
||||
registry.addNewAttunement( new ItemStack( buildcraft.BuildCraftTransport.pipeItemsObsidian ), TunnelType.ITEM );
|
||||
registry.addNewAttunement( new ItemStack( buildcraft.BuildCraftTransport.pipeItemsIron ), TunnelType.ITEM );
|
||||
registry.addNewAttunement( new ItemStack( buildcraft.BuildCraftTransport.pipeItemsGold ), TunnelType.ITEM );
|
||||
registry.addNewAttunement( new ItemStack( buildcraft.BuildCraftTransport.pipeItemsEmerald ), TunnelType.ITEM );
|
||||
registry.addNewAttunement( new ItemStack( buildcraft.BuildCraftTransport.pipeItemsDiamond ), TunnelType.ITEM );
|
||||
registry.addNewAttunement( new ItemStack( buildcraft.BuildCraftTransport.pipeItemsStone ), TunnelType.ITEM );
|
||||
registry.addNewAttunement( new ItemStack( buildcraft.BuildCraftTransport.pipeItemsCobblestone ), TunnelType.ITEM );
|
||||
}
|
||||
|
||||
private void registerLiquidsP2P()
|
||||
{
|
||||
IP2PTunnelRegistry reg = AEApi.instance().registries().p2pTunnel();
|
||||
reg.addNewAttunement( new ItemStack( buildcraft.BuildCraftTransport.pipeFluidsCobblestone ), TunnelType.FLUID );
|
||||
reg.addNewAttunement( new ItemStack( buildcraft.BuildCraftTransport.pipeFluidsEmerald ), TunnelType.FLUID );
|
||||
reg.addNewAttunement( new ItemStack( buildcraft.BuildCraftTransport.pipeFluidsGold ), TunnelType.FLUID );
|
||||
reg.addNewAttunement( new ItemStack( buildcraft.BuildCraftTransport.pipeFluidsIron ), TunnelType.FLUID );
|
||||
reg.addNewAttunement( new ItemStack( buildcraft.BuildCraftTransport.pipeFluidsSandstone ), TunnelType.FLUID );
|
||||
reg.addNewAttunement( new ItemStack( buildcraft.BuildCraftTransport.pipeFluidsStone ), TunnelType.FLUID );
|
||||
reg.addNewAttunement( new ItemStack( buildcraft.BuildCraftTransport.pipeFluidsVoid ), TunnelType.FLUID );
|
||||
reg.addNewAttunement( new ItemStack( buildcraft.BuildCraftTransport.pipeFluidsWood ), TunnelType.FLUID );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() throws Throwable
|
||||
{
|
||||
this.initPipeConnection();
|
||||
this.initFacades();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit()
|
||||
{
|
||||
this.registerPowerP2P();
|
||||
this.registerItemP2P();
|
||||
this.registerLiquidsP2P();
|
||||
}
|
||||
|
||||
private void initPipeConnection()
|
||||
{
|
||||
final IAppEngApi api = AEApi.instance();
|
||||
|
||||
api.partHelper().registerNewLayer( "appeng.parts.layers.LayerIPipeConnection", "buildcraft.api.transport.IPipeConnection" );
|
||||
api.registries().externalStorage().addExternalStorageInterface( new BCPipeHandler() );
|
||||
}
|
||||
|
||||
private void initFacades()
|
||||
{
|
||||
final IAppEngApi api = AEApi.instance();
|
||||
final IBlocks blocks = api.definitions().blocks();
|
||||
|
||||
this.addFacadeStack( blocks.fluix() );
|
||||
this.addFacadeStack( blocks.quartz() );
|
||||
this.addFacadeStack( blocks.quartzChiseled() );
|
||||
this.addFacadeStack( blocks.quartzPillar() );
|
||||
|
||||
for( Block skyStoneBlock : blocks.skyStone().maybeBlock().asSet() )
|
||||
{
|
||||
this.addFacade( new ItemStack( skyStoneBlock, 1, 0 ) );
|
||||
this.addFacade( new ItemStack( skyStoneBlock, 1, 1 ) );
|
||||
this.addFacade( new ItemStack( skyStoneBlock, 1, 2 ) );
|
||||
this.addFacade( new ItemStack( skyStoneBlock, 1, 3 ) );
|
||||
}
|
||||
}
|
||||
|
||||
private void addFacadeStack( IItemDefinition definition )
|
||||
{
|
||||
for( ItemStack facadeStack : definition.maybeStack( 1 ).asSet() )
|
||||
{
|
||||
this.addFacade( facadeStack );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
* Copyright (c) 2013 - 2015, 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
|
||||
@@ -52,9 +52,9 @@ import appeng.util.Platform;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
|
||||
@Interface( iface = "buildcraft.api.tools.IToolWrench", iname = "BC" )
|
||||
public class ToolNetworkTool extends AEBaseItem implements IGuiItem, IAEWrench // TODO: BC Wrench
|
||||
// TODO BC Integration
|
||||
//@Interface( iface = "buildcraft.api.tools.IToolWrench", iname = "BuildCraftCore" )
|
||||
public class ToolNetworkTool extends AEBaseItem implements IGuiItem, IAEWrench
|
||||
{
|
||||
|
||||
public ToolNetworkTool()
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
* Copyright (c) 2013 - 2015, 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
|
||||
@@ -35,8 +35,8 @@ import appeng.util.Platform;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
|
||||
//@Interface( iface = "buildcraft.api.tools.IToolWrench", iname = "BC" ) IToolWrench
|
||||
// TODO BC Integration
|
||||
//@Interface( iface = "buildcraft.api.tools.IToolWrench", iname = "BuildCraftCore" )
|
||||
public class ToolQuartzWrench extends AEBaseItem implements IAEWrench
|
||||
{
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
* Copyright (c) 2013 - 2015, 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
|
||||
@@ -19,6 +19,8 @@
|
||||
package appeng.parts;
|
||||
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import appeng.api.implementations.parts.IPartCable;
|
||||
import appeng.api.parts.IFacadePart;
|
||||
import appeng.api.parts.IPart;
|
||||
@@ -128,7 +130,7 @@ public class CableBusStorage
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setFacade( int x, IFacadePart facade )
|
||||
public void setFacade( int x, @Nullable IFacadePart facade )
|
||||
{
|
||||
if( this.facades != null && this.facades.length > x && facade == null )
|
||||
{
|
||||
|
||||
@@ -57,7 +57,7 @@ import appeng.core.sync.packets.PacketPartPlacement;
|
||||
import appeng.facade.IFacadeItem;
|
||||
import appeng.integration.IntegrationRegistry;
|
||||
import appeng.integration.IntegrationType;
|
||||
import appeng.integration.abstraction.IBC;
|
||||
import appeng.integration.abstraction.IBuildCraftTransport;
|
||||
import appeng.integration.abstraction.IFMP;
|
||||
import appeng.util.LookDirection;
|
||||
import appeng.util.Platform;
|
||||
@@ -419,9 +419,9 @@ public class PartPlacement
|
||||
return ( (IFacadeItem) held.getItem() ).createPartFromItemStack( held, side );
|
||||
}
|
||||
|
||||
if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.BC ) )
|
||||
if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.BuildCraftTransport ) )
|
||||
{
|
||||
IBC bc = (IBC) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.BC );
|
||||
IBuildCraftTransport bc = (IBuildCraftTransport) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.BuildCraftTransport );
|
||||
if( bc.isFacade( held ) )
|
||||
{
|
||||
return bc.createFacadePart( held, side );
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
* Copyright (c) 2013 - 2015, 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
|
||||
@@ -24,8 +24,10 @@ import buildcraft.api.transport.IPipeTile.PipeType;
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.api.parts.LayerBase;
|
||||
import appeng.api.util.ForgeDirection;
|
||||
import appeng.helpers.Reflected;
|
||||
|
||||
|
||||
@Reflected
|
||||
public class LayerIPipeConnection extends LayerBase implements IPipeConnection
|
||||
{
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
* Copyright (c) 2013 - 2015, 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
|
||||
@@ -83,8 +83,9 @@ import appeng.util.Platform;
|
||||
import appeng.util.prioitylist.FuzzyPriorityList;
|
||||
import appeng.util.prioitylist.PrecisePriorityList;
|
||||
|
||||
// TODO: BC PIPE INTEGRATION
|
||||
//@Interface( iname = "BC", iface = "buildcraft.api.transport.IPipeConnection" ) - IPipeConnection
|
||||
|
||||
// TODO: BC Integration
|
||||
//@Interface( iname = "BuildCraftCore", iface = "buildcraft.api.transport.IPipeConnection" )
|
||||
public class PartStorageBus extends PartUpgradeable implements IGridTickable, ICellContainer, IMEMonitorHandlerReceiver<IAEItemStack>, IPriorityHost
|
||||
{
|
||||
final BaseActionSource mySrc;
|
||||
@@ -560,8 +561,8 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
|
||||
// TODO: BC PIPE INTEGRATION
|
||||
/*
|
||||
@Override
|
||||
@Method( iname = "BC" )
|
||||
public ConnectOverride overridePipeConnection( PipeType type, AEPartLocation with )
|
||||
@Method( iname = "BuildCraftCore" )
|
||||
public ConnectOverride overridePipeConnection( PipeType type, ForgeDirection with )
|
||||
{
|
||||
return type == PipeType.ITEM && with == this.side ? ConnectOverride.CONNECT : ConnectOverride.DISCONNECT;
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.tileentity.TileEntityChest;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.IChatComponent;
|
||||
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.networking.events.MENetworkBootingStatusChange;
|
||||
import appeng.api.networking.events.MENetworkChannelsChanged;
|
||||
@@ -39,16 +40,20 @@ import appeng.api.networking.ticking.IGridTickable;
|
||||
import appeng.api.networking.ticking.TickRateModulation;
|
||||
import appeng.api.networking.ticking.TickingRequest;
|
||||
import appeng.core.settings.TickRates;
|
||||
import appeng.integration.IntegrationRegistry;
|
||||
import appeng.integration.IntegrationType;
|
||||
import appeng.integration.abstraction.IBuildCraftTransport;
|
||||
import appeng.me.GridAccessException;
|
||||
import appeng.me.cache.helpers.TunnelCollection;
|
||||
import appeng.tile.inventory.AppEngNullInventory;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.inv.WrapperBCPipe;
|
||||
import appeng.util.inv.WrapperChainedInventory;
|
||||
import appeng.util.inv.WrapperMCISidedInventory;
|
||||
|
||||
|
||||
// TODO: BUILD CRAFT INTEGRATION
|
||||
// @Interface( iface = "buildcraft.api.transport.IPipeConnection", iname = "BC" ) IPipeConnection
|
||||
// TODO: BC Integration
|
||||
//@Integration.Interface( iface = "buildcraft.api.transport.IPipeConnection", iname = "BuildCraftCore" )
|
||||
public class PartP2PItems extends PartP2PTunnel<PartP2PItems> implements ISidedInventory, IGridTickable
|
||||
{
|
||||
|
||||
@@ -128,26 +133,20 @@ public class PartP2PItems extends PartP2PTunnel<PartP2PItems> implements ISidedI
|
||||
|
||||
this.which.add( this );
|
||||
|
||||
/*
|
||||
// TODO: BUILD CRAFT INTEGRATION
|
||||
if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.BC ) )
|
||||
if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.BuildCraftTransport ) )
|
||||
{
|
||||
IBC buildcraft = (IBC) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.BC );
|
||||
if( buildcraft != null )
|
||||
final IBuildCraftTransport buildcraft = (IBuildCraftTransport) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.BuildCraftTransport );
|
||||
if( buildcraft.isPipe( te, this.side.getOpposite() ) )
|
||||
{
|
||||
if( buildcraft.isPipe( te, this.side.getOpposite() ) )
|
||||
try
|
||||
{
|
||||
output = new WrapperBCPipe( te, this.side.getFacing().getOpposite() );
|
||||
}
|
||||
catch( Throwable ignore )
|
||||
{
|
||||
try
|
||||
{
|
||||
output = new WrapperBCPipe( te, this.side.getFacing().getOpposite() );
|
||||
}
|
||||
catch( Throwable ignore )
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
* if ( AppEng.INSTANCE.isIntegrationEnabled( "TE" ) ) { ITE thermal = (ITE) AppEng.INSTANCE.getIntegration(
|
||||
@@ -382,7 +381,7 @@ public class PartP2PItems extends PartP2PTunnel<PartP2PItems> implements ISidedI
|
||||
int id,
|
||||
int value )
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -403,13 +402,11 @@ public class PartP2PItems extends PartP2PTunnel<PartP2PItems> implements ISidedI
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
// TODO: BUILD CRAFT INTEGRATION
|
||||
@Override
|
||||
@Method( iname = "BC" )
|
||||
public ConnectOverride overridePipeConnection( PipeType type, AEPartLocation with )
|
||||
{
|
||||
return this.side == with && type == PipeType.ITEM ? ConnectOverride.CONNECT : ConnectOverride.DEFAULT;
|
||||
}
|
||||
*/
|
||||
// TODO: BC Integration
|
||||
// @Override
|
||||
// @Method( iname = "BuildCraftCore" )
|
||||
// public ConnectOverride overridePipeConnection( PipeType type, ForgeDirection with )
|
||||
// {
|
||||
// return this.side == with && type == PipeType.ITEM ? ConnectOverride.CONNECT : ConnectOverride.DEFAULT;
|
||||
// }
|
||||
}
|
||||
|
||||
@@ -19,95 +19,109 @@
|
||||
package appeng.util.inv;
|
||||
|
||||
|
||||
//public class AdaptorBCPipe extends InventoryAdaptor
|
||||
//{
|
||||
//
|
||||
// private final IBC bc;
|
||||
// private final TileEntity i;
|
||||
// private final ForgeDirection d;
|
||||
//
|
||||
// public AdaptorBCPipe( TileEntity s, ForgeDirection dd )
|
||||
// {
|
||||
// this.bc = (IBC) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.BC );
|
||||
// if( this.bc != null )
|
||||
// {
|
||||
// if( this.bc.isPipe( s, dd ) )
|
||||
// {
|
||||
// this.i = s;
|
||||
// this.d = dd;
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
// this.i = null;
|
||||
// this.d = null;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public ItemStack removeItems( int amount, ItemStack filter, IInventoryDestination destination )
|
||||
// {
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public ItemStack simulateRemove( int amount, ItemStack filter, IInventoryDestination destination )
|
||||
// {
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public ItemStack removeSimilarItems( int amount, ItemStack filter, FuzzyMode fuzzyMode, IInventoryDestination destination )
|
||||
// {
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public ItemStack simulateSimilarRemove( int amount, ItemStack filter, FuzzyMode fuzzyMode, IInventoryDestination destination )
|
||||
// {
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public ItemStack addItems( ItemStack toBeAdded )
|
||||
// {
|
||||
// if( this.i == null )
|
||||
// {
|
||||
// return toBeAdded;
|
||||
// }
|
||||
// if( toBeAdded == null )
|
||||
// {
|
||||
// return null;
|
||||
// }
|
||||
// if( toBeAdded.stackSize == 0 )
|
||||
// {
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// if( this.bc.addItemsToPipe( this.i, toBeAdded, this.d ) )
|
||||
// {
|
||||
// return null;
|
||||
// }
|
||||
// return toBeAdded;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public ItemStack simulateAdd( ItemStack toBeSimulated )
|
||||
// {
|
||||
// if( this.i == null )
|
||||
// {
|
||||
// return toBeSimulated;
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean containsItems()
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public Iterator<ItemSlot> iterator()
|
||||
// {
|
||||
// return new NullIterator<ItemSlot>();
|
||||
// }
|
||||
//}
|
||||
import java.util.Iterator;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import appeng.api.config.FuzzyMode;
|
||||
import appeng.integration.IntegrationRegistry;
|
||||
import appeng.integration.IntegrationType;
|
||||
import appeng.integration.abstraction.IBC;
|
||||
import appeng.integration.abstraction.IBuildCraftTransport;
|
||||
import appeng.util.InventoryAdaptor;
|
||||
import appeng.util.iterators.NullIterator;
|
||||
|
||||
|
||||
public class AdaptorBCPipe extends InventoryAdaptor
|
||||
{
|
||||
private final IBuildCraftTransport bc;
|
||||
private final TileEntity i;
|
||||
private final ForgeDirection d;
|
||||
|
||||
public AdaptorBCPipe( TileEntity s, ForgeDirection dd )
|
||||
{
|
||||
this.bc = (IBuildCraftTransport) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.BC );
|
||||
if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.BuildCraftTransport ) )
|
||||
{
|
||||
if( this.bc.isPipe( s, dd ) )
|
||||
{
|
||||
this.i = s;
|
||||
this.d = dd;
|
||||
return;
|
||||
}
|
||||
}
|
||||
this.i = null;
|
||||
this.d = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack removeItems( int amount, ItemStack filter, IInventoryDestination destination )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack simulateRemove( int amount, ItemStack filter, IInventoryDestination destination )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack removeSimilarItems( int amount, ItemStack filter, FuzzyMode fuzzyMode, IInventoryDestination destination )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack simulateSimilarRemove( int amount, ItemStack filter, FuzzyMode fuzzyMode, IInventoryDestination destination )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack addItems( ItemStack toBeAdded )
|
||||
{
|
||||
if( this.i == null )
|
||||
{
|
||||
return toBeAdded;
|
||||
}
|
||||
if( toBeAdded == null )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
if( toBeAdded.stackSize == 0 )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.BuildCraftTransport ) && this.bc.addItemsToPipe( this.i, toBeAdded, this.d ) )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return toBeAdded;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack simulateAdd( ItemStack toBeSimulated )
|
||||
{
|
||||
if( this.i == null )
|
||||
{
|
||||
return toBeSimulated;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean containsItems()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<ItemSlot> iterator()
|
||||
{
|
||||
return new NullIterator<ItemSlot>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,95 +19,108 @@
|
||||
package appeng.util.inv;
|
||||
|
||||
|
||||
//public class WrapperBCPipe implements IInventory
|
||||
//{
|
||||
//
|
||||
// private final IBC bc;
|
||||
// private final TileEntity ad;
|
||||
// private final ForgeDirection dir;
|
||||
//
|
||||
// public WrapperBCPipe( TileEntity te, ForgeDirection d )
|
||||
// {
|
||||
// this.bc = (IBC) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.BC );
|
||||
// this.ad = te;
|
||||
// this.dir = d;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public int getSizeInventory()
|
||||
// {
|
||||
// return 1;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public ItemStack getStackInSlot( int i )
|
||||
// {
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public ItemStack decrStackSize( int i, int j )
|
||||
// {
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public ItemStack getStackInSlotOnClosing( int i )
|
||||
// {
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void setInventorySlotContents( int i, ItemStack itemstack )
|
||||
// {
|
||||
// this.bc.addItemsToPipe( this.ad, itemstack, this.dir );
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public String getInventoryName()
|
||||
// {
|
||||
// return "BC Pipe Wrapper";
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean hasCustomInventoryName()
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public int getInventoryStackLimit()
|
||||
// {
|
||||
// return 64;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void markDirty()
|
||||
// {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean isUseableByPlayer( EntityPlayer entityplayer )
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void openInventory()
|
||||
// {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void closeInventory()
|
||||
// {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean isItemValidForSlot( int i, ItemStack itemstack )
|
||||
// {
|
||||
// return this.bc.canAddItemsToPipe( this.ad, itemstack, this.dir );
|
||||
// }
|
||||
//}
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import appeng.integration.IntegrationRegistry;
|
||||
import appeng.integration.IntegrationType;
|
||||
import appeng.integration.abstraction.IBuildCraftTransport;
|
||||
|
||||
|
||||
public class WrapperBCPipe implements IInventory
|
||||
{
|
||||
private final IBuildCraftTransport bc;
|
||||
private final TileEntity ad;
|
||||
private final ForgeDirection dir;
|
||||
|
||||
public WrapperBCPipe( TileEntity te, ForgeDirection d )
|
||||
{
|
||||
this.bc = (IBuildCraftTransport) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.BuildCraftTransport );
|
||||
this.ad = te;
|
||||
this.dir = d;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSizeInventory()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot( int i )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize( int i, int j )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing( int i )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents( int i, ItemStack itemstack )
|
||||
{
|
||||
if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.BuildCraftTransport ) )
|
||||
{
|
||||
this.bc.addItemsToPipe( this.ad, itemstack, this.dir );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName()
|
||||
{
|
||||
return "BC Pipe Wrapper";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit()
|
||||
{
|
||||
return 64;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void markDirty()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer( EntityPlayer entityplayer )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeInventory()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot( int i, ItemStack itemstack )
|
||||
{
|
||||
return this.bc.canAddItemsToPipe( this.ad, itemstack, this.dir );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user