Basic reformat, hit once, hope never again
This commit is contained in:
@@ -94,13 +94,13 @@ public final class BC extends BaseModule implements IBC
|
||||
@Override
|
||||
public boolean canAddItemsToPipe( TileEntity te, ItemStack is, ForgeDirection dir )
|
||||
{
|
||||
if ( is != null && te != null && te instanceof IInjectable )
|
||||
if( is != null && te != null && te instanceof IInjectable )
|
||||
{
|
||||
IInjectable pt = (IInjectable) te;
|
||||
if ( pt.canInjectItems( dir ) )
|
||||
if( pt.canInjectItems( dir ) )
|
||||
{
|
||||
int amt = pt.injectItem( is, false, dir, null );
|
||||
if ( amt == is.stackSize )
|
||||
if( amt == is.stackSize )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -113,13 +113,13 @@ public final class BC extends BaseModule implements IBC
|
||||
@Override
|
||||
public boolean addItemsToPipe( TileEntity te, ItemStack is, ForgeDirection dir )
|
||||
{
|
||||
if ( is != null && te != null && te instanceof IInjectable )
|
||||
if( is != null && te != null && te instanceof IInjectable )
|
||||
{
|
||||
IInjectable pt = (IInjectable) te;
|
||||
if ( pt.canInjectItems( dir ) )
|
||||
if( pt.canInjectItems( dir ) )
|
||||
{
|
||||
int amt = pt.injectItem( is, false, dir, null );
|
||||
if ( amt == is.stackSize )
|
||||
if( amt == is.stackSize )
|
||||
{
|
||||
pt.injectItem( is, true, dir, null );
|
||||
return true;
|
||||
@@ -133,7 +133,7 @@ public final class BC extends BaseModule implements IBC
|
||||
@Override
|
||||
public boolean isFacade( ItemStack is )
|
||||
{
|
||||
if ( is == null )
|
||||
if( is == null )
|
||||
return false;
|
||||
|
||||
return is.getItem() instanceof IFacadeItem;
|
||||
@@ -142,7 +142,7 @@ public final class BC extends BaseModule implements IBC
|
||||
@Override
|
||||
public boolean isPipe( TileEntity te, ForgeDirection dir )
|
||||
{
|
||||
if ( te instanceof IPipeTile )
|
||||
if( te instanceof IPipeTile )
|
||||
{
|
||||
final IPipeTile pipeTile = (IPipeTile) te;
|
||||
return !pipeTile.hasPipePluggable( dir.getOpposite() );
|
||||
@@ -154,7 +154,7 @@ public final class BC extends BaseModule implements IBC
|
||||
@Override
|
||||
public void addFacade( ItemStack item )
|
||||
{
|
||||
if ( item != null )
|
||||
if( item != null )
|
||||
FMLInterModComms.sendMessage( "BuildCraft|Transport", "add-facade", item );
|
||||
}
|
||||
|
||||
@@ -214,7 +214,7 @@ public final class BC extends BaseModule implements IBC
|
||||
|
||||
return new FacadePart( facade, side );
|
||||
}
|
||||
catch ( Throwable ignored )
|
||||
catch( Throwable ignored )
|
||||
{
|
||||
|
||||
}
|
||||
@@ -233,14 +233,14 @@ public final class BC extends BaseModule implements IBC
|
||||
{
|
||||
final Item maybeFacadeItem = facade.getItem();
|
||||
|
||||
if ( maybeFacadeItem instanceof buildcraft.api.facades.IFacadeItem )
|
||||
if( maybeFacadeItem instanceof buildcraft.api.facades.IFacadeItem )
|
||||
{
|
||||
final buildcraft.api.facades.IFacadeItem facadeItem = (buildcraft.api.facades.IFacadeItem) maybeFacadeItem;
|
||||
|
||||
final Block[] blocks = facadeItem.getBlocksForFacade( facade );
|
||||
final int[] metas = facadeItem.getMetaValuesForFacade( facade );
|
||||
|
||||
if ( blocks.length > 0 && metas.length > 0 )
|
||||
if( blocks.length > 0 && metas.length > 0 )
|
||||
{
|
||||
return new ItemStack( blocks[0], 1, metas[0] );
|
||||
}
|
||||
@@ -256,21 +256,13 @@ public final class BC extends BaseModule implements IBC
|
||||
{
|
||||
return BuildCraftTransport.instance.pipeIconProvider.getIcon( PipeIconProvider.TYPE.PipeStructureCobblestone.ordinal() ); // Structure
|
||||
}
|
||||
catch ( Throwable ignored )
|
||||
catch( Throwable ignored )
|
||||
{
|
||||
}
|
||||
return null;
|
||||
// Pipe
|
||||
}
|
||||
|
||||
private void addFacadeStack( IBlockDefinition definition )
|
||||
{
|
||||
for ( ItemStack facadeStack : definition.maybeStack( 1 ).asSet() )
|
||||
{
|
||||
this.addFacade( facadeStack );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init()
|
||||
{
|
||||
@@ -290,12 +282,12 @@ public final class BC extends BaseModule implements IBC
|
||||
{
|
||||
this.initBuilderSupport();
|
||||
}
|
||||
catch ( Throwable builderSupport )
|
||||
catch( Throwable builderSupport )
|
||||
{
|
||||
// not supported?
|
||||
}
|
||||
|
||||
for ( Block skyStoneBlock : blocks.skyStone().maybeBlock().asSet() )
|
||||
for( Block skyStoneBlock : blocks.skyStone().maybeBlock().asSet() )
|
||||
{
|
||||
this.addFacade( new ItemStack( skyStoneBlock, 1, 0 ) );
|
||||
this.addFacade( new ItemStack( skyStoneBlock, 1, 1 ) );
|
||||
@@ -304,6 +296,14 @@ public final class BC extends BaseModule implements IBC
|
||||
}
|
||||
}
|
||||
|
||||
private void addFacadeStack( IBlockDefinition definition )
|
||||
{
|
||||
for( ItemStack facadeStack : definition.maybeStack( 1 ).asSet() )
|
||||
{
|
||||
this.addFacade( facadeStack );
|
||||
}
|
||||
}
|
||||
|
||||
private void initBuilderSupport()
|
||||
{
|
||||
final ISchematicRegistry schematicRegistry = BuilderAPI.schematicRegistry;
|
||||
@@ -311,7 +311,7 @@ public final class BC extends BaseModule implements IBC
|
||||
final IBlocks blocks = AEApi.instance().definitions().blocks();
|
||||
final IBlockDefinition maybeMultiPart = blocks.multiPart();
|
||||
|
||||
for ( Method blockDefinition : blocks.getClass().getMethods() )
|
||||
for( Method blockDefinition : blocks.getClass().getMethods() )
|
||||
{
|
||||
AEItemDefinition def;
|
||||
try
|
||||
@@ -319,20 +319,20 @@ public final class BC extends BaseModule implements IBC
|
||||
def = (AEItemDefinition) blockDefinition.invoke( blocks );
|
||||
|
||||
Block myBlock = def.block();
|
||||
if ( myBlock instanceof IOrientableBlock && ( (IOrientableBlock) myBlock ).usesMetadata() && def.entity() == null )
|
||||
if( myBlock instanceof IOrientableBlock && ( (IOrientableBlock) myBlock ).usesMetadata() && def.entity() == null )
|
||||
{
|
||||
schematicRegistry.registerSchematicBlock( myBlock, AERotatableBlockSchematic.class );
|
||||
}
|
||||
else if ( maybeMultiPart.isSameAs( new ItemStack( myBlock ) ) )
|
||||
else if( maybeMultiPart.isSameAs( new ItemStack( myBlock ) ) )
|
||||
{
|
||||
schematicRegistry.registerSchematicBlock( myBlock, AECableSchematicTile.class );
|
||||
}
|
||||
else if ( def.entity() != null )
|
||||
else if( def.entity() != null )
|
||||
{
|
||||
schematicRegistry.registerSchematicBlock( myBlock, AEGenericSchematicTile.class );
|
||||
}
|
||||
}
|
||||
catch ( Throwable t )
|
||||
catch( Throwable t )
|
||||
{
|
||||
// :P
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package appeng.integration.modules.BCHelpers;
|
||||
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -38,11 +39,12 @@ import appeng.api.util.AEColor;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
import appeng.parts.CableBusContainer;
|
||||
|
||||
|
||||
public class AECableSchematicTile extends AEGenericSchematicTile implements IPartHost
|
||||
{
|
||||
|
||||
@Override
|
||||
public void rotateLeft(IBuilderContext context)
|
||||
public void rotateLeft( IBuilderContext context )
|
||||
{
|
||||
CableBusContainer cbc = new CableBusContainer( this );
|
||||
cbc.readFromNBT( this.tileNBT );
|
||||
@@ -60,25 +62,25 @@ public class AECableSchematicTile extends AEGenericSchematicTile implements IPar
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAddPart(ItemStack part, ForgeDirection side)
|
||||
public boolean canAddPart( ItemStack part, ForgeDirection side )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ForgeDirection addPart(ItemStack is, ForgeDirection side, EntityPlayer owner)
|
||||
public ForgeDirection addPart( ItemStack is, ForgeDirection side, EntityPlayer owner )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPart getPart(ForgeDirection side)
|
||||
public IPart getPart( ForgeDirection side )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removePart(ForgeDirection side, boolean suppressUpdate)
|
||||
public void removePart( ForgeDirection side, boolean suppressUpdate )
|
||||
{
|
||||
|
||||
}
|
||||
@@ -114,13 +116,13 @@ public class AECableSchematicTile extends AEGenericSchematicTile implements IPar
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBlocked(ForgeDirection side)
|
||||
public boolean isBlocked( ForgeDirection side )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SelectedPart selectPart(Vec3 pos)
|
||||
public SelectedPart selectPart( Vec3 pos )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
@@ -138,7 +140,7 @@ public class AECableSchematicTile extends AEGenericSchematicTile implements IPar
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasRedstone(ForgeDirection side)
|
||||
public boolean hasRedstone( ForgeDirection side )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -18,27 +18,30 @@
|
||||
|
||||
package appeng.integration.modules.BCHelpers;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
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 storeRequirements(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 )
|
||||
if( tile instanceof AEBaseTile )
|
||||
{
|
||||
ICommonTile tcb = (AEBaseTile) tile;
|
||||
tcb.getDrops( tile.getWorldObj(), tile.xCoord, tile.yCoord, tile.zCoord, list );
|
||||
@@ -48,14 +51,14 @@ public class AEGenericSchematicTile extends SchematicTile
|
||||
}
|
||||
|
||||
@Override
|
||||
public void rotateLeft(IBuilderContext context)
|
||||
public void rotateLeft( IBuilderContext context )
|
||||
{
|
||||
if ( this.tileNBT.hasKey( "orientation_forward" ) && this.tileNBT.hasKey( "orientation_up" ) )
|
||||
if( this.tileNBT.hasKey( "orientation_forward" ) && this.tileNBT.hasKey( "orientation_up" ) )
|
||||
{
|
||||
String forward = this.tileNBT.getString( "orientation_forward" );
|
||||
String up = this.tileNBT.getString( "orientation_up" );
|
||||
|
||||
if ( forward != null && up != null )
|
||||
if( forward != null && up != null )
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -68,12 +71,11 @@ public class AEGenericSchematicTile extends SchematicTile
|
||||
this.tileNBT.setString( "orientation_forward", fdForward.name() );
|
||||
this.tileNBT.setString( "orientation_up", fdUp.name() );
|
||||
}
|
||||
catch (Throwable ignored)
|
||||
catch( Throwable ignored )
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package appeng.integration.modules.BCHelpers;
|
||||
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import buildcraft.api.blueprints.IBuilderContext;
|
||||
@@ -25,17 +26,17 @@ import buildcraft.api.blueprints.SchematicBlock;
|
||||
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public class AERotatableBlockSchematic extends SchematicBlock
|
||||
{
|
||||
|
||||
@Override
|
||||
public void rotateLeft(IBuilderContext context)
|
||||
public void rotateLeft( IBuilderContext context )
|
||||
{
|
||||
if ( this.meta < 6 )
|
||||
if( this.meta < 6 )
|
||||
{
|
||||
ForgeDirection d = Platform.rotateAround( ForgeDirection.values()[this.meta], ForgeDirection.DOWN );
|
||||
this.meta = d.ordinal();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package appeng.integration.modules.BCHelpers;
|
||||
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
@@ -27,21 +28,21 @@ import appeng.api.storage.IMEInventory;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.integration.modules.BC;
|
||||
|
||||
|
||||
public class BCPipeHandler implements IExternalStorageHandler
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean canHandle(TileEntity te, ForgeDirection d, StorageChannel chan, BaseActionSource mySrc)
|
||||
public boolean canHandle( TileEntity te, ForgeDirection d, StorageChannel chan, BaseActionSource mySrc )
|
||||
{
|
||||
return chan == StorageChannel.ITEMS && BC.instance.isPipe( te, d );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMEInventory getInventory(TileEntity te, ForgeDirection d, StorageChannel chan, BaseActionSource src)
|
||||
public IMEInventory getInventory( TileEntity te, ForgeDirection d, StorageChannel chan, BaseActionSource src )
|
||||
{
|
||||
if ( chan == StorageChannel.ITEMS )
|
||||
if( chan == StorageChannel.ITEMS )
|
||||
return new BCPipeInventory( te, d );
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package appeng.integration.modules.BCHelpers;
|
||||
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
@@ -29,48 +30,49 @@ import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.integration.modules.BC;
|
||||
|
||||
|
||||
public class BCPipeInventory implements IMEInventory<IAEItemStack>
|
||||
{
|
||||
|
||||
final TileEntity te;
|
||||
final ForgeDirection dir;
|
||||
|
||||
public BCPipeInventory(TileEntity _te, ForgeDirection _dir) {
|
||||
public BCPipeInventory( TileEntity _te, ForgeDirection _dir )
|
||||
{
|
||||
this.te = _te;
|
||||
this.dir = _dir;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEItemStack injectItems( IAEItemStack input, Actionable mode, BaseActionSource src )
|
||||
{
|
||||
if( mode == Actionable.SIMULATE )
|
||||
{
|
||||
if( BC.instance.canAddItemsToPipe( this.te, input.getItemStack(), this.dir ) )
|
||||
return null;
|
||||
return input;
|
||||
}
|
||||
|
||||
if( BC.instance.addItemsToPipe( this.te, input.getItemStack(), this.dir ) )
|
||||
return null;
|
||||
return input;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEItemStack extractItems( IAEItemStack request, Actionable mode, BaseActionSource src )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemList<IAEItemStack> getAvailableItems( IItemList<IAEItemStack> out )
|
||||
{
|
||||
return out;
|
||||
}
|
||||
|
||||
@Override
|
||||
public StorageChannel getChannel()
|
||||
{
|
||||
return StorageChannel.ITEMS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEItemStack injectItems(IAEItemStack input, Actionable mode, BaseActionSource src)
|
||||
{
|
||||
if ( mode == Actionable.SIMULATE )
|
||||
{
|
||||
if ( BC.instance.canAddItemsToPipe( this.te, input.getItemStack(), this.dir ) )
|
||||
return null;
|
||||
return input;
|
||||
}
|
||||
|
||||
if ( BC.instance.addItemsToPipe( this.te, input.getItemStack(), this.dir ) )
|
||||
return null;
|
||||
return input;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEItemStack extractItems(IAEItemStack request, Actionable mode, BaseActionSource src)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemList<IAEItemStack> getAvailableItems(IItemList<IAEItemStack> out)
|
||||
{
|
||||
return out;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package appeng.integration.modules;
|
||||
|
||||
|
||||
import net.mcft.copy.betterstorage.api.crate.ICrateStorage;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
@@ -28,21 +29,22 @@ import appeng.integration.modules.helpers.BSCrateHandler;
|
||||
import appeng.integration.modules.helpers.BSCrateStorageAdaptor;
|
||||
import appeng.util.InventoryAdaptor;
|
||||
|
||||
|
||||
public class BetterStorage implements IIntegrationModule, IBetterStorage
|
||||
{
|
||||
|
||||
public static BetterStorage instance;
|
||||
|
||||
@Override
|
||||
public boolean isStorageCrate(Object te)
|
||||
public boolean isStorageCrate( Object te )
|
||||
{
|
||||
return te instanceof ICrateStorage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public InventoryAdaptor getAdaptor(Object te, ForgeDirection d)
|
||||
public InventoryAdaptor getAdaptor( Object te, ForgeDirection d )
|
||||
{
|
||||
if ( te instanceof ICrateStorage )
|
||||
if( te instanceof ICrateStorage )
|
||||
{
|
||||
return new BSCrateStorageAdaptor( te, d );
|
||||
}
|
||||
@@ -60,5 +62,4 @@ public class BetterStorage implements IIntegrationModule, IBetterStorage
|
||||
{
|
||||
AEApi.instance().registries().externalStorage().addExternalStorageInterface( new BSCrateHandler() );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,10 +18,12 @@
|
||||
|
||||
package appeng.integration.modules;
|
||||
|
||||
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.integration.BaseModule;
|
||||
import appeng.integration.abstraction.ICLApi;
|
||||
|
||||
|
||||
public class CLApi extends BaseModule implements ICLApi
|
||||
{
|
||||
|
||||
@@ -40,12 +42,12 @@ public class CLApi extends BaseModule implements ICLApi
|
||||
}
|
||||
|
||||
@Override
|
||||
public int colorLight(AEColor color, int light)
|
||||
public int colorLight( AEColor color, int light )
|
||||
{
|
||||
int mv = color.mediumVariant;
|
||||
|
||||
float r = (mv >> 16) & 0xff;
|
||||
float g = (mv >> 8) & 0xff;
|
||||
float r = ( mv >> 16 ) & 0xff;
|
||||
float g = ( mv >> 8 ) & 0xff;
|
||||
float b = ( mv ) & 0xff;
|
||||
|
||||
return coloredlightscore.src.api.CLApi.makeRGBLightValue( r / 255.0f, g / 255.0f, b / 255.0f, light / 15.0f );
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package appeng.integration.modules;
|
||||
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
@@ -51,89 +52,68 @@ import appeng.integration.IIntegrationModule;
|
||||
import appeng.recipes.game.ShapedRecipe;
|
||||
import appeng.recipes.game.ShapelessRecipe;
|
||||
|
||||
|
||||
public class CraftGuide extends CraftGuideAPIObject implements IIntegrationModule, RecipeProvider, StackInfoSource, RecipeGenerator
|
||||
{
|
||||
|
||||
public static CraftGuide instance;
|
||||
|
||||
private final Slot[] shapelessCraftingSlots = new ItemSlot[] { new ItemSlot( 3, 3, 16, 16 ), new ItemSlot( 21, 3, 16, 16 ), new ItemSlot( 39, 3, 16, 16 ),
|
||||
new ItemSlot( 3, 21, 16, 16 ), new ItemSlot( 21, 21, 16, 16 ), new ItemSlot( 39, 21, 16, 16 ), new ItemSlot( 3, 39, 16, 16 ),
|
||||
new ItemSlot( 21, 39, 16, 16 ), new ItemSlot( 39, 39, 16, 16 ), new ItemSlot( 59, 21, 16, 16, true ).setSlotType( SlotType.OUTPUT_SLOT ), };
|
||||
private final Slot[] shapelessCraftingSlots = new ItemSlot[] { new ItemSlot( 3, 3, 16, 16 ), new ItemSlot( 21, 3, 16, 16 ), new ItemSlot( 39, 3, 16, 16 ), new ItemSlot( 3, 21, 16, 16 ), new ItemSlot( 21, 21, 16, 16 ), new ItemSlot( 39, 21, 16, 16 ), new ItemSlot( 3, 39, 16, 16 ), new ItemSlot( 21, 39, 16, 16 ), new ItemSlot( 39, 39, 16, 16 ), new ItemSlot( 59, 21, 16, 16, true ).setSlotType( SlotType.OUTPUT_SLOT ), };
|
||||
|
||||
private final Slot[] craftingSlotsOwnBackground = new ItemSlot[] { new ItemSlot( 3, 3, 16, 16 ).drawOwnBackground(),
|
||||
new ItemSlot( 21, 3, 16, 16 ).drawOwnBackground(), new ItemSlot( 39, 3, 16, 16 ).drawOwnBackground(),
|
||||
new ItemSlot( 3, 21, 16, 16 ).drawOwnBackground(), new ItemSlot( 21, 21, 16, 16 ).drawOwnBackground(),
|
||||
new ItemSlot( 39, 21, 16, 16 ).drawOwnBackground(), new ItemSlot( 3, 39, 16, 16 ).drawOwnBackground(),
|
||||
new ItemSlot( 21, 39, 16, 16 ).drawOwnBackground(), new ItemSlot( 39, 39, 16, 16 ).drawOwnBackground(),
|
||||
new ItemSlot( 59, 21, 16, 16, true ).setSlotType( SlotType.OUTPUT_SLOT ).drawOwnBackground(), };
|
||||
private final Slot[] craftingSlotsOwnBackground = new ItemSlot[] { new ItemSlot( 3, 3, 16, 16 ).drawOwnBackground(), new ItemSlot( 21, 3, 16, 16 ).drawOwnBackground(), new ItemSlot( 39, 3, 16, 16 ).drawOwnBackground(), new ItemSlot( 3, 21, 16, 16 ).drawOwnBackground(), new ItemSlot( 21, 21, 16, 16 ).drawOwnBackground(), new ItemSlot( 39, 21, 16, 16 ).drawOwnBackground(), new ItemSlot( 3, 39, 16, 16 ).drawOwnBackground(), new ItemSlot( 21, 39, 16, 16 ).drawOwnBackground(), new ItemSlot( 39, 39, 16, 16 ).drawOwnBackground(), new ItemSlot( 59, 21, 16, 16, true ).setSlotType( SlotType.OUTPUT_SLOT ).drawOwnBackground(), };
|
||||
|
||||
private final Slot[] smallCraftingSlotsOwnBackground = new ItemSlot[] { new ItemSlot( 12, 12, 16, 16 ).drawOwnBackground(),
|
||||
new ItemSlot( 30, 12, 16, 16 ).drawOwnBackground(), new ItemSlot( 12, 30, 16, 16 ).drawOwnBackground(),
|
||||
new ItemSlot( 30, 30, 16, 16 ).drawOwnBackground(), new ItemSlot( 59, 21, 16, 16, true ).setSlotType( SlotType.OUTPUT_SLOT ).drawOwnBackground(), };
|
||||
private final Slot[] smallCraftingSlotsOwnBackground = new ItemSlot[] { new ItemSlot( 12, 12, 16, 16 ).drawOwnBackground(), new ItemSlot( 30, 12, 16, 16 ).drawOwnBackground(), new ItemSlot( 12, 30, 16, 16 ).drawOwnBackground(), new ItemSlot( 30, 30, 16, 16 ).drawOwnBackground(), new ItemSlot( 59, 21, 16, 16, true ).setSlotType( SlotType.OUTPUT_SLOT ).drawOwnBackground(), };
|
||||
|
||||
private final Slot[] craftingSlots = new ItemSlot[] { new ItemSlot( 3, 3, 16, 16 ), new ItemSlot( 21, 3, 16, 16 ), new ItemSlot( 39, 3, 16, 16 ),
|
||||
new ItemSlot( 3, 21, 16, 16 ), new ItemSlot( 21, 21, 16, 16 ), new ItemSlot( 39, 21, 16, 16 ), new ItemSlot( 3, 39, 16, 16 ),
|
||||
new ItemSlot( 21, 39, 16, 16 ), new ItemSlot( 39, 39, 16, 16 ), new ItemSlot( 59, 21, 16, 16, true ).setSlotType( SlotType.OUTPUT_SLOT ), };
|
||||
private final Slot[] craftingSlots = new ItemSlot[] { new ItemSlot( 3, 3, 16, 16 ), new ItemSlot( 21, 3, 16, 16 ), new ItemSlot( 39, 3, 16, 16 ), new ItemSlot( 3, 21, 16, 16 ), new ItemSlot( 21, 21, 16, 16 ), new ItemSlot( 39, 21, 16, 16 ), new ItemSlot( 3, 39, 16, 16 ), new ItemSlot( 21, 39, 16, 16 ), new ItemSlot( 39, 39, 16, 16 ), new ItemSlot( 59, 21, 16, 16, true ).setSlotType( SlotType.OUTPUT_SLOT ), };
|
||||
|
||||
private final Slot[] smallCraftingSlots = new ItemSlot[] { new ItemSlot( 12, 12, 16, 16 ), new ItemSlot( 30, 12, 16, 16 ), new ItemSlot( 12, 30, 16, 16 ),
|
||||
new ItemSlot( 30, 30, 16, 16 ), new ItemSlot( 59, 21, 16, 16, true ).setSlotType( SlotType.OUTPUT_SLOT ), };
|
||||
private final Slot[] smallCraftingSlots = new ItemSlot[] { new ItemSlot( 12, 12, 16, 16 ), new ItemSlot( 30, 12, 16, 16 ), new ItemSlot( 12, 30, 16, 16 ), new ItemSlot( 30, 30, 16, 16 ), new ItemSlot( 59, 21, 16, 16, true ).setSlotType( SlotType.OUTPUT_SLOT ), };
|
||||
|
||||
private final Slot[] furnaceSlots = new ItemSlot[] { new ItemSlot( 13, 21, 16, 16 ),
|
||||
new ItemSlot( 50, 21, 16, 16, true ).setSlotType( SlotType.OUTPUT_SLOT ), };
|
||||
private final Slot[] furnaceSlots = new ItemSlot[] { new ItemSlot( 13, 21, 16, 16 ), new ItemSlot( 50, 21, 16, 16, true ).setSlotType( SlotType.OUTPUT_SLOT ), };
|
||||
RecipeGenerator parent;
|
||||
|
||||
@Override
|
||||
public String getInfo(ItemStack itemStack)
|
||||
public String getInfo( ItemStack itemStack )
|
||||
{
|
||||
// :P
|
||||
return null;
|
||||
}
|
||||
|
||||
RecipeGenerator parent;
|
||||
|
||||
@Override
|
||||
public void generateRecipes(RecipeGenerator generator)
|
||||
public void generateRecipes( RecipeGenerator generator )
|
||||
{
|
||||
this.parent = generator;
|
||||
|
||||
RecipeTemplate craftingTemplate;
|
||||
RecipeTemplate smallCraftingTemplate;
|
||||
|
||||
if ( uristqwerty.CraftGuide.CraftGuide.newerBackgroundStyle )
|
||||
if( uristqwerty.CraftGuide.CraftGuide.newerBackgroundStyle )
|
||||
{
|
||||
craftingTemplate = generator.createRecipeTemplate( this.craftingSlotsOwnBackground, null );
|
||||
smallCraftingTemplate = generator.createRecipeTemplate( this.smallCraftingSlotsOwnBackground, null );
|
||||
}
|
||||
else
|
||||
{
|
||||
craftingTemplate = new DefaultRecipeTemplate( this.craftingSlots, RecipeGeneratorImplementation.workbench, new TextureClip(
|
||||
DynamicTexture.instance( "recipe_backgrounds" ), 1, 1, 79, 58 ), new TextureClip( DynamicTexture.instance( "recipe_backgrounds" ), 82, 1,
|
||||
79, 58 ) );
|
||||
craftingTemplate = new DefaultRecipeTemplate( this.craftingSlots, RecipeGeneratorImplementation.workbench, new TextureClip( DynamicTexture.instance( "recipe_backgrounds" ), 1, 1, 79, 58 ), new TextureClip( DynamicTexture.instance( "recipe_backgrounds" ), 82, 1, 79, 58 ) );
|
||||
|
||||
smallCraftingTemplate = new DefaultRecipeTemplate( this.smallCraftingSlots, RecipeGeneratorImplementation.workbench, new TextureClip(
|
||||
DynamicTexture.instance( "recipe_backgrounds" ), 1, 61, 79, 58 ), new TextureClip( DynamicTexture.instance( "recipe_backgrounds" ), 82, 61,
|
||||
79, 58 ) );
|
||||
smallCraftingTemplate = new DefaultRecipeTemplate( this.smallCraftingSlots, RecipeGeneratorImplementation.workbench, new TextureClip( DynamicTexture.instance( "recipe_backgrounds" ), 1, 61, 79, 58 ), new TextureClip( DynamicTexture.instance( "recipe_backgrounds" ), 82, 61, 79, 58 ) );
|
||||
}
|
||||
|
||||
RecipeTemplate shapelessTemplate = new DefaultRecipeTemplate( this.shapelessCraftingSlots, RecipeGeneratorImplementation.workbench, new TextureClip(
|
||||
DynamicTexture.instance( "recipe_backgrounds" ), 1, 121, 79, 58 ), new TextureClip( DynamicTexture.instance( "recipe_backgrounds" ), 82, 121,
|
||||
79, 58 ) );
|
||||
RecipeTemplate shapelessTemplate = new DefaultRecipeTemplate( this.shapelessCraftingSlots, RecipeGeneratorImplementation.workbench, new TextureClip( DynamicTexture.instance( "recipe_backgrounds" ), 1, 121, 79, 58 ), new TextureClip( DynamicTexture.instance( "recipe_backgrounds" ), 82, 121, 79, 58 ) );
|
||||
|
||||
RecipeTemplate furnaceTemplate = new DefaultRecipeTemplate( this.furnaceSlots, new ItemStack( Blocks.furnace ), new TextureClip(
|
||||
DynamicTexture.instance( "recipe_backgrounds" ), 1, 181, 79, 58 ), new TextureClip( DynamicTexture.instance( "recipe_backgrounds" ), 82, 181,
|
||||
79, 58 ) );
|
||||
RecipeTemplate furnaceTemplate = new DefaultRecipeTemplate( this.furnaceSlots, new ItemStack( Blocks.furnace ), new TextureClip( DynamicTexture.instance( "recipe_backgrounds" ), 1, 181, 79, 58 ), new TextureClip( DynamicTexture.instance( "recipe_backgrounds" ), 82, 181, 79, 58 ) );
|
||||
|
||||
this.addCraftingRecipes( craftingTemplate, smallCraftingTemplate, shapelessTemplate, this );
|
||||
this.addGrinderRecipes( furnaceTemplate, this );
|
||||
this.addInscriberRecipes( furnaceTemplate, this );
|
||||
}
|
||||
|
||||
private void addCraftingRecipes(RecipeTemplate template, RecipeTemplate templateSmall, RecipeTemplate templateShapeless, RecipeGenerator generator)
|
||||
private void addCraftingRecipes( RecipeTemplate template, RecipeTemplate templateSmall, RecipeTemplate templateShapeless, RecipeGenerator generator )
|
||||
{
|
||||
List recipes = CraftingManager.getInstance().getRecipeList();
|
||||
|
||||
int errCount = 0;
|
||||
|
||||
for (Object o : recipes)
|
||||
for( Object o : recipes )
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -141,11 +121,11 @@ public class CraftGuide extends CraftGuideAPIObject implements IIntegrationModul
|
||||
|
||||
Object[] items = generator.getCraftingRecipe( recipe, true );
|
||||
|
||||
if ( items.length == 5 )
|
||||
if( items.length == 5 )
|
||||
{
|
||||
generator.addRecipe( templateSmall, items );
|
||||
}
|
||||
else if ( recipe instanceof ShapelessRecipe )
|
||||
else if( recipe instanceof ShapelessRecipe )
|
||||
{
|
||||
generator.addRecipe( templateShapeless, items );
|
||||
}
|
||||
@@ -154,13 +134,11 @@ public class CraftGuide extends CraftGuideAPIObject implements IIntegrationModul
|
||||
generator.addRecipe( template, items );
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
catch( Exception e )
|
||||
{
|
||||
if ( errCount >= 5 )
|
||||
if( errCount >= 5 )
|
||||
{
|
||||
CraftGuideLog
|
||||
.log( "CraftGuide DefaultRecipeProvider: Stack trace limit reached, further stack traces from this invocation will not be logged to the console. They will still be logged to (.minecraft)/config/CraftGuide/CraftGuide.log",
|
||||
true );
|
||||
CraftGuideLog.log( "CraftGuide DefaultRecipeProvider: Stack trace limit reached, further stack traces from this invocation will not be logged to the console. They will still be logged to (.minecraft)/config/CraftGuide/CraftGuide.log", true );
|
||||
errCount = -1;
|
||||
}
|
||||
else
|
||||
@@ -174,83 +152,80 @@ public class CraftGuide extends CraftGuideAPIObject implements IIntegrationModul
|
||||
}
|
||||
}
|
||||
|
||||
private void addGrinderRecipes(RecipeTemplate template, RecipeGenerator generator)
|
||||
private void addGrinderRecipes( RecipeTemplate template, RecipeGenerator generator )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void addInscriberRecipes(RecipeTemplate template, RecipeGenerator generator)
|
||||
private void addInscriberRecipes( RecipeTemplate template, RecipeGenerator generator )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public RecipeTemplate createRecipeTemplate(Slot[] slots, ItemStack craftingType)
|
||||
public RecipeTemplate createRecipeTemplate( Slot[] slots, ItemStack craftingType )
|
||||
{
|
||||
return this.parent.createRecipeTemplate( slots, craftingType );
|
||||
}
|
||||
|
||||
@Override
|
||||
public RecipeTemplate createRecipeTemplate(Slot[] slots, ItemStack craftingType, String backgroundTexture, int backgroundX, int backgroundY,
|
||||
int backgroundSelectedX, int backgroundSelectedY)
|
||||
public RecipeTemplate createRecipeTemplate( Slot[] slots, ItemStack craftingType, String backgroundTexture, int backgroundX, int backgroundY, int backgroundSelectedX, int backgroundSelectedY )
|
||||
{
|
||||
return this.parent.createRecipeTemplate( slots, craftingType, backgroundTexture, backgroundX, backgroundY, backgroundSelectedX, backgroundSelectedY );
|
||||
}
|
||||
|
||||
@Override
|
||||
public RecipeTemplate createRecipeTemplate(Slot[] slots, ItemStack craftingType, String backgroundTexture, int backgroundX, int backgroundY,
|
||||
String backgroundSelectedTexture, int backgroundSelectedX, int backgroundSelectedY)
|
||||
public RecipeTemplate createRecipeTemplate( Slot[] slots, ItemStack craftingType, String backgroundTexture, int backgroundX, int backgroundY, String backgroundSelectedTexture, int backgroundSelectedX, int backgroundSelectedY )
|
||||
{
|
||||
return this.parent.createRecipeTemplate( slots, craftingType, backgroundTexture, backgroundX, backgroundY, backgroundSelectedTexture, backgroundSelectedX,
|
||||
backgroundSelectedY );
|
||||
return this.parent.createRecipeTemplate( slots, craftingType, backgroundTexture, backgroundX, backgroundY, backgroundSelectedTexture, backgroundSelectedX, backgroundSelectedY );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addRecipe(RecipeTemplate template, Object[] crafting)
|
||||
public void addRecipe( RecipeTemplate template, Object[] crafting )
|
||||
{
|
||||
this.parent.addRecipe( template, crafting );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addRecipe(CraftGuideRecipe recipe, ItemStack craftingType)
|
||||
public void addRecipe( CraftGuideRecipe recipe, ItemStack craftingType )
|
||||
{
|
||||
this.parent.addRecipe( recipe, craftingType );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDefaultTypeVisibility(ItemStack type, boolean visible)
|
||||
public void setDefaultTypeVisibility( ItemStack type, boolean visible )
|
||||
{
|
||||
this.parent.setDefaultTypeVisibility( type, visible );
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object[] getCraftingRecipe(IRecipe recipe)
|
||||
public Object[] getCraftingRecipe( IRecipe recipe )
|
||||
{
|
||||
return this.getCraftingRecipe( recipe, true );
|
||||
}
|
||||
|
||||
Object[] getCraftingShapelessRecipe(List items, ItemStack recipeOutput)
|
||||
Object[] getCraftingShapelessRecipe( List items, ItemStack recipeOutput )
|
||||
{
|
||||
Object[] output = new Object[10];
|
||||
|
||||
for (int i = 0; i < items.size(); i++)
|
||||
for( int i = 0; i < items.size(); i++ )
|
||||
{
|
||||
output[i] = items.get( i );
|
||||
|
||||
if ( output[i] instanceof ItemStack[] )
|
||||
if( output[i] instanceof ItemStack[] )
|
||||
output[i] = Arrays.asList( (ItemStack[]) output[i] );
|
||||
|
||||
if ( output[i] instanceof IIngredient )
|
||||
if( output[i] instanceof IIngredient )
|
||||
{
|
||||
try
|
||||
{
|
||||
output[i] = this.toCG( ((IIngredient) output[i]).getItemStackSet() );
|
||||
output[i] = this.toCG( ( (IIngredient) output[i] ).getItemStackSet() );
|
||||
}
|
||||
catch (RegistrationError ignored)
|
||||
catch( RegistrationError ignored )
|
||||
{
|
||||
|
||||
}
|
||||
catch (MissingIngredientError ignored)
|
||||
catch( MissingIngredientError ignored )
|
||||
{
|
||||
|
||||
}
|
||||
@@ -261,67 +236,31 @@ public class CraftGuide extends CraftGuideAPIObject implements IIntegrationModul
|
||||
return output;
|
||||
}
|
||||
|
||||
Object[] getCraftingShapedRecipe(int width, int height, Object[] items, ItemStack recipeOutput)
|
||||
{
|
||||
Object[] output = new Object[10];
|
||||
|
||||
for (int y = 0; y < height; y++)
|
||||
{
|
||||
for (int x = 0; x < width; x++)
|
||||
{
|
||||
int i = y * 3 + x;
|
||||
output[i] = items[y * width + x];
|
||||
|
||||
if ( output[i] instanceof ItemStack[] )
|
||||
output[i] = Arrays.asList( (ItemStack[]) output[i] );
|
||||
|
||||
if ( output[i] instanceof IIngredient )
|
||||
{
|
||||
try
|
||||
{
|
||||
output[i] = this.toCG( ((IIngredient) output[i]).getItemStackSet() );
|
||||
}
|
||||
catch (RegistrationError ignored)
|
||||
{
|
||||
|
||||
}
|
||||
catch (MissingIngredientError ignored)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
output[9] = recipeOutput;
|
||||
return output;
|
||||
}
|
||||
|
||||
Object[] getSmallShapedRecipe(int width, int height, Object[] items, ItemStack recipeOutput)
|
||||
Object[] getSmallShapedRecipe( int width, int height, Object[] items, ItemStack recipeOutput )
|
||||
{
|
||||
Object[] output = new Object[5];
|
||||
|
||||
for (int y = 0; y < height; y++)
|
||||
for( int y = 0; y < height; y++ )
|
||||
{
|
||||
for (int x = 0; x < width; x++)
|
||||
for( int x = 0; x < width; x++ )
|
||||
{
|
||||
int i = y * 2 + x;
|
||||
output[i] = items[y * width + x];
|
||||
|
||||
if ( output[i] instanceof ItemStack[] )
|
||||
if( output[i] instanceof ItemStack[] )
|
||||
output[i] = Arrays.asList( (ItemStack[]) output[i] );
|
||||
|
||||
if ( output[i] instanceof IIngredient )
|
||||
if( output[i] instanceof IIngredient )
|
||||
{
|
||||
try
|
||||
{
|
||||
output[i] = this.toCG( ((IIngredient) output[i]).getItemStackSet() );
|
||||
output[i] = this.toCG( ( (IIngredient) output[i] ).getItemStackSet() );
|
||||
}
|
||||
catch (RegistrationError ignored)
|
||||
catch( RegistrationError ignored )
|
||||
{
|
||||
|
||||
}
|
||||
catch (MissingIngredientError ignored)
|
||||
catch( MissingIngredientError ignored )
|
||||
{
|
||||
|
||||
}
|
||||
@@ -333,14 +272,50 @@ public class CraftGuide extends CraftGuideAPIObject implements IIntegrationModul
|
||||
return output;
|
||||
}
|
||||
|
||||
private Object toCG(ItemStack[] itemStackSet)
|
||||
Object[] getCraftingShapedRecipe( int width, int height, Object[] items, ItemStack recipeOutput )
|
||||
{
|
||||
Object[] output = new Object[10];
|
||||
|
||||
for( int y = 0; y < height; y++ )
|
||||
{
|
||||
for( int x = 0; x < width; x++ )
|
||||
{
|
||||
int i = y * 3 + x;
|
||||
output[i] = items[y * width + x];
|
||||
|
||||
if( output[i] instanceof ItemStack[] )
|
||||
output[i] = Arrays.asList( (ItemStack[]) output[i] );
|
||||
|
||||
if( output[i] instanceof IIngredient )
|
||||
{
|
||||
try
|
||||
{
|
||||
output[i] = this.toCG( ( (IIngredient) output[i] ).getItemStackSet() );
|
||||
}
|
||||
catch( RegistrationError ignored )
|
||||
{
|
||||
|
||||
}
|
||||
catch( MissingIngredientError ignored )
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
output[9] = recipeOutput;
|
||||
return output;
|
||||
}
|
||||
|
||||
private Object toCG( ItemStack[] itemStackSet )
|
||||
{
|
||||
List<ItemStack> list = Arrays.asList( itemStackSet );
|
||||
|
||||
for (int x = 0; x < list.size(); x++)
|
||||
for( int x = 0; x < list.size(); x++ )
|
||||
{
|
||||
list.set( x, list.get( x ).copy() );
|
||||
if ( list.get( x ).stackSize == 0 )
|
||||
if( list.get( x ).stackSize == 0 )
|
||||
list.get( x ).stackSize = 1;
|
||||
}
|
||||
|
||||
@@ -348,20 +323,20 @@ public class CraftGuide extends CraftGuideAPIObject implements IIntegrationModul
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object[] getCraftingRecipe(IRecipe recipe, boolean allowSmallGrid)
|
||||
public Object[] getCraftingRecipe( IRecipe recipe, boolean allowSmallGrid )
|
||||
{
|
||||
if ( recipe instanceof ShapelessRecipe )
|
||||
if( recipe instanceof ShapelessRecipe )
|
||||
{
|
||||
List items = ReflectionHelper.getPrivateValue( ShapelessRecipe.class, (ShapelessRecipe) recipe, "input" );
|
||||
return this.getCraftingShapelessRecipe( items, recipe.getRecipeOutput() );
|
||||
}
|
||||
else if ( recipe instanceof ShapedRecipe )
|
||||
else if( recipe instanceof ShapedRecipe )
|
||||
{
|
||||
int width = ReflectionHelper.getPrivateValue( ShapedRecipe.class, (ShapedRecipe) recipe, "width" );
|
||||
int height = ReflectionHelper.getPrivateValue( ShapedRecipe.class, (ShapedRecipe) recipe, "height" );
|
||||
Object[] items = ReflectionHelper.getPrivateValue( ShapedRecipe.class, (ShapedRecipe) recipe, "input" );
|
||||
|
||||
if ( allowSmallGrid && width < 3 && height < 3 )
|
||||
if( allowSmallGrid && width < 3 && height < 3 )
|
||||
{
|
||||
return this.getSmallShapedRecipe( width, height, items, recipe.getRecipeOutput() );
|
||||
}
|
||||
@@ -369,7 +344,6 @@ public class CraftGuide extends CraftGuideAPIObject implements IIntegrationModul
|
||||
{
|
||||
return this.getCraftingShapedRecipe( width, height, items, recipe.getRecipeOutput() );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return null;
|
||||
@@ -386,5 +360,4 @@ public class CraftGuide extends CraftGuideAPIObject implements IIntegrationModul
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -58,5 +58,4 @@ public class DSU extends BaseModule implements IDSU
|
||||
{
|
||||
AEApi.instance().registries().externalStorage().addExternalStorageInterface( new MFRDSUHandler() );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package appeng.integration.modules;
|
||||
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
@@ -53,17 +54,18 @@ import appeng.integration.abstraction.IFMP;
|
||||
import appeng.integration.modules.helpers.FMPPacketEvent;
|
||||
import appeng.parts.CableBusContainer;
|
||||
|
||||
|
||||
public class FMP implements IIntegrationModule, IPartFactory, IPartConverter, IFMP
|
||||
{
|
||||
|
||||
public static FMP instance;
|
||||
|
||||
@Override
|
||||
public TMultiPart createPart(String name, boolean client)
|
||||
public TMultiPart createPart( String name, boolean client )
|
||||
{
|
||||
for (PartRegistry pr : PartRegistry.values())
|
||||
for( PartRegistry pr : PartRegistry.values() )
|
||||
{
|
||||
if ( pr.getName().equals( name ) )
|
||||
if( pr.getName().equals( name ) )
|
||||
return pr.construct( 0 );
|
||||
}
|
||||
|
||||
@@ -71,13 +73,13 @@ public class FMP implements IIntegrationModule, IPartFactory, IPartConverter, IF
|
||||
}
|
||||
|
||||
@Override
|
||||
public TMultiPart convert(World world, BlockCoord pos)
|
||||
public TMultiPart convert( World world, BlockCoord pos )
|
||||
{
|
||||
Block blk = world.getBlock( pos.x, pos.y, pos.z );
|
||||
int meta = world.getBlockMetadata( pos.x, pos.y, pos.z );
|
||||
|
||||
TMultiPart part = PartRegistry.getPartByBlock( blk, meta );
|
||||
if ( part instanceof CableBusPart )
|
||||
if( part instanceof CableBusPart )
|
||||
{
|
||||
CableBusPart cbp = (CableBusPart) part;
|
||||
cbp.convertFromTile( world.getTileEntity( pos.x, pos.y, pos.z ) );
|
||||
@@ -86,6 +88,26 @@ public class FMP implements IIntegrationModule, IPartFactory, IPartConverter, IF
|
||||
return part;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<Block> blockTypes()
|
||||
{
|
||||
final IBlocks blocks = AEApi.instance().definitions().blocks();
|
||||
final List<Block> blockTypes = Lists.newArrayListWithCapacity( 2 );
|
||||
|
||||
this.addBlockTypes( blockTypes, blocks.multiPart() );
|
||||
this.addBlockTypes( blockTypes, blocks.quartzTorch() );
|
||||
|
||||
return blockTypes;
|
||||
}
|
||||
|
||||
private void addBlockTypes( Collection<Block> blockTypes, IBlockDefinition definition )
|
||||
{
|
||||
for( Block block : definition.maybeBlock().asSet() )
|
||||
{
|
||||
blockTypes.add( block );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() throws Throwable
|
||||
{
|
||||
@@ -102,7 +124,7 @@ public class FMP implements IIntegrationModule, IPartFactory, IPartConverter, IF
|
||||
PartRegistry[] reg = PartRegistry.values();
|
||||
|
||||
String[] data = new String[reg.length];
|
||||
for (int x = 0; x < data.length; x++)
|
||||
for( int x = 0; x < data.length; x++ )
|
||||
data[x] = reg[x].getName();
|
||||
|
||||
MultiPartRegistry.registerConverter( this );
|
||||
@@ -111,9 +133,9 @@ public class FMP implements IIntegrationModule, IPartFactory, IPartConverter, IF
|
||||
MultipartGenerator.registerPassThroughInterface( "appeng.helpers.AEMultiTile" );
|
||||
}
|
||||
|
||||
private void createAndRegister(IBlockDefinition definition, int i)
|
||||
private void createAndRegister( IBlockDefinition definition, int i )
|
||||
{
|
||||
for ( Block block : definition.maybeBlock().asSet() )
|
||||
for( Block block : definition.maybeBlock().asSet() )
|
||||
{
|
||||
BlockMicroMaterial.createAndRegister( block, i );
|
||||
}
|
||||
@@ -126,27 +148,27 @@ public class FMP implements IIntegrationModule, IPartFactory, IPartConverter, IF
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPartHost getOrCreateHost(TileEntity tile)
|
||||
public IPartHost getOrCreateHost( TileEntity tile )
|
||||
{
|
||||
try
|
||||
{
|
||||
BlockCoord loc = new BlockCoord( tile.xCoord, tile.yCoord, tile.zCoord );
|
||||
|
||||
TileMultipart mp = TileMultipart.getOrConvertTile( tile.getWorldObj(), loc );
|
||||
if ( mp != null )
|
||||
if( mp != null )
|
||||
{
|
||||
scala.collection.Iterator<TMultiPart> i = mp.partList().iterator();
|
||||
while (i.hasNext())
|
||||
while( i.hasNext() )
|
||||
{
|
||||
TMultiPart p = i.next();
|
||||
if ( p instanceof CableBusPart )
|
||||
if( p instanceof CableBusPart )
|
||||
return (IPartHost) p;
|
||||
}
|
||||
|
||||
return new FMPPlacementHelper( mp );
|
||||
}
|
||||
}
|
||||
catch (Throwable t)
|
||||
catch( Throwable t )
|
||||
{
|
||||
AELog.error( t );
|
||||
}
|
||||
@@ -154,30 +176,30 @@ public class FMP implements IIntegrationModule, IPartFactory, IPartConverter, IF
|
||||
}
|
||||
|
||||
@Override
|
||||
public CableBusContainer getCableContainer(TileEntity te)
|
||||
public CableBusContainer getCableContainer( TileEntity te )
|
||||
{
|
||||
if ( te instanceof TileMultipart )
|
||||
if( te instanceof TileMultipart )
|
||||
{
|
||||
TileMultipart mp = (TileMultipart) te;
|
||||
scala.collection.Iterator<TMultiPart> i = mp.partList().iterator();
|
||||
while (i.hasNext())
|
||||
while( i.hasNext() )
|
||||
{
|
||||
TMultiPart p = i.next();
|
||||
if ( p instanceof CableBusPart )
|
||||
return ((CableBusPart) p).cb;
|
||||
if( p instanceof CableBusPart )
|
||||
return ( (CableBusPart) p ).cb;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerPassThrough(Class<?> layerInterface)
|
||||
public void registerPassThrough( Class<?> layerInterface )
|
||||
{
|
||||
try
|
||||
{
|
||||
MultipartGenerator.registerPassThroughInterface( layerInterface.getName() );
|
||||
}
|
||||
catch (Throwable t)
|
||||
catch( Throwable t )
|
||||
{
|
||||
AELog.severe( "Failed to register " + layerInterface.getName() + " with FMP, some features may not work with MultiParts." );
|
||||
AELog.error( t );
|
||||
@@ -185,28 +207,8 @@ public class FMP implements IIntegrationModule, IPartFactory, IPartConverter, IF
|
||||
}
|
||||
|
||||
@Override
|
||||
public Event newFMPPacketEvent(EntityPlayerMP sender)
|
||||
public Event newFMPPacketEvent( EntityPlayerMP sender )
|
||||
{
|
||||
return new FMPPacketEvent( sender );
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<Block> blockTypes()
|
||||
{
|
||||
final IBlocks blocks = AEApi.instance().definitions().blocks();
|
||||
final List<Block> blockTypes = Lists.newArrayListWithCapacity( 2 );
|
||||
|
||||
this.addBlockTypes( blockTypes, blocks.multiPart() );
|
||||
this.addBlockTypes( blockTypes, blocks.quartzTorch() );
|
||||
|
||||
return blockTypes;
|
||||
}
|
||||
|
||||
private void addBlockTypes( Collection<Block> blockTypes, IBlockDefinition definition )
|
||||
{
|
||||
for ( Block block : definition.maybeBlock().asSet() )
|
||||
{
|
||||
blockTypes.add( block );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package appeng.integration.modules;
|
||||
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
@@ -33,6 +34,7 @@ import appeng.integration.modules.helpers.FactorizationBarrel;
|
||||
import appeng.integration.modules.helpers.FactorizationHandler;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
/**
|
||||
* 100% Hacks.
|
||||
*/
|
||||
@@ -48,118 +50,138 @@ public class FZ implements IFZ, IIntegrationModule
|
||||
private static Field day_item;
|
||||
|
||||
@Override
|
||||
public ItemStack barrelGetItem(TileEntity te)
|
||||
public ItemStack barrelGetItem( TileEntity te )
|
||||
{
|
||||
try
|
||||
{
|
||||
ItemStack i = null;
|
||||
|
||||
if ( day_BarrelClass.isInstance( te ) )
|
||||
if( day_BarrelClass.isInstance( te ) )
|
||||
i = (ItemStack) day_item.get( te );
|
||||
|
||||
if ( i != null )
|
||||
if( i != null )
|
||||
i = Platform.cloneItemStack( i );
|
||||
|
||||
return i;
|
||||
}
|
||||
catch (IllegalArgumentException ignored)
|
||||
catch( IllegalArgumentException ignored )
|
||||
{
|
||||
}
|
||||
catch (IllegalAccessException ignored)
|
||||
catch( IllegalAccessException ignored )
|
||||
{
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int barrelGetMaxItemCount(TileEntity te)
|
||||
public int barrelGetMaxItemCount( TileEntity te )
|
||||
{
|
||||
try
|
||||
{
|
||||
if ( day_BarrelClass.isInstance( te ) )
|
||||
if( day_BarrelClass.isInstance( te ) )
|
||||
return (Integer) day_getMaxSize.invoke( te );
|
||||
}
|
||||
catch (IllegalAccessException ignored)
|
||||
catch( IllegalAccessException ignored )
|
||||
{
|
||||
}
|
||||
catch (IllegalArgumentException ignored)
|
||||
catch( IllegalArgumentException ignored )
|
||||
{
|
||||
}
|
||||
catch (InvocationTargetException ignored)
|
||||
catch( InvocationTargetException ignored )
|
||||
{
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int barrelGetItemCount(TileEntity te)
|
||||
public int barrelGetItemCount( TileEntity te )
|
||||
{
|
||||
try
|
||||
{
|
||||
if ( day_BarrelClass.isInstance( te ) )
|
||||
if( day_BarrelClass.isInstance( te ) )
|
||||
return (Integer) day_getItemCount.invoke( te );
|
||||
}
|
||||
catch (IllegalAccessException ignored)
|
||||
catch( IllegalAccessException ignored )
|
||||
{
|
||||
}
|
||||
catch (IllegalArgumentException ignored)
|
||||
catch( IllegalArgumentException ignored )
|
||||
{
|
||||
}
|
||||
catch (InvocationTargetException ignored)
|
||||
catch( InvocationTargetException ignored )
|
||||
{
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setItemType(TileEntity te, ItemStack input)
|
||||
public void setItemType( TileEntity te, ItemStack input )
|
||||
{
|
||||
try
|
||||
{
|
||||
if ( day_BarrelClass.isInstance( te ) )
|
||||
if( day_BarrelClass.isInstance( te ) )
|
||||
day_item.set( te, input == null ? null : input.copy() );
|
||||
}
|
||||
catch (IllegalArgumentException ignored)
|
||||
catch( IllegalArgumentException ignored )
|
||||
{
|
||||
}
|
||||
catch (IllegalAccessException ignored)
|
||||
catch( IllegalAccessException ignored )
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void barrelSetCount(TileEntity te, int max)
|
||||
public void barrelSetCount( TileEntity te, int max )
|
||||
{
|
||||
try
|
||||
{
|
||||
if ( day_BarrelClass.isInstance( te ) )
|
||||
if( day_BarrelClass.isInstance( te ) )
|
||||
day_setItemCount.invoke( te, max );
|
||||
|
||||
te.markDirty();
|
||||
}
|
||||
catch (IllegalAccessException ignored)
|
||||
catch( IllegalAccessException ignored )
|
||||
{
|
||||
}
|
||||
catch (IllegalArgumentException ignored)
|
||||
catch( IllegalArgumentException ignored )
|
||||
{
|
||||
}
|
||||
catch (InvocationTargetException ignored)
|
||||
catch( InvocationTargetException ignored )
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMEInventory getFactorizationBarrel(TileEntity te)
|
||||
public IMEInventory getFactorizationBarrel( TileEntity te )
|
||||
{
|
||||
return new FactorizationBarrel( this, te );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBarrel(TileEntity te)
|
||||
public boolean isBarrel( TileEntity te )
|
||||
{
|
||||
return day_BarrelClass.isAssignableFrom( te.getClass() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void grinderRecipe( ItemStack in, ItemStack out )
|
||||
{
|
||||
try
|
||||
{
|
||||
Class<?> c = Class.forName( "factorization.oreprocessing.TileEntityGrinder" );
|
||||
Method m = c.getMethod( "addRecipe", Object.class, ItemStack.class, float.class );
|
||||
|
||||
float amt = out.stackSize;
|
||||
out.stackSize = 1;
|
||||
|
||||
m.invoke( c, in, out, amt );
|
||||
}
|
||||
catch( Throwable t )
|
||||
{
|
||||
// AELog.info( "" );
|
||||
// throw new RuntimeException( t );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() throws Throwable
|
||||
{
|
||||
@@ -176,24 +198,4 @@ public class FZ implements IFZ, IIntegrationModule
|
||||
{
|
||||
AEApi.instance().registries().externalStorage().addExternalStorageInterface( new FactorizationHandler() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void grinderRecipe(ItemStack in, ItemStack out)
|
||||
{
|
||||
try
|
||||
{
|
||||
Class<?> c = Class.forName( "factorization.oreprocessing.TileEntityGrinder" );
|
||||
Method m = c.getMethod( "addRecipe", Object.class, ItemStack.class, float.class );
|
||||
|
||||
float amt = out.stackSize;
|
||||
out.stackSize = 1;
|
||||
|
||||
m.invoke( c, in, out, amt );
|
||||
}
|
||||
catch (Throwable t)
|
||||
{
|
||||
// AELog.info( "" );
|
||||
// throw new RuntimeException( t );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package appeng.integration.modules;
|
||||
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
@@ -31,12 +32,14 @@ import appeng.api.features.IP2PTunnelRegistry;
|
||||
import appeng.integration.BaseModule;
|
||||
import appeng.integration.abstraction.IIC2;
|
||||
|
||||
|
||||
public class IC2 extends BaseModule implements IIC2
|
||||
{
|
||||
|
||||
public static IC2 instance;
|
||||
|
||||
public IC2() {
|
||||
public IC2()
|
||||
{
|
||||
this.testClassExistence( IEnergyTile.class );
|
||||
}
|
||||
|
||||
@@ -66,27 +69,26 @@ public class IC2 extends BaseModule implements IIC2
|
||||
}
|
||||
|
||||
@Override
|
||||
public void maceratorRecipe(ItemStack in, ItemStack out)
|
||||
{
|
||||
ic2.api.recipe.Recipes.macerator.addRecipe( new RecipeInputItemStack( in, in.stackSize ), null, out );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addToEnergyNet(TileEntity appEngTile)
|
||||
public void addToEnergyNet( TileEntity appEngTile )
|
||||
{
|
||||
MinecraftForge.EVENT_BUS.post( new ic2.api.energy.event.EnergyTileLoadEvent( (IEnergyTile) appEngTile ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeFromEnergyNet(TileEntity appEngTile)
|
||||
public void removeFromEnergyNet( TileEntity appEngTile )
|
||||
{
|
||||
MinecraftForge.EVENT_BUS.post( new ic2.api.energy.event.EnergyTileUnloadEvent( (IEnergyTile) appEngTile ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getItem(String name)
|
||||
public ItemStack getItem( String name )
|
||||
{
|
||||
return ic2.api.item.IC2Items.getItem( name );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void maceratorRecipe( ItemStack in, ItemStack out )
|
||||
{
|
||||
ic2.api.recipe.Recipes.macerator.addRecipe( new RecipeInputItemStack( in, in.stackSize ), null, out );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,11 +62,10 @@ public class ImmibisMicroblocks extends BaseModule implements IImmibisMicroblock
|
||||
try
|
||||
{
|
||||
this.MicroblockAPIUtils = Class.forName( "mods.immibis.microblocks.api.MicroblockAPIUtils" );
|
||||
this.mergeIntoMicroblockContainer = this.MicroblockAPIUtils.getMethod( "mergeIntoMicroblockContainer", ItemStack.class, EntityPlayer.class, World.class,
|
||||
int.class, int.class, int.class, int.class, Block.class, int.class );
|
||||
this.mergeIntoMicroblockContainer = this.MicroblockAPIUtils.getMethod( "mergeIntoMicroblockContainer", ItemStack.class, EntityPlayer.class, World.class, int.class, int.class, int.class, int.class, Block.class, int.class );
|
||||
this.canConvertTiles = true;
|
||||
}
|
||||
catch ( Throwable t )
|
||||
catch( Throwable t )
|
||||
{
|
||||
AELog.error( t );
|
||||
}
|
||||
@@ -78,22 +77,6 @@ public class ImmibisMicroblocks extends BaseModule implements IImmibisMicroblock
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean leaveParts( TileEntity te )
|
||||
{
|
||||
if ( te instanceof IMultipartTile )
|
||||
{
|
||||
ICoverSystem ci = ( ( IMultipartTile ) te ).getCoverSystem();
|
||||
if ( ci != null )
|
||||
{
|
||||
ci.convertToContainerBlock();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPartHost getOrCreateHost( EntityPlayer player, int side, TileEntity te )
|
||||
{
|
||||
@@ -103,7 +86,7 @@ public class ImmibisMicroblocks extends BaseModule implements IImmibisMicroblock
|
||||
final int z = te.zCoord;
|
||||
final boolean isPartItem = player != null && player.getHeldItem() != null && player.getHeldItem().getItem() instanceof IPartItem;
|
||||
|
||||
if ( te instanceof IMultipartTile && this.canConvertTiles && isPartItem )
|
||||
if( te instanceof IMultipartTile && this.canConvertTiles && isPartItem )
|
||||
{
|
||||
final IBlockDefinition multiPart = AEApi.instance().definitions().blocks().multiPart();
|
||||
final Optional<Block> maybeMultiPartBlock = multiPart.maybeBlock();
|
||||
@@ -111,7 +94,7 @@ public class ImmibisMicroblocks extends BaseModule implements IImmibisMicroblock
|
||||
|
||||
final boolean multiPartPresent = maybeMultiPartBlock.isPresent() && maybeMultiPartStack.isPresent();
|
||||
|
||||
if ( multiPartPresent )
|
||||
if( multiPartPresent )
|
||||
{
|
||||
final Block multiPartBlock = maybeMultiPartBlock.get();
|
||||
final ItemStack multiPartStack = maybeMultiPartStack.get();
|
||||
@@ -122,7 +105,7 @@ public class ImmibisMicroblocks extends BaseModule implements IImmibisMicroblock
|
||||
// int.class, int.class, int.class, int.class, Block.class, int.class );
|
||||
this.mergeIntoMicroblockContainer.invoke( null, multiPartStack, player, w, x, y, z, side, multiPartBlock, 0 );
|
||||
}
|
||||
catch ( Throwable e )
|
||||
catch( Throwable e )
|
||||
{
|
||||
this.canConvertTiles = false;
|
||||
return null;
|
||||
@@ -131,9 +114,25 @@ public class ImmibisMicroblocks extends BaseModule implements IImmibisMicroblock
|
||||
}
|
||||
|
||||
final TileEntity tx = w.getTileEntity( x, y, z );
|
||||
if ( tx instanceof IPartHost )
|
||||
return ( IPartHost ) tx;
|
||||
if( tx instanceof IPartHost )
|
||||
return (IPartHost) tx;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean leaveParts( TileEntity te )
|
||||
{
|
||||
if( te instanceof IMultipartTile )
|
||||
{
|
||||
ICoverSystem ci = ( (IMultipartTile) te ).getCoverSystem();
|
||||
if( ci != null )
|
||||
{
|
||||
ci.convertToContainerBlock();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package appeng.integration.modules;
|
||||
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import cpw.mods.fml.common.Loader;
|
||||
@@ -27,6 +28,7 @@ import invtweaks.api.InvTweaksAPI;
|
||||
import appeng.integration.BaseModule;
|
||||
import appeng.integration.abstraction.IInvTweaks;
|
||||
|
||||
|
||||
public class InvTweaks extends BaseModule implements IInvTweaks
|
||||
{
|
||||
|
||||
@@ -43,12 +45,12 @@ public class InvTweaks extends BaseModule implements IInvTweaks
|
||||
@Override
|
||||
public void postInit()
|
||||
{
|
||||
if ( api == null )
|
||||
if( api == null )
|
||||
throw new RuntimeException( "InvTweaks API Instance Failed." );
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareItems(ItemStack i, ItemStack j)
|
||||
public int compareItems( ItemStack i, ItemStack j )
|
||||
{
|
||||
return api.compareItems( i, j );
|
||||
}
|
||||
|
||||
@@ -18,16 +18,19 @@
|
||||
|
||||
package appeng.integration.modules;
|
||||
|
||||
|
||||
import powercrystals.minefactoryreloaded.api.rednet.connectivity.IRedNetConnection;
|
||||
|
||||
import appeng.integration.BaseModule;
|
||||
|
||||
|
||||
public class MFR extends BaseModule
|
||||
{
|
||||
|
||||
public static MFR instance;
|
||||
|
||||
public MFR() {
|
||||
public MFR()
|
||||
{
|
||||
this.testClassExistence( IRedNetConnection.class );
|
||||
}
|
||||
|
||||
@@ -42,5 +45,4 @@ public class MFR extends BaseModule
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package appeng.integration.modules;
|
||||
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
@@ -26,6 +27,7 @@ import cpw.mods.fml.common.event.FMLInterModComms;
|
||||
import appeng.integration.BaseModule;
|
||||
import appeng.integration.abstraction.IMekanism;
|
||||
|
||||
|
||||
public final class Mekanism extends BaseModule implements IMekanism
|
||||
{
|
||||
|
||||
@@ -44,7 +46,7 @@ public final class Mekanism extends BaseModule implements IMekanism
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCrusherRecipe(ItemStack in, ItemStack out)
|
||||
public void addCrusherRecipe( ItemStack in, ItemStack out )
|
||||
{
|
||||
final NBTTagCompound sendTag = this.convertToSimpleRecipe( in, out );
|
||||
|
||||
@@ -52,7 +54,7 @@ public final class Mekanism extends BaseModule implements IMekanism
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addEnrichmentChamberRecipe(ItemStack in, ItemStack out)
|
||||
public void addEnrichmentChamberRecipe( ItemStack in, ItemStack out )
|
||||
{
|
||||
final NBTTagCompound sendTag = this.convertToSimpleRecipe( in, out );
|
||||
|
||||
|
||||
@@ -51,6 +51,7 @@ import appeng.integration.modules.NEIHelpers.NEIInscriberRecipeHandler;
|
||||
import appeng.integration.modules.NEIHelpers.NEIWorldCraftingHandler;
|
||||
import appeng.integration.modules.NEIHelpers.TerminalCraftingSlotFinder;
|
||||
|
||||
|
||||
public class NEI extends BaseModule implements INEI, IContainerTooltipHandler
|
||||
{
|
||||
|
||||
@@ -62,19 +63,14 @@ public class NEI extends BaseModule implements INEI, IContainerTooltipHandler
|
||||
Method registerRecipeHandler;
|
||||
Method registerUsageHandler;
|
||||
|
||||
public NEI() throws ClassNotFoundException {
|
||||
public NEI() throws ClassNotFoundException
|
||||
{
|
||||
this.testClassExistence( GuiContainerManager.class );
|
||||
this.testClassExistence( codechicken.nei.recipe.ICraftingHandler.class );
|
||||
this.testClassExistence( codechicken.nei.recipe.IUsageHandler.class );
|
||||
this.API = Class.forName( "codechicken.nei.api.API" );
|
||||
}
|
||||
|
||||
public void registerRecipeHandler(Object o) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException
|
||||
{
|
||||
this.registerRecipeHandler.invoke( this.API, o );
|
||||
this.registerUsageHandler.invoke( this.API, o );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() throws Throwable
|
||||
{
|
||||
@@ -87,7 +83,7 @@ public class NEI extends BaseModule implements INEI, IContainerTooltipHandler
|
||||
this.registerRecipeHandler( new NEIWorldCraftingHandler() );
|
||||
this.registerRecipeHandler( new NEIGrinderRecipeHandler() );
|
||||
|
||||
if ( AEConfig.instance.isFeatureEnabled( AEFeature.Facades ) && AEConfig.instance.isFeatureEnabled( AEFeature.enableFacadeCrafting ) )
|
||||
if( AEConfig.instance.isFeatureEnabled( AEFeature.Facades ) && AEConfig.instance.isFeatureEnabled( AEFeature.enableFacadeCrafting ) )
|
||||
this.registerRecipeHandler( new NEIFacadeRecipeHandler() );
|
||||
|
||||
// large stack tooltips
|
||||
@@ -107,6 +103,12 @@ public class NEI extends BaseModule implements INEI, IContainerTooltipHandler
|
||||
registerGuiOverlayHandler.invoke( this.API, GuiPatternTerm.class, DefaultOverlayHandlerConstructor.newInstance( 6, 75 ), "crafting" );
|
||||
}
|
||||
|
||||
public void registerRecipeHandler( Object o ) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException
|
||||
{
|
||||
this.registerRecipeHandler.invoke( this.API, o );
|
||||
this.registerUsageHandler.invoke( this.API, o );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit()
|
||||
{
|
||||
@@ -114,14 +116,14 @@ public class NEI extends BaseModule implements INEI, IContainerTooltipHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawSlot(Slot s)
|
||||
public void drawSlot( Slot s )
|
||||
{
|
||||
if ( s == null )
|
||||
if( s == null )
|
||||
return;
|
||||
|
||||
ItemStack stack = s.getStack();
|
||||
|
||||
if ( stack == null )
|
||||
if( stack == null )
|
||||
return;
|
||||
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
@@ -134,7 +136,7 @@ public class NEI extends BaseModule implements INEI, IContainerTooltipHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public RenderItem setItemRender(RenderItem renderItem)
|
||||
public RenderItem setItemRender( RenderItem renderItem )
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -142,31 +144,30 @@ public class NEI extends BaseModule implements INEI, IContainerTooltipHandler
|
||||
GuiContainerManager.drawItems = renderItem;
|
||||
return ri;
|
||||
}
|
||||
catch (Throwable t)
|
||||
catch( Throwable t )
|
||||
{
|
||||
throw new RuntimeException( "Invalid version of NEI, please update", t );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> handleItemDisplayName(GuiContainer arg0, ItemStack arg1, List<String> current)
|
||||
public List<String> handleTooltip( GuiContainer arg0, int arg1, int arg2, List<String> current )
|
||||
{
|
||||
return current;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> handleItemTooltip(GuiContainer guiScreen, ItemStack stack, int mouseX, int mouseY, List<String> currentToolTip)
|
||||
public List<String> handleItemDisplayName( GuiContainer arg0, ItemStack arg1, List<String> current )
|
||||
{
|
||||
if ( guiScreen instanceof AEBaseMEGui )
|
||||
return ((AEBaseMEGui) guiScreen).handleItemTooltip( stack, mouseX, mouseY, currentToolTip );
|
||||
return current;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> handleItemTooltip( GuiContainer guiScreen, ItemStack stack, int mouseX, int mouseY, List<String> currentToolTip )
|
||||
{
|
||||
if( guiScreen instanceof AEBaseMEGui )
|
||||
return ( (AEBaseMEGui) guiScreen ).handleItemTooltip( stack, mouseX, mouseY, currentToolTip );
|
||||
|
||||
return currentToolTip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> handleTooltip(GuiContainer arg0, int arg1, int arg2, List<String> current)
|
||||
{
|
||||
return current;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,7 +18,8 @@
|
||||
|
||||
package appeng.integration.modules.NEIHelpers;
|
||||
|
||||
import java.awt.Rectangle;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -46,6 +47,7 @@ import appeng.core.AEConfig;
|
||||
import appeng.recipes.game.ShapedRecipe;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public class NEIAEShapedRecipeHandler extends TemplateRecipeHandler
|
||||
{
|
||||
|
||||
@@ -56,28 +58,16 @@ public class NEIAEShapedRecipeHandler extends TemplateRecipeHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends GuiContainer> getGuiClass()
|
||||
public void loadCraftingRecipes( String outputId, Object... results )
|
||||
{
|
||||
return GuiCrafting.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeName()
|
||||
{
|
||||
return NEIClientUtils.translate( "recipe.shaped" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(String outputId, Object... results)
|
||||
{
|
||||
if ( (outputId.equals( "crafting" )) && (this.getClass() == NEIAEShapedRecipeHandler.class) )
|
||||
if( ( outputId.equals( "crafting" ) ) && ( this.getClass() == NEIAEShapedRecipeHandler.class ) )
|
||||
{
|
||||
List<IRecipe> recipes = CraftingManager.getInstance().getRecipeList();
|
||||
for (IRecipe recipe : recipes)
|
||||
for( IRecipe recipe : recipes )
|
||||
{
|
||||
if ( (recipe instanceof ShapedRecipe) )
|
||||
if( ( recipe instanceof ShapedRecipe ) )
|
||||
{
|
||||
if ( ((ShapedRecipe) recipe).isEnabled() )
|
||||
if( ( (ShapedRecipe) recipe ).isEnabled() )
|
||||
{
|
||||
CachedShapedRecipe cachedRecipe = new CachedShapedRecipe( (ShapedRecipe) recipe );
|
||||
cachedRecipe.computeVisuals();
|
||||
@@ -93,14 +83,14 @@ public class NEIAEShapedRecipeHandler extends TemplateRecipeHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(ItemStack result)
|
||||
public void loadCraftingRecipes( ItemStack result )
|
||||
{
|
||||
List<IRecipe> recipes = CraftingManager.getInstance().getRecipeList();
|
||||
for (IRecipe recipe : recipes)
|
||||
for( IRecipe recipe : recipes )
|
||||
{
|
||||
if ( (recipe instanceof ShapedRecipe) )
|
||||
if( ( recipe instanceof ShapedRecipe ) )
|
||||
{
|
||||
if ( ((ShapedRecipe) recipe).isEnabled() && NEIServerUtils.areStacksSameTypeCrafting( recipe.getRecipeOutput(), result ) )
|
||||
if( ( (ShapedRecipe) recipe ).isEnabled() && NEIServerUtils.areStacksSameTypeCrafting( recipe.getRecipeOutput(), result ) )
|
||||
{
|
||||
CachedShapedRecipe cachedRecipe = new CachedShapedRecipe( (ShapedRecipe) recipe );
|
||||
cachedRecipe.computeVisuals();
|
||||
@@ -111,19 +101,19 @@ public class NEIAEShapedRecipeHandler extends TemplateRecipeHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadUsageRecipes(ItemStack ingredient)
|
||||
public void loadUsageRecipes( ItemStack ingredient )
|
||||
{
|
||||
List<IRecipe> recipes = CraftingManager.getInstance().getRecipeList();
|
||||
for (IRecipe recipe : recipes)
|
||||
for( IRecipe recipe : recipes )
|
||||
{
|
||||
if ( (recipe instanceof ShapedRecipe) )
|
||||
if( ( recipe instanceof ShapedRecipe ) )
|
||||
{
|
||||
CachedShapedRecipe cachedRecipe = new CachedShapedRecipe( (ShapedRecipe) recipe );
|
||||
|
||||
if ( ((ShapedRecipe) recipe).isEnabled() && cachedRecipe.contains( cachedRecipe.ingredients, ingredient.getItem() ) )
|
||||
if( ( (ShapedRecipe) recipe ).isEnabled() && cachedRecipe.contains( cachedRecipe.ingredients, ingredient.getItem() ) )
|
||||
{
|
||||
cachedRecipe.computeVisuals();
|
||||
if ( cachedRecipe.contains( cachedRecipe.ingredients, ingredient ) )
|
||||
if( cachedRecipe.contains( cachedRecipe.ingredients, ingredient ) )
|
||||
{
|
||||
cachedRecipe.setIngredientPermutation( cachedRecipe.ingredients, ingredient );
|
||||
this.arecipes.add( cachedRecipe );
|
||||
@@ -146,67 +136,80 @@ public class NEIAEShapedRecipeHandler extends TemplateRecipeHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasOverlay(GuiContainer gui, Container container, int recipe)
|
||||
public Class<? extends GuiContainer> getGuiClass()
|
||||
{
|
||||
return (super.hasOverlay( gui, container, recipe )) || ((this.isRecipe2x2( recipe )) && (RecipeInfo.hasDefaultOverlay( gui, "crafting2x2" )));
|
||||
return GuiCrafting.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRecipeOverlayRenderer getOverlayRenderer(GuiContainer gui, int recipe)
|
||||
public boolean hasOverlay( GuiContainer gui, Container container, int recipe )
|
||||
{
|
||||
return ( super.hasOverlay( gui, container, recipe ) ) || ( ( this.isRecipe2x2( recipe ) ) && ( RecipeInfo.hasDefaultOverlay( gui, "crafting2x2" ) ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRecipeOverlayRenderer getOverlayRenderer( GuiContainer gui, int recipe )
|
||||
{
|
||||
IRecipeOverlayRenderer renderer = super.getOverlayRenderer( gui, recipe );
|
||||
if ( renderer != null )
|
||||
if( renderer != null )
|
||||
return renderer;
|
||||
|
||||
IStackPositioner positioner = RecipeInfo.getStackPositioner( gui, "crafting2x2" );
|
||||
if ( positioner == null )
|
||||
if( positioner == null )
|
||||
return null;
|
||||
|
||||
return new DefaultOverlayRenderer( this.getIngredientStacks( recipe ), positioner );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IOverlayHandler getOverlayHandler(GuiContainer gui, int recipe)
|
||||
public IOverlayHandler getOverlayHandler( GuiContainer gui, int recipe )
|
||||
{
|
||||
IOverlayHandler handler = super.getOverlayHandler( gui, recipe );
|
||||
if ( handler != null )
|
||||
if( handler != null )
|
||||
return handler;
|
||||
|
||||
return RecipeInfo.getOverlayHandler( gui, "crafting2x2" );
|
||||
}
|
||||
|
||||
public boolean isRecipe2x2(int recipe)
|
||||
public boolean isRecipe2x2( int recipe )
|
||||
{
|
||||
for (PositionedStack stack : this.getIngredientStacks( recipe ))
|
||||
for( PositionedStack stack : this.getIngredientStacks( recipe ) )
|
||||
{
|
||||
if ( (stack.relx > 43) || (stack.rely > 24) )
|
||||
if( ( stack.relx > 43 ) || ( stack.rely > 24 ) )
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeName()
|
||||
{
|
||||
return NEIClientUtils.translate( "recipe.shaped" );
|
||||
}
|
||||
|
||||
public class CachedShapedRecipe extends TemplateRecipeHandler.CachedRecipe
|
||||
{
|
||||
|
||||
public final ArrayList<PositionedStack> ingredients;
|
||||
public final PositionedStack result;
|
||||
|
||||
public CachedShapedRecipe(ShapedRecipe recipe) {
|
||||
public CachedShapedRecipe( ShapedRecipe recipe )
|
||||
{
|
||||
this.result = new PositionedStack( recipe.getRecipeOutput(), 119, 24 );
|
||||
this.ingredients = new ArrayList<PositionedStack>();
|
||||
this.setIngredients( recipe.getWidth(), recipe.getHeight(), recipe.getIngredients() );
|
||||
}
|
||||
|
||||
public void setIngredients(int width, int height, Object[] items)
|
||||
public void setIngredients( int width, int height, Object[] items )
|
||||
{
|
||||
boolean useSingleItems = AEConfig.instance.disableColoredCableRecipesInNEI();
|
||||
for (int x = 0; x < width; x++)
|
||||
for( int x = 0; x < width; x++ )
|
||||
{
|
||||
for (int y = 0; y < height; y++)
|
||||
for( int y = 0; y < height; y++ )
|
||||
{
|
||||
if ( items[(y * width + x)] != null )
|
||||
if( items[( y * width + x )] != null )
|
||||
{
|
||||
IIngredient ing = (IIngredient) items[(y * width + x)];
|
||||
IIngredient ing = (IIngredient) items[( y * width + x )];
|
||||
|
||||
try
|
||||
{
|
||||
@@ -215,35 +218,34 @@ public class NEIAEShapedRecipeHandler extends TemplateRecipeHandler
|
||||
stack.setMaxSize( 1 );
|
||||
this.ingredients.add( stack );
|
||||
}
|
||||
catch (RegistrationError ignored)
|
||||
catch( RegistrationError ignored )
|
||||
{
|
||||
|
||||
}
|
||||
catch (MissingIngredientError ignored)
|
||||
catch( MissingIngredientError ignored )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PositionedStack> getIngredients()
|
||||
{
|
||||
return this.getCycledIngredients( NEIAEShapedRecipeHandler.this.cycleticks / 20, this.ingredients );
|
||||
}
|
||||
|
||||
@Override
|
||||
public PositionedStack getResult()
|
||||
{
|
||||
return this.result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PositionedStack> getIngredients()
|
||||
{
|
||||
return this.getCycledIngredients( NEIAEShapedRecipeHandler.this.cycleticks / 20, this.ingredients );
|
||||
}
|
||||
|
||||
public void computeVisuals()
|
||||
{
|
||||
for (PositionedStack p : this.ingredients)
|
||||
for( PositionedStack p : this.ingredients )
|
||||
{
|
||||
p.generatePermutations();
|
||||
}
|
||||
|
||||
+79
-78
@@ -18,7 +18,8 @@
|
||||
|
||||
package appeng.integration.modules.NEIHelpers;
|
||||
|
||||
import java.awt.Rectangle;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -46,6 +47,7 @@ import appeng.core.AEConfig;
|
||||
import appeng.recipes.game.ShapelessRecipe;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public class NEIAEShapelessRecipeHandler extends TemplateRecipeHandler
|
||||
{
|
||||
|
||||
@@ -56,28 +58,16 @@ public class NEIAEShapelessRecipeHandler extends TemplateRecipeHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends GuiContainer> getGuiClass()
|
||||
public void loadCraftingRecipes( String outputId, Object... results )
|
||||
{
|
||||
return GuiCrafting.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeName()
|
||||
{
|
||||
return NEIClientUtils.translate( "recipe.shapeless" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(String outputId, Object... results)
|
||||
{
|
||||
if ( (outputId.equals( "crafting" )) && (this.getClass() == NEIAEShapelessRecipeHandler.class) )
|
||||
if( ( outputId.equals( "crafting" ) ) && ( this.getClass() == NEIAEShapelessRecipeHandler.class ) )
|
||||
{
|
||||
List<IRecipe> recipes = CraftingManager.getInstance().getRecipeList();
|
||||
for (IRecipe recipe : recipes)
|
||||
for( IRecipe recipe : recipes )
|
||||
{
|
||||
if ( (recipe instanceof ShapelessRecipe) )
|
||||
if( ( recipe instanceof ShapelessRecipe ) )
|
||||
{
|
||||
if ( ((ShapelessRecipe) recipe).isEnabled() )
|
||||
if( ( (ShapelessRecipe) recipe ).isEnabled() )
|
||||
{
|
||||
CachedShapelessRecipe cachedRecipe = new CachedShapelessRecipe( (ShapelessRecipe) recipe );
|
||||
cachedRecipe.computeVisuals();
|
||||
@@ -93,14 +83,14 @@ public class NEIAEShapelessRecipeHandler extends TemplateRecipeHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(ItemStack result)
|
||||
public void loadCraftingRecipes( ItemStack result )
|
||||
{
|
||||
List<IRecipe> recipes = CraftingManager.getInstance().getRecipeList();
|
||||
for (IRecipe recipe : recipes)
|
||||
for( IRecipe recipe : recipes )
|
||||
{
|
||||
if ( (recipe instanceof ShapelessRecipe) )
|
||||
if( ( recipe instanceof ShapelessRecipe ) )
|
||||
{
|
||||
if ( ((ShapelessRecipe) recipe).isEnabled() && NEIServerUtils.areStacksSameTypeCrafting( recipe.getRecipeOutput(), result ) )
|
||||
if( ( (ShapelessRecipe) recipe ).isEnabled() && NEIServerUtils.areStacksSameTypeCrafting( recipe.getRecipeOutput(), result ) )
|
||||
{
|
||||
CachedShapelessRecipe cachedRecipe = new CachedShapelessRecipe( (ShapelessRecipe) recipe );
|
||||
cachedRecipe.computeVisuals();
|
||||
@@ -111,19 +101,19 @@ public class NEIAEShapelessRecipeHandler extends TemplateRecipeHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadUsageRecipes(ItemStack ingredient)
|
||||
public void loadUsageRecipes( ItemStack ingredient )
|
||||
{
|
||||
List<IRecipe> recipes = CraftingManager.getInstance().getRecipeList();
|
||||
for (IRecipe recipe : recipes)
|
||||
for( IRecipe recipe : recipes )
|
||||
{
|
||||
if ( (recipe instanceof ShapelessRecipe) )
|
||||
if( ( recipe instanceof ShapelessRecipe ) )
|
||||
{
|
||||
CachedShapelessRecipe cachedRecipe = new CachedShapelessRecipe( (ShapelessRecipe) recipe );
|
||||
|
||||
if ( ((ShapelessRecipe) recipe).isEnabled() && cachedRecipe.contains( cachedRecipe.ingredients, ingredient.getItem() ) )
|
||||
if( ( (ShapelessRecipe) recipe ).isEnabled() && cachedRecipe.contains( cachedRecipe.ingredients, ingredient.getItem() ) )
|
||||
{
|
||||
cachedRecipe.computeVisuals();
|
||||
if ( cachedRecipe.contains( cachedRecipe.ingredients, ingredient ) )
|
||||
if( cachedRecipe.contains( cachedRecipe.ingredients, ingredient ) )
|
||||
{
|
||||
cachedRecipe.setIngredientPermutation( cachedRecipe.ingredients, ingredient );
|
||||
this.arecipes.add( cachedRecipe );
|
||||
@@ -146,105 +136,116 @@ public class NEIAEShapelessRecipeHandler extends TemplateRecipeHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasOverlay(GuiContainer gui, Container container, int recipe)
|
||||
public Class<? extends GuiContainer> getGuiClass()
|
||||
{
|
||||
return (super.hasOverlay( gui, container, recipe )) || ((this.isRecipe2x2( recipe )) && (RecipeInfo.hasDefaultOverlay( gui, "crafting2x2" )));
|
||||
return GuiCrafting.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRecipeOverlayRenderer getOverlayRenderer(GuiContainer gui, int recipe)
|
||||
public boolean hasOverlay( GuiContainer gui, Container container, int recipe )
|
||||
{
|
||||
return ( super.hasOverlay( gui, container, recipe ) ) || ( ( this.isRecipe2x2( recipe ) ) && ( RecipeInfo.hasDefaultOverlay( gui, "crafting2x2" ) ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRecipeOverlayRenderer getOverlayRenderer( GuiContainer gui, int recipe )
|
||||
{
|
||||
IRecipeOverlayRenderer renderer = super.getOverlayRenderer( gui, recipe );
|
||||
if ( renderer != null )
|
||||
if( renderer != null )
|
||||
return renderer;
|
||||
|
||||
IStackPositioner positioner = RecipeInfo.getStackPositioner( gui, "crafting2x2" );
|
||||
if ( positioner == null )
|
||||
if( positioner == null )
|
||||
return null;
|
||||
|
||||
return new DefaultOverlayRenderer( this.getIngredientStacks( recipe ), positioner );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IOverlayHandler getOverlayHandler(GuiContainer gui, int recipe)
|
||||
public IOverlayHandler getOverlayHandler( GuiContainer gui, int recipe )
|
||||
{
|
||||
IOverlayHandler handler = super.getOverlayHandler( gui, recipe );
|
||||
if ( handler != null )
|
||||
if( handler != null )
|
||||
return handler;
|
||||
|
||||
return RecipeInfo.getOverlayHandler( gui, "crafting2x2" );
|
||||
}
|
||||
|
||||
public boolean isRecipe2x2(int recipe)
|
||||
public boolean isRecipe2x2( int recipe )
|
||||
{
|
||||
for (PositionedStack stack : this.getIngredientStacks( recipe ))
|
||||
for( PositionedStack stack : this.getIngredientStacks( recipe ) )
|
||||
{
|
||||
if ( (stack.relx > 43) || (stack.rely > 24) )
|
||||
if( ( stack.relx > 43 ) || ( stack.rely > 24 ) )
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeName()
|
||||
{
|
||||
return NEIClientUtils.translate( "recipe.shapeless" );
|
||||
}
|
||||
|
||||
public class CachedShapelessRecipe extends TemplateRecipeHandler.CachedRecipe
|
||||
{
|
||||
|
||||
public final ArrayList<PositionedStack> ingredients;
|
||||
public final PositionedStack result;
|
||||
|
||||
public CachedShapelessRecipe(ShapelessRecipe recipe) {
|
||||
public CachedShapelessRecipe( ShapelessRecipe recipe )
|
||||
{
|
||||
this.result = new PositionedStack( recipe.getRecipeOutput(), 119, 24 );
|
||||
this.ingredients = new ArrayList<PositionedStack>();
|
||||
this.setIngredients( recipe.getInput().toArray() );
|
||||
}
|
||||
|
||||
public void setIngredients(Object[] items)
|
||||
{
|
||||
boolean useSingleItems = AEConfig.instance.disableColoredCableRecipesInNEI();
|
||||
for (int x = 0; x < 3; x++)
|
||||
{
|
||||
for (int y = 0; y < 3; y++)
|
||||
{
|
||||
if ( items.length > (y * 3 + x) )
|
||||
{
|
||||
IIngredient ing = (IIngredient) items[(y * 3 + x)];
|
||||
|
||||
try
|
||||
{
|
||||
ItemStack[] is = ing.getItemStackSet();
|
||||
PositionedStack stack = new PositionedStack( useSingleItems ? Platform.findPreferred( is ) : ing.getItemStackSet(), 25 + x * 18,
|
||||
6 + y * 18, false );
|
||||
stack.setMaxSize( 1 );
|
||||
this.ingredients.add( stack );
|
||||
}
|
||||
catch (RegistrationError ignored)
|
||||
{
|
||||
|
||||
}
|
||||
catch (MissingIngredientError ignored)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PositionedStack> getIngredients()
|
||||
{
|
||||
return this.getCycledIngredients( NEIAEShapelessRecipeHandler.this.cycleticks / 20, this.ingredients );
|
||||
}
|
||||
|
||||
@Override
|
||||
public PositionedStack getResult()
|
||||
{
|
||||
return this.result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PositionedStack> getIngredients()
|
||||
{
|
||||
return this.getCycledIngredients( NEIAEShapelessRecipeHandler.this.cycleticks / 20, this.ingredients );
|
||||
}
|
||||
|
||||
public void setIngredients( Object[] items )
|
||||
{
|
||||
boolean useSingleItems = AEConfig.instance.disableColoredCableRecipesInNEI();
|
||||
for( int x = 0; x < 3; x++ )
|
||||
{
|
||||
for( int y = 0; y < 3; y++ )
|
||||
{
|
||||
if( items.length > ( y * 3 + x ) )
|
||||
{
|
||||
IIngredient ing = (IIngredient) items[( y * 3 + x )];
|
||||
|
||||
try
|
||||
{
|
||||
ItemStack[] is = ing.getItemStackSet();
|
||||
PositionedStack stack = new PositionedStack( useSingleItems ? Platform.findPreferred( is ) : ing.getItemStackSet(), 25 + x * 18, 6 + y * 18, false );
|
||||
stack.setMaxSize( 1 );
|
||||
this.ingredients.add( stack );
|
||||
}
|
||||
catch( RegistrationError ignored )
|
||||
{
|
||||
|
||||
}
|
||||
catch( MissingIngredientError ignored )
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void computeVisuals()
|
||||
{
|
||||
for (PositionedStack p : this.ingredients)
|
||||
for( PositionedStack p : this.ingredients )
|
||||
p.generatePermutations();
|
||||
|
||||
this.result.generatePermutations();
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package appeng.integration.modules.NEIHelpers;
|
||||
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -39,61 +40,62 @@ import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.PacketNEIRecipe;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public class NEICraftingHandler implements IOverlayHandler
|
||||
{
|
||||
|
||||
public NEICraftingHandler(int x, int y)
|
||||
final int offsetX;
|
||||
final int offsetY;
|
||||
|
||||
public NEICraftingHandler( int x, int y )
|
||||
{
|
||||
this.offsetX = x;
|
||||
this.offsetY = y;
|
||||
}
|
||||
|
||||
final int offsetX;
|
||||
final int offsetY;
|
||||
|
||||
@Override
|
||||
public void overlayRecipe(GuiContainer gui, IRecipeHandler recipe, int recipeIndex, boolean shift)
|
||||
public void overlayRecipe( GuiContainer gui, IRecipeHandler recipe, int recipeIndex, boolean shift )
|
||||
{
|
||||
try
|
||||
{
|
||||
List ingredients = recipe.getIngredientStacks( recipeIndex );
|
||||
this.overlayRecipe( gui, ingredients, shift );
|
||||
}
|
||||
catch (Exception ignored)
|
||||
catch( Exception ignored )
|
||||
{
|
||||
}
|
||||
catch (Error ignored)
|
||||
catch( Error ignored )
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public void overlayRecipe(GuiContainer gui, List<PositionedStack> ingredients, boolean shift)
|
||||
public void overlayRecipe( GuiContainer gui, List<PositionedStack> ingredients, boolean shift )
|
||||
{
|
||||
try
|
||||
{
|
||||
NBTTagCompound recipe = new NBTTagCompound();
|
||||
|
||||
if ( gui instanceof GuiCraftingTerm || gui instanceof GuiPatternTerm )
|
||||
if( gui instanceof GuiCraftingTerm || gui instanceof GuiPatternTerm )
|
||||
{
|
||||
for (PositionedStack positionedStack : ingredients)
|
||||
for( PositionedStack positionedStack : ingredients )
|
||||
{
|
||||
int col = (positionedStack.relx - 25) / 18;
|
||||
int row = (positionedStack.rely - 6) / 18;
|
||||
if ( positionedStack.items != null && positionedStack.items.length > 0 )
|
||||
int col = ( positionedStack.relx - 25 ) / 18;
|
||||
int row = ( positionedStack.rely - 6 ) / 18;
|
||||
if( positionedStack.items != null && positionedStack.items.length > 0 )
|
||||
{
|
||||
for (Slot slot : (List<Slot>) gui.inventorySlots.inventorySlots)
|
||||
for( Slot slot : (List<Slot>) gui.inventorySlots.inventorySlots )
|
||||
{
|
||||
if ( slot instanceof SlotCraftingMatrix || slot instanceof SlotFakeCraftingMatrix )
|
||||
if( slot instanceof SlotCraftingMatrix || slot instanceof SlotFakeCraftingMatrix )
|
||||
{
|
||||
if ( slot.getSlotIndex() == col + row * 3 )
|
||||
if( slot.getSlotIndex() == col + row * 3 )
|
||||
{
|
||||
NBTTagList tags = new NBTTagList();
|
||||
List<ItemStack> list = new LinkedList<ItemStack>();
|
||||
|
||||
// prefer pure crystals.
|
||||
for (int x = 0; x < positionedStack.items.length; x++)
|
||||
for( int x = 0; x < positionedStack.items.length; x++ )
|
||||
{
|
||||
if ( Platform.isRecipePrioritized( positionedStack.items[x] ) )
|
||||
if( Platform.isRecipePrioritized( positionedStack.items[x] ) )
|
||||
{
|
||||
list.add( 0, positionedStack.items[x] );
|
||||
}
|
||||
@@ -103,7 +105,7 @@ public class NEICraftingHandler implements IOverlayHandler
|
||||
}
|
||||
}
|
||||
|
||||
for (ItemStack is : list)
|
||||
for( ItemStack is : list )
|
||||
{
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
is.writeToNBT( tag );
|
||||
@@ -121,10 +123,10 @@ public class NEICraftingHandler implements IOverlayHandler
|
||||
NetworkHandler.instance.sendToServer( new PacketNEIRecipe( recipe ) );
|
||||
}
|
||||
}
|
||||
catch (Exception ignored)
|
||||
catch( Exception ignored )
|
||||
{
|
||||
}
|
||||
catch (Error ignored)
|
||||
catch( Error ignored )
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,12 +66,12 @@ public class NEIFacadeRecipeHandler extends TemplateRecipeHandler
|
||||
@Override
|
||||
public void loadCraftingRecipes( String outputId, Object... results )
|
||||
{
|
||||
if ( ( outputId.equals( "crafting" ) ) && ( this.getClass() == NEIFacadeRecipeHandler.class ) )
|
||||
if( ( outputId.equals( "crafting" ) ) && ( this.getClass() == NEIFacadeRecipeHandler.class ) )
|
||||
{
|
||||
final List<ItemStack> facades = this.facade.getFacades();
|
||||
for ( ItemStack anchorStack : this.anchorDefinition.maybeStack( 1 ).asSet() )
|
||||
for( ItemStack anchorStack : this.anchorDefinition.maybeStack( 1 ).asSet() )
|
||||
{
|
||||
for ( ItemStack is : facades )
|
||||
for( ItemStack is : facades )
|
||||
{
|
||||
CachedShapedRecipe recipe = new CachedShapedRecipe( this.facade, anchorStack, is );
|
||||
recipe.computeVisuals();
|
||||
@@ -88,9 +88,9 @@ public class NEIFacadeRecipeHandler extends TemplateRecipeHandler
|
||||
@Override
|
||||
public void loadCraftingRecipes( ItemStack result )
|
||||
{
|
||||
if ( result.getItem() == this.facade )
|
||||
if( result.getItem() == this.facade )
|
||||
{
|
||||
for ( ItemStack anchorStack : this.anchorDefinition.maybeStack( 1 ).asSet() )
|
||||
for( ItemStack anchorStack : this.anchorDefinition.maybeStack( 1 ).asSet() )
|
||||
{
|
||||
CachedShapedRecipe recipe = new CachedShapedRecipe( this.facade, anchorStack, result );
|
||||
recipe.computeVisuals();
|
||||
@@ -103,16 +103,16 @@ public class NEIFacadeRecipeHandler extends TemplateRecipeHandler
|
||||
public void loadUsageRecipes( ItemStack ingredient )
|
||||
{
|
||||
List<ItemStack> facades = this.facade.getFacades();
|
||||
for ( ItemStack anchorStack : this.anchorDefinition.maybeStack( 1 ).asSet() )
|
||||
for( ItemStack anchorStack : this.anchorDefinition.maybeStack( 1 ).asSet() )
|
||||
{
|
||||
for ( ItemStack is : facades )
|
||||
for( ItemStack is : facades )
|
||||
{
|
||||
CachedShapedRecipe recipe = new CachedShapedRecipe( this.facade, anchorStack, is );
|
||||
|
||||
if ( recipe.contains( recipe.ingredients, ingredient.getItem() ) )
|
||||
if( recipe.contains( recipe.ingredients, ingredient.getItem() ) )
|
||||
{
|
||||
recipe.computeVisuals();
|
||||
if ( recipe.contains( recipe.ingredients, ingredient ) )
|
||||
if( recipe.contains( recipe.ingredients, ingredient ) )
|
||||
{
|
||||
recipe.setIngredientPermutation( recipe.ingredients, ingredient );
|
||||
this.arecipes.add( recipe );
|
||||
@@ -150,11 +150,11 @@ public class NEIFacadeRecipeHandler extends TemplateRecipeHandler
|
||||
public IRecipeOverlayRenderer getOverlayRenderer( GuiContainer gui, int recipe )
|
||||
{
|
||||
IRecipeOverlayRenderer renderer = super.getOverlayRenderer( gui, recipe );
|
||||
if ( renderer != null )
|
||||
if( renderer != null )
|
||||
return renderer;
|
||||
|
||||
IStackPositioner positioner = RecipeInfo.getStackPositioner( gui, "crafting2x2" );
|
||||
if ( positioner == null )
|
||||
if( positioner == null )
|
||||
return null;
|
||||
|
||||
return new DefaultOverlayRenderer( this.getIngredientStacks( recipe ), positioner );
|
||||
@@ -164,7 +164,7 @@ public class NEIFacadeRecipeHandler extends TemplateRecipeHandler
|
||||
public IOverlayHandler getOverlayHandler( GuiContainer gui, int recipe )
|
||||
{
|
||||
IOverlayHandler handler = super.getOverlayHandler( gui, recipe );
|
||||
if ( handler != null )
|
||||
if( handler != null )
|
||||
return handler;
|
||||
|
||||
return RecipeInfo.getOverlayHandler( gui, "crafting2x2" );
|
||||
@@ -172,9 +172,9 @@ public class NEIFacadeRecipeHandler extends TemplateRecipeHandler
|
||||
|
||||
public boolean isRecipe2x2( int recipe )
|
||||
{
|
||||
for ( PositionedStack stack : this.getIngredientStacks( recipe ) )
|
||||
for( PositionedStack stack : this.getIngredientStacks( recipe ) )
|
||||
{
|
||||
if ( ( stack.relx > 43 ) || ( stack.rely > 24 ) )
|
||||
if( ( stack.relx > 43 ) || ( stack.rely > 24 ) )
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -202,11 +202,11 @@ public class NEIFacadeRecipeHandler extends TemplateRecipeHandler
|
||||
|
||||
public void setIngredients( int width, int height, Object[] items )
|
||||
{
|
||||
for ( int x = 0; x < width; x++ )
|
||||
for( int x = 0; x < width; x++ )
|
||||
{
|
||||
for ( int y = 0; y < height; y++ )
|
||||
for( int y = 0; y < height; y++ )
|
||||
{
|
||||
if ( items[( y * width + x )] != null )
|
||||
if( items[( y * width + x )] != null )
|
||||
{
|
||||
ItemStack is = (ItemStack) items[( y * width + x )];
|
||||
PositionedStack stack = new PositionedStack( is, 25 + x * 18, 6 + y * 18, false );
|
||||
@@ -231,7 +231,7 @@ public class NEIFacadeRecipeHandler extends TemplateRecipeHandler
|
||||
|
||||
public void computeVisuals()
|
||||
{
|
||||
for ( PositionedStack p : this.ingredients )
|
||||
for( PositionedStack p : this.ingredients )
|
||||
{
|
||||
p.generatePermutations();
|
||||
}
|
||||
|
||||
@@ -18,10 +18,8 @@
|
||||
|
||||
package appeng.integration.modules.NEIHelpers;
|
||||
|
||||
import static codechicken.lib.gui.GuiDraw.changeTexture;
|
||||
import static codechicken.lib.gui.GuiDraw.drawTexturedModalRect;
|
||||
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -45,43 +43,13 @@ import appeng.api.features.IGrinderEntry;
|
||||
import appeng.client.gui.implementations.GuiGrinder;
|
||||
import appeng.core.localization.GuiText;
|
||||
|
||||
import static codechicken.lib.gui.GuiDraw.changeTexture;
|
||||
import static codechicken.lib.gui.GuiDraw.drawTexturedModalRect;
|
||||
|
||||
|
||||
public class NEIGrinderRecipeHandler extends TemplateRecipeHandler
|
||||
{
|
||||
|
||||
@Override
|
||||
public void drawBackground(int recipe)
|
||||
{
|
||||
GL11.glColor4f( 1, 1, 1, 1 );
|
||||
changeTexture( this.getGuiTexture() );
|
||||
drawTexturedModalRect( 40, 10, 75, 16 + 10, 90, 66 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawForeground(int recipe)
|
||||
{
|
||||
super.drawForeground( recipe );
|
||||
if ( this.arecipes.size() > recipe )
|
||||
{
|
||||
CachedRecipe cr = this.arecipes.get( recipe );
|
||||
if ( cr instanceof CachedGrindStoneRecipe )
|
||||
{
|
||||
CachedGrindStoneRecipe cachedRecipe = (CachedGrindStoneRecipe) cr;
|
||||
if ( cachedRecipe.hasOptional )
|
||||
{
|
||||
FontRenderer fr = Minecraft.getMinecraft().fontRenderer;
|
||||
int width = fr.getStringWidth( cachedRecipe.Chance );
|
||||
fr.drawString( cachedRecipe.Chance, (168 - width) / 2, 5, 0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
FontRenderer fr = Minecraft.getMinecraft().fontRenderer;
|
||||
int width = fr.getStringWidth( GuiText.NoSecondOutput.getLocal() );
|
||||
fr.drawString( GuiText.NoSecondOutput.getLocal(), (168 - width) / 2, 5, 0 );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadTransferRects()
|
||||
{
|
||||
@@ -89,23 +57,11 @@ public class NEIGrinderRecipeHandler extends TemplateRecipeHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends GuiContainer> getGuiClass()
|
||||
public void loadCraftingRecipes( String outputId, Object... results )
|
||||
{
|
||||
return GuiGrinder.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeName()
|
||||
{
|
||||
return GuiText.GrindStone.getLocal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(String outputId, Object... results)
|
||||
{
|
||||
if ( (outputId.equals( "grindstone" )) && (this.getClass() == NEIGrinderRecipeHandler.class) )
|
||||
if( ( outputId.equals( "grindstone" ) ) && ( this.getClass() == NEIGrinderRecipeHandler.class ) )
|
||||
{
|
||||
for (IGrinderEntry recipe : AEApi.instance().registries().grinder().getRecipes())
|
||||
for( IGrinderEntry recipe : AEApi.instance().registries().grinder().getRecipes() )
|
||||
{
|
||||
CachedGrindStoneRecipe cachedRecipe = new CachedGrindStoneRecipe( recipe );
|
||||
cachedRecipe.computeVisuals();
|
||||
@@ -119,11 +75,11 @@ public class NEIGrinderRecipeHandler extends TemplateRecipeHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(ItemStack result)
|
||||
public void loadCraftingRecipes( ItemStack result )
|
||||
{
|
||||
for (IGrinderEntry recipe : AEApi.instance().registries().grinder().getRecipes())
|
||||
for( IGrinderEntry recipe : AEApi.instance().registries().grinder().getRecipes() )
|
||||
{
|
||||
if ( NEIServerUtils.areStacksSameTypeCrafting( recipe.getOutput(), result ) )
|
||||
if( NEIServerUtils.areStacksSameTypeCrafting( recipe.getOutput(), result ) )
|
||||
{
|
||||
CachedGrindStoneRecipe cachedRecipe = new CachedGrindStoneRecipe( recipe );
|
||||
cachedRecipe.computeVisuals();
|
||||
@@ -133,16 +89,16 @@ public class NEIGrinderRecipeHandler extends TemplateRecipeHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadUsageRecipes(ItemStack ingredient)
|
||||
public void loadUsageRecipes( ItemStack ingredient )
|
||||
{
|
||||
for (IGrinderEntry recipe : AEApi.instance().registries().grinder().getRecipes())
|
||||
for( IGrinderEntry recipe : AEApi.instance().registries().grinder().getRecipes() )
|
||||
{
|
||||
CachedGrindStoneRecipe cachedRecipe = new CachedGrindStoneRecipe( recipe );
|
||||
|
||||
if ( (cachedRecipe.contains( cachedRecipe.ingredients, ingredient.getItem() )) )
|
||||
if( ( cachedRecipe.contains( cachedRecipe.ingredients, ingredient.getItem() ) ) )
|
||||
{
|
||||
cachedRecipe.computeVisuals();
|
||||
if ( cachedRecipe.contains( cachedRecipe.ingredients, ingredient ) )
|
||||
if( cachedRecipe.contains( cachedRecipe.ingredients, ingredient ) )
|
||||
{
|
||||
cachedRecipe.setIngredientPermutation( cachedRecipe.ingredients, ingredient );
|
||||
this.arecipes.add( cachedRecipe );
|
||||
@@ -165,62 +121,108 @@ public class NEIGrinderRecipeHandler extends TemplateRecipeHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasOverlay(GuiContainer gui, Container container, int recipe)
|
||||
public Class<? extends GuiContainer> getGuiClass()
|
||||
{
|
||||
return GuiGrinder.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBackground( int recipe )
|
||||
{
|
||||
GL11.glColor4f( 1, 1, 1, 1 );
|
||||
changeTexture( this.getGuiTexture() );
|
||||
drawTexturedModalRect( 40, 10, 75, 16 + 10, 90, 66 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawForeground( int recipe )
|
||||
{
|
||||
super.drawForeground( recipe );
|
||||
if( this.arecipes.size() > recipe )
|
||||
{
|
||||
CachedRecipe cr = this.arecipes.get( recipe );
|
||||
if( cr instanceof CachedGrindStoneRecipe )
|
||||
{
|
||||
CachedGrindStoneRecipe cachedRecipe = (CachedGrindStoneRecipe) cr;
|
||||
if( cachedRecipe.hasOptional )
|
||||
{
|
||||
FontRenderer fr = Minecraft.getMinecraft().fontRenderer;
|
||||
int width = fr.getStringWidth( cachedRecipe.Chance );
|
||||
fr.drawString( cachedRecipe.Chance, ( 168 - width ) / 2, 5, 0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
FontRenderer fr = Minecraft.getMinecraft().fontRenderer;
|
||||
int width = fr.getStringWidth( GuiText.NoSecondOutput.getLocal() );
|
||||
fr.drawString( GuiText.NoSecondOutput.getLocal(), ( 168 - width ) / 2, 5, 0 );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasOverlay( GuiContainer gui, Container container, int recipe )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRecipeOverlayRenderer getOverlayRenderer(GuiContainer gui, int recipe)
|
||||
public IRecipeOverlayRenderer getOverlayRenderer( GuiContainer gui, int recipe )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IOverlayHandler getOverlayHandler(GuiContainer gui, int recipe)
|
||||
public IOverlayHandler getOverlayHandler( GuiContainer gui, int recipe )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeName()
|
||||
{
|
||||
return GuiText.GrindStone.getLocal();
|
||||
}
|
||||
|
||||
public class CachedGrindStoneRecipe extends TemplateRecipeHandler.CachedRecipe
|
||||
{
|
||||
|
||||
public final ArrayList<PositionedStack> ingredients;
|
||||
public final PositionedStack result;
|
||||
|
||||
boolean hasOptional = false;
|
||||
public String Chance;
|
||||
boolean hasOptional = false;
|
||||
|
||||
public CachedGrindStoneRecipe(IGrinderEntry recipe) {
|
||||
public CachedGrindStoneRecipe( IGrinderEntry recipe )
|
||||
{
|
||||
this.result = new PositionedStack( recipe.getOutput(), -30 + 107, 47 );
|
||||
this.ingredients = new ArrayList<PositionedStack>();
|
||||
|
||||
if ( recipe.getOptionalOutput() != null )
|
||||
if( recipe.getOptionalOutput() != null )
|
||||
{
|
||||
this.hasOptional = true;
|
||||
this.Chance = ((int) (recipe.getOptionalChance() * 100)) + GuiText.OfSecondOutput.getLocal();
|
||||
this.Chance = ( (int) ( recipe.getOptionalChance() * 100 ) ) + GuiText.OfSecondOutput.getLocal();
|
||||
this.ingredients.add( new PositionedStack( recipe.getOptionalOutput(), -30 + 107 + 18, 47 ) );
|
||||
}
|
||||
|
||||
if ( recipe.getInput() != null )
|
||||
if( recipe.getInput() != null )
|
||||
this.ingredients.add( new PositionedStack( recipe.getInput(), 45, 24 ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PositionedStack> getIngredients()
|
||||
{
|
||||
return this.getCycledIngredients( NEIGrinderRecipeHandler.this.cycleticks / 20, this.ingredients );
|
||||
}
|
||||
|
||||
@Override
|
||||
public PositionedStack getResult()
|
||||
{
|
||||
return this.result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PositionedStack> getIngredients()
|
||||
{
|
||||
return this.getCycledIngredients( NEIGrinderRecipeHandler.this.cycleticks / 20, this.ingredients );
|
||||
}
|
||||
|
||||
public void computeVisuals()
|
||||
{
|
||||
for (PositionedStack p : this.ingredients)
|
||||
for( PositionedStack p : this.ingredients )
|
||||
{
|
||||
p.generatePermutations();
|
||||
}
|
||||
|
||||
+50
-47
@@ -18,10 +18,8 @@
|
||||
|
||||
package appeng.integration.modules.NEIHelpers;
|
||||
|
||||
import static codechicken.lib.gui.GuiDraw.changeTexture;
|
||||
import static codechicken.lib.gui.GuiDraw.drawTexturedModalRect;
|
||||
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -43,17 +41,13 @@ import appeng.core.localization.GuiText;
|
||||
import appeng.recipes.handlers.Inscribe;
|
||||
import appeng.recipes.handlers.Inscribe.InscriberRecipe;
|
||||
|
||||
import static codechicken.lib.gui.GuiDraw.changeTexture;
|
||||
import static codechicken.lib.gui.GuiDraw.drawTexturedModalRect;
|
||||
|
||||
|
||||
public class NEIInscriberRecipeHandler extends TemplateRecipeHandler
|
||||
{
|
||||
|
||||
@Override
|
||||
public void drawBackground(int recipe)
|
||||
{
|
||||
GL11.glColor4f( 1, 1, 1, 1 );
|
||||
changeTexture( this.getGuiTexture() );
|
||||
drawTexturedModalRect( 0, 0, 5, 11, 166, 75 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadTransferRects()
|
||||
{
|
||||
@@ -61,23 +55,11 @@ public class NEIInscriberRecipeHandler extends TemplateRecipeHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends GuiContainer> getGuiClass()
|
||||
public void loadCraftingRecipes( String outputId, Object... results )
|
||||
{
|
||||
return GuiInscriber.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeName()
|
||||
{
|
||||
return GuiText.Inscriber.getLocal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(String outputId, Object... results)
|
||||
{
|
||||
if ( (outputId.equals( "inscriber" )) && (this.getClass() == NEIInscriberRecipeHandler.class) )
|
||||
if( ( outputId.equals( "inscriber" ) ) && ( this.getClass() == NEIInscriberRecipeHandler.class ) )
|
||||
{
|
||||
for (InscriberRecipe recipe : Inscribe.RECIPES )
|
||||
for( InscriberRecipe recipe : Inscribe.RECIPES )
|
||||
{
|
||||
CachedInscriberRecipe cachedRecipe = new CachedInscriberRecipe( recipe );
|
||||
cachedRecipe.computeVisuals();
|
||||
@@ -91,11 +73,11 @@ public class NEIInscriberRecipeHandler extends TemplateRecipeHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(ItemStack result)
|
||||
public void loadCraftingRecipes( ItemStack result )
|
||||
{
|
||||
for (InscriberRecipe recipe : Inscribe.RECIPES )
|
||||
for( InscriberRecipe recipe : Inscribe.RECIPES )
|
||||
{
|
||||
if ( NEIServerUtils.areStacksSameTypeCrafting( recipe.output, result ) )
|
||||
if( NEIServerUtils.areStacksSameTypeCrafting( recipe.output, result ) )
|
||||
{
|
||||
CachedInscriberRecipe cachedRecipe = new CachedInscriberRecipe( recipe );
|
||||
cachedRecipe.computeVisuals();
|
||||
@@ -105,16 +87,16 @@ public class NEIInscriberRecipeHandler extends TemplateRecipeHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadUsageRecipes(ItemStack ingredient)
|
||||
public void loadUsageRecipes( ItemStack ingredient )
|
||||
{
|
||||
for (InscriberRecipe recipe : Inscribe.RECIPES )
|
||||
for( InscriberRecipe recipe : Inscribe.RECIPES )
|
||||
{
|
||||
CachedInscriberRecipe cachedRecipe = new CachedInscriberRecipe( recipe );
|
||||
|
||||
if ( (cachedRecipe.contains( cachedRecipe.ingredients, ingredient.getItem() )) )
|
||||
if( ( cachedRecipe.contains( cachedRecipe.ingredients, ingredient.getItem() ) ) )
|
||||
{
|
||||
cachedRecipe.computeVisuals();
|
||||
if ( cachedRecipe.contains( cachedRecipe.ingredients, ingredient ) )
|
||||
if( cachedRecipe.contains( cachedRecipe.ingredients, ingredient ) )
|
||||
{
|
||||
cachedRecipe.setIngredientPermutation( cachedRecipe.ingredients, ingredient );
|
||||
this.arecipes.add( cachedRecipe );
|
||||
@@ -137,58 +119,79 @@ public class NEIInscriberRecipeHandler extends TemplateRecipeHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasOverlay(GuiContainer gui, Container container, int recipe)
|
||||
public Class<? extends GuiContainer> getGuiClass()
|
||||
{
|
||||
return GuiInscriber.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBackground( int recipe )
|
||||
{
|
||||
GL11.glColor4f( 1, 1, 1, 1 );
|
||||
changeTexture( this.getGuiTexture() );
|
||||
drawTexturedModalRect( 0, 0, 5, 11, 166, 75 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasOverlay( GuiContainer gui, Container container, int recipe )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRecipeOverlayRenderer getOverlayRenderer(GuiContainer gui, int recipe)
|
||||
public IRecipeOverlayRenderer getOverlayRenderer( GuiContainer gui, int recipe )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IOverlayHandler getOverlayHandler(GuiContainer gui, int recipe)
|
||||
public IOverlayHandler getOverlayHandler( GuiContainer gui, int recipe )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeName()
|
||||
{
|
||||
return GuiText.Inscriber.getLocal();
|
||||
}
|
||||
|
||||
public class CachedInscriberRecipe extends TemplateRecipeHandler.CachedRecipe
|
||||
{
|
||||
|
||||
public final ArrayList<PositionedStack> ingredients;
|
||||
public final PositionedStack result;
|
||||
|
||||
public CachedInscriberRecipe(InscriberRecipe recipe) {
|
||||
public CachedInscriberRecipe( InscriberRecipe recipe )
|
||||
{
|
||||
this.result = new PositionedStack( recipe.output, 108, 29 );
|
||||
this.ingredients = new ArrayList<PositionedStack>();
|
||||
|
||||
if ( recipe.plateA != null )
|
||||
if( recipe.plateA != null )
|
||||
this.ingredients.add( new PositionedStack( recipe.plateA, 40, 5 ) );
|
||||
|
||||
if ( recipe.imprintable != null )
|
||||
if( recipe.imprintable != null )
|
||||
this.ingredients.add( new PositionedStack( recipe.imprintable, 40 + 18, 28 ) );
|
||||
|
||||
if ( recipe.plateB != null )
|
||||
if( recipe.plateB != null )
|
||||
this.ingredients.add( new PositionedStack( recipe.plateB, 40, 51 ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PositionedStack> getIngredients()
|
||||
{
|
||||
return this.getCycledIngredients( NEIInscriberRecipeHandler.this.cycleticks / 20, this.ingredients );
|
||||
}
|
||||
|
||||
@Override
|
||||
public PositionedStack getResult()
|
||||
{
|
||||
return this.result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PositionedStack> getIngredients()
|
||||
{
|
||||
return this.getCycledIngredients( NEIInscriberRecipeHandler.this.cycleticks / 20, this.ingredients );
|
||||
}
|
||||
|
||||
public void computeVisuals()
|
||||
{
|
||||
for (PositionedStack p : this.ingredients)
|
||||
for( PositionedStack p : this.ingredients )
|
||||
{
|
||||
p.generatePermutations();
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package appeng.integration.modules.NEIHelpers;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
@@ -48,6 +49,7 @@ import appeng.core.AEConfig;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.localization.GuiText;
|
||||
|
||||
|
||||
public class NEIWorldCraftingHandler implements ICraftingHandler, IUsageHandler
|
||||
{
|
||||
|
||||
@@ -57,61 +59,6 @@ public class NEIWorldCraftingHandler implements ICraftingHandler, IUsageHandler
|
||||
|
||||
private ItemStack target;
|
||||
|
||||
private void addRecipe(IItemDefinition def, String msg)
|
||||
{
|
||||
for ( ItemStack definitionStack : def.maybeStack( 1 ).asSet() )
|
||||
{
|
||||
if ( NEIServerUtils.areStacksSameTypeCrafting( definitionStack, this.target ) )
|
||||
{
|
||||
this.offsets.add( def );
|
||||
this.outputs.add( new PositionedStack( definitionStack, 75, 4 ) );
|
||||
this.details.put( def, msg );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void addRecipes()
|
||||
{
|
||||
final IDefinitions definitions = AEApi.instance().definitions();
|
||||
final IMaterials materials = definitions.materials();
|
||||
|
||||
final String message;
|
||||
if ( AEConfig.instance.isFeatureEnabled( AEFeature.CertusQuartzWorldGen ) )
|
||||
{
|
||||
message = GuiText.ChargedQuartz.getLocal() + "\n\n" + GuiText.ChargedQuartzFind.getLocal();
|
||||
}
|
||||
else
|
||||
{
|
||||
message = GuiText.ChargedQuartzFind.getLocal();
|
||||
}
|
||||
|
||||
this.addRecipe( materials.certusQuartzCrystalCharged(), message );
|
||||
|
||||
if ( AEConfig.instance.isFeatureEnabled( AEFeature.MeteoriteWorldGen ) )
|
||||
{
|
||||
this.addRecipe( materials.logicProcessorPress(), GuiText.inWorldCraftingPresses.getLocal() );
|
||||
this.addRecipe( materials.calcProcessorPress(), GuiText.inWorldCraftingPresses.getLocal() );
|
||||
this.addRecipe( materials.engProcessorPress(), GuiText.inWorldCraftingPresses.getLocal() );
|
||||
}
|
||||
|
||||
if ( AEConfig.instance.isFeatureEnabled( AEFeature.inWorldFluix ) )
|
||||
{
|
||||
this.addRecipe( materials.fluixCrystal(), GuiText.inWorldFluix.getLocal() );
|
||||
}
|
||||
|
||||
if ( AEConfig.instance.isFeatureEnabled( AEFeature.inWorldSingularity ) )
|
||||
{
|
||||
this.addRecipe( materials.qESingularity(), GuiText.inWorldSingularity.getLocal() );
|
||||
}
|
||||
|
||||
if ( AEConfig.instance.isFeatureEnabled( AEFeature.inWorldPurification ) )
|
||||
{
|
||||
this.addRecipe( materials.purifiedCertusQuartzCrystal(), GuiText.inWorldPurificationCertus.getLocal() );
|
||||
this.addRecipe( materials.purifiedNetherQuartzCrystal(), GuiText.inWorldPurificationNether.getLocal() );
|
||||
this.addRecipe( materials.purifiedFluixCrystal(), GuiText.inWorldPurificationFluix.getLocal() );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeName()
|
||||
{
|
||||
@@ -125,15 +72,15 @@ public class NEIWorldCraftingHandler implements ICraftingHandler, IUsageHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBackground(int recipe)
|
||||
public void drawBackground( int recipe )
|
||||
{
|
||||
GL11.glColor4f( 1, 1, 1, 1 );// nothing.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawForeground(int recipe)
|
||||
public void drawForeground( int recipe )
|
||||
{
|
||||
if ( this.outputs.size() > recipe )
|
||||
if( this.outputs.size() > recipe )
|
||||
{
|
||||
// PositionedStack cr = this.outputs.get( recipe );
|
||||
String details = this.details.get( this.offsets.get( recipe ) );
|
||||
@@ -144,19 +91,19 @@ public class NEIWorldCraftingHandler implements ICraftingHandler, IUsageHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PositionedStack> getIngredientStacks(int recipeIndex)
|
||||
public List<PositionedStack> getIngredientStacks( int recipeIndex )
|
||||
{
|
||||
return new ArrayList<PositionedStack>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PositionedStack> getOtherStacks(int recipeIndex)
|
||||
public List<PositionedStack> getOtherStacks( int recipeIndex )
|
||||
{
|
||||
return new ArrayList<PositionedStack>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PositionedStack getResultStack(int recipe)
|
||||
public PositionedStack getResultStack( int recipe )
|
||||
{
|
||||
return this.outputs.get( recipe );
|
||||
}
|
||||
@@ -168,19 +115,19 @@ public class NEIWorldCraftingHandler implements ICraftingHandler, IUsageHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasOverlay(GuiContainer gui, Container container, int recipe)
|
||||
public boolean hasOverlay( GuiContainer gui, Container container, int recipe )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRecipeOverlayRenderer getOverlayRenderer(GuiContainer gui, int recipe)
|
||||
public IRecipeOverlayRenderer getOverlayRenderer( GuiContainer gui, int recipe )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IOverlayHandler getOverlayHandler(GuiContainer gui, int recipe)
|
||||
public IOverlayHandler getOverlayHandler( GuiContainer gui, int recipe )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
@@ -192,52 +139,40 @@ public class NEIWorldCraftingHandler implements ICraftingHandler, IUsageHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> handleTooltip(GuiRecipe gui, List<String> currentToolTip, int recipe)
|
||||
public List<String> handleTooltip( GuiRecipe gui, List<String> currentToolTip, int recipe )
|
||||
{
|
||||
return currentToolTip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> handleItemTooltip(GuiRecipe gui, ItemStack stack, List<String> currentToolTip, int recipe)
|
||||
public List<String> handleItemTooltip( GuiRecipe gui, ItemStack stack, List<String> currentToolTip, int recipe )
|
||||
{
|
||||
return currentToolTip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean keyTyped(GuiRecipe gui, char keyChar, int keyCode, int recipe)
|
||||
public boolean keyTyped( GuiRecipe gui, char keyChar, int keyCode, int recipe )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean mouseClicked(GuiRecipe gui, int button, int recipe)
|
||||
public boolean mouseClicked( GuiRecipe gui, int button, int recipe )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public NEIWorldCraftingHandler newInstance()
|
||||
{
|
||||
try
|
||||
{
|
||||
return this.getClass().newInstance();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new RuntimeException( e );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IUsageHandler getUsageHandler(String inputId, Object... ingredients)
|
||||
public IUsageHandler getUsageHandler( String inputId, Object... ingredients )
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ICraftingHandler getRecipeHandler(String outputId, Object... results)
|
||||
public ICraftingHandler getRecipeHandler( String outputId, Object... results )
|
||||
{
|
||||
NEIWorldCraftingHandler g = this.newInstance();
|
||||
if ( results.length > 0 && results[0] instanceof ItemStack )
|
||||
if( results.length > 0 && results[0] instanceof ItemStack )
|
||||
{
|
||||
g.target = (ItemStack) results[0];
|
||||
g.addRecipes();
|
||||
@@ -246,4 +181,70 @@ public class NEIWorldCraftingHandler implements ICraftingHandler, IUsageHandler
|
||||
return this;
|
||||
}
|
||||
|
||||
public NEIWorldCraftingHandler newInstance()
|
||||
{
|
||||
try
|
||||
{
|
||||
return this.getClass().newInstance();
|
||||
}
|
||||
catch( Exception e )
|
||||
{
|
||||
throw new RuntimeException( e );
|
||||
}
|
||||
}
|
||||
|
||||
private void addRecipes()
|
||||
{
|
||||
final IDefinitions definitions = AEApi.instance().definitions();
|
||||
final IMaterials materials = definitions.materials();
|
||||
|
||||
final String message;
|
||||
if( AEConfig.instance.isFeatureEnabled( AEFeature.CertusQuartzWorldGen ) )
|
||||
{
|
||||
message = GuiText.ChargedQuartz.getLocal() + "\n\n" + GuiText.ChargedQuartzFind.getLocal();
|
||||
}
|
||||
else
|
||||
{
|
||||
message = GuiText.ChargedQuartzFind.getLocal();
|
||||
}
|
||||
|
||||
this.addRecipe( materials.certusQuartzCrystalCharged(), message );
|
||||
|
||||
if( AEConfig.instance.isFeatureEnabled( AEFeature.MeteoriteWorldGen ) )
|
||||
{
|
||||
this.addRecipe( materials.logicProcessorPress(), GuiText.inWorldCraftingPresses.getLocal() );
|
||||
this.addRecipe( materials.calcProcessorPress(), GuiText.inWorldCraftingPresses.getLocal() );
|
||||
this.addRecipe( materials.engProcessorPress(), GuiText.inWorldCraftingPresses.getLocal() );
|
||||
}
|
||||
|
||||
if( AEConfig.instance.isFeatureEnabled( AEFeature.inWorldFluix ) )
|
||||
{
|
||||
this.addRecipe( materials.fluixCrystal(), GuiText.inWorldFluix.getLocal() );
|
||||
}
|
||||
|
||||
if( AEConfig.instance.isFeatureEnabled( AEFeature.inWorldSingularity ) )
|
||||
{
|
||||
this.addRecipe( materials.qESingularity(), GuiText.inWorldSingularity.getLocal() );
|
||||
}
|
||||
|
||||
if( AEConfig.instance.isFeatureEnabled( AEFeature.inWorldPurification ) )
|
||||
{
|
||||
this.addRecipe( materials.purifiedCertusQuartzCrystal(), GuiText.inWorldPurificationCertus.getLocal() );
|
||||
this.addRecipe( materials.purifiedNetherQuartzCrystal(), GuiText.inWorldPurificationNether.getLocal() );
|
||||
this.addRecipe( materials.purifiedFluixCrystal(), GuiText.inWorldPurificationFluix.getLocal() );
|
||||
}
|
||||
}
|
||||
|
||||
private void addRecipe( IItemDefinition def, String msg )
|
||||
{
|
||||
for( ItemStack definitionStack : def.maybeStack( 1 ).asSet() )
|
||||
{
|
||||
if( NEIServerUtils.areStacksSameTypeCrafting( definitionStack, this.target ) )
|
||||
{
|
||||
this.offsets.add( def );
|
||||
this.outputs.add( new PositionedStack( definitionStack, 75, 4 ) );
|
||||
this.details.put( def, msg );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package appeng.integration.modules.NEIHelpers;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import codechicken.nei.PositionedStack;
|
||||
@@ -25,19 +26,19 @@ import codechicken.nei.api.IStackPositioner;
|
||||
|
||||
import appeng.client.gui.implementations.GuiMEMonitorable;
|
||||
|
||||
|
||||
public class TerminalCraftingSlotFinder implements IStackPositioner
|
||||
{
|
||||
|
||||
@Override
|
||||
public ArrayList<PositionedStack> positionStacks(ArrayList<PositionedStack> a)
|
||||
public ArrayList<PositionedStack> positionStacks( ArrayList<PositionedStack> a )
|
||||
{
|
||||
for (PositionedStack ps : a)
|
||||
if ( ps != null )
|
||||
for( PositionedStack ps : a )
|
||||
if( ps != null )
|
||||
{
|
||||
ps.relx += GuiMEMonitorable.CraftingGridOffsetX;
|
||||
ps.rely += GuiMEMonitorable.CraftingGridOffsetY;
|
||||
}
|
||||
return a;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package appeng.integration.modules;
|
||||
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
@@ -26,15 +27,39 @@ import rblocks.api.IOrientable;
|
||||
import appeng.integration.BaseModule;
|
||||
import appeng.integration.abstraction.IRB;
|
||||
|
||||
|
||||
public class RB extends BaseModule implements IRB
|
||||
{
|
||||
|
||||
public static RB instance;
|
||||
|
||||
@Override
|
||||
public void init() throws Throwable
|
||||
{
|
||||
this.testClassExistence( IOrientable.class );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public appeng.api.util.IOrientable getOrientable( TileEntity te )
|
||||
{
|
||||
if( te instanceof IOrientable )
|
||||
return new RBWrapper( (IOrientable) te );
|
||||
return null;
|
||||
}
|
||||
|
||||
private class RBWrapper implements appeng.api.util.IOrientable
|
||||
{
|
||||
|
||||
final private IOrientable internal;
|
||||
|
||||
public RBWrapper(IOrientable ww) {
|
||||
public RBWrapper( IOrientable ww )
|
||||
{
|
||||
this.internal = ww;
|
||||
}
|
||||
|
||||
@@ -57,33 +82,9 @@ public class RB extends BaseModule implements IRB
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOrientation(ForgeDirection Forward, ForgeDirection Up)
|
||||
public void setOrientation( ForgeDirection Forward, ForgeDirection Up )
|
||||
{
|
||||
this.internal.setOrientation( Forward, Up );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static RB instance;
|
||||
|
||||
@Override
|
||||
public void init() throws Throwable
|
||||
{
|
||||
this.testClassExistence( IOrientable.class );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public appeng.api.util.IOrientable getOrientable(TileEntity te)
|
||||
{
|
||||
if ( te instanceof IOrientable )
|
||||
return new RBWrapper( (IOrientable) te );
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package appeng.integration.modules;
|
||||
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import mods.railcraft.api.crafting.IRockCrusherRecipe;
|
||||
@@ -26,23 +27,25 @@ import mods.railcraft.api.crafting.RailcraftCraftingManager;
|
||||
import appeng.integration.BaseModule;
|
||||
import appeng.integration.abstraction.IRC;
|
||||
|
||||
|
||||
public class RC extends BaseModule implements IRC
|
||||
{
|
||||
|
||||
public static RC instance;
|
||||
|
||||
public RC()
|
||||
{
|
||||
this.testClassExistence( RailcraftCraftingManager.class );
|
||||
this.testClassExistence( IRockCrusherRecipe.class );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void rockCrusher(ItemStack input, ItemStack output)
|
||||
public void rockCrusher( ItemStack input, ItemStack output )
|
||||
{
|
||||
IRockCrusherRecipe re = RailcraftCraftingManager.rockCrusher.createNewRecipe( input, true, true );
|
||||
re.addOutput( output, 1.0f );
|
||||
}
|
||||
|
||||
public RC() {
|
||||
this.testClassExistence( RailcraftCraftingManager.class );
|
||||
this.testClassExistence( IRockCrusherRecipe.class );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init()
|
||||
{
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package appeng.integration.modules;
|
||||
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
@@ -27,12 +28,14 @@ import appeng.api.AEApi;
|
||||
import appeng.api.config.TunnelType;
|
||||
import appeng.integration.BaseModule;
|
||||
|
||||
|
||||
public class RF extends BaseModule
|
||||
{
|
||||
|
||||
public static RF instance;
|
||||
|
||||
public RF() {
|
||||
public RF()
|
||||
{
|
||||
this.testClassExistence( cofh.api.energy.IEnergyReceiver.class );
|
||||
this.testClassExistence( cofh.api.energy.IEnergyProvider.class );
|
||||
this.testClassExistence( cofh.api.energy.IEnergyHandler.class );
|
||||
@@ -44,16 +47,6 @@ public class RF extends BaseModule
|
||||
{
|
||||
}
|
||||
|
||||
void RFStack(String mod, String name, int dmg)
|
||||
{
|
||||
ItemStack modItem = GameRegistry.findItemStack( mod, name, 1 );
|
||||
if ( modItem != null )
|
||||
{
|
||||
modItem.setItemDamage( dmg );
|
||||
AEApi.instance().registries().p2pTunnel().addNewAttunement( modItem, TunnelType.RF_POWER );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit()
|
||||
{
|
||||
@@ -70,4 +63,13 @@ public class RF extends BaseModule
|
||||
this.RFStack( "EnderIO", "blockPowerMonitor", 0 );
|
||||
}
|
||||
|
||||
void RFStack( String mod, String name, int dmg )
|
||||
{
|
||||
ItemStack modItem = GameRegistry.findItemStack( mod, name, 1 );
|
||||
if( modItem != null )
|
||||
{
|
||||
modItem.setItemDamage( dmg );
|
||||
AEApi.instance().registries().p2pTunnel().addNewAttunement( modItem, TunnelType.RF_POWER );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,14 +18,17 @@
|
||||
|
||||
package appeng.integration.modules;
|
||||
|
||||
|
||||
import appeng.integration.BaseModule;
|
||||
|
||||
|
||||
public class RFItem extends BaseModule
|
||||
{
|
||||
|
||||
public static RFItem instance;
|
||||
|
||||
public RFItem() {
|
||||
public RFItem()
|
||||
{
|
||||
this.testClassExistence( cofh.api.energy.IEnergyContainerItem.class );
|
||||
}
|
||||
|
||||
@@ -40,5 +43,4 @@ public class RFItem extends BaseModule
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -46,11 +46,11 @@ public class BSCrate implements IMEInventory<IAEItemStack>
|
||||
@Override
|
||||
public IAEItemStack injectItems( IAEItemStack input, Actionable mode, BaseActionSource src )
|
||||
{
|
||||
if ( mode == Actionable.SIMULATE )
|
||||
if( mode == Actionable.SIMULATE )
|
||||
return null;
|
||||
|
||||
ItemStack failed = this.crateStorage.insertItems( input.getItemStack() );
|
||||
if ( failed == null )
|
||||
if( failed == null )
|
||||
return null;
|
||||
input.setStackSize( failed.stackSize );
|
||||
return input;
|
||||
@@ -59,7 +59,7 @@ public class BSCrate implements IMEInventory<IAEItemStack>
|
||||
@Override
|
||||
public IAEItemStack extractItems( IAEItemStack request, Actionable mode, BaseActionSource src )
|
||||
{
|
||||
if ( mode == Actionable.SIMULATE )
|
||||
if( mode == Actionable.SIMULATE )
|
||||
{
|
||||
int howMany = this.crateStorage.getItemCount( request.getItemStack() );
|
||||
return howMany > request.getStackSize() ? request : request.copy().setStackSize( howMany );
|
||||
@@ -72,7 +72,7 @@ public class BSCrate implements IMEInventory<IAEItemStack>
|
||||
@Override
|
||||
public IItemList getAvailableItems( IItemList out )
|
||||
{
|
||||
for ( ItemStack is : this.crateStorage.getContents() )
|
||||
for( ItemStack is : this.crateStorage.getContents() )
|
||||
{
|
||||
out.add( AEItemStack.create( is ) );
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package appeng.integration.modules.helpers;
|
||||
|
||||
|
||||
import net.mcft.copy.betterstorage.api.crate.ICrateStorage;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
@@ -27,21 +28,21 @@ import appeng.api.storage.IExternalStorageHandler;
|
||||
import appeng.api.storage.IMEInventory;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
|
||||
|
||||
public class BSCrateHandler implements IExternalStorageHandler
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean canHandle(TileEntity te, ForgeDirection d, StorageChannel channel, BaseActionSource mySrc)
|
||||
public boolean canHandle( TileEntity te, ForgeDirection d, StorageChannel channel, BaseActionSource mySrc )
|
||||
{
|
||||
return channel == StorageChannel.ITEMS && te instanceof ICrateStorage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMEInventory getInventory(TileEntity te, ForgeDirection d, StorageChannel channel, BaseActionSource src)
|
||||
public IMEInventory getInventory( TileEntity te, ForgeDirection d, StorageChannel channel, BaseActionSource src )
|
||||
{
|
||||
if ( channel == StorageChannel.ITEMS )
|
||||
if( channel == StorageChannel.ITEMS )
|
||||
return new BSCrate( te, ForgeDirection.UNKNOWN );
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package appeng.integration.modules.helpers;
|
||||
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
import net.mcft.copy.betterstorage.api.crate.ICrateStorage;
|
||||
@@ -31,29 +32,31 @@ import appeng.util.inv.IInventoryDestination;
|
||||
import appeng.util.inv.ItemSlot;
|
||||
import appeng.util.iterators.StackToSlotIterator;
|
||||
|
||||
|
||||
public class BSCrateStorageAdaptor extends InventoryAdaptor
|
||||
{
|
||||
|
||||
final ICrateStorage cs;
|
||||
final ForgeDirection side;
|
||||
|
||||
public BSCrateStorageAdaptor(Object te, ForgeDirection d) {
|
||||
public BSCrateStorageAdaptor( Object te, ForgeDirection d )
|
||||
{
|
||||
this.cs = (ICrateStorage) te;
|
||||
this.side = d;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack removeItems(int amount, ItemStack filter, IInventoryDestination destination)
|
||||
public ItemStack removeItems( int amount, ItemStack filter, IInventoryDestination destination )
|
||||
{
|
||||
ItemStack target = null;
|
||||
|
||||
for (ItemStack is : this.cs.getContents())
|
||||
for( ItemStack is : this.cs.getContents() )
|
||||
{
|
||||
if ( is != null )
|
||||
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 ) )
|
||||
if( destination == null || destination.canInsert( is ) )
|
||||
{
|
||||
target = is;
|
||||
break;
|
||||
@@ -62,7 +65,7 @@ public class BSCrateStorageAdaptor extends InventoryAdaptor
|
||||
}
|
||||
}
|
||||
|
||||
if ( target != null )
|
||||
if( target != null )
|
||||
{
|
||||
ItemStack f = Platform.cloneItemStack( target );
|
||||
f.stackSize = amount;
|
||||
@@ -73,17 +76,17 @@ public class BSCrateStorageAdaptor extends InventoryAdaptor
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack simulateRemove(int amount, ItemStack filter, IInventoryDestination destination)
|
||||
public ItemStack simulateRemove( int amount, ItemStack filter, IInventoryDestination destination )
|
||||
{
|
||||
ItemStack target = null;
|
||||
|
||||
for (ItemStack is : this.cs.getContents())
|
||||
for( ItemStack is : this.cs.getContents() )
|
||||
{
|
||||
if ( is != null )
|
||||
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 ) )
|
||||
if( destination == null || destination.canInsert( is ) )
|
||||
{
|
||||
target = is;
|
||||
break;
|
||||
@@ -92,12 +95,12 @@ public class BSCrateStorageAdaptor extends InventoryAdaptor
|
||||
}
|
||||
}
|
||||
|
||||
if ( target != null )
|
||||
if( target != null )
|
||||
{
|
||||
int cnt = this.cs.getItemCount( target );
|
||||
if ( cnt == 0 )
|
||||
if( cnt == 0 )
|
||||
return null;
|
||||
if ( cnt > amount )
|
||||
if( cnt > amount )
|
||||
cnt = amount;
|
||||
ItemStack c = target.copy();
|
||||
c.stackSize = cnt;
|
||||
@@ -108,17 +111,17 @@ public class BSCrateStorageAdaptor extends InventoryAdaptor
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack removeSimilarItems(int amount, ItemStack filter, FuzzyMode fuzzyMode, IInventoryDestination destination)
|
||||
public ItemStack removeSimilarItems( int amount, ItemStack filter, FuzzyMode fuzzyMode, IInventoryDestination destination )
|
||||
{
|
||||
ItemStack target = null;
|
||||
|
||||
for (ItemStack is : this.cs.getContents())
|
||||
for( ItemStack is : this.cs.getContents() )
|
||||
{
|
||||
if ( is != null )
|
||||
if( is != null )
|
||||
{
|
||||
if ( is.stackSize > 0 && (filter == null || Platform.isSameItemFuzzy( filter, is, fuzzyMode )) )
|
||||
if( is.stackSize > 0 && ( filter == null || Platform.isSameItemFuzzy( filter, is, fuzzyMode ) ) )
|
||||
{
|
||||
if ( destination == null || destination.canInsert( is ) )
|
||||
if( destination == null || destination.canInsert( is ) )
|
||||
{
|
||||
target = is;
|
||||
break;
|
||||
@@ -127,7 +130,7 @@ public class BSCrateStorageAdaptor extends InventoryAdaptor
|
||||
}
|
||||
}
|
||||
|
||||
if ( target != null )
|
||||
if( target != null )
|
||||
{
|
||||
ItemStack f = Platform.cloneItemStack( target );
|
||||
f.stackSize = amount;
|
||||
@@ -138,17 +141,17 @@ public class BSCrateStorageAdaptor extends InventoryAdaptor
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack simulateSimilarRemove(int amount, ItemStack filter, FuzzyMode fuzzyMode, IInventoryDestination destination)
|
||||
public ItemStack simulateSimilarRemove( int amount, ItemStack filter, FuzzyMode fuzzyMode, IInventoryDestination destination )
|
||||
{
|
||||
ItemStack target = null;
|
||||
|
||||
for (ItemStack is : this.cs.getContents())
|
||||
for( ItemStack is : this.cs.getContents() )
|
||||
{
|
||||
if ( is != null )
|
||||
if( is != null )
|
||||
{
|
||||
if ( is.stackSize > 0 && (filter == null || Platform.isSameItemFuzzy( filter, is, fuzzyMode )) )
|
||||
if( is.stackSize > 0 && ( filter == null || Platform.isSameItemFuzzy( filter, is, fuzzyMode ) ) )
|
||||
{
|
||||
if ( destination == null || destination.canInsert( is ) )
|
||||
if( destination == null || destination.canInsert( is ) )
|
||||
{
|
||||
target = is;
|
||||
break;
|
||||
@@ -157,12 +160,12 @@ public class BSCrateStorageAdaptor extends InventoryAdaptor
|
||||
}
|
||||
}
|
||||
|
||||
if ( target != null )
|
||||
if( target != null )
|
||||
{
|
||||
int cnt = this.cs.getItemCount( target );
|
||||
if ( cnt == 0 )
|
||||
if( cnt == 0 )
|
||||
return null;
|
||||
if ( cnt > amount )
|
||||
if( cnt > amount )
|
||||
cnt = amount;
|
||||
ItemStack c = target.copy();
|
||||
c.stackSize = cnt;
|
||||
@@ -173,17 +176,17 @@ public class BSCrateStorageAdaptor extends InventoryAdaptor
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack addItems(ItemStack toBeAdded )
|
||||
public ItemStack addItems( ItemStack toBeAdded )
|
||||
{
|
||||
return this.cs.insertItems( toBeAdded );
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack simulateAdd(ItemStack toBeSimulated )
|
||||
public ItemStack simulateAdd( ItemStack toBeSimulated )
|
||||
{
|
||||
int items = this.cs.getSpaceForItem( toBeSimulated );
|
||||
ItemStack B = Platform.cloneItemStack( toBeSimulated );
|
||||
if ( toBeSimulated.stackSize <= items )
|
||||
if( toBeSimulated.stackSize <= items )
|
||||
return null;
|
||||
B.stackSize -= items;
|
||||
return B;
|
||||
@@ -200,5 +203,4 @@ public class BSCrateStorageAdaptor extends InventoryAdaptor
|
||||
{
|
||||
return new StackToSlotIterator( this.cs.getContents().iterator() );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,17 +18,19 @@
|
||||
|
||||
package appeng.integration.modules.helpers;
|
||||
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
|
||||
|
||||
public class FMPPacketEvent extends Event
|
||||
{
|
||||
|
||||
public final EntityPlayerMP sender;
|
||||
|
||||
public FMPPacketEvent(EntityPlayerMP sender) {
|
||||
public FMPPacketEvent( EntityPlayerMP sender )
|
||||
{
|
||||
this.sender = sender;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package appeng.integration.modules.helpers;
|
||||
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
@@ -30,39 +31,76 @@ import appeng.api.storage.data.IItemList;
|
||||
import appeng.integration.abstraction.IFZ;
|
||||
import appeng.util.item.AEItemStack;
|
||||
|
||||
|
||||
public class FactorizationBarrel implements IMEInventory<IAEItemStack>
|
||||
{
|
||||
|
||||
private final TileEntity te;
|
||||
final IFZ fProxy;
|
||||
private final TileEntity te;
|
||||
|
||||
public FactorizationBarrel(IFZ proxy, TileEntity tile) {
|
||||
public FactorizationBarrel( IFZ proxy, TileEntity tile )
|
||||
{
|
||||
this.te = tile;
|
||||
this.fProxy = proxy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public StorageChannel getChannel()
|
||||
{
|
||||
return StorageChannel.ITEMS;
|
||||
}
|
||||
|
||||
public long remainingItemTypes()
|
||||
{
|
||||
return this.fProxy.barrelGetItem( this.te ) == null ? 1 : 0;
|
||||
}
|
||||
|
||||
public long remainingItemCount()
|
||||
{
|
||||
return this.fProxy.barrelGetMaxItemCount( this.te ) - this.fProxy.barrelGetItemCount( this.te );
|
||||
}
|
||||
|
||||
public boolean containsItemType(IAEItemStack i, boolean acceptEmpty)
|
||||
@Override
|
||||
public IAEItemStack injectItems( IAEItemStack input, Actionable mode, BaseActionSource src )
|
||||
{
|
||||
if( input == null )
|
||||
return null;
|
||||
if( input.getStackSize() == 0 )
|
||||
return null;
|
||||
|
||||
ItemStack shared = input.getItemStack();
|
||||
if( shared.isItemDamaged() )
|
||||
return input;
|
||||
|
||||
if( this.remainingItemTypes() > 0 )
|
||||
{
|
||||
if( mode == Actionable.MODULATE )
|
||||
this.fProxy.setItemType( this.te, input.getItemStack() );
|
||||
}
|
||||
|
||||
if( this.containsItemType( input, mode == Actionable.SIMULATE ) )
|
||||
{
|
||||
int max = this.fProxy.barrelGetMaxItemCount( this.te );
|
||||
int newTotal = (int) this.storedItemCount() + (int) input.getStackSize();
|
||||
if( newTotal > max )
|
||||
{
|
||||
if( mode == Actionable.MODULATE )
|
||||
this.fProxy.barrelSetCount( this.te, max );
|
||||
IAEItemStack result = input.copy();
|
||||
result.setStackSize( newTotal - max );
|
||||
return result;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( mode == Actionable.MODULATE )
|
||||
this.fProxy.barrelSetCount( this.te, newTotal );
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
return input;
|
||||
}
|
||||
|
||||
public long remainingItemTypes()
|
||||
{
|
||||
return this.fProxy.barrelGetItem( this.te ) == null ? 1 : 0;
|
||||
}
|
||||
|
||||
public boolean containsItemType( IAEItemStack i, boolean acceptEmpty )
|
||||
{
|
||||
ItemStack currentItem = this.fProxy.barrelGetItem( this.te );
|
||||
|
||||
// empty barrels want your love too!
|
||||
if ( acceptEmpty && currentItem == null )
|
||||
if( acceptEmpty && currentItem == null )
|
||||
return true;
|
||||
|
||||
return i.equals( currentItem );
|
||||
@@ -74,55 +112,14 @@ public class FactorizationBarrel implements IMEInventory<IAEItemStack>
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEItemStack injectItems(IAEItemStack input, Actionable mode, BaseActionSource src)
|
||||
public IAEItemStack extractItems( IAEItemStack request, Actionable mode, BaseActionSource src )
|
||||
{
|
||||
if ( input == null )
|
||||
return null;
|
||||
if ( input.getStackSize() == 0 )
|
||||
return null;
|
||||
|
||||
ItemStack shared = input.getItemStack();
|
||||
if ( shared.isItemDamaged() )
|
||||
return input;
|
||||
|
||||
if ( this.remainingItemTypes() > 0 )
|
||||
{
|
||||
if ( mode == Actionable.MODULATE )
|
||||
this.fProxy.setItemType( this.te, input.getItemStack() );
|
||||
}
|
||||
|
||||
if ( this.containsItemType( input, mode == Actionable.SIMULATE ) )
|
||||
{
|
||||
int max = this.fProxy.barrelGetMaxItemCount( this.te );
|
||||
int newTotal = (int) this.storedItemCount() + (int) input.getStackSize();
|
||||
if ( newTotal > max )
|
||||
{
|
||||
if ( mode == Actionable.MODULATE )
|
||||
this.fProxy.barrelSetCount( this.te, max );
|
||||
IAEItemStack result = input.copy();
|
||||
result.setStackSize( newTotal - max );
|
||||
return result;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( mode == Actionable.MODULATE )
|
||||
this.fProxy.barrelSetCount( this.te, newTotal );
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
return input;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEItemStack extractItems(IAEItemStack request, Actionable mode, BaseActionSource src)
|
||||
{
|
||||
if ( this.containsItemType( request, false ) )
|
||||
if( this.containsItemType( request, false ) )
|
||||
{
|
||||
int howMany = (int) this.storedItemCount();
|
||||
if ( request.getStackSize() >= howMany )
|
||||
if( request.getStackSize() >= howMany )
|
||||
{
|
||||
if ( mode == Actionable.MODULATE )
|
||||
if( mode == Actionable.MODULATE )
|
||||
{
|
||||
this.fProxy.setItemType( this.te, null );
|
||||
this.fProxy.barrelSetCount( this.te, 0 );
|
||||
@@ -134,8 +131,8 @@ public class FactorizationBarrel implements IMEInventory<IAEItemStack>
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( mode == Actionable.MODULATE )
|
||||
this.fProxy.barrelSetCount( this.te, (int) (howMany - request.getStackSize()) );
|
||||
if( mode == Actionable.MODULATE )
|
||||
this.fProxy.barrelSetCount( this.te, (int) ( howMany - request.getStackSize() ) );
|
||||
return request.copy();
|
||||
}
|
||||
}
|
||||
@@ -143,10 +140,10 @@ public class FactorizationBarrel implements IMEInventory<IAEItemStack>
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemList<IAEItemStack> getAvailableItems(IItemList out)
|
||||
public IItemList<IAEItemStack> getAvailableItems( IItemList out )
|
||||
{
|
||||
ItemStack i = this.fProxy.barrelGetItem( this.te );
|
||||
if ( i != null )
|
||||
if( i != null )
|
||||
{
|
||||
i.stackSize = this.fProxy.barrelGetItemCount( this.te );
|
||||
out.addStorage( AEItemStack.create( i ) );
|
||||
@@ -155,4 +152,9 @@ public class FactorizationBarrel implements IMEInventory<IAEItemStack>
|
||||
return out;
|
||||
}
|
||||
|
||||
@Override
|
||||
public StorageChannel getChannel()
|
||||
{
|
||||
return StorageChannel.ITEMS;
|
||||
}
|
||||
}
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package appeng.integration.modules.helpers;
|
||||
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
@@ -29,21 +30,21 @@ import appeng.integration.modules.FZ;
|
||||
import appeng.me.storage.MEMonitorIInventory;
|
||||
import appeng.util.inv.IMEAdaptor;
|
||||
|
||||
|
||||
public class FactorizationHandler implements IExternalStorageHandler
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean canHandle(TileEntity te, ForgeDirection d, StorageChannel chan, BaseActionSource mySrc)
|
||||
public boolean canHandle( TileEntity te, ForgeDirection d, StorageChannel chan, BaseActionSource mySrc )
|
||||
{
|
||||
return chan == StorageChannel.ITEMS && FZ.instance.isBarrel( te );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMEInventory getInventory(TileEntity te, ForgeDirection d, StorageChannel chan, BaseActionSource src)
|
||||
public IMEInventory getInventory( TileEntity te, ForgeDirection d, StorageChannel chan, BaseActionSource src )
|
||||
{
|
||||
if ( chan == StorageChannel.ITEMS )
|
||||
if( chan == StorageChannel.ITEMS )
|
||||
return new MEMonitorIInventory( new IMEAdaptor( FZ.instance.getFactorizationBarrel( te ), src ) );
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package appeng.integration.modules.helpers;
|
||||
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
@@ -29,19 +30,20 @@ import appeng.integration.modules.DSU;
|
||||
import appeng.me.storage.MEMonitorIInventory;
|
||||
import appeng.util.inv.IMEAdaptor;
|
||||
|
||||
|
||||
public class MFRDSUHandler implements IExternalStorageHandler
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean canHandle(TileEntity te, ForgeDirection d, StorageChannel chan, BaseActionSource mySrc)
|
||||
public boolean canHandle( TileEntity te, ForgeDirection d, StorageChannel chan, BaseActionSource mySrc )
|
||||
{
|
||||
return chan == StorageChannel.ITEMS && DSU.instance.isDSU( te );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMEInventory getInventory(TileEntity te, ForgeDirection d, StorageChannel chan, BaseActionSource src)
|
||||
public IMEInventory getInventory( TileEntity te, ForgeDirection d, StorageChannel chan, BaseActionSource src )
|
||||
{
|
||||
if ( chan == StorageChannel.ITEMS )
|
||||
if( chan == StorageChannel.ITEMS )
|
||||
return new MEMonitorIInventory( new IMEAdaptor( DSU.instance.getDSU( te ), src ) );
|
||||
|
||||
return null;
|
||||
|
||||
+26
-24
@@ -18,6 +18,7 @@
|
||||
|
||||
package appeng.integration.modules.helpers;
|
||||
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
@@ -31,48 +32,44 @@ import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.util.item.AEItemStack;
|
||||
|
||||
|
||||
public class MinefactoryReloadedDeepStorageUnit implements IMEInventory<IAEItemStack>
|
||||
{
|
||||
|
||||
final IDeepStorageUnit dsu;
|
||||
final TileEntity te;
|
||||
|
||||
public MinefactoryReloadedDeepStorageUnit(TileEntity ta) {
|
||||
public MinefactoryReloadedDeepStorageUnit( TileEntity ta )
|
||||
{
|
||||
this.te = ta;
|
||||
this.dsu = (IDeepStorageUnit) ta;
|
||||
}
|
||||
|
||||
@Override
|
||||
public StorageChannel getChannel()
|
||||
{
|
||||
return StorageChannel.ITEMS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEItemStack injectItems(IAEItemStack input, Actionable mode, BaseActionSource src)
|
||||
public IAEItemStack injectItems( IAEItemStack input, Actionable mode, BaseActionSource src )
|
||||
{
|
||||
ItemStack is = this.dsu.getStoredItemType();
|
||||
if ( is != null )
|
||||
if( is != null )
|
||||
{
|
||||
if ( input.equals( is ) )
|
||||
if( input.equals( is ) )
|
||||
{
|
||||
long max = this.dsu.getMaxStoredCount();
|
||||
long storedItems = is.stackSize;
|
||||
if ( max == storedItems )
|
||||
if( max == storedItems )
|
||||
return input;
|
||||
|
||||
storedItems += input.getStackSize();
|
||||
if ( storedItems > max )
|
||||
if( storedItems > max )
|
||||
{
|
||||
IAEItemStack overflow = AEItemStack.create( is );
|
||||
overflow.setStackSize( (int) (storedItems - max) );
|
||||
if ( mode == Actionable.MODULATE )
|
||||
overflow.setStackSize( (int) ( storedItems - max ) );
|
||||
if( mode == Actionable.MODULATE )
|
||||
this.dsu.setStoredItemCount( (int) max );
|
||||
return overflow;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( mode == Actionable.MODULATE )
|
||||
if( mode == Actionable.MODULATE )
|
||||
this.dsu.setStoredItemCount( is.stackSize + (int) input.getStackSize() );
|
||||
return null;
|
||||
}
|
||||
@@ -80,9 +77,9 @@ public class MinefactoryReloadedDeepStorageUnit implements IMEInventory<IAEItemS
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( input.getTagCompound() != null )
|
||||
if( input.getTagCompound() != null )
|
||||
return input;
|
||||
if ( mode == Actionable.MODULATE )
|
||||
if( mode == Actionable.MODULATE )
|
||||
this.dsu.setStoredItemType( input.getItemStack(), (int) input.getStackSize() );
|
||||
return null;
|
||||
}
|
||||
@@ -90,21 +87,21 @@ public class MinefactoryReloadedDeepStorageUnit implements IMEInventory<IAEItemS
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEItemStack extractItems(IAEItemStack request, Actionable mode, BaseActionSource src)
|
||||
public IAEItemStack extractItems( IAEItemStack request, Actionable mode, BaseActionSource src )
|
||||
{
|
||||
ItemStack is = this.dsu.getStoredItemType();
|
||||
if ( request.equals( is ) )
|
||||
if( request.equals( is ) )
|
||||
{
|
||||
if ( request.getStackSize() >= is.stackSize )
|
||||
if( request.getStackSize() >= is.stackSize )
|
||||
{
|
||||
is = is.copy();
|
||||
if ( mode == Actionable.MODULATE )
|
||||
if( mode == Actionable.MODULATE )
|
||||
this.dsu.setStoredItemCount( 0 );
|
||||
return AEItemStack.create( is );
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( mode == Actionable.MODULATE )
|
||||
if( mode == Actionable.MODULATE )
|
||||
this.dsu.setStoredItemCount( is.stackSize - (int) request.getStackSize() );
|
||||
return request.copy();
|
||||
}
|
||||
@@ -113,14 +110,19 @@ public class MinefactoryReloadedDeepStorageUnit implements IMEInventory<IAEItemS
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemList<IAEItemStack> getAvailableItems(IItemList<IAEItemStack> out)
|
||||
public IItemList<IAEItemStack> getAvailableItems( IItemList<IAEItemStack> out )
|
||||
{
|
||||
ItemStack is = this.dsu.getStoredItemType();
|
||||
if ( is != null )
|
||||
if( is != null )
|
||||
{
|
||||
out.add( AEItemStack.create( is ) );
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
@Override
|
||||
public StorageChannel getChannel()
|
||||
{
|
||||
return StorageChannel.ITEMS;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,11 +93,11 @@ public final class PartWailaDataProvider implements IWailaDataProvider
|
||||
|
||||
final Optional<IPart> maybePart = this.accessor.getMaybePart( te, mop );
|
||||
|
||||
if ( maybePart.isPresent() )
|
||||
if( maybePart.isPresent() )
|
||||
{
|
||||
final IPart part = maybePart.get();
|
||||
|
||||
for ( IPartWailaDataProvider provider : this.providers )
|
||||
for( IPartWailaDataProvider provider : this.providers )
|
||||
{
|
||||
provider.getWailaHead( part, currentToolTip, accessor, config );
|
||||
}
|
||||
@@ -114,11 +114,11 @@ public final class PartWailaDataProvider implements IWailaDataProvider
|
||||
|
||||
final Optional<IPart> maybePart = this.accessor.getMaybePart( te, mop );
|
||||
|
||||
if ( maybePart.isPresent() )
|
||||
if( maybePart.isPresent() )
|
||||
{
|
||||
final IPart part = maybePart.get();
|
||||
|
||||
for ( IPartWailaDataProvider provider : this.providers )
|
||||
for( IPartWailaDataProvider provider : this.providers )
|
||||
{
|
||||
provider.getWailaBody( part, currentToolTip, accessor, config );
|
||||
}
|
||||
@@ -135,11 +135,11 @@ public final class PartWailaDataProvider implements IWailaDataProvider
|
||||
|
||||
final Optional<IPart> maybePart = this.accessor.getMaybePart( te, mop );
|
||||
|
||||
if ( maybePart.isPresent() )
|
||||
if( maybePart.isPresent() )
|
||||
{
|
||||
final IPart part = maybePart.get();
|
||||
|
||||
for ( IPartWailaDataProvider provider : this.providers )
|
||||
for( IPartWailaDataProvider provider : this.providers )
|
||||
{
|
||||
provider.getWailaTail( part, currentToolTip, accessor, config );
|
||||
}
|
||||
@@ -153,15 +153,15 @@ public final class PartWailaDataProvider implements IWailaDataProvider
|
||||
{
|
||||
final MovingObjectPosition mop = this.tracer.retraceBlock( world, player, x, y, z );
|
||||
|
||||
if ( mop != null )
|
||||
if( mop != null )
|
||||
{
|
||||
final Optional<IPart> maybePart = this.accessor.getMaybePart( te, mop );
|
||||
|
||||
if ( maybePart.isPresent() )
|
||||
if( maybePart.isPresent() )
|
||||
{
|
||||
final IPart part = maybePart.get();
|
||||
|
||||
for ( IPartWailaDataProvider provider : this.providers )
|
||||
for( IPartWailaDataProvider provider : this.providers )
|
||||
{
|
||||
provider.getNBTData( player, part, te, tag, world, x, y, z );
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ public final class TileWailaDataProvider implements IWailaDataProvider
|
||||
@Override
|
||||
public List<String> getWailaHead( ItemStack itemStack, List<String> currentToolTip, IWailaDataAccessor accessor, IWailaConfigHandler config )
|
||||
{
|
||||
for ( IWailaDataProvider provider : this.providers )
|
||||
for( IWailaDataProvider provider : this.providers )
|
||||
{
|
||||
provider.getWailaHead( itemStack, currentToolTip, accessor, config );
|
||||
}
|
||||
@@ -85,7 +85,7 @@ public final class TileWailaDataProvider implements IWailaDataProvider
|
||||
@Override
|
||||
public List<String> getWailaBody( ItemStack itemStack, List<String> currentToolTip, IWailaDataAccessor accessor, IWailaConfigHandler config )
|
||||
{
|
||||
for ( IWailaDataProvider provider : this.providers )
|
||||
for( IWailaDataProvider provider : this.providers )
|
||||
{
|
||||
provider.getWailaBody( itemStack, currentToolTip, accessor, config );
|
||||
}
|
||||
@@ -96,7 +96,7 @@ public final class TileWailaDataProvider implements IWailaDataProvider
|
||||
@Override
|
||||
public List<String> getWailaTail( ItemStack itemStack, List<String> currentToolTip, IWailaDataAccessor accessor, IWailaConfigHandler config )
|
||||
{
|
||||
for ( IWailaDataProvider provider : this.providers )
|
||||
for( IWailaDataProvider provider : this.providers )
|
||||
{
|
||||
provider.getWailaTail( itemStack, currentToolTip, accessor, config );
|
||||
}
|
||||
@@ -107,7 +107,7 @@ public final class TileWailaDataProvider implements IWailaDataProvider
|
||||
@Override
|
||||
public NBTTagCompound getNBTData( EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x, int y, int z )
|
||||
{
|
||||
for ( IWailaDataProvider provider : this.providers )
|
||||
for( IWailaDataProvider provider : this.providers )
|
||||
{
|
||||
provider.getNBTData( player, te, tag, world, x, y, z );
|
||||
}
|
||||
|
||||
@@ -75,12 +75,12 @@ public final class ChannelWailaDataProvider extends BasePartWailaDataProvider
|
||||
@Override
|
||||
public List<String> getWailaBody( IPart part, List<String> currentToolTip, IWailaDataAccessor accessor, IWailaConfigHandler config )
|
||||
{
|
||||
if ( part instanceof PartCableSmart || part instanceof PartDenseCable )
|
||||
if( part instanceof PartCableSmart || part instanceof PartDenseCable )
|
||||
{
|
||||
final NBTTagCompound tag = accessor.getNBTData();
|
||||
|
||||
final byte usedChannels = this.getUsedChannels( part, tag, this.cache );
|
||||
final byte maxChannels = ( byte ) ( ( part instanceof PartDenseCable ) ? 32 : 8 );
|
||||
final byte maxChannels = (byte) ( ( part instanceof PartDenseCable ) ? 32 : 8 );
|
||||
|
||||
currentToolTip.add( usedChannels + " " + GuiText.Of.getLocal() + ' ' + maxChannels + ' ' + WailaText.Channels.getLocal() );
|
||||
}
|
||||
@@ -105,12 +105,12 @@ public final class ChannelWailaDataProvider extends BasePartWailaDataProvider
|
||||
{
|
||||
final byte usedChannels;
|
||||
|
||||
if ( tag.hasKey( ID_USED_CHANNELS ) )
|
||||
if( tag.hasKey( ID_USED_CHANNELS ) )
|
||||
{
|
||||
usedChannels = tag.getByte( ID_USED_CHANNELS );
|
||||
this.cache.put( part, usedChannels );
|
||||
}
|
||||
else if ( this.cache.containsKey( part ) )
|
||||
else if( this.cache.containsKey( part ) )
|
||||
{
|
||||
usedChannels = this.cache.get( part );
|
||||
}
|
||||
@@ -143,13 +143,13 @@ public final class ChannelWailaDataProvider extends BasePartWailaDataProvider
|
||||
@Override
|
||||
public NBTTagCompound getNBTData( EntityPlayerMP player, IPart part, TileEntity te, NBTTagCompound tag, World world, int x, int y, int z )
|
||||
{
|
||||
if ( part instanceof PartCableSmart || part instanceof PartDenseCable )
|
||||
if( part instanceof PartCableSmart || part instanceof PartDenseCable )
|
||||
{
|
||||
final NBTTagCompound tempTag = new NBTTagCompound();
|
||||
|
||||
part.writeToNBT( tempTag );
|
||||
|
||||
if ( tempTag.hasKey( ID_USED_CHANNELS ) )
|
||||
if( tempTag.hasKey( ID_USED_CHANNELS ) )
|
||||
{
|
||||
final byte usedChannels = tempTag.getByte( ID_USED_CHANNELS );
|
||||
|
||||
|
||||
@@ -47,5 +47,5 @@ public interface IPartWailaDataProvider
|
||||
|
||||
List<String> getWailaTail( IPart part, List<String> currentToolTip, IWailaDataAccessor accessor, IWailaConfigHandler config );
|
||||
|
||||
NBTTagCompound getNBTData(EntityPlayerMP player, IPart part, TileEntity te, NBTTagCompound tag, World world, int x, int y, int z);
|
||||
NBTTagCompound getNBTData( EntityPlayerMP player, IPart part, TileEntity te, NBTTagCompound tag, World world, int x, int y, int z );
|
||||
}
|
||||
|
||||
@@ -52,13 +52,13 @@ public final class PartAccessor
|
||||
*/
|
||||
public Optional<IPart> getMaybePart( TileEntity te, MovingObjectPosition mop )
|
||||
{
|
||||
if ( te instanceof IPartHost )
|
||||
if( te instanceof IPartHost )
|
||||
{
|
||||
final Vec3 position = mop.hitVec.addVector( -mop.blockX, -mop.blockY, -mop.blockZ );
|
||||
final IPartHost host = ( IPartHost ) te;
|
||||
final IPartHost host = (IPartHost) te;
|
||||
final SelectedPart sp = host.selectPart( position );
|
||||
|
||||
if ( sp.part != null )
|
||||
if( sp.part != null )
|
||||
{
|
||||
return Optional.of( sp.part );
|
||||
}
|
||||
|
||||
+4
-4
@@ -51,9 +51,9 @@ public final class PowerStateWailaDataProvider extends BasePartWailaDataProvider
|
||||
@Override
|
||||
public List<String> getWailaBody( IPart part, List<String> currentToolTip, IWailaDataAccessor accessor, IWailaConfigHandler config )
|
||||
{
|
||||
if ( part instanceof IPowerChannelState )
|
||||
if( part instanceof IPowerChannelState )
|
||||
{
|
||||
final IPowerChannelState state = ( IPowerChannelState ) part;
|
||||
final IPowerChannelState state = (IPowerChannelState) part;
|
||||
|
||||
currentToolTip.add( this.getToolTip( state.isActive(), state.isPowered() ) );
|
||||
}
|
||||
@@ -73,11 +73,11 @@ public final class PowerStateWailaDataProvider extends BasePartWailaDataProvider
|
||||
{
|
||||
final String result;
|
||||
|
||||
if ( isActive && isPowered )
|
||||
if( isActive && isPowered )
|
||||
{
|
||||
result = WailaText.DeviceOnline.getLocal();
|
||||
}
|
||||
else if ( isPowered )
|
||||
else if( isPowered )
|
||||
{
|
||||
result = WailaText.DeviceMissingChannel.getLocal();
|
||||
}
|
||||
|
||||
+6
-6
@@ -55,21 +55,21 @@ public final class StorageMonitorWailaDataProvider extends BasePartWailaDataProv
|
||||
@Override
|
||||
public List<String> getWailaBody( IPart part, List<String> currentToolTip, IWailaDataAccessor accessor, IWailaConfigHandler config )
|
||||
{
|
||||
if ( part instanceof IPartStorageMonitor )
|
||||
if( part instanceof IPartStorageMonitor )
|
||||
{
|
||||
final IPartStorageMonitor monitor = ( IPartStorageMonitor ) part;
|
||||
final IPartStorageMonitor monitor = (IPartStorageMonitor) part;
|
||||
|
||||
final IAEStack<?> displayed = monitor.getDisplayed();
|
||||
final boolean isLocked = monitor.isLocked();
|
||||
|
||||
if ( displayed instanceof IAEItemStack )
|
||||
if( displayed instanceof IAEItemStack )
|
||||
{
|
||||
IAEItemStack ais = ( IAEItemStack ) displayed;
|
||||
IAEItemStack ais = (IAEItemStack) displayed;
|
||||
currentToolTip.add( WailaText.Showing.getLocal() + ": " + ais.getItemStack().getDisplayName() );
|
||||
}
|
||||
else if ( displayed instanceof IAEFluidStack )
|
||||
else if( displayed instanceof IAEFluidStack )
|
||||
{
|
||||
IAEFluidStack ais = ( IAEFluidStack ) displayed;
|
||||
IAEFluidStack ais = (IAEFluidStack) displayed;
|
||||
currentToolTip.add( WailaText.Showing.getLocal() + ": " + ais.getFluid().getLocalizedName( ais.getFluidStack() ) );
|
||||
}
|
||||
|
||||
|
||||
@@ -40,11 +40,11 @@ public final class Tracer
|
||||
* Trace view of players to blocks.
|
||||
* Ignore all which are out of reach.
|
||||
*
|
||||
* @param world word of block
|
||||
* @param world word of block
|
||||
* @param player player viewing block
|
||||
* @param x x pos of block
|
||||
* @param y y pos of block
|
||||
* @param z z pos of block
|
||||
* @param x x pos of block
|
||||
* @param y y pos of block
|
||||
* @param z z pos of block
|
||||
*
|
||||
* @return trace movement. Can be null
|
||||
*/
|
||||
@@ -70,7 +70,7 @@ public final class Tracer
|
||||
private Vec3 getCorrectedHeadVec( EntityPlayer player )
|
||||
{
|
||||
Vec3 v = Vec3.createVectorHelper( player.posX, player.posY, player.posZ );
|
||||
if ( player.worldObj.isRemote )
|
||||
if( player.worldObj.isRemote )
|
||||
{
|
||||
//compatibility with eye height changing mods
|
||||
v.yCoord += player.getEyeHeight() - player.getDefaultEyeHeight();
|
||||
@@ -78,7 +78,7 @@ public final class Tracer
|
||||
else
|
||||
{
|
||||
v.yCoord += player.getEyeHeight();
|
||||
if ( player instanceof EntityPlayerMP && player.isSneaking() )
|
||||
if( player instanceof EntityPlayerMP && player.isSneaking() )
|
||||
v.yCoord -= 0.08;
|
||||
}
|
||||
return v;
|
||||
|
||||
@@ -57,13 +57,13 @@ public final class ChargerWailaDataProvider extends BaseWailaDataProvider
|
||||
public List<String> getWailaBody( ItemStack itemStack, List<String> currentToolTip, IWailaDataAccessor accessor, IWailaConfigHandler config )
|
||||
{
|
||||
final TileEntity te = accessor.getTileEntity();
|
||||
if ( te instanceof TileCharger )
|
||||
if( te instanceof TileCharger )
|
||||
{
|
||||
final TileCharger charger = ( TileCharger ) te;
|
||||
final TileCharger charger = (TileCharger) te;
|
||||
final IInventory chargerInventory = charger.getInternalInventory();
|
||||
final ItemStack chargingItem = chargerInventory.getStackInSlot( 0 );
|
||||
|
||||
if ( chargingItem != null )
|
||||
if( chargingItem != null )
|
||||
{
|
||||
final String currentInventory = chargingItem.getDisplayName();
|
||||
final EntityPlayer player = accessor.getPlayer();
|
||||
|
||||
+3
-3
@@ -56,12 +56,12 @@ public final class CraftingMonitorWailaDataProvider extends BaseWailaDataProvide
|
||||
public List<String> getWailaBody( ItemStack itemStack, List<String> currentToolTip, IWailaDataAccessor accessor, IWailaConfigHandler config )
|
||||
{
|
||||
final TileEntity te = accessor.getTileEntity();
|
||||
if ( te instanceof TileCraftingMonitorTile )
|
||||
if( te instanceof TileCraftingMonitorTile )
|
||||
{
|
||||
final TileCraftingMonitorTile monitor = ( TileCraftingMonitorTile ) te;
|
||||
final TileCraftingMonitorTile monitor = (TileCraftingMonitorTile) te;
|
||||
final IAEItemStack displayStack = monitor.getJobProgress();
|
||||
|
||||
if ( displayStack != null )
|
||||
if( displayStack != null )
|
||||
{
|
||||
final String currentCrafting = displayStack.getItemStack().getDisplayName();
|
||||
|
||||
|
||||
+4
-4
@@ -56,18 +56,18 @@ public final class PowerStateWailaDataProvider extends BaseWailaDataProvider
|
||||
{
|
||||
final TileEntity te = accessor.getTileEntity();
|
||||
|
||||
if ( te instanceof IPowerChannelState )
|
||||
if( te instanceof IPowerChannelState )
|
||||
{
|
||||
final IPowerChannelState state = ( IPowerChannelState ) te;
|
||||
final IPowerChannelState state = (IPowerChannelState) te;
|
||||
|
||||
final boolean isActive = state.isActive();
|
||||
final boolean isPowered = state.isPowered();
|
||||
|
||||
if ( isActive && isPowered )
|
||||
if( isActive && isPowered )
|
||||
{
|
||||
currentToolTip.add( WailaText.DeviceOnline.getLocal() );
|
||||
}
|
||||
else if ( isPowered )
|
||||
else if( isPowered )
|
||||
{
|
||||
currentToolTip.add( WailaText.DeviceMissingChannel.getLocal() );
|
||||
}
|
||||
|
||||
+10
-10
@@ -77,17 +77,17 @@ public final class PowerStorageWailaDataProvider extends BaseWailaDataProvider
|
||||
public List<String> getWailaBody( ItemStack itemStack, List<String> currentToolTip, IWailaDataAccessor accessor, IWailaConfigHandler config )
|
||||
{
|
||||
final TileEntity te = accessor.getTileEntity();
|
||||
if ( te instanceof IAEPowerStorage )
|
||||
if( te instanceof IAEPowerStorage )
|
||||
{
|
||||
final IAEPowerStorage storage = ( IAEPowerStorage ) te;
|
||||
final IAEPowerStorage storage = (IAEPowerStorage) te;
|
||||
|
||||
final double maxPower = storage.getAEMaxPower();
|
||||
if ( maxPower > 0 )
|
||||
if( maxPower > 0 )
|
||||
{
|
||||
final NBTTagCompound tag = accessor.getNBTData();
|
||||
|
||||
final long internalCurrentPower = this.getInternalCurrentPower( tag, te );
|
||||
final long internalMaxPower = ( long ) ( 100 * maxPower );
|
||||
final long internalMaxPower = (long) ( 100 * maxPower );
|
||||
|
||||
final String formatCurrentPower = Platform.formatPowerLong( internalCurrentPower, false );
|
||||
final String formatMaxPower = Platform.formatPowerLong( internalMaxPower, false );
|
||||
@@ -119,13 +119,13 @@ public final class PowerStorageWailaDataProvider extends BaseWailaDataProvider
|
||||
@Override
|
||||
public NBTTagCompound getNBTData( EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x, int y, int z )
|
||||
{
|
||||
if ( te instanceof IAEPowerStorage )
|
||||
if( te instanceof IAEPowerStorage )
|
||||
{
|
||||
final IAEPowerStorage storage = ( IAEPowerStorage ) te;
|
||||
final IAEPowerStorage storage = (IAEPowerStorage) te;
|
||||
|
||||
if ( storage.getAEMaxPower() > 0 )
|
||||
if( storage.getAEMaxPower() > 0 )
|
||||
{
|
||||
final long internalCurrentPower = ( long ) ( 100 * storage.getAECurrentPower() );
|
||||
final long internalCurrentPower = (long) ( 100 * storage.getAECurrentPower() );
|
||||
|
||||
tag.setLong( ID_CURRENT_POWER, internalCurrentPower );
|
||||
}
|
||||
@@ -150,12 +150,12 @@ public final class PowerStorageWailaDataProvider extends BaseWailaDataProvider
|
||||
{
|
||||
final long internalCurrentPower;
|
||||
|
||||
if ( tag.hasKey( ID_CURRENT_POWER ) )
|
||||
if( tag.hasKey( ID_CURRENT_POWER ) )
|
||||
{
|
||||
internalCurrentPower = tag.getLong( ID_CURRENT_POWER );
|
||||
this.cache.put( te, internalCurrentPower );
|
||||
}
|
||||
else if ( this.cache.containsKey( te ) )
|
||||
else if( this.cache.containsKey( te ) )
|
||||
{
|
||||
internalCurrentPower = this.cache.get( te );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user