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
This commit is contained in:
thatsIch 2015-06-08 01:41:35 +02:00
parent 57836848ae
commit 71ce42f26a
25 changed files with 947 additions and 621 deletions

View File

@ -33,7 +33,7 @@ fmp_version=1.1.1.324
code_chicken_lib_version=1.1.3.127
code_chicken_core_version=1.0.4.35
nei_version=1.0.4.90
bc_version=6.4.6
bc_version=7.0.9
opencomputers_version=1.5.9.21
#########################################################

View File

@ -1,3 +1,4 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
@ -55,6 +56,11 @@ repositories {
url = "http://maven.cil.li/"
}
ivy {
name "BuildCraft"
artifactPattern "http://www.mod-buildcraft.com/releases/BuildCraft/[revision]/[module]-[revision]-[classifier].[ext]"
}
// CurseForge DNS for TE is not available or I am just being unlucky, code part can stay since this is applicable to any other curseforge mod though
// ivy {
// name = "CoFHLib"

View File

@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2013 AlgorithmX2
* Copyright (c) 2013 - 2015 AlgorithmX2
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
@ -94,7 +94,7 @@ public interface IFacadePart
int getItemDamage();
boolean isBC();
boolean notAEFacade();
void setThinFacades( boolean useThinFacades );

View File

@ -35,7 +35,7 @@ import appeng.api.parts.IFacadePart;
import appeng.api.parts.IPartHost;
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;
@ -137,11 +137,13 @@ public class FacadeContainer implements IFacadeContainer
boolean isBC = ids[0] < 0;
ids[0] = Math.abs( ids[0] );
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) Block.blockRegistry.getObjectById( ids[0] ), ids[1], side );
changed = changed || this.storage.getFacade( x ) == null;
this.storage.setFacade( x, bc.createFacadePart( (Block) Block.blockRegistry.getObjectById( ids[0] ), ids[1], side ) );
this.storage.setFacade( x, created );
}
else if( !isBC )
{
@ -187,9 +189,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, ForgeDirection.getOrientation( x ) ) );
@ -221,7 +223,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 );
}
}

View File

@ -20,6 +20,7 @@ package appeng.facade;
import java.util.EnumSet;
import javax.annotation.Nullable;
import org.lwjgl.opengl.GL11;
@ -53,7 +54,7 @@ import appeng.client.render.RenderBlocksWorkaround;
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;
@ -131,10 +132,10 @@ public class FacadePart implements IFacadePart, IBoxProvider
}
IIcon myIcon = null;
if( this.isBC() )
if( this.notAEFacade() && IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.BuildCraftTransport ) )
{
IBC bc = (IBC) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.BC );
myIcon = bc.getFacadeTexture();
IBuildCraftTransport bc = (IBuildCraftTransport) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.BuildCraftTransport );
myIcon = bc.getCobbleStructurePipeTexture();
}
if( myIcon == null )
@ -144,7 +145,7 @@ public class FacadePart implements IFacadePart, IBoxProvider
instance.setTexture( myIcon );
if( this.isBC() )
if( this.notAEFacade() )
{
instance.setBounds( 6, 6, 10, 10, 10, 15 );
}
@ -342,6 +343,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();
@ -353,9 +472,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 );
}
@ -484,120 +603,6 @@ public class FacadePart implements IFacadePart, IBoxProvider
return true;
}
@Override
@SideOnly( Side.CLIENT )
public void renderInventory( IPartRenderHelper instance, RenderBlocks renderer )
{
if( this.facade != null )
{
IFacadeItem fi = (IFacadeItem) this.facade.getItem();
try
{
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( Throwable 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 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 )
{

View File

@ -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 cpw.mods.fml.relauncher.FMLLaunchHandler;
import cpw.mods.fml.relauncher.Side;
@ -98,6 +99,7 @@ public enum IntegrationRegistry
return false;
}
@Nonnull
public Object getInstance( IntegrationType name )
{
for( IntegrationNode node : this.modules )

View File

@ -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" ),

View File

@ -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.Block;
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.IIcon;
import net.minecraftforge.common.util.ForgeDirection;
import appeng.api.parts.IFacadePart;
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, ForgeDirection dir );
boolean addItemsToPipe( TileEntity te, ItemStack is, ForgeDirection dir );
boolean isFacade( ItemStack is );
boolean isPipe( TileEntity te, ForgeDirection dir );
void addFacade( ItemStack item );
void registerPowerP2P();
void registerItemP2P();
void registerLiquidsP2P();
IFacadePart createFacadePart( Block blk, int meta, ForgeDirection side );
IFacadePart createFacadePart( ItemStack held, ForgeDirection side );
ItemStack getTextureForFacade( ItemStack facade );
IIcon getFacadeTexture();
}

View File

@ -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 );
}

View File

@ -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 );
}

View File

@ -1,373 +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.entity.player.EntityPlayer;
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.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.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 IIcon 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()
{
}
}

View File

@ -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
@ -26,7 +26,9 @@ import appeng.api.networking.security.BaseActionSource;
import appeng.api.storage.IExternalStorageHandler;
import appeng.api.storage.IMEInventory;
import appeng.api.storage.StorageChannel;
import appeng.integration.modules.BC;
import appeng.integration.IntegrationRegistry;
import appeng.integration.IntegrationType;
import appeng.integration.abstraction.IBuildCraftTransport;
public class BCPipeHandler implements IExternalStorageHandler
@ -35,7 +37,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

View File

@ -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
@ -28,7 +28,9 @@ import appeng.api.storage.IMEInventory;
import appeng.api.storage.StorageChannel;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IItemList;
import appeng.integration.modules.BC;
import appeng.integration.IntegrationRegistry;
import appeng.integration.IntegrationType;
import appeng.integration.abstraction.IBuildCraftTransport;
public class BCPipeInventory implements IMEInventory<IAEItemStack>
@ -46,19 +48,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;
}

View File

@ -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 );
}
}
}
}

View File

@ -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 );
}
}

View File

@ -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 );
}
}
}

View File

@ -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
@ -54,7 +54,7 @@ import appeng.transformer.annotations.Integration.Interface;
import appeng.util.Platform;
@Interface( iface = "buildcraft.api.tools.IToolWrench", iname = "BC" )
@Interface( iface = "buildcraft.api.tools.IToolWrench", iname = "BuildCraftCore" )
public class ToolNetworkTool extends AEBaseItem implements IGuiItem, IAEWrench, IToolWrench
{

View File

@ -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
@ -39,7 +39,7 @@ import appeng.transformer.annotations.Integration.Interface;
import appeng.util.Platform;
@Interface( iface = "buildcraft.api.tools.IToolWrench", iname = "BC" )
@Interface( iface = "buildcraft.api.tools.IToolWrench", iname = "BuildCraftCore" )
public class ToolQuartzWrench extends AEBaseItem implements IAEWrench, IToolWrench
{

View File

@ -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 net.minecraftforge.common.util.ForgeDirection;
import appeng.api.implementations.parts.IPartCable;
@ -129,7 +131,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 )
{

View File

@ -59,7 +59,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.integration.abstraction.IImmibisMicroblocks;
import appeng.util.LookDirection;
@ -418,9 +418,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 );

View File

@ -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
@ -26,8 +26,10 @@ import buildcraft.api.transport.IPipeTile.PipeType;
import appeng.api.parts.IPart;
import appeng.api.parts.LayerBase;
import appeng.helpers.Reflected;
@Reflected
public class LayerIPipeConnection extends LayerBase implements IPipeConnection
{

View File

@ -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
@ -90,7 +90,7 @@ import appeng.util.prioitylist.FuzzyPriorityList;
import appeng.util.prioitylist.PrecisePriorityList;
@Interface( iname = "BC", iface = "buildcraft.api.transport.IPipeConnection" )
@Interface( iname = "BuildCraftCore", iface = "buildcraft.api.transport.IPipeConnection" )
public class PartStorageBus extends PartUpgradeable implements IGridTickable, ICellContainer, IMEMonitorHandlerReceiver<IAEItemStack>, IPipeConnection, IPriorityHost
{
final BaseActionSource mySrc;
@ -565,7 +565,7 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
}
@Override
@Method( iname = "BC" )
@Method( iname = "BuildCraftCore" )
public ConnectOverride overridePipeConnection( PipeType type, ForgeDirection with )
{
return type == PipeType.ITEM && with == this.side ? ConnectOverride.CONNECT : ConnectOverride.DISCONNECT;

View File

@ -49,7 +49,7 @@ import appeng.api.networking.ticking.TickingRequest;
import appeng.core.settings.TickRates;
import appeng.integration.IntegrationRegistry;
import appeng.integration.IntegrationType;
import appeng.integration.abstraction.IBC;
import appeng.integration.abstraction.IBuildCraftTransport;
import appeng.me.GridAccessException;
import appeng.me.cache.helpers.TunnelCollection;
import appeng.tile.inventory.AppEngNullInventory;
@ -61,7 +61,7 @@ import appeng.util.inv.WrapperChainedInventory;
import appeng.util.inv.WrapperMCISidedInventory;
@Interface( iface = "buildcraft.api.transport.IPipeConnection", iname = "BC" )
@Interface( iface = "buildcraft.api.transport.IPipeConnection", iname = "BuildCraftCore" )
public class PartP2PItems extends PartP2PTunnel<PartP2PItems> implements IPipeConnection, ISidedInventory, IGridTickable
{
@ -141,20 +141,17 @@ public class PartP2PItems extends PartP2PTunnel<PartP2PItems> implements IPipeCo
this.which.add( this );
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.getOpposite() );
}
catch( Throwable ignore )
{
try
{
output = new WrapperBCPipe( te, this.side.getOpposite() );
}
catch( Throwable ignore )
{
}
}
}
}
@ -387,7 +384,7 @@ public class PartP2PItems extends PartP2PTunnel<PartP2PItems> implements IPipeCo
}
@Override
@Method( iname = "BC" )
@Method( iname = "BuildCraftCore" )
public ConnectOverride overridePipeConnection( PipeType type, ForgeDirection with )
{
return this.side == with && type == PipeType.ITEM ? ConnectOverride.CONNECT : ConnectOverride.DEFAULT;

View File

@ -28,24 +28,23 @@ 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 IBC bc;
private final IBuildCraftTransport buildCraft;
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 )
this.buildCraft = (IBuildCraftTransport) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.BuildCraftTransport );
if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.BuildCraftTransport ) )
{
if( this.bc.isPipe( s, dd ) )
if( this.buildCraft.isPipe( s, dd ) )
{
this.i = s;
this.d = dd;
@ -96,7 +95,7 @@ public class AdaptorBCPipe extends InventoryAdaptor
return null;
}
if( this.bc.addItemsToPipe( this.i, toBeAdded, this.d ) )
if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.BuildCraftTransport ) && this.buildCraft.addItemsToPipe( this.i, toBeAdded, this.d ) )
{
return null;
}

View File

@ -27,19 +27,19 @@ import net.minecraftforge.common.util.ForgeDirection;
import appeng.integration.IntegrationRegistry;
import appeng.integration.IntegrationType;
import appeng.integration.abstraction.IBC;
import appeng.integration.abstraction.IBuildCraftTransport;
public class WrapperBCPipe implements IInventory
{
private final IBC bc;
private final IBuildCraftTransport bc;
private final TileEntity ad;
private final ForgeDirection dir;
public WrapperBCPipe( TileEntity te, ForgeDirection d )
{
this.bc = (IBC) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.BC );
this.bc = (IBuildCraftTransport) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.BuildCraftTransport );
this.ad = te;
this.dir = d;
}
@ -71,7 +71,10 @@ public class WrapperBCPipe implements IInventory
@Override
public void setInventorySlotContents( int i, ItemStack itemstack )
{
this.bc.addItemsToPipe( this.ad, itemstack, this.dir );
if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.BuildCraftTransport ) )
{
this.bc.addItemsToPipe( this.ad, itemstack, this.dir );
}
}
@Override