This commit is contained in:
parent
cdf949a557
commit
e300bf93fd
|
@ -19,6 +19,7 @@ code_chicken_lib_version=1.1.1.110
|
|||
code_chicken_core_version=1.0.4.35
|
||||
nei_version=1.0.4.90
|
||||
waila_version=1.5.9_1.7.10
|
||||
bc_version=6.4.2
|
||||
|
||||
#########################################################
|
||||
# API Stubs #
|
||||
|
@ -38,4 +39,3 @@ api_railcraft_version=1
|
|||
api_rblocks_version=1
|
||||
api_rf_version=2
|
||||
api_rotarycraft_version=1
|
||||
dev_buildcraft_version=1
|
||||
|
|
|
@ -9,26 +9,4 @@ task copyChicken(type: Copy, dependsOn: "extractUserDev") {
|
|||
mustRunAfter "repackMinecraft"
|
||||
}
|
||||
tasks.setupDevWorkspace.dependsOn copyChicken
|
||||
tasks.setupDecompWorkspace.dependsOn copyChicken
|
||||
|
||||
// same for BC hacked file
|
||||
task copyBuildcraft(type: Copy, dependsOn: "extractUserDev") {
|
||||
from { configurations.compile }
|
||||
include "**/*buildcraft*.jar"
|
||||
into file(minecraft.runDir + "/mods")
|
||||
mustRunAfter "deobfBinJar"
|
||||
mustRunAfter "repackMinecraft"
|
||||
}
|
||||
tasks.setupDevWorkspace.dependsOn copyBuildcraft
|
||||
tasks.setupDecompWorkspace.dependsOn copyBuildcraft
|
||||
|
||||
// and for IC2 because it needs its EMLJ jar
|
||||
task copyIndustrialcraft(type: Copy, dependsOn: "extractUserDev") {
|
||||
from { configurations.compile }
|
||||
include "**/*industrialcraft*.jar"
|
||||
into file(minecraft.runDir + "/mods")
|
||||
mustRunAfter "deobfBinJar"
|
||||
mustRunAfter "repackMinecraft"
|
||||
}
|
||||
tasks.setupDevWorkspace.dependsOn copyIndustrialcraft
|
||||
tasks.setupDecompWorkspace.dependsOn copyIndustrialcraft
|
||||
tasks.setupDecompWorkspace.dependsOn copyChicken
|
|
@ -44,7 +44,9 @@ dependencies {
|
|||
compile "codechicken:NotEnoughItems:${config.cb_minecraft_version}-${config.nei_version}:dev"
|
||||
|
||||
compile "mcp.mobius.waila:Waila:${config.waila_version}:dev"
|
||||
|
||||
|
||||
compile "com.mod-buildcraft:buildcraft:${config.bc_version}:dev"
|
||||
|
||||
compile(group: 'api', name: 'betterstorage', version: "${config.api_betterstorage_version}")
|
||||
compile(group: 'api', name: 'coloredlightscore', version: "${config.api_coloredlightscore_version}")
|
||||
compile(group: 'api', name: 'craftguide', version: "${config.api_craftguide_version}")
|
||||
|
@ -57,10 +59,6 @@ dependencies {
|
|||
compile(group: 'api', name: 'rblocks', version: "${config.api_rblocks_version}")
|
||||
compile(group: 'api', name: 'rf', version: "${config.api_rf_version}")
|
||||
compile(group: 'api', name: 'rotarycraft', version: "${config.api_rotarycraft_version}")
|
||||
compile(group: 'dev', name: 'buildcraft', version: "${config.dev_buildcraft_version}")
|
||||
|
||||
// add hacked buildcraft jar to compile time (for facades)
|
||||
compile fileTree(dir: 'libs', include: '*.jar')
|
||||
|
||||
testCompile "junit:junit:4.11"
|
||||
}
|
||||
|
|
|
@ -561,15 +561,6 @@ public final class Registration
|
|||
ph.registerNewLayer( "appeng.parts.layers.LayerIEnergySource", "ic2.api.energy.tile.IEnergySource" );
|
||||
}
|
||||
|
||||
if ( AppEng.instance.isIntegrationEnabled( IntegrationType.MJ5 ) )
|
||||
{
|
||||
ph.registerNewLayer( "appeng.parts.layers.LayerIPowerEmitter", "buildcraft.api.power.IPowerEmitter" );
|
||||
ph.registerNewLayer( "appeng.parts.layers.LayerIPowerReceptor", "buildcraft.api.power.IPowerReceptor" );
|
||||
}
|
||||
|
||||
if ( AppEng.instance.isIntegrationEnabled( IntegrationType.MJ6 ) )
|
||||
ph.registerNewLayer( "appeng.parts.layers.LayerIBatteryProvider", "buildcraft.api.mj.IBatteryProvider" );
|
||||
|
||||
if ( AppEng.instance.isIntegrationEnabled( IntegrationType.RF ) )
|
||||
ph.registerNewLayer( "appeng.parts.layers.LayerIEnergyHandler", "cofh.api.energy.IEnergyReceiver" );
|
||||
|
||||
|
|
|
@ -103,23 +103,27 @@ public class FacadePart implements IFacadePart, IBoxProvider
|
|||
|
||||
public static boolean isFacade(ItemStack is)
|
||||
{
|
||||
if ( is.getItem() instanceof IFacadeItem )
|
||||
return true;
|
||||
return false;
|
||||
return is.getItem() instanceof IFacadeItem;
|
||||
}
|
||||
|
||||
ItemStack getTexture()
|
||||
{
|
||||
if ( this.facade.getItem() instanceof IFacadeItem )
|
||||
final Item maybeFacade = this.facade.getItem();
|
||||
|
||||
// AE Facade
|
||||
if ( maybeFacade instanceof IFacadeItem )
|
||||
{
|
||||
IFacadeItem fi = (IFacadeItem) this.facade.getItem();
|
||||
return fi.getTextureItem( this.facade );
|
||||
IFacadeItem facade = (IFacadeItem) maybeFacade;
|
||||
|
||||
return facade.getTextureItem( this.facade );
|
||||
}
|
||||
else if ( AppEng.instance.isIntegrationEnabled( IntegrationType.BC ) )
|
||||
{
|
||||
IBC bc = (IBC) AppEng.instance.getIntegration( IntegrationType.BC );
|
||||
|
||||
return bc.getTextureForFacade( this.facade );
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -133,7 +137,7 @@ public class FacadePart implements IFacadePart, IBoxProvider
|
|||
BusRenderHelper instance = (BusRenderHelper) instance2;
|
||||
|
||||
try
|
||||
{
|
||||
{
|
||||
ItemStack randomItem = this.getTexture();
|
||||
|
||||
RenderBlocksWorkaround rbw = null;
|
||||
|
@ -204,7 +208,7 @@ public class FacadePart implements IFacadePart, IBoxProvider
|
|||
}
|
||||
|
||||
renderer.uvRotateBottom = renderer.uvRotateEast = renderer.uvRotateNorth = renderer.uvRotateSouth = renderer.uvRotateTop = renderer.uvRotateWest = 0;
|
||||
instance.setBounds( 0, 0, 16 - this.getFacadeThickness(), 16, 16, 16 );
|
||||
instance.setBounds( 0, 0, 16 - this.thickness, 16, 16, 16 );
|
||||
instance.prepareBounds( renderer );
|
||||
|
||||
if ( rbw != null )
|
||||
|
@ -254,26 +258,38 @@ public class FacadePart implements IFacadePart, IBoxProvider
|
|||
else if ( this.side == ForgeDirection.NORTH || this.side == ForgeDirection.SOUTH )
|
||||
{
|
||||
if ( fc.getFacade( ForgeDirection.UP ) != null )
|
||||
renderer.renderMaxY -= this.getFacadeThickness() / 16.0;
|
||||
{
|
||||
renderer.renderMaxY -= this.thickness / 16.0;
|
||||
}
|
||||
|
||||
if ( fc.getFacade( ForgeDirection.DOWN ) != null )
|
||||
renderer.renderMinY += this.getFacadeThickness() / 16.0;
|
||||
{
|
||||
renderer.renderMinY += this.thickness / 16.0;
|
||||
}
|
||||
|
||||
instance.renderBlockCurrentBounds( x, y, z, renderer );
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( fc.getFacade( ForgeDirection.UP ) != null )
|
||||
renderer.renderMaxY -= this.getFacadeThickness() / 16.0;
|
||||
{
|
||||
renderer.renderMaxY -= this.thickness / 16.0;
|
||||
}
|
||||
|
||||
if ( fc.getFacade( ForgeDirection.DOWN ) != null )
|
||||
renderer.renderMinY += this.getFacadeThickness() / 16.0;
|
||||
{
|
||||
renderer.renderMinY += this.thickness / 16.0;
|
||||
}
|
||||
|
||||
if ( fc.getFacade( ForgeDirection.SOUTH ) != null )
|
||||
renderer.renderMaxZ -= this.getFacadeThickness() / 16.0;
|
||||
{
|
||||
renderer.renderMaxZ -= this.thickness / 16.0;
|
||||
}
|
||||
|
||||
if ( fc.getFacade( ForgeDirection.NORTH ) != null )
|
||||
renderer.renderMinZ += this.getFacadeThickness() / 16.0;
|
||||
{
|
||||
renderer.renderMinZ += this.thickness / 16.0;
|
||||
}
|
||||
|
||||
instance.renderBlockCurrentBounds( x, y, z, renderer );
|
||||
}
|
||||
|
@ -290,10 +306,14 @@ public class FacadePart implements IFacadePart, IBoxProvider
|
|||
else if ( this.side == ForgeDirection.NORTH || this.side == ForgeDirection.SOUTH )
|
||||
{
|
||||
if ( fc.getFacade( ForgeDirection.UP ) != null )
|
||||
renderer.renderMaxY -= this.getFacadeThickness() / 16.0;
|
||||
{
|
||||
renderer.renderMaxY -= this.thickness / 16.0;
|
||||
}
|
||||
|
||||
if ( fc.getFacade( ForgeDirection.DOWN ) != null )
|
||||
renderer.renderMinY += this.getFacadeThickness() / 16.0;
|
||||
{
|
||||
renderer.renderMinY += this.thickness / 16.0;
|
||||
}
|
||||
|
||||
this.renderSegmentBlockCurrentBounds( instance, x, y, z, renderer, busBounds.maxX, 0.0, 0.0, 1.0, 1.0, 1.0 );
|
||||
this.renderSegmentBlockCurrentBounds( instance, x, y, z, renderer, 0.0, 0.0, 0.0, busBounds.minX, 1.0, 1.0 );
|
||||
|
@ -303,16 +323,24 @@ public class FacadePart implements IFacadePart, IBoxProvider
|
|||
else
|
||||
{
|
||||
if ( fc.getFacade( ForgeDirection.UP ) != null )
|
||||
renderer.renderMaxY -= this.getFacadeThickness() / 16.0;
|
||||
{
|
||||
renderer.renderMaxY -= this.thickness / 16.0;
|
||||
}
|
||||
|
||||
if ( fc.getFacade( ForgeDirection.DOWN ) != null )
|
||||
renderer.renderMinY += this.getFacadeThickness() / 16.0;
|
||||
{
|
||||
renderer.renderMinY += this.thickness / 16.0;
|
||||
}
|
||||
|
||||
if ( fc.getFacade( ForgeDirection.SOUTH ) != null )
|
||||
renderer.renderMaxZ -= this.getFacadeThickness() / 16.0;
|
||||
{
|
||||
renderer.renderMaxZ -= this.thickness / 16.0;
|
||||
}
|
||||
|
||||
if ( fc.getFacade( ForgeDirection.NORTH ) != null )
|
||||
renderer.renderMinZ += this.getFacadeThickness() / 16.0;
|
||||
{
|
||||
renderer.renderMinZ += this.thickness / 16.0;
|
||||
}
|
||||
|
||||
this.renderSegmentBlockCurrentBounds( instance, x, y, z, renderer, 0.0, 0.0, busBounds.maxZ, 1.0, 1.0, 1.0 );
|
||||
this.renderSegmentBlockCurrentBounds( instance, x, y, z, renderer, 0.0, 0.0, 0.0, 1.0, 1.0, busBounds.minZ );
|
||||
|
@ -348,7 +376,7 @@ public class FacadePart implements IFacadePart, IBoxProvider
|
|||
|
||||
for (ForgeDirection it : ForgeDirection.VALID_DIRECTIONS)
|
||||
{
|
||||
if ( !out.contains( it ) && this.alphaDiff( blockAccess.getTileEntity( x + it.offsetX, y + it.offsetY, z + it.offsetZ ), side, facade ) )
|
||||
if ( !out.contains( it ) && this.hasAlphaDiff( blockAccess.getTileEntity( x + it.offsetX, y + it.offsetY, z + it.offsetZ ), side, facade ) )
|
||||
{
|
||||
out.add( it );
|
||||
}
|
||||
|
@ -410,7 +438,7 @@ public class FacadePart implements IFacadePart, IBoxProvider
|
|||
return out;
|
||||
}
|
||||
|
||||
private boolean alphaDiff(TileEntity tileEntity, ForgeDirection side, IFacadePart facade)
|
||||
private boolean hasAlphaDiff( TileEntity tileEntity, ForgeDirection side, IFacadePart facade )
|
||||
{
|
||||
if ( tileEntity instanceof IPartHost )
|
||||
{
|
||||
|
@ -424,7 +452,7 @@ public class FacadePart implements IFacadePart, IBoxProvider
|
|||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private void renderSegmentBlockCurrentBounds(BusRenderHelper instance, int x, int y, int z, RenderBlocks renderer, double minX, double minY, double minZ,
|
||||
private void renderSegmentBlockCurrentBounds(IPartRenderHelper instance, int x, int y, int z, RenderBlocks renderer, double minX, double minY, double minZ,
|
||||
double maxX, double maxY, double maxZ)
|
||||
{
|
||||
double oldMinX = renderer.renderMinX;
|
||||
|
@ -516,15 +544,10 @@ public class FacadePart implements IFacadePart, IBoxProvider
|
|||
return this.side;
|
||||
}
|
||||
|
||||
public int getFacadeThickness()
|
||||
{
|
||||
return this.thickness;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getPrimaryBox()
|
||||
{
|
||||
return Platform.getPrimaryBox( this.side, this.getFacadeThickness() );
|
||||
return Platform.getPrimaryBox( this.side, this.thickness );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -548,7 +571,7 @@ public class FacadePart implements IFacadePart, IBoxProvider
|
|||
@Override
|
||||
public boolean isBC()
|
||||
{
|
||||
return !(this.facade.getItem() instanceof IFacadeItem);
|
||||
return !( this.facade.getItem() instanceof IFacadeItem);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -565,10 +588,8 @@ public class FacadePart implements IFacadePart, IBoxProvider
|
|||
|
||||
ItemStack is = this.getTexture();
|
||||
Block blk = Block.getBlockFromItem( is.getItem() );
|
||||
if ( !blk.isOpaqueCube() )
|
||||
return true;
|
||||
|
||||
return false;
|
||||
return !blk.isOpaqueCube();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
|
||||
package appeng.integration.abstraction;
|
||||
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
|
@ -28,24 +29,24 @@ import net.minecraftforge.common.util.ForgeDirection;
|
|||
|
||||
import appeng.api.parts.IFacadePart;
|
||||
|
||||
|
||||
public interface IBC
|
||||
{
|
||||
boolean isWrench( Item eq );
|
||||
|
||||
boolean isWrench(Item eq);
|
||||
boolean canWrench( Item i, EntityPlayer p, int x, int y, int z );
|
||||
|
||||
boolean canWrench(Item i, EntityPlayer p, int x, int y, int z);
|
||||
void wrenchUsed( Item i, EntityPlayer p, int x, int y, int z );
|
||||
|
||||
void wrenchUsed(Item i, EntityPlayer p, int x, int y, int z);
|
||||
boolean canAddItemsToPipe( TileEntity te, ItemStack is, ForgeDirection dir );
|
||||
|
||||
boolean canAddItemsToPipe(TileEntity te, ItemStack is, ForgeDirection dir);
|
||||
boolean addItemsToPipe( TileEntity te, ItemStack is, ForgeDirection dir );
|
||||
|
||||
boolean addItemsToPipe(TileEntity te, ItemStack is, ForgeDirection dir);
|
||||
boolean isFacade( ItemStack is );
|
||||
|
||||
boolean isFacade(ItemStack is);
|
||||
boolean isPipe( TileEntity te, ForgeDirection dir );
|
||||
|
||||
boolean isPipe(TileEntity te, ForgeDirection dir);
|
||||
|
||||
void addFacade(ItemStack item);
|
||||
void addFacade( ItemStack item );
|
||||
|
||||
void registerPowerP2P();
|
||||
|
||||
|
@ -53,12 +54,11 @@ public interface IBC
|
|||
|
||||
void registerLiquidsP2P();
|
||||
|
||||
IFacadePart createFacadePart(Block blk, int meta, ForgeDirection side);
|
||||
IFacadePart createFacadePart( Block blk, int meta, ForgeDirection side );
|
||||
|
||||
IFacadePart createFacadePart(ItemStack held, ForgeDirection side);
|
||||
IFacadePart createFacadePart( ItemStack held, ForgeDirection side );
|
||||
|
||||
ItemStack getTextureForFacade(ItemStack facade);
|
||||
ItemStack getTextureForFacade( ItemStack facade );
|
||||
|
||||
IIcon getFacadeTexture();
|
||||
|
||||
}
|
||||
|
|
|
@ -1,27 +0,0 @@
|
|||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.integration.abstraction;
|
||||
|
||||
|
||||
public interface IMJ5
|
||||
{
|
||||
|
||||
Object createPerdition(Object buildCraft);
|
||||
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.integration.abstraction;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import buildcraft.api.mj.IBatteryObject;
|
||||
|
||||
public interface IMJ6
|
||||
{
|
||||
|
||||
IBatteryObject provider(TileEntity te, ForgeDirection side);
|
||||
|
||||
}
|
|
@ -1,43 +0,0 @@
|
|||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.integration.abstraction.helpers;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import buildcraft.api.power.PowerHandler.PowerReceiver;
|
||||
|
||||
import appeng.transformer.annotations.integration.Method;
|
||||
|
||||
public abstract class BaseMJPerdition
|
||||
{
|
||||
@Method(iname = "MJ5")
|
||||
public abstract PowerReceiver getPowerReceiver();
|
||||
|
||||
public abstract double useEnergy(double f, double required, boolean b);
|
||||
|
||||
public abstract void addEnergy(float failed);
|
||||
|
||||
public abstract void configure(int i, int j, float f, int k);
|
||||
|
||||
public abstract void writeToNBT(NBTTagCompound tag);
|
||||
|
||||
public abstract void readFromNBT(NBTTagCompound tag);
|
||||
|
||||
public abstract void Tick();
|
||||
}
|
|
@ -33,14 +33,15 @@ import cpw.mods.fml.common.event.FMLInterModComms;
|
|||
|
||||
import buildcraft.BuildCraftEnergy;
|
||||
import buildcraft.BuildCraftTransport;
|
||||
import buildcraft.api.blueprints.SchematicRegistry;
|
||||
import buildcraft.api.blueprints.BuilderAPI;
|
||||
import buildcraft.api.blueprints.ISchematicRegistry;
|
||||
import buildcraft.api.facades.IFacadeItem;
|
||||
import buildcraft.api.tools.IToolWrench;
|
||||
import buildcraft.api.transport.IInjectable;
|
||||
import buildcraft.api.transport.IPipeConnection;
|
||||
import buildcraft.api.transport.IPipeTile;
|
||||
import buildcraft.api.transport.IPipeTile.PipeType;
|
||||
import buildcraft.transport.ItemFacade;
|
||||
import buildcraft.transport.PipeIconProvider;
|
||||
import buildcraft.transport.TileGenericPipe;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.TunnelType;
|
||||
|
@ -49,7 +50,6 @@ import appeng.api.features.IP2PTunnelRegistry;
|
|||
import appeng.api.parts.IFacadePart;
|
||||
import appeng.api.util.AEItemDefinition;
|
||||
import appeng.api.util.IOrientableBlock;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.facade.FacadePart;
|
||||
import appeng.integration.BaseModule;
|
||||
import appeng.integration.abstraction.IBC;
|
||||
|
@ -58,7 +58,7 @@ import appeng.integration.modules.BCHelpers.AEGenericSchematicTile;
|
|||
import appeng.integration.modules.BCHelpers.AERotatableBlockSchematic;
|
||||
import appeng.integration.modules.BCHelpers.BCPipeHandler;
|
||||
|
||||
public class BC extends BaseModule implements IBC
|
||||
public final class BC extends BaseModule implements IBC
|
||||
{
|
||||
|
||||
public static BC instance;
|
||||
|
@ -87,17 +87,8 @@ public class BC extends BaseModule implements IBC
|
|||
{
|
||||
if ( te instanceof IPipeTile )
|
||||
{
|
||||
try
|
||||
{
|
||||
if ( te instanceof TileGenericPipe )
|
||||
if ( ((TileGenericPipe) te).hasPlug( dir.getOpposite() ) )
|
||||
return false;
|
||||
}
|
||||
catch (Exception ignored)
|
||||
{
|
||||
}
|
||||
|
||||
return true;
|
||||
final IPipeTile pipeTile = (IPipeTile) te;
|
||||
return !pipeTile.hasPipePluggable( dir.getOpposite() );
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -118,15 +109,15 @@ public class BC extends BaseModule implements IBC
|
|||
@Override
|
||||
public boolean addItemsToPipe(TileEntity te, ItemStack is, ForgeDirection dir)
|
||||
{
|
||||
if ( is != null && te != null && te instanceof IPipeTile )
|
||||
if ( is != null && te != null && te instanceof IInjectable )
|
||||
{
|
||||
IPipeTile pt = (IPipeTile) te;
|
||||
if ( pt.getPipeType() == PipeType.ITEM )
|
||||
IInjectable pt = (IInjectable) te;
|
||||
if ( pt.canInjectItems( dir ) )
|
||||
{
|
||||
int amt = pt.injectItem( is, false, dir );
|
||||
int amt = pt.injectItem( is, false, dir, null );
|
||||
if ( amt == is.stackSize )
|
||||
{
|
||||
pt.injectItem( is, true, dir );
|
||||
pt.injectItem( is, true, dir, null );
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -141,33 +132,18 @@ public class BC extends BaseModule implements IBC
|
|||
if ( is == null )
|
||||
return false;
|
||||
|
||||
try
|
||||
{
|
||||
return is.getItem() instanceof ItemFacade && ItemFacade.getType( is ) == ItemFacade.FacadeType.Basic;
|
||||
}
|
||||
catch (Throwable t)
|
||||
{
|
||||
try
|
||||
{
|
||||
return is.getItem() instanceof ItemFacade && ItemFacade.getType( is ) == ItemFacade.TYPE_BASIC;
|
||||
}
|
||||
catch (Throwable g)
|
||||
{
|
||||
return is.getItem() instanceof ItemFacade;
|
||||
}
|
||||
}
|
||||
return is.getItem() instanceof IFacadeItem;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAddItemsToPipe(TileEntity te, ItemStack is, ForgeDirection dir)
|
||||
{
|
||||
|
||||
if ( is != null && te != null && te instanceof IPipeTile )
|
||||
if ( is != null && te != null && te instanceof IInjectable )
|
||||
{
|
||||
IPipeTile pt = (IPipeTile) te;
|
||||
if ( pt.getPipeType() == PipeType.ITEM )
|
||||
IInjectable pt = (IInjectable) te;
|
||||
if ( pt.canInjectItems( dir ) )
|
||||
{
|
||||
int amt = pt.injectItem( is, false, dir );
|
||||
int amt = pt.injectItem( is, false, dir, null );
|
||||
if ( amt == is.stackSize )
|
||||
{
|
||||
return true;
|
||||
|
@ -182,15 +158,15 @@ public class BC extends BaseModule implements IBC
|
|||
public void registerPowerP2P()
|
||||
{
|
||||
IP2PTunnelRegistry reg = AEApi.instance().registries().p2pTunnel();
|
||||
reg.addNewAttunement( new ItemStack( BuildCraftEnergy.engineBlock, 1, 0 ), TunnelType.BC_POWER );
|
||||
reg.addNewAttunement( new ItemStack( BuildCraftEnergy.engineBlock, 1, 1 ), TunnelType.BC_POWER );
|
||||
reg.addNewAttunement( new ItemStack( BuildCraftEnergy.engineBlock, 1, 2 ), TunnelType.BC_POWER );
|
||||
reg.addNewAttunement( new ItemStack( BuildCraftTransport.pipePowerCobblestone ), TunnelType.BC_POWER );
|
||||
reg.addNewAttunement( new ItemStack( BuildCraftTransport.pipePowerDiamond ), TunnelType.BC_POWER );
|
||||
reg.addNewAttunement( new ItemStack( BuildCraftTransport.pipePowerGold ), TunnelType.BC_POWER );
|
||||
reg.addNewAttunement( new ItemStack( BuildCraftTransport.pipePowerQuartz ), TunnelType.BC_POWER );
|
||||
reg.addNewAttunement( new ItemStack( BuildCraftTransport.pipePowerStone ), TunnelType.BC_POWER );
|
||||
reg.addNewAttunement( new ItemStack( BuildCraftTransport.pipePowerWood ), TunnelType.BC_POWER );
|
||||
reg.addNewAttunement( new ItemStack( BuildCraftEnergy.engineBlock, 1, 0 ), TunnelType.RF_POWER );
|
||||
reg.addNewAttunement( new ItemStack( BuildCraftEnergy.engineBlock, 1, 1 ), TunnelType.RF_POWER );
|
||||
reg.addNewAttunement( new ItemStack( BuildCraftEnergy.engineBlock, 1, 2 ), TunnelType.RF_POWER );
|
||||
reg.addNewAttunement( new ItemStack( BuildCraftTransport.pipePowerCobblestone ), TunnelType.RF_POWER );
|
||||
reg.addNewAttunement( new ItemStack( BuildCraftTransport.pipePowerDiamond ), TunnelType.RF_POWER );
|
||||
reg.addNewAttunement( new ItemStack( BuildCraftTransport.pipePowerGold ), TunnelType.RF_POWER );
|
||||
reg.addNewAttunement( new ItemStack( BuildCraftTransport.pipePowerQuartz ), TunnelType.RF_POWER );
|
||||
reg.addNewAttunement( new ItemStack( BuildCraftTransport.pipePowerStone ), TunnelType.RF_POWER );
|
||||
reg.addNewAttunement( new ItemStack( BuildCraftTransport.pipePowerWood ), TunnelType.RF_POWER );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -257,7 +233,7 @@ public class BC extends BaseModule implements IBC
|
|||
|
||||
private void initBuilderSupport()
|
||||
{
|
||||
SchematicRegistry.declareBlueprintSupport( AppEng.MOD_ID );
|
||||
final ISchematicRegistry schematicRegistry = BuilderAPI.schematicRegistry;
|
||||
|
||||
Blocks blocks = AEApi.instance().blocks();
|
||||
Block cable = blocks.blockMultiPart.block();
|
||||
|
@ -272,15 +248,15 @@ public class BC extends BaseModule implements IBC
|
|||
Block myBlock = def.block();
|
||||
if ( myBlock instanceof IOrientableBlock && ((IOrientableBlock) myBlock).usesMetadata() && def.entity() == null )
|
||||
{
|
||||
SchematicRegistry.registerSchematicBlock( myBlock, AERotatableBlockSchematic.class );
|
||||
schematicRegistry.registerSchematicBlock( myBlock, AERotatableBlockSchematic.class );
|
||||
}
|
||||
else if ( myBlock == cable )
|
||||
{
|
||||
SchematicRegistry.registerSchematicBlock( myBlock, AECableSchematicTile.class );
|
||||
schematicRegistry.registerSchematicBlock( myBlock, AECableSchematicTile.class );
|
||||
}
|
||||
else if ( def.entity() != null )
|
||||
{
|
||||
SchematicRegistry.registerSchematicBlock( myBlock, AEGenericSchematicTile.class );
|
||||
schematicRegistry.registerSchematicBlock( myBlock, AEGenericSchematicTile.class );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -304,18 +280,10 @@ public class BC extends BaseModule implements IBC
|
|||
{
|
||||
try
|
||||
{
|
||||
ItemStack fs = ItemFacade.getFacade( blk, meta );
|
||||
return new FacadePart( fs, side );
|
||||
}
|
||||
catch (Throwable ignored)
|
||||
{
|
||||
final ItemFacade.FacadeState state = ItemFacade.FacadeState.create( blk, meta );
|
||||
final ItemStack facade = ItemFacade.getFacade( state );
|
||||
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
ItemStack fs = ItemFacade.getStack( blk, meta );
|
||||
return new FacadePart( fs, side );
|
||||
return new FacadePart( facade, side );
|
||||
}
|
||||
catch (Throwable ignored)
|
||||
{
|
||||
|
@ -334,30 +302,19 @@ public class BC extends BaseModule implements IBC
|
|||
@Override
|
||||
public ItemStack getTextureForFacade(ItemStack facade)
|
||||
{
|
||||
try
|
||||
{
|
||||
Block[] blk = ItemFacade.getBlocks( facade );
|
||||
int[] meta = ItemFacade.getMetaValues( facade );
|
||||
if ( blk == null || blk.length < 1 )
|
||||
return null;
|
||||
final Item maybeFacadeItem = facade.getItem();
|
||||
|
||||
if ( blk[0] != null )
|
||||
return new ItemStack( blk[0], 1, meta[0] );
|
||||
}
|
||||
catch (Throwable ignored)
|
||||
if ( maybeFacadeItem instanceof buildcraft.api.facades.IFacadeItem)
|
||||
{
|
||||
final buildcraft.api.facades.IFacadeItem facadeItem = (buildcraft.api.facades.IFacadeItem) maybeFacadeItem;
|
||||
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
Block blk = ItemFacade.getBlock( facade );
|
||||
if ( blk != null )
|
||||
return new ItemStack( blk, 1, ItemFacade.getMetaData( facade ) );
|
||||
}
|
||||
catch (Throwable ignored)
|
||||
{
|
||||
final Block[] blocks = facadeItem.getBlocksForFacade( facade );
|
||||
final int[] metas = facadeItem.getMetaValuesForFacade( facade );
|
||||
|
||||
if ( blocks.length > 0 && metas.length > 0 )
|
||||
{
|
||||
return new ItemStack( blocks[0], 1, metas[0] );
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
|
|
|
@ -24,23 +24,23 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import buildcraft.api.blueprints.IBuilderContext;
|
||||
import buildcraft.api.blueprints.SchematicTile;
|
||||
|
||||
import appeng.api.util.ICommonTile;
|
||||
import appeng.tile.AEBaseTile;
|
||||
import appeng.util.Platform;
|
||||
import buildcraft.api.blueprints.IBuilderContext;
|
||||
import buildcraft.api.blueprints.SchematicTile;
|
||||
|
||||
public class AEGenericSchematicTile extends SchematicTile
|
||||
{
|
||||
|
||||
@Override
|
||||
public void writeRequirementsToBlueprint(IBuilderContext context, int x, int y, int z)
|
||||
public void storeRequirements(IBuilderContext context, int x, int y, int z)
|
||||
{
|
||||
TileEntity tile = context.world().getTileEntity( x, y, z );
|
||||
ArrayList<ItemStack> list = new ArrayList<ItemStack>();
|
||||
if ( tile instanceof AEBaseTile )
|
||||
{
|
||||
AEBaseTile tcb = (AEBaseTile) tile;
|
||||
ICommonTile tcb = (AEBaseTile) tile;
|
||||
tcb.getDrops( tile.getWorldObj(), tile.xCoord, tile.yCoord, tile.zCoord, list );
|
||||
}
|
||||
|
||||
|
|
|
@ -1,56 +0,0 @@
|
|||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.integration.modules;
|
||||
|
||||
import buildcraft.api.power.IPowerReceptor;
|
||||
|
||||
import appeng.integration.BaseModule;
|
||||
import appeng.integration.abstraction.IMJ5;
|
||||
import appeng.integration.modules.helpers.MJPerdition;
|
||||
|
||||
public class MJ5 extends BaseModule implements IMJ5
|
||||
{
|
||||
|
||||
public static MJ5 instance;
|
||||
|
||||
public MJ5() {
|
||||
this.testClassExistence( IPowerReceptor.class );
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object createPerdition(Object buildCraft)
|
||||
{
|
||||
if ( buildCraft instanceof IPowerReceptor )
|
||||
return new MJPerdition( (IPowerReceptor) buildCraft );
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() throws Throwable
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,134 +0,0 @@
|
|||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.integration.modules;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import buildcraft.api.mj.IBatteryObject;
|
||||
import buildcraft.api.mj.IBatteryProvider;
|
||||
import buildcraft.api.mj.ISidedBatteryProvider;
|
||||
import buildcraft.api.mj.MjAPI;
|
||||
import buildcraft.api.power.IPowerReceptor;
|
||||
import buildcraft.api.power.PowerHandler.PowerReceiver;
|
||||
import buildcraft.api.power.PowerHandler.Type;
|
||||
|
||||
import appeng.integration.BaseModule;
|
||||
import appeng.integration.abstraction.IMJ6;
|
||||
import appeng.transformer.annotations.integration.Method;
|
||||
|
||||
public class MJ6 extends BaseModule implements IMJ6
|
||||
{
|
||||
|
||||
public static MJ6 instance;
|
||||
|
||||
public MJ6() {
|
||||
this.testClassExistence( IBatteryObject.class );
|
||||
this.testClassExistence( IBatteryProvider.class );
|
||||
this.testClassExistence( ISidedBatteryProvider.class );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() throws Throwable
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(iname = "MJ5")
|
||||
public IBatteryObject provider(final TileEntity te, final ForgeDirection side)
|
||||
{
|
||||
if ( te instanceof IPowerReceptor )
|
||||
{
|
||||
final IPowerReceptor receptor = (IPowerReceptor) te;
|
||||
final PowerReceiver ph = receptor.getPowerReceiver( side );
|
||||
|
||||
if ( ph == null )
|
||||
return null;
|
||||
|
||||
return new IBatteryObject() {
|
||||
|
||||
@Override
|
||||
public void setEnergyStored(double mj)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBatteryObject reconfigure(double maxCapacity, double maxReceivedPerCycle, double minimumConsumption)
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double minimumConsumption()
|
||||
{
|
||||
return ph.getMinEnergyReceived();
|
||||
}
|
||||
|
||||
@Override
|
||||
public double maxReceivedPerCycle()
|
||||
{
|
||||
return ph.getMaxEnergyReceived();
|
||||
}
|
||||
|
||||
@Override
|
||||
public double maxCapacity()
|
||||
{
|
||||
return ph.getMaxEnergyStored();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String kind()
|
||||
{
|
||||
return MjAPI.DEFAULT_POWER_FRAMEWORK;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getEnergyStored()
|
||||
{
|
||||
return ph.getEnergyStored();
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getEnergyRequested()
|
||||
{
|
||||
return ph.getMaxEnergyStored() - ph.getEnergyStored();
|
||||
}
|
||||
|
||||
@Override
|
||||
public double addEnergy(double mj, boolean ignoreCycleLimit)
|
||||
{
|
||||
return ph.receiveEnergy( Type.PIPE, mj, side );
|
||||
}
|
||||
|
||||
@Override
|
||||
public double addEnergy(double mj)
|
||||
{
|
||||
return ph.receiveEnergy( Type.PIPE, mj, side );
|
||||
}
|
||||
};
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -43,7 +43,7 @@ public class BSCrateStorageAdaptor extends InventoryAdaptor
|
|||
}
|
||||
|
||||
@Override
|
||||
public ItemStack removeItems(int how_many, ItemStack Filter, IInventoryDestination destination)
|
||||
public ItemStack removeItems(int amount, ItemStack filter, IInventoryDestination destination)
|
||||
{
|
||||
ItemStack target = null;
|
||||
|
||||
|
@ -51,7 +51,7 @@ public class BSCrateStorageAdaptor extends InventoryAdaptor
|
|||
{
|
||||
if ( is != null )
|
||||
{
|
||||
if ( is.stackSize > 0 && (Filter == null || Platform.isSameItem( Filter, is )) )
|
||||
if ( is.stackSize > 0 && ( filter == null || Platform.isSameItem( filter, is )) )
|
||||
{
|
||||
if ( destination == null || destination.canInsert( is ) )
|
||||
{
|
||||
|
@ -65,15 +65,15 @@ public class BSCrateStorageAdaptor extends InventoryAdaptor
|
|||
if ( target != null )
|
||||
{
|
||||
ItemStack f = Platform.cloneItemStack( target );
|
||||
f.stackSize = how_many;
|
||||
return this.cs.extractItems( f, how_many );
|
||||
f.stackSize = amount;
|
||||
return cs.extractItems( f, amount );
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack simulateRemove(int how_many, ItemStack Filter, IInventoryDestination destination)
|
||||
public ItemStack simulateRemove(int amount, ItemStack filter, IInventoryDestination destination)
|
||||
{
|
||||
ItemStack target = null;
|
||||
|
||||
|
@ -81,7 +81,7 @@ public class BSCrateStorageAdaptor extends InventoryAdaptor
|
|||
{
|
||||
if ( is != null )
|
||||
{
|
||||
if ( is.stackSize > 0 && (Filter == null || Platform.isSameItem( Filter, is )) )
|
||||
if ( is.stackSize > 0 && ( filter == null || Platform.isSameItem( filter, is )) )
|
||||
{
|
||||
if ( destination == null || destination.canInsert( is ) )
|
||||
{
|
||||
|
@ -97,8 +97,8 @@ public class BSCrateStorageAdaptor extends InventoryAdaptor
|
|||
int cnt = this.cs.getItemCount( target );
|
||||
if ( cnt == 0 )
|
||||
return null;
|
||||
if ( cnt > how_many )
|
||||
cnt = how_many;
|
||||
if ( cnt > amount )
|
||||
cnt = amount;
|
||||
ItemStack c = target.copy();
|
||||
c.stackSize = cnt;
|
||||
return c;
|
||||
|
@ -138,7 +138,7 @@ public class BSCrateStorageAdaptor extends InventoryAdaptor
|
|||
}
|
||||
|
||||
@Override
|
||||
public ItemStack simulateSimilarRemove(int how_many, ItemStack filter, FuzzyMode fuzzyMode, IInventoryDestination destination)
|
||||
public ItemStack simulateSimilarRemove(int amount, ItemStack filter, FuzzyMode fuzzyMode, IInventoryDestination destination)
|
||||
{
|
||||
ItemStack target = null;
|
||||
|
||||
|
@ -162,8 +162,8 @@ public class BSCrateStorageAdaptor extends InventoryAdaptor
|
|||
int cnt = this.cs.getItemCount( target );
|
||||
if ( cnt == 0 )
|
||||
return null;
|
||||
if ( cnt > how_many )
|
||||
cnt = how_many;
|
||||
if ( cnt > amount )
|
||||
cnt = amount;
|
||||
ItemStack c = target.copy();
|
||||
c.stackSize = cnt;
|
||||
return c;
|
||||
|
@ -173,17 +173,17 @@ public class BSCrateStorageAdaptor extends InventoryAdaptor
|
|||
}
|
||||
|
||||
@Override
|
||||
public ItemStack addItems(ItemStack A)
|
||||
public ItemStack addItems(ItemStack toBeAdded )
|
||||
{
|
||||
return this.cs.insertItems( A );
|
||||
return this.cs.insertItems( toBeAdded );
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack simulateAdd(ItemStack A)
|
||||
public ItemStack simulateAdd(ItemStack toBeSimulated )
|
||||
{
|
||||
int items = this.cs.getSpaceForItem( A );
|
||||
ItemStack B = Platform.cloneItemStack( A );
|
||||
if ( A.stackSize <= items )
|
||||
int items = this.cs.getSpaceForItem( toBeSimulated );
|
||||
ItemStack B = Platform.cloneItemStack( toBeSimulated );
|
||||
if ( toBeSimulated.stackSize <= items )
|
||||
return null;
|
||||
B.stackSize -= items;
|
||||
return B;
|
||||
|
|
|
@ -1,25 +0,0 @@
|
|||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.integration.modules.helpers;
|
||||
|
||||
|
||||
public class MJBattery
|
||||
{
|
||||
|
||||
}
|
|
@ -1,81 +0,0 @@
|
|||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.integration.modules.helpers;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import buildcraft.api.power.IPowerReceptor;
|
||||
import buildcraft.api.power.PowerHandler;
|
||||
import buildcraft.api.power.PowerHandler.PowerReceiver;
|
||||
import buildcraft.api.power.PowerHandler.Type;
|
||||
|
||||
import appeng.integration.abstraction.helpers.BaseMJPerdition;
|
||||
|
||||
public class MJPerdition extends BaseMJPerdition
|
||||
{
|
||||
|
||||
final protected PowerHandler bcPowerHandler;
|
||||
|
||||
public MJPerdition(IPowerReceptor te) {
|
||||
this.bcPowerHandler = new PowerHandler( te, Type.MACHINE );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Tick()
|
||||
{
|
||||
this.bcPowerHandler.update();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound data)
|
||||
{
|
||||
this.bcPowerHandler.writeToNBT( data, "bcPowerHandler" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound data)
|
||||
{
|
||||
this.bcPowerHandler.readFromNBT( data, "bcPowerHandler" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public PowerReceiver getPowerReceiver()
|
||||
{
|
||||
return this.bcPowerHandler.getPowerReceiver();
|
||||
}
|
||||
|
||||
@Override
|
||||
public double useEnergy(double min, double max, boolean doUse)
|
||||
{
|
||||
return this.bcPowerHandler.useEnergy( min, max, doUse );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addEnergy(float failed)
|
||||
{
|
||||
this.bcPowerHandler.addEnergy( failed );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void configure(int i, int j, float f, int k)
|
||||
{
|
||||
this.bcPowerHandler.configure( i, j, f, k );
|
||||
}
|
||||
|
||||
}
|
|
@ -18,6 +18,7 @@
|
|||
|
||||
package appeng.items.parts;
|
||||
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.util.EnumSet;
|
||||
|
||||
|
@ -40,7 +41,6 @@ import appeng.parts.networking.PartCableGlass;
|
|||
import appeng.parts.networking.PartCableSmart;
|
||||
import appeng.parts.networking.PartDenseCable;
|
||||
import appeng.parts.networking.PartQuartzFiber;
|
||||
import appeng.parts.p2p.PartP2PBCPower;
|
||||
import appeng.parts.p2p.PartP2PIC2Power;
|
||||
import appeng.parts.p2p.PartP2PItems;
|
||||
import appeng.parts.p2p.PartP2PLight;
|
||||
|
@ -58,86 +58,86 @@ import appeng.parts.reporting.PartSemiDarkMonitor;
|
|||
import appeng.parts.reporting.PartStorageMonitor;
|
||||
import appeng.parts.reporting.PartTerminal;
|
||||
|
||||
|
||||
public enum PartType
|
||||
{
|
||||
InvalidType(-1, AEFeature.Core, null),
|
||||
InvalidType( -1, AEFeature.Core, null ),
|
||||
|
||||
CableGlass(0, AEFeature.Core, PartCableGlass.class),
|
||||
CableGlass( 0, AEFeature.Core, PartCableGlass.class ),
|
||||
|
||||
CableCovered(20, AEFeature.Core, PartCableCovered.class),
|
||||
CableCovered( 20, AEFeature.Core, PartCableCovered.class ),
|
||||
|
||||
CableSmart(40, AEFeature.Channels, PartCableSmart.class),
|
||||
CableSmart( 40, AEFeature.Channels, PartCableSmart.class ),
|
||||
|
||||
CableDense(60, AEFeature.Channels, PartDenseCable.class),
|
||||
CableDense( 60, AEFeature.Channels, PartDenseCable.class ),
|
||||
|
||||
ToggleBus(80, AEFeature.Core, PartToggleBus.class),
|
||||
ToggleBus( 80, AEFeature.Core, PartToggleBus.class ),
|
||||
|
||||
InvertedToggleBus(100, AEFeature.Core, PartInvertedToggleBus.class),
|
||||
InvertedToggleBus( 100, AEFeature.Core, PartInvertedToggleBus.class ),
|
||||
|
||||
CableAnchor(120, AEFeature.Core, PartCableAnchor.class),
|
||||
CableAnchor( 120, AEFeature.Core, PartCableAnchor.class ),
|
||||
|
||||
QuartzFiber(140, AEFeature.Core, PartQuartzFiber.class),
|
||||
QuartzFiber( 140, AEFeature.Core, PartQuartzFiber.class ),
|
||||
|
||||
Monitor(160, AEFeature.Core, PartMonitor.class),
|
||||
Monitor( 160, AEFeature.Core, PartMonitor.class ),
|
||||
|
||||
SemiDarkMonitor(180, AEFeature.Core, PartSemiDarkMonitor.class),
|
||||
SemiDarkMonitor( 180, AEFeature.Core, PartSemiDarkMonitor.class ),
|
||||
|
||||
DarkMonitor(200, AEFeature.Core, PartDarkMonitor.class),
|
||||
DarkMonitor( 200, AEFeature.Core, PartDarkMonitor.class ),
|
||||
|
||||
StorageBus(220, AEFeature.StorageBus, PartStorageBus.class),
|
||||
StorageBus( 220, AEFeature.StorageBus, PartStorageBus.class ),
|
||||
|
||||
ImportBus(240, AEFeature.ImportBus, PartImportBus.class),
|
||||
ImportBus( 240, AEFeature.ImportBus, PartImportBus.class ),
|
||||
|
||||
ExportBus(260, AEFeature.ExportBus, PartExportBus.class),
|
||||
ExportBus( 260, AEFeature.ExportBus, PartExportBus.class ),
|
||||
|
||||
LevelEmitter(280, AEFeature.LevelEmitter, PartLevelEmitter.class),
|
||||
LevelEmitter( 280, AEFeature.LevelEmitter, PartLevelEmitter.class ),
|
||||
|
||||
AnnihilationPlane(300, AEFeature.AnnihilationPlane, PartAnnihilationPlane.class),
|
||||
AnnihilationPlane( 300, AEFeature.AnnihilationPlane, PartAnnihilationPlane.class ),
|
||||
|
||||
FormationPlane(320, AEFeature.FormationPlane, PartFormationPlane.class),
|
||||
FormationPlane( 320, AEFeature.FormationPlane, PartFormationPlane.class ),
|
||||
|
||||
PatternTerminal(340, AEFeature.Patterns, PartPatternTerminal.class),
|
||||
PatternTerminal( 340, AEFeature.Patterns, PartPatternTerminal.class ),
|
||||
|
||||
CraftingTerminal(360, AEFeature.CraftingTerminal, PartCraftingTerminal.class),
|
||||
CraftingTerminal( 360, AEFeature.CraftingTerminal, PartCraftingTerminal.class ),
|
||||
|
||||
Terminal(380, AEFeature.Core, PartTerminal.class),
|
||||
Terminal( 380, AEFeature.Core, PartTerminal.class ),
|
||||
|
||||
StorageMonitor(400, AEFeature.StorageMonitor, PartStorageMonitor.class),
|
||||
StorageMonitor( 400, AEFeature.StorageMonitor, PartStorageMonitor.class ),
|
||||
|
||||
ConversionMonitor(420, AEFeature.PartConversionMonitor, PartConversionMonitor.class),
|
||||
ConversionMonitor( 420, AEFeature.PartConversionMonitor, PartConversionMonitor.class ),
|
||||
|
||||
Interface(440, AEFeature.Core, PartInterface.class),
|
||||
Interface( 440, AEFeature.Core, PartInterface.class ),
|
||||
|
||||
P2PTunnelME(460, AEFeature.P2PTunnelME, PartP2PTunnelME.class, GuiText.METunnel),
|
||||
P2PTunnelME( 460, AEFeature.P2PTunnelME, PartP2PTunnelME.class, GuiText.METunnel ),
|
||||
|
||||
P2PTunnelRedstone(461, AEFeature.P2PTunnelRedstone, PartP2PRedstone.class, GuiText.RedstoneTunnel),
|
||||
P2PTunnelRedstone( 461, AEFeature.P2PTunnelRedstone, PartP2PRedstone.class, GuiText.RedstoneTunnel ),
|
||||
|
||||
P2PTunnelItems(462, AEFeature.P2PTunnelItems, PartP2PItems.class, GuiText.ItemTunnel),
|
||||
P2PTunnelItems( 462, AEFeature.P2PTunnelItems, PartP2PItems.class, GuiText.ItemTunnel ),
|
||||
|
||||
P2PTunnelLiquids(463, AEFeature.P2PTunnelLiquids, PartP2PLiquids.class, GuiText.FluidTunnel),
|
||||
P2PTunnelLiquids( 463, AEFeature.P2PTunnelLiquids, PartP2PLiquids.class, GuiText.FluidTunnel ),
|
||||
|
||||
P2PTunnelMJ(464, AEFeature.P2PTunnelMJ, PartP2PBCPower.class, GuiText.MJTunnel),
|
||||
P2PTunnelEU( 465, AEFeature.P2PTunnelEU, PartP2PIC2Power.class, GuiText.EUTunnel ),
|
||||
|
||||
P2PTunnelEU(465, AEFeature.P2PTunnelEU, PartP2PIC2Power.class, GuiText.EUTunnel),
|
||||
P2PTunnelRF( 466, AEFeature.P2PTunnelRF, PartP2PRFPower.class, GuiText.RFTunnel ),
|
||||
|
||||
P2PTunnelRF(466, AEFeature.P2PTunnelRF, PartP2PRFPower.class, GuiText.RFTunnel),
|
||||
P2PTunnelLight( 467, AEFeature.P2PTunnelLight, PartP2PLight.class, GuiText.LightTunnel ),
|
||||
|
||||
P2PTunnelLight(467, AEFeature.P2PTunnelLight, PartP2PLight.class, GuiText.LightTunnel),
|
||||
|
||||
InterfaceTerminal(480, AEFeature.InterfaceTerminal, PartInterfaceTerminal.class);
|
||||
InterfaceTerminal( 480, AEFeature.InterfaceTerminal, PartInterfaceTerminal.class );
|
||||
|
||||
public final int baseDamage;
|
||||
private final EnumSet<AEFeature> features;
|
||||
private final Class<? extends IPart> myPart;
|
||||
private final GuiText extraName;
|
||||
public final int baseDamage;
|
||||
|
||||
public Constructor<? extends IPart> constructor;
|
||||
|
||||
PartType(int baseMetaValue, AEFeature part, Class<? extends IPart> c) {
|
||||
PartType( int baseMetaValue, AEFeature part, Class<? extends IPart> c )
|
||||
{
|
||||
this( baseMetaValue, part, c, null );
|
||||
}
|
||||
|
||||
PartType(int baseMetaValue, AEFeature part, Class<? extends IPart> c, GuiText en) {
|
||||
PartType( int baseMetaValue, AEFeature part, Class<? extends IPart> c, GuiText en )
|
||||
{
|
||||
this.features = EnumSet.of( part );
|
||||
this.myPart = c;
|
||||
this.extraName = en;
|
||||
|
|
|
@ -1,43 +0,0 @@
|
|||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.parts.layers;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import buildcraft.api.mj.IBatteryObject;
|
||||
import buildcraft.api.mj.ISidedBatteryProvider;
|
||||
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.api.parts.LayerBase;
|
||||
|
||||
public class LayerIBatteryProvider extends LayerBase implements ISidedBatteryProvider
|
||||
{
|
||||
|
||||
@Override
|
||||
public IBatteryObject getMjBattery(String kind, ForgeDirection direction)
|
||||
{
|
||||
IPart p = this.getPart( direction );
|
||||
|
||||
if ( p instanceof ISidedBatteryProvider )
|
||||
return ((ISidedBatteryProvider) p).getMjBattery( kind, direction );
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,39 +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.parts.layers;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import buildcraft.api.power.IPowerEmitter;
|
||||
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.api.parts.LayerBase;
|
||||
|
||||
public class LayerIPowerEmitter extends LayerBase implements IPowerEmitter
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean canEmitPowerFrom(ForgeDirection side)
|
||||
{
|
||||
IPart part = this.getPart( side );
|
||||
if ( part instanceof IPowerEmitter )
|
||||
return ((IPowerEmitter) part).canEmitPowerFrom( side );
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -1,56 +0,0 @@
|
|||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.parts.layers;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import buildcraft.api.power.IPowerReceptor;
|
||||
import buildcraft.api.power.PowerHandler;
|
||||
import buildcraft.api.power.PowerHandler.PowerReceiver;
|
||||
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.api.parts.IPartHost;
|
||||
import appeng.api.parts.LayerBase;
|
||||
|
||||
public class LayerIPowerReceptor extends LayerBase implements IPowerReceptor
|
||||
{
|
||||
|
||||
@Override
|
||||
public PowerReceiver getPowerReceiver(ForgeDirection side)
|
||||
{
|
||||
IPart part = this.getPart( side );
|
||||
if ( part instanceof IPowerReceptor )
|
||||
return ((IPowerReceptor) part).getPowerReceiver( side );
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doWork(PowerHandler workProvider)
|
||||
{
|
||||
// do nothing, this seems pointless.
|
||||
}
|
||||
|
||||
@Override
|
||||
public World getWorld()
|
||||
{
|
||||
return ((IPartHost) this).getTile().getWorldObj();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,464 +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.parts.p2p;
|
||||
|
||||
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import buildcraft.api.mj.IBatteryObject;
|
||||
import buildcraft.api.mj.ISidedBatteryProvider;
|
||||
import buildcraft.api.mj.MjAPI;
|
||||
import buildcraft.api.power.IPowerReceptor;
|
||||
import buildcraft.api.power.PowerHandler;
|
||||
import buildcraft.api.power.PowerHandler.PowerReceiver;
|
||||
import buildcraft.api.power.PowerHandler.Type;
|
||||
|
||||
import appeng.api.config.PowerUnits;
|
||||
import appeng.api.config.TunnelType;
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.networking.ticking.IGridTickable;
|
||||
import appeng.api.networking.ticking.TickRateModulation;
|
||||
import appeng.api.networking.ticking.TickingRequest;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.core.settings.TickRates;
|
||||
import appeng.integration.IntegrationType;
|
||||
import appeng.integration.abstraction.IMJ5;
|
||||
import appeng.integration.abstraction.IMJ6;
|
||||
import appeng.integration.abstraction.helpers.BaseMJPerdition;
|
||||
import appeng.me.GridAccessException;
|
||||
import appeng.me.cache.helpers.TunnelCollection;
|
||||
import appeng.transformer.annotations.integration.Interface;
|
||||
import appeng.transformer.annotations.integration.InterfaceList;
|
||||
import appeng.transformer.annotations.integration.Method;
|
||||
|
||||
@InterfaceList(value = { @Interface(iface = "buildcraft.api.mj.ISidedBatteryProvider", iname = "MJ6"),
|
||||
@Interface(iface = "buildcraft.api.mj.IBatteryObject", iname = "MJ6"), @Interface(iface = "buildcraft.api.power.IPowerReceptor", iname = "MJ5"),
|
||||
@Interface(iface = "appeng.api.networking.ticking.IGridTickable", iname = "MJ5") })
|
||||
public class PartP2PBCPower extends PartP2PTunnel<PartP2PBCPower> implements IPowerReceptor, ISidedBatteryProvider, IBatteryObject, IGridTickable
|
||||
{
|
||||
|
||||
BaseMJPerdition pp;
|
||||
|
||||
@Override
|
||||
public TunnelType getTunnelType()
|
||||
{
|
||||
return TunnelType.BC_POWER;
|
||||
}
|
||||
|
||||
public PartP2PBCPower(ItemStack is) {
|
||||
super( is );
|
||||
|
||||
if ( !AppEng.instance.isIntegrationEnabled( IntegrationType.MJ5 ) && !AppEng.instance.isIntegrationEnabled( IntegrationType.MJ6 ) )
|
||||
throw new RuntimeException( "MJ Not installed!" );
|
||||
|
||||
if ( AppEng.instance.isIntegrationEnabled( IntegrationType.MJ5 ) )
|
||||
{
|
||||
this.pp = (BaseMJPerdition) ((IMJ5) AppEng.instance.getIntegration( IntegrationType.MJ5 )).createPerdition( this );
|
||||
if ( this.pp != null )
|
||||
this.pp.configure( 1, 380, 1.0f / 5.0f, 1000 );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(iname = "MJ5")
|
||||
public TickingRequest getTickingRequest(IGridNode node)
|
||||
{
|
||||
return new TickingRequest( TickRates.MJTunnel.min, TickRates.MJTunnel.max, false, false );
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(iname = "MJ5")
|
||||
public TickRateModulation tickingRequest(IGridNode node, int TicksSinceLastCall)
|
||||
{
|
||||
if ( !this.output && this.proxy.isActive() )
|
||||
{
|
||||
float totalRequiredPower = 0.0f;
|
||||
TunnelCollection<PartP2PBCPower> tunnels;
|
||||
|
||||
try
|
||||
{
|
||||
tunnels = this.getOutputs();
|
||||
}
|
||||
catch (GridAccessException e)
|
||||
{
|
||||
return TickRateModulation.IDLE;
|
||||
}
|
||||
|
||||
for (PartP2PBCPower o : tunnels)
|
||||
{
|
||||
IPowerReceptor target = o.getPowerTarget();
|
||||
if ( target != null )
|
||||
{
|
||||
PowerReceiver tp = target.getPowerReceiver( this.side.getOpposite() );
|
||||
if ( tp != null )
|
||||
{
|
||||
double request = tp.powerRequest();
|
||||
|
||||
if ( request > tp.getMaxEnergyReceived() )
|
||||
request = tp.getMaxEnergyReceived();
|
||||
|
||||
if ( request > 0.01 && request > tp.getMinEnergyReceived() )
|
||||
{
|
||||
totalRequiredPower += request;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( totalRequiredPower < 0.1 )
|
||||
return TickRateModulation.SLOWER;
|
||||
|
||||
double currentTotal = this.pp.getPowerReceiver().getEnergyStored();
|
||||
if ( currentTotal < 0.01 )
|
||||
return TickRateModulation.SLOWER;
|
||||
|
||||
for (PartP2PBCPower o : tunnels)
|
||||
{
|
||||
IPowerReceptor target = o.getPowerTarget();
|
||||
if ( target != null )
|
||||
{
|
||||
PowerReceiver tp = target.getPowerReceiver( this.side.getOpposite() );
|
||||
if ( tp != null )
|
||||
{
|
||||
double request = tp.powerRequest();
|
||||
|
||||
if ( request > tp.getMaxEnergyReceived() )
|
||||
request = tp.getMaxEnergyReceived();
|
||||
|
||||
if ( request > 0.01 && request > tp.getMinEnergyReceived() )
|
||||
{
|
||||
double toPull = currentTotal * (request / totalRequiredPower);
|
||||
double pulled = this.pp.useEnergy( 0, toPull, true );
|
||||
this.QueueTunnelDrain( PowerUnits.MJ, pulled );
|
||||
|
||||
tp.receiveEnergy( Type.PIPE, pulled, o.side.getOpposite() );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return TickRateModulation.FASTER;
|
||||
}
|
||||
|
||||
return TickRateModulation.SLOWER;
|
||||
}
|
||||
|
||||
public float getPowerDrainPerTick()
|
||||
{
|
||||
return 0.5f;
|
||||
}
|
||||
|
||||
@Method(iname = "MJ6")
|
||||
private IBatteryObject getTargetBattery()
|
||||
{
|
||||
TileEntity te = this.getWorld().getTileEntity( this.tile.xCoord + this.side.offsetX, this.tile.yCoord + this.side.offsetY, this.tile.zCoord + this.side.offsetZ );
|
||||
if ( te != null )
|
||||
{
|
||||
IBatteryObject bo = MjAPI.getMjBattery( te, MjAPI.DEFAULT_POWER_FRAMEWORK, this.side.getOpposite() );
|
||||
if ( bo != null )
|
||||
return bo;
|
||||
|
||||
return ((IMJ6) AppEng.instance.getIntegration( IntegrationType.MJ6 )).provider( te, this.side.getOpposite() );
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Method(iname = "MJ5")
|
||||
private IPowerReceptor getPowerTarget()
|
||||
{
|
||||
TileEntity te = this.getWorld().getTileEntity( this.tile.xCoord + this.side.offsetX, this.tile.yCoord + this.side.offsetY, this.tile.zCoord + this.side.offsetZ );
|
||||
if ( te != null )
|
||||
{
|
||||
if ( te instanceof IPowerReceptor )
|
||||
return (IPowerReceptor) te;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
super.writeToNBT( tag );
|
||||
if ( this.pp != null )
|
||||
this.pp.writeToNBT( tag );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
super.readFromNBT( tag );
|
||||
if ( this.pp != null )
|
||||
this.pp.readFromNBT( tag );
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getTypeTexture()
|
||||
{
|
||||
return Blocks.emerald_block.getBlockTextureFromSide( 0 );
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(iname = "MJ5")
|
||||
public PowerReceiver getPowerReceiver(ForgeDirection side)
|
||||
{
|
||||
return this.pp.getPowerReceiver();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(iname = "MJ5")
|
||||
public void doWork(PowerHandler workProvider)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public World getWorld()
|
||||
{
|
||||
return this.tile.getWorldObj();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(iname = "MJ6")
|
||||
public IBatteryObject getMjBattery(String kind, ForgeDirection direction)
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(iname = "MJ6")
|
||||
public double getEnergyRequested()
|
||||
{
|
||||
try
|
||||
{
|
||||
double totalRequiredPower = 0.0f;
|
||||
|
||||
for (PartP2PBCPower g : this.getOutputs())
|
||||
{
|
||||
IBatteryObject o = g.getTargetBattery();
|
||||
if ( o != null )
|
||||
totalRequiredPower += o.getEnergyRequested();
|
||||
}
|
||||
|
||||
return totalRequiredPower;
|
||||
}
|
||||
catch (GridAccessException e)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(iname = "MJ6")
|
||||
public double addEnergy(double mj)
|
||||
{
|
||||
return this.addEnergyInternal( mj, false, false );
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(iname = "MJ6")
|
||||
public double addEnergy(double mj, boolean ignoreCycleLimit)
|
||||
{
|
||||
return this.addEnergyInternal( mj, true, ignoreCycleLimit );
|
||||
}
|
||||
|
||||
@Method(iname = "MJ6")
|
||||
private double addEnergyInternal(double mj, boolean cycleLimitMode, boolean ignoreCycleLimit)
|
||||
{
|
||||
if ( this.output || !this.proxy.isActive() )
|
||||
return 0;
|
||||
|
||||
double originalInput = mj;
|
||||
|
||||
try
|
||||
{
|
||||
TunnelCollection<PartP2PBCPower> outs = this.getOutputs();
|
||||
|
||||
double outputs = 0;
|
||||
for (PartP2PBCPower g : outs)
|
||||
{
|
||||
IBatteryObject o = g.getTargetBattery();
|
||||
if ( o != null )
|
||||
{
|
||||
outputs = outputs + 1.0;
|
||||
}
|
||||
}
|
||||
|
||||
if ( outputs < 0.0000001 )
|
||||
return 0;
|
||||
|
||||
for (PartP2PBCPower g : outs)
|
||||
{
|
||||
IBatteryObject o = g.getTargetBattery();
|
||||
if ( o != null )
|
||||
{
|
||||
double fraction = originalInput / outputs;
|
||||
if ( cycleLimitMode )
|
||||
fraction = o.addEnergy( fraction );
|
||||
else
|
||||
fraction = o.addEnergy( fraction, ignoreCycleLimit );
|
||||
mj -= fraction;
|
||||
}
|
||||
}
|
||||
|
||||
if ( mj > 0 )
|
||||
{
|
||||
for (PartP2PBCPower g : outs)
|
||||
{
|
||||
IBatteryObject o = g.getTargetBattery();
|
||||
if ( o != null )
|
||||
{
|
||||
if ( cycleLimitMode )
|
||||
mj = mj - o.addEnergy( mj );
|
||||
else
|
||||
mj = mj - o.addEnergy( mj, ignoreCycleLimit );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return originalInput - mj;
|
||||
}
|
||||
catch (GridAccessException e)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(iname = "MJ6")
|
||||
public double getEnergyStored()
|
||||
{
|
||||
try
|
||||
{
|
||||
double totalRequiredPower = 0.0f;
|
||||
|
||||
for (PartP2PBCPower g : this.getOutputs())
|
||||
{
|
||||
IBatteryObject o = g.getTargetBattery();
|
||||
if ( o != null )
|
||||
totalRequiredPower += o.getEnergyStored();
|
||||
}
|
||||
|
||||
return totalRequiredPower;
|
||||
}
|
||||
catch (GridAccessException e)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(iname = "MJ6")
|
||||
public void setEnergyStored(double mj)
|
||||
{
|
||||
// EHh?!
|
||||
}
|
||||
|
||||
@Override
|
||||
public double maxCapacity()
|
||||
{
|
||||
try
|
||||
{
|
||||
double totalRequiredPower = 0.0f;
|
||||
|
||||
for (PartP2PBCPower g : this.getOutputs())
|
||||
{
|
||||
IBatteryObject o = g.getTargetBattery();
|
||||
if ( o != null )
|
||||
totalRequiredPower += o.maxCapacity();
|
||||
}
|
||||
|
||||
return totalRequiredPower;
|
||||
}
|
||||
catch (GridAccessException e)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(iname = "MJ6")
|
||||
public double minimumConsumption()
|
||||
{
|
||||
try
|
||||
{
|
||||
double totalRequiredPower = 1000000000000.0;
|
||||
|
||||
for (PartP2PBCPower g : this.getOutputs())
|
||||
{
|
||||
IBatteryObject o = g.getTargetBattery();
|
||||
if ( o != null )
|
||||
totalRequiredPower = Math.min( totalRequiredPower, o.minimumConsumption() );
|
||||
}
|
||||
|
||||
return totalRequiredPower;
|
||||
}
|
||||
catch (GridAccessException e)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(iname = "MJ6")
|
||||
public double maxReceivedPerCycle()
|
||||
{
|
||||
try
|
||||
{
|
||||
double totalRequiredPower = 1000000.0;
|
||||
|
||||
for (PartP2PBCPower g : this.getOutputs())
|
||||
{
|
||||
IBatteryObject o = g.getTargetBattery();
|
||||
if ( o != null )
|
||||
totalRequiredPower = Math.min( totalRequiredPower, o.maxReceivedPerCycle() );
|
||||
}
|
||||
|
||||
return totalRequiredPower;
|
||||
}
|
||||
catch (GridAccessException e)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(iname = "MJ6")
|
||||
public IBatteryObject reconfigure(double maxCapacity, double maxReceivedPerCycle, double minimumConsumption)
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(iname = "MJ6")
|
||||
public String kind()
|
||||
{
|
||||
return "tunnel";
|
||||
}
|
||||
|
||||
}
|
|
@ -33,7 +33,7 @@ import appeng.transformer.annotations.integration.Interface;
|
|||
import appeng.util.Platform;
|
||||
|
||||
@Interface(iname = "IC2", iface = "ic2.api.energy.tile.IEnergySink")
|
||||
public abstract class IC2 extends MinecraftJoules6 implements IEnergySink
|
||||
public abstract class IC2 extends AERootPoweredTile implements IEnergySink
|
||||
{
|
||||
|
||||
boolean isInIC2 = false;
|
||||
|
|
|
@ -1,102 +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.tile.powersink;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import buildcraft.api.power.IPowerReceptor;
|
||||
import buildcraft.api.power.PowerHandler;
|
||||
import buildcraft.api.power.PowerHandler.PowerReceiver;
|
||||
|
||||
import appeng.api.config.PowerUnits;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.integration.IntegrationType;
|
||||
import appeng.integration.abstraction.IMJ5;
|
||||
import appeng.integration.abstraction.helpers.BaseMJPerdition;
|
||||
import appeng.tile.TileEvent;
|
||||
import appeng.tile.events.TileEventType;
|
||||
import appeng.transformer.annotations.integration.Interface;
|
||||
import appeng.transformer.annotations.integration.Method;
|
||||
import appeng.util.Platform;
|
||||
|
||||
@Interface(iname = "MJ5", iface = "buildcraft.api.power.IPowerReceptor")
|
||||
public abstract class MinecraftJoules5 extends AERootPoweredTile implements IPowerReceptor
|
||||
{
|
||||
|
||||
BaseMJPerdition bcPowerWrapper;
|
||||
|
||||
@Method(iname = "MJ5")
|
||||
@TileEvent(TileEventType.TICK)
|
||||
public void Tick_MinecraftJoules5()
|
||||
{
|
||||
if ( this.bcPowerWrapper != null )
|
||||
this.bcPowerWrapper.Tick();
|
||||
}
|
||||
|
||||
public MinecraftJoules5() {
|
||||
if ( Platform.isServer() )
|
||||
{
|
||||
try
|
||||
{
|
||||
if ( AppEng.instance.isIntegrationEnabled( IntegrationType.MJ5 ) )
|
||||
{
|
||||
IMJ5 mjIntegration = (IMJ5) AppEng.instance.getIntegration( IntegrationType.MJ5 );
|
||||
if ( mjIntegration != null )
|
||||
{
|
||||
this.bcPowerWrapper = (BaseMJPerdition) mjIntegration.createPerdition( this );
|
||||
if ( this.bcPowerWrapper != null )
|
||||
this.bcPowerWrapper.configure( 1, 380, 1.0f / 5.0f, 1000 );
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Throwable t)
|
||||
{
|
||||
// ignore.. no bc?
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(iname = "MJ5")
|
||||
final public PowerReceiver getPowerReceiver(ForgeDirection side)
|
||||
{
|
||||
if ( this.getPowerSides().contains( side ) && this.bcPowerWrapper != null )
|
||||
return this.bcPowerWrapper.getPowerReceiver();
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(iname = "MJ5")
|
||||
final public void doWork(PowerHandler workProvider)
|
||||
{
|
||||
float required = (float) this.getExternalPowerDemand( PowerUnits.MJ, this.bcPowerWrapper.getPowerReceiver().getEnergyStored() );
|
||||
double failed = this.injectExternalPower( PowerUnits.MJ, this.bcPowerWrapper.useEnergy( 0.0f, required, true ) );
|
||||
if ( failed > 0.01 )
|
||||
this.bcPowerWrapper.addEnergy( (float) failed );
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(iname = "MJ5")
|
||||
final public World getWorld()
|
||||
{
|
||||
return this.worldObj;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,117 +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.tile.powersink;
|
||||
|
||||
import buildcraft.api.mj.IBatteryObject;
|
||||
import buildcraft.api.mj.IBatteryProvider;
|
||||
|
||||
import appeng.api.config.PowerUnits;
|
||||
import appeng.transformer.annotations.integration.Interface;
|
||||
import appeng.transformer.annotations.integration.InterfaceList;
|
||||
import appeng.transformer.annotations.integration.Method;
|
||||
|
||||
@InterfaceList(value = { @Interface(iname = "MJ6", iface = "buildcraft.api.mj.IBatteryProvider"),
|
||||
@Interface(iname = "MJ6", iface = "buildcraft.api.mj.IBatteryObject") })
|
||||
public abstract class MinecraftJoules6 extends MinecraftJoules5 implements IBatteryProvider, IBatteryObject
|
||||
{
|
||||
|
||||
@Override
|
||||
@Method(iname = "MJ6")
|
||||
public String kind()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(iname = "MJ6")
|
||||
public double getEnergyRequested()
|
||||
{
|
||||
return this.getExternalPowerDemand( PowerUnits.MJ, Double.MAX_VALUE );
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(iname = "MJ6")
|
||||
public double addEnergy(double amount)
|
||||
{
|
||||
double demand = this.getExternalPowerDemand( PowerUnits.MJ, Double.MAX_VALUE );
|
||||
if ( amount > demand )
|
||||
amount = demand;
|
||||
|
||||
double overflow = this.injectExternalPower( PowerUnits.MJ, amount );
|
||||
return amount - overflow;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(iname = "MJ6")
|
||||
public double addEnergy(double amount, boolean ignoreCycleLimit)
|
||||
{
|
||||
double overflow = this.injectExternalPower( PowerUnits.MJ, amount );
|
||||
return amount - overflow;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(iname = "MJ6")
|
||||
public double getEnergyStored()
|
||||
{
|
||||
return PowerUnits.AE.convertTo( PowerUnits.MJ, this.internalCurrentPower );
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(iname = "MJ6")
|
||||
public void setEnergyStored(double mj)
|
||||
{
|
||||
this.internalCurrentPower = PowerUnits.MJ.convertTo( PowerUnits.AE, mj );
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(iname = "MJ6")
|
||||
public double maxCapacity()
|
||||
{
|
||||
return PowerUnits.AE.convertTo( PowerUnits.MJ, this.internalMaxPower );
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(iname = "MJ6")
|
||||
public double minimumConsumption()
|
||||
{
|
||||
return 0.1;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(iname = "MJ6")
|
||||
public double maxReceivedPerCycle()
|
||||
{
|
||||
return 999999.0;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(iname = "MJ6")
|
||||
public IBatteryObject reconfigure(double maxCapacity, double maxReceivedPerCycle, double minimumConsumption)
|
||||
{
|
||||
return this.getMjBattery( "" );
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(iname = "MJ6")
|
||||
public IBatteryObject getMjBattery(String kind)
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
|
@ -27,14 +27,11 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.tileentity.TileEntityChest;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import buildcraft.api.inventory.ISpecialInventory;
|
||||
|
||||
import appeng.api.config.FuzzyMode;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.integration.IntegrationType;
|
||||
import appeng.integration.abstraction.IBetterStorage;
|
||||
import appeng.util.inv.AdaptorIInventory;
|
||||
import appeng.util.inv.AdaptorISpecialInventory;
|
||||
import appeng.util.inv.AdaptorList;
|
||||
import appeng.util.inv.AdaptorPlayerInventory;
|
||||
import appeng.util.inv.IInventoryDestination;
|
||||
|
@ -45,19 +42,19 @@ public abstract class InventoryAdaptor implements Iterable<ItemSlot>
|
|||
{
|
||||
|
||||
// return what was extracted.
|
||||
public abstract ItemStack removeItems(int how_many, ItemStack Filter, IInventoryDestination destination);
|
||||
public abstract ItemStack removeItems(int amount, ItemStack filter, IInventoryDestination destination);
|
||||
|
||||
public abstract ItemStack simulateRemove(int how_many, ItemStack Filter, IInventoryDestination destination);
|
||||
public abstract ItemStack simulateRemove(int amount, ItemStack filter, IInventoryDestination destination);
|
||||
|
||||
// return what was extracted.
|
||||
public abstract ItemStack removeSimilarItems(int amount, ItemStack filter, FuzzyMode fuzzyMode, IInventoryDestination destination);
|
||||
|
||||
public abstract ItemStack simulateSimilarRemove(int how_many, ItemStack filter, FuzzyMode fuzzyMode, IInventoryDestination destination);
|
||||
public abstract ItemStack simulateSimilarRemove(int amount, ItemStack filter, FuzzyMode fuzzyMode, IInventoryDestination destination);
|
||||
|
||||
// return what isn't used...
|
||||
public abstract ItemStack addItems(ItemStack A);
|
||||
public abstract ItemStack addItems(ItemStack toBeAdded);
|
||||
|
||||
public abstract ItemStack simulateAdd(ItemStack A);
|
||||
public abstract ItemStack simulateAdd(ItemStack toBeSimulated);
|
||||
|
||||
public abstract boolean containsItems();
|
||||
|
||||
|
@ -75,7 +72,10 @@ public abstract class InventoryAdaptor implements Iterable<ItemSlot>
|
|||
}
|
||||
else if ( te instanceof ArrayList )
|
||||
{
|
||||
return new AdaptorList( (ArrayList<ItemStack>) te );
|
||||
@SuppressWarnings( "unchecked" )
|
||||
final ArrayList<ItemStack> list = ( ArrayList<ItemStack> ) te;
|
||||
|
||||
return new AdaptorList( list );
|
||||
}
|
||||
else if ( bs != null && bs.isStorageCrate( te ) )
|
||||
{
|
||||
|
@ -85,10 +85,6 @@ public abstract class InventoryAdaptor implements Iterable<ItemSlot>
|
|||
{
|
||||
return new AdaptorIInventory( Platform.GetChestInv( te ) );
|
||||
}
|
||||
else if ( isSpecialInventory( te ) )
|
||||
{
|
||||
return new AdaptorISpecialInventory( (ISpecialInventory) te, d );
|
||||
}
|
||||
else if ( te instanceof ISidedInventory )
|
||||
{
|
||||
ISidedInventory si =(ISidedInventory)te;
|
||||
|
@ -105,22 +101,4 @@ public abstract class InventoryAdaptor implements Iterable<ItemSlot>
|
|||
|
||||
return null;
|
||||
}
|
||||
|
||||
private static boolean canBeSpecial = true;
|
||||
|
||||
private static boolean isSpecialInventory(Object a)
|
||||
{
|
||||
if ( canBeSpecial )
|
||||
{
|
||||
try
|
||||
{
|
||||
return a instanceof ISpecialInventory;
|
||||
}
|
||||
catch (Throwable e)
|
||||
{
|
||||
canBeSpecial = false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,43 +60,43 @@ public class AdaptorBCPipe extends InventoryAdaptor
|
|||
}
|
||||
|
||||
@Override
|
||||
public ItemStack simulateSimilarRemove(int how_many, ItemStack filter, FuzzyMode fuzzyMode, IInventoryDestination destination)
|
||||
public ItemStack simulateSimilarRemove(int amount, ItemStack filter, FuzzyMode fuzzyMode, IInventoryDestination destination)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack removeItems(int how_many, ItemStack filter, IInventoryDestination destination)
|
||||
public ItemStack removeItems(int amount, ItemStack filter, IInventoryDestination destination)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack simulateRemove(int how_many, ItemStack filter, IInventoryDestination destination)
|
||||
public ItemStack simulateRemove(int amount, ItemStack filter, IInventoryDestination destination)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack addItems(ItemStack A)
|
||||
public ItemStack addItems(ItemStack toBeAdded )
|
||||
{
|
||||
if ( this.i == null )
|
||||
return A;
|
||||
if ( A == null )
|
||||
return toBeAdded;
|
||||
if ( toBeAdded == null )
|
||||
return null;
|
||||
if ( A.stackSize == 0 )
|
||||
if ( toBeAdded.stackSize == 0 )
|
||||
return null;
|
||||
|
||||
if ( this.bc.addItemsToPipe( this.i, A, this.d ) )
|
||||
if ( this.bc.addItemsToPipe( this.i, toBeAdded, this.d ) )
|
||||
return null;
|
||||
return A;
|
||||
return toBeAdded;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack simulateAdd(ItemStack A)
|
||||
public ItemStack simulateAdd(ItemStack toBeSimulated )
|
||||
{
|
||||
if ( this.i == null )
|
||||
return A;
|
||||
return toBeSimulated;
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -224,15 +224,15 @@ public class AdaptorIInventory extends InventoryAdaptor
|
|||
}
|
||||
|
||||
@Override
|
||||
public ItemStack addItems( ItemStack itemsToAdd )
|
||||
public ItemStack addItems( ItemStack toBeAdded )
|
||||
{
|
||||
return this.addItems( itemsToAdd, true );
|
||||
return this.addItems( toBeAdded, true );
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack simulateAdd( ItemStack itemsToAdd )
|
||||
public ItemStack simulateAdd( ItemStack toBeSimulated )
|
||||
{
|
||||
return this.addItems( itemsToAdd, false );
|
||||
return this.addItems( toBeSimulated, false );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,136 +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.util.inv;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import buildcraft.api.inventory.ISpecialInventory;
|
||||
|
||||
import appeng.api.config.FuzzyMode;
|
||||
import appeng.util.InventoryAdaptor;
|
||||
|
||||
public class AdaptorISpecialInventory extends InventoryAdaptor
|
||||
{
|
||||
|
||||
private final AdaptorIInventory remover;
|
||||
|
||||
private final ISpecialInventory i;
|
||||
private final ForgeDirection d;
|
||||
|
||||
public AdaptorISpecialInventory(ISpecialInventory s, ForgeDirection dd) {
|
||||
this.i = s;
|
||||
this.d = dd;
|
||||
|
||||
if ( s instanceof ISidedInventory )
|
||||
this.remover = new AdaptorIInventory( new WrapperMCISidedInventory( (ISidedInventory) s, this.d ) );
|
||||
else
|
||||
this.remover = new AdaptorIInventory( s );
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack removeSimilarItems(int how_many, ItemStack filter, FuzzyMode fuzzyMode, IInventoryDestination destination)
|
||||
{
|
||||
return this.remover.removeSimilarItems( how_many, filter, fuzzyMode, destination );
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack simulateSimilarRemove(int how_many, ItemStack filter, FuzzyMode fuzzyMode, IInventoryDestination destination)
|
||||
{
|
||||
return this.remover.simulateSimilarRemove( how_many, filter, fuzzyMode, destination );
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack removeItems(int how_many, ItemStack filter, IInventoryDestination destination)
|
||||
{
|
||||
return this.remover.removeItems( how_many, filter, destination );
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack simulateRemove(int how_many, ItemStack filter, IInventoryDestination destination)
|
||||
{
|
||||
return this.remover.simulateRemove( how_many, filter, destination );
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack addItems(ItemStack A)
|
||||
{
|
||||
if ( A == null )
|
||||
return null;
|
||||
if ( A.stackSize == 0 )
|
||||
return null;
|
||||
|
||||
int used = this.i.addItem( A, true, this.d );
|
||||
ItemStack out = A.copy();
|
||||
out.stackSize -= used;
|
||||
if ( out.stackSize > 0 )
|
||||
return out;
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack simulateAdd(ItemStack A)
|
||||
{
|
||||
int used = this.i.addItem( A, false, this.d );
|
||||
ItemStack out = A.copy();
|
||||
out.stackSize -= used;
|
||||
if ( out.stackSize > 0 )
|
||||
return out;
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean containsItems()
|
||||
{
|
||||
if ( this.i instanceof ISidedInventory )
|
||||
{
|
||||
ISidedInventory sided = (ISidedInventory) this.i;
|
||||
int[] slots = sided.getAccessibleSlotsFromSide( this.d.ordinal() );
|
||||
|
||||
if ( slots == null )
|
||||
return false;
|
||||
|
||||
for (int slot : slots)
|
||||
{
|
||||
if ( this.i.getStackInSlot( slot ) != null )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
int s = this.i.getSizeInventory();
|
||||
for (int x = 0; x < s; x++)
|
||||
if ( this.i.getStackInSlot( x ) != null )
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<ItemSlot> iterator()
|
||||
{
|
||||
return this.remover.iterator();
|
||||
}
|
||||
|
||||
}
|
|
@ -69,25 +69,25 @@ public class AdaptorList extends InventoryAdaptor
|
|||
}
|
||||
|
||||
@Override
|
||||
public ItemStack simulateSimilarRemove(int how_many, ItemStack filter, FuzzyMode fuzzyMode, IInventoryDestination destination)
|
||||
public ItemStack simulateSimilarRemove(int amount, ItemStack filter, FuzzyMode fuzzyMode, IInventoryDestination destination)
|
||||
{
|
||||
for (ItemStack is : this.i)
|
||||
{
|
||||
if ( is != null && (filter == null || Platform.isSameItemFuzzy( is, filter, fuzzyMode )) )
|
||||
{
|
||||
if ( how_many > is.stackSize )
|
||||
if ( amount > is.stackSize )
|
||||
{
|
||||
how_many = is.stackSize;
|
||||
amount = is.stackSize;
|
||||
}
|
||||
if ( destination != null && !destination.canInsert( is ) )
|
||||
{
|
||||
how_many = 0;
|
||||
amount = 0;
|
||||
}
|
||||
|
||||
if ( how_many > 0 )
|
||||
if ( amount > 0 )
|
||||
{
|
||||
ItemStack rv = is.copy();
|
||||
rv.stackSize = how_many;
|
||||
rv.stackSize = amount;
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
|
@ -97,7 +97,7 @@ public class AdaptorList extends InventoryAdaptor
|
|||
}
|
||||
|
||||
@Override
|
||||
public ItemStack removeItems(int how_many, ItemStack filter, IInventoryDestination destination)
|
||||
public ItemStack removeItems(int amount, ItemStack filter, IInventoryDestination destination)
|
||||
{
|
||||
int s = this.i.size();
|
||||
for (int x = 0; x < s; x++)
|
||||
|
@ -105,16 +105,16 @@ public class AdaptorList extends InventoryAdaptor
|
|||
ItemStack is = this.i.get( x );
|
||||
if ( is != null && (filter == null || Platform.isSameItemPrecise( is, filter )) )
|
||||
{
|
||||
if ( how_many > is.stackSize )
|
||||
how_many = is.stackSize;
|
||||
if ( amount > is.stackSize )
|
||||
amount = is.stackSize;
|
||||
if ( destination != null && !destination.canInsert( is ) )
|
||||
how_many = 0;
|
||||
amount = 0;
|
||||
|
||||
if ( how_many > 0 )
|
||||
if ( amount > 0 )
|
||||
{
|
||||
ItemStack rv = is.copy();
|
||||
rv.stackSize = how_many;
|
||||
is.stackSize -= how_many;
|
||||
rv.stackSize = amount;
|
||||
is.stackSize -= amount;
|
||||
|
||||
// remove it..
|
||||
if ( is.stackSize <= 0 )
|
||||
|
@ -128,25 +128,25 @@ public class AdaptorList extends InventoryAdaptor
|
|||
}
|
||||
|
||||
@Override
|
||||
public ItemStack simulateRemove(int how_many, ItemStack filter, IInventoryDestination destination)
|
||||
public ItemStack simulateRemove(int amount, ItemStack filter, IInventoryDestination destination)
|
||||
{
|
||||
for (ItemStack is : this.i)
|
||||
{
|
||||
if ( is != null && (filter == null || Platform.isSameItemPrecise( is, filter )) )
|
||||
{
|
||||
if ( how_many > is.stackSize )
|
||||
if ( amount > is.stackSize )
|
||||
{
|
||||
how_many = is.stackSize;
|
||||
amount = is.stackSize;
|
||||
}
|
||||
if ( destination != null && !destination.canInsert( is ) )
|
||||
{
|
||||
how_many = 0;
|
||||
amount = 0;
|
||||
}
|
||||
|
||||
if ( how_many > 0 )
|
||||
if ( amount > 0 )
|
||||
{
|
||||
ItemStack rv = is.copy();
|
||||
rv.stackSize = how_many;
|
||||
rv.stackSize = amount;
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
|
@ -156,14 +156,14 @@ public class AdaptorList extends InventoryAdaptor
|
|||
}
|
||||
|
||||
@Override
|
||||
public ItemStack addItems(ItemStack A)
|
||||
public ItemStack addItems(ItemStack toBeAdded )
|
||||
{
|
||||
if ( A == null )
|
||||
if ( toBeAdded == null )
|
||||
return null;
|
||||
if ( A.stackSize == 0 )
|
||||
if ( toBeAdded.stackSize == 0 )
|
||||
return null;
|
||||
|
||||
ItemStack left = A.copy();
|
||||
ItemStack left = toBeAdded.copy();
|
||||
|
||||
for (ItemStack is : this.i)
|
||||
{
|
||||
|
@ -179,7 +179,7 @@ public class AdaptorList extends InventoryAdaptor
|
|||
}
|
||||
|
||||
@Override
|
||||
public ItemStack simulateAdd(ItemStack A)
|
||||
public ItemStack simulateAdd(ItemStack toBeSimulated )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -65,7 +65,7 @@ public class AdaptorPlayerHand extends InventoryAdaptor
|
|||
}
|
||||
|
||||
@Override
|
||||
public ItemStack simulateSimilarRemove( int how_many, ItemStack Filter, FuzzyMode fuzzyMode, IInventoryDestination destination )
|
||||
public ItemStack simulateSimilarRemove( int amount, ItemStack Filter, FuzzyMode fuzzyMode, IInventoryDestination destination )
|
||||
{
|
||||
|
||||
ItemStack hand = this.p.inventory.getItemStack();
|
||||
|
@ -75,7 +75,7 @@ public class AdaptorPlayerHand extends InventoryAdaptor
|
|||
if ( Filter == null || Platform.isSameItemFuzzy( Filter, hand, fuzzyMode ) )
|
||||
{
|
||||
ItemStack result = hand.copy();
|
||||
result.stackSize = hand.stackSize > how_many ? how_many : hand.stackSize;
|
||||
result.stackSize = hand.stackSize > amount ? amount : hand.stackSize;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -83,17 +83,17 @@ public class AdaptorPlayerHand extends InventoryAdaptor
|
|||
}
|
||||
|
||||
@Override
|
||||
public ItemStack removeItems( int how_many, ItemStack Filter, IInventoryDestination destination )
|
||||
public ItemStack removeItems( int amount, ItemStack filter, IInventoryDestination destination )
|
||||
{
|
||||
ItemStack hand = this.p.inventory.getItemStack();
|
||||
if ( hand == null )
|
||||
return null;
|
||||
|
||||
if ( Filter == null || Platform.isSameItemPrecise( Filter, hand ) )
|
||||
if ( filter == null || Platform.isSameItemPrecise( filter, hand ) )
|
||||
{
|
||||
ItemStack result = hand.copy();
|
||||
result.stackSize = hand.stackSize > how_many ? how_many : hand.stackSize;
|
||||
hand.stackSize -= how_many;
|
||||
result.stackSize = hand.stackSize > amount ? amount : hand.stackSize;
|
||||
hand.stackSize -= amount;
|
||||
if ( hand.stackSize <= 0 )
|
||||
this.p.inventory.setItemStack( null );
|
||||
return result;
|
||||
|
@ -103,17 +103,17 @@ public class AdaptorPlayerHand extends InventoryAdaptor
|
|||
}
|
||||
|
||||
@Override
|
||||
public ItemStack simulateRemove( int how_many, ItemStack Filter, IInventoryDestination destination )
|
||||
public ItemStack simulateRemove( int amount, ItemStack filter, IInventoryDestination destination )
|
||||
{
|
||||
|
||||
ItemStack hand = this.p.inventory.getItemStack();
|
||||
if ( hand == null )
|
||||
return null;
|
||||
|
||||
if ( Filter == null || Platform.isSameItemPrecise( Filter, hand ) )
|
||||
if ( filter == null || Platform.isSameItemPrecise( filter, hand ) )
|
||||
{
|
||||
ItemStack result = hand.copy();
|
||||
result.stackSize = hand.stackSize > how_many ? how_many : hand.stackSize;
|
||||
result.stackSize = hand.stackSize > amount ? amount : hand.stackSize;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -121,38 +121,38 @@ public class AdaptorPlayerHand extends InventoryAdaptor
|
|||
}
|
||||
|
||||
@Override
|
||||
public ItemStack addItems( ItemStack A )
|
||||
public ItemStack addItems( ItemStack toBeAdded )
|
||||
{
|
||||
|
||||
if ( A == null )
|
||||
if ( toBeAdded == null )
|
||||
return null;
|
||||
if ( A.stackSize == 0 )
|
||||
if ( toBeAdded.stackSize == 0 )
|
||||
return null;
|
||||
if ( this.p == null )
|
||||
return A;
|
||||
return toBeAdded;
|
||||
if ( this.p.inventory == null )
|
||||
return A;
|
||||
return toBeAdded;
|
||||
|
||||
ItemStack hand = this.p.inventory.getItemStack();
|
||||
|
||||
if ( hand != null && !Platform.isSameItemPrecise( A, hand ) )
|
||||
return A;
|
||||
if ( hand != null && !Platform.isSameItemPrecise( toBeAdded, hand ) )
|
||||
return toBeAdded;
|
||||
|
||||
int original = 0;
|
||||
ItemStack newHand = null;
|
||||
if ( hand == null )
|
||||
newHand = A.copy();
|
||||
newHand = toBeAdded.copy();
|
||||
else
|
||||
{
|
||||
newHand = hand;
|
||||
original = hand.stackSize;
|
||||
newHand.stackSize += A.stackSize;
|
||||
newHand.stackSize += toBeAdded.stackSize;
|
||||
}
|
||||
|
||||
if ( newHand.stackSize > newHand.getMaxStackSize() )
|
||||
{
|
||||
newHand.stackSize = newHand.getMaxStackSize();
|
||||
ItemStack B = A.copy();
|
||||
ItemStack B = toBeAdded.copy();
|
||||
B.stackSize -= newHand.stackSize - original;
|
||||
this.p.inventory.setItemStack( newHand );
|
||||
return B;
|
||||
|
@ -163,30 +163,30 @@ public class AdaptorPlayerHand extends InventoryAdaptor
|
|||
}
|
||||
|
||||
@Override
|
||||
public ItemStack simulateAdd( ItemStack A )
|
||||
public ItemStack simulateAdd( ItemStack toBeSimulated )
|
||||
{
|
||||
ItemStack hand = this.p.inventory.getItemStack();
|
||||
if ( A == null )
|
||||
if ( toBeSimulated == null )
|
||||
return null;
|
||||
|
||||
if ( hand != null && !Platform.isSameItem( A, hand ) )
|
||||
return A;
|
||||
if ( hand != null && !Platform.isSameItem( toBeSimulated, hand ) )
|
||||
return toBeSimulated;
|
||||
|
||||
int original = 0;
|
||||
ItemStack newHand = null;
|
||||
if ( hand == null )
|
||||
newHand = A.copy();
|
||||
newHand = toBeSimulated.copy();
|
||||
else
|
||||
{
|
||||
newHand = hand.copy();
|
||||
original = hand.stackSize;
|
||||
newHand.stackSize += A.stackSize;
|
||||
newHand.stackSize += toBeSimulated.stackSize;
|
||||
}
|
||||
|
||||
if ( newHand.stackSize > newHand.getMaxStackSize() )
|
||||
{
|
||||
newHand.stackSize = newHand.getMaxStackSize();
|
||||
ItemStack B = A.copy();
|
||||
ItemStack B = toBeSimulated.copy();
|
||||
B.stackSize -= newHand.stackSize - original;
|
||||
return B;
|
||||
}
|
||||
|
|
|
@ -107,15 +107,15 @@ public class IMEAdaptor extends InventoryAdaptor
|
|||
}
|
||||
|
||||
@Override
|
||||
public ItemStack removeItems(int how_many, ItemStack Filter, IInventoryDestination destination)
|
||||
public ItemStack removeItems(int amount, ItemStack filter, IInventoryDestination destination)
|
||||
{
|
||||
return this.doRemoveItems( how_many, Filter, destination, Actionable.MODULATE );
|
||||
return this.doRemoveItems( amount, filter, destination, Actionable.MODULATE );
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack simulateRemove(int how_many, ItemStack Filter, IInventoryDestination destination)
|
||||
public ItemStack simulateRemove(int amount, ItemStack filter, IInventoryDestination destination)
|
||||
{
|
||||
return this.doRemoveItems( how_many, Filter, destination, Actionable.SIMULATE );
|
||||
return this.doRemoveItems( amount, filter, destination, Actionable.SIMULATE );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -127,17 +127,17 @@ public class IMEAdaptor extends InventoryAdaptor
|
|||
}
|
||||
|
||||
@Override
|
||||
public ItemStack simulateSimilarRemove(int how_many, ItemStack filter, FuzzyMode fuzzyMode, IInventoryDestination destination)
|
||||
public ItemStack simulateSimilarRemove(int amount, ItemStack filter, FuzzyMode fuzzyMode, IInventoryDestination destination)
|
||||
{
|
||||
if ( filter == null )
|
||||
return this.doRemoveItems( how_many, null, destination, Actionable.SIMULATE );
|
||||
return this.doRemoveItemsFuzzy( how_many, filter, destination, Actionable.SIMULATE, fuzzyMode );
|
||||
return this.doRemoveItems( amount, null, destination, Actionable.SIMULATE );
|
||||
return this.doRemoveItemsFuzzy( amount, filter, destination, Actionable.SIMULATE, fuzzyMode );
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack addItems(ItemStack A)
|
||||
public ItemStack addItems(ItemStack toBeAdded )
|
||||
{
|
||||
IAEItemStack in = AEItemStack.create( A );
|
||||
IAEItemStack in = AEItemStack.create( toBeAdded );
|
||||
if ( in != null )
|
||||
{
|
||||
IAEItemStack out = this.target.injectItems( in, Actionable.MODULATE, this.src );
|
||||
|
@ -148,9 +148,9 @@ public class IMEAdaptor extends InventoryAdaptor
|
|||
}
|
||||
|
||||
@Override
|
||||
public ItemStack simulateAdd(ItemStack A)
|
||||
public ItemStack simulateAdd(ItemStack toBeSimulated )
|
||||
{
|
||||
IAEItemStack in = AEItemStack.create( A );
|
||||
IAEItemStack in = AEItemStack.create( toBeSimulated );
|
||||
if ( in != null )
|
||||
{
|
||||
IAEItemStack out = this.target.injectItems( in, Actionable.SIMULATE, this.src );
|
||||
|
|
Loading…
Reference in a new issue