diff --git a/build.gradle b/build.gradle index f35763c11..c841189a7 100644 --- a/build.gradle +++ b/build.gradle @@ -41,7 +41,7 @@ buildscript { } dependencies { - classpath 'net.minecraftforge.gradle:ForgeGradle:2.0-SNAPSHOT' + classpath 'net.minecraftforge.gradle:ForgeGradle:2.1-SNAPSHOT' } } @@ -83,8 +83,7 @@ minecraft { // used when launching minecraft in dev env runDir = "run" - - mappings = "snapshot_20150928" + mappings = "snapshot_20151227" } sourceSets { diff --git a/gradle.properties b/gradle.properties index c95fd30f9..eaa7b0388 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,8 +7,8 @@ aebasename=appliedenergistics2 ######################################################### # Versions # ######################################################### -minecraft_version=1.8 -forge_version=11.14.3.1516 +minecraft_version=1.8.8 +forge_version=11.15.0.1634-1.8.8 ######################################################### # Installable # diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index b5166dad4..30d399d8d 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 22f1d88cf..9397848f1 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Mon Sep 28 22:02:24 CEST 2015 +#Mon Sep 14 12:28:28 PDT 2015 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.7-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-2.7-bin.zip diff --git a/gradlew.bat b/gradlew.bat index 8a0b282aa..a844ad2f0 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -9,7 +9,7 @@ if "%OS%"=="Windows_NT" setlocal @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= +set DEFAULT_JVM_OPTS="-Xmx4g" set DIRNAME=%~dp0 if "%DIRNAME%" == "" set DIRNAME=. diff --git a/src/main/java/appeng/block/AEBaseSlabBlock.java b/src/main/java/appeng/block/AEBaseSlabBlock.java deleted file mode 100644 index b07718498..000000000 --- a/src/main/java/appeng/block/AEBaseSlabBlock.java +++ /dev/null @@ -1,137 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved. - * - * Applied Energistics 2 is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Applied Energistics 2 is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Applied Energistics 2. If not, see . - */ - -package appeng.block; - - -import java.util.EnumSet; -import java.util.Random; - -import net.minecraft.block.BlockSlab; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.MovingObjectPosition; -import net.minecraft.world.World; - -import appeng.client.texture.IAESprite; -import appeng.core.features.AEFeature; -import appeng.core.features.IAEFeature; -import appeng.core.features.IFeatureHandler; - - -public class AEBaseSlabBlock extends BlockSlab implements IAEFeature -{ - private final IFeatureHandler features; - private final AEBaseBlock block; - private final int meta; - private AEBaseSlabBlock slabs; - private AEBaseSlabBlock doubleSlabs; - private final String name; - - public AEBaseSlabBlock( final AEBaseBlock block, final int meta, final EnumSet features, final boolean isDoubleSlab, final String name ) - { - super( isDoubleSlab, block.getMaterial() ); - this.block = block; - this.meta = meta; - this.name = name; - this.setBlockName( "appliedenergistics2." + name ); - this.setHardness( block.getBlockHardness( null, 0, 0, 0 ) ); - this.setResistance( block.getExplosionResistance( null ) * 5.0F / 3.0F ); - this.setStepSound( block.stepSound ); - this.useNeighborBrightness = true; - if( !this.field_150004_a ) - { - this.doubleSlabs = new AEBaseSlabBlock( block, meta, features, true, name + ".double" ).setSlabs( this ); - } - this.features = !this.field_150004_a ? new SlabBlockFeatureHandler( features, this ) : null; - } - - private AEBaseSlabBlock setSlabs( final AEBaseSlabBlock slabs ) - { - this.slabs = slabs; - return this; - } - - public AEBaseSlabBlock slabs() - { - return this.slabs; - } - - public AEBaseSlabBlock doubleSlabs() - { - return this.doubleSlabs; - } - - @Override - public IFeatureHandler handler() - { - return this.features; - } - - @Override - public void postInit() - { - // Override to do stuff - } - - @Override - public IAESprite getIcon( final int dir, final int meta ) - { - return this.block.getIcon( dir, this.meta ); - } - - @Override - public String func_150002_b( final int p_150002_1_ ) - { - return this.getUnlocalizedName(); - } - - @Override - public void registerBlockIcons( final IIconRegister reg ) - { - } - - @Override - public Item getItemDropped( final int meta, final Random rand, final int fortune ) - { - return this.field_150004_a ? Item.getItemFromBlock( this.slabs ) : Item.getItemFromBlock( this ); - } - - @Override - public ItemStack getPickBlock( final MovingObjectPosition target, final World world, final int x, final int y, final int z ) - { - AEBaseSlabBlock block = (AEBaseSlabBlock) world.getBlock( x, y, z ); - - if( block == null ) - { - return null; - } - if( block.field_150004_a ) - { - block = this.slabs; - } - - final int meta = world.getBlockMetadata( x, y, z ) & 7; - return new ItemStack( block, 1, meta ); - } - - public String name() - { - return this.name; - } -} diff --git a/src/main/java/appeng/block/misc/BlockLightDetector.java b/src/main/java/appeng/block/misc/BlockLightDetector.java index 991fd682b..db197b881 100644 --- a/src/main/java/appeng/block/misc/BlockLightDetector.java +++ b/src/main/java/appeng/block/misc/BlockLightDetector.java @@ -18,12 +18,19 @@ package appeng.block.misc; - import java.util.Collections; import java.util.EnumSet; import java.util.List; import java.util.Random; +import appeng.api.util.IOrientable; +import appeng.api.util.IOrientableBlock; +import appeng.block.AEBaseTileBlock; +import appeng.client.render.blocks.RenderQuartzTorch; +import appeng.core.features.AEFeature; +import appeng.helpers.ICustomCollision; +import appeng.helpers.MetaRotation; +import appeng.tile.misc.TileLightDetector; import net.minecraft.block.Block; import net.minecraft.block.BlockTorch; import net.minecraft.block.material.Material; @@ -36,16 +43,6 @@ import net.minecraft.util.EnumFacing; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import appeng.api.util.IOrientable; -import appeng.api.util.IOrientableBlock; -import appeng.block.AEBaseTileBlock; -import appeng.client.render.blocks.RenderQuartzTorch; -import appeng.core.features.AEFeature; -import appeng.helpers.ICustomCollision; -import appeng.helpers.MetaRotation; -import appeng.tile.misc.TileLightDetector; - - public class BlockLightDetector extends AEBaseTileBlock implements IOrientableBlock, ICustomCollision { @@ -53,12 +50,12 @@ public class BlockLightDetector extends AEBaseTileBlock implements IOrientableBl { super( Material.circuits ); - this.setLightOpacity( 0 ); - this.setFullSize( false ); - this.setOpaque( false ); + setLightOpacity( 0 ); + setFullSize( false ); + setOpaque( false ); - this.setTileEntity( TileLightDetector.class ); - this.setFeature( EnumSet.of( AEFeature.LightDetector ) ); + setTileEntity( TileLightDetector.class ); + setFeature( EnumSet.of( AEFeature.LightDetector ) ); } @Override @@ -72,7 +69,7 @@ public class BlockLightDetector extends AEBaseTileBlock implements IOrientableBl public IBlockState getStateFromMeta( final int meta ) { - return this.getDefaultState(); + return getDefaultState(); } @Override @@ -82,13 +79,13 @@ public class BlockLightDetector extends AEBaseTileBlock implements IOrientableBl } @Override - public int isProvidingWeakPower( + public int getWeakPower( final IBlockAccess w, final BlockPos pos, final IBlockState state, final EnumFacing side ) { - if( w instanceof World && ( (TileLightDetector) this.getTileEntity( w, pos ) ).isReady() ) + if ( w instanceof World && ( (TileLightDetector) this.getTileEntity( w, pos ) ).isReady() ) { return ( (World) w ).getLightFromNeighbors( pos ) - 6; } @@ -105,7 +102,7 @@ public class BlockLightDetector extends AEBaseTileBlock implements IOrientableBl super.onNeighborChange( world, pos, neighbor ); final TileLightDetector tld = this.getTileEntity( world, pos ); - if( tld != null ) + if ( tld != null ) { tld.updateLight(); } @@ -134,10 +131,13 @@ public class BlockLightDetector extends AEBaseTileBlock implements IOrientableBl final EnumFacing forward, final EnumFacing up ) { - return this.canPlaceAt( w, pos, up.getOpposite() ); + return canPlaceAt( w, pos, up.getOpposite() ); } - private boolean canPlaceAt( final World w, final BlockPos pos, final EnumFacing dir ) + private boolean canPlaceAt( + final World w, + final BlockPos pos, + final EnumFacing dir ) { return w.isSideSolid( pos.offset( dir ), dir.getOpposite(), false ); } @@ -149,7 +149,7 @@ public class BlockLightDetector extends AEBaseTileBlock implements IOrientableBl final Entity thePlayer, final boolean b ) { - final EnumFacing up = this.getOrientable( w, pos ).getUp(); + final EnumFacing up = getOrientable( w, pos ).getUp(); final double xOff = -0.3 * up.getFrontOffsetX(); final double yOff = -0.3 * up.getFrontOffsetY(); final double zOff = -0.3 * up.getFrontOffsetZ(); @@ -164,10 +164,12 @@ public class BlockLightDetector extends AEBaseTileBlock implements IOrientableBl final List out, final Entity e ) {/* - * double xOff = -0.15 * getUp().offsetX; double yOff = -0.15 * getUp().offsetY; double zOff = -0.15 * - * getUp().offsetZ; out.add( AxisAlignedBB.getBoundingBox( xOff + (double) x + 0.15, yOff + (double) y + 0.15, zOff - * + (double) z + 0.15,// ahh xOff + (double) x + 0.85, yOff + (double) y + 0.85, zOff + (double) z + 0.85 ) ); - */ + * double xOff = -0.15 * getUp().offsetX; double yOff = -0.15 * + * getUp().offsetY; double zOff = -0.15 * getUp().offsetZ; out.add( + * AxisAlignedBB.getBoundingBox( xOff + (double) x + 0.15, yOff + + * (double) y + 0.15, zOff + (double) z + 0.15,// ahh xOff + (double) x + * + 0.85, yOff + (double) y + 0.85, zOff + (double) z + 0.85 ) ); + */ } @Override @@ -177,14 +179,16 @@ public class BlockLightDetector extends AEBaseTileBlock implements IOrientableBl final IBlockState state, final Block neighborBlock ) { - final EnumFacing up = this.getOrientable( w, pos ).getUp(); - if( !this.canPlaceAt( w, pos, up.getOpposite() ) ) + final EnumFacing up = getOrientable( w, pos ).getUp(); + if ( !canPlaceAt( w, pos, up.getOpposite() ) ) { - this.dropTorch( w, pos ); + dropTorch( w, pos ); } } - private void dropTorch( final World w, final BlockPos pos ) + private void dropTorch( + final World w, + final BlockPos pos ) { w.destroyBlock( pos, true ); w.markBlockForUpdate( pos ); @@ -195,9 +199,9 @@ public class BlockLightDetector extends AEBaseTileBlock implements IOrientableBl final World w, final BlockPos pos ) { - for( final EnumFacing dir : EnumFacing.VALUES ) + for ( final EnumFacing dir : EnumFacing.VALUES ) { - if( this.canPlaceAt( w, pos, dir ) ) + if ( canPlaceAt( w, pos, dir ) ) { return true; } @@ -212,7 +216,9 @@ public class BlockLightDetector extends AEBaseTileBlock implements IOrientableBl } @Override - public IOrientable getOrientable( final IBlockAccess w, final BlockPos pos ) + public IOrientable getOrientable( + final IBlockAccess w, + final BlockPos pos ) { return new MetaRotation( w, pos, true ); } diff --git a/src/main/java/appeng/block/networking/BlockCableBus.java b/src/main/java/appeng/block/networking/BlockCableBus.java index a25a0ebf8..c6e77ecf6 100644 --- a/src/main/java/appeng/block/networking/BlockCableBus.java +++ b/src/main/java/appeng/block/networking/BlockCableBus.java @@ -18,33 +18,10 @@ package appeng.block.networking; - import java.util.EnumSet; import java.util.List; import java.util.Random; -import net.minecraft.block.Block; -import net.minecraft.block.state.IBlockState; -import net.minecraft.client.particle.EffectRenderer; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.EnumDyeColor; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumWorldBlockLayer; -import net.minecraft.util.MovingObjectPosition; -import net.minecraft.util.Vec3; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.World; -import net.minecraftforge.fml.common.registry.GameRegistry; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - import appeng.api.parts.IPartHost; import appeng.api.parts.PartItemStack; import appeng.api.parts.SelectedPart; @@ -68,11 +45,32 @@ import appeng.tile.AEBaseTile; import appeng.tile.networking.TileCableBus; import appeng.tile.networking.TileCableBusTESR; import appeng.util.Platform; - +import net.minecraft.block.Block; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.particle.EffectRenderer; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.EnumDyeColor; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumWorldBlockLayer; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.Vec3; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import net.minecraftforge.fml.common.registry.GameRegistry; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; // TODO: MFR INTEGRATION //@Interface( iface = "powercrystals.minefactoryreloaded.api.rednet.connectivity.IRedNetConnection", iname = IntegrationType.MFR ) -public class BlockCableBus extends AEBaseTileBlock // implements IRedNetConnection +public class BlockCableBus extends AEBaseTileBlock // implements + // IRedNetConnection { private static final ICableBusContainer NULL_CABLE_BUS = new NullCableBusContainer(); @@ -82,8 +80,10 @@ public class BlockCableBus extends AEBaseTileBlock // implements IRedNetConnecti /** * Immibis MB Support. * - * It will look for a field named ImmibisMicroblocks_TransformableBlockMarker or - * ImmibisMicroblocks_TransformableTileEntityMarker, modifiers, type, etc can be ignored. + * It will look for a field named + * ImmibisMicroblocks_TransformableBlockMarker or + * ImmibisMicroblocks_TransformableTileEntityMarker, modifiers, type, etc + * can be ignored. */ @Reflected private static final boolean ImmibisMicroblocks_TransformableBlockMarker = true; @@ -91,12 +91,13 @@ public class BlockCableBus extends AEBaseTileBlock // implements IRedNetConnecti public BlockCableBus() { super( AEGlassMaterial.INSTANCE ); - this.setLightOpacity( 0 ); - this.setFullSize( this.setOpaque( false ) ); + setLightOpacity( 0 ); + setFullSize( setOpaque( false ) ); - // this will actually be overwritten later through setupTile and the combined layers - this.setTileEntity( TileCableBus.class ); - this.setFeature( EnumSet.of( AEFeature.Core ) ); + // this will actually be overwritten later through setupTile and the + // combined layers + setTileEntity( TileCableBus.class ); + setFeature( EnumSet.of( AEFeature.Core ) ); } @Override @@ -106,7 +107,7 @@ public class BlockCableBus extends AEBaseTileBlock // implements IRedNetConnecti final IBlockState state, final Random rand ) { - this.cb( worldIn, pos ).randomDisplayTick( worldIn, pos, rand ); + cb( worldIn, pos ).randomDisplayTick( worldIn, pos, rand ); } @Override @@ -115,7 +116,7 @@ public class BlockCableBus extends AEBaseTileBlock // implements IRedNetConnecti final BlockPos pos, final BlockPos neighbor ) { - this.cb( w, pos ).onNeighborChanged(); + cb( w, pos ).onNeighborChanged(); } @Override @@ -128,13 +129,15 @@ public class BlockCableBus extends AEBaseTileBlock // implements IRedNetConnecti } @Override - public int isProvidingWeakPower( + public int getWeakPower( final IBlockAccess w, final BlockPos pos, final IBlockState state, final EnumFacing side ) { - return this.cb( w, pos ).isProvidingWeakPower( side.getOpposite() ); // TODO: IS OPPOSITE!? + return cb( w, pos ).isProvidingWeakPower( side.getOpposite() ); // TODO: + // IS + // OPPOSITE!? } @Override @@ -150,17 +153,19 @@ public class BlockCableBus extends AEBaseTileBlock // implements IRedNetConnecti final IBlockState state, final Entity entityIn ) { - this.cb( w, pos ).onEntityCollision( entityIn ); + cb( w, pos ).onEntityCollision( entityIn ); } @Override - public int isProvidingStrongPower( + public int getStrongPower( final IBlockAccess w, final BlockPos pos, final IBlockState state, final EnumFacing side ) { - return this.cb( w, pos ).isProvidingStrongPower( side.getOpposite() ); // TODO: IS OPPOSITE!? + return cb( w, pos ).isProvidingStrongPower( side.getOpposite() ); // TODO: + // IS + // OPPOSITE!? } @Override @@ -169,27 +174,33 @@ public class BlockCableBus extends AEBaseTileBlock // implements IRedNetConnecti final BlockPos pos ) { final IBlockState block = world.getBlockState( pos ); - if( block != null && block.getBlock() != this ) + if ( block != null && block.getBlock() != this ) { return block.getBlock().getLightValue( world, pos ); } - if( block == null ) + if ( block == null ) { return 0; } - return this.cb( world, pos ).getLightValue(); + return cb( world, pos ).getLightValue(); } @Override - public boolean isLadder( final IBlockAccess world, final BlockPos pos, final EntityLivingBase entity ) + public boolean isLadder( + final IBlockAccess world, + final BlockPos pos, + final EntityLivingBase entity ) { - return this.cb( world, pos ).isLadder( entity ); + return cb( world, pos ).isLadder( entity ); } @Override - public boolean isSideSolid( final IBlockAccess w, final BlockPos pos, final EnumFacing side ) + public boolean isSideSolid( + final IBlockAccess w, + final BlockPos pos, + final EnumFacing side ) { - return this.cb( w, pos ).isSolidOnSide( side ); + return cb( w, pos ).isSolidOnSide( side ); } @Override @@ -197,7 +208,7 @@ public class BlockCableBus extends AEBaseTileBlock // implements IRedNetConnecti final World w, final BlockPos pos ) { - return this.cb( w, pos ).isEmpty(); + return cb( w, pos ).isEmpty(); } @Override @@ -207,10 +218,10 @@ public class BlockCableBus extends AEBaseTileBlock // implements IRedNetConnecti final EntityPlayer player, final boolean willHarvest ) { - if( player.capabilities.isCreativeMode ) + if ( player.capabilities.isCreativeMode ) { final AEBaseTile tile = this.getTileEntity( world, pos ); - if( tile != null ) + if ( tile != null ) { tile.disableDrops(); } @@ -225,19 +236,19 @@ public class BlockCableBus extends AEBaseTileBlock // implements IRedNetConnecti final BlockPos pos, EnumFacing side ) { - if( side == null ) + if ( side == null ) { side = EnumFacing.UP; } - return this.cb( w, pos ).canConnectRedstone( EnumSet.of( side ) ); + return cb( w, pos ).canConnectRedstone( EnumSet.of( side ) ); } @Override public boolean canRenderInLayer( final EnumWorldBlockLayer layer ) { - if( AEConfig.instance.isFeatureEnabled( AEFeature.AlphaPass ) ) + if ( AEConfig.instance.isFeatureEnabled( AEFeature.AlphaPass ) ) { return layer == EnumWorldBlockLayer.CUTOUT || layer == EnumWorldBlockLayer.TRANSLUCENT; } @@ -252,13 +263,13 @@ public class BlockCableBus extends AEBaseTileBlock // implements IRedNetConnecti final BlockPos pos ) { final Vec3 v3 = target.hitVec.subtract( pos.getX(), pos.getY(), pos.getZ() ); - final SelectedPart sp = this.cb( world, pos ).selectPart( v3 ); + final SelectedPart sp = cb( world, pos ).selectPart( v3 ); - if( sp.part != null ) + if ( sp.part != null ) { return sp.part.getItemStack( PartItemStack.Pick ); } - else if( sp.facade != null ) + else if ( sp.facade != null ) { return sp.facade.getItemStack(); } @@ -268,45 +279,33 @@ public class BlockCableBus extends AEBaseTileBlock // implements IRedNetConnecti @Override @SideOnly( Side.CLIENT ) - public boolean addHitEffects( final World world, final MovingObjectPosition target, final EffectRenderer effectRenderer ) + public boolean addHitEffects( + final World world, + final MovingObjectPosition target, + final EffectRenderer effectRenderer ) { - final Object object = this.cb( world, target.getBlockPos() ); - if( object instanceof IPartHost ) + final Object object = cb( world, target.getBlockPos() ); + if ( object instanceof IPartHost ) { final IPartHost host = (IPartHost) object; // TODO HIT EFFECTS /* - * for( AEPartLocation side : AEPartLocation.values() ) - * { - * IPart p = host.getPart( side ); - * TextureAtlasSprite ico = this.getIcon( p ); - * if( ico == null ) - * { - * continue; - * } - * byte b0 = (byte) ( Platform.getRandomInt() % 2 == 0 ? 1 : 0 ); - * for( int i1 = 0; i1 < b0; ++i1 ) - * { - * for( int j1 = 0; j1 < b0; ++j1 ) - * { - * for( int k1 = 0; k1 < b0; ++k1 ) - * { - * double d0 = target.blockX + ( i1 + 0.5D ) / b0; - * double d1 = target.blockY + ( j1 + 0.5D ) / b0; - * double d2 = target.blockZ + ( k1 + 0.5D ) / b0; - * double dd0 = target.hitVec.xCoord; - * double dd1 = target.hitVec.yCoord; - * double dd2 = target.hitVec.zCoord; - * EntityDiggingFX fx = ( new EntityDiggingFX( world, dd0, dd1, dd2, d0 - target.blockX - 0.5D, d1 - - * target.blockY - 0.5D, d2 - target.blockZ - 0.5D, this, 0 ) ).applyColourMultiplier( target.blockX, - * target.blockY, target.blockZ ); - * fx.setParticleIcon( ico ); - * effectRenderer.addEffect( fx ); - * } - * } - * } - * } + * for( AEPartLocation side : AEPartLocation.values() ) { IPart p = + * host.getPart( side ); TextureAtlasSprite ico = this.getIcon( p ); + * if( ico == null ) { continue; } byte b0 = (byte) ( + * Platform.getRandomInt() % 2 == 0 ? 1 : 0 ); for( int i1 = 0; i1 < + * b0; ++i1 ) { for( int j1 = 0; j1 < b0; ++j1 ) { for( int k1 = 0; + * k1 < b0; ++k1 ) { double d0 = target.blockX + ( i1 + 0.5D ) / b0; + * double d1 = target.blockY + ( j1 + 0.5D ) / b0; double d2 = + * target.blockZ + ( k1 + 0.5D ) / b0; double dd0 = + * target.hitVec.xCoord; double dd1 = target.hitVec.yCoord; double + * dd2 = target.hitVec.zCoord; EntityDiggingFX fx = ( new + * EntityDiggingFX( world, dd0, dd1, dd2, d0 - target.blockX - 0.5D, + * d1 - target.blockY - 0.5D, d2 - target.blockZ - 0.5D, this, 0 ) + * ).applyColourMultiplier( target.blockX, target.blockY, + * target.blockZ ); fx.setParticleIcon( ico ); + * effectRenderer.addEffect( fx ); } } } } */ } @@ -319,39 +318,23 @@ public class BlockCableBus extends AEBaseTileBlock // implements IRedNetConnecti final BlockPos pos, final EffectRenderer effectRenderer ) { - final Object object = this.cb( world, pos ); - if( object instanceof IPartHost ) + final Object object = cb( world, pos ); + if ( object instanceof IPartHost ) { final IPartHost host = (IPartHost) object; // TODO DESTROY EFFECTS /* - * for( AEPartLocation side : AEPartLocation.values() ) - * { - * IPart p = host.getPart( side ); - * TextureAtlasSprite ico = this.getIcon( p ); - * if( ico == null ) - * { - * continue; - * } - * byte b0 = 3; - * for( int i1 = 0; i1 < b0; ++i1 ) - * { - * for( int j1 = 0; j1 < b0; ++j1 ) - * { - * for( int k1 = 0; k1 < b0; ++k1 ) - * { - * double d0 = x + ( i1 + 0.5D ) / b0; - * double d1 = y + ( j1 + 0.5D ) / b0; - * double d2 = z + ( k1 + 0.5D ) / b0; - * EntityDiggingFX fx = ( new EntityDiggingFX( world, d0, d1, d2, d0 - x - 0.5D, d1 - y - 0.5D, d2 - z - - * 0.5D, this, meta ) ).applyColourMultiplier( x, y, z ); - * fx.setParticleIcon( ico ); - * effectRenderer.addEffect( fx ); - * } - * } - * } - * } + * for( AEPartLocation side : AEPartLocation.values() ) { IPart p = + * host.getPart( side ); TextureAtlasSprite ico = this.getIcon( p ); + * if( ico == null ) { continue; } byte b0 = 3; for( int i1 = 0; i1 + * < b0; ++i1 ) { for( int j1 = 0; j1 < b0; ++j1 ) { for( int k1 = + * 0; k1 < b0; ++k1 ) { double d0 = x + ( i1 + 0.5D ) / b0; double + * d1 = y + ( j1 + 0.5D ) / b0; double d2 = z + ( k1 + 0.5D ) / b0; + * EntityDiggingFX fx = ( new EntityDiggingFX( world, d0, d1, d2, d0 + * - x - 0.5D, d1 - y - 0.5D, d2 - z - 0.5D, this, meta ) + * ).applyColourMultiplier( x, y, z ); fx.setParticleIcon( ico ); + * effectRenderer.addEffect( fx ); } } } } */ } @@ -365,22 +348,24 @@ public class BlockCableBus extends AEBaseTileBlock // implements IRedNetConnecti final IBlockState state, final Block neighborBlock ) { - if( Platform.isServer() ) + if ( Platform.isServer() ) { - this.cb( w, pos ).onNeighborChanged(); + cb( w, pos ).onNeighborChanged(); } } - private ICableBusContainer cb( final IBlockAccess w, final BlockPos pos ) + private ICableBusContainer cb( + final IBlockAccess w, + final BlockPos pos ) { final TileEntity te = w.getTileEntity( pos ); ICableBusContainer out = null; - if( te instanceof TileCableBus ) + if ( te instanceof TileCableBus ) { out = ( (TileCableBus) te ).getCableBus(); } - else if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.FMP ) ) + else if ( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.FMP ) ) { out = ( (IFMP) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.FMP ) ).getCableContainer( te ); } @@ -404,7 +389,7 @@ public class BlockCableBus extends AEBaseTileBlock // implements IRedNetConnecti final float hitY, final float hitZ ) { - return this.cb( w, pos ).activate( player, new Vec3( hitX, hitY, hitZ ) ); + return cb( w, pos ).activate( player, new Vec3( hitX, hitY, hitZ ) ); } @Override @@ -426,9 +411,9 @@ public class BlockCableBus extends AEBaseTileBlock // implements IRedNetConnecti { try { - return this.cb( world, pos ).recolourBlock( side, AEColor.values()[color.ordinal()], who ); + return cb( world, pos ).recolourBlock( side, AEColor.values()[color.ordinal()], who ); } - catch( final Throwable ignored ) + catch ( final Throwable ignored ) { } return false; @@ -436,22 +421,27 @@ public class BlockCableBus extends AEBaseTileBlock // implements IRedNetConnecti @Override @SideOnly( Side.CLIENT ) - public void getCheckedSubBlocks( final Item item, final CreativeTabs tabs, final List itemStacks ) + public void getCheckedSubBlocks( + final Item item, + final CreativeTabs tabs, + final List itemStacks ) { // do nothing } @Override - public T getTileEntity( final IBlockAccess w, final BlockPos pos ) + public T getTileEntity( + final IBlockAccess w, + final BlockPos pos ) { final TileEntity te = w.getTileEntity( pos ); - if( noTesrTile.isInstance( te ) ) + if ( noTesrTile.isInstance( te ) ) { return (T) te; } - if( tesrTile != null && tesrTile.isInstance( te ) ) + if ( tesrTile != null && tesrTile.isInstance( te ) ) { return (T) te; } @@ -460,18 +450,19 @@ public class BlockCableBus extends AEBaseTileBlock // implements IRedNetConnecti } @Override - protected void setFeature( final EnumSet f ) + protected void setFeature( + final EnumSet f ) { - final AECableBusFeatureHandler featureHandler = new AECableBusFeatureHandler( f, this, this.getFeatureSubName() ); - this.setHandler( featureHandler ); + final AECableBusFeatureHandler featureHandler = new AECableBusFeatureHandler( f, this, getFeatureSubName() ); + setHandler( featureHandler ); } public void setupTile() { noTesrTile = Api.INSTANCE.partHelper().getCombinedInstance( TileCableBus.class.getName() ); - this.setTileEntity( noTesrTile ); + setTileEntity( noTesrTile ); GameRegistry.registerTileEntity( noTesrTile, "BlockCableBus" ); - if( Platform.isClient() ) + if ( Platform.isClient() ) { tesrTile = Api.INSTANCE.partHelper().getCombinedInstance( TileCableBusTESR.class.getName() ); GameRegistry.registerTileEntity( tesrTile, "ClientOnly_TESR_CableBus" ); @@ -492,9 +483,11 @@ public class BlockCableBus extends AEBaseTileBlock // implements IRedNetConnecti // TODO MFR Integration // @Override // @Method( iname = IntegrationType.MFR ) - // public RedNetConnectionType getConnectionType( World world, int x, int y, int z, ForgeDirection side ) + // public RedNetConnectionType getConnectionType( World world, int x, int y, + // int z, ForgeDirection side ) // { - // return this.cb( world, x, y, z ).canConnectRedstone( EnumSet.allOf( ForgeDirection.class ) ) ? + // return this.cb( world, x, y, z ).canConnectRedstone( EnumSet.allOf( + // ForgeDirection.class ) ) ? // RedNetConnectionType.CableSingle : RedNetConnectionType.None; // } // diff --git a/src/main/java/appeng/client/ClientHelper.java b/src/main/java/appeng/client/ClientHelper.java index f12845b3b..05c28776a 100644 --- a/src/main/java/appeng/client/ClientHelper.java +++ b/src/main/java/appeng/client/ClientHelper.java @@ -100,8 +100,6 @@ import appeng.util.Platform; public class ClientHelper extends ServerHelper { - private static final RenderItem ITEM_RENDERER = Minecraft.getMinecraft().getRenderItem(); - private static final ModelGenerator BLOCK_RENDERER = new ModelGenerator(); private final ModelResourceLocation partRenderer = new ModelResourceLocation( new ResourceLocation( AppEng.MOD_ID, "DynamicPartRenderer" ), "inventory" ); private final Map> iconRegistrations = new HashMap<>(); diff --git a/src/main/java/appeng/client/ItemRenderType.java b/src/main/java/appeng/client/ItemRenderType.java new file mode 100644 index 000000000..1f9cc1f5e --- /dev/null +++ b/src/main/java/appeng/client/ItemRenderType.java @@ -0,0 +1,7 @@ +package appeng.client; + +public enum ItemRenderType +{ + INVENTORY, ENTITY + +} diff --git a/src/main/java/appeng/client/SmartModel.java b/src/main/java/appeng/client/SmartModel.java index a1e3bc912..bfd3a4578 100644 --- a/src/main/java/appeng/client/SmartModel.java +++ b/src/main/java/appeng/client/SmartModel.java @@ -1,10 +1,14 @@ package appeng.client; - import java.util.Collections; import java.util.List; +import appeng.api.util.AEPartLocation; +import appeng.block.AEBaseBlock; +import appeng.client.render.BlockRenderInfo; +import appeng.client.render.ModelGenerator; +import appeng.client.texture.MissingIcon; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.block.model.ItemCameraTransforms; @@ -14,44 +18,20 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.IBlockAccess; -import net.minecraftforge.client.IItemRenderer.ItemRenderType; -import net.minecraftforge.client.model.IModelPart; -import net.minecraftforge.client.model.IModelState; import net.minecraftforge.client.model.ISmartBlockModel; import net.minecraftforge.client.model.ISmartItemModel; -import net.minecraftforge.client.model.TRSRTransformation; import net.minecraftforge.common.property.IExtendedBlockState; -import appeng.api.util.AEPartLocation; -import appeng.block.AEBaseBlock; -import appeng.block.AEBaseTileBlock; -import appeng.client.render.BlockRenderInfo; -import appeng.client.render.ModelGenerator; -import appeng.client.texture.MissingIcon; - - // net.minecraft.client.renderer.tileentity.TileEntityItemStackRenderer public class SmartModel implements IBakedModel, ISmartBlockModel, ISmartItemModel { private final BlockRenderInfo aeRenderer; - private class DefState implements IModelState - { - - @Override - public TRSRTransformation apply( - final IModelPart part ) - { - return TRSRTransformation.identity(); - } - - }; - public SmartModel( final BlockRenderInfo rendererInstance ) { - this.aeRenderer = rendererInstance; + aeRenderer = rendererInstance; } @Override @@ -84,11 +64,11 @@ public class SmartModel implements IBakedModel, ISmartBlockModel, ISmartItemMode { return false; } - + @Override - public TextureAtlasSprite getTexture() + public TextureAtlasSprite getParticleTexture() { - return this.aeRenderer != null ? this.aeRenderer.getTexture( AEPartLocation.UP ).getAtlas() : MissingIcon.getMissing(); + return aeRenderer != null ? aeRenderer.getTexture( AEPartLocation.UP ).getAtlas() : MissingIcon.getMissing(); } @Override @@ -104,7 +84,7 @@ public class SmartModel implements IBakedModel, ISmartBlockModel, ISmartItemMode final ModelGenerator helper = new ModelGenerator(); final Block blk = Block.getBlockFromItem( stack.getItem() ); helper.setRenderBoundsFromBlock( blk ); - this.aeRenderer.getRendererInstance().renderInventory( blk instanceof AEBaseBlock ? (AEBaseBlock) blk : null, stack, helper, ItemRenderType.INVENTORY, null ); + aeRenderer.getRendererInstance().renderInventory( blk instanceof AEBaseBlock ? (AEBaseBlock) blk : null, stack, helper, ItemRenderType.INVENTORY, null ); helper.finalizeModel( true ); return helper.getOutput(); } @@ -115,12 +95,12 @@ public class SmartModel implements IBakedModel, ISmartBlockModel, ISmartItemMode { final ModelGenerator helper = new ModelGenerator(); final Block blk = state.getBlock(); - final BlockPos pos = ( (IExtendedBlockState) state ).getValue( AEBaseTileBlock.AE_BLOCK_POS ); - final IBlockAccess world = ( (IExtendedBlockState) state ).getValue( AEBaseTileBlock.AE_BLOCK_ACCESS ); + final BlockPos pos = ( (IExtendedBlockState) state ).getValue( AEBaseBlock.AE_BLOCK_POS ); + final IBlockAccess world = ( (IExtendedBlockState) state ).getValue( AEBaseBlock.AE_BLOCK_ACCESS ); helper.setTranslation( -pos.getX(), -pos.getY(), -pos.getZ() ); helper.setRenderBoundsFromBlock( blk ); helper.setBlockAccess( world ); - this.aeRenderer.getRendererInstance().renderInWorld( blk instanceof AEBaseBlock ? (AEBaseBlock) blk : null, world, pos, helper ); + aeRenderer.getRendererInstance().renderInWorld( blk instanceof AEBaseBlock ? (AEBaseBlock) blk : null, world, pos, helper ); helper.finalizeModel( false ); return helper.getOutput(); } diff --git a/src/main/java/appeng/client/gui/AEBaseGui.java b/src/main/java/appeng/client/gui/AEBaseGui.java index 7c8f852ee..c28c8dc93 100644 --- a/src/main/java/appeng/client/gui/AEBaseGui.java +++ b/src/main/java/appeng/client/gui/AEBaseGui.java @@ -45,6 +45,7 @@ import net.minecraft.client.renderer.RenderHelper; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.WorldRenderer; import net.minecraft.client.renderer.entity.RenderItem; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.Slot; @@ -817,17 +818,16 @@ public abstract class AEBaseGui extends GuiContainer final Tessellator tessellator = Tessellator.getInstance(); final WorldRenderer worldrenderer = tessellator.getWorldRenderer(); - worldrenderer.startDrawingQuads(); - worldrenderer.setColorRGBA_F( 1.0f, 1.0f, 1.0f, aes.getOpacityOfIcon() ); + worldrenderer.begin( GL11.GL_QUADS, DefaultVertexFormats.ITEM ); + ; final float f1 = 0.00390625F; final float f = 0.00390625F; final float par6 = 16; - worldrenderer.addVertexWithUV( par1 + 0, par2 + par6, this.zLevel, ( par3 + 0 ) * f, ( par4 + par6 ) * f1 ); + worldrenderer.color( 1.0f, 1.0f, 1.0f, aes.getOpacityOfIcon() ).pos( par1 + 0, par2 + par6, this.zLevel).tex( ( par3 + 0 ) * f, ( par4 + par6 ) * f1 ).endVertex(); final float par5 = 16; - worldrenderer.addVertexWithUV( par1 + par5, par2 + par6, this.zLevel, ( par3 + par5 ) * f, ( par4 + par6 ) * f1 ); - worldrenderer.addVertexWithUV( par1 + par5, par2 + 0, this.zLevel, ( par3 + par5 ) * f, ( par4 + 0 ) * f1 ); - worldrenderer.addVertexWithUV( par1 + 0, par2 + 0, this.zLevel, ( par3 + 0 ) * f, ( par4 + 0 ) * f1 ); - worldrenderer.setColorRGBA_F( 1.0f, 1.0f, 1.0f, 1.0f ); + worldrenderer.color( 1.0f, 1.0f, 1.0f, aes.getOpacityOfIcon() ).pos( par1 + par5, par2 + par6, this.zLevel).tex( ( par3 + par5 ) * f, ( par4 + par6 ) * f1 ).endVertex(); + worldrenderer.color( 1.0f, 1.0f, 1.0f, aes.getOpacityOfIcon() ).pos( par1 + par5, par2 + 0, this.zLevel).tex( ( par3 + par5 ) * f, ( par4 + 0 ) * f1 ).endVertex(); + worldrenderer.color( 1.0f, 1.0f, 1.0f, aes.getOpacityOfIcon() ).pos( par1 + 0, par2 + 0, this.zLevel).tex( ( par3 + 0 ) * f, ( par4 + 0 ) * f1 ).endVertex(); tessellator.draw(); } catch( final Exception err ) diff --git a/src/main/java/appeng/client/gui/implementations/GuiInterfaceTerminal.java b/src/main/java/appeng/client/gui/implementations/GuiInterfaceTerminal.java index c088251a9..c3d5dab37 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiInterfaceTerminal.java +++ b/src/main/java/appeng/client/gui/implementations/GuiInterfaceTerminal.java @@ -34,6 +34,7 @@ import com.google.common.collect.HashMultimap; import org.lwjgl.opengl.GL11; import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; @@ -103,7 +104,7 @@ public class GuiInterfaceTerminal extends AEBaseGui final int ex = this.getScrollBar().getCurrentScroll(); - final Iterator o = this.inventorySlots.inventorySlots.iterator(); + final Iterator o = this.inventorySlots.inventorySlots.iterator(); while( o.hasNext() ) { if( o.next() instanceof SlotDisconnected ) diff --git a/src/main/java/appeng/client/render/AppEngRenderItem.java b/src/main/java/appeng/client/render/AppEngRenderItem.java index ec006c3e9..bd9f4457a 100644 --- a/src/main/java/appeng/client/render/AppEngRenderItem.java +++ b/src/main/java/appeng/client/render/AppEngRenderItem.java @@ -28,6 +28,7 @@ import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.WorldRenderer; import net.minecraft.client.renderer.entity.RenderItem; import net.minecraft.client.renderer.texture.TextureManager; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.client.resources.model.ModelManager; import net.minecraft.item.ItemStack; @@ -140,12 +141,13 @@ public class AppEngRenderItem extends RenderItem { final WorldRenderer wr = par1Tessellator.getWorldRenderer(); - wr.startDrawingQuads(); - wr.setColorOpaque_I( par6 ); - wr.addVertex( par2, par3, 0.0D ); - wr.addVertex( par2, par3 + par5, 0.0D ); - wr.addVertex( par2 + par4, par3 + par5, 0.0D ); - wr.addVertex( par2 + par4, par3, 0.0D ); + wr.begin( GL11.GL_QUADS, DefaultVertexFormats.ITEM); + + wr.color( (par6>>16)&0xff,(par6>>8)&0xff,(par6)&0xff,(par6>>24)&0xff ).pos( par2, par3, 0.0D ).endVertex(); + wr.color( (par6>>16)&0xff,(par6>>8)&0xff,(par6)&0xff,(par6>>24)&0xff ).pos(par2, par3 + par5, 0.0D ).endVertex(); + wr.color( (par6>>16)&0xff,(par6>>8)&0xff,(par6)&0xff,(par6>>24)&0xff ).pos( par2 + par4, par3 + par5, 0.0D ).endVertex(); + wr.color( (par6>>16)&0xff,(par6>>8)&0xff,(par6)&0xff,(par6>>24)&0xff ).pos( par2 + par4, par3, 0.0D ).endVertex(); + par1Tessellator.draw(); } diff --git a/src/main/java/appeng/client/render/BaseBlockRender.java b/src/main/java/appeng/client/render/BaseBlockRender.java index 1c67e0d9f..e34f9a981 100644 --- a/src/main/java/appeng/client/render/BaseBlockRender.java +++ b/src/main/java/appeng/client/render/BaseBlockRender.java @@ -39,7 +39,6 @@ import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.ResourceLocation; import net.minecraft.world.IBlockAccess; -import net.minecraftforge.client.IItemRenderer.ItemRenderType; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -284,7 +283,7 @@ public class BaseBlockRender return this.renderDistance; } - public void renderInventory( final B block, final ItemStack item, final ModelGenerator renderer, final ItemRenderType type, final Object[] data ) + public void renderInventory( final B block, final ItemStack item, final ModelGenerator renderer, final appeng.client.ItemRenderType type, final Object[] data ) { final BlockRenderInfo info = block.getRendererInstance(); if( info.isValid() ) diff --git a/src/main/java/appeng/client/render/BusRenderer.java b/src/main/java/appeng/client/render/BusRenderer.java deleted file mode 100644 index 2396655c5..000000000 --- a/src/main/java/appeng/client/render/BusRenderer.java +++ /dev/null @@ -1,194 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved. - * - * Applied Energistics 2 is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Applied Energistics 2 is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Applied Energistics 2. If not, see . - */ - -package appeng.client.render; - - -import java.util.HashMap; -import java.util.Map; - -import javax.annotation.Nullable; - -import org.lwjgl.opengl.GL11; - -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumFacing; -import net.minecraftforge.client.IItemRenderer; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - -import appeng.api.parts.IAlphaPassItem; -import appeng.api.parts.IFacadePart; -import appeng.api.parts.IPart; -import appeng.api.parts.IPartItem; -import appeng.api.util.AEPartLocation; -import appeng.client.ClientHelper; -import appeng.core.AEConfig; -import appeng.core.features.AEFeature; -import appeng.facade.IFacadeItem; -import appeng.util.Platform; - - -@SideOnly( Side.CLIENT ) -public class BusRenderer implements IItemRenderer -{ - - public static final BusRenderer INSTANCE = new BusRenderer(); - private static final Map RENDER_PART = new HashMap(); - private ModelGenerator renderer; - - @Override - public boolean handleRenderType( final ItemStack item, final ItemRenderType type ) - { - return true; - } - - @Override - public boolean shouldUseRenderHelper( final ItemRenderType type, final ItemStack item, final ItemRendererHelper helper ) - { - return true; - } - - @Override - public void renderItem( final ItemRenderType type, final ItemStack item, final Object... data ) - { - if( item == null ) - { - return; - } - - GL11.glPushMatrix(); - GL11.glPushAttrib( GL11.GL_ALL_ATTRIB_BITS ); - GL11.glEnable( GL11.GL_DEPTH_TEST ); - GL11.glEnable( GL11.GL_TEXTURE_2D ); - GL11.glEnable( GL11.GL_LIGHTING ); - - if( AEConfig.instance.isFeatureEnabled( AEFeature.AlphaPass ) && item.getItem() instanceof IAlphaPassItem && ( (IAlphaPassItem) item.getItem() ).useAlphaPass( item ) ) - { - GL11.glBlendFunc( GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA ); - GL11.glColor4f( 1.0f, 1.0f, 1.0f, 1.0f ); - GL11.glDisable( GL11.GL_ALPHA_TEST ); - GL11.glEnable( GL11.GL_BLEND ); - } - else - { - GL11.glAlphaFunc( GL11.GL_GREATER, 0.4f ); - GL11.glEnable( GL11.GL_ALPHA_TEST ); - GL11.glDisable( GL11.GL_BLEND ); - } - - if( type == ItemRenderType.EQUIPPED_FIRST_PERSON ) - { - GL11.glTranslatef( -0.2f, -0.1f, -0.3f ); - } - - if( type == ItemRenderType.ENTITY ) - { - GL11.glRotatef( 90.0f, 0.0f, 1.0f, 0.0f ); - GL11.glScalef( 0.8f, 0.8f, 0.8f ); - GL11.glTranslatef( -0.8f, -0.87f, -0.7f ); - } - - if( type == ItemRenderType.INVENTORY ) - { - GL11.glTranslatef( 0.0f, -0.1f, 0.0f ); - } - - GL11.glTranslated( 0.2, 0.3, 0.1 ); - GL11.glScaled( 1.2, 1.2, 1. ); - - GL11.glColor4f( 1, 1, 1, 1 ); - this.getRenderer().setColorOpaque_F( 1, 1, 1 ); - this.getRenderer().setBrightness( 14 << 20 | 14 << 4 ); - - BusRenderHelper.INSTANCE.setBounds( 0, 0, 0, 1, 1, 1 ); - BusRenderHelper.INSTANCE.setTexture( null ); - BusRenderHelper.INSTANCE.setInvColor( 0xffffff ); - this.getRenderer().setBlockAccess( ClientHelper.proxy.getWorld() ); - - BusRenderHelper.INSTANCE.setOrientation( EnumFacing.EAST, EnumFacing.UP, EnumFacing.SOUTH ); - - this.getRenderer().setUvRotateBottom( this.getRenderer().setUvRotateEast( this.getRenderer().setUvRotateNorth( this.getRenderer().setUvRotateSouth( this.getRenderer().setUvRotateTop( this.getRenderer().setUvRotateWest( 0 ) ) ) ) ) ); - this.getRenderer().setOverrideBlockTexture( null ); - - if( item.getItem() instanceof IFacadeItem ) - { - final IFacadeItem fi = (IFacadeItem) item.getItem(); - final IFacadePart fp = fi.createPartFromItemStack( item, AEPartLocation.SOUTH ); - - if( type == ItemRenderType.EQUIPPED_FIRST_PERSON ) - { - GL11.glRotatef( 160.0f, 0.0f, 1.0f, 0.0f ); - GL11.glTranslated( -0.4, 0.1, -1.6 ); - } - - if( fp != null ) - { - fp.renderInventory( BusRenderHelper.INSTANCE, this.getRenderer() ); - } - } - else - { - final IPart ip = this.getRenderer( item, (IPartItem) item.getItem() ); - if( ip != null ) - { - if( type == ItemRenderType.ENTITY ) - { - final int depth = ip.cableConnectionRenderTo(); - GL11.glTranslatef( 0.0f, 0.0f, -0.04f * ( 8 - depth ) - 0.06f ); - } - - ip.renderInventory( BusRenderHelper.INSTANCE, this.getRenderer() ); - } - } - - this.getRenderer().setUvRotateBottom( this.getRenderer().setUvRotateEast( this.getRenderer().setUvRotateNorth( this.getRenderer().setUvRotateSouth( this.getRenderer().setUvRotateTop( this.getRenderer().setUvRotateWest( 0 ) ) ) ) ) ); - - GL11.glPopAttrib(); - GL11.glPopMatrix(); - } - - @Nullable - private IPart getRenderer( final ItemStack is, final IPartItem c ) - { - final int id = ( Item.getIdFromItem( is.getItem() ) << Platform.DEF_OFFSET ) | is.getItemDamage(); - - IPart part = RENDER_PART.get( id ); - if( part == null ) - { - part = c.createPartFromItemStack( is ); - if( part != null ) - { - RENDER_PART.put( id, part ); - } - } - - return part; - } - - public ModelGenerator getRenderer() - { - return this.renderer; - } - - public void setRenderer( final ModelGenerator renderer ) - { - this.renderer = renderer; - } -} diff --git a/src/main/java/appeng/client/render/ModelGenerator.java b/src/main/java/appeng/client/render/ModelGenerator.java index 7d365ab75..c22afaa35 100644 --- a/src/main/java/appeng/client/render/ModelGenerator.java +++ b/src/main/java/appeng/client/render/ModelGenerator.java @@ -6,7 +6,7 @@ import java.util.ArrayList; import java.util.EnumSet; import java.util.List; -import javax.vecmath.Vector3f; +import org.lwjgl.util.vector.Vector3f; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; @@ -72,9 +72,9 @@ public class ModelGenerator } @Override - public TextureAtlasSprite getTexture() + public TextureAtlasSprite getParticleTexture() { - return null; + return Minecraft.getMinecraft().getTextureMapBlocks().getMissingSprite(); } @Override diff --git a/src/main/java/appeng/client/render/SMFace.java b/src/main/java/appeng/client/render/SMFace.java index 292377b61..6874f411f 100644 --- a/src/main/java/appeng/client/render/SMFace.java +++ b/src/main/java/appeng/client/render/SMFace.java @@ -2,7 +2,8 @@ package appeng.client.render; -import javax.vecmath.Vector3f; + +import org.lwjgl.util.vector.Vector3f; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.util.EnumFacing; diff --git a/src/main/java/appeng/client/render/SpatialSkyRender.java b/src/main/java/appeng/client/render/SpatialSkyRender.java index d9feb5c53..ec09b5935 100644 --- a/src/main/java/appeng/client/render/SpatialSkyRender.java +++ b/src/main/java/appeng/client/render/SpatialSkyRender.java @@ -23,6 +23,8 @@ import java.util.Random; import org.lwjgl.opengl.GL11; +import com.sun.xml.internal.ws.api.streaming.XMLStreamReaderFactory.Default; + import net.minecraft.client.Minecraft; import net.minecraft.client.multiplayer.WorldClient; import net.minecraft.client.renderer.GLAllocation; @@ -30,6 +32,7 @@ import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.RenderHelper; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraftforge.client.IRenderHandler; @@ -107,12 +110,11 @@ public class SpatialSkyRender extends IRenderHandler GL11.glRotatef( -90.0F, 0.0F, 0.0F, 1.0F ); } - worldrenderer.startDrawingQuads(); - worldrenderer.setColorOpaque_I( 0 ); - worldrenderer.addVertexWithUV( -100.0D, -100.0D, -100.0D, 0.0D, 0.0D ); - worldrenderer.addVertexWithUV( -100.0D, -100.0D, 100.0D, 0.0D, 16.0D ); - worldrenderer.addVertexWithUV( 100.0D, -100.0D, 100.0D, 16.0D, 16.0D ); - worldrenderer.addVertexWithUV( 100.0D, -100.0D, -100.0D, 16.0D, 0.0D ); + worldrenderer.begin( GL11.GL_QUADS, DefaultVertexFormats.ITEM ); + worldrenderer.color(0f,0f,0f,1f).pos( -100.0D, -100.0D, -100.0D).tex( 0.0D, 0.0D ).endVertex(); + worldrenderer.color(0f,0f,0f,1f).pos( -100.0D, -100.0D, 100.0D).tex( 0.0D, 16.0D ).endVertex(); + worldrenderer.color(0f,0f,0f,1f).pos( 100.0D, -100.0D, 100.0D).tex( 16.0D, 16.0D ).endVertex(); + worldrenderer.color(0f,0f,0f,1f).pos( 100.0D, -100.0D, -100.0D).tex( 16.0D, 0.0D ).endVertex(); tessellator.draw(); GL11.glPopMatrix(); } @@ -146,7 +148,7 @@ public class SpatialSkyRender extends IRenderHandler { final Tessellator tessellator = Tessellator.getInstance(); final WorldRenderer worldrenderer = tessellator.getWorldRenderer(); - worldrenderer.startDrawingQuads(); + worldrenderer.begin( GL11.GL_QUADS, DefaultVertexFormats.ITEM ); for( int i = 0; i < 50; ++i ) { @@ -186,7 +188,7 @@ public class SpatialSkyRender extends IRenderHandler final double d23 = d17 * d12 - d20 * d13; final double d24 = d23 * d9 - d21 * d10; final double d25 = d21 * d9 + d23 * d10; - worldrenderer.addVertex( x + d24, y + d22, z + d25 ); + worldrenderer.pos( x + d24, y + d22, z + d25 ).endVertex(); } } } diff --git a/src/main/java/appeng/client/render/WorldRender.java b/src/main/java/appeng/client/render/WorldRender.java index 410b507dd..2836b97c5 100644 --- a/src/main/java/appeng/client/render/WorldRender.java +++ b/src/main/java/appeng/client/render/WorldRender.java @@ -25,11 +25,11 @@ import net.minecraft.block.Block; import net.minecraft.item.ItemStack; import net.minecraft.util.BlockPos; import net.minecraft.world.IBlockAccess; -import net.minecraftforge.client.IItemRenderer.ItemRenderType; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import appeng.block.AEBaseBlock; +import appeng.client.ItemRenderType; import appeng.core.AELog; diff --git a/src/main/java/appeng/client/render/blocks/RenderBlockAssembler.java b/src/main/java/appeng/client/render/blocks/RenderBlockAssembler.java index 99cdf73de..f61a11a27 100644 --- a/src/main/java/appeng/client/render/blocks/RenderBlockAssembler.java +++ b/src/main/java/appeng/client/render/blocks/RenderBlockAssembler.java @@ -26,7 +26,6 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.IBlockAccess; -import net.minecraftforge.client.IItemRenderer.ItemRenderType; import appeng.api.networking.IGridHost; import appeng.api.parts.IBoxProvider; @@ -36,6 +35,7 @@ import appeng.api.parts.IPartHost; import appeng.api.util.AEPartLocation; import appeng.api.util.IOrientable; import appeng.block.crafting.BlockMolecularAssembler; +import appeng.client.ItemRenderType; import appeng.client.render.BaseBlockRender; import appeng.client.render.BusRenderer; import appeng.client.render.ModelGenerator; diff --git a/src/main/java/appeng/client/render/blocks/RenderBlockCharger.java b/src/main/java/appeng/client/render/blocks/RenderBlockCharger.java index 54f86d7a8..3369f6469 100644 --- a/src/main/java/appeng/client/render/blocks/RenderBlockCharger.java +++ b/src/main/java/appeng/client/render/blocks/RenderBlockCharger.java @@ -31,7 +31,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.IBlockAccess; -import net.minecraftforge.client.IItemRenderer.ItemRenderType; +import appeng.client.ItemRenderType; import appeng.api.util.AEPartLocation; import appeng.api.util.IOrientable; @@ -159,7 +159,6 @@ public class RenderBlockCharger extends BaseBlockRender. - */ - -package appeng.integration.modules.BCHelpers; - - -import java.util.Set; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.Vec3; -import buildcraft.api.blueprints.IBuilderContext; -import appeng.api.parts.IFacadeContainer; -import appeng.api.parts.IPart; -import appeng.api.parts.IPartHost; -import appeng.api.parts.LayerFlags; -import appeng.api.parts.SelectedPart; -import appeng.api.util.AEColor; -import appeng.api.util.DimensionalCoord; -import appeng.api.util.ForgeDirection; -import appeng.parts.CableBusContainer; - - -public class AECableSchematicTile extends AEGenericSchematicTile implements IPartHost -{ - - @Override - public void rotateLeft( IBuilderContext context ) - { - CableBusContainer cbc = new CableBusContainer( this ); - cbc.readFromNBT( this.tileNBT ); - - cbc.rotateLeft(); - - this.tileNBT = new NBTTagCompound(); - cbc.writeToNBT( this.tileNBT ); - } - - @Override - public IFacadeContainer getFacadeContainer() - { - return null; - } - - @Override - public boolean canAddPart( ItemStack part, ForgeDirection side ) - { - return false; - } - - @Override - public ForgeDirection addPart( ItemStack is, ForgeDirection side, EntityPlayer owner ) - { - return null; - } - - @Override - public IPart getPart( ForgeDirection side ) - { - return null; - } - - @Override - public void removePart( ForgeDirection side, boolean suppressUpdate ) - { - - } - - @Override - public void markForUpdate() - { - - } - - @Override - public DimensionalCoord getLocation() - { - return null; - } - - @Override - public TileEntity getTile() - { - return null; - } - - @Override - public AEColor getColor() - { - return null; - } - - @Override - public void clearContainer() - { - - } - - @Override - public boolean isBlocked( ForgeDirection side ) - { - return false; - } - - @Override - public SelectedPart selectPart( Vec3 pos ) - { - return null; - } - - @Override - public void markForSave() - { - - } - - @Override - public void partChanged() - { - - } - - @Override - public boolean hasRedstone( ForgeDirection side ) - { - return false; - } - - @Override - public boolean isEmpty() - { - return false; - } - - @Override - public Set getLayerFlags() - { - return null; - } - - @Override - public void cleanup() - { - - } - - @Override - public void notifyNeighbors() - { - - } - - @Override - public boolean isInWorld() - { - return false; - } -} diff --git a/src/main/java/appeng/integration/modules/BCHelpers/AEGenericSchematicTile.java b/src/main/java/appeng/integration/modules/BCHelpers/AEGenericSchematicTile.java deleted file mode 100644 index 6d28366a0..000000000 --- a/src/main/java/appeng/integration/modules/BCHelpers/AEGenericSchematicTile.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved. - * - * Applied Energistics 2 is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Applied Energistics 2 is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Applied Energistics 2. If not, see . - */ - -package appeng.integration.modules.BCHelpers; - - -import java.util.ArrayList; - -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import buildcraft.api.blueprints.IBuilderContext; -import buildcraft.api.blueprints.SchematicTile; -import appeng.api.util.ForgeDirection; -import appeng.api.util.ICommonTile; -import appeng.tile.AEBaseTile; -import appeng.util.Platform; - - -public class AEGenericSchematicTile extends SchematicTile -{ - - @Override - public void storeRequirements( IBuilderContext context, int x, int y, int z ) - { - TileEntity tile = context.world().getTileEntity( x, y, z ); - ArrayList list = new ArrayList(); - if( tile instanceof AEBaseTile ) - { - ICommonTile tcb = (ICommonTile) tile; - tcb.getDrops( tile.getWorldObj(), tile.xCoord, tile.yCoord, tile.zCoord, list ); - } - - this.storedRequirements = list.toArray( new ItemStack[list.size()] ); - } - - @Override - public void rotateLeft( IBuilderContext context ) - { - 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 ) - { - try - { - ForgeDirection fdForward = ForgeDirection.valueOf( forward ); - ForgeDirection fdUp = ForgeDirection.valueOf( up ); - - fdForward = Platform.rotateAround( fdForward, ForgeDirection.DOWN ); - fdUp = Platform.rotateAround( fdUp, ForgeDirection.DOWN ); - - this.tileNBT.setString( "orientation_forward", fdForward.name() ); - this.tileNBT.setString( "orientation_up", fdUp.name() ); - } - catch( Throwable ignored ) - { - - } - } - } - } -} diff --git a/src/main/java/appeng/integration/modules/BCHelpers/AERotatableBlockSchematic.java b/src/main/java/appeng/integration/modules/BCHelpers/AERotatableBlockSchematic.java deleted file mode 100644 index 1efda5896..000000000 --- a/src/main/java/appeng/integration/modules/BCHelpers/AERotatableBlockSchematic.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved. - * - * Applied Energistics 2 is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Applied Energistics 2 is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Applied Energistics 2. If not, see . - */ - -package appeng.integration.modules.BCHelpers; - - -import buildcraft.api.blueprints.IBuilderContext; -import buildcraft.api.blueprints.SchematicBlock; -import appeng.api.util.ForgeDirection; -import appeng.util.Platform; - - -public class AERotatableBlockSchematic extends SchematicBlock -{ - - @Override - public void rotateLeft( IBuilderContext context ) - { - if( this.meta < 6 ) - { - ForgeDirection d = Platform.rotateAround( ForgeDirection.values()[this.meta], ForgeDirection.DOWN ); - this.meta = d.ordinal(); - } - } -} diff --git a/src/main/java/appeng/integration/modules/BCHelpers/BCPipeHandler.java b/src/main/java/appeng/integration/modules/BCHelpers/BCPipeHandler.java deleted file mode 100644 index 1f0c03ce5..000000000 --- a/src/main/java/appeng/integration/modules/BCHelpers/BCPipeHandler.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved. - * - * Applied Energistics 2 is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Applied Energistics 2 is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Applied Energistics 2. If not, see . - */ - -package appeng.integration.modules.BCHelpers; - - -import net.minecraft.tileentity.TileEntity; -import appeng.api.networking.security.BaseActionSource; -import appeng.api.storage.IExternalStorageHandler; -import appeng.api.storage.IMEInventory; -import appeng.api.storage.StorageChannel; -import appeng.integration.IntegrationRegistry; -import appeng.integration.IntegrationType; -import appeng.api.util.ForgeDirection; -import appeng.integration.abstraction.IBuildCraftTransport; - - -public class BCPipeHandler implements IExternalStorageHandler -{ - - @Override - public boolean canHandle( TileEntity te, ForgeDirection d, StorageChannel chan, BaseActionSource mySrc ) - { - if ( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.BuildCraftTransport ) ) - { - final IBuildCraftTransport bc = (IBuildCraftTransport) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.BuildCraftTransport ); - - return chan == StorageChannel.ITEMS && bc.isPipe( te, d ); - } - - return false; - } - - @Override - public IMEInventory getInventory( TileEntity te, ForgeDirection d, StorageChannel chan, BaseActionSource src ) - { - if( chan == StorageChannel.ITEMS ) - { - return new BCPipeInventory( te, d ); - } - return null; - } -} diff --git a/src/main/java/appeng/integration/modules/BCHelpers/BCPipeInventory.java b/src/main/java/appeng/integration/modules/BCHelpers/BCPipeInventory.java deleted file mode 100644 index dbc1cfba1..000000000 --- a/src/main/java/appeng/integration/modules/BCHelpers/BCPipeInventory.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved. - * - * Applied Energistics 2 is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Applied Energistics 2 is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Applied Energistics 2. If not, see . - */ - -package appeng.integration.modules.BCHelpers; - - -import net.minecraft.tileentity.TileEntity; -import appeng.api.config.Actionable; -import appeng.api.networking.security.BaseActionSource; -import appeng.api.storage.IMEInventory; -import appeng.api.storage.StorageChannel; -import appeng.api.storage.data.IAEItemStack; -import appeng.api.storage.data.IItemList; -import appeng.api.util.ForgeDirection; -import appeng.integration.IntegrationRegistry; -import appeng.integration.IntegrationType; -import appeng.integration.abstraction.IBuildCraftTransport; - - -public class BCPipeInventory implements IMEInventory -{ - - private final TileEntity te; - private final ForgeDirection direction; - - public BCPipeInventory( TileEntity te, ForgeDirection direction ) - { - this.te = te; - this.direction = direction; - } - - @Override - public IAEItemStack injectItems( IAEItemStack input, Actionable mode, BaseActionSource src ) - { - if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.BuildCraftTransport ) ) - { - final IBuildCraftTransport registry = (IBuildCraftTransport) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.BuildCraftTransport ); - - if( mode == Actionable.SIMULATE ) - { - if( registry.canAddItemsToPipe( this.te, input.getItemStack(), this.direction ) ) - { - return null; - } - return input; - } - - if( registry.addItemsToPipe( this.te, input.getItemStack(), this.direction ) ) - { - return null; - } - } - - return input; - } - - @Override - public IAEItemStack extractItems( IAEItemStack request, Actionable mode, BaseActionSource src ) - { - return null; - } - - @Override - public IItemList getAvailableItems( IItemList out ) - { - return out; - } - - @Override - public StorageChannel getChannel() - { - return StorageChannel.ITEMS; - } -} diff --git a/src/main/java/appeng/integration/modules/BetterStorage.java b/src/main/java/appeng/integration/modules/BetterStorage.java deleted file mode 100644 index 358ff1116..000000000 --- a/src/main/java/appeng/integration/modules/BetterStorage.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved. - * - * Applied Energistics 2 is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Applied Energistics 2 is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Applied Energistics 2. If not, see . - */ - -package appeng.integration.modules; - - -import net.mcft.copy.betterstorage.api.crate.ICrateStorage; -import appeng.api.AEApi; -import appeng.helpers.Reflected; -import appeng.integration.IIntegrationModule; -import appeng.integration.IntegrationHelper; -import appeng.integration.abstraction.IBetterStorage; -import appeng.integration.modules.helpers.BSCrateHandler; -import appeng.integration.modules.helpers.BSCrateStorageAdaptor; -import appeng.util.InventoryAdaptor; - - -public class BetterStorage implements IIntegrationModule, IBetterStorage -{ - @Reflected - public static BetterStorage instance; - - @Reflected - public BetterStorage() - { - IntegrationHelper.testClassExistence( this, net.mcft.copy.betterstorage.api.crate.ICrateStorage.class ); - } - - @Override - public boolean isStorageCrate( Object te ) - { - return te instanceof ICrateStorage; - } - - @Override - public InventoryAdaptor getAdaptor( Object te, ForgeDirection d ) - { - if( te instanceof ICrateStorage ) - { - return new BSCrateStorageAdaptor( te ); - } - return null; - } - - @Override - public void init() - { - } - - @Override - public void postInit() - { - AEApi.instance().registries().externalStorage().addExternalStorageInterface( new BSCrateHandler() ); - } -} diff --git a/src/main/java/appeng/integration/modules/BuildCraftBuilder.java b/src/main/java/appeng/integration/modules/BuildCraftBuilder.java deleted file mode 100644 index 336f14295..000000000 --- a/src/main/java/appeng/integration/modules/BuildCraftBuilder.java +++ /dev/null @@ -1,130 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved. - * - * Applied Energistics 2 is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Applied Energistics 2 is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Applied Energistics 2. If not, see . - */ - -package appeng.integration.modules; - - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; - -import com.google.common.base.Optional; - -import net.minecraft.block.Block; -import net.minecraft.item.ItemStack; - -import buildcraft.api.blueprints.BuilderAPI; -import buildcraft.api.blueprints.ISchematicRegistry; - -import appeng.api.AEApi; -import appeng.api.definitions.IBlockDefinition; -import appeng.api.definitions.IBlocks; -import appeng.api.definitions.ITileDefinition; -import appeng.api.util.IOrientableBlock; -import appeng.core.AELog; -import appeng.helpers.Reflected; -import appeng.integration.IIntegrationModule; -import appeng.integration.IntegrationHelper; -import appeng.integration.modules.BCHelpers.AECableSchematicTile; -import appeng.integration.modules.BCHelpers.AEGenericSchematicTile; -import appeng.integration.modules.BCHelpers.AERotatableBlockSchematic; - - -/** - * The builder has no interface, because it provides no functionality - * - * @author thatsIch - * @version rv3 - 12.06.2015 - * @since rv3 12.06.2015 - */ -@Reflected -public class BuildCraftBuilder implements IIntegrationModule -{ - @Reflected - public static BuildCraftBuilder instance; - - @Reflected - public BuildCraftBuilder() - { - IntegrationHelper.testClassExistence( this, buildcraft.api.blueprints.BuilderAPI.class ); - IntegrationHelper.testClassExistence( this, buildcraft.api.blueprints.IBuilderContext.class ); - IntegrationHelper.testClassExistence( this, buildcraft.api.blueprints.ISchematicRegistry.class ); - IntegrationHelper.testClassExistence( this, buildcraft.api.blueprints.SchematicTile.class ); - IntegrationHelper.testClassExistence( this, buildcraft.api.blueprints.SchematicBlock.class ); - } - - @Override - public void init() throws Throwable - { - try - { - this.initBuilderSupport(); - } - catch( Exception builderSupport ) - { - // not supported? - } - } - - @Override - public void postInit() - { - } - - private void initBuilderSupport() - { - final ISchematicRegistry schematicRegistry = BuilderAPI.schematicRegistry; - - final IBlocks blocks = AEApi.instance().definitions().blocks(); - final IBlockDefinition maybeMultiPart = blocks.multiPart(); - - for( Method blockDefinition : blocks.getClass().getMethods() ) - { - try - { - final IBlockDefinition def = (IBlockDefinition) blockDefinition.invoke( blocks ); - final Optional maybeBlock = def.maybeBlock(); - if( !maybeBlock.isPresent() ) - { - continue; - } - - final Block block = maybeBlock.get(); - if( block instanceof IOrientableBlock && ( (IOrientableBlock) block ).usesMetadata() && !( def instanceof ITileDefinition ) ) - { - schematicRegistry.registerSchematicBlock( block, AERotatableBlockSchematic.class ); - } - else if( maybeMultiPart.isSameAs( new ItemStack( block ) ) ) - { - schematicRegistry.registerSchematicBlock( block, AECableSchematicTile.class ); - } - else if( def instanceof ITileDefinition ) - { - schematicRegistry.registerSchematicBlock( block, AEGenericSchematicTile.class ); - } - } - catch( InvocationTargetException ignore ) - { - AELog.warning( "Encountered problems while initializing the BuildCraft Builder support. Can not invoke the method %s", blockDefinition ); - } - catch( IllegalAccessException ignore ) - { - AELog.warning( "Encountered problems while initializing the BuildCraft Builder support. Can not access the method %s", blockDefinition ); - } - } - } -} diff --git a/src/main/java/appeng/integration/modules/BuildCraftCore.java b/src/main/java/appeng/integration/modules/BuildCraftCore.java deleted file mode 100644 index d1815d4a8..000000000 --- a/src/main/java/appeng/integration/modules/BuildCraftCore.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved. - * - * Applied Energistics 2 is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Applied Energistics 2 is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Applied Energistics 2. If not, see . - */ - -package appeng.integration.modules; - - -import javax.annotation.Nonnull; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; - -import buildcraft.api.tools.IToolWrench; - -import appeng.api.AEApi; -import appeng.api.config.TunnelType; -import appeng.api.features.IP2PTunnelRegistry; -import appeng.helpers.Reflected; -import appeng.integration.IIntegrationModule; -import appeng.integration.IntegrationHelper; -import appeng.integration.abstraction.IBuildCraftCore; - - -@Reflected -public final class BuildCraftCore implements IBuildCraftCore, IIntegrationModule -{ - @Reflected - public static BuildCraftCore instance; - - @Reflected - public BuildCraftCore() - { - IntegrationHelper.testClassExistence( this, buildcraft.BuildCraftCore.class ); - IntegrationHelper.testClassExistence( this, buildcraft.BuildCraftTransport.class ); - IntegrationHelper.testClassExistence( this, buildcraft.api.tools.IToolWrench.class ); - } - - @Override - public boolean isWrench( Item eq ) - { - return eq instanceof IToolWrench; - } - - @Override - public boolean canWrench( @Nonnull Item wrench, EntityPlayer wrencher, int x, int y, int z ) - { - return ( (IToolWrench) wrench ).canWrench( wrencher, x, y, z ); - } - - @Override - public void wrenchUsed( @Nonnull Item wrench, EntityPlayer wrencher, int x, int y, int z ) - { - ( (IToolWrench) wrench ).wrenchUsed( wrencher, x, y, z ); - } - - @Override - public void init() - { - } - - @Override - public void postInit() - { - this.registerPowerP2P(); - } - - private void registerPowerP2P() - { - final IP2PTunnelRegistry registry = AEApi.instance().registries().p2pTunnel(); - - registry.addNewAttunement( new ItemStack( buildcraft.BuildCraftCore.engineBlock, 1, 0 ), TunnelType.RF_POWER ); - registry.addNewAttunement( new ItemStack( buildcraft.BuildCraftCore.engineBlock, 1, 1 ), TunnelType.RF_POWER ); - registry.addNewAttunement( new ItemStack( buildcraft.BuildCraftCore.engineBlock, 1, 2 ), TunnelType.RF_POWER ); - } -} diff --git a/src/main/java/appeng/integration/modules/BuildCraftTransport.java b/src/main/java/appeng/integration/modules/BuildCraftTransport.java deleted file mode 100644 index a0e1078b8..000000000 --- a/src/main/java/appeng/integration/modules/BuildCraftTransport.java +++ /dev/null @@ -1,302 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved. - * - * Applied Energistics 2 is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Applied Energistics 2 is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Applied Energistics 2. If not, see . - */ - -package appeng.integration.modules; - - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import net.minecraft.block.Block; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.IIcon; -import net.minecraftforge.common.util.ForgeDirection; - -import cpw.mods.fml.common.event.FMLInterModComms; - -import buildcraft.api.facades.IFacadeItem; -import buildcraft.api.transport.IInjectable; -import buildcraft.api.transport.IPipeTile; -import buildcraft.transport.ItemFacade; -import buildcraft.transport.PipeIconProvider; - -import appeng.api.AEApi; -import appeng.api.IAppEngApi; -import appeng.api.config.TunnelType; -import appeng.api.definitions.IBlocks; -import appeng.api.definitions.IItemDefinition; -import appeng.api.features.IP2PTunnelRegistry; -import appeng.api.parts.IFacadePart; -import appeng.facade.FacadePart; -import appeng.helpers.Reflected; -import appeng.integration.IIntegrationModule; -import appeng.integration.IntegrationHelper; -import appeng.integration.abstraction.IBuildCraftTransport; -import appeng.integration.modules.BCHelpers.BCPipeHandler; - - -/** - * @author thatsIch - * @version rv3 - 12.06.2015 - * @since rv3 12.06.2015 - */ -@Reflected -public class BuildCraftTransport implements IBuildCraftTransport, IIntegrationModule -{ - @Reflected - public static BuildCraftTransport instance; - - @Reflected - public BuildCraftTransport() - { - IntegrationHelper.testClassExistence( this, buildcraft.BuildCraftTransport.class ); - IntegrationHelper.testClassExistence( this, buildcraft.api.facades.IFacadeItem.class ); - IntegrationHelper.testClassExistence( this, buildcraft.api.transport.IInjectable.class ); - IntegrationHelper.testClassExistence( this, buildcraft.api.transport.IPipeConnection.class ); - IntegrationHelper.testClassExistence( this, buildcraft.api.transport.IPipeTile.class ); - IntegrationHelper.testClassExistence( this, buildcraft.api.transport.IPipeTile.PipeType.class ); - IntegrationHelper.testClassExistence( this, buildcraft.transport.ItemFacade.class ); - IntegrationHelper.testClassExistence( this, buildcraft.transport.PipeIconProvider.class ); - } - - @Override - public boolean isFacade( ItemStack is ) - { - if( is == null ) - { - return false; - } - - return is.getItem() instanceof IFacadeItem; - } - - @Nullable - @Override - public IFacadePart createFacadePart( Block blk, int meta, @Nonnull ForgeDirection side ) - { - try - { - final ItemFacade.FacadeState state = ItemFacade.FacadeState.create( blk, meta ); - final ItemStack facade = ItemFacade.getFacade( state ); - - return new FacadePart( facade, side ); - } - catch( Exception ignored ) - { - - } - - return null; - } - - @Override - public IFacadePart createFacadePart( @Nonnull ItemStack fs, @Nonnull ForgeDirection side ) - { - return new FacadePart( fs, side ); - } - - @Nullable - @Override - public ItemStack getTextureForFacade( @Nonnull ItemStack facade ) - { - final Item maybeFacadeItem = facade.getItem(); - - if( maybeFacadeItem instanceof IFacadeItem ) - { - final IFacadeItem facadeItem = (IFacadeItem) maybeFacadeItem; - - final Block[] blocks = facadeItem.getBlocksForFacade( facade ); - final int[] metas = facadeItem.getMetaValuesForFacade( facade ); - - if( blocks.length > 0 && metas.length > 0 ) - { - return new ItemStack( blocks[0], 1, metas[0] ); - } - } - - return null; - } - - @Nullable - @Override - public IIcon getCobbleStructurePipeTexture() - { - try - { - return buildcraft.BuildCraftTransport.instance.pipeIconProvider.getIcon( PipeIconProvider.TYPE.PipeStructureCobblestone.ordinal() ); // Structure - } - catch( Exception ignored ) - { - } - return null; - // Pipe - } - - @Override - public boolean isPipe( TileEntity te, @Nonnull ForgeDirection dir ) - { - if( te instanceof IPipeTile ) - { - final IPipeTile pipeTile = (IPipeTile) te; - return !pipeTile.hasPipePluggable( dir.getOpposite() ); - } - - return false; - } - - @Override - public boolean canAddItemsToPipe( TileEntity te, ItemStack is, ForgeDirection dir ) - { - if( is != null && te != null && te instanceof IInjectable ) - { - IInjectable pt = (IInjectable) te; - if( pt.canInjectItems( dir ) ) - { - int amt = pt.injectItem( is, false, dir, null ); - if( amt == is.stackSize ) - { - return true; - } - } - } - - return false; - } - - @Override - public boolean addItemsToPipe( @Nullable TileEntity te, @Nullable ItemStack is, @Nonnull ForgeDirection dir ) - { - if( is != null && te != null && te instanceof IInjectable ) - { - IInjectable pt = (IInjectable) te; - if( pt.canInjectItems( dir ) ) - { - int amt = pt.injectItem( is, false, dir, null ); - if( amt == is.stackSize ) - { - pt.injectItem( is, true, dir, null ); - return true; - } - } - } - - return false; - } - - private void addFacade( ItemStack item ) - { - if( item != null ) - { - FMLInterModComms.sendMessage( "BuildCraft|Transport", "add-facade", item ); - } - } - - private void registerPowerP2P() - { - final IP2PTunnelRegistry registry = AEApi.instance().registries().p2pTunnel(); - - registry.addNewAttunement( new ItemStack( buildcraft.BuildCraftTransport.pipePowerCobblestone ), TunnelType.RF_POWER ); - registry.addNewAttunement( new ItemStack( buildcraft.BuildCraftTransport.pipePowerDiamond ), TunnelType.RF_POWER ); - registry.addNewAttunement( new ItemStack( buildcraft.BuildCraftTransport.pipePowerGold ), TunnelType.RF_POWER ); - registry.addNewAttunement( new ItemStack( buildcraft.BuildCraftTransport.pipePowerQuartz ), TunnelType.RF_POWER ); - registry.addNewAttunement( new ItemStack( buildcraft.BuildCraftTransport.pipePowerStone ), TunnelType.RF_POWER ); - registry.addNewAttunement( new ItemStack( buildcraft.BuildCraftTransport.pipePowerWood ), TunnelType.RF_POWER ); - } - - private void registerItemP2P() - { - final IP2PTunnelRegistry registry = AEApi.instance().registries().p2pTunnel(); - - registry.addNewAttunement( new ItemStack( buildcraft.BuildCraftTransport.pipeItemsWood ), TunnelType.ITEM ); - registry.addNewAttunement( new ItemStack( buildcraft.BuildCraftTransport.pipeItemsVoid ), TunnelType.ITEM ); - registry.addNewAttunement( new ItemStack( buildcraft.BuildCraftTransport.pipeItemsSandstone ), TunnelType.ITEM ); - registry.addNewAttunement( new ItemStack( buildcraft.BuildCraftTransport.pipeItemsQuartz ), TunnelType.ITEM ); - registry.addNewAttunement( new ItemStack( buildcraft.BuildCraftTransport.pipeItemsObsidian ), TunnelType.ITEM ); - registry.addNewAttunement( new ItemStack( buildcraft.BuildCraftTransport.pipeItemsIron ), TunnelType.ITEM ); - registry.addNewAttunement( new ItemStack( buildcraft.BuildCraftTransport.pipeItemsGold ), TunnelType.ITEM ); - registry.addNewAttunement( new ItemStack( buildcraft.BuildCraftTransport.pipeItemsEmerald ), TunnelType.ITEM ); - registry.addNewAttunement( new ItemStack( buildcraft.BuildCraftTransport.pipeItemsDiamond ), TunnelType.ITEM ); - registry.addNewAttunement( new ItemStack( buildcraft.BuildCraftTransport.pipeItemsStone ), TunnelType.ITEM ); - registry.addNewAttunement( new ItemStack( buildcraft.BuildCraftTransport.pipeItemsCobblestone ), TunnelType.ITEM ); - } - - private void registerLiquidsP2P() - { - IP2PTunnelRegistry reg = AEApi.instance().registries().p2pTunnel(); - reg.addNewAttunement( new ItemStack( buildcraft.BuildCraftTransport.pipeFluidsCobblestone ), TunnelType.FLUID ); - reg.addNewAttunement( new ItemStack( buildcraft.BuildCraftTransport.pipeFluidsEmerald ), TunnelType.FLUID ); - reg.addNewAttunement( new ItemStack( buildcraft.BuildCraftTransport.pipeFluidsGold ), TunnelType.FLUID ); - reg.addNewAttunement( new ItemStack( buildcraft.BuildCraftTransport.pipeFluidsIron ), TunnelType.FLUID ); - reg.addNewAttunement( new ItemStack( buildcraft.BuildCraftTransport.pipeFluidsSandstone ), TunnelType.FLUID ); - reg.addNewAttunement( new ItemStack( buildcraft.BuildCraftTransport.pipeFluidsStone ), TunnelType.FLUID ); - reg.addNewAttunement( new ItemStack( buildcraft.BuildCraftTransport.pipeFluidsVoid ), TunnelType.FLUID ); - reg.addNewAttunement( new ItemStack( buildcraft.BuildCraftTransport.pipeFluidsWood ), TunnelType.FLUID ); - } - - @Override - public void init() throws Throwable - { - this.initPipeConnection(); - this.initFacades(); - } - - @Override - public void postInit() - { - this.registerPowerP2P(); - this.registerItemP2P(); - this.registerLiquidsP2P(); - } - - private void initPipeConnection() - { - final IAppEngApi api = AEApi.instance(); - - api.partHelper().registerNewLayer( "appeng.parts.layers.LayerIPipeConnection", "buildcraft.api.transport.IPipeConnection" ); - api.registries().externalStorage().addExternalStorageInterface( new BCPipeHandler() ); - } - - private void initFacades() - { - final IAppEngApi api = AEApi.instance(); - final IBlocks blocks = api.definitions().blocks(); - - this.addFacadeStack( blocks.fluix() ); - this.addFacadeStack( blocks.quartz() ); - this.addFacadeStack( blocks.quartzChiseled() ); - this.addFacadeStack( blocks.quartzPillar() ); - - for( Block skyStoneBlock : blocks.skyStone().maybeBlock().asSet() ) - { - this.addFacade( new ItemStack( skyStoneBlock, 1, 0 ) ); - this.addFacade( new ItemStack( skyStoneBlock, 1, 1 ) ); - this.addFacade( new ItemStack( skyStoneBlock, 1, 2 ) ); - this.addFacade( new ItemStack( skyStoneBlock, 1, 3 ) ); - } - } - - private void addFacadeStack( IItemDefinition definition ) - { - for( ItemStack facadeStack : definition.maybeStack( 1 ).asSet() ) - { - this.addFacade( facadeStack ); - } - } -} diff --git a/src/main/java/appeng/integration/modules/CLApi.java b/src/main/java/appeng/integration/modules/CLApi.java deleted file mode 100644 index aafb5f283..000000000 --- a/src/main/java/appeng/integration/modules/CLApi.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved. - * - * Applied Energistics 2 is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Applied Energistics 2 is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Applied Energistics 2. If not, see . - */ - -package appeng.integration.modules; - - -import appeng.api.util.AEColor; -import appeng.helpers.Reflected; -import appeng.integration.IIntegrationModule; -import appeng.integration.IntegrationHelper; -import appeng.integration.abstraction.ICLApi; - - -public class CLApi implements ICLApi, IIntegrationModule -{ - @Reflected - public static CLApi instance; - - @Reflected - public CLApi() - { - IntegrationHelper.testClassExistence( this, coloredlightscore.src.api.CLApi.class ); - } - - @Override - public void init() throws Throwable - { - } - - @Override - public void postInit() - { - // :P - } - - @Override - public int colorLight( AEColor color, int light ) - { - int mv = color.mediumVariant; - - 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 ); - } -} diff --git a/src/main/java/appeng/integration/modules/CraftGuide.java b/src/main/java/appeng/integration/modules/CraftGuide.java deleted file mode 100644 index 76362f6d7..000000000 --- a/src/main/java/appeng/integration/modules/CraftGuide.java +++ /dev/null @@ -1,459 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved. - * - * Applied Energistics 2 is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Applied Energistics 2 is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Applied Energistics 2. If not, see . - */ - -package appeng.integration.modules; - - -import java.util.Arrays; -import java.util.List; - -import javax.annotation.Nullable; - -import com.google.common.base.Optional; - -import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.CraftingManager; -import net.minecraft.item.crafting.IRecipe; - -import cpw.mods.fml.relauncher.ReflectionHelper; - -import uristqwerty.CraftGuide.CraftGuideLog; -import uristqwerty.CraftGuide.DefaultRecipeTemplate; -import uristqwerty.CraftGuide.RecipeGeneratorImplementation; -import uristqwerty.CraftGuide.api.ChanceSlot; -import uristqwerty.CraftGuide.api.CraftGuideAPIObject; -import uristqwerty.CraftGuide.api.ItemSlot; -import uristqwerty.CraftGuide.api.RecipeGenerator; -import uristqwerty.CraftGuide.api.RecipeProvider; -import uristqwerty.CraftGuide.api.RecipeTemplate; -import uristqwerty.CraftGuide.api.Slot; -import uristqwerty.CraftGuide.api.SlotType; -import uristqwerty.gui_craftguide.texture.DynamicTexture; -import uristqwerty.gui_craftguide.texture.TextureClip; - -import appeng.api.AEApi; -import appeng.api.IAppEngApi; -import appeng.api.definitions.IBlocks; -import appeng.api.exceptions.MissingIngredientError; -import appeng.api.exceptions.RegistrationError; -import appeng.api.features.IGrinderEntry; -import appeng.api.features.IInscriberRecipe; -import appeng.api.recipes.IIngredient; -import appeng.helpers.Reflected; -import appeng.integration.IIntegrationModule; -import appeng.integration.IntegrationHelper; -import appeng.recipes.game.ShapedRecipe; -import appeng.recipes.game.ShapelessRecipe; - - -public final class CraftGuide extends CraftGuideAPIObject implements IIntegrationModule, RecipeProvider -{ - private static final int SLOT_SIZE = 16; - private static final int TEXTURE_WIDTH = 79; - private static final int TEXTURE_HEIGHT = 58; - private static final int GRINDER_RATIO = 10000; - - private static final Slot[] GRINDER_SLOTS = { - new ItemSlot( 3, 21, SLOT_SIZE, SLOT_SIZE ).drawOwnBackground(), - new ItemSlot( 41, 21, SLOT_SIZE, SLOT_SIZE, true ).drawOwnBackground().setSlotType( SlotType.OUTPUT_SLOT ), - new ChanceSlot( 59, 12, SLOT_SIZE, SLOT_SIZE, true ).setRatio( GRINDER_RATIO ).setFormatString( " (%1$.2f%% chance)" ).drawOwnBackground().setSlotType( SlotType.OUTPUT_SLOT ), - new ChanceSlot( 59, 30, SLOT_SIZE, SLOT_SIZE, true ).setRatio( GRINDER_RATIO ).setFormatString( " (%1$.2f%% chance)" ).drawOwnBackground().setSlotType( SlotType.OUTPUT_SLOT ), - new ItemSlot( 22, 12, SLOT_SIZE, SLOT_SIZE ).setSlotType( SlotType.MACHINE_SLOT ), - new ItemSlot( 22, 30, SLOT_SIZE, SLOT_SIZE ).setSlotType( SlotType.MACHINE_SLOT ) - }; - private static final Slot[] INSCRIBER_SLOTS = { - new ItemSlot( 12, 21, SLOT_SIZE, SLOT_SIZE ).drawOwnBackground(), - new ItemSlot( 21, 3, SLOT_SIZE, SLOT_SIZE ).drawOwnBackground(), - new ItemSlot( 21, 39, SLOT_SIZE, SLOT_SIZE ).drawOwnBackground(), - new ItemSlot( 50, 21, SLOT_SIZE, SLOT_SIZE, true ).drawOwnBackground().setSlotType( SlotType.OUTPUT_SLOT ), - new ItemSlot( 31, 21, SLOT_SIZE, SLOT_SIZE ).setSlotType( SlotType.MACHINE_SLOT ) - }; - private static final Slot[] SHAPELESS_CRAFTING_SLOTS = { - new ItemSlot( 3, 3, SLOT_SIZE, SLOT_SIZE ), - new ItemSlot( 21, 3, SLOT_SIZE, SLOT_SIZE ), - new ItemSlot( 39, 3, SLOT_SIZE, SLOT_SIZE ), - new ItemSlot( 3, 21, SLOT_SIZE, SLOT_SIZE ), - new ItemSlot( 21, 21, SLOT_SIZE, SLOT_SIZE ), - new ItemSlot( 39, 21, SLOT_SIZE, SLOT_SIZE ), - new ItemSlot( 3, 39, SLOT_SIZE, SLOT_SIZE ), - new ItemSlot( 21, 39, SLOT_SIZE, SLOT_SIZE ), - new ItemSlot( 39, 39, SLOT_SIZE, SLOT_SIZE ), - new ItemSlot( 59, 21, SLOT_SIZE, SLOT_SIZE, true ).setSlotType( SlotType.OUTPUT_SLOT ), - }; - private static final Slot[] CRAFTING_SLOTS_OWN_BG = { - new ItemSlot( 3, 3, SLOT_SIZE, SLOT_SIZE ).drawOwnBackground(), - new ItemSlot( 21, 3, SLOT_SIZE, SLOT_SIZE ).drawOwnBackground(), - new ItemSlot( 39, 3, SLOT_SIZE, SLOT_SIZE ).drawOwnBackground(), - new ItemSlot( 3, 21, SLOT_SIZE, SLOT_SIZE ).drawOwnBackground(), - new ItemSlot( 21, 21, SLOT_SIZE, SLOT_SIZE ).drawOwnBackground(), - new ItemSlot( 39, 21, SLOT_SIZE, SLOT_SIZE ).drawOwnBackground(), - new ItemSlot( 3, 39, SLOT_SIZE, SLOT_SIZE ).drawOwnBackground(), - new ItemSlot( 21, 39, SLOT_SIZE, SLOT_SIZE ).drawOwnBackground(), - new ItemSlot( 39, 39, SLOT_SIZE, SLOT_SIZE ).drawOwnBackground(), - new ItemSlot( 59, 21, SLOT_SIZE, SLOT_SIZE, true ).setSlotType( SlotType.OUTPUT_SLOT ).drawOwnBackground(), - }; - private static final Slot[] SMALL_CRAFTING_SLOTS_OWN_BG = { - new ItemSlot( 12, 12, SLOT_SIZE, SLOT_SIZE ).drawOwnBackground(), - new ItemSlot( 30, 12, SLOT_SIZE, SLOT_SIZE ).drawOwnBackground(), - new ItemSlot( 12, 30, SLOT_SIZE, SLOT_SIZE ).drawOwnBackground(), - new ItemSlot( 30, 30, SLOT_SIZE, SLOT_SIZE ).drawOwnBackground(), - new ItemSlot( 59, 21, SLOT_SIZE, SLOT_SIZE, true ).setSlotType( SlotType.OUTPUT_SLOT ).drawOwnBackground(), - }; - private static final Slot[] CRTAFTING_SLOTS = { - new ItemSlot( 3, 3, SLOT_SIZE, SLOT_SIZE ), - new ItemSlot( 21, 3, SLOT_SIZE, SLOT_SIZE ), - new ItemSlot( 39, 3, SLOT_SIZE, SLOT_SIZE ), - new ItemSlot( 3, 21, SLOT_SIZE, SLOT_SIZE ), - new ItemSlot( 21, 21, SLOT_SIZE, SLOT_SIZE ), - new ItemSlot( 39, 21, SLOT_SIZE, SLOT_SIZE ), - new ItemSlot( 3, 39, SLOT_SIZE, SLOT_SIZE ), - new ItemSlot( 21, 39, SLOT_SIZE, SLOT_SIZE ), - new ItemSlot( 39, 39, SLOT_SIZE, SLOT_SIZE ), - new ItemSlot( 59, 21, SLOT_SIZE, SLOT_SIZE, true ).setSlotType( SlotType.OUTPUT_SLOT ), - }; - private static final Slot[] SMALL_CRAFTING_SLOTS = { - new ItemSlot( 12, 12, SLOT_SIZE, SLOT_SIZE ), - new ItemSlot( 30, 12, SLOT_SIZE, SLOT_SIZE ), - new ItemSlot( 12, 30, SLOT_SIZE, SLOT_SIZE ), - new ItemSlot( 30, 30, SLOT_SIZE, SLOT_SIZE ), - new ItemSlot( 59, 21, SLOT_SIZE, SLOT_SIZE, true ).setSlotType( SlotType.OUTPUT_SLOT ), - }; - - @Reflected - public static CraftGuide instance; - - public CraftGuide() - { - IntegrationHelper.testClassExistence( this, uristqwerty.CraftGuide.CraftGuideLog.class ); - IntegrationHelper.testClassExistence( this, uristqwerty.CraftGuide.DefaultRecipeTemplate.class ); - IntegrationHelper.testClassExistence( this, uristqwerty.CraftGuide.RecipeGeneratorImplementation.class ); - IntegrationHelper.testClassExistence( this, uristqwerty.CraftGuide.api.ChanceSlot.class ); - IntegrationHelper.testClassExistence( this, uristqwerty.CraftGuide.api.CraftGuideAPIObject.class ); - IntegrationHelper.testClassExistence( this, uristqwerty.CraftGuide.api.ItemSlot.class ); - IntegrationHelper.testClassExistence( this, uristqwerty.CraftGuide.api.RecipeGenerator.class ); - IntegrationHelper.testClassExistence( this, uristqwerty.CraftGuide.api.RecipeProvider.class ); - IntegrationHelper.testClassExistence( this, uristqwerty.CraftGuide.api.RecipeTemplate.class ); - IntegrationHelper.testClassExistence( this, uristqwerty.CraftGuide.api.Slot.class ); - IntegrationHelper.testClassExistence( this, uristqwerty.CraftGuide.api.SlotType.class ); - IntegrationHelper.testClassExistence( this, uristqwerty.gui_craftguide.texture.DynamicTexture.class ); - IntegrationHelper.testClassExistence( this, uristqwerty.gui_craftguide.texture.TextureClip.class ); - } - - @Override - public void init() throws Throwable - { - } - - @Override - public void postInit() - { - } - - @Override - public void generateRecipes( RecipeGenerator generator ) - { - final RecipeTemplate craftingTemplate; - final RecipeTemplate smallTemplate; - - if( uristqwerty.CraftGuide.CraftGuide.newerBackgroundStyle ) - { - craftingTemplate = generator.createRecipeTemplate( CRAFTING_SLOTS_OWN_BG, null ); - smallTemplate = generator.createRecipeTemplate( SMALL_CRAFTING_SLOTS_OWN_BG, null ); - } - else - { - final TextureClip craftingBG = new TextureClip( DynamicTexture.instance( "recipe_backgrounds" ), 1, 1, TEXTURE_WIDTH, TEXTURE_HEIGHT ); - final TextureClip craftingSelected = new TextureClip( DynamicTexture.instance( "recipe_backgrounds" ), 82, 1, TEXTURE_WIDTH, TEXTURE_HEIGHT ); - craftingTemplate = new DefaultRecipeTemplate( CRTAFTING_SLOTS, RecipeGeneratorImplementation.workbench, craftingBG, craftingSelected ); - - final TextureClip smallBG = new TextureClip( DynamicTexture.instance( "recipe_backgrounds" ), 1, 61, TEXTURE_WIDTH, TEXTURE_HEIGHT ); - final TextureClip smallSelected = new TextureClip( DynamicTexture.instance( "recipe_backgrounds" ), 82, 61, TEXTURE_WIDTH, TEXTURE_HEIGHT ); - smallTemplate = new DefaultRecipeTemplate( SMALL_CRAFTING_SLOTS, RecipeGeneratorImplementation.workbench, smallBG, smallSelected ); - } - - final TextureClip shapelessBG = new TextureClip( DynamicTexture.instance( "recipe_backgrounds" ), 1, 121, TEXTURE_WIDTH, TEXTURE_HEIGHT ); - final TextureClip shapelessSelected = new TextureClip( DynamicTexture.instance( "recipe_backgrounds" ), 82, 121, TEXTURE_WIDTH, TEXTURE_HEIGHT ); - final RecipeTemplate shapelessTemplate = new DefaultRecipeTemplate( SHAPELESS_CRAFTING_SLOTS, RecipeGeneratorImplementation.workbench, shapelessBG, shapelessSelected ); - - this.addCraftingRecipes( craftingTemplate, smallTemplate, shapelessTemplate, generator ); - - final IAppEngApi api = AEApi.instance(); - final IBlocks aeBlocks = api.definitions().blocks(); - final Optional grindstone = aeBlocks.grindStone().maybeStack( 1 ); - final Optional inscriber = aeBlocks.inscriber().maybeStack( 1 ); - - if( grindstone.isPresent() ) - { - this.addGrinderRecipes( api, grindstone.get(), generator ); - } - - if( inscriber.isPresent() ) - { - this.addInscriberRecipes( api, inscriber.get(), generator ); - } - } - - @SuppressWarnings( "unchecked" ) - private List getUncheckedRecipes() - { - return (List) CraftingManager.getInstance().getRecipeList(); - } - - private void addCraftingRecipes( RecipeTemplate template, RecipeTemplate templateSmall, RecipeTemplate templateShapeless, RecipeGenerator generator ) - { - final List recipes = this.getUncheckedRecipes(); - - int errCount = 0; - - for( IRecipe recipe : recipes ) - { - try - { - final Object[] items = this.getCraftingRecipe( recipe, true ); - - if( items == null ) - { - continue; - } - if( items.length == 5 ) - { - generator.addRecipe( templateSmall, items ); - } - else if( recipe instanceof ShapelessRecipe ) - { - generator.addRecipe( templateShapeless, items ); - } - else - { - generator.addRecipe( template, items ); - } - } - catch( Exception e ) - { - if( errCount >= 5 ) - { - CraftGuideLog.log( "AppEng CraftGuide integration: 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 ); - } - else - { - e.printStackTrace(); - } - errCount++; - - CraftGuideLog.log( e ); - } - } - } - - private void addGrinderRecipes( IAppEngApi api, ItemStack grindstone, RecipeGenerator generator ) - { - final ItemStack handle = api.definitions().blocks().crankHandle().maybeStack( 1 ).orNull(); - final RecipeTemplate grinderTemplate = generator.createRecipeTemplate( GRINDER_SLOTS, grindstone ); - - for( IGrinderEntry recipe : api.registries().grinder().getRecipes() ) - { - generator.addRecipe( grinderTemplate, new Object[] { - recipe.getInput(), - recipe.getOutput(), - new Object[] { - recipe.getOptionalOutput(), - (int) ( recipe.getOptionalChance() * GRINDER_RATIO ) - }, - new Object[] { - recipe.getSecondOptionalOutput(), - (int) ( recipe.getOptionalChance() * GRINDER_RATIO ) - }, - handle, - grindstone - } ); - } - } - - private void addInscriberRecipes( IAppEngApi api, ItemStack inscriber, RecipeGenerator generator ) - { - final RecipeTemplate inscriberTemplate = generator.createRecipeTemplate( INSCRIBER_SLOTS, inscriber ); - - for( IInscriberRecipe recipe : api.registries().inscriber().getRecipes() ) - { - generator.addRecipe( inscriberTemplate, new Object[] { - recipe.getInputs(), - recipe.getTopOptional().orNull(), - recipe.getBottomOptional().orNull(), - recipe.getOutput(), - inscriber - } ); - } - } - - private Object[] getCraftingShapelessRecipe( List items, ItemStack recipeOutput ) - { - final Object[] output = new Object[10]; - - for( int i = 0; i < items.size(); i++ ) - { - output[i] = items.get( i ); - - 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[] getSmallShapedRecipe( int width, int height, Object[] items, ItemStack recipeOutput ) - { - final Object[] output = new Object[5]; - - for( int y = 0; y < height; y++ ) - { - for( int x = 0; x < width; x++ ) - { - final int i = y * 2 + 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[4] = recipeOutput; - - return output; - } - - private Object[] getCraftingShapedRecipe( int width, int height, Object[] items, ItemStack recipeOutput ) - { - final Object[] output = new Object[10]; - - for( int y = 0; y < height; y++ ) - { - for( int x = 0; x < width; x++ ) - { - final 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 ) - { - final List list = Arrays.asList( itemStackSet ); - - for( int x = 0; x < list.size(); x++ ) - { - list.set( x, list.get( x ).copy() ); - if( list.get( x ).stackSize == 0 ) - { - list.get( x ).stackSize = 1; - } - } - - return list; - } - - @Nullable - private Object[] getCraftingRecipe( IRecipe recipe, boolean allowSmallGrid ) - { - if( recipe instanceof ShapelessRecipe ) - { - final List items = ReflectionHelper.getPrivateValue( ShapelessRecipe.class, (ShapelessRecipe) recipe, "input" ); - - return this.getCraftingShapelessRecipe( items, recipe.getRecipeOutput() ); - } - else if( recipe instanceof ShapedRecipe ) - { - final int width = ReflectionHelper.getPrivateValue( ShapedRecipe.class, (ShapedRecipe) recipe, "width" ); - final int height = ReflectionHelper.getPrivateValue( ShapedRecipe.class, (ShapedRecipe) recipe, "height" ); - final Object[] items = ReflectionHelper.getPrivateValue( ShapedRecipe.class, (ShapedRecipe) recipe, "input" ); - - if( allowSmallGrid && width < 3 && height < 3 ) - { - return this.getSmallShapedRecipe( width, height, items, recipe.getRecipeOutput() ); - } - else - { - return this.getCraftingShapedRecipe( width, height, items, recipe.getRecipeOutput() ); - } - } - - return null; - } -} diff --git a/src/main/java/appeng/integration/modules/DSU.java b/src/main/java/appeng/integration/modules/DSU.java deleted file mode 100644 index d156fbc59..000000000 --- a/src/main/java/appeng/integration/modules/DSU.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved. - * - * Applied Energistics 2 is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Applied Energistics 2 is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Applied Energistics 2. If not, see . - */ - -package appeng.integration.modules; - - -import net.minecraft.tileentity.TileEntity; - -import powercrystals.minefactoryreloaded.api.IDeepStorageUnit; - -import appeng.api.AEApi; -import appeng.api.storage.IMEInventory; -import appeng.helpers.Reflected; -import appeng.integration.IIntegrationModule; -import appeng.integration.IntegrationHelper; -import appeng.integration.abstraction.IDSU; -import appeng.integration.modules.helpers.MFRDSUHandler; -import appeng.integration.modules.helpers.MinefactoryReloadedDeepStorageUnit; - - -public class DSU implements IDSU, IIntegrationModule -{ - @Reflected - public static DSU instance; - - @Reflected - public DSU() - { - IntegrationHelper.testClassExistence( this, powercrystals.minefactoryreloaded.api.IDeepStorageUnit.class ); - } - - @Override - public IMEInventory getDSU( TileEntity te ) - { - return new MinefactoryReloadedDeepStorageUnit( te ); - } - - @Override - public boolean isDSU( TileEntity te ) - { - return te instanceof IDeepStorageUnit; - } - - @Override - public void init() - { - } - - @Override - public void postInit() - { - AEApi.instance().registries().externalStorage().addExternalStorageInterface( new MFRDSUHandler() ); - } -} diff --git a/src/main/java/appeng/integration/modules/FMP.java b/src/main/java/appeng/integration/modules/FMP.java deleted file mode 100644 index fc0104e91..000000000 --- a/src/main/java/appeng/integration/modules/FMP.java +++ /dev/null @@ -1,221 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved. - * - * Applied Energistics 2 is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Applied Energistics 2 is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Applied Energistics 2. If not, see . - */ - -package appeng.integration.modules; - - -import java.util.Collection; -import java.util.List; - -import com.google.common.collect.Lists; - -import net.minecraft.block.Block; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.fml.common.eventhandler.Event; -import codechicken.lib.vec.BlockCoord; -import codechicken.microblock.BlockMicroMaterial; -import codechicken.multipart.MultiPartRegistry; -import codechicken.multipart.MultiPartRegistry.IPartConverter; -import codechicken.multipart.MultiPartRegistry.IPartFactory; -import codechicken.multipart.MultipartGenerator; -import codechicken.multipart.TMultiPart; -import codechicken.multipart.TileMultipart; -import appeng.api.AEApi; -import appeng.api.definitions.IBlockDefinition; -import appeng.api.definitions.IBlocks; -import appeng.api.parts.IPartHost; -import appeng.core.AELog; -import appeng.fmp.CableBusPart; -import appeng.fmp.FMPEvent; -import appeng.fmp.FMPPlacementHelper; -import appeng.fmp.PartRegistry; -import appeng.helpers.Reflected; -import appeng.integration.IIntegrationModule; -import appeng.integration.abstraction.IFMP; -import appeng.integration.modules.helpers.FMPPacketEvent; -import appeng.parts.CableBusContainer; - - -public class FMP implements IIntegrationModule, IPartFactory, IPartConverter, IFMP -{ - @Reflected - public static FMP instance; - - @Override - public TMultiPart createPart( String name, boolean client ) - { - for( PartRegistry pr : PartRegistry.values() ) - { - if( pr.getName().equals( name ) ) - { - return pr.construct( 0 ); - } - } - - return null; - } - - @Override - 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 ) - { - CableBusPart cbp = (CableBusPart) part; - cbp.convertFromTile( world.getTileEntity( pos.x, pos.y, pos.z ) ); - } - - return part; - } - - @Override - public Iterable blockTypes() - { - final IBlocks blocks = AEApi.instance().definitions().blocks(); - final List blockTypes = Lists.newArrayListWithCapacity( 2 ); - - this.addBlockTypes( blockTypes, blocks.multiPart() ); - this.addBlockTypes( blockTypes, blocks.quartzTorch() ); - - return blockTypes; - } - - private void addBlockTypes( Collection blockTypes, IBlockDefinition definition ) - { - for( Block block : definition.maybeBlock().asSet() ) - { - blockTypes.add( block ); - } - } - - @Override - public void init() throws Throwable - { - final IBlocks blocks = AEApi.instance().definitions().blocks(); - - this.createAndRegister( blocks.quartz(), 0 ); - this.createAndRegister( blocks.quartzPillar(), 0 ); - this.createAndRegister( blocks.quartzChiseled(), 0 ); - this.createAndRegister( blocks.skyStone(), 0 ); - this.createAndRegister( blocks.skyStone(), 1 ); - this.createAndRegister( blocks.skyStone(), 2 ); - this.createAndRegister( blocks.skyStone(), 3 ); - - PartRegistry[] reg = PartRegistry.values(); - - String[] data = new String[reg.length]; - for( int x = 0; x < data.length; x++ ) - { - data[x] = reg[x].getName(); - } - - MultiPartRegistry.registerConverter( this ); - MultiPartRegistry.registerParts( this, data ); - - MultipartGenerator.registerPassThroughInterface( "appeng.helpers.AEMultiTile" ); - } - - private void createAndRegister( IBlockDefinition definition, int i ) - { - for( Block block : definition.maybeBlock().asSet() ) - { - BlockMicroMaterial.createAndRegister( block, i ); - } - } - - @Override - public void postInit() - { - MinecraftForge.EVENT_BUS.register( new FMPEvent() ); - } - - @Override - 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 ) - { - scala.collection.Iterator i = mp.partList().iterator(); - while( i.hasNext() ) - { - TMultiPart p = i.next(); - if( p instanceof CableBusPart ) - { - return (IPartHost) p; - } - } - - return new FMPPlacementHelper( mp ); - } - } - catch( Throwable t ) - { - AELog.error( t ); - } - return null; - } - - @Override - public CableBusContainer getCableContainer( TileEntity te ) - { - if( te instanceof TileMultipart ) - { - TileMultipart mp = (TileMultipart) te; - scala.collection.Iterator i = mp.partList().iterator(); - while( i.hasNext() ) - { - TMultiPart p = i.next(); - if( p instanceof CableBusPart ) - { - return ( (CableBusPart) p ).getCableBus(); - } - } - } - return null; - } - - @Override - public void registerPassThrough( Class layerInterface ) - { - try - { - MultipartGenerator.registerPassThroughInterface( layerInterface.getName() ); - } - catch( Throwable t ) - { - AELog.severe( "Failed to register " + layerInterface.getName() + " with FMP, some features may not work with MultiParts." ); - AELog.error( t ); - } - } - - @Override - public Event newFMPPacketEvent( EntityPlayerMP sender ) - { - return new FMPPacketEvent( sender ); - } -} diff --git a/src/main/java/appeng/integration/modules/FZ.java b/src/main/java/appeng/integration/modules/FZ.java deleted file mode 100644 index cda928ca5..000000000 --- a/src/main/java/appeng/integration/modules/FZ.java +++ /dev/null @@ -1,214 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved. - * - * Applied Energistics 2 is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Applied Energistics 2 is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Applied Energistics 2. If not, see . - */ - -package appeng.integration.modules; - - -import java.lang.reflect.Field; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; - -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; - -import appeng.api.AEApi; -import appeng.api.storage.IMEInventory; -import appeng.helpers.Reflected; -import appeng.integration.IIntegrationModule; -import appeng.integration.abstraction.IFZ; -import appeng.integration.modules.helpers.FactorizationBarrel; -import appeng.integration.modules.helpers.FactorizationHandler; -import appeng.util.Platform; - - -/** - * 100% Hacks. - */ -public class FZ implements IFZ, IIntegrationModule -{ - @Reflected - public static FZ instance; - - private static Class day_BarrelClass; - private static Method day_getItemCount; - private static Method day_setItemCount; - private static Method day_getMaxSize; - private static Field day_item; - - @Override - public ItemStack barrelGetItem( TileEntity te ) - { - try - { - ItemStack i = null; - - if( day_BarrelClass.isInstance( te ) ) - { - i = (ItemStack) day_item.get( te ); - } - - if( i != null ) - { - i = Platform.cloneItemStack( i ); - } - - return i; - } - catch( IllegalArgumentException ignored ) - { - } - catch( IllegalAccessException ignored ) - { - } - return null; - } - - @Override - public int barrelGetMaxItemCount( TileEntity te ) - { - try - { - if( day_BarrelClass.isInstance( te ) ) - { - return (Integer) day_getMaxSize.invoke( te ); - } - } - catch( IllegalAccessException ignored ) - { - } - catch( IllegalArgumentException ignored ) - { - } - catch( InvocationTargetException ignored ) - { - } - return 0; - } - - @Override - public int barrelGetItemCount( TileEntity te ) - { - try - { - if( day_BarrelClass.isInstance( te ) ) - { - return (Integer) day_getItemCount.invoke( te ); - } - } - catch( IllegalAccessException ignored ) - { - } - catch( IllegalArgumentException ignored ) - { - } - catch( InvocationTargetException ignored ) - { - } - return 0; - } - - @Override - public void setItemType( TileEntity te, ItemStack input ) - { - try - { - if( day_BarrelClass.isInstance( te ) ) - { - day_item.set( te, input == null ? null : input.copy() ); - } - } - catch( IllegalArgumentException ignored ) - { - } - catch( IllegalAccessException ignored ) - { - } - } - - @Override - public void barrelSetCount( TileEntity te, int max ) - { - try - { - if( day_BarrelClass.isInstance( te ) ) - { - day_setItemCount.invoke( te, max ); - } - - te.markDirty(); - } - catch( IllegalAccessException ignored ) - { - } - catch( IllegalArgumentException ignored ) - { - } - catch( InvocationTargetException ignored ) - { - } - } - - @Override - public IMEInventory getFactorizationBarrel( TileEntity te ) - { - return new FactorizationBarrel( this, te ); - } - - @Override - 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 - { - day_BarrelClass = Class.forName( "factorization.weird.TileEntityDayBarrel" ); - - day_getItemCount = day_BarrelClass.getDeclaredMethod( "getItemCount" ); - day_setItemCount = day_BarrelClass.getDeclaredMethod( "setItemCount", int.class ); - day_getMaxSize = day_BarrelClass.getDeclaredMethod( "getMaxSize" ); - day_item = day_BarrelClass.getDeclaredField( "item" ); - } - - @Override - public void postInit() - { - AEApi.instance().registries().externalStorage().addExternalStorageInterface( new FactorizationHandler() ); - } -} diff --git a/src/main/java/appeng/integration/modules/IC2.java b/src/main/java/appeng/integration/modules/IC2.java deleted file mode 100644 index 843d2effb..000000000 --- a/src/main/java/appeng/integration/modules/IC2.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved. - * - * Applied Energistics 2 is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Applied Energistics 2 is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Applied Energistics 2. If not, see . - */ - -package appeng.integration.modules; - - -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraftforge.common.MinecraftForge; - -import ic2.api.energy.tile.IEnergyTile; -import ic2.api.recipe.RecipeInputItemStack; - -import appeng.api.AEApi; -import appeng.api.IAppEngApi; -import appeng.api.config.TunnelType; -import appeng.api.features.IP2PTunnelRegistry; -import appeng.api.parts.IPartHelper; -import appeng.helpers.Reflected; -import appeng.integration.IIntegrationModule; -import appeng.integration.IntegrationHelper; -import appeng.integration.IntegrationRegistry; -import appeng.integration.IntegrationType; -import appeng.integration.abstraction.IIC2; - - -public class IC2 implements IIC2, IIntegrationModule -{ - @Reflected - public static IC2 instance; - - @Reflected - public IC2() - { - IntegrationHelper.testClassExistence( this, ic2.api.energy.tile.IEnergyTile.class ); - IntegrationHelper.testClassExistence( this, ic2.api.recipe.RecipeInputItemStack.class ); - } - - @Override - public void init() - { - final IAppEngApi api = AEApi.instance(); - final IPartHelper partHelper = api.partHelper(); - - if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.IC2 ) ) - { - partHelper.registerNewLayer( "appeng.parts.layers.LayerIEnergySink", "ic2.api.energy.tile.IEnergySink" ); - partHelper.registerNewLayer( "appeng.parts.layers.LayerIEnergySource", "ic2.api.energy.tile.IEnergySource" ); - } - } - - @Override - public void postInit() - { - IP2PTunnelRegistry reg = AEApi.instance().registries().p2pTunnel(); - reg.addNewAttunement( this.getItem( "copperCableItem" ), TunnelType.IC2_POWER ); - reg.addNewAttunement( this.getItem( "insulatedCopperCableItem" ), TunnelType.IC2_POWER ); - reg.addNewAttunement( this.getItem( "goldCableItem" ), TunnelType.IC2_POWER ); - reg.addNewAttunement( this.getItem( "insulatedGoldCableItem" ), TunnelType.IC2_POWER ); - reg.addNewAttunement( this.getItem( "ironCableItem" ), TunnelType.IC2_POWER ); - reg.addNewAttunement( this.getItem( "insulatedIronCableItem" ), TunnelType.IC2_POWER ); - reg.addNewAttunement( this.getItem( "insulatedTinCableItem" ), TunnelType.IC2_POWER ); - reg.addNewAttunement( this.getItem( "glassFiberCableItem" ), TunnelType.IC2_POWER ); - reg.addNewAttunement( this.getItem( "tinCableItem" ), TunnelType.IC2_POWER ); - reg.addNewAttunement( this.getItem( "detectorCableItem" ), TunnelType.IC2_POWER ); - reg.addNewAttunement( this.getItem( "splitterCableItem" ), TunnelType.IC2_POWER ); - - // this is gone? - // AEApi.INSTANCE().registries().matterCannon().registerAmmo( getItem( "uraniumDrop" ), 238.0289 ); - } - - @Override - public void addToEnergyNet( TileEntity appEngTile ) - { - MinecraftForge.EVENT_BUS.post( new ic2.api.energy.event.EnergyTileLoadEvent( (IEnergyTile) appEngTile ) ); - } - - @Override - public void removeFromEnergyNet( TileEntity appEngTile ) - { - MinecraftForge.EVENT_BUS.post( new ic2.api.energy.event.EnergyTileUnloadEvent( (IEnergyTile) appEngTile ) ); - } - - @Override - 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 ); - } -} diff --git a/src/main/java/appeng/integration/modules/ImmibisMicroblocks.java b/src/main/java/appeng/integration/modules/ImmibisMicroblocks.java deleted file mode 100644 index ada8d24c7..000000000 --- a/src/main/java/appeng/integration/modules/ImmibisMicroblocks.java +++ /dev/null @@ -1,145 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved. - * - * Applied Energistics 2 is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Applied Energistics 2 is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Applied Energistics 2. If not, see . - */ - -package appeng.integration.modules; - - -import java.lang.reflect.Method; - -import com.google.common.base.Optional; - -import net.minecraft.block.Block; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; - -import mods.immibis.core.api.multipart.ICoverSystem; -import mods.immibis.core.api.multipart.IMultipartTile; - -import appeng.api.AEApi; -import appeng.api.definitions.IBlockDefinition; -import appeng.api.parts.IPartHost; -import appeng.api.parts.IPartItem; -import appeng.core.AELog; -import appeng.helpers.Reflected; -import appeng.integration.IIntegrationModule; -import appeng.integration.IntegrationHelper; -import appeng.integration.abstraction.IImmibisMicroblocks; - - -public class ImmibisMicroblocks implements IImmibisMicroblocks, IIntegrationModule -{ - @Reflected - public static ImmibisMicroblocks instance; - - private boolean canConvertTiles = false; - - private Class MicroblockAPIUtils; - private Method mergeIntoMicroblockContainer; - - @Reflected - public ImmibisMicroblocks() - { - IntegrationHelper.testClassExistence( this, mods.immibis.core.api.multipart.IMultipartTile.class ); - IntegrationHelper.testClassExistence( this, mods.immibis.core.api.multipart.ICoverSystem.class ); - IntegrationHelper.testClassExistence( this, mods.immibis.core.api.multipart.IPartContainer.class ); - } - - @Override - public void init() throws Throwable - { - 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.canConvertTiles = true; - } - catch( Throwable t ) - { - AELog.error( t ); - } - } - - @Override - public void postInit() - { - - } - - @Override - public IPartHost getOrCreateHost( EntityPlayer player, int side, TileEntity te ) - { - final World w = te.getWorldObj(); - final int x = te.xCoord; - final int y = te.yCoord; - 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 ) - { - final IBlockDefinition multiPart = AEApi.instance().definitions().blocks().multiPart(); - final Optional maybeMultiPartBlock = multiPart.maybeBlock(); - final Optional maybeMultiPartStack = multiPart.maybeStack( 1 ); - - final boolean multiPartPresent = maybeMultiPartBlock.isPresent() && maybeMultiPartStack.isPresent(); - - if( multiPartPresent ) - { - final Block multiPartBlock = maybeMultiPartBlock.get(); - final ItemStack multiPartStack = maybeMultiPartStack.get(); - - try - { - // ItemStack.class, EntityPlayer.class, World.class, - // 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 ) - { - this.canConvertTiles = false; - return null; - } - } - } - - final TileEntity tx = w.getTileEntity( x, y, z ); - 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; - } -} diff --git a/src/main/java/appeng/integration/modules/InvTweaks.java b/src/main/java/appeng/integration/modules/InvTweaks.java deleted file mode 100644 index 424a494a2..000000000 --- a/src/main/java/appeng/integration/modules/InvTweaks.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved. - * - * Applied Energistics 2 is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Applied Energistics 2 is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Applied Energistics 2. If not, see . - */ - -package appeng.integration.modules; - - -import net.minecraft.item.ItemStack; -import net.minecraftforge.fml.common.Loader; -import invtweaks.api.InvTweaksAPI; - -import appeng.helpers.Reflected; -import appeng.integration.IIntegrationModule; -import appeng.integration.IntegrationHelper; -import appeng.integration.abstraction.IInvTweaks; - - -public class InvTweaks implements IInvTweaks, IIntegrationModule -{ - @Reflected - public static InvTweaks instance; - - static InvTweaksAPI api; - - @Reflected - public InvTweaks() - { - IntegrationHelper.testClassExistence( this, invtweaks.api.InvTweaksAPI.class ); - } - - @Override - public void init() - { - api = (InvTweaksAPI) Loader.instance().getIndexedModList().get( "inventorytweaks" ).getMod(); - } - - @Override - public void postInit() - { - if( api == null ) - { - throw new IllegalStateException( "InvTweaks API Instance Failed." ); - } - } - - @Override - public int compareItems( ItemStack i, ItemStack j ) - { - return api.compareItems( i, j ); - } -} diff --git a/src/main/java/appeng/integration/modules/MFR.java b/src/main/java/appeng/integration/modules/MFR.java deleted file mode 100644 index 26ab2bbc7..000000000 --- a/src/main/java/appeng/integration/modules/MFR.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved. - * - * Applied Energistics 2 is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Applied Energistics 2 is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Applied Energistics 2. If not, see . - */ - -package appeng.integration.modules; - - -import appeng.helpers.Reflected; -import appeng.integration.IIntegrationModule; -import appeng.integration.IntegrationHelper; - - -public class MFR implements IIntegrationModule -{ - @Reflected - public static MFR instance; - - @Reflected - public MFR() - { - IntegrationHelper.testClassExistence( this, powercrystals.minefactoryreloaded.api.rednet.connectivity.IRedNetConnection.class ); - } - - @Override - public void init() throws Throwable - { - } - - @Override - public void postInit() - { - } -} diff --git a/src/main/java/appeng/integration/modules/Mekanism.java b/src/main/java/appeng/integration/modules/Mekanism.java deleted file mode 100644 index 129a48374..000000000 --- a/src/main/java/appeng/integration/modules/Mekanism.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved. - * - * Applied Energistics 2 is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Applied Energistics 2 is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Applied Energistics 2. If not, see . - */ - -package appeng.integration.modules; - - -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; - -import cpw.mods.fml.common.event.FMLInterModComms; - -import appeng.helpers.Reflected; -import appeng.integration.IIntegrationModule; -import appeng.integration.IntegrationHelper; -import appeng.integration.abstraction.IMekanism; - - -public final class Mekanism implements IMekanism, IIntegrationModule -{ - @Reflected - public static Mekanism instance; - - @Reflected - public Mekanism() - { - IntegrationHelper.testClassExistence( this, mekanism.api.energy.IStrictEnergyAcceptor.class ); - } - - @Override - public void init() throws Throwable - { - } - - @Override - public void postInit() - { - } - - @Override - public void addCrusherRecipe( ItemStack in, ItemStack out ) - { - final NBTTagCompound sendTag = this.convertToSimpleRecipe( in, out ); - - FMLInterModComms.sendMessage( "mekanism", "CrusherRecipe", sendTag ); - } - - @Override - public void addEnrichmentChamberRecipe( ItemStack in, ItemStack out ) - { - final NBTTagCompound sendTag = this.convertToSimpleRecipe( in, out ); - - FMLInterModComms.sendMessage( "mekanism", "EnrichmentChamberRecipe", sendTag ); - } - - private NBTTagCompound convertToSimpleRecipe( ItemStack in, ItemStack out ) - { - final NBTTagCompound sendTag = new NBTTagCompound(); - final NBTTagCompound inputTagDummy = new NBTTagCompound(); - final NBTTagCompound outputTagDummy = new NBTTagCompound(); - - final NBTTagCompound inputTag = in.writeToNBT( inputTagDummy ); - final NBTTagCompound outputTag = out.writeToNBT( outputTagDummy ); - - sendTag.setTag( "input", inputTag ); - sendTag.setTag( "output", outputTag ); - - return sendTag; - } -} diff --git a/src/main/java/appeng/integration/modules/NEI.java b/src/main/java/appeng/integration/modules/NEI.java deleted file mode 100644 index 5cc47a175..000000000 --- a/src/main/java/appeng/integration/modules/NEI.java +++ /dev/null @@ -1,188 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved. - * - * Applied Energistics 2 is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Applied Energistics 2 is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Applied Energistics 2. If not, see . - */ - -package appeng.integration.modules; - - -import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.List; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.client.renderer.entity.RenderItem; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; - -import codechicken.nei.api.IStackPositioner; -import codechicken.nei.guihook.GuiContainerManager; -import codechicken.nei.guihook.IContainerTooltipHandler; - -import appeng.client.gui.AEBaseMEGui; -import appeng.client.gui.implementations.GuiCraftingTerm; -import appeng.client.gui.implementations.GuiPatternTerm; -import appeng.core.AEConfig; -import appeng.core.features.AEFeature; -import appeng.helpers.Reflected; -import appeng.integration.IIntegrationModule; -import appeng.integration.IntegrationHelper; -import appeng.integration.abstraction.INEI; -import appeng.integration.modules.NEIHelpers.NEIAEShapedRecipeHandler; -import appeng.integration.modules.NEIHelpers.NEIAEShapelessRecipeHandler; -import appeng.integration.modules.NEIHelpers.NEICraftingHandler; -import appeng.integration.modules.NEIHelpers.NEIFacadeRecipeHandler; -import appeng.integration.modules.NEIHelpers.NEIGrinderRecipeHandler; -import appeng.integration.modules.NEIHelpers.NEIInscriberRecipeHandler; -import appeng.integration.modules.NEIHelpers.NEIWorldCraftingHandler; -import appeng.integration.modules.NEIHelpers.TerminalCraftingSlotFinder; - - -public class NEI implements INEI, IContainerTooltipHandler, IIntegrationModule -{ - @Reflected - public static NEI instance; - - private final Class apiClass; - - // recipe handler... - private Method registerRecipeHandler; - private Method registerUsageHandler; - - @Reflected - public NEI() throws ClassNotFoundException - { - IntegrationHelper.testClassExistence( this, codechicken.nei.api.API.class ); - IntegrationHelper.testClassExistence( this, codechicken.nei.api.IStackPositioner.class ); - IntegrationHelper.testClassExistence( this, codechicken.nei.guihook.GuiContainerManager.class ); - IntegrationHelper.testClassExistence( this, codechicken.nei.guihook.IContainerTooltipHandler.class ); - IntegrationHelper.testClassExistence( this, codechicken.nei.recipe.ICraftingHandler.class ); - IntegrationHelper.testClassExistence( this, codechicken.nei.recipe.IUsageHandler.class ); - - this.apiClass = Class.forName( "codechicken.nei.api.API" ); - } - - @Override - public void init() throws Throwable - { - this.registerRecipeHandler = this.apiClass.getDeclaredMethod( "registerRecipeHandler", codechicken.nei.recipe.ICraftingHandler.class ); - this.registerUsageHandler = this.apiClass.getDeclaredMethod( "registerUsageHandler", codechicken.nei.recipe.IUsageHandler.class ); - - this.registerRecipeHandler( new NEIAEShapedRecipeHandler() ); - this.registerRecipeHandler( new NEIAEShapelessRecipeHandler() ); - this.registerRecipeHandler( new NEIInscriberRecipeHandler() ); - this.registerRecipeHandler( new NEIWorldCraftingHandler() ); - this.registerRecipeHandler( new NEIGrinderRecipeHandler() ); - - if( AEConfig.instance.isFeatureEnabled( AEFeature.Facades ) && AEConfig.instance.isFeatureEnabled( AEFeature.EnableFacadeCrafting ) ) - { - this.registerRecipeHandler( new NEIFacadeRecipeHandler() ); - } - - // large stack tooltips - GuiContainerManager.addTooltipHandler( this ); - - // crafting terminal... - Method registerGuiOverlay = this.apiClass.getDeclaredMethod( "registerGuiOverlay", Class.class, String.class, IStackPositioner.class ); - Class overlayHandler = Class.forName( "codechicken.nei.api.IOverlayHandler" ); - Class defaultHandler = NEICraftingHandler.class; - - Method registrar = this.apiClass.getDeclaredMethod( "registerGuiOverlayHandler", Class.class, overlayHandler, String.class ); - registerGuiOverlay.invoke( this.apiClass, GuiCraftingTerm.class, "crafting", new TerminalCraftingSlotFinder() ); - registerGuiOverlay.invoke( this.apiClass, GuiPatternTerm.class, "crafting", new TerminalCraftingSlotFinder() ); - - Constructor defaultConstructor = defaultHandler.getConstructor( int.class, int.class ); - registrar.invoke( this.apiClass, GuiCraftingTerm.class, defaultConstructor.newInstance( 6, 75 ), "crafting" ); - registrar.invoke( this.apiClass, GuiPatternTerm.class, defaultConstructor.newInstance( 6, 75 ), "crafting" ); - } - - public void registerRecipeHandler( Object o ) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException - { - this.registerRecipeHandler.invoke( this.apiClass, o ); - this.registerUsageHandler.invoke( this.apiClass, o ); - } - - @Override - public void postInit() - { - - } - - @Override - public void drawSlot( Slot s ) - { - if( s == null ) - { - return; - } - - ItemStack stack = s.getStack(); - - if( stack == null ) - { - return; - } - - Minecraft mc = Minecraft.getMinecraft(); - FontRenderer fontRenderer = mc.fontRenderer; - int x = s.xDisplayPosition; - int y = s.yDisplayPosition; - - GuiContainerManager.drawItems.renderItemAndEffectIntoGUI( fontRenderer, mc.getTextureManager(), stack, x, y ); - GuiContainerManager.drawItems.renderItemOverlayIntoGUI( fontRenderer, mc.getTextureManager(), stack, x, y, String.valueOf( stack.stackSize ) ); - } - - @Override - public RenderItem setItemRender( RenderItem renderItem ) - { - try - { - RenderItem ri = GuiContainerManager.drawItems; - GuiContainerManager.drawItems = renderItem; - return ri; - } - catch( Throwable t ) - { - throw new IllegalStateException( "Invalid version of NEI, please update", t ); - } - } - - @Override - public List handleTooltip( GuiContainer arg0, int arg1, int arg2, List current ) - { - return current; - } - - @Override - public List handleItemDisplayName( GuiContainer arg0, ItemStack arg1, List current ) - { - return current; - } - - @Override - public List handleItemTooltip( GuiContainer guiScreen, ItemStack stack, int mouseX, int mouseY, List currentToolTip ) - { - if( guiScreen instanceof AEBaseMEGui ) - { - return ( (AEBaseMEGui) guiScreen ).handleItemTooltip( stack, mouseX, mouseY, currentToolTip ); - } - - return currentToolTip; - } -} diff --git a/src/main/java/appeng/integration/modules/NEIHelpers/NEIAEShapedRecipeHandler.java b/src/main/java/appeng/integration/modules/NEIHelpers/NEIAEShapedRecipeHandler.java deleted file mode 100644 index 867003135..000000000 --- a/src/main/java/appeng/integration/modules/NEIHelpers/NEIAEShapedRecipeHandler.java +++ /dev/null @@ -1,263 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved. - * - * Applied Energistics 2 is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Applied Energistics 2 is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Applied Energistics 2. If not, see . - */ - -package appeng.integration.modules.NEIHelpers; - - -import java.awt.Rectangle; -import java.util.ArrayList; -import java.util.List; - -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.client.gui.inventory.GuiCrafting; -import net.minecraft.inventory.Container; -import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.CraftingManager; -import net.minecraft.item.crafting.IRecipe; - -import codechicken.nei.NEIClientUtils; -import codechicken.nei.NEIServerUtils; -import codechicken.nei.PositionedStack; -import codechicken.nei.api.DefaultOverlayRenderer; -import codechicken.nei.api.IOverlayHandler; -import codechicken.nei.api.IRecipeOverlayRenderer; -import codechicken.nei.api.IStackPositioner; -import codechicken.nei.recipe.RecipeInfo; -import codechicken.nei.recipe.TemplateRecipeHandler; - -import appeng.api.exceptions.MissingIngredientError; -import appeng.api.exceptions.RegistrationError; -import appeng.api.recipes.IIngredient; -import appeng.core.AEConfig; -import appeng.recipes.game.ShapedRecipe; -import appeng.util.Platform; - - -public class NEIAEShapedRecipeHandler extends TemplateRecipeHandler -{ - - @Override - public void loadTransferRects() - { - this.transferRects.add( new TemplateRecipeHandler.RecipeTransferRect( new Rectangle( 84, 23, 24, 18 ), "crafting" ) ); - } - - @Override - public void loadCraftingRecipes( String outputId, Object... results ) - { - if( ( outputId.equals( "crafting" ) ) && ( this.getClass() == NEIAEShapedRecipeHandler.class ) ) - { - List recipes = CraftingManager.getInstance().getRecipeList(); - for( IRecipe recipe : recipes ) - { - if( ( recipe instanceof ShapedRecipe ) ) - { - if( ( (ShapedRecipe) recipe ).isEnabled() ) - { - CachedShapedRecipe cachedRecipe = new CachedShapedRecipe( (ShapedRecipe) recipe ); - cachedRecipe.computeVisuals(); - this.arecipes.add( cachedRecipe ); - } - } - } - } - else - { - super.loadCraftingRecipes( outputId, results ); - } - } - - @Override - public void loadCraftingRecipes( ItemStack result ) - { - List recipes = CraftingManager.getInstance().getRecipeList(); - for( IRecipe recipe : recipes ) - { - if( ( recipe instanceof ShapedRecipe ) ) - { - if( ( (ShapedRecipe) recipe ).isEnabled() && NEIServerUtils.areStacksSameTypeCrafting( recipe.getRecipeOutput(), result ) ) - { - CachedShapedRecipe cachedRecipe = new CachedShapedRecipe( (ShapedRecipe) recipe ); - cachedRecipe.computeVisuals(); - this.arecipes.add( cachedRecipe ); - } - } - } - } - - @Override - public void loadUsageRecipes( ItemStack ingredient ) - { - List recipes = CraftingManager.getInstance().getRecipeList(); - for( IRecipe recipe : recipes ) - { - if( ( recipe instanceof ShapedRecipe ) ) - { - CachedShapedRecipe cachedRecipe = new CachedShapedRecipe( (ShapedRecipe) recipe ); - - if( ( (ShapedRecipe) recipe ).isEnabled() && cachedRecipe.contains( cachedRecipe.ingredients, ingredient.getItem() ) ) - { - cachedRecipe.computeVisuals(); - if( cachedRecipe.contains( cachedRecipe.ingredients, ingredient ) ) - { - cachedRecipe.setIngredientPermutation( cachedRecipe.ingredients, ingredient ); - this.arecipes.add( cachedRecipe ); - } - } - } - } - } - - @Override - public String getGuiTexture() - { - return "textures/gui/container/crafting_table.png"; - } - - @Override - public String getOverlayIdentifier() - { - return "crafting"; - } - - @Override - public Class getGuiClass() - { - return GuiCrafting.class; - } - - @Override - 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 ) - { - return renderer; - } - - IStackPositioner positioner = RecipeInfo.getStackPositioner( gui, "crafting2x2" ); - if( positioner == null ) - { - return null; - } - - return new DefaultOverlayRenderer( this.getIngredientStacks( recipe ), positioner ); - } - - @Override - public IOverlayHandler getOverlayHandler( GuiContainer gui, int recipe ) - { - IOverlayHandler handler = super.getOverlayHandler( gui, recipe ); - if( handler != null ) - { - return handler; - } - - return RecipeInfo.getOverlayHandler( gui, "crafting2x2" ); - } - - private boolean isRecipe2x2( final int recipe ) - { - for( PositionedStack stack : this.getIngredientStacks( recipe ) ) - { - if( ( stack.relx > 43 ) || ( stack.rely > 24 ) ) - { - return false; - } - } - return true; - } - - @Override - public String getRecipeName() - { - return NEIClientUtils.translate( "recipe.shaped" ); - } - - private class CachedShapedRecipe extends TemplateRecipeHandler.CachedRecipe - { - - private final List ingredients; - private final PositionedStack result; - - public CachedShapedRecipe( ShapedRecipe recipe ) - { - this.result = new PositionedStack( recipe.getRecipeOutput(), 119, 24 ); - this.ingredients = new ArrayList(); - this.setIngredients( recipe.getWidth(), recipe.getHeight(), recipe.getIngredients() ); - } - - private void setIngredients( final int width, final int height, final Object[] items ) - { - boolean useSingleItems = AEConfig.instance.disableColoredCableRecipesInNEI(); - for( int x = 0; x < width; x++ ) - { - for( int y = 0; y < height; y++ ) - { - if( items[( y * width + x )] != null ) - { - IIngredient ing = (IIngredient) items[( y * width + x )]; - - try - { - ItemStack[] is = ing.getItemStackSet(); - PositionedStack stack = new PositionedStack( useSingleItems ? Platform.findPreferred( is ) : is, 25 + x * 18, 6 + y * 18, false ); - stack.setMaxSize( 1 ); - this.ingredients.add( stack ); - } - catch( RegistrationError ignored ) - { - - } - catch( MissingIngredientError ignored ) - { - - } - } - } - } - } - - @Override - public PositionedStack getResult() - { - return this.result; - } - - @Override - public List getIngredients() - { - return this.getCycledIngredients( NEIAEShapedRecipeHandler.this.cycleticks / 20, this.ingredients ); - } - - private void computeVisuals() - { - for( PositionedStack p : this.ingredients ) - { - p.generatePermutations(); - } - this.result.generatePermutations(); - } - } -} \ No newline at end of file diff --git a/src/main/java/appeng/integration/modules/NEIHelpers/NEIAEShapelessRecipeHandler.java b/src/main/java/appeng/integration/modules/NEIHelpers/NEIAEShapelessRecipeHandler.java deleted file mode 100644 index a56f86d42..000000000 --- a/src/main/java/appeng/integration/modules/NEIHelpers/NEIAEShapelessRecipeHandler.java +++ /dev/null @@ -1,272 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved. - * - * Applied Energistics 2 is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Applied Energistics 2 is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Applied Energistics 2. If not, see . - */ - -package appeng.integration.modules.NEIHelpers; - - -import java.awt.Rectangle; -import java.util.ArrayList; -import java.util.List; - -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.client.gui.inventory.GuiCrafting; -import net.minecraft.inventory.Container; -import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.CraftingManager; -import net.minecraft.item.crafting.IRecipe; - -import codechicken.nei.NEIClientUtils; -import codechicken.nei.NEIServerUtils; -import codechicken.nei.PositionedStack; -import codechicken.nei.api.DefaultOverlayRenderer; -import codechicken.nei.api.IOverlayHandler; -import codechicken.nei.api.IRecipeOverlayRenderer; -import codechicken.nei.api.IStackPositioner; -import codechicken.nei.recipe.RecipeInfo; -import codechicken.nei.recipe.TemplateRecipeHandler; - -import appeng.api.exceptions.MissingIngredientError; -import appeng.api.exceptions.RegistrationError; -import appeng.api.recipes.IIngredient; -import appeng.core.AEConfig; -import appeng.recipes.game.ShapelessRecipe; -import appeng.util.Platform; - - -public class NEIAEShapelessRecipeHandler extends TemplateRecipeHandler -{ - - @Override - public void loadTransferRects() - { - this.transferRects.add( new TemplateRecipeHandler.RecipeTransferRect( new Rectangle( 84, 23, 24, 18 ), "crafting" ) ); - } - - @Override - public void loadCraftingRecipes( String outputId, Object... results ) - { - if( ( outputId.equals( "crafting" ) ) && ( this.getClass() == NEIAEShapelessRecipeHandler.class ) ) - { - List recipes = CraftingManager.getInstance().getRecipeList(); - for( IRecipe recipe : recipes ) - { - if( ( recipe instanceof ShapelessRecipe ) ) - { - if( ( (ShapelessRecipe) recipe ).isEnabled() ) - { - CachedShapelessRecipe cachedRecipe = new CachedShapelessRecipe( (ShapelessRecipe) recipe ); - cachedRecipe.computeVisuals(); - this.arecipes.add( cachedRecipe ); - } - } - } - } - else - { - super.loadCraftingRecipes( outputId, results ); - } - } - - @Override - public void loadCraftingRecipes( ItemStack result ) - { - List recipes = CraftingManager.getInstance().getRecipeList(); - for( IRecipe recipe : recipes ) - { - if( ( recipe instanceof ShapelessRecipe ) ) - { - if( ( (ShapelessRecipe) recipe ).isEnabled() && NEIServerUtils.areStacksSameTypeCrafting( recipe.getRecipeOutput(), result ) ) - { - CachedShapelessRecipe cachedRecipe = new CachedShapelessRecipe( (ShapelessRecipe) recipe ); - cachedRecipe.computeVisuals(); - this.arecipes.add( cachedRecipe ); - } - } - } - } - - @Override - public void loadUsageRecipes( ItemStack ingredient ) - { - List recipes = CraftingManager.getInstance().getRecipeList(); - for( IRecipe recipe : recipes ) - { - if( ( recipe instanceof ShapelessRecipe ) ) - { - CachedShapelessRecipe cachedRecipe = new CachedShapelessRecipe( (ShapelessRecipe) recipe ); - - if( ( (ShapelessRecipe) recipe ).isEnabled() && cachedRecipe.contains( cachedRecipe.ingredients, ingredient.getItem() ) ) - { - cachedRecipe.computeVisuals(); - if( cachedRecipe.contains( cachedRecipe.ingredients, ingredient ) ) - { - cachedRecipe.setIngredientPermutation( cachedRecipe.ingredients, ingredient ); - this.arecipes.add( cachedRecipe ); - } - } - } - } - } - - @Override - public String getGuiTexture() - { - return "textures/gui/container/crafting_table.png"; - } - - @Override - public String getOverlayIdentifier() - { - return "crafting"; - } - - @Override - public Class getGuiClass() - { - return GuiCrafting.class; - } - - @Override - 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 ) - { - return renderer; - } - - IStackPositioner positioner = RecipeInfo.getStackPositioner( gui, "crafting2x2" ); - if( positioner == null ) - { - return null; - } - - return new DefaultOverlayRenderer( this.getIngredientStacks( recipe ), positioner ); - } - - @Override - public IOverlayHandler getOverlayHandler( GuiContainer gui, int recipe ) - { - IOverlayHandler handler = super.getOverlayHandler( gui, recipe ); - if( handler != null ) - { - return handler; - } - - return RecipeInfo.getOverlayHandler( gui, "crafting2x2" ); - } - -<<<<<<< HEAD - public boolean isRecipe2x2( int recipe ) -======= - private boolean isRecipe2x2( final int recipe ) ->>>>>>> 500fc47... Reduces visibility of internal fields/methods - { - for( PositionedStack stack : this.getIngredientStacks( recipe ) ) - { - if( ( stack.relx > 43 ) || ( stack.rely > 24 ) ) - { - return false; - } - } - return true; - } - - @Override - public String getRecipeName() - { - return NEIClientUtils.translate( "recipe.shapeless" ); - } - - private class CachedShapelessRecipe extends TemplateRecipeHandler.CachedRecipe - { - - private final List ingredients; - private final PositionedStack result; - - public CachedShapelessRecipe( ShapelessRecipe recipe ) - { - this.result = new PositionedStack( recipe.getRecipeOutput(), 119, 24 ); - this.ingredients = new ArrayList(); - this.setIngredients( recipe.getInput().toArray() ); - } - - @Override - public PositionedStack getResult() - { - return this.result; - } - - @Override - public List getIngredients() - { - return this.getCycledIngredients( NEIAEShapelessRecipeHandler.this.cycleticks / 20, this.ingredients ); - } - -<<<<<<< HEAD - public void setIngredients( Object[] items ) -======= - private void setIngredients( final Object[] items ) ->>>>>>> 500fc47... Reduces visibility of internal fields/methods - { - 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 ) - { - - } - } - } - } - } - - private void computeVisuals() - { - for( PositionedStack p : this.ingredients ) - { - p.generatePermutations(); - } - - this.result.generatePermutations(); - } - } -} \ No newline at end of file diff --git a/src/main/java/appeng/integration/modules/NEIHelpers/NEICraftingHandler.java b/src/main/java/appeng/integration/modules/NEIHelpers/NEICraftingHandler.java deleted file mode 100644 index a4664a25e..000000000 --- a/src/main/java/appeng/integration/modules/NEIHelpers/NEICraftingHandler.java +++ /dev/null @@ -1,131 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved. - * - * Applied Energistics 2 is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Applied Energistics 2 is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Applied Energistics 2. If not, see . - */ - -package appeng.integration.modules.NEIHelpers; - - -import java.util.LinkedList; -import java.util.List; - -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; - -import codechicken.nei.PositionedStack; -import codechicken.nei.api.IOverlayHandler; -import codechicken.nei.recipe.IRecipeHandler; - -import appeng.client.gui.implementations.GuiCraftingTerm; -import appeng.client.gui.implementations.GuiPatternTerm; -import appeng.container.slot.SlotCraftingMatrix; -import appeng.container.slot.SlotFakeCraftingMatrix; -import appeng.core.sync.network.NetworkHandler; -import appeng.core.sync.packets.PacketNEIRecipe; -import appeng.util.Platform; - - -public class NEICraftingHandler implements IOverlayHandler -{ - - private final int offsetX; - private final int offsetY; - - public NEICraftingHandler( final int x, final int y ) - { - } - - @Override - 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( Error ignored ) - { - } - } - - private void overlayRecipe( GuiContainer gui, List ingredients, boolean shift ) - { - try - { - NBTTagCompound recipe = new NBTTagCompound(); - - if( gui instanceof GuiCraftingTerm || gui instanceof GuiPatternTerm ) - { - for( PositionedStack positionedStack : ingredients ) - { - int col = ( positionedStack.relx - 25 ) / 18; - int row = ( positionedStack.rely - 6 ) / 18; - if( positionedStack.items != null && positionedStack.items.length > 0 ) - { - for( Slot slot : (List) gui.inventorySlots.inventorySlots ) - { - if( slot instanceof SlotCraftingMatrix || slot instanceof SlotFakeCraftingMatrix ) - { - if( slot.getSlotIndex() == col + row * 3 ) - { - NBTTagList tags = new NBTTagList(); - List list = new LinkedList(); - - // prefer pure crystals. - for( int x = 0; x < positionedStack.items.length; x++ ) - { - if( Platform.isRecipePrioritized( positionedStack.items[x] ) ) - { - list.add( 0, positionedStack.items[x] ); - } - else - { - list.add( positionedStack.items[x] ); - } - } - - for( ItemStack is : list ) - { - NBTTagCompound tag = new NBTTagCompound(); - is.writeToNBT( tag ); - tags.appendTag( tag ); - } - - recipe.setTag( "#" + slot.getSlotIndex(), tags ); - break; - } - } - } - } - } - - NetworkHandler.instance.sendToServer( new PacketNEIRecipe( recipe ) ); - } - } - catch( Exception ignored ) - { - } - catch( Error ignored ) - { - } - } -} diff --git a/src/main/java/appeng/integration/modules/NEIHelpers/NEIFacadeRecipeHandler.java b/src/main/java/appeng/integration/modules/NEIHelpers/NEIFacadeRecipeHandler.java deleted file mode 100644 index ddf94f533..000000000 --- a/src/main/java/appeng/integration/modules/NEIHelpers/NEIFacadeRecipeHandler.java +++ /dev/null @@ -1,249 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved. - * - * Applied Energistics 2 is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Applied Energistics 2 is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Applied Energistics 2. If not, see . - */ - -package appeng.integration.modules.NEIHelpers; - - -import java.awt.Rectangle; -import java.util.ArrayList; -import java.util.List; - -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.client.gui.inventory.GuiCrafting; -import net.minecraft.inventory.Container; -import net.minecraft.item.ItemStack; - -import codechicken.nei.PositionedStack; -import codechicken.nei.api.DefaultOverlayRenderer; -import codechicken.nei.api.IOverlayHandler; -import codechicken.nei.api.IRecipeOverlayRenderer; -import codechicken.nei.api.IStackPositioner; -import codechicken.nei.recipe.RecipeInfo; -import codechicken.nei.recipe.TemplateRecipeHandler; - -import appeng.api.AEApi; -import appeng.api.definitions.IDefinitions; -import appeng.api.definitions.IItemDefinition; -import appeng.core.localization.GuiText; -import appeng.facade.IFacadeItem; -import appeng.items.parts.ItemFacade; - - -public class NEIFacadeRecipeHandler extends TemplateRecipeHandler -{ - private final ItemFacade facade; - private final IItemDefinition anchorDefinition; - - public NEIFacadeRecipeHandler() - { - final IDefinitions definitions = AEApi.instance().definitions(); - - this.facade = (ItemFacade) definitions.items().facade().maybeItem().get(); - this.anchorDefinition = definitions.parts().cableAnchor(); - } - - @Override - public void loadTransferRects() - { - this.transferRects.add( new TemplateRecipeHandler.RecipeTransferRect( new Rectangle( 84, 23, 24, 18 ), "crafting" ) ); - } - - @Override - public void loadCraftingRecipes( String outputId, Object... results ) - { - if( ( outputId.equals( "crafting" ) ) && ( this.getClass() == NEIFacadeRecipeHandler.class ) ) - { - final List facades = this.facade.getFacades(); - for( ItemStack anchorStack : this.anchorDefinition.maybeStack( 1 ).asSet() ) - { - for( ItemStack is : facades ) - { - CachedShapedRecipe recipe = new CachedShapedRecipe( this.facade, anchorStack, is ); - recipe.computeVisuals(); - this.arecipes.add( recipe ); - } - } - } - else - { - super.loadCraftingRecipes( outputId, results ); - } - } - - @Override - public void loadCraftingRecipes( ItemStack result ) - { - if( result.getItem() == this.facade ) - { - for( ItemStack anchorStack : this.anchorDefinition.maybeStack( 1 ).asSet() ) - { - CachedShapedRecipe recipe = new CachedShapedRecipe( this.facade, anchorStack, result ); - recipe.computeVisuals(); - this.arecipes.add( recipe ); - } - } - } - - @Override - public void loadUsageRecipes( ItemStack ingredient ) - { - List facades = this.facade.getFacades(); - for( ItemStack anchorStack : this.anchorDefinition.maybeStack( 1 ).asSet() ) - { - for( ItemStack is : facades ) - { - CachedShapedRecipe recipe = new CachedShapedRecipe( this.facade, anchorStack, is ); - - if( recipe.contains( recipe.ingredients, ingredient.getItem() ) ) - { - recipe.computeVisuals(); - if( recipe.contains( recipe.ingredients, ingredient ) ) - { - recipe.setIngredientPermutation( recipe.ingredients, ingredient ); - this.arecipes.add( recipe ); - } - } - } - } - } - - @Override - public String getGuiTexture() - { - return "textures/gui/container/crafting_table.png"; - } - - @Override - public String getOverlayIdentifier() - { - return "crafting"; - } - - @Override - public Class getGuiClass() - { - return GuiCrafting.class; - } - - @Override - 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 ) - { - return renderer; - } - - IStackPositioner positioner = RecipeInfo.getStackPositioner( gui, "crafting2x2" ); - if( positioner == null ) - { - return null; - } - - return new DefaultOverlayRenderer( this.getIngredientStacks( recipe ), positioner ); - } - - @Override - public IOverlayHandler getOverlayHandler( GuiContainer gui, int recipe ) - { - IOverlayHandler handler = super.getOverlayHandler( gui, recipe ); - if( handler != null ) - { - return handler; - } - - return RecipeInfo.getOverlayHandler( gui, "crafting2x2" ); - } - - private boolean isRecipe2x2( final int recipe ) - { - for( PositionedStack stack : this.getIngredientStacks( recipe ) ) - { - if( ( stack.relx > 43 ) || ( stack.rely > 24 ) ) - { - return false; - } - } - return true; - } - - @Override - public String getRecipeName() - { - return GuiText.FacadeCrafting.getLocal(); - } - - private final class CachedShapedRecipe extends TemplateRecipeHandler.CachedRecipe - { - public final List ingredients; - public final PositionedStack result; - - public CachedShapedRecipe( IFacadeItem facade, ItemStack anchor, ItemStack output ) - { - output.stackSize = 4; - this.result = new PositionedStack( output, 119, 24 ); - this.ingredients = new ArrayList(); - ItemStack in = facade.getTextureItem( output ); - this.setIngredients( 3, 3, new Object[] { null, anchor, null, anchor, in, anchor, null, anchor, null } ); - } - - public void setIngredients( int width, int height, Object[] items ) - { - for( int x = 0; x < width; x++ ) - { - for( int y = 0; y < height; y++ ) - { - 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 ); - stack.setMaxSize( 1 ); - this.ingredients.add( stack ); - } - } - } - } - - @Override - public PositionedStack getResult() - { - return this.result; - } - - @Override - public List getIngredients() - { - return this.getCycledIngredients( NEIFacadeRecipeHandler.this.cycleticks / 20, this.ingredients ); - } - - public void computeVisuals() - { - for( PositionedStack p : this.ingredients ) - { - p.generatePermutations(); - } - this.result.generatePermutations(); - } - } -} \ No newline at end of file diff --git a/src/main/java/appeng/integration/modules/NEIHelpers/NEIGrinderRecipeHandler.java b/src/main/java/appeng/integration/modules/NEIHelpers/NEIGrinderRecipeHandler.java deleted file mode 100644 index 68116e3ed..000000000 --- a/src/main/java/appeng/integration/modules/NEIHelpers/NEIGrinderRecipeHandler.java +++ /dev/null @@ -1,243 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved. - * - * Applied Energistics 2 is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Applied Energistics 2 is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Applied Energistics 2. If not, see . - */ - -package appeng.integration.modules.NEIHelpers; - - -import java.awt.Rectangle; -import java.util.ArrayList; -import java.util.List; - -import org.lwjgl.opengl.GL11; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.inventory.Container; -import net.minecraft.item.ItemStack; -import net.minecraft.util.ResourceLocation; - -import codechicken.lib.gui.GuiDraw; -import codechicken.nei.NEIServerUtils; -import codechicken.nei.PositionedStack; -import codechicken.nei.api.IOverlayHandler; -import codechicken.nei.api.IRecipeOverlayRenderer; -import codechicken.nei.recipe.TemplateRecipeHandler; - -import appeng.api.AEApi; -import appeng.api.features.IGrinderEntry; -import appeng.client.gui.implementations.GuiGrinder; -import appeng.core.localization.GuiText; - - -public class NEIGrinderRecipeHandler extends TemplateRecipeHandler -{ - - @Override - public void loadTransferRects() - { - this.transferRects.add( new TemplateRecipeHandler.RecipeTransferRect( new Rectangle( 84, 23, 24, 18 ), "grindstone" ) ); - } - - @Override - public void loadCraftingRecipes( String outputId, Object... results ) - { - if( ( outputId.equals( "grindstone" ) ) && ( this.getClass() == NEIGrinderRecipeHandler.class ) ) - { - for( IGrinderEntry recipe : AEApi.instance().registries().grinder().getRecipes() ) - { - CachedGrindStoneRecipe cachedRecipe = new CachedGrindStoneRecipe( recipe ); - cachedRecipe.computeVisuals(); - this.arecipes.add( cachedRecipe ); - } - } - else - { - super.loadCraftingRecipes( outputId, results ); - } - } - - @Override - public void loadCraftingRecipes( ItemStack result ) - { - for( IGrinderEntry recipe : AEApi.instance().registries().grinder().getRecipes() ) - { - if( NEIServerUtils.areStacksSameTypeCrafting( recipe.getOutput(), result ) ) - { - CachedGrindStoneRecipe cachedRecipe = new CachedGrindStoneRecipe( recipe ); - cachedRecipe.computeVisuals(); - this.arecipes.add( cachedRecipe ); - } - } - } - - @Override - public void loadUsageRecipes( ItemStack ingredient ) - { - for( IGrinderEntry recipe : AEApi.instance().registries().grinder().getRecipes() ) - { - CachedGrindStoneRecipe cachedRecipe = new CachedGrindStoneRecipe( recipe ); - - if( ( cachedRecipe.contains( cachedRecipe.ingredients, ingredient.getItem() ) ) ) - { - cachedRecipe.computeVisuals(); - if( cachedRecipe.contains( cachedRecipe.ingredients, ingredient ) ) - { - cachedRecipe.setIngredientPermutation( cachedRecipe.ingredients, ingredient ); - this.arecipes.add( cachedRecipe ); - } - } - } - } - - @Override - public String getGuiTexture() - { - ResourceLocation loc = new ResourceLocation( "appliedenergistics2", "textures/guis/grinder.png" ); - - return loc.toString(); - } - - @Override - public String getOverlayIdentifier() - { - return "grindstone"; - } - - @Override - public Class getGuiClass() - { - return GuiGrinder.class; - } - - @Override - public void drawBackground( int recipe ) - { - GL11.glColor4f( 1, 1, 1, 1 ); - GuiDraw.changeTexture( this.getGuiTexture() ); - GuiDraw.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.displayChance ); - fr.drawString( cachedRecipe.displayChance, ( 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 ) - { - return null; - } - - @Override - public IOverlayHandler getOverlayHandler( GuiContainer gui, int recipe ) - { - return null; - } - - @Override - public String getRecipeName() - { - return GuiText.GrindStone.getLocal(); - } - - private class CachedGrindStoneRecipe extends TemplateRecipeHandler.CachedRecipe - { - private final List ingredients; - private final PositionedStack result; - private String displayChance; - private boolean hasOptional = false; - - public CachedGrindStoneRecipe( IGrinderEntry recipe ) - { - this.result = new PositionedStack( recipe.getOutput(), -30 + 107, 47 ); - this.ingredients = new ArrayList(); - - final ItemStack optionalOutput = recipe.getOptionalOutput(); - final int optionalChancePercent = (int) ( recipe.getOptionalChance() * 100 ); - if( optionalOutput != null ) - { - this.hasOptional = true; - this.displayChance = String.format( GuiText.OfSecondOutput.getLocal(), optionalChancePercent ); - this.ingredients.add( new PositionedStack( optionalOutput, -30 + 107 + 18, 47 ) ); - } - - final ItemStack secondOptionalOutput = recipe.getSecondOptionalOutput(); - final int secondOptionalChancePercent = (int) ( recipe.getSecondOptionalChance() * 100 ); - if( secondOptionalOutput != null ) - { - this.hasOptional = true; - this.displayChance = String.format( GuiText.MultipleOutputs.getLocal(), optionalChancePercent, secondOptionalChancePercent ); - this.ingredients.add( new PositionedStack( secondOptionalOutput, -30 + 107 + 18 + 18, 47 ) ); - } - - if( recipe.getInput() != null ) - { - this.ingredients.add( new PositionedStack( recipe.getInput(), 45, 24 ) ); - } - } - - @Override - public PositionedStack getResult() - { - return this.result; - } - - @Override - public List getIngredients() - { - return this.getCycledIngredients( NEIGrinderRecipeHandler.this.cycleticks / 20, this.ingredients ); - } - - private void computeVisuals() - { - for( PositionedStack p : this.ingredients ) - { - p.generatePermutations(); - } - this.result.generatePermutations(); - } - } -} \ No newline at end of file diff --git a/src/main/java/appeng/integration/modules/NEIHelpers/NEIInscriberRecipeHandler.java b/src/main/java/appeng/integration/modules/NEIHelpers/NEIInscriberRecipeHandler.java deleted file mode 100644 index baa955dfd..000000000 --- a/src/main/java/appeng/integration/modules/NEIHelpers/NEIInscriberRecipeHandler.java +++ /dev/null @@ -1,208 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved. - * - * Applied Energistics 2 is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Applied Energistics 2 is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Applied Energistics 2. If not, see . - */ - -package appeng.integration.modules.NEIHelpers; - - -import java.awt.Rectangle; -import java.util.ArrayList; -import java.util.List; - -import org.lwjgl.opengl.GL11; - -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.inventory.Container; -import net.minecraft.item.ItemStack; -import net.minecraft.util.ResourceLocation; - -import codechicken.lib.gui.GuiDraw; -import codechicken.nei.NEIServerUtils; -import codechicken.nei.PositionedStack; -import codechicken.nei.api.IOverlayHandler; -import codechicken.nei.api.IRecipeOverlayRenderer; -import codechicken.nei.recipe.TemplateRecipeHandler; - -import appeng.api.AEApi; -import appeng.api.features.IInscriberRecipe; -import appeng.client.gui.implementations.GuiInscriber; -import appeng.core.localization.GuiText; - - -/** - * @author AlgorithmX2 - * @author thatsIch - * @version rv2 - * @since rv0 - */ -public class NEIInscriberRecipeHandler extends TemplateRecipeHandler -{ - - @Override - public void loadTransferRects() - { - this.transferRects.add( new TemplateRecipeHandler.RecipeTransferRect( new Rectangle( 84, 23, 24, 18 ), "inscriber" ) ); - } - - @Override - public void loadCraftingRecipes( String outputId, Object... results ) - { - if( ( outputId.equals( "inscriber" ) ) && ( this.getClass() == NEIInscriberRecipeHandler.class ) ) - { - for( IInscriberRecipe recipe : AEApi.instance().registries().inscriber().getRecipes() ) - { - CachedInscriberRecipe cachedRecipe = new CachedInscriberRecipe( recipe ); - cachedRecipe.computeVisuals(); - this.arecipes.add( cachedRecipe ); - } - } - else - { - super.loadCraftingRecipes( outputId, results ); - } - } - - @Override - public void loadCraftingRecipes( ItemStack result ) - { - for( IInscriberRecipe recipe : AEApi.instance().registries().inscriber().getRecipes() ) - { - if( NEIServerUtils.areStacksSameTypeCrafting( recipe.getOutput(), result ) ) - { - CachedInscriberRecipe cachedRecipe = new CachedInscriberRecipe( recipe ); - cachedRecipe.computeVisuals(); - this.arecipes.add( cachedRecipe ); - } - } - } - - @Override - public void loadUsageRecipes( ItemStack ingredient ) - { - for( IInscriberRecipe recipe : AEApi.instance().registries().inscriber().getRecipes() ) - { - CachedInscriberRecipe cachedRecipe = new CachedInscriberRecipe( recipe ); - - if( ( cachedRecipe.contains( cachedRecipe.ingredients, ingredient.getItem() ) ) ) - { - cachedRecipe.computeVisuals(); - if( cachedRecipe.contains( cachedRecipe.ingredients, ingredient ) ) - { - cachedRecipe.setIngredientPermutation( cachedRecipe.ingredients, ingredient ); - this.arecipes.add( cachedRecipe ); - } - } - } - } - - @Override - public String getGuiTexture() - { - ResourceLocation loc = new ResourceLocation( "appliedenergistics2", "textures/guis/inscriber.png" ); - return loc.toString(); - } - - @Override - public String getOverlayIdentifier() - { - return "inscriber"; - } - - @Override - public Class getGuiClass() - { - return GuiInscriber.class; - } - - @Override - public void drawBackground( int recipe ) - { - GL11.glColor4f( 1, 1, 1, 1 ); - GuiDraw.changeTexture( this.getGuiTexture() ); - GuiDraw.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 ) - { - return null; - } - - @Override - public IOverlayHandler getOverlayHandler( GuiContainer gui, int recipe ) - { - return null; - } - - @Override - public String getRecipeName() - { - return GuiText.Inscriber.getLocal(); - } - - private class CachedInscriberRecipe extends TemplateRecipeHandler.CachedRecipe - { - - private final List ingredients; - private final PositionedStack result; - - public CachedInscriberRecipe( IInscriberRecipe recipe ) - { - this.result = new PositionedStack( recipe.getOutput(), 108, 29 ); - this.ingredients = new ArrayList(); - - for( ItemStack top : recipe.getTopOptional().asSet() ) - { - this.ingredients.add( new PositionedStack( top, 40, 5 ) ); - } - - this.ingredients.add( new PositionedStack( recipe.getInputs(), 40 + 18, 28 ) ); - - for( ItemStack bot : recipe.getBottomOptional().asSet() ) - { - this.ingredients.add( new PositionedStack( bot, 40, 51 ) ); - } - } - - @Override - public PositionedStack getResult() - { - return this.result; - } - - @Override - public List getIngredients() - { - return this.getCycledIngredients( NEIInscriberRecipeHandler.this.cycleticks / 20, this.ingredients ); - } - - private void computeVisuals() - { - for( PositionedStack p : this.ingredients ) - { - p.generatePermutations(); - } - this.result.generatePermutations(); - } - } -} \ No newline at end of file diff --git a/src/main/java/appeng/integration/modules/NEIHelpers/NEIWorldCraftingHandler.java b/src/main/java/appeng/integration/modules/NEIHelpers/NEIWorldCraftingHandler.java deleted file mode 100644 index b8d8c3990..000000000 --- a/src/main/java/appeng/integration/modules/NEIHelpers/NEIWorldCraftingHandler.java +++ /dev/null @@ -1,254 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved. - * - * Applied Energistics 2 is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Applied Energistics 2 is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Applied Energistics 2. If not, see . - */ - -package appeng.integration.modules.NEIHelpers; - - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; - -import org.lwjgl.opengl.GL11; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.inventory.Container; -import net.minecraft.item.ItemStack; - -import codechicken.nei.NEIServerUtils; -import codechicken.nei.PositionedStack; -import codechicken.nei.api.IOverlayHandler; -import codechicken.nei.api.IRecipeOverlayRenderer; -import codechicken.nei.recipe.GuiRecipe; -import codechicken.nei.recipe.ICraftingHandler; -import codechicken.nei.recipe.IUsageHandler; - -import appeng.api.AEApi; -import appeng.api.definitions.IDefinitions; -import appeng.api.definitions.IItemDefinition; -import appeng.api.definitions.IMaterials; -import appeng.core.AEConfig; -import appeng.core.features.AEFeature; -import appeng.core.localization.GuiText; - - -public class NEIWorldCraftingHandler implements ICraftingHandler, IUsageHandler -{ - - private final Map details = new HashMap(); - private final List offsets = new LinkedList(); - private final List outputs = new LinkedList(); - - private ItemStack target; - - @Override - public String getRecipeName() - { - return GuiText.InWorldCrafting.getLocal(); - } - - @Override - public int numRecipes() - { - return this.offsets.size(); - } - - @Override - public void drawBackground( int recipe ) - { - GL11.glColor4f( 1, 1, 1, 1 );// nothing. - } - - @Override - public void drawForeground( int recipe ) - { - if( this.outputs.size() > recipe ) - { - // PositionedStack cr = this.outputs.get( recipe ); - String details = this.details.get( this.offsets.get( recipe ) ); - - FontRenderer fr = Minecraft.getMinecraft().fontRenderer; - fr.drawSplitString( details, 10, 25, 150, 0 ); - } - } - - @Override - public List getIngredientStacks( int recipeIndex ) - { - return new ArrayList(); - } - - @Override - public List getOtherStacks( int recipeIndex ) - { - return new ArrayList(); - } - - @Override - public PositionedStack getResultStack( int recipe ) - { - return this.outputs.get( recipe ); - } - - @Override - public void onUpdate() - { - - } - - @Override - public boolean hasOverlay( GuiContainer gui, Container container, int recipe ) - { - return false; - } - - @Override - public IRecipeOverlayRenderer getOverlayRenderer( GuiContainer gui, int recipe ) - { - return null; - } - - @Override - public IOverlayHandler getOverlayHandler( GuiContainer gui, int recipe ) - { - return null; - } - - @Override - public int recipiesPerPage() - { - return 1; - } - - @Override - public List handleTooltip( GuiRecipe gui, List currentToolTip, int recipe ) - { - return currentToolTip; - } - - @Override - public List handleItemTooltip( GuiRecipe gui, ItemStack stack, List currentToolTip, int recipe ) - { - return currentToolTip; - } - - @Override - public boolean keyTyped( GuiRecipe gui, char keyChar, int keyCode, int recipe ) - { - return false; - } - - @Override - public boolean mouseClicked( GuiRecipe gui, int button, int recipe ) - { - return false; - } - - @Override - public IUsageHandler getUsageHandler( String inputId, Object... ingredients ) - { - return this; - } - - @Override - public ICraftingHandler getRecipeHandler( String outputId, Object... results ) - { - NEIWorldCraftingHandler g = this.newInstance(); - if( results.length > 0 && results[0] instanceof ItemStack ) - { - g.target = (ItemStack) results[0]; - g.addRecipes(); - return g; - } - return this; - } - - private NEIWorldCraftingHandler newInstance() - { - try - { - return this.getClass().newInstance(); - } - catch( InstantiationException e ) - { - throw new IllegalStateException( e ); - } - catch( IllegalAccessException e ) - { - throw new IllegalStateException( 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 ); - } - } - } -} \ No newline at end of file diff --git a/src/main/java/appeng/integration/modules/NEIHelpers/TerminalCraftingSlotFinder.java b/src/main/java/appeng/integration/modules/NEIHelpers/TerminalCraftingSlotFinder.java deleted file mode 100644 index eb86e0a65..000000000 --- a/src/main/java/appeng/integration/modules/NEIHelpers/TerminalCraftingSlotFinder.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved. - * - * Applied Energistics 2 is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Applied Energistics 2 is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Applied Energistics 2. If not, see . - */ - -package appeng.integration.modules.NEIHelpers; - - -import java.util.ArrayList; - -import codechicken.nei.PositionedStack; -import codechicken.nei.api.IStackPositioner; - -import appeng.client.gui.implementations.GuiMEMonitorable; - - -public class TerminalCraftingSlotFinder implements IStackPositioner -{ - - @Override - public ArrayList positionStacks( ArrayList a ) - { - for( PositionedStack ps : a ) - { - if( ps != null ) - { - ps.relx += GuiMEMonitorable.craftingGridOffsetX; - ps.rely += GuiMEMonitorable.craftingGridOffsetY; - } - } - return a; - } -} diff --git a/src/main/java/appeng/integration/modules/OpenComputers.java b/src/main/java/appeng/integration/modules/OpenComputers.java deleted file mode 100644 index f23e378b0..000000000 --- a/src/main/java/appeng/integration/modules/OpenComputers.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved. - * - * Applied Energistics 2 is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Applied Energistics 2 is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Applied Energistics 2. If not, see . - */ - -package appeng.integration.modules; - -import li.cil.oc.api.Items; - -import appeng.api.AEApi; -import appeng.api.IAppEngApi; -import appeng.api.config.TunnelType; -import appeng.api.features.IP2PTunnelRegistry; -import appeng.api.parts.IPartHelper; -import appeng.helpers.Reflected; -import appeng.integration.IIntegrationModule; -import appeng.integration.IntegrationHelper; -import appeng.integration.IntegrationRegistry; -import appeng.integration.IntegrationType; - - -public class OpenComputers implements IIntegrationModule -{ - @Reflected - public static OpenComputers instance; - - @Reflected - public OpenComputers() - { - IntegrationHelper.testClassExistence( this, li.cil.oc.api.Items.class ); - IntegrationHelper.testClassExistence( this, li.cil.oc.api.Network.class ); - IntegrationHelper.testClassExistence( this, li.cil.oc.api.network.Environment.class ); - IntegrationHelper.testClassExistence( this, li.cil.oc.api.network.SidedEnvironment.class ); - IntegrationHelper.testClassExistence( this, li.cil.oc.api.network.Node.class ); - IntegrationHelper.testClassExistence( this, li.cil.oc.api.network.Message.class ); - } - - @Override - public void init() - { - final IAppEngApi api = AEApi.instance(); - final IPartHelper partHelper = api.partHelper(); - - if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.OpenComputers ) ) - { - partHelper.registerNewLayer( "appeng.parts.layers.LayerSidedEnvironment", "li.cil.oc.api.network.SidedEnvironment" ); - } - } - - @Override - public void postInit() - { - final IP2PTunnelRegistry registry = AEApi.instance().registries().p2pTunnel(); - - registry.addNewAttunement( Items.get( "cable" ).createItemStack( 1 ), TunnelType.COMPUTER_MESSAGE ); - registry.addNewAttunement( Items.get( "adapter" ).createItemStack( 1 ), TunnelType.COMPUTER_MESSAGE ); - registry.addNewAttunement( Items.get( "switch" ).createItemStack( 1 ), TunnelType.COMPUTER_MESSAGE ); - registry.addNewAttunement( Items.get( "accessPoint" ).createItemStack( 1 ), TunnelType.COMPUTER_MESSAGE ); - registry.addNewAttunement( Items.get( "lanCard" ).createItemStack( 1 ), TunnelType.COMPUTER_MESSAGE ); - registry.addNewAttunement( Items.get( "linkedCard" ).createItemStack( 1 ), TunnelType.COMPUTER_MESSAGE ); - registry.addNewAttunement( Items.get( "wlanCard" ).createItemStack( 1 ), TunnelType.COMPUTER_MESSAGE ); - registry.addNewAttunement( Items.get( "analyzer" ).createItemStack( 1 ), TunnelType.COMPUTER_MESSAGE ); - } -} diff --git a/src/main/java/appeng/integration/modules/PneumaticCraft.java b/src/main/java/appeng/integration/modules/PneumaticCraft.java deleted file mode 100644 index 496309304..000000000 --- a/src/main/java/appeng/integration/modules/PneumaticCraft.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved. - * - * Applied Energistics 2 is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Applied Energistics 2 is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Applied Energistics 2. If not, see . - */ - -package appeng.integration.modules; - - -import net.minecraft.item.ItemStack; -import net.minecraftforge.oredict.OreDictionary; - -import cpw.mods.fml.common.registry.GameRegistry; - -import appeng.api.AEApi; -import appeng.api.IAppEngApi; -import appeng.api.config.TunnelType; -import appeng.api.features.IP2PTunnelRegistry; -import appeng.api.parts.IPartHelper; -import appeng.helpers.Reflected; -import appeng.integration.IIntegrationModule; -import appeng.integration.IntegrationHelper; -import appeng.integration.IntegrationRegistry; -import appeng.integration.IntegrationType; - - -public class PneumaticCraft implements IIntegrationModule -{ - @Reflected - public static PneumaticCraft instance; - - private static final String PNEUMATIC_CRAFT_MOD_ID = "PneumaticCraft"; - - @Reflected - public PneumaticCraft() - { - IntegrationHelper.testClassExistence( this, pneumaticCraft.api.block.BlockSupplier.class ); - IntegrationHelper.testClassExistence( this, pneumaticCraft.api.tileentity.ISidedPneumaticMachine.class ); - IntegrationHelper.testClassExistence( this, pneumaticCraft.api.tileentity.AirHandlerSupplier.class ); - IntegrationHelper.testClassExistence( this, pneumaticCraft.api.tileentity.IAirHandler.class ); - } - - @Override - public void init() - { - final IAppEngApi api = AEApi.instance(); - final IPartHelper partHelper = api.partHelper(); - - if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.PneumaticCraft ) ) - { - partHelper.registerNewLayer( appeng.parts.layers.LayerPressure.class.getName(), pneumaticCraft.api.tileentity.ISidedPneumaticMachine.class.getName() ); - } - } - - @Override - public void postInit() - { - this.registerPressureAttunement( "pressureTube" ); - this.registerPressureAttunement( "advancedPressureTube" ); - } - - private void registerPressureAttunement( String itemID ) - { - final IP2PTunnelRegistry registry = AEApi.instance().registries().p2pTunnel(); - final ItemStack modItem = GameRegistry.findItemStack( PNEUMATIC_CRAFT_MOD_ID, itemID, 1 ); - - if( modItem != null ) - { - modItem.setItemDamage( OreDictionary.WILDCARD_VALUE ); - registry.addNewAttunement( modItem, TunnelType.PRESSURE ); - } - } -} diff --git a/src/main/java/appeng/integration/modules/RC.java b/src/main/java/appeng/integration/modules/RC.java deleted file mode 100644 index 49dc1f22d..000000000 --- a/src/main/java/appeng/integration/modules/RC.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved. - * - * Applied Energistics 2 is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Applied Energistics 2 is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Applied Energistics 2. If not, see . - */ - -package appeng.integration.modules; - - -import net.minecraft.item.ItemStack; - -import mods.railcraft.api.crafting.IRockCrusherRecipe; -import mods.railcraft.api.crafting.RailcraftCraftingManager; - -import appeng.helpers.Reflected; -import appeng.integration.IIntegrationModule; -import appeng.integration.IntegrationHelper; -import appeng.integration.abstraction.IRC; - - -public class RC implements IRC, IIntegrationModule -{ - @Reflected - public static RC instance; - - @Reflected - public RC() - { - IntegrationHelper.testClassExistence( this, mods.railcraft.api.crafting.RailcraftCraftingManager.class ); - IntegrationHelper.testClassExistence( this, mods.railcraft.api.crafting.IRockCrusherRecipe.class ); - } - - @Override - public void rockCrusher( ItemStack input, ItemStack output ) - { - IRockCrusherRecipe re = RailcraftCraftingManager.rockCrusher.createNewRecipe( input, true, true ); - re.addOutput( output, 1.0f ); - } - - @Override - public void init() - { - } - - @Override - public void postInit() - { - } -} diff --git a/src/main/java/appeng/integration/modules/RF.java b/src/main/java/appeng/integration/modules/RF.java deleted file mode 100644 index 502de7dd7..000000000 --- a/src/main/java/appeng/integration/modules/RF.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved. - * - * Applied Energistics 2 is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Applied Energistics 2 is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Applied Energistics 2. If not, see . - */ - -package appeng.integration.modules; - - -import net.minecraft.item.ItemStack; -import net.minecraftforge.fml.common.registry.GameRegistry; -import net.minecraftforge.oredict.OreDictionary; -import appeng.api.AEApi; -import appeng.api.IAppEngApi; -import appeng.api.config.TunnelType; -import appeng.api.parts.IPartHelper; -import appeng.helpers.Reflected; -import appeng.integration.IIntegrationModule; -import appeng.integration.IntegrationHelper; -import appeng.integration.IntegrationRegistry; -import appeng.integration.IntegrationType; - - -public final class RF implements IIntegrationModule -{ - @Reflected - public static RF instance; - - @Reflected - public RF() - { - IntegrationHelper.testClassExistence( this, cofh.api.energy.IEnergyReceiver.class ); - IntegrationHelper.testClassExistence( this, cofh.api.energy.IEnergyProvider.class ); - IntegrationHelper.testClassExistence( this, cofh.api.energy.IEnergyHandler.class ); - IntegrationHelper.testClassExistence( this, cofh.api.energy.IEnergyConnection.class ); - } - - @Override - public void init() - { - final IAppEngApi api = AEApi.instance(); - final IPartHelper partHelper = api.partHelper(); - - if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.RF ) ) - { - partHelper.registerNewLayer( "appeng.parts.layers.LayerIEnergyHandler", "cofh.api.energy.IEnergyReceiver" ); - } - } - - @Override - public void postInit() - { - this.registerRFAttunement( "ExtraUtilities", "extractor_base", 12 ); - this.registerRFAttunement( "ExtraUtilities", "pipes", 11 ); - this.registerRFAttunement( "ExtraUtilities", "pipes", 14 ); - this.registerRFAttunement( "ExtraUtilities", "generator", OreDictionary.WILDCARD_VALUE ); - - this.registerRFAttunement( "ThermalExpansion", "Cell", OreDictionary.WILDCARD_VALUE ); - this.registerRFAttunement( "ThermalExpansion", "Dynamo", OreDictionary.WILDCARD_VALUE ); - - // Fluxduct - this.registerRFAttunement( "ThermalDynamics", "ThermalDynamics_0", 0 ); - - this.registerRFAttunement( "EnderIO", "itemPowerConduit", OreDictionary.WILDCARD_VALUE ); - this.registerRFAttunement( "EnderIO", "blockCapacitorBank", 0 ); - this.registerRFAttunement( "EnderIO", "blockPowerMonitor", 0 ); - } - - private void registerRFAttunement( String mod, String name, int dmg ) - { - assert mod != null; - assert !mod.isEmpty(); - assert name != null; - assert !name.isEmpty(); - assert dmg >= 0; - - final ItemStack modItem = GameRegistry.findItemStack( mod, name, 1 ); - if( modItem != null ) - { - modItem.setItemDamage( dmg ); - AEApi.instance().registries().p2pTunnel().addNewAttunement( modItem, TunnelType.RF_POWER ); - } - } -} diff --git a/src/main/java/appeng/integration/modules/RFItem.java b/src/main/java/appeng/integration/modules/RFItem.java deleted file mode 100644 index d2ded2c89..000000000 --- a/src/main/java/appeng/integration/modules/RFItem.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved. - * - * Applied Energistics 2 is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Applied Energistics 2 is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Applied Energistics 2. If not, see . - */ - -package appeng.integration.modules; - - -import appeng.helpers.Reflected; -import appeng.integration.IIntegrationModule; -import appeng.integration.IntegrationHelper; - - -public class RFItem implements IIntegrationModule -{ - @Reflected - public static RFItem instance; - - @Reflected - public RFItem() - { - IntegrationHelper.testClassExistence( this, cofh.api.energy.IEnergyContainerItem.class ); - } - - @Override - public void init() - { - } - - @Override - public void postInit() - { - } -} diff --git a/src/main/java/appeng/integration/modules/RotaryCraft.java b/src/main/java/appeng/integration/modules/RotaryCraft.java deleted file mode 100644 index 90cd7f58a..000000000 --- a/src/main/java/appeng/integration/modules/RotaryCraft.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved. - * - * Applied Energistics 2 is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Applied Energistics 2 is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Applied Energistics 2. If not, see . - */ - -package appeng.integration.modules; - - -import appeng.helpers.Reflected; -import appeng.integration.IIntegrationModule; -import appeng.integration.IntegrationHelper; - - -public class RotaryCraft implements IIntegrationModule -{ - @Reflected - public static RotaryCraft instance; - - @Reflected - public RotaryCraft() - { - IntegrationHelper.testClassExistence( this, Reika.RotaryCraft.API.Power.AdvancedShaftPowerReceiver.class ); - IntegrationHelper.testClassExistence( this, Reika.RotaryCraft.API.Interfaces.Transducerable.class ); - } - - @Override - public void init() throws Throwable - { - } - - @Override - public void postInit() - { - } -} diff --git a/src/main/java/appeng/integration/modules/Waila.java b/src/main/java/appeng/integration/modules/Waila.java deleted file mode 100644 index efdc9c750..000000000 --- a/src/main/java/appeng/integration/modules/Waila.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved. - * - * Applied Energistics 2 is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Applied Energistics 2 is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Applied Energistics 2. If not, see . - */ - -package appeng.integration.modules; - - -import net.minecraftforge.fml.common.event.FMLInterModComms; -import mcp.mobius.waila.api.IWailaDataProvider; -import mcp.mobius.waila.api.IWailaRegistrar; - -import appeng.helpers.Reflected; -import appeng.integration.IIntegrationModule; -import appeng.integration.IntegrationHelper; -import appeng.integration.modules.waila.PartWailaDataProvider; -import appeng.integration.modules.waila.TileWailaDataProvider; -import appeng.tile.AEBaseTile; - - -public class Waila implements IIntegrationModule -{ - @Reflected - public static Waila instance; - - @Reflected - public Waila() - { - IntegrationHelper.testClassExistence( this, mcp.mobius.waila.api.IWailaDataProvider.class ); - IntegrationHelper.testClassExistence( this, mcp.mobius.waila.api.IWailaRegistrar.class ); - IntegrationHelper.testClassExistence( this, mcp.mobius.waila.api.IWailaConfigHandler.class ); - IntegrationHelper.testClassExistence( this, mcp.mobius.waila.api.IWailaDataAccessor.class ); - IntegrationHelper.testClassExistence( this, mcp.mobius.waila.api.ITaggedList.class ); - } - - public static void register( IWailaRegistrar registrar ) - { - final IWailaDataProvider partHost = new PartWailaDataProvider(); - - registrar.registerStackProvider( partHost, AEBaseTile.class ); - registrar.registerBodyProvider( partHost, AEBaseTile.class ); - registrar.registerNBTProvider( partHost, AEBaseTile.class ); - - final IWailaDataProvider tile = new TileWailaDataProvider(); - - registrar.registerBodyProvider( tile, AEBaseTile.class ); - registrar.registerNBTProvider( tile, AEBaseTile.class ); - } - - @Override - public void init() throws Throwable - { - FMLInterModComms.sendMessage( "Waila", "register", this.getClass().getName() + ".register" ); - } - - @Override - public void postInit() - { - } -} diff --git a/src/main/java/appeng/integration/modules/helpers/BSCrate.java b/src/main/java/appeng/integration/modules/helpers/BSCrate.java deleted file mode 100644 index be8bc5b31..000000000 --- a/src/main/java/appeng/integration/modules/helpers/BSCrate.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved. - * - * Applied Energistics 2 is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Applied Energistics 2 is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Applied Energistics 2. If not, see . - */ - -package appeng.integration.modules.helpers; - - -import net.mcft.copy.betterstorage.api.crate.ICrateStorage; -import net.minecraft.item.ItemStack; -<<<<<<< HEAD -======= - ->>>>>>> 500fc47... Reduces visibility of internal fields/methods -import appeng.api.config.Actionable; -import appeng.api.networking.security.BaseActionSource; -import appeng.api.storage.IMEInventory; -import appeng.api.storage.StorageChannel; -import appeng.api.storage.data.IAEItemStack; -import appeng.api.storage.data.IItemList; -import appeng.api.util.ForgeDirection; -import appeng.util.item.AEItemStack; - - -public class BSCrate implements IMEInventory -{ - private final ICrateStorage crateStorage; - - public BSCrate( final Object object ) - { - this.crateStorage = (ICrateStorage) object; - } - - @Override - public IAEItemStack injectItems( IAEItemStack input, Actionable mode, BaseActionSource src ) - { - if( mode == Actionable.SIMULATE ) - { - return null; - } - - ItemStack failed = this.crateStorage.insertItems( input.getItemStack() ); - if( failed == null ) - { - return null; - } - input.setStackSize( failed.stackSize ); - return input; - } - - @Override - public IAEItemStack extractItems( IAEItemStack request, Actionable mode, BaseActionSource src ) - { - if( mode == Actionable.SIMULATE ) - { - int howMany = this.crateStorage.getItemCount( request.getItemStack() ); - return howMany > request.getStackSize() ? request : request.copy().setStackSize( howMany ); - } - - ItemStack obtained = this.crateStorage.extractItems( request.getItemStack(), (int) request.getStackSize() ); - return AEItemStack.create( obtained ); - } - - @Override - public IItemList getAvailableItems( IItemList out ) - { - for( ItemStack is : this.crateStorage.getContents() ) - { - out.add( AEItemStack.create( is ) ); - } - return out; - } - - @Override - public StorageChannel getChannel() - { - return StorageChannel.ITEMS; - } -} diff --git a/src/main/java/appeng/integration/modules/helpers/BSCrateHandler.java b/src/main/java/appeng/integration/modules/helpers/BSCrateHandler.java deleted file mode 100644 index 6a0407d55..000000000 --- a/src/main/java/appeng/integration/modules/helpers/BSCrateHandler.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved. - * - * Applied Energistics 2 is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Applied Energistics 2 is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Applied Energistics 2. If not, see . - */ - -package appeng.integration.modules.helpers; - - -import net.mcft.copy.betterstorage.api.crate.ICrateStorage; -import net.minecraft.tileentity.TileEntity; -import appeng.api.networking.security.BaseActionSource; -import appeng.api.storage.IExternalStorageHandler; -import appeng.api.storage.IMEInventory; -import appeng.api.storage.StorageChannel; -import appeng.api.util.ForgeDirection; - - -public class BSCrateHandler implements IExternalStorageHandler -{ - - @Override - 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 ) - { - if( channel == StorageChannel.ITEMS ) - { - return new BSCrate( te ); - } - return null; - } -} diff --git a/src/main/java/appeng/integration/modules/helpers/BSCrateStorageAdaptor.java b/src/main/java/appeng/integration/modules/helpers/BSCrateStorageAdaptor.java deleted file mode 100644 index 9f901ebc1..000000000 --- a/src/main/java/appeng/integration/modules/helpers/BSCrateStorageAdaptor.java +++ /dev/null @@ -1,217 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved. - * - * Applied Energistics 2 is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Applied Energistics 2 is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Applied Energistics 2. If not, see . - */ - -package appeng.integration.modules.helpers; - - -import java.util.Iterator; - -import net.mcft.copy.betterstorage.api.crate.ICrateStorage; -import net.minecraft.item.ItemStack; -<<<<<<< HEAD -======= - ->>>>>>> 500fc47... Reduces visibility of internal fields/methods -import appeng.api.config.FuzzyMode; -import appeng.api.util.ForgeDirection; -import appeng.util.InventoryAdaptor; -import appeng.util.Platform; -import appeng.util.inv.IInventoryDestination; -import appeng.util.inv.ItemSlot; -import appeng.util.iterators.StackToSlotIterator; - - -public class BSCrateStorageAdaptor extends InventoryAdaptor -{ - - private final ICrateStorage cs; - - public BSCrateStorageAdaptor( final Object te ) - { - this.cs = (ICrateStorage) te; - } - - @Override - public ItemStack removeItems( int amount, ItemStack filter, IInventoryDestination destination ) - { - ItemStack target = null; - - for( ItemStack is : this.cs.getContents() ) - { - if( is != null ) - { - if( is.stackSize > 0 && ( filter == null || Platform.isSameItem( filter, is ) ) ) - { - if( destination == null || destination.canInsert( is ) ) - { - target = is; - break; - } - } - } - } - - if( target != null ) - { - ItemStack f = Platform.cloneItemStack( target ); - f.stackSize = amount; - return this.cs.extractItems( f, amount ); - } - - return null; - } - - @Override - public ItemStack simulateRemove( int amount, ItemStack filter, IInventoryDestination destination ) - { - ItemStack target = null; - - for( ItemStack is : this.cs.getContents() ) - { - if( is != null ) - { - if( is.stackSize > 0 && ( filter == null || Platform.isSameItem( filter, is ) ) ) - { - if( destination == null || destination.canInsert( is ) ) - { - target = is; - break; - } - } - } - } - - if( target != null ) - { - int cnt = this.cs.getItemCount( target ); - if( cnt == 0 ) - { - return null; - } - if( cnt > amount ) - { - cnt = amount; - } - ItemStack c = target.copy(); - c.stackSize = cnt; - return c; - } - - return null; - } - - @Override - public ItemStack removeSimilarItems( int amount, ItemStack filter, FuzzyMode fuzzyMode, IInventoryDestination destination ) - { - ItemStack target = null; - - for( ItemStack is : this.cs.getContents() ) - { - if( is != null ) - { - if( is.stackSize > 0 && ( filter == null || Platform.isSameItemFuzzy( filter, is, fuzzyMode ) ) ) - { - if( destination == null || destination.canInsert( is ) ) - { - target = is; - break; - } - } - } - } - - if( target != null ) - { - ItemStack f = Platform.cloneItemStack( target ); - f.stackSize = amount; - return this.cs.extractItems( f, amount ); - } - - return null; - } - - @Override - public ItemStack simulateSimilarRemove( int amount, ItemStack filter, FuzzyMode fuzzyMode, IInventoryDestination destination ) - { - ItemStack target = null; - - for( ItemStack is : this.cs.getContents() ) - { - if( is != null ) - { - if( is.stackSize > 0 && ( filter == null || Platform.isSameItemFuzzy( filter, is, fuzzyMode ) ) ) - { - if( destination == null || destination.canInsert( is ) ) - { - target = is; - break; - } - } - } - } - - if( target != null ) - { - int cnt = this.cs.getItemCount( target ); - if( cnt == 0 ) - { - return null; - } - if( cnt > amount ) - { - cnt = amount; - } - ItemStack c = target.copy(); - c.stackSize = cnt; - return c; - } - - return null; - } - - @Override - public ItemStack addItems( ItemStack toBeAdded ) - { - return this.cs.insertItems( toBeAdded ); - } - - @Override - public ItemStack simulateAdd( ItemStack toBeSimulated ) - { - int items = this.cs.getSpaceForItem( toBeSimulated ); - ItemStack cloned = Platform.cloneItemStack( toBeSimulated ); - if( toBeSimulated.stackSize <= items ) - { - return null; - } - cloned.stackSize -= items; - return cloned; - } - - @Override - public boolean containsItems() - { - return this.cs.getUniqueItems() > 0; - } - - @Override - public Iterator iterator() - { - return new StackToSlotIterator( this.cs.getContents().iterator() ); - } -} diff --git a/src/main/java/appeng/integration/modules/helpers/FMPPacketEvent.java b/src/main/java/appeng/integration/modules/helpers/FMPPacketEvent.java deleted file mode 100644 index 665c0f667..000000000 --- a/src/main/java/appeng/integration/modules/helpers/FMPPacketEvent.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved. - * - * Applied Energistics 2 is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Applied Energistics 2 is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Applied Energistics 2. If not, see . - */ - -package appeng.integration.modules.helpers; - - -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraftforge.fml.common.eventhandler.Event; - - -public class FMPPacketEvent extends Event -{ - - private final EntityPlayerMP sender; - - public FMPPacketEvent( EntityPlayerMP sender ) - { - this.sender = sender; - } - - public EntityPlayerMP getSender() - { - return this.sender; - } -} diff --git a/src/main/java/appeng/integration/modules/helpers/FactorizationBarrel.java b/src/main/java/appeng/integration/modules/helpers/FactorizationBarrel.java deleted file mode 100644 index c881e493f..000000000 --- a/src/main/java/appeng/integration/modules/helpers/FactorizationBarrel.java +++ /dev/null @@ -1,176 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved. - * - * Applied Energistics 2 is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Applied Energistics 2 is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Applied Energistics 2. If not, see . - */ - -package appeng.integration.modules.helpers; - - -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; - -import appeng.api.config.Actionable; -import appeng.api.networking.security.BaseActionSource; -import appeng.api.storage.IMEInventory; -import appeng.api.storage.StorageChannel; -import appeng.api.storage.data.IAEItemStack; -import appeng.api.storage.data.IItemList; -import appeng.integration.abstraction.IFZ; -import appeng.util.item.AEItemStack; - - -public class FactorizationBarrel implements IMEInventory -{ - - private final IFZ fProxy; - private final TileEntity te; - - public FactorizationBarrel( IFZ proxy, TileEntity tile ) - { - this.te = tile; - this.fProxy = proxy; - } - - public long remainingItemCount() - { - return this.fProxy.barrelGetMaxItemCount( this.te ) - this.fProxy.barrelGetItemCount( this.te ); - } - - @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; - } - - private long remainingItemTypes() - { - return this.fProxy.barrelGetItem( this.te ) == null ? 1 : 0; - } - - private boolean containsItemType( final IAEItemStack i, final boolean acceptEmpty ) - { - ItemStack currentItem = this.fProxy.barrelGetItem( this.te ); - - // empty barrels want your love too! - if( acceptEmpty && currentItem == null ) - { - return true; - } - - return i.equals( currentItem ); - } - - private long storedItemCount() - { - return this.fProxy.barrelGetItemCount( this.te ); - } - - @Override - public IAEItemStack extractItems( IAEItemStack request, Actionable mode, BaseActionSource src ) - { - if( this.containsItemType( request, false ) ) - { - int howMany = (int) this.storedItemCount(); - if( request.getStackSize() >= howMany ) - { - if( mode == Actionable.MODULATE ) - { - this.fProxy.setItemType( this.te, null ); - this.fProxy.barrelSetCount( this.te, 0 ); - } - - IAEItemStack r = request.copy(); - r.setStackSize( howMany ); - return r; - } - else - { - if( mode == Actionable.MODULATE ) - { - this.fProxy.barrelSetCount( this.te, (int) ( howMany - request.getStackSize() ) ); - } - return request.copy(); - } - } - return null; - } - - @Override - public IItemList getAvailableItems( IItemList out ) - { - ItemStack i = this.fProxy.barrelGetItem( this.te ); - if( i != null ) - { - i.stackSize = this.fProxy.barrelGetItemCount( this.te ); - out.addStorage( AEItemStack.create( i ) ); - } - - return out; - } - - @Override - public StorageChannel getChannel() - { - return StorageChannel.ITEMS; - } -} \ No newline at end of file diff --git a/src/main/java/appeng/integration/modules/helpers/FactorizationHandler.java b/src/main/java/appeng/integration/modules/helpers/FactorizationHandler.java deleted file mode 100644 index d0a875974..000000000 --- a/src/main/java/appeng/integration/modules/helpers/FactorizationHandler.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved. - * - * Applied Energistics 2 is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Applied Energistics 2 is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Applied Energistics 2. If not, see . - */ - -package appeng.integration.modules.helpers; - - -import net.minecraft.tileentity.TileEntity; -import appeng.api.networking.security.BaseActionSource; -import appeng.api.storage.IExternalStorageHandler; -import appeng.api.storage.IMEInventory; -import appeng.api.storage.StorageChannel; -import appeng.api.util.ForgeDirection; -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 ) - { - return chan == StorageChannel.ITEMS && FZ.instance.isBarrel( te ); - } - - @Override - public IMEInventory getInventory( TileEntity te, ForgeDirection d, StorageChannel chan, BaseActionSource src ) - { - if( chan == StorageChannel.ITEMS ) - { - return new MEMonitorIInventory( new IMEAdaptor( FZ.instance.getFactorizationBarrel( te ), src ) ); - } - return null; - } -} diff --git a/src/main/java/appeng/integration/modules/helpers/MFRDSUHandler.java b/src/main/java/appeng/integration/modules/helpers/MFRDSUHandler.java deleted file mode 100644 index 014b0ffe8..000000000 --- a/src/main/java/appeng/integration/modules/helpers/MFRDSUHandler.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved. - * - * Applied Energistics 2 is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Applied Energistics 2 is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Applied Energistics 2. If not, see . - */ - -package appeng.integration.modules.helpers; - - -import net.minecraft.tileentity.TileEntity; -import appeng.api.networking.security.BaseActionSource; -import appeng.api.storage.IExternalStorageHandler; -import appeng.api.storage.IMEInventory; -import appeng.api.storage.StorageChannel; -import appeng.api.util.ForgeDirection; -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 ) - { - return chan == StorageChannel.ITEMS && DSU.instance.isDSU( te ); - } - - @Override - public IMEInventory getInventory( TileEntity te, ForgeDirection d, StorageChannel chan, BaseActionSource src ) - { - if( chan == StorageChannel.ITEMS ) - { - return new MEMonitorIInventory( new IMEAdaptor( DSU.instance.getDSU( te ), src ) ); - } - - return null; - } -} diff --git a/src/main/java/appeng/integration/modules/helpers/MinefactoryReloadedDeepStorageUnit.java b/src/main/java/appeng/integration/modules/helpers/MinefactoryReloadedDeepStorageUnit.java deleted file mode 100644 index f4b720f78..000000000 --- a/src/main/java/appeng/integration/modules/helpers/MinefactoryReloadedDeepStorageUnit.java +++ /dev/null @@ -1,140 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved. - * - * Applied Energistics 2 is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Applied Energistics 2 is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Applied Energistics 2. If not, see . - */ - -package appeng.integration.modules.helpers; - - -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; - -import powercrystals.minefactoryreloaded.api.IDeepStorageUnit; - -import appeng.api.config.Actionable; -import appeng.api.networking.security.BaseActionSource; -import appeng.api.storage.IMEInventory; -import appeng.api.storage.StorageChannel; -import appeng.api.storage.data.IAEItemStack; -import appeng.api.storage.data.IItemList; -import appeng.util.item.AEItemStack; - - -public class MinefactoryReloadedDeepStorageUnit implements IMEInventory -{ - - private final IDeepStorageUnit dsu; - - public MinefactoryReloadedDeepStorageUnit( TileEntity ta ) - { - this.dsu = (IDeepStorageUnit) ta; - } - - @Override - public IAEItemStack injectItems( IAEItemStack input, Actionable mode, BaseActionSource src ) - { - ItemStack is = this.dsu.getStoredItemType(); - if( is != null ) - { - if( input.equals( is ) ) - { - long max = this.dsu.getMaxStoredCount(); - long storedItems = is.stackSize; - if( max == storedItems ) - { - return input; - } - - storedItems += input.getStackSize(); - if( storedItems > max ) - { - IAEItemStack overflow = AEItemStack.create( is ); - overflow.setStackSize( (int) ( storedItems - max ) ); - if( mode == Actionable.MODULATE ) - { - this.dsu.setStoredItemCount( (int) max ); - } - return overflow; - } - else - { - if( mode == Actionable.MODULATE ) - { - this.dsu.setStoredItemCount( is.stackSize + (int) input.getStackSize() ); - } - return null; - } - } - } - else - { - if( input.getTagCompound() != null ) - { - return input; - } - if( mode == Actionable.MODULATE ) - { - this.dsu.setStoredItemType( input.getItemStack(), (int) input.getStackSize() ); - } - return null; - } - return input; - } - - @Override - public IAEItemStack extractItems( IAEItemStack request, Actionable mode, BaseActionSource src ) - { - ItemStack is = this.dsu.getStoredItemType(); - if( request.equals( is ) ) - { - if( request.getStackSize() >= is.stackSize ) - { - is = is.copy(); - if( mode == Actionable.MODULATE ) - { - this.dsu.setStoredItemCount( 0 ); - } - return AEItemStack.create( is ); - } - else - { - if( mode == Actionable.MODULATE ) - { - this.dsu.setStoredItemCount( is.stackSize - (int) request.getStackSize() ); - } - return request.copy(); - } - } - return null; - } - - @Override - public IItemList getAvailableItems( IItemList out ) - { - ItemStack is = this.dsu.getStoredItemType(); - if( is != null ) - { - out.add( AEItemStack.create( is ) ); - } - return out; - } - - @Override - public StorageChannel getChannel() - { - return StorageChannel.ITEMS; - } -} diff --git a/src/main/java/appeng/integration/modules/helpers/NullRFHandler.java b/src/main/java/appeng/integration/modules/helpers/NullRFHandler.java deleted file mode 100644 index 384aa0fd6..000000000 --- a/src/main/java/appeng/integration/modules/helpers/NullRFHandler.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved. - * - * Applied Energistics 2 is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Applied Energistics 2 is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Applied Energistics 2. If not, see . - */ - -package appeng.integration.modules.helpers; - - -import appeng.api.util.ForgeDirection; -import cofh.api.energy.IEnergyReceiver; - - -public class NullRFHandler implements IEnergyReceiver -{ - - @Override - public int receiveEnergy( ForgeDirection from, int maxReceive, boolean simulate ) - { - return 0; - } - - @Override - public int getEnergyStored( ForgeDirection from ) - { - return 0; - } - - @Override - public int getMaxEnergyStored( ForgeDirection from ) - { - return 0; - } - - @Override - public boolean canConnectEnergy( ForgeDirection from ) - { - return true; - } -} diff --git a/src/main/java/appeng/integration/modules/waila/BaseWailaDataProvider.java b/src/main/java/appeng/integration/modules/waila/BaseWailaDataProvider.java deleted file mode 100644 index 50557e855..000000000 --- a/src/main/java/appeng/integration/modules/waila/BaseWailaDataProvider.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved. - * - * Applied Energistics 2 is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Applied Energistics 2 is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Applied Energistics 2. If not, see . - */ - -package appeng.integration.modules.waila; - - -import java.util.List; - -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; - -import mcp.mobius.waila.api.IWailaConfigHandler; -import mcp.mobius.waila.api.IWailaDataAccessor; -import mcp.mobius.waila.api.IWailaDataProvider; - - -/** - * Base implementation for {@link mcp.mobius.waila.api.IWailaDataProvider} - * - * @author thatsIch - * @version rv2 - * @since rv2 - */ -public abstract class BaseWailaDataProvider implements IWailaDataProvider -{ - @Override - public ItemStack getWailaStack( IWailaDataAccessor accessor, IWailaConfigHandler config ) - { - return null; - } - - @Override - public List getWailaHead( ItemStack itemStack, List currentToolTip, IWailaDataAccessor accessor, IWailaConfigHandler config ) - { - return currentToolTip; - } - - @Override - public List getWailaBody( ItemStack itemStack, List currentToolTip, IWailaDataAccessor accessor, IWailaConfigHandler config ) - { - return currentToolTip; - } - - @Override - public List getWailaTail( ItemStack itemStack, List currentToolTip, IWailaDataAccessor accessor, IWailaConfigHandler config ) - { - return currentToolTip; - } - - @Override - public NBTTagCompound getNBTData( EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x, int y, int z ) - { - return tag; - } -} diff --git a/src/main/java/appeng/integration/modules/waila/PartWailaDataProvider.java b/src/main/java/appeng/integration/modules/waila/PartWailaDataProvider.java deleted file mode 100644 index 84af51f0a..000000000 --- a/src/main/java/appeng/integration/modules/waila/PartWailaDataProvider.java +++ /dev/null @@ -1,194 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved. - * - * Applied Energistics 2 is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Applied Energistics 2 is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Applied Energistics 2. If not, see . - */ - -package appeng.integration.modules.waila; - - -import java.util.List; - -import com.google.common.base.Optional; -import com.google.common.collect.Lists; - -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.MovingObjectPosition; -import net.minecraft.world.World; - -import mcp.mobius.waila.api.IWailaConfigHandler; -import mcp.mobius.waila.api.IWailaDataAccessor; -import mcp.mobius.waila.api.IWailaDataProvider; - -import appeng.api.parts.IPart; -import appeng.integration.modules.waila.part.ChannelWailaDataProvider; -import appeng.integration.modules.waila.part.IPartWailaDataProvider; -import appeng.integration.modules.waila.part.PartAccessor; -import appeng.integration.modules.waila.part.PartStackWailaDataProvider; -import appeng.integration.modules.waila.part.PowerStateWailaDataProvider; -import appeng.integration.modules.waila.part.StorageMonitorWailaDataProvider; -import appeng.integration.modules.waila.part.Tracer; - - -/** - * Delegation provider for parts through {@link appeng.integration.modules.waila.part.IPartWailaDataProvider} - * - * @author thatsIch - * @version rv2 - * @since rv2 - */ -public final class PartWailaDataProvider implements IWailaDataProvider -{ - /** - * Contains all providers - */ - private final List providers; - - /** - * Can access parts through view-hits - */ - private final PartAccessor accessor = new PartAccessor(); - - /** - * Traces views hit on blocks - */ - private final Tracer tracer = new Tracer(); - - /** - * Initializes the provider list with all wanted providers - */ - public PartWailaDataProvider() - { - final IPartWailaDataProvider channel = new ChannelWailaDataProvider(); - final IPartWailaDataProvider storageMonitor = new StorageMonitorWailaDataProvider(); - final IPartWailaDataProvider powerState = new PowerStateWailaDataProvider(); - final IPartWailaDataProvider partStack = new PartStackWailaDataProvider(); - - this.providers = Lists.newArrayList( channel, storageMonitor, powerState, partStack ); - } - - @Override - public ItemStack getWailaStack( IWailaDataAccessor accessor, IWailaConfigHandler config ) - { - final TileEntity te = accessor.getTileEntity(); - final MovingObjectPosition mop = accessor.getPosition(); - - final Optional maybePart = this.accessor.getMaybePart( te, mop ); - - if( maybePart.isPresent() ) - { - final IPart part = maybePart.get(); - - ItemStack wailaStack = null; - - for( IPartWailaDataProvider provider : this.providers ) - { - wailaStack = provider.getWailaStack( part, config, wailaStack ); - } - return wailaStack; - } - - return null; - } - - @Override - public List getWailaHead( ItemStack itemStack, List currentToolTip, IWailaDataAccessor accessor, IWailaConfigHandler config ) - { - final TileEntity te = accessor.getTileEntity(); - final MovingObjectPosition mop = accessor.getPosition(); - - final Optional maybePart = this.accessor.getMaybePart( te, mop ); - - if( maybePart.isPresent() ) - { - final IPart part = maybePart.get(); - - for( IPartWailaDataProvider provider : this.providers ) - { - provider.getWailaHead( part, currentToolTip, accessor, config ); - } - } - - return currentToolTip; - } - - @Override - public List getWailaBody( ItemStack itemStack, List currentToolTip, IWailaDataAccessor accessor, IWailaConfigHandler config ) - { - final TileEntity te = accessor.getTileEntity(); - final MovingObjectPosition mop = accessor.getPosition(); - - final Optional maybePart = this.accessor.getMaybePart( te, mop ); - - if( maybePart.isPresent() ) - { - final IPart part = maybePart.get(); - - for( IPartWailaDataProvider provider : this.providers ) - { - provider.getWailaBody( part, currentToolTip, accessor, config ); - } - } - - return currentToolTip; - } - - @Override - public List getWailaTail( ItemStack itemStack, List currentToolTip, IWailaDataAccessor accessor, IWailaConfigHandler config ) - { - final TileEntity te = accessor.getTileEntity(); - final MovingObjectPosition mop = accessor.getPosition(); - - final Optional maybePart = this.accessor.getMaybePart( te, mop ); - - if( maybePart.isPresent() ) - { - final IPart part = maybePart.get(); - - for( IPartWailaDataProvider provider : this.providers ) - { - provider.getWailaTail( part, currentToolTip, accessor, config ); - } - } - - return currentToolTip; - } - - @Override - public NBTTagCompound getNBTData( EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x, int y, int z ) - { - final MovingObjectPosition mop = this.tracer.retraceBlock( world, player, x, y, z ); - - if( mop != null ) - { - final Optional maybePart = this.accessor.getMaybePart( te, mop ); - - if( maybePart.isPresent() ) - { - final IPart part = maybePart.get(); - - for( IPartWailaDataProvider provider : this.providers ) - { - provider.getNBTData( player, part, te, tag, world, x, y, z ); - } - } - } - - return tag; - } -} diff --git a/src/main/java/appeng/integration/modules/waila/TileWailaDataProvider.java b/src/main/java/appeng/integration/modules/waila/TileWailaDataProvider.java deleted file mode 100644 index 92944d0e1..000000000 --- a/src/main/java/appeng/integration/modules/waila/TileWailaDataProvider.java +++ /dev/null @@ -1,118 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved. - * - * Applied Energistics 2 is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Applied Energistics 2 is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Applied Energistics 2. If not, see . - */ - -package appeng.integration.modules.waila; - - -import java.util.List; - -import com.google.common.collect.Lists; - -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; - -import mcp.mobius.waila.api.IWailaConfigHandler; -import mcp.mobius.waila.api.IWailaDataAccessor; -import mcp.mobius.waila.api.IWailaDataProvider; - -import appeng.integration.modules.waila.tile.ChargerWailaDataProvider; -import appeng.integration.modules.waila.tile.CraftingMonitorWailaDataProvider; -import appeng.integration.modules.waila.tile.PowerStateWailaDataProvider; -import appeng.integration.modules.waila.tile.PowerStorageWailaDataProvider; - - -/** - * Delegation provider for tiles through {@link mcp.mobius.waila.api.IWailaDataProvider} - * - * @author thatsIch - * @version rv2 - * @since rv2 - */ -public final class TileWailaDataProvider implements IWailaDataProvider -{ - /** - * Contains all providers - */ - private final List providers; - - /** - * Initializes the provider list with all wanted providers - */ - public TileWailaDataProvider() - { - final IWailaDataProvider charger = new ChargerWailaDataProvider(); - final IWailaDataProvider energyCell = new PowerStorageWailaDataProvider(); - final IWailaDataProvider craftingBlock = new PowerStateWailaDataProvider(); - final IWailaDataProvider craftingMonitor = new CraftingMonitorWailaDataProvider(); - - this.providers = Lists.newArrayList( charger, energyCell, craftingBlock, craftingMonitor ); - } - - @Override - public ItemStack getWailaStack( IWailaDataAccessor accessor, IWailaConfigHandler config ) - { - return null; - } - - @Override - public List getWailaHead( ItemStack itemStack, List currentToolTip, IWailaDataAccessor accessor, IWailaConfigHandler config ) - { - for( IWailaDataProvider provider : this.providers ) - { - provider.getWailaHead( itemStack, currentToolTip, accessor, config ); - } - - return currentToolTip; - } - - @Override - public List getWailaBody( ItemStack itemStack, List currentToolTip, IWailaDataAccessor accessor, IWailaConfigHandler config ) - { - for( IWailaDataProvider provider : this.providers ) - { - provider.getWailaBody( itemStack, currentToolTip, accessor, config ); - } - - return currentToolTip; - } - - @Override - public List getWailaTail( ItemStack itemStack, List currentToolTip, IWailaDataAccessor accessor, IWailaConfigHandler config ) - { - for( IWailaDataProvider provider : this.providers ) - { - provider.getWailaTail( itemStack, currentToolTip, accessor, config ); - } - - return currentToolTip; - } - - @Override - public NBTTagCompound getNBTData( EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x, int y, int z ) - { - for( IWailaDataProvider provider : this.providers ) - { - provider.getNBTData( player, te, tag, world, x, y, z ); - } - - return tag; - } -} diff --git a/src/main/java/appeng/integration/modules/waila/part/BasePartWailaDataProvider.java b/src/main/java/appeng/integration/modules/waila/part/BasePartWailaDataProvider.java deleted file mode 100644 index b7042238e..000000000 --- a/src/main/java/appeng/integration/modules/waila/part/BasePartWailaDataProvider.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved. - * - * Applied Energistics 2 is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Applied Energistics 2 is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Applied Energistics 2. If not, see . - */ - -package appeng.integration.modules.waila.part; - - -import java.util.List; - -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; - -import mcp.mobius.waila.api.IWailaConfigHandler; -import mcp.mobius.waila.api.IWailaDataAccessor; - -import appeng.api.parts.IPart; - - -/** - * Default implementation of {@link appeng.integration.modules.waila.part.IPartWailaDataProvider} - * - * @author thatsIch - * @version rv2 - * @since rv2 - */ -public abstract class BasePartWailaDataProvider implements IPartWailaDataProvider -{ - @Override - public ItemStack getWailaStack( IPart part, IWailaConfigHandler config, ItemStack partStack ) - { - return null; - } - - @Override - public List getWailaHead( IPart part, List currentToolTip, IWailaDataAccessor accessor, IWailaConfigHandler config ) - { - return currentToolTip; - } - - @Override - public List getWailaBody( IPart part, List currentToolTip, IWailaDataAccessor accessor, IWailaConfigHandler config ) - { - return currentToolTip; - } - - @Override - public List getWailaTail( IPart part, List currentToolTip, IWailaDataAccessor accessor, IWailaConfigHandler config ) - { - return currentToolTip; - } - - @Override - public NBTTagCompound getNBTData( EntityPlayerMP player, IPart part, TileEntity te, NBTTagCompound tag, World world, int x, int y, int z ) - { - return tag; - } -} diff --git a/src/main/java/appeng/integration/modules/waila/part/ChannelWailaDataProvider.java b/src/main/java/appeng/integration/modules/waila/part/ChannelWailaDataProvider.java deleted file mode 100644 index 6bc7a8e98..000000000 --- a/src/main/java/appeng/integration/modules/waila/part/ChannelWailaDataProvider.java +++ /dev/null @@ -1,162 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved. - * - * Applied Energistics 2 is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Applied Energistics 2 is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Applied Energistics 2. If not, see . - */ - -package appeng.integration.modules.waila.part; - - -import java.util.List; - -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; - -import gnu.trove.map.TObjectByteMap; -import gnu.trove.map.hash.TObjectByteHashMap; -import mcp.mobius.waila.api.IWailaConfigHandler; -import mcp.mobius.waila.api.IWailaDataAccessor; - -import appeng.api.parts.IPart; -import appeng.core.localization.WailaText; -import appeng.parts.networking.PartCableSmart; -import appeng.parts.networking.PartDenseCable; - - -/** - * Channel-information provider for WAILA - * - * @author thatsIch - * @version rv2 - * @since rv2 - */ -public final class ChannelWailaDataProvider extends BasePartWailaDataProvider -{ - /** - * Channel key used for the transferred {@link net.minecraft.nbt.NBTTagCompound} - */ - private static final String ID_USED_CHANNELS = "usedChannels"; - - /** - * Used cache for channels if the channel was not transmitted through the server. - *

- * This is useful, when a player just started to look at a tile - * and thus just requested the new information from the server. - *

- * The cache will be updated from the server. - */ - private final TObjectByteMap cache = new TObjectByteHashMap(); - - /** - * Adds the used and max channel to the tool tip - * - * @param part being looked at part - * @param currentToolTip current tool tip - * @param accessor wrapper for various world information - * @param config config to react to various settings - * - * @return modified tool tip - */ - @Override - public List getWailaBody( IPart part, List currentToolTip, IWailaDataAccessor accessor, IWailaConfigHandler config ) - { - 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 String formattedToolTip = String.format( WailaText.Channels.getLocal(), usedChannels, maxChannels ); - currentToolTip.add( formattedToolTip ); - } - - return currentToolTip; - } - - /** - * Determines the source of the channel. - *

- * If the client received information of the channels on the server, they are used, - * else if the cache contains a previous stored value, this will be used. - * Default value is 0. - * - * @param part part to be looked at - * @param tag tag maybe containing the channel information - * @param cache cache with previous knowledge - * - * @return used channels on the cable - */ - private byte getUsedChannels( IPart part, NBTTagCompound tag, TObjectByteMap cache ) - { - final byte usedChannels; - - if( tag.hasKey( ID_USED_CHANNELS ) ) - { - usedChannels = tag.getByte( ID_USED_CHANNELS ); - this.cache.put( part, usedChannels ); - } - else if( this.cache.containsKey( part ) ) - { - usedChannels = this.cache.get( part ); - } - else - { - usedChannels = 0; - } - - return usedChannels; - } - - /** - * Called on server to transfer information from server to client. - *

- * If the part is a cable, - * it writes the channel information in the {@code #tag} - * using the {@code ID_USED_CHANNELS} key. - * - * @param player player looking at the part - * @param part part being looked at - * @param te host of the part - * @param tag transferred tag which is send to the client - * @param world world of the part - * @param x x pos of the part - * @param y y pos of the part - * @param z z pos of the part - * - * @return tag send to the client - */ - @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 ) - { - final NBTTagCompound tempTag = new NBTTagCompound(); - - part.writeToNBT( tempTag ); - - if( tempTag.hasKey( ID_USED_CHANNELS ) ) - { - final byte usedChannels = tempTag.getByte( ID_USED_CHANNELS ); - - tag.setByte( ID_USED_CHANNELS, usedChannels ); - } - } - - return tag; - } -} diff --git a/src/main/java/appeng/integration/modules/waila/part/IPartWailaDataProvider.java b/src/main/java/appeng/integration/modules/waila/part/IPartWailaDataProvider.java deleted file mode 100644 index 0aeadf84a..000000000 --- a/src/main/java/appeng/integration/modules/waila/part/IPartWailaDataProvider.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved. - * - * Applied Energistics 2 is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Applied Energistics 2 is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Applied Energistics 2. If not, see . - */ - -package appeng.integration.modules.waila.part; - - -import java.util.List; - -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; - -import mcp.mobius.waila.api.IWailaConfigHandler; -import mcp.mobius.waila.api.IWailaDataAccessor; - -import appeng.api.parts.IPart; - - -/** - * An abstraction layer of the {@link appeng.integration.modules.waila.part.IPartWailaDataProvider} for {@link appeng.api.parts.IPart}. - * - * @author thatsIch - * @version rv2 - * @since rv2 - */ -public interface IPartWailaDataProvider -{ - ItemStack getWailaStack( IPart part, IWailaConfigHandler config, ItemStack partStack ); - - List getWailaHead( IPart part, List currentToolTip, IWailaDataAccessor accessor, IWailaConfigHandler config ); - - List getWailaBody( IPart part, List currentToolTip, IWailaDataAccessor accessor, IWailaConfigHandler config ); - - List getWailaTail( IPart part, List currentToolTip, IWailaDataAccessor accessor, IWailaConfigHandler config ); - - NBTTagCompound getNBTData( EntityPlayerMP player, IPart part, TileEntity te, NBTTagCompound tag, World world, int x, int y, int z ); -} diff --git a/src/main/java/appeng/integration/modules/waila/part/PartAccessor.java b/src/main/java/appeng/integration/modules/waila/part/PartAccessor.java deleted file mode 100644 index d78b5cfae..000000000 --- a/src/main/java/appeng/integration/modules/waila/part/PartAccessor.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved. - * - * Applied Energistics 2 is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Applied Energistics 2 is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Applied Energistics 2. If not, see . - */ - -package appeng.integration.modules.waila.part; - - -import com.google.common.base.Optional; - -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.MovingObjectPosition; -import net.minecraft.util.Vec3; - -import appeng.api.parts.IPart; -import appeng.api.parts.IPartHost; -import appeng.api.parts.SelectedPart; - - -/** - * Accessor to access specific parts for WAILA - * - * @author thatsIch - * @version rv2 - * @since rv2 - */ -public final class PartAccessor -{ - /** - * Hits a {@link appeng.api.parts.IPartHost} with {@link net.minecraft.util.MovingObjectPosition}. - *

- * You can derive the looked at {@link appeng.api.parts.IPart} by doing that. - * If a facade is being looked at, it is defined as being absent. - * - * @param te being looked at {@link net.minecraft.tileentity.TileEntity} - * @param mop type of ray-trace - * - * @return maybe the looked at {@link appeng.api.parts.IPart} - */ - public Optional getMaybePart( TileEntity te, MovingObjectPosition mop ) - { - if( te instanceof IPartHost ) - { - final Vec3 position = mop.hitVec.addVector( -mop.blockX, -mop.blockY, -mop.blockZ ); - final IPartHost host = (IPartHost) te; - final SelectedPart sp = host.selectPart( position ); - - if( sp.part != null ) - { - return Optional.of( sp.part ); - } - } - - return Optional.absent(); - } -} diff --git a/src/main/java/appeng/integration/modules/waila/part/PartStackWailaDataProvider.java b/src/main/java/appeng/integration/modules/waila/part/PartStackWailaDataProvider.java deleted file mode 100644 index 027559106..000000000 --- a/src/main/java/appeng/integration/modules/waila/part/PartStackWailaDataProvider.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved. - * - * Applied Energistics 2 is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Applied Energistics 2 is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Applied Energistics 2. If not, see . - */ - -package appeng.integration.modules.waila.part; - -import net.minecraft.item.ItemStack; - -import mcp.mobius.waila.api.IWailaConfigHandler; - -import appeng.api.parts.IPart; -import appeng.api.parts.PartItemStack; - -/** - * Part ItemStack provider for WAILA - * - * @author TheJulianJES - * @version rv2 - * @since rv2 - */ -public class PartStackWailaDataProvider extends BasePartWailaDataProvider { - - @Override - public ItemStack getWailaStack( IPart part, IWailaConfigHandler config, ItemStack partStack ) - { - partStack = part.getItemStack( PartItemStack.Pick ); - return partStack; - } - -} diff --git a/src/main/java/appeng/integration/modules/waila/part/PowerStateWailaDataProvider.java b/src/main/java/appeng/integration/modules/waila/part/PowerStateWailaDataProvider.java deleted file mode 100644 index ce976fad9..000000000 --- a/src/main/java/appeng/integration/modules/waila/part/PowerStateWailaDataProvider.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved. - * - * Applied Energistics 2 is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Applied Energistics 2 is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Applied Energistics 2. If not, see . - */ - -package appeng.integration.modules.waila.part; - - -import java.util.List; - -import mcp.mobius.waila.api.IWailaConfigHandler; -import mcp.mobius.waila.api.IWailaDataAccessor; - -import appeng.api.implementations.IPowerChannelState; -import appeng.api.parts.IPart; -import appeng.core.localization.WailaText; - - -/** - * Power state provider for WAILA - * - * @author thatsIch - * @version rv2 - * @since rv2 - */ -public final class PowerStateWailaDataProvider extends BasePartWailaDataProvider -{ - /** - * Adds state to the tooltip - * - * @param part part with state - * @param currentToolTip to be added to tooltip - * @param accessor wrapper for various information - * @param config config settings - * - * @return modified tooltip - */ - @Override - public List getWailaBody( IPart part, List currentToolTip, IWailaDataAccessor accessor, IWailaConfigHandler config ) - { - if( part instanceof IPowerChannelState ) - { - final IPowerChannelState state = (IPowerChannelState) part; - - currentToolTip.add( this.getToolTip( state.isActive(), state.isPowered() ) ); - } - - return currentToolTip; - } - - /** - * Gets the corresponding tool tip for different values of {@code #isActive} and {@code #isPowered} - * - * @param isActive if part is active - * @param isPowered if part is powered - * - * @return tooltip of the state - */ - private String getToolTip( boolean isActive, boolean isPowered ) - { - final String result; - - if( isActive && isPowered ) - { - result = WailaText.DeviceOnline.getLocal(); - } - else if( isPowered ) - { - result = WailaText.DeviceMissingChannel.getLocal(); - } - else - { - result = WailaText.DeviceOffline.getLocal(); - } - - return result; - } -} diff --git a/src/main/java/appeng/integration/modules/waila/part/StorageMonitorWailaDataProvider.java b/src/main/java/appeng/integration/modules/waila/part/StorageMonitorWailaDataProvider.java deleted file mode 100644 index dfd96a9cf..000000000 --- a/src/main/java/appeng/integration/modules/waila/part/StorageMonitorWailaDataProvider.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved. - * - * Applied Energistics 2 is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Applied Energistics 2 is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Applied Energistics 2. If not, see . - */ - -package appeng.integration.modules.waila.part; - - -import java.util.List; - -import mcp.mobius.waila.api.IWailaConfigHandler; -import mcp.mobius.waila.api.IWailaDataAccessor; - -import appeng.api.implementations.parts.IPartStorageMonitor; -import appeng.api.parts.IPart; -import appeng.api.storage.data.IAEFluidStack; -import appeng.api.storage.data.IAEItemStack; -import appeng.api.storage.data.IAEStack; -import appeng.core.localization.WailaText; - - -/** - * Storage monitor provider for WAILA - * - * @author thatsIch - * @version rv2 - * @since rv2 - */ -public final class StorageMonitorWailaDataProvider extends BasePartWailaDataProvider -{ - /** - * Displays the stack if present and if the monitor is locked. - * Can handle fluids and items. - * - * @param part maybe storage monitor - * @param currentToolTip to be written to tooltip - * @param accessor information wrapper - * @param config config option - * - * @return modified tooltip - */ - @Override - public List getWailaBody( IPart part, List currentToolTip, IWailaDataAccessor accessor, IWailaConfigHandler config ) - { - if( part instanceof IPartStorageMonitor ) - { - final IPartStorageMonitor monitor = (IPartStorageMonitor) part; - - final IAEStack displayed = monitor.getDisplayed(); - final boolean isLocked = monitor.isLocked(); - - if( displayed instanceof IAEItemStack ) - { - IAEItemStack ais = (IAEItemStack) displayed; - currentToolTip.add( WailaText.Showing.getLocal() + ": " + ais.getItemStack().getDisplayName() ); - } - else if( displayed instanceof IAEFluidStack ) - { - IAEFluidStack ais = (IAEFluidStack) displayed; - currentToolTip.add( WailaText.Showing.getLocal() + ": " + ais.getFluid().getLocalizedName( ais.getFluidStack() ) ); - } - - currentToolTip.add( ( isLocked ) ? WailaText.Locked.getLocal() : WailaText.Unlocked.getLocal() ); - } - - return currentToolTip; - } -} diff --git a/src/main/java/appeng/integration/modules/waila/part/Tracer.java b/src/main/java/appeng/integration/modules/waila/part/Tracer.java deleted file mode 100644 index 28dd595e6..000000000 --- a/src/main/java/appeng/integration/modules/waila/part/Tracer.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved. - * - * Applied Energistics 2 is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Applied Energistics 2 is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Applied Energistics 2. If not, see . - */ - -package appeng.integration.modules.waila.part; - - -import net.minecraft.block.Block; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.util.MovingObjectPosition; -import net.minecraft.util.Vec3; -import net.minecraft.world.World; - - -/** - * Tracer for players hitting blocks - * - * @author thatsIch - * @version rv2 - * @since rv2 - */ -public final class Tracer -{ - /** - * Trace view of players to blocks. - * Ignore all which are out of reach. - * - * @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 - * - * @return trace movement. Can be null - */ - public MovingObjectPosition retraceBlock( World world, EntityPlayerMP player, int x, int y, int z ) - { - Block block = world.getBlock( x, y, z ); - - Vec3 headVec = this.getCorrectedHeadVec( player ); - Vec3 lookVec = player.getLook( 1.0F ); - double reach = this.getBlockReachDistance_server( player ); - Vec3 endVec = headVec.addVector( lookVec.xCoord * reach, lookVec.yCoord * reach, lookVec.zCoord * reach ); - - return block.collisionRayTrace( world, x, y, z, headVec, endVec ); - } - - /** - * Gets the view point of a player - * - * @param player player with head - * - * @return view point of player - */ - private Vec3 getCorrectedHeadVec( EntityPlayer player ) - { - Vec3 v = Vec3.createVectorHelper( player.posX, player.posY, player.posZ ); - if( player.worldObj.isRemote ) - { - //compatibility with eye height changing mods - v.yCoord += player.getEyeHeight() - player.getDefaultEyeHeight(); - } - else - { - v.yCoord += player.getEyeHeight(); - if( player instanceof EntityPlayerMP && player.isSneaking() ) - { - v.yCoord -= 0.08; - } - } - return v; - } - - /** - * @param player multi-player player - * - * @return block reach distance of player - */ - private double getBlockReachDistance_server( EntityPlayerMP player ) - { - return player.theItemInWorldManager.getBlockReachDistance(); - } -} diff --git a/src/main/java/appeng/integration/modules/waila/tile/ChargerWailaDataProvider.java b/src/main/java/appeng/integration/modules/waila/tile/ChargerWailaDataProvider.java deleted file mode 100644 index 047b05bc4..000000000 --- a/src/main/java/appeng/integration/modules/waila/tile/ChargerWailaDataProvider.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved. - * - * Applied Energistics 2 is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Applied Energistics 2 is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Applied Energistics 2. If not, see . - */ - -package appeng.integration.modules.waila.tile; - - -import java.util.List; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; - -import mcp.mobius.waila.api.IWailaConfigHandler; -import mcp.mobius.waila.api.IWailaDataAccessor; - -import appeng.core.localization.WailaText; -import appeng.integration.modules.waila.BaseWailaDataProvider; -import appeng.tile.misc.TileCharger; - - -/** - * Charger provider for WAILA - * - * @author thatsIch - * @version rv2 - * @since rv2 - */ -public final class ChargerWailaDataProvider extends BaseWailaDataProvider -{ - /** - * Displays the holding item and its tooltip - * - * @param itemStack stack of charger - * @param currentToolTip unmodified tooltip - * @param accessor wrapper information - * @param config config option - * - * @return modified tooltip - */ - @Override - public List getWailaBody( ItemStack itemStack, List currentToolTip, IWailaDataAccessor accessor, IWailaConfigHandler config ) - { - final TileEntity te = accessor.getTileEntity(); - if( te instanceof TileCharger ) - { - final TileCharger charger = (TileCharger) te; - final IInventory chargerInventory = charger.getInternalInventory(); - final ItemStack chargingItem = chargerInventory.getStackInSlot( 0 ); - - if( chargingItem != null ) - { - final String currentInventory = chargingItem.getDisplayName(); - final EntityPlayer player = accessor.getPlayer(); - - currentToolTip.add( WailaText.Contains + ": " + currentInventory ); - chargingItem.getItem().addInformation( chargingItem, player, currentToolTip, true ); - } - } - - return currentToolTip; - } -} diff --git a/src/main/java/appeng/integration/modules/waila/tile/CraftingMonitorWailaDataProvider.java b/src/main/java/appeng/integration/modules/waila/tile/CraftingMonitorWailaDataProvider.java deleted file mode 100644 index 2267c7f22..000000000 --- a/src/main/java/appeng/integration/modules/waila/tile/CraftingMonitorWailaDataProvider.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved. - * - * Applied Energistics 2 is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Applied Energistics 2 is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Applied Energistics 2. If not, see . - */ - -package appeng.integration.modules.waila.tile; - - -import java.util.List; - -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; - -import mcp.mobius.waila.api.IWailaConfigHandler; -import mcp.mobius.waila.api.IWailaDataAccessor; - -import appeng.api.storage.data.IAEItemStack; -import appeng.core.localization.WailaText; -import appeng.integration.modules.waila.BaseWailaDataProvider; -import appeng.tile.crafting.TileCraftingMonitorTile; - - -/** - * Crafting-monitor provider for WAILA - * - * @author thatsIch - * @version rv2 - * @since rv2 - */ -public final class CraftingMonitorWailaDataProvider extends BaseWailaDataProvider -{ - /** - * Displays the item currently crafted by the CPU cluster - * - * @param itemStack stack of crafting monitor - * @param currentToolTip unmodified tooltip - * @param accessor information wrapper - * @param config config option - * - * @return modified tooltip - */ - @Override - public List getWailaBody( ItemStack itemStack, List currentToolTip, IWailaDataAccessor accessor, IWailaConfigHandler config ) - { - final TileEntity te = accessor.getTileEntity(); - if( te instanceof TileCraftingMonitorTile ) - { - final TileCraftingMonitorTile monitor = (TileCraftingMonitorTile) te; - final IAEItemStack displayStack = monitor.getJobProgress(); - - if( displayStack != null ) - { - final String currentCrafting = displayStack.getItemStack().getDisplayName(); - - currentToolTip.add( WailaText.Crafting.getLocal() + ": " + currentCrafting ); - } - } - - return currentToolTip; - } -} diff --git a/src/main/java/appeng/integration/modules/waila/tile/PowerStateWailaDataProvider.java b/src/main/java/appeng/integration/modules/waila/tile/PowerStateWailaDataProvider.java deleted file mode 100644 index 9c74fd8b7..000000000 --- a/src/main/java/appeng/integration/modules/waila/tile/PowerStateWailaDataProvider.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved. - * - * Applied Energistics 2 is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Applied Energistics 2 is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Applied Energistics 2. If not, see . - */ - -package appeng.integration.modules.waila.tile; - - -import java.util.List; - -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; - -import mcp.mobius.waila.api.IWailaConfigHandler; -import mcp.mobius.waila.api.IWailaDataAccessor; - -import appeng.api.implementations.IPowerChannelState; -import appeng.core.localization.WailaText; -import appeng.integration.modules.waila.BaseWailaDataProvider; - - -/** - * Power state provider for WAILA - * - * @author thatsIch - * @version rv2 - * @since rv2 - */ -public final class PowerStateWailaDataProvider extends BaseWailaDataProvider -{ - /** - * Adds state to the tooltip - * - * @param itemStack stack of power state - * @param currentToolTip to be added to tooltip - * @param accessor wrapper for various information - * @param config config settings - * - * @return modified tooltip - */ - @Override - public List getWailaBody( ItemStack itemStack, List currentToolTip, IWailaDataAccessor accessor, IWailaConfigHandler config ) - { - final TileEntity te = accessor.getTileEntity(); - - if( te instanceof IPowerChannelState ) - { - final IPowerChannelState state = (IPowerChannelState) te; - - final boolean isActive = state.isActive(); - final boolean isPowered = state.isPowered(); - - if( isActive && isPowered ) - { - currentToolTip.add( WailaText.DeviceOnline.getLocal() ); - } - else if( isPowered ) - { - currentToolTip.add( WailaText.DeviceMissingChannel.getLocal() ); - } - else - { - currentToolTip.add( WailaText.DeviceOffline.getLocal() ); - } - } - - return currentToolTip; - } -} \ No newline at end of file diff --git a/src/main/java/appeng/integration/modules/waila/tile/PowerStorageWailaDataProvider.java b/src/main/java/appeng/integration/modules/waila/tile/PowerStorageWailaDataProvider.java deleted file mode 100644 index 7322c698e..000000000 --- a/src/main/java/appeng/integration/modules/waila/tile/PowerStorageWailaDataProvider.java +++ /dev/null @@ -1,173 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved. - * - * Applied Energistics 2 is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Applied Energistics 2 is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Applied Energistics 2. If not, see . - */ - -package appeng.integration.modules.waila.tile; - - -import java.util.List; - -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; - -import gnu.trove.map.TObjectLongMap; -import gnu.trove.map.hash.TObjectLongHashMap; -import mcp.mobius.waila.api.ITaggedList; -import mcp.mobius.waila.api.IWailaConfigHandler; -import mcp.mobius.waila.api.IWailaDataAccessor; - -import appeng.api.networking.energy.IAEPowerStorage; -import appeng.core.localization.WailaText; -import appeng.integration.modules.waila.BaseWailaDataProvider; -import appeng.util.Platform; - - -/** - * Power storage provider for WAILA - * - * @author thatsIch - * @version rv2 - * @since rv2 - */ -public final class PowerStorageWailaDataProvider extends BaseWailaDataProvider -{ - /** - * Power key used for the transferred {@link net.minecraft.nbt.NBTTagCompound} - */ - private static final String ID_CURRENT_POWER = "currentPower"; - - /** - * Used cache for power if the power was not transmitted through the server. - *

- * This is useful, when a player just started to look at a tile - * and thus just requested the new information from the server. - *

- * The cache will be updated from the server. - */ - private final TObjectLongMap cache = new TObjectLongHashMap(); - - /** - * Adds the current and max power to the tool tip - * Will ignore if the tile has an energy buffer ( > 0 ) - * - * @param itemStack stack of power storage - * @param currentToolTip current tool tip - * @param accessor wrapper for various world information - * @param config config to react to various settings - * - * @return modified tool tip - */ - @Override - public List getWailaBody( ItemStack itemStack, List currentToolTip, IWailaDataAccessor accessor, IWailaConfigHandler config ) - { - //Removes RF tooltip on WAILA 1.5.9+ - ((ITaggedList) currentToolTip).removeEntries("RFEnergyStorage"); - - final TileEntity te = accessor.getTileEntity(); - if( te instanceof IAEPowerStorage ) - { - final IAEPowerStorage storage = (IAEPowerStorage) te; - - final double maxPower = storage.getAEMaxPower(); - if( maxPower > 0 ) - { - final NBTTagCompound tag = accessor.getNBTData(); - - final long internalCurrentPower = this.getInternalCurrentPower( tag, te ); - final long internalMaxPower = (long) ( 100 * maxPower ); - - final String formatCurrentPower = Platform.formatPowerLong( internalCurrentPower, false ); - final String formatMaxPower = Platform.formatPowerLong( internalMaxPower, false ); - - currentToolTip.add( WailaText.Contains.getLocal() + ": " + formatCurrentPower + " / " + formatMaxPower ); - } - } - - return currentToolTip; - } - - /** - * Called on server to transfer information from server to client. - *

- * If the {@link net.minecraft.tileentity.TileEntity} is a {@link appeng.api.networking.energy.IAEPowerStorage}, - * it writes the power information to the {@code #tag} - * using the {@code #ID_CURRENT_POWER} key. - * - * @param player player looking at the power storage - * @param te power storage - * @param tag transferred tag which is send to the client - * @param world world of the power storage - * @param x x pos of the power storage - * @param y y pos of the power storage - * @param z z pos of the power storage - * - * @return tag send to the client - */ - @Override - public NBTTagCompound getNBTData( EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x, int y, int z ) - { - if( te instanceof IAEPowerStorage ) - { - final IAEPowerStorage storage = (IAEPowerStorage) te; - - if( storage.getAEMaxPower() > 0 ) - { - final long internalCurrentPower = (long) ( 100 * storage.getAECurrentPower() ); - - tag.setLong( ID_CURRENT_POWER, internalCurrentPower ); - } - } - - return tag; - } - - /** - * Determines the current power. - *

- * If the client received power information on the server, they are used, - * else if the cache contains a previous stored value, this will be used. - * Default value is 0. - * - * @param te te to be looked at - * @param tag tag maybe containing the channel information - * - * @return used channels on the cable - */ - private long getInternalCurrentPower( NBTTagCompound tag, TileEntity te ) - { - final long internalCurrentPower; - - if( tag.hasKey( ID_CURRENT_POWER ) ) - { - internalCurrentPower = tag.getLong( ID_CURRENT_POWER ); - this.cache.put( te, internalCurrentPower ); - } - else if( this.cache.containsKey( te ) ) - { - internalCurrentPower = this.cache.get( te ); - } - else - { - internalCurrentPower = 0; - } - - return internalCurrentPower; - } -} diff --git a/src/main/java/appeng/items/contents/NetworkToolViewer.java b/src/main/java/appeng/items/contents/NetworkToolViewer.java index 76a5d60d0..15fd54786 100644 --- a/src/main/java/appeng/items/contents/NetworkToolViewer.java +++ b/src/main/java/appeng/items/contents/NetworkToolViewer.java @@ -67,9 +67,10 @@ public class NetworkToolViewer implements INetworkTool } @Override - public ItemStack getStackInSlotOnClosing( final int i ) + public ItemStack removeStackFromSlot( + int i ) { - return this.inv.getStackInSlotOnClosing( i ); + return this.inv.removeStackFromSlot( i ); } @Override @@ -79,9 +80,9 @@ public class NetworkToolViewer implements INetworkTool } @Override - public String getCommandSenderName() + public String getName() { - return this.inv.getCommandSenderName(); + return this.inv.getName(); } @Override diff --git a/src/main/java/appeng/items/tools/ToolBiometricCard.java b/src/main/java/appeng/items/tools/ToolBiometricCard.java index a43b65caf..9e282b1da 100644 --- a/src/main/java/appeng/items/tools/ToolBiometricCard.java +++ b/src/main/java/appeng/items/tools/ToolBiometricCard.java @@ -52,7 +52,8 @@ public class ToolBiometricCard extends AEBaseItem implements IBiometricCard if( Platform.isClient() ) { - MinecraftForgeClient.registerItemRenderer( this, new ToolBiometricCardRender() ); + // TODO - PORT ToolBiometricCardRender + //MinecraftForgeClient.registerItemRenderer( this, new ToolBiometricCardRender() ); } } diff --git a/src/main/java/appeng/items/tools/powered/ToolColorApplicator.java b/src/main/java/appeng/items/tools/powered/ToolColorApplicator.java index b940a0b2f..2d2f6ddf6 100644 --- a/src/main/java/appeng/items/tools/powered/ToolColorApplicator.java +++ b/src/main/java/appeng/items/tools/powered/ToolColorApplicator.java @@ -110,7 +110,8 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe this.setFeature( EnumSet.of( AEFeature.ColorApplicator, AEFeature.PoweredTools ) ); if( Platform.isClient() ) { - MinecraftForgeClient.registerItemRenderer( this, new ToolColorApplicatorRender() ); + //TODO - color applicator + //MinecraftForgeClient.registerItemRenderer( this, new ToolColorApplicatorRender() ); } } diff --git a/src/main/java/appeng/parts/layers/LayerISidedInventory.java b/src/main/java/appeng/parts/layers/LayerISidedInventory.java index 34783f76c..35f40304d 100644 --- a/src/main/java/appeng/parts/layers/LayerISidedInventory.java +++ b/src/main/java/appeng/parts/layers/LayerISidedInventory.java @@ -163,7 +163,7 @@ public class LayerISidedInventory extends LayerBase implements ISidedInventory } @Override - public ItemStack getStackInSlotOnClosing( final int slot ) + public ItemStack removeStackFromSlot( final int slot ) { return null; } @@ -180,7 +180,7 @@ public class LayerISidedInventory extends LayerBase implements ISidedInventory } @Override - public String getCommandSenderName() + public String getName() { return "AEMultiPart"; } diff --git a/src/main/java/appeng/parts/misc/PartInterface.java b/src/main/java/appeng/parts/misc/PartInterface.java index 51ede58d1..a53f64004 100644 --- a/src/main/java/appeng/parts/misc/PartInterface.java +++ b/src/main/java/appeng/parts/misc/PartInterface.java @@ -270,9 +270,9 @@ public class PartInterface extends PartBasicState implements IGridTickable, ISto } @Override - public ItemStack getStackInSlotOnClosing( final int i ) + public ItemStack removeStackFromSlot( final int i ) { - return this.duality.getStorage().getStackInSlotOnClosing( i ); + return this.duality.getStorage().removeStackFromSlot( i ); } @Override @@ -282,9 +282,9 @@ public class PartInterface extends PartBasicState implements IGridTickable, ISto } @Override - public String getCommandSenderName() + public String getName() { - return this.duality.getStorage().getCommandSenderName(); + return this.duality.getStorage().getName(); } @Override diff --git a/src/main/java/appeng/parts/p2p/PartP2PItems.java b/src/main/java/appeng/parts/p2p/PartP2PItems.java index 15cedffaf..97107f882 100644 --- a/src/main/java/appeng/parts/p2p/PartP2PItems.java +++ b/src/main/java/appeng/parts/p2p/PartP2PItems.java @@ -295,7 +295,7 @@ public class PartP2PItems extends PartP2PTunnel implements /* IPip } @Override - public ItemStack getStackInSlotOnClosing( final int i ) + public ItemStack removeStackFromSlot( final int i ) { return null; } @@ -307,7 +307,7 @@ public class PartP2PItems extends PartP2PTunnel implements /* IPip } @Override - public String getCommandSenderName() + public String getName() { return null; } diff --git a/src/main/java/appeng/parts/p2p/PartP2PRedstone.java b/src/main/java/appeng/parts/p2p/PartP2PRedstone.java index 97c429c57..d4a98e0c4 100644 --- a/src/main/java/appeng/parts/p2p/PartP2PRedstone.java +++ b/src/main/java/appeng/parts/p2p/PartP2PRedstone.java @@ -152,8 +152,8 @@ public class PartP2PRedstone extends PartP2PTunnel srcSide = EnumFacing.UP; } - this.power = b.isProvidingStrongPower( this.getTile().getWorld(), target, state, srcSide ); - this.power = Math.max( this.power, b.isProvidingWeakPower( this.getTile().getWorld(), target, state, srcSide ) ); + this.power = b.getWeakPower( this.getTile().getWorld(), target, state, srcSide ); + this.power = Math.max( this.power, b.getWeakPower( this.getTile().getWorld(), target, state, srcSide ) ); this.sendToOutput( this.power ); } else diff --git a/src/main/java/appeng/parts/reporting/AbstractPartMonitor.java b/src/main/java/appeng/parts/reporting/AbstractPartMonitor.java index 24d12e28d..b8999b992 100644 --- a/src/main/java/appeng/parts/reporting/AbstractPartMonitor.java +++ b/src/main/java/appeng/parts/reporting/AbstractPartMonitor.java @@ -369,7 +369,6 @@ public abstract class AbstractPartMonitor extends AbstractPartDisplay implements GL11.glDisable( GL11.GL_LIGHTING ); GL11.glDisable( GL12.GL_RESCALE_NORMAL ); // RenderHelper.enableGUIStandardItemLighting(); - wr.setColorOpaque_F( 1.0f, 1.0f, 1.0f ); ClientHelper.proxy.doRenderItem( sis, this.getTile().getWorld() ); } diff --git a/src/main/java/appeng/server/AECommand.java b/src/main/java/appeng/server/AECommand.java index 9315d56ac..b1c331bc2 100644 --- a/src/main/java/appeng/server/AECommand.java +++ b/src/main/java/appeng/server/AECommand.java @@ -43,15 +43,6 @@ public final class AECommand extends CommandBase return 0; } - /** - * wtf? - */ - @Override - public int compareTo( final Object arg0 ) - { - return 1; - } - @Override public String getCommandName() { diff --git a/src/main/java/appeng/server/ServerHelper.java b/src/main/java/appeng/server/ServerHelper.java index df2d29917..a63626fe9 100644 --- a/src/main/java/appeng/server/ServerHelper.java +++ b/src/main/java/appeng/server/ServerHelper.java @@ -83,7 +83,7 @@ public class ServerHelper extends CommonHelper if( server != null ) { - return server.getConfigurationManager().playerEntityList; + return (List)server.getConfigurationManager().playerEntityList; } } diff --git a/src/main/java/appeng/tile/AEBaseInvTile.java b/src/main/java/appeng/tile/AEBaseInvTile.java index 64f894c7f..b1ff6b6c0 100644 --- a/src/main/java/appeng/tile/AEBaseInvTile.java +++ b/src/main/java/appeng/tile/AEBaseInvTile.java @@ -41,7 +41,7 @@ import appeng.tile.inventory.InvOperation; public abstract class AEBaseInvTile extends AEBaseTile implements ISidedInventory, IAEAppEngInventory { @Override - public String getCommandSenderName() + public String getName() { return this.getCustomName(); } @@ -97,7 +97,7 @@ public abstract class AEBaseInvTile extends AEBaseTile implements ISidedInventor } @Override - public ItemStack getStackInSlotOnClosing( final int i ) + public ItemStack removeStackFromSlot( final int i ) { return null; } diff --git a/src/main/java/appeng/tile/AEBaseTile.java b/src/main/java/appeng/tile/AEBaseTile.java index 903227d65..e4dc9af8f 100644 --- a/src/main/java/appeng/tile/AEBaseTile.java +++ b/src/main/java/appeng/tile/AEBaseTile.java @@ -411,12 +411,14 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile, @Override public EnumFacing getForward() { + if ( forward == null ) return EnumFacing.NORTH; return this.forward; } @Override public EnumFacing getUp() { + if ( up == null ) return EnumFacing.UP; return this.up; } diff --git a/src/main/java/appeng/tile/events/TileEventType.java b/src/main/java/appeng/tile/events/TileEventType.java index 495072891..72b725eff 100644 --- a/src/main/java/appeng/tile/events/TileEventType.java +++ b/src/main/java/appeng/tile/events/TileEventType.java @@ -22,7 +22,7 @@ package appeng.tile.events; public enum TileEventType { /** - * Requires IUpdatePlayerListBox, this makes the tile entity tick in 1.8 + * Requires ITickable, this makes the tile entity tick in 1.8 */ TICK, diff --git a/src/main/java/appeng/tile/grid/AENetworkInvTile.java b/src/main/java/appeng/tile/grid/AENetworkInvTile.java index eea0a3c8e..daa44845b 100644 --- a/src/main/java/appeng/tile/grid/AENetworkInvTile.java +++ b/src/main/java/appeng/tile/grid/AENetworkInvTile.java @@ -51,7 +51,7 @@ public abstract class AENetworkInvTile extends AEBaseInvTile implements IActionH @Override public AENetworkProxy getProxy() { - return this.getProxy(); + return gridProxy; } @Override diff --git a/src/main/java/appeng/tile/grindstone/TileCrank.java b/src/main/java/appeng/tile/grindstone/TileCrank.java index 95aff48d1..86ee2564a 100644 --- a/src/main/java/appeng/tile/grindstone/TileCrank.java +++ b/src/main/java/appeng/tile/grindstone/TileCrank.java @@ -26,11 +26,11 @@ import io.netty.buffer.ByteBuf; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.Entity; -import net.minecraft.server.gui.IUpdatePlayerListBox; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; +import net.minecraft.util.ITickable; import net.minecraft.world.World; import appeng.api.implementations.tiles.ICrankable; @@ -41,7 +41,7 @@ import appeng.tile.events.TileEventType; import appeng.util.Platform; -public class TileCrank extends AEBaseTile implements ICustomCollision, IUpdatePlayerListBox +public class TileCrank extends AEBaseTile implements ICustomCollision, ITickable { private final int ticksPerRotation = 18; diff --git a/src/main/java/appeng/tile/inventory/AppEngInternalAEInventory.java b/src/main/java/appeng/tile/inventory/AppEngInternalAEInventory.java index 5a47281e1..945fb696c 100644 --- a/src/main/java/appeng/tile/inventory/AppEngInternalAEInventory.java +++ b/src/main/java/appeng/tile/inventory/AppEngInternalAEInventory.java @@ -178,7 +178,7 @@ public class AppEngInternalAEInventory implements IInventory, Iterable } @Override - public ItemStack getStackInSlotOnClosing( final int var1 ) + public ItemStack removeStackFromSlot( final int var1 ) { return null; } @@ -158,7 +158,7 @@ public class AppEngInternalInventory implements IInventory, Iterable } @Override - public String getCommandSenderName() + public String getName() { return "appeng-internal"; } diff --git a/src/main/java/appeng/tile/inventory/AppEngNullInventory.java b/src/main/java/appeng/tile/inventory/AppEngNullInventory.java index f7e9d71c8..7c4c26e29 100644 --- a/src/main/java/appeng/tile/inventory/AppEngNullInventory.java +++ b/src/main/java/appeng/tile/inventory/AppEngNullInventory.java @@ -56,7 +56,7 @@ public class AppEngNullInventory implements IInventory } @Override - public ItemStack getStackInSlotOnClosing( final int var1 ) + public ItemStack removeStackFromSlot( final int var1 ) { return null; } @@ -68,7 +68,7 @@ public class AppEngNullInventory implements IInventory } @Override - public String getCommandSenderName() + public String getName() { return "appeng-internal"; } diff --git a/src/main/java/appeng/tile/misc/TileCharger.java b/src/main/java/appeng/tile/misc/TileCharger.java index cede4c7b9..b8a93249b 100644 --- a/src/main/java/appeng/tile/misc/TileCharger.java +++ b/src/main/java/appeng/tile/misc/TileCharger.java @@ -29,9 +29,8 @@ import io.netty.buffer.ByteBuf; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; -import net.minecraft.server.gui.IUpdatePlayerListBox; import net.minecraft.util.EnumFacing; - +import net.minecraft.util.ITickable; import appeng.api.AEApi; import appeng.api.config.Actionable; import appeng.api.config.PowerMultiplier; @@ -54,7 +53,7 @@ import appeng.util.Platform; import appeng.util.item.AEItemStack; -public class TileCharger extends AENetworkPowerTile implements ICrankable, IUpdatePlayerListBox +public class TileCharger extends AENetworkPowerTile implements ICrankable, ITickable { private final int[] sides = { 0 }; diff --git a/src/main/java/appeng/tile/misc/TileLightDetector.java b/src/main/java/appeng/tile/misc/TileLightDetector.java index b35ad4a14..638d5389a 100644 --- a/src/main/java/appeng/tile/misc/TileLightDetector.java +++ b/src/main/java/appeng/tile/misc/TileLightDetector.java @@ -19,15 +19,15 @@ package appeng.tile.misc; -import net.minecraft.server.gui.IUpdatePlayerListBox; import appeng.tile.AEBaseTile; import appeng.tile.TileEvent; import appeng.tile.events.TileEventType; import appeng.util.Platform; +import net.minecraft.util.ITickable; -public class TileLightDetector extends AEBaseTile implements IUpdatePlayerListBox +public class TileLightDetector extends AEBaseTile implements ITickable { private int lastCheck = 30; diff --git a/src/main/java/appeng/tile/qnb/TileQuantumBridge.java b/src/main/java/appeng/tile/qnb/TileQuantumBridge.java index 5aa9cabb8..a1b064aa8 100644 --- a/src/main/java/appeng/tile/qnb/TileQuantumBridge.java +++ b/src/main/java/appeng/tile/qnb/TileQuantumBridge.java @@ -29,10 +29,9 @@ import net.minecraft.block.Block; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.server.gui.IUpdatePlayerListBox; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; - +import net.minecraft.util.ITickable; import appeng.api.AEApi; import appeng.api.definitions.IBlockDefinition; import appeng.api.networking.GridFlags; @@ -54,7 +53,7 @@ import appeng.tile.inventory.InvOperation; import appeng.util.Platform; -public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock, IUpdatePlayerListBox +public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock, ITickable { private final byte corner = 16; private final int[] sidesRing = {}; diff --git a/src/main/java/appeng/tile/storage/TileChest.java b/src/main/java/appeng/tile/storage/TileChest.java index 1a8132927..5eb64df78 100644 --- a/src/main/java/appeng/tile/storage/TileChest.java +++ b/src/main/java/appeng/tile/storage/TileChest.java @@ -24,14 +24,13 @@ import java.util.Collections; import java.util.List; import io.netty.buffer.ByteBuf; - import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.server.gui.IUpdatePlayerListBox; import net.minecraft.util.EnumFacing; +import net.minecraft.util.ITickable; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidTankInfo; @@ -93,7 +92,7 @@ import appeng.util.Platform; import appeng.util.item.AEFluidStack; -public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHandler, ITerminalHost, IPriorityHost, IConfigManagerHost, IColorableTile, IUpdatePlayerListBox +public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHandler, ITerminalHost, IPriorityHost, IConfigManagerHost, IColorableTile, ITickable { private static final ChestNoHandler NO_HANDLER = new ChestNoHandler(); @@ -993,4 +992,5 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan return super.extractItems( request, mode, src ); } } + } diff --git a/src/main/java/appeng/transformer/AppEngCore.java b/src/main/java/appeng/transformer/AppEngCore.java index 93392d2f5..7623d5042 100644 --- a/src/main/java/appeng/transformer/AppEngCore.java +++ b/src/main/java/appeng/transformer/AppEngCore.java @@ -37,7 +37,7 @@ import net.minecraftforge.fml.relauncher.IFMLLoadingPlugin.MCVersion; import appeng.core.AEConfig; -@MCVersion( "1.8" ) +@MCVersion( "1.8.8" ) public final class AppEngCore extends DummyModContainer implements IFMLLoadingPlugin { private final ModMetadata metadata = new ModMetadata(); diff --git a/src/main/java/appeng/util/inv/AdaptorPlayerInventory.java b/src/main/java/appeng/util/inv/AdaptorPlayerInventory.java index b7bfdbe79..1ee4182b2 100644 --- a/src/main/java/appeng/util/inv/AdaptorPlayerInventory.java +++ b/src/main/java/appeng/util/inv/AdaptorPlayerInventory.java @@ -64,9 +64,9 @@ public class AdaptorPlayerInventory implements IInventory } @Override - public ItemStack getStackInSlotOnClosing( final int var1 ) + public ItemStack removeStackFromSlot( final int var1 ) { - return this.src.getStackInSlotOnClosing( this.min + var1 ); + return this.src.removeStackFromSlot( this.min + var1 ); } @Override @@ -127,9 +127,9 @@ public class AdaptorPlayerInventory implements IInventory } @Override - public String getCommandSenderName() + public String getName() { - return this.src.getCommandSenderName(); + return this.src.getName(); } @Override diff --git a/src/main/java/appeng/util/inv/WrapperBCPipe.java b/src/main/java/appeng/util/inv/WrapperBCPipe.java index 237f676aa..b8df9ddd1 100644 --- a/src/main/java/appeng/util/inv/WrapperBCPipe.java +++ b/src/main/java/appeng/util/inv/WrapperBCPipe.java @@ -63,7 +63,7 @@ public class WrapperBCPipe implements IInventory } @Override - public ItemStack getStackInSlotOnClosing( final int i ) + public ItemStack removeStackFromSlot( final int i ) { return null; } @@ -138,7 +138,7 @@ public class WrapperBCPipe implements IInventory } @Override - public String getCommandSenderName() + public String getName() { return null; } diff --git a/src/main/java/appeng/util/inv/WrapperChainedInventory.java b/src/main/java/appeng/util/inv/WrapperChainedInventory.java index aa60afd21..b49666ba3 100644 --- a/src/main/java/appeng/util/inv/WrapperChainedInventory.java +++ b/src/main/java/appeng/util/inv/WrapperChainedInventory.java @@ -147,12 +147,12 @@ public class WrapperChainedInventory implements IInventory } @Override - public ItemStack getStackInSlotOnClosing( final int idx ) + public ItemStack removeStackFromSlot( final int idx ) { final InvOffset io = this.offsets.get( idx ); if( io != null ) { - return io.i.getStackInSlotOnClosing( idx - io.offset ); + return io.i.removeStackFromSlot( idx - io.offset ); } return null; } @@ -168,7 +168,7 @@ public class WrapperChainedInventory implements IInventory } @Override - public String getCommandSenderName() + public String getName() { return "ChainedInv"; } diff --git a/src/main/java/appeng/util/inv/WrapperInvSlot.java b/src/main/java/appeng/util/inv/WrapperInvSlot.java index 66cd13612..c682462a2 100644 --- a/src/main/java/appeng/util/inv/WrapperInvSlot.java +++ b/src/main/java/appeng/util/inv/WrapperInvSlot.java @@ -76,9 +76,9 @@ public class WrapperInvSlot } @Override - public ItemStack getStackInSlotOnClosing( final int i ) + public ItemStack removeStackFromSlot( final int i ) { - return this.inv.getStackInSlotOnClosing( this.slot ); + return this.inv.removeStackFromSlot( this.slot ); } @Override @@ -106,9 +106,9 @@ public class WrapperInvSlot } @Override - public String getCommandSenderName() + public String getName() { - return this.inv.getCommandSenderName(); + return this.inv.getName(); } @Override diff --git a/src/main/java/appeng/util/inv/WrapperInventoryRange.java b/src/main/java/appeng/util/inv/WrapperInventoryRange.java index e3c7c5284..df75ff5bc 100644 --- a/src/main/java/appeng/util/inv/WrapperInventoryRange.java +++ b/src/main/java/appeng/util/inv/WrapperInventoryRange.java @@ -93,9 +93,9 @@ public class WrapperInventoryRange implements IInventory } @Override - public ItemStack getStackInSlotOnClosing( final int var1 ) + public ItemStack removeStackFromSlot( final int var1 ) { - return this.src.getStackInSlotOnClosing( this.getSlots()[var1] ); + return this.src.removeStackFromSlot( this.getSlots()[var1] ); } @Override @@ -123,9 +123,9 @@ public class WrapperInventoryRange implements IInventory } @Override - public String getCommandSenderName() + public String getName() { - return this.src.getCommandSenderName(); + return this.src.getName(); } @Override diff --git a/src/main/java/appeng/util/item/AEFluidStack.java b/src/main/java/appeng/util/item/AEFluidStack.java index a6022281d..7be937f01 100644 --- a/src/main/java/appeng/util/item/AEFluidStack.java +++ b/src/main/java/appeng/util/item/AEFluidStack.java @@ -303,7 +303,7 @@ public final class AEFluidStack extends AEStack implements IAEFlu { final FluidStack is = (FluidStack) ia; - if( is.getFluidID() == this.fluid.getID() ) + if( is.getFluid() == this.fluid ) { final NBTTagCompound ta = (NBTTagCompound) this.tagCompound; final NBTTagCompound tb = is.tag;