diff --git a/gradle.properties b/gradle.properties index dba36fecd..85ddd0384 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,9 +7,9 @@ aebasename=appliedenergistics2 ######################################################### # Versions # ######################################################### -minecraft_version=1.10.2 -mcp_mappings=snapshot_20161111 -forge_version=12.18.3.2185 +minecraft_version=1.11 +mcp_mappings=snapshot_20161206 +forge_version=13.19.1.2188 ######################################################### # Installable # @@ -19,7 +19,7 @@ waila_version=1.7.0-B3_1.9.4 ######################################################### # Provided APIs # ######################################################### -jei_version=3.13.6.391 -tesla_version=1.10.2-1.2.1.50 +jei_version=4.0.4.199 +tesla_version=1.11-1.3.0.51 ic2_version=2.6.99-ex110 -top_version=1.10-1.3.3-41 \ No newline at end of file +top_version=1.11-1.3.3-46 \ No newline at end of file diff --git a/gradle/scripts/dependencies.gradle b/gradle/scripts/dependencies.gradle index 93df25681..7bc917558 100644 --- a/gradle/scripts/dependencies.gradle +++ b/gradle/scripts/dependencies.gradle @@ -51,15 +51,15 @@ configurations { dependencies { // installable runtime dependencies - mods "mcp.mobius.waila:Waila:${waila_version}" - mods "net.industrial-craft:industrialcraft-2:${ic2_version}:dev" + //mods "mcp.mobius.waila:Waila:${waila_version}" + //mods "net.industrial-craft:industrialcraft-2:${ic2_version}:dev" mods "mcjty.theoneprobe:TheOneProbe:${top_version}" // compile against provided APIs compileOnly "mezz.jei:jei_${minecraft_version}:${jei_version}:api" - compileOnly "mcp.mobius.waila:Waila:${waila_version}" + //compileOnly "mcp.mobius.waila:Waila:${waila_version}" compileOnly "net.darkhax.tesla:Tesla:${tesla_version}" - compileOnly "net.industrial-craft:industrialcraft-2:${ic2_version}:api" + //compileOnly "net.industrial-craft:industrialcraft-2:${ic2_version}:api" compileOnly "mcjty.theoneprobe:TheOneProbe:${top_version}:api" // at runtime, use the full JEI jar diff --git a/src/api/java/appeng/api/definitions/IParts.java b/src/api/java/appeng/api/definitions/IParts.java index ce1880cda..a330b061b 100644 --- a/src/api/java/appeng/api/definitions/IParts.java +++ b/src/api/java/appeng/api/definitions/IParts.java @@ -76,9 +76,9 @@ public interface IParts IItemDefinition p2PTunnelItems(); - IItemDefinition p2PTunnelLiquids(); + //IItemDefinition p2PTunnelLiquids(); - IItemDefinition p2PTunnelEU(); + //IItemDefinition p2PTunnelEU(); // IItemDefinition p2PTunnelRF(); diff --git a/src/main/java/appeng/block/AEBaseBlock.java b/src/main/java/appeng/block/AEBaseBlock.java index 9e837a7b5..dde840719 100644 --- a/src/main/java/appeng/block/AEBaseBlock.java +++ b/src/main/java/appeng/block/AEBaseBlock.java @@ -93,12 +93,6 @@ public abstract class AEBaseBlock extends Block this.fullBlock = this.isFullSize(); } - @Override - public final boolean isVisuallyOpaque() - { - return this.isOpaque() && this.isFullSize(); - } - @Override protected BlockStateContainer createBlockState() { @@ -151,10 +145,10 @@ public abstract class AEBaseBlock extends Block { if( Platform.isClient() ) { - final EntityPlayer player = Minecraft.getMinecraft().thePlayer; + final EntityPlayer player = Minecraft.getMinecraft().player; final LookDirection ld = Platform.getPlayerRay( player, Platform.getEyeOffset( player ) ); - final Iterable bbs = collisionHandler.getSelectedBoundingBoxesFromPool( w, pos, Minecraft.getMinecraft().thePlayer, true ); + final Iterable bbs = collisionHandler.getSelectedBoundingBoxesFromPool( w, pos, Minecraft.getMinecraft().player, true ); AxisAlignedBB br = null; double lastDist = 0; diff --git a/src/main/java/appeng/block/AEBaseItemBlock.java b/src/main/java/appeng/block/AEBaseItemBlock.java index fc0b0876d..1668fd249 100644 --- a/src/main/java/appeng/block/AEBaseItemBlock.java +++ b/src/main/java/appeng/block/AEBaseItemBlock.java @@ -126,7 +126,7 @@ public class AEBaseItemBlock extends ItemBlock { up = EnumFacing.UP; - final byte rotation = (byte) ( MathHelper.floor_double( ( player.rotationYaw * 4F ) / 360F + 2.5D ) & 3 ); + final byte rotation = (byte) ( MathHelper.floor( ( player.rotationYaw * 4F ) / 360F + 2.5D ) & 3 ); switch( rotation ) { diff --git a/src/main/java/appeng/block/AEBaseTileBlock.java b/src/main/java/appeng/block/AEBaseTileBlock.java index a40ff1eba..92244e849 100644 --- a/src/main/java/appeng/block/AEBaseTileBlock.java +++ b/src/main/java/appeng/block/AEBaseTileBlock.java @@ -269,13 +269,16 @@ public abstract class AEBaseTileBlock extends AEBaseBlock implements ITileEntity } @Override - public boolean onBlockActivated( final World w, final BlockPos pos, final IBlockState state, final EntityPlayer player, final EnumHand hand, final @Nullable ItemStack heldItem, final EnumFacing side, final float hitX, final float hitY, final float hitZ ) + public boolean onBlockActivated( World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ ) { - if( player != null && heldItem != null ) + ItemStack heldItem; + if( player != null && player.getHeldItemMainhand() != null ) { + heldItem = player.getHeldItemMainhand(); + if( Platform.isWrench( player, heldItem, pos ) && player.isSneaking() ) { - final IBlockState blockState = w.getBlockState( pos ); + final IBlockState blockState = world.getBlockState( pos ); final Block block = blockState.getBlock(); if( block == null ) @@ -283,7 +286,7 @@ public abstract class AEBaseTileBlock extends AEBaseBlock implements ITileEntity return false; } - final AEBaseTile tile = this.getTileEntity( w, pos ); + final AEBaseTile tile = this.getTileEntity( world, pos ); if( tile == null ) { @@ -295,7 +298,7 @@ public abstract class AEBaseTileBlock extends AEBaseBlock implements ITileEntity return false; } - final ItemStack[] itemDropCandidates = Platform.getBlockDrops( w, pos ); + final ItemStack[] itemDropCandidates = Platform.getBlockDrops( world, pos ); final ItemStack op = new ItemStack( this ); for( final ItemStack ol : itemDropCandidates ) @@ -310,11 +313,11 @@ public abstract class AEBaseTileBlock extends AEBaseBlock implements ITileEntity } } - if( block.removedByPlayer( blockState, w, pos, player, false ) ) + if( block.removedByPlayer( blockState, world, pos, player, false ) ) { final List itemsToDrop = Lists.newArrayList( itemDropCandidates ); - Platform.spawnDrops( w, pos, itemsToDrop ); - w.setBlockToAir( pos ); + Platform.spawnDrops( world, pos, itemsToDrop ); + world.setBlockToAir( pos ); } return false; @@ -323,7 +326,7 @@ public abstract class AEBaseTileBlock extends AEBaseBlock implements ITileEntity if( heldItem.getItem() instanceof IMemoryCard && !( this instanceof BlockCableBus ) ) { final IMemoryCard memoryCard = (IMemoryCard) heldItem.getItem(); - final AEBaseTile tileEntity = this.getTileEntity( w, pos ); + final AEBaseTile tileEntity = this.getTileEntity( world, pos ); if( tileEntity == null ) { @@ -361,7 +364,7 @@ public abstract class AEBaseTileBlock extends AEBaseBlock implements ITileEntity } } - return this.onActivated( w, pos, player, hand, heldItem, side, hitX, hitY, hitZ ); + return this.onActivated( world, pos, player, hand, player.getHeldItemMainhand(), facing, hitX, hitY, hitZ ); } @Override diff --git a/src/main/java/appeng/block/crafting/BlockCraftingMonitor.java b/src/main/java/appeng/block/crafting/BlockCraftingMonitor.java index 8d496b6e3..2d69b8895 100644 --- a/src/main/java/appeng/block/crafting/BlockCraftingMonitor.java +++ b/src/main/java/appeng/block/crafting/BlockCraftingMonitor.java @@ -19,14 +19,13 @@ package appeng.block.crafting; -import java.util.List; - import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; +import net.minecraft.util.NonNullList; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraftforge.common.property.ExtendedBlockState; @@ -85,7 +84,7 @@ public class BlockCraftingMonitor extends BlockCraftingUnit @Override @SideOnly( Side.CLIENT ) - public void getSubBlocks( final Item item, final CreativeTabs tabs, final List itemStacks ) + public void getSubBlocks( final Item item, final CreativeTabs tabs, final NonNullList itemStacks ) { itemStacks.add( new ItemStack( this, 1, 0 ) ); } diff --git a/src/main/java/appeng/block/crafting/BlockCraftingUnit.java b/src/main/java/appeng/block/crafting/BlockCraftingUnit.java index 256aa26b0..2e0bd82e2 100644 --- a/src/main/java/appeng/block/crafting/BlockCraftingUnit.java +++ b/src/main/java/appeng/block/crafting/BlockCraftingUnit.java @@ -21,8 +21,6 @@ package appeng.block.crafting; import java.util.EnumSet; -import javax.annotation.Nullable; - import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.block.properties.IProperty; @@ -30,7 +28,6 @@ import net.minecraft.block.properties.PropertyBool; import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; @@ -118,7 +115,7 @@ public class BlockCraftingUnit extends AEBaseTileBlock } @Override - public void neighborChanged( final IBlockState state, final World worldIn, final BlockPos pos, final Block neighborBlock ) + public void neighborChanged( final IBlockState state, final World worldIn, final BlockPos pos, final Block blockIn, final BlockPos fromPos ) { final TileCraftingTile cp = this.getTileEntity( worldIn, pos ); if( cp != null ) @@ -146,7 +143,7 @@ public class BlockCraftingUnit extends AEBaseTileBlock } @Override - public boolean onBlockActivated( final World w, final BlockPos pos, final IBlockState state, final EntityPlayer p, final EnumHand hand, final @Nullable ItemStack heldItem, final EnumFacing side, final float hitX, final float hitY, final float hitZ ) + public boolean onBlockActivated( final World w, final BlockPos pos, final IBlockState state, final EntityPlayer p, final EnumHand hand, final EnumFacing side, final float hitX, final float hitY, final float hitZ ) { final TileCraftingTile tg = this.getTileEntity( w, pos ); if( tg != null && !p.isSneaking() && tg.isFormed() && tg.isActive() ) diff --git a/src/main/java/appeng/block/crafting/BlockMolecularAssembler.java b/src/main/java/appeng/block/crafting/BlockMolecularAssembler.java index 9ec06dd12..569a39c13 100644 --- a/src/main/java/appeng/block/crafting/BlockMolecularAssembler.java +++ b/src/main/java/appeng/block/crafting/BlockMolecularAssembler.java @@ -19,14 +19,11 @@ package appeng.block.crafting; -import javax.annotation.Nullable; - import net.minecraft.block.material.Material; import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.PropertyBool; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; @@ -42,6 +39,7 @@ import appeng.core.sync.GuiBridge; import appeng.tile.crafting.TileMolecularAssembler; import appeng.util.Platform; + public class BlockMolecularAssembler extends AEBaseTileBlock { @@ -88,18 +86,18 @@ public class BlockMolecularAssembler extends AEBaseTileBlock @SideOnly( Side.CLIENT ) @Override - public boolean canRenderInLayer( BlockRenderLayer layer ) + public boolean canRenderInLayer( IBlockState state, BlockRenderLayer layer ) { return layer == BlockRenderLayer.TRANSLUCENT; } - public boolean isFullCube(IBlockState state) + public boolean isFullCube( IBlockState state ) { return false; } @Override - public boolean onBlockActivated( final World w, final BlockPos pos, final IBlockState state, final EntityPlayer p, final EnumHand hand, final @Nullable ItemStack heldItem, final EnumFacing side, final float hitX, final float hitY, final float hitZ ) + public boolean onBlockActivated( final World w, final BlockPos pos, final IBlockState state, final EntityPlayer p, final EnumHand hand, final EnumFacing side, final float hitX, final float hitY, final float hitZ ) { final TileMolecularAssembler tg = this.getTileEntity( w, pos ); if( tg != null && !p.isSneaking() ) diff --git a/src/main/java/appeng/block/grindstone/BlockCrank.java b/src/main/java/appeng/block/grindstone/BlockCrank.java index 8fe305db6..d875de8c1 100644 --- a/src/main/java/appeng/block/grindstone/BlockCrank.java +++ b/src/main/java/appeng/block/grindstone/BlockCrank.java @@ -135,7 +135,7 @@ public class BlockCrank extends AEBaseTileBlock } @Override - public void neighborChanged( final IBlockState state, final World world, final BlockPos pos, final Block neighborBlock ) + public void neighborChanged( IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos ) { final AEBaseTile tile = this.getTileEntity( world, pos ); diff --git a/src/main/java/appeng/block/misc/BlockCharger.java b/src/main/java/appeng/block/misc/BlockCharger.java index fbe2ff038..59dd7b7d5 100644 --- a/src/main/java/appeng/block/misc/BlockCharger.java +++ b/src/main/java/appeng/block/misc/BlockCharger.java @@ -52,7 +52,7 @@ import appeng.client.render.effects.LightningFX; import appeng.client.render.renderable.ItemRenderable; import appeng.client.render.tesr.ModularTESR; import appeng.core.AEConfig; -import appeng.core.CommonHelper; +import appeng.core.AppEng; import appeng.helpers.ICustomCollision; import appeng.tile.AEBaseTile; import appeng.tile.misc.TileCharger; @@ -118,7 +118,7 @@ public class BlockCharger extends AEBaseTileBlock implements ICustomCollision for( int bolts = 0; bolts < 3; bolts++ ) { - if( CommonHelper.proxy.shouldAddParticles( r ) ) + if( AppEng.proxy.shouldAddParticles( r ) ) { final LightningFX fx = new LightningFX( w, xOff + 0.5 + pos.getX(), yOff + 0.5 + pos.getY(), zOff + 0.5 + pos.getZ(), 0.0D, 0.0D, 0.0D ); Minecraft.getMinecraft().effectRenderer.addEffect( fx ); diff --git a/src/main/java/appeng/block/misc/BlockLightDetector.java b/src/main/java/appeng/block/misc/BlockLightDetector.java index 052faed12..69758b82d 100644 --- a/src/main/java/appeng/block/misc/BlockLightDetector.java +++ b/src/main/java/appeng/block/misc/BlockLightDetector.java @@ -148,12 +148,12 @@ public class BlockLightDetector extends AEBaseTileBlock implements IOrientableBl } @Override - public void neighborChanged( IBlockState state, World w, BlockPos pos, Block blockIn ) + public void neighborChanged(IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos ) { - final EnumFacing up = this.getOrientable( w, pos ).getUp(); - if( !this.canPlaceAt( (World) w, pos, up.getOpposite() ) ) + final EnumFacing up = this.getOrientable( world, pos ).getUp(); + if( !this.canPlaceAt( (World) world, pos, up.getOpposite() ) ) { - this.dropTorch( (World) w, pos ); + this.dropTorch( (World) world, pos ); } } diff --git a/src/main/java/appeng/block/misc/BlockQuartzFixture.java b/src/main/java/appeng/block/misc/BlockQuartzFixture.java index 3809b010a..eb090f543 100644 --- a/src/main/java/appeng/block/misc/BlockQuartzFixture.java +++ b/src/main/java/appeng/block/misc/BlockQuartzFixture.java @@ -45,7 +45,7 @@ import appeng.api.util.IOrientableBlock; import appeng.block.AEBaseBlock; import appeng.client.render.effects.LightningFX; import appeng.core.AEConfig; -import appeng.core.CommonHelper; +import appeng.core.AppEng; import appeng.helpers.ICustomCollision; import appeng.helpers.MetaRotation; @@ -151,7 +151,7 @@ public class BlockQuartzFixture extends AEBaseBlock implements IOrientableBlock, final double zOff = -0.3 * up.getFrontOffsetZ(); for( int bolts = 0; bolts < 3; bolts++ ) { - if( CommonHelper.proxy.shouldAddParticles( r ) ) + if( AppEng.proxy.shouldAddParticles( r ) ) { final LightningFX fx = new LightningFX( w, xOff + 0.5 + pos.getX(), yOff + 0.5 + pos.getY(), zOff + 0.5 + pos.getZ(), 0.0D, 0.0D, 0.0D ); @@ -161,12 +161,12 @@ public class BlockQuartzFixture extends AEBaseBlock implements IOrientableBlock, } @Override - public void neighborChanged( final IBlockState state, final World w, final BlockPos pos,final Block neighborBlock ) + public void neighborChanged(IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos) { - final EnumFacing up = this.getOrientable( w, pos ).getUp(); - if( !this.canPlaceAt( w, pos, up.getOpposite() ) ) + final EnumFacing up = this.getOrientable( world, pos ).getUp(); + if( !this.canPlaceAt( world, pos, up.getOpposite() ) ) { - this.dropTorch( w, pos ); + this.dropTorch( world, pos ); } } diff --git a/src/main/java/appeng/block/misc/BlockQuartzGrowthAccelerator.java b/src/main/java/appeng/block/misc/BlockQuartzGrowthAccelerator.java index ecfcbaa80..72903975f 100644 --- a/src/main/java/appeng/block/misc/BlockQuartzGrowthAccelerator.java +++ b/src/main/java/appeng/block/misc/BlockQuartzGrowthAccelerator.java @@ -38,7 +38,7 @@ import appeng.api.util.IOrientableBlock; import appeng.block.AEBaseTileBlock; import appeng.client.render.effects.LightningFX; import appeng.core.AEConfig; -import appeng.core.CommonHelper; +import appeng.core.AppEng; import appeng.tile.misc.TileQuartzGrowthAccelerator; import appeng.util.Platform; @@ -83,7 +83,7 @@ public class BlockQuartzGrowthAccelerator extends AEBaseTileBlock implements IOr final TileQuartzGrowthAccelerator cga = this.getTileEntity( w, pos ); - if( cga != null && cga.isPowered() && CommonHelper.proxy.shouldAddParticles( r ) ) + if( cga != null && cga.isPowered() && AppEng.proxy.shouldAddParticles( r ) ) { final double d0 = r.nextFloat() - 0.5F; final double d1 = r.nextFloat() - 0.5F; diff --git a/src/main/java/appeng/block/misc/BlockSkyCompass.java b/src/main/java/appeng/block/misc/BlockSkyCompass.java index 42ab13eb4..5a0c495d4 100644 --- a/src/main/java/appeng/block/misc/BlockSkyCompass.java +++ b/src/main/java/appeng/block/misc/BlockSkyCompass.java @@ -78,13 +78,13 @@ public class BlockSkyCompass extends AEBaseTileBlock implements ICustomCollision } @Override - public void neighborChanged( final IBlockState state, final World w, final BlockPos pos, final Block neighborBlock ) + public void neighborChanged( IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos ) { - final TileSkyCompass sc = this.getTileEntity( w, pos ); + final TileSkyCompass sc = this.getTileEntity( world, pos ); final EnumFacing forward = sc.getForward(); - if( !this.canPlaceAt( w, pos, forward.getOpposite() ) ) + if( !this.canPlaceAt( world, pos, forward.getOpposite() ) ) { - this.dropTorch( w, pos ); + this.dropTorch( world, pos ); } } diff --git a/src/main/java/appeng/block/misc/BlockTinyTNT.java b/src/main/java/appeng/block/misc/BlockTinyTNT.java index f6f8ef764..9f9b7b94f 100644 --- a/src/main/java/appeng/block/misc/BlockTinyTNT.java +++ b/src/main/java/appeng/block/misc/BlockTinyTNT.java @@ -42,11 +42,8 @@ import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.world.Explosion; import net.minecraft.world.World; -import net.minecraftforge.fml.common.registry.EntityRegistry; import appeng.block.AEBaseBlock; -import appeng.core.AppEng; -import appeng.entity.EntityIds; import appeng.entity.EntityTinyTNTPrimed; import appeng.helpers.ICustomCollision; @@ -62,7 +59,8 @@ public class BlockTinyTNT extends AEBaseBlock implements ICustomCollision this.setSoundType( SoundType.GROUND ); this.setHardness( 0F ); - EntityRegistry.registerModEntity( EntityTinyTNTPrimed.class, "EntityTinyTNTPrimed", EntityIds.get( EntityTinyTNTPrimed.class ), AppEng.instance(), 16, 4, true ); + // TODO: 1.11 + //EntityRegistry.registerModEntity( EntityTinyTNTPrimed.class, "EntityTinyTNTPrimed", EntityIds.get( EntityTinyTNTPrimed.class ), AppEng.instance(), 16, 4, true ); } @Override @@ -86,18 +84,18 @@ public class BlockTinyTNT extends AEBaseBlock implements ICustomCollision if( !w.isRemote ) { final EntityTinyTNTPrimed primedTinyTNTEntity = new EntityTinyTNTPrimed( w, pos.getX() + 0.5F, pos.getY() + 0.5F, pos.getZ() + 0.5F, igniter ); - w.spawnEntityInWorld( primedTinyTNTEntity ); + w.spawnEntity( primedTinyTNTEntity ); w.playSound( null, primedTinyTNTEntity.posX, primedTinyTNTEntity.posY, primedTinyTNTEntity.posZ, SoundEvents.ENTITY_TNT_PRIMED, SoundCategory.BLOCKS, 1, 1 ); } } @Override - public void neighborChanged( final IBlockState state, final World w, final BlockPos pos, final Block neighborBlock ) + public void neighborChanged( IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos ) { - if( w.isBlockIndirectlyGettingPowered( pos ) > 0 ) + if( world.isBlockIndirectlyGettingPowered( pos ) > 0 ) { - this.startFuse( w, pos, null ); - w.setBlockToAir( pos ); + this.startFuse( world, pos, null ); + world.setBlockToAir( pos ); } } @@ -142,7 +140,7 @@ public class BlockTinyTNT extends AEBaseBlock implements ICustomCollision { final EntityTinyTNTPrimed primedTinyTNTEntity = new EntityTinyTNTPrimed( w, pos.getX() + 0.5F, pos.getY() + 0.5F, pos.getZ() + 0.5F, exp.getExplosivePlacedBy() ); primedTinyTNTEntity.setFuse( w.rand.nextInt( primedTinyTNTEntity.getFuse() / 4 ) + primedTinyTNTEntity.getFuse() / 8 ); - w.spawnEntityInWorld( primedTinyTNTEntity ); + w.spawnEntity( primedTinyTNTEntity ); } } diff --git a/src/main/java/appeng/block/networking/BlockCableBus.java b/src/main/java/appeng/block/networking/BlockCableBus.java index 09d15062a..e00f349dc 100644 --- a/src/main/java/appeng/block/networking/BlockCableBus.java +++ b/src/main/java/appeng/block/networking/BlockCableBus.java @@ -46,6 +46,7 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; +import net.minecraft.util.NonNullList; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.RayTraceResult; import net.minecraft.util.math.Vec3d; @@ -330,11 +331,11 @@ public class BlockCableBus extends AEBaseTileBlock } @Override - public void neighborChanged( final IBlockState state, final World w, final BlockPos pos, final Block neighborBlock ) + public void neighborChanged( IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos ) { if( Platform.isServer() ) { - this.cb( w, pos ).onNeighborChanged(); + this.cb( world, pos ).onNeighborChanged(); } } @@ -377,7 +378,7 @@ public class BlockCableBus extends AEBaseTileBlock @Override @SideOnly( Side.CLIENT ) - public void getSubBlocks( final Item item, final CreativeTabs tabs, final List itemStacks ) + public void getSubBlocks( final Item item, final CreativeTabs tabs, final NonNullList itemStacks ) { // do nothing } diff --git a/src/main/java/appeng/block/networking/BlockController.java b/src/main/java/appeng/block/networking/BlockController.java index 79878351a..5668f3f94 100644 --- a/src/main/java/appeng/block/networking/BlockController.java +++ b/src/main/java/appeng/block/networking/BlockController.java @@ -170,9 +170,9 @@ public class BlockController extends AEBaseTileBlock } @Override - public void neighborChanged( final IBlockState state, final World w, final BlockPos pos, final Block neighborBlock ) + public void neighborChanged( IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos ) { - final TileController tc = this.getTileEntity( w, pos ); + final TileController tc = this.getTileEntity( world, pos ); if( tc != null ) { tc.onNeighborChange( false ); diff --git a/src/main/java/appeng/block/networking/BlockEnergyCell.java b/src/main/java/appeng/block/networking/BlockEnergyCell.java index fb62e225e..8b444721c 100644 --- a/src/main/java/appeng/block/networking/BlockEnergyCell.java +++ b/src/main/java/appeng/block/networking/BlockEnergyCell.java @@ -19,8 +19,6 @@ package appeng.block.networking; -import java.util.List; - import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.PropertyInteger; import net.minecraft.block.state.IBlockState; @@ -28,6 +26,7 @@ import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.NonNullList; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -63,7 +62,7 @@ public class BlockEnergyCell extends AEBaseTileBlock @Override @SideOnly( Side.CLIENT ) - public void getSubBlocks( final Item item, final CreativeTabs tabs, final List itemStacks ) + public void getSubBlocks( final Item item, final CreativeTabs tabs, final NonNullList itemStacks ) { super.getSubBlocks( item, tabs, itemStacks ); diff --git a/src/main/java/appeng/block/networking/BlockWireless.java b/src/main/java/appeng/block/networking/BlockWireless.java index 4f8de8238..2eac5f84a 100644 --- a/src/main/java/appeng/block/networking/BlockWireless.java +++ b/src/main/java/appeng/block/networking/BlockWireless.java @@ -22,14 +22,11 @@ package appeng.block.networking; import java.util.Collections; import java.util.List; -import javax.annotation.Nullable; - import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.PropertyEnum; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; @@ -47,6 +44,7 @@ import appeng.helpers.ICustomCollision; import appeng.tile.networking.TileWireless; import appeng.util.Platform; + public class BlockWireless extends AEBaseTileBlock implements ICustomCollision { @@ -63,7 +61,6 @@ public class BlockWireless extends AEBaseTileBlock implements ICustomCollision } } - public static final PropertyEnum STATE = PropertyEnum.create( "state", State.class ); public BlockWireless() @@ -111,7 +108,7 @@ public class BlockWireless extends AEBaseTileBlock implements ICustomCollision } @Override - public boolean onBlockActivated( final World w, final BlockPos pos, final IBlockState state, final EntityPlayer player, final EnumHand hand, final @Nullable ItemStack heldItem, final EnumFacing side, final float hitX, final float hitY, final float hitZ ) + public boolean onBlockActivated( final World w, final BlockPos pos, final IBlockState state, final EntityPlayer player, final EnumHand hand, final EnumFacing side, final float hitX, final float hitY, final float hitZ ) { if( player.isSneaking() ) { diff --git a/src/main/java/appeng/block/paint/BlockPaint.java b/src/main/java/appeng/block/paint/BlockPaint.java index 003f7e788..b61995796 100644 --- a/src/main/java/appeng/block/paint/BlockPaint.java +++ b/src/main/java/appeng/block/paint/BlockPaint.java @@ -21,7 +21,6 @@ package appeng.block.paint; import java.util.Collection; import java.util.Collections; -import java.util.List; import java.util.Random; import net.minecraft.block.Block; @@ -34,6 +33,7 @@ import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.BlockRenderLayer; +import net.minecraft.util.NonNullList; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; @@ -94,13 +94,13 @@ public class BlockPaint extends AEBaseTileBlock @Override @SideOnly( Side.CLIENT ) - public void getSubBlocks( final Item item, final CreativeTabs tabs, final List itemStacks ) + public void getSubBlocks( final Item item, final CreativeTabs tabs, final NonNullList itemStacks ) { // do nothing } @Override - public AxisAlignedBB getCollisionBoundingBox( final IBlockState state, final World worldIn, final BlockPos pos ) + public AxisAlignedBB getCollisionBoundingBox( IBlockState blockState, IBlockAccess worldIn, BlockPos pos ) { return null; } @@ -112,9 +112,9 @@ public class BlockPaint extends AEBaseTileBlock } @Override - public void neighborChanged( final IBlockState state, final World w, final BlockPos pos, final Block neighborBlock ) + public void neighborChanged( IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos ) { - final TilePaint tp = this.getTileEntity( w, pos ); + final TilePaint tp = this.getTileEntity( world, pos ); if( tp != null ) { diff --git a/src/main/java/appeng/block/qnb/BlockQuantumBase.java b/src/main/java/appeng/block/qnb/BlockQuantumBase.java index de18f59ce..76c8f4861 100644 --- a/src/main/java/appeng/block/qnb/BlockQuantumBase.java +++ b/src/main/java/appeng/block/qnb/BlockQuantumBase.java @@ -101,9 +101,9 @@ public abstract class BlockQuantumBase extends AEBaseTileBlock implements ICusto } @Override - public void neighborChanged( final IBlockState state, final World w, final BlockPos pos, final Block neighborBlock ) + public void neighborChanged( IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos ) { - final TileQuantumBridge bridge = this.getTileEntity( w, pos ); + final TileQuantumBridge bridge = this.getTileEntity( world, pos ); if( bridge != null ) { bridge.neighborUpdate(); diff --git a/src/main/java/appeng/block/qnb/BlockQuantumLinkChamber.java b/src/main/java/appeng/block/qnb/BlockQuantumLinkChamber.java index 76a0c347d..0072f1728 100644 --- a/src/main/java/appeng/block/qnb/BlockQuantumLinkChamber.java +++ b/src/main/java/appeng/block/qnb/BlockQuantumLinkChamber.java @@ -37,7 +37,7 @@ import net.minecraft.world.World; import appeng.api.util.AEPartLocation; import appeng.client.EffectType; -import appeng.core.CommonHelper; +import appeng.core.AppEng; import appeng.core.sync.GuiBridge; import appeng.helpers.AEGlassMaterial; import appeng.tile.qnb.TileQuantumBridge; @@ -60,9 +60,9 @@ public class BlockQuantumLinkChamber extends BlockQuantumBase { if( bridge.hasQES() ) { - if( CommonHelper.proxy.shouldAddParticles( rand ) ) + if( AppEng.proxy.shouldAddParticles( rand ) ) { - CommonHelper.proxy.spawnEffect( EffectType.Energy, w, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, null ); + AppEng.proxy.spawnEffect( EffectType.Energy, w, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, null ); } } } diff --git a/src/main/java/appeng/block/spatial/BlockMatrixFrame.java b/src/main/java/appeng/block/spatial/BlockMatrixFrame.java index 97b5cb8fb..520489664 100644 --- a/src/main/java/appeng/block/spatial/BlockMatrixFrame.java +++ b/src/main/java/appeng/block/spatial/BlockMatrixFrame.java @@ -28,6 +28,7 @@ import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.Entity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.util.NonNullList; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.world.Explosion; @@ -53,7 +54,7 @@ public class BlockMatrixFrame extends AEBaseBlock implements ICustomCollision @Override @SideOnly( Side.CLIENT ) - public void getSubBlocks( final Item item, final CreativeTabs tabs, final List itemStacks ) + public void getSubBlocks( final Item item, final CreativeTabs tabs, final NonNullList itemStacks ) { // do nothing } diff --git a/src/main/java/appeng/block/spatial/BlockSpatialIOPort.java b/src/main/java/appeng/block/spatial/BlockSpatialIOPort.java index b4edaf5c1..c58ac04d5 100644 --- a/src/main/java/appeng/block/spatial/BlockSpatialIOPort.java +++ b/src/main/java/appeng/block/spatial/BlockSpatialIOPort.java @@ -47,9 +47,9 @@ public class BlockSpatialIOPort extends AEBaseTileBlock } @Override - public void neighborChanged( final IBlockState state, final World w, final BlockPos pos, final Block neighborBlock ) + public void neighborChanged( IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos ) { - final TileSpatialIOPort te = this.getTileEntity( w, pos ); + final TileSpatialIOPort te = this.getTileEntity( world, pos ); if( te != null ) { te.updateRedstoneState(); diff --git a/src/main/java/appeng/block/spatial/BlockSpatialPylon.java b/src/main/java/appeng/block/spatial/BlockSpatialPylon.java index dc49453b1..3302e30a0 100644 --- a/src/main/java/appeng/block/spatial/BlockSpatialPylon.java +++ b/src/main/java/appeng/block/spatial/BlockSpatialPylon.java @@ -62,9 +62,9 @@ public class BlockSpatialPylon extends AEBaseTileBlock } @Override - public void neighborChanged( final IBlockState state, final World w, final BlockPos pos, final Block neighborBlock ) + public void neighborChanged( IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos ) { - final TileSpatialPylon tsp = this.getTileEntity( w, pos ); + final TileSpatialPylon tsp = this.getTileEntity( world, pos ); if( tsp != null ) { tsp.neighborChanged(); diff --git a/src/main/java/appeng/block/storage/BlockChest.java b/src/main/java/appeng/block/storage/BlockChest.java index dac20eaf4..cc39b18ec 100644 --- a/src/main/java/appeng/block/storage/BlockChest.java +++ b/src/main/java/appeng/block/storage/BlockChest.java @@ -118,7 +118,7 @@ public class BlockChest extends AEBaseTileBlock } else { - p.addChatMessage( PlayerMessages.ChestCannotReadStorageCell.get() ); + p.sendMessage( PlayerMessages.ChestCannotReadStorageCell.get() ); } } diff --git a/src/main/java/appeng/block/storage/BlockIOPort.java b/src/main/java/appeng/block/storage/BlockIOPort.java index 96beae757..cf164c740 100644 --- a/src/main/java/appeng/block/storage/BlockIOPort.java +++ b/src/main/java/appeng/block/storage/BlockIOPort.java @@ -48,9 +48,9 @@ public class BlockIOPort extends AEBaseTileBlock } @Override - public void neighborChanged( final IBlockState state, final World w, final BlockPos pos, final Block neighborBlock ) + public void neighborChanged( IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos ) { - final TileIOPort te = this.getTileEntity( w, pos ); + final TileIOPort te = this.getTileEntity( world, pos ); if( te != null ) { te.updateRedstoneState(); diff --git a/src/main/java/appeng/bootstrap/BlockDefinitionBuilder.java b/src/main/java/appeng/bootstrap/BlockDefinitionBuilder.java index 8488b0973..19f093dde 100644 --- a/src/main/java/appeng/bootstrap/BlockDefinitionBuilder.java +++ b/src/main/java/appeng/bootstrap/BlockDefinitionBuilder.java @@ -242,9 +242,6 @@ class BlockDefinitionBuilder implements IBlockBuilder factory.addPreInit( side -> { Class tileEntityClass = tileBlock.getTileEntityClass(); AEBaseTile.registerTileItem( tileEntityClass, new BlockStackSrc( block, 0, ActivityState.Enabled ) ); - - // TODO: Change after transition phase - GameRegistry.registerTileEntityWithAlternatives( tileEntityClass, AppEng.MOD_ID.toLowerCase() + ":" + registryName, registryName ); } ); return (T) new TileDefinition( registryName, (AEBaseTileBlock) block, item ); diff --git a/src/main/java/appeng/capabilities/Capabilities.java b/src/main/java/appeng/capabilities/Capabilities.java index 6da3fb62c..095795572 100644 --- a/src/main/java/appeng/capabilities/Capabilities.java +++ b/src/main/java/appeng/capabilities/Capabilities.java @@ -43,10 +43,10 @@ public final class Capabilities @CapabilityInject( IStorageMonitorableAccessor.class ) public static Capability STORAGE_MONITORABLE_ACCESSOR; - @CapabilityInject(ITeslaConsumer.class) + @CapabilityInject( ITeslaConsumer.class ) public static Capability TESLA_CONSUMER; - @CapabilityInject(ITeslaHolder.class) + @CapabilityInject( ITeslaHolder.class ) public static Capability TESLA_HOLDER; /** diff --git a/src/main/java/appeng/client/ClientHelper.java b/src/main/java/appeng/client/ClientHelper.java index 7b2fdb5e4..abcd0bb24 100644 --- a/src/main/java/appeng/client/ClientHelper.java +++ b/src/main/java/appeng/client/ClientHelper.java @@ -58,7 +58,7 @@ import appeng.client.render.tesr.InscriberTESR; import appeng.client.render.textures.ParticleTextures; import appeng.core.AEConfig; import appeng.core.AELog; -import appeng.core.CommonHelper; +import appeng.core.AppEng; import appeng.core.sync.network.NetworkHandler; import appeng.core.sync.packets.PacketAssemblerAnimation; import appeng.core.sync.packets.PacketValueConfig; @@ -117,7 +117,7 @@ public class ClientHelper extends ServerHelper { if( Platform.isClient() ) { - return Minecraft.getMinecraft().theWorld; + return Minecraft.getMinecraft().world; } else { @@ -137,7 +137,7 @@ public class ClientHelper extends ServerHelper if( Platform.isClient() ) { final List o = new ArrayList<>(); - o.add( Minecraft.getMinecraft().thePlayer ); + o.add( Minecraft.getMinecraft().player ); return o; } else @@ -147,29 +147,29 @@ public class ClientHelper extends ServerHelper } @Override - public void spawnEffect( final EffectType effect, final World worldObj, final double posX, final double posY, final double posZ, final Object o ) + public void spawnEffect( final EffectType effect, final World world, final double posX, final double posY, final double posZ, final Object o ) { if( AEConfig.instance().isEnableEffects() ) { switch( effect ) { case Assembler: - this.spawnAssembler( worldObj, posX, posY, posZ, o ); + this.spawnAssembler( world, posX, posY, posZ, o ); return; case Vibrant: - this.spawnVibrant( worldObj, posX, posY, posZ ); + this.spawnVibrant( world, posX, posY, posZ ); return; case Crafting: - this.spawnCrafting( worldObj, posX, posY, posZ ); + this.spawnCrafting( world, posX, posY, posZ ); return; case Energy: - this.spawnEnergy( worldObj, posX, posY, posZ ); + this.spawnEnergy( world, posX, posY, posZ ); return; case Lightning: - this.spawnLightning( worldObj, posX, posY, posZ ); + this.spawnLightning( world, posX, posY, posZ ); return; case LightningArc: - this.spawnLightningArc( worldObj, posX, posY, posZ, (Vec3d) o ); + this.spawnLightningArc( world, posX, posY, posZ, (Vec3d) o ); return; default: } @@ -216,7 +216,7 @@ public class ClientHelper extends ServerHelper } final Minecraft mc = Minecraft.getMinecraft(); - final EntityPlayer player = mc.thePlayer; + final EntityPlayer player = mc.player; return this.renderModeForPlayer( player ); } @@ -225,12 +225,12 @@ public class ClientHelper extends ServerHelper public void triggerUpdates() { final Minecraft mc = Minecraft.getMinecraft(); - if( mc == null || mc.thePlayer == null || mc.theWorld == null ) + if( mc == null || mc.player == null || mc.world == null ) { return; } - final EntityPlayer player = mc.thePlayer; + final EntityPlayer player = mc.player; final int x = (int) player.posX; final int y = (int) player.posY; @@ -238,7 +238,7 @@ public class ClientHelper extends ServerHelper final int range = 16 * 16; - mc.theWorld.markBlockRangeForRenderUpdate( x - range, y - range, z - range, x + range, y + range, z + range ); + mc.world.markBlockRangeForRenderUpdate( x - range, y - range, z - range, x + range, y + range, z + range ); } @Override @@ -262,17 +262,17 @@ public class ClientHelper extends ServerHelper } } - private void spawnAssembler( final World worldObj, final double posX, final double posY, final double posZ, final Object o ) + private void spawnAssembler( final World world, final double posX, final double posY, final double posZ, final Object o ) { final PacketAssemblerAnimation paa = (PacketAssemblerAnimation) o; - final AssemblerFX fx = new AssemblerFX( worldObj, posX, posY, posZ, 0.0D, 0.0D, 0.0D, paa.rate, paa.is ); + final AssemblerFX fx = new AssemblerFX( world, posX, posY, posZ, 0.0D, 0.0D, 0.0D, paa.rate, paa.is ); Minecraft.getMinecraft().effectRenderer.addEffect( fx ); } private void spawnVibrant( final World w, final double x, final double y, final double z ) { - if( CommonHelper.proxy.shouldAddParticles( Platform.getRandom() ) ) + if( AppEng.proxy.shouldAddParticles( Platform.getRandom() ) ) { final double d0 = ( Platform.getRandomFloat() - 0.5F ) * 0.26D; final double d1 = ( Platform.getRandomFloat() - 0.5F ) * 0.26D; @@ -313,15 +313,15 @@ public class ClientHelper extends ServerHelper Minecraft.getMinecraft().effectRenderer.addEffect( fx ); } - private void spawnLightning( final World worldObj, final double posX, final double posY, final double posZ ) + private void spawnLightning( final World world, final double posX, final double posY, final double posZ ) { - final LightningFX fx = new LightningFX( worldObj, posX, posY + 0.3f, posZ, 0.0f, 0.0f, 0.0f ); + final LightningFX fx = new LightningFX( world, posX, posY + 0.3f, posZ, 0.0f, 0.0f, 0.0f ); Minecraft.getMinecraft().effectRenderer.addEffect( fx ); } - private void spawnLightningArc( final World worldObj, final double posX, final double posY, final double posZ, final Vec3d second ) + private void spawnLightningArc( final World world, final double posX, final double posY, final double posZ, final Vec3d second ) { - final LightningFX fx = new LightningArcFX( worldObj, posX, posY, posZ, second.xCoord, second.yCoord, second.zCoord, 0.0f, 0.0f, 0.0f ); + final LightningFX fx = new LightningArcFX( world, posX, posY, posZ, second.xCoord, second.yCoord, second.zCoord, 0.0f, 0.0f, 0.0f ); Minecraft.getMinecraft().effectRenderer.addEffect( fx ); } @@ -334,7 +334,7 @@ public class ClientHelper extends ServerHelper } final Minecraft mc = Minecraft.getMinecraft(); - final EntityPlayer player = mc.thePlayer; + final EntityPlayer player = mc.player; if( player.isSneaking() ) { final EnumHand hand; diff --git a/src/main/java/appeng/client/gui/AEBaseGui.java b/src/main/java/appeng/client/gui/AEBaseGui.java index 9c2c8d880..b14909eb4 100644 --- a/src/main/java/appeng/client/gui/AEBaseGui.java +++ b/src/main/java/appeng/client/gui/AEBaseGui.java @@ -251,14 +251,14 @@ public abstract class AEBaseGui extends GuiContainer { if( fs.isEnabled() ) { - this.drawTexturedModalRect( ox + fs.xDisplayPosition - 1, oy + fs.yDisplayPosition - 1, fs.getSourceX() - 1, fs.getSourceY() - 1, 18, + this.drawTexturedModalRect( ox + fs.xPos - 1, oy + fs.yPos - 1, fs.getSourceX() - 1, fs.getSourceY() - 1, 18, 18 ); } else { GlStateManager.color( 1.0F, 1.0F, 1.0F, 0.4F ); GlStateManager.enableBlend(); - this.drawTexturedModalRect( ox + fs.xDisplayPosition - 1, oy + fs.yDisplayPosition - 1, fs.getSourceX() - 1, fs.getSourceY() - 1, 18, + this.drawTexturedModalRect( ox + fs.xPos - 1, oy + fs.yPos - 1, fs.getSourceX() - 1, fs.getSourceY() - 1, 18, 18 ); GlStateManager.color( 1.0F, 1.0F, 1.0F, 1.0F ); } @@ -297,7 +297,7 @@ public abstract class AEBaseGui extends GuiContainer protected void mouseClickMove( final int x, final int y, final int c, final long d ) { final Slot slot = this.getSlot( x, y ); - final ItemStack itemstack = this.mc.thePlayer.inventory.getItemStack(); + final ItemStack itemstack = this.mc.player.inventory.getItemStack(); if( this.getScrollBar() != null ) { @@ -326,7 +326,7 @@ public abstract class AEBaseGui extends GuiContainer @Override protected void handleMouseClick( final Slot slot, final int slotIdx, final int mouseButton, final ClickType clickType ) { - final EntityPlayer player = Minecraft.getMinecraft().thePlayer; + final EntityPlayer player = Minecraft.getMinecraft().player; if( slot instanceof SlotFake ) { @@ -521,7 +521,7 @@ public abstract class AEBaseGui extends GuiContainer for( final Slot inventorySlot : slots ) { if( inventorySlot != null && inventorySlot.canTakeStack( - this.mc.thePlayer ) && inventorySlot.getHasStack() && inventorySlot.inventory == slot.inventory && Container.canAddItemToSlot( + this.mc.player ) && inventorySlot.getHasStack() && inventorySlot.inventory == slot.inventory && Container.canAddItemToSlot( inventorySlot, this.dbl_whichItem, true ) ) { this.handleMouseClick( inventorySlot, inventorySlot.slotNumber, 1, clickType ); @@ -540,7 +540,7 @@ public abstract class AEBaseGui extends GuiContainer { final Slot theSlot = this.getSlotUnderMouse(); - if( this.mc.thePlayer.inventory.getItemStack() == null && theSlot != null ) + if( this.mc.player.inventory.getItemStack() == null && theSlot != null ) { for( int j = 0; j < 9; ++j ) { @@ -594,7 +594,7 @@ public abstract class AEBaseGui extends GuiContainer for( final Slot slot : slots ) { // isPointInRegion - if( this.isPointInRegion( slot.xDisplayPosition, slot.yDisplayPosition, 16, 16, mouseX, mouseY ) ) + if( this.isPointInRegion( slot.xPos, slot.yPos, 16, 16, mouseX, mouseY ) ) { return slot; } @@ -704,7 +704,7 @@ public abstract class AEBaseGui extends GuiContainer if( !this.isPowered() ) { - drawRect( s.xDisplayPosition, s.yDisplayPosition, 16 + s.xDisplayPosition, 16 + s.yDisplayPosition, 0x66111111 ); + drawRect( s.xPos, s.yPos, 16 + s.xPos, 16 + s.yPos, 0x66111111 ); } this.zLevel = 0.0F; @@ -713,7 +713,7 @@ public abstract class AEBaseGui extends GuiContainer // Annoying but easier than trying to splice into render item super.drawSlot( new Size1Slot( s ) ); - stackSizeRenderer.renderStackSize( fontRendererObj, ( (SlotME) s ).getAEStack(), s.getStack(), s.xDisplayPosition, s.yDisplayPosition ); + stackSizeRenderer.renderStackSize( fontRendererObj, ( (SlotME) s ).getAEStack(), s.getStack(), s.xPos, s.yPos ); } catch( final Exception err ) @@ -745,8 +745,8 @@ public abstract class AEBaseGui extends GuiContainer GlStateManager.enableTexture2D(); GlStateManager.blendFunc( GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA ); GlStateManager.color( 1.0f, 1.0f, 1.0f, 1.0f ); - final float par1 = aes.xDisplayPosition; - final float par2 = aes.yDisplayPosition; + final float par1 = aes.xPos; + final float par2 = aes.yPos; final float par3 = uv_x * 16; final float par4 = uv_y * 16; @@ -786,7 +786,7 @@ public abstract class AEBaseGui extends GuiContainer { try { - isValid = ( (SlotRestrictedInput) s ).isValid( is, this.mc.theWorld ); + isValid = ( (SlotRestrictedInput) s ).isValid( is, this.mc.world ); } catch( final Exception err ) { @@ -802,7 +802,7 @@ public abstract class AEBaseGui extends GuiContainer this.itemRender.zLevel = 100.0F; GlStateManager.disableLighting(); - drawRect( s.xDisplayPosition, s.yDisplayPosition, 16 + s.xDisplayPosition, 16 + s.yDisplayPosition, 0x66ff6666 ); + drawRect( s.xPos, s.yPos, 16 + s.xPos, 16 + s.yPos, 0x66ff6666 ); GlStateManager.enableLighting(); this.zLevel = 0.0F; diff --git a/src/main/java/appeng/client/gui/AEBaseMEGui.java b/src/main/java/appeng/client/gui/AEBaseMEGui.java index f3fd749f9..857578e97 100644 --- a/src/main/java/appeng/client/gui/AEBaseMEGui.java +++ b/src/main/java/appeng/client/gui/AEBaseMEGui.java @@ -82,10 +82,10 @@ public abstract class AEBaseMEGui extends AEBaseGui currentToolTip.add( TextFormatting.GRAY + format ); } } - else if( stack.stackSize > BigNumber || ( stack.stackSize > 1 && stack.isItemDamaged() ) ) + else if( stack.getCount() > BigNumber || ( stack.getCount() > 1 && stack.isItemDamaged() ) ) { final String local = ButtonToolTips.ItemsStored.getLocal(); - final String formattedAmount = NumberFormat.getNumberInstance( Locale.US ).format( stack.stackSize ); + final String formattedAmount = NumberFormat.getNumberInstance( Locale.US ).format( stack.getCount() ); final String format = String.format( local, formattedAmount ); currentToolTip.add( TextFormatting.GRAY + format ); @@ -119,7 +119,7 @@ public abstract class AEBaseMEGui extends AEBaseGui if( myStack != null ) { @SuppressWarnings( "unchecked" ) - final List currentToolTip = stack.getTooltip( this.mc.thePlayer, this.mc.gameSettings.advancedItemTooltips ); + final List currentToolTip = stack.getTooltip( this.mc.player, this.mc.gameSettings.advancedItemTooltips ); if( myStack.getStackSize() > BigNumber || ( myStack.getStackSize() > 1 && stack.isItemDamaged() ) ) { @@ -134,10 +134,10 @@ public abstract class AEBaseMEGui extends AEBaseGui this.drawTooltip( x, y, currentToolTip ); return; } - else if( stack.stackSize > BigNumber ) + else if( stack.getCount() > BigNumber ) { - List var4 = stack.getTooltip( this.mc.thePlayer, this.mc.gameSettings.advancedItemTooltips ); - var4.add( "Items Stored: " + NumberFormat.getNumberInstance( Locale.US ).format( stack.stackSize ) ); + List var4 = stack.getTooltip( this.mc.player, this.mc.gameSettings.advancedItemTooltips ); + var4.add( "Items Stored: " + NumberFormat.getNumberInstance( Locale.US ).format( stack.getCount() ) ); this.drawTooltip( x, y, var4 ); return; } diff --git a/src/main/java/appeng/client/gui/Size1Slot.java b/src/main/java/appeng/client/gui/Size1Slot.java index c5f36eae8..72deb2e33 100644 --- a/src/main/java/appeng/client/gui/Size1Slot.java +++ b/src/main/java/appeng/client/gui/Size1Slot.java @@ -24,7 +24,7 @@ class Size1Slot extends Slot public Size1Slot( Slot delegate ) { - super( delegate.inventory, delegate.getSlotIndex(), delegate.xDisplayPosition, delegate.yDisplayPosition ); + super( delegate.inventory, delegate.getSlotIndex(), delegate.xPos, delegate.yPos ); this.delegate = delegate; } @@ -36,7 +36,7 @@ class Size1Slot extends Slot if( orgStack != null ) { ItemStack modifiedStack = orgStack.copy(); - modifiedStack.stackSize = 1; + modifiedStack.setCount( 1 ); return modifiedStack; } diff --git a/src/main/java/appeng/client/gui/implementations/GuiInterfaceTerminal.java b/src/main/java/appeng/client/gui/implementations/GuiInterfaceTerminal.java index aa7e8ee4b..1e54ee8d3 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiInterfaceTerminal.java +++ b/src/main/java/appeng/client/gui/implementations/GuiInterfaceTerminal.java @@ -232,7 +232,7 @@ public class GuiInterfaceTerminal extends AEBaseGui final String which = Integer.toString( x ); if( invData.hasKey( which ) ) { - current.getInventory().setInventorySlotContents( x, ItemStack.loadItemStackFromNBT( invData.getCompoundTag( which ) ) ); + current.getInventory().setInventorySlotContents( x, new ItemStack( invData.getCompoundTag( which ) ) ); } } } @@ -344,7 +344,7 @@ public class GuiInterfaceTerminal extends AEBaseGui for( int i = 0; i < outTag.tagCount(); i++ ) { - final ItemStack parsedItemStack = ItemStack.loadItemStackFromNBT( outTag.getCompoundTagAt( i ) ); + final ItemStack parsedItemStack = new ItemStack( outTag.getCompoundTagAt( i ) ); if( parsedItemStack != null ) { final String displayName = Platform.getItemDisplayName( AEApi.instance().storage().createItemStack( parsedItemStack ) ).toLowerCase(); diff --git a/src/main/java/appeng/client/gui/implementations/GuiMEMonitorable.java b/src/main/java/appeng/client/gui/implementations/GuiMEMonitorable.java index f958f5c32..9b2e3853a 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiMEMonitorable.java +++ b/src/main/java/appeng/client/gui/implementations/GuiMEMonitorable.java @@ -323,7 +323,7 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi { if( s instanceof AppEngSlot ) { - if( ( (Slot) s ).xDisplayPosition < 197 ) + if( ( (Slot) s ).xPos < 197 ) { this.repositionSlot( (AppEngSlot) s ); } @@ -332,10 +332,10 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi if( s instanceof SlotCraftingMatrix || s instanceof SlotFakeCraftingMatrix ) { final Slot g = (Slot) s; - if( g.xDisplayPosition > 0 && g.yDisplayPosition > 0 ) + if( g.xPos > 0 && g.yPos > 0 ) { - craftingGridOffsetX = Math.min( craftingGridOffsetX, g.xDisplayPosition ); - craftingGridOffsetY = Math.min( craftingGridOffsetY, g.yDisplayPosition ); + craftingGridOffsetX = Math.min( craftingGridOffsetX, g.xPos ); + craftingGridOffsetY = Math.min( craftingGridOffsetY, g.yPos ); } } } @@ -443,7 +443,7 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi protected void repositionSlot( final AppEngSlot s ) { - s.yDisplayPosition = s.getY() + this.ySize - 78 - 5; + s.yPos = s.getY() + this.ySize - 78 - 5; } @Override diff --git a/src/main/java/appeng/client/gui/implementations/GuiNetworkStatus.java b/src/main/java/appeng/client/gui/implementations/GuiNetworkStatus.java index 96e8d9c10..2f0d31b9f 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiNetworkStatus.java +++ b/src/main/java/appeng/client/gui/implementations/GuiNetworkStatus.java @@ -253,7 +253,7 @@ public class GuiNetworkStatus extends AEBaseGui implements ISortSource if( myStack != null ) { - List currentToolTip = stack.getTooltip( this.mc.thePlayer, this.mc.gameSettings.advancedItemTooltips ); + List currentToolTip = stack.getTooltip( this.mc.player, this.mc.gameSettings.advancedItemTooltips ); while( currentToolTip.size() > 1 ) { diff --git a/src/main/java/appeng/client/gui/implementations/GuiPatternTerm.java b/src/main/java/appeng/client/gui/implementations/GuiPatternTerm.java index 9e9070233..a5dfb2680 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiPatternTerm.java +++ b/src/main/java/appeng/client/gui/implementations/GuiPatternTerm.java @@ -176,6 +176,6 @@ public class GuiPatternTerm extends GuiMEMonitorable { final int offsetPlayerSide = s.isPlayerSide() ? 5 : 3; - s.yDisplayPosition = s.getY() + this.ySize - 78 - offsetPlayerSide; + s.yPos = s.getY() + this.ySize - 78 - offsetPlayerSide; } } diff --git a/src/main/java/appeng/client/me/SlotDisconnected.java b/src/main/java/appeng/client/me/SlotDisconnected.java index 7592f6a58..3be3b0444 100644 --- a/src/main/java/appeng/client/me/SlotDisconnected.java +++ b/src/main/java/appeng/client/me/SlotDisconnected.java @@ -76,11 +76,6 @@ public class SlotDisconnected extends AppEngSlot return super.getStack(); } - @Override - public void onPickupFromSlot( final EntityPlayer par1EntityPlayer, final ItemStack par2ItemStack ) - { - } - @Override public boolean getHasStack() { diff --git a/src/main/java/appeng/client/me/SlotME.java b/src/main/java/appeng/client/me/SlotME.java index 2c6a0fc1b..31826222c 100644 --- a/src/main/java/appeng/client/me/SlotME.java +++ b/src/main/java/appeng/client/me/SlotME.java @@ -47,11 +47,6 @@ public class SlotME extends Slot return null; } - @Override - public void onPickupFromSlot( final EntityPlayer par1EntityPlayer, final ItemStack par2ItemStack ) - { - } - @Override public boolean isItemValid( final ItemStack par1ItemStack ) { diff --git a/src/main/java/appeng/client/render/StackSizeRenderer.java b/src/main/java/appeng/client/render/StackSizeRenderer.java index 1030bc3eb..0176d17f8 100644 --- a/src/main/java/appeng/client/render/StackSizeRenderer.java +++ b/src/main/java/appeng/client/render/StackSizeRenderer.java @@ -53,7 +53,7 @@ public class StackSizeRenderer final boolean unicodeFlag = fontRenderer.getUnicodeFlag(); fontRenderer.setUnicodeFlag( false ); - if( is.stackSize == 0 ) + if( is.getCount() == 0 ) { final String craftLabelText = AEConfig.instance().useTerminalUseLargeFont() ? GuiText.LargeFontCraft.getLocal() : GuiText.SmallFontCraft.getLocal(); GlStateManager.disableLighting(); @@ -70,7 +70,7 @@ public class StackSizeRenderer GlStateManager.enableBlend(); } - final long amount = aeStack != null ? aeStack.getStackSize() : is.stackSize; + final long amount = aeStack != null ? aeStack.getStackSize() : is.getCount(); if( amount != 0 ) { final String stackSize = this.getToBeRenderedStackSize( amount ); diff --git a/src/main/java/appeng/client/render/cablebus/CubeBuilder.java b/src/main/java/appeng/client/render/cablebus/CubeBuilder.java index 0794fcb2e..3ffafa2a0 100644 --- a/src/main/java/appeng/client/render/cablebus/CubeBuilder.java +++ b/src/main/java/appeng/client/render/cablebus/CubeBuilder.java @@ -174,10 +174,10 @@ public class CubeBuilder putVertexTR( builder, face, x2, y2, z1, uv ); break; case NORTH: - putVertexBR( builder, face, x2, y2, z1, uv ); - putVertexTR( builder, face, x2, y1, z1, uv ); + putVertexTL( builder, face, x2, y2, z1, uv ); + putVertexTL( builder, face, x2, y1, z1, uv ); putVertexTL( builder, face, x1, y1, z1, uv ); - putVertexBL( builder, face, x1, y2, z1, uv ); + putVertexTL( builder, face, x1, y2, z1, uv ); break; case SOUTH: putVertexBL( builder, face, x1, y2, z2, uv ); diff --git a/src/main/java/appeng/client/render/effects/AssemblerFX.java b/src/main/java/appeng/client/render/effects/AssemblerFX.java index b21cb8f14..76b53fa96 100644 --- a/src/main/java/appeng/client/render/effects/AssemblerFX.java +++ b/src/main/java/appeng/client/render/effects/AssemblerFX.java @@ -26,7 +26,7 @@ import net.minecraft.world.World; import appeng.api.storage.data.IAEItemStack; import appeng.client.EffectType; -import appeng.core.CommonHelper; +import appeng.core.AppEng; import appeng.entity.EntityFloatingItem; import appeng.entity.ICanDie; @@ -46,7 +46,7 @@ public class AssemblerFX extends Particle implements ICanDie this.motionZ = 0; this.speed = speed; this.fi = new EntityFloatingItem( this, w, x, y, z, is.getItemStack() ); - w.spawnEntityInWorld( this.fi ); + w.spawnEntity( this.fi ); this.particleMaxAge = (int) Math.ceil( Math.max( 1, 100.0f / speed ) ) + 2; } @@ -76,7 +76,7 @@ public class AssemblerFX extends Particle implements ICanDie } this.motionY -= 0.04D * (double)this.particleGravity; - this.moveEntity(this.motionX, this.motionY, this.motionZ); + this.move(this.motionX, this.motionY, this.motionZ); this.motionX *= 0.9800000190734863D; this.motionY *= 0.9800000190734863D; this.motionZ *= 0.9800000190734863D; @@ -99,10 +99,10 @@ public class AssemblerFX extends Particle implements ICanDie if( this.time > 4.0 ) { this.time -= 4.0; - // if ( CommonHelper.proxy.shouldAddParticles( r ) ) + // if ( AppEng.proxy.shouldAddParticles( r ) ) for( int x = 0; x < (int) Math.ceil( this.speed / 5 ); x++ ) { - CommonHelper.proxy.spawnEffect( EffectType.Crafting, this.worldObj, this.posX, this.posY, this.posZ, null ); + AppEng.proxy.spawnEffect( EffectType.Crafting, this.world, this.posX, this.posY, this.posZ, null ); } } } diff --git a/src/main/java/appeng/client/render/effects/CraftingFx.java b/src/main/java/appeng/client/render/effects/CraftingFx.java index 69e50f322..defab6ee8 100644 --- a/src/main/java/appeng/client/render/effects/CraftingFx.java +++ b/src/main/java/appeng/client/render/effects/CraftingFx.java @@ -55,9 +55,9 @@ public class CraftingFx extends ParticleBreaking this.particleTextureIndex = ParticleTextures.BlockEnergyParticle; this.particleMaxAge /= 1.2; - this.startBlkX = MathHelper.floor_double( this.posX ); - this.startBlkY = MathHelper.floor_double( this.posY ); - this.startBlkZ = MathHelper.floor_double( this.posZ ); + this.startBlkX = MathHelper.floor( this.posX ); + this.startBlkY = MathHelper.floor( this.posY ); + this.startBlkZ = MathHelper.floor( this.posZ ); } @Override @@ -84,9 +84,9 @@ public class CraftingFx extends ParticleBreaking float offY = (float) ( this.prevPosY + ( this.posY - this.prevPosY ) * partialTick ); float offZ = (float) ( this.prevPosZ + ( this.posZ - this.prevPosZ ) * partialTick ); - final int blkX = MathHelper.floor_double( offX ); - final int blkY = MathHelper.floor_double( offY ); - final int blkZ = MathHelper.floor_double( offZ ); + final int blkX = MathHelper.floor( offX ); + final int blkY = MathHelper.floor( offY ); + final int blkZ = MathHelper.floor( offZ ); if( blkX == this.startBlkX && blkY == this.startBlkY && blkZ == this.startBlkZ ) { offX -= interpPosX; @@ -127,7 +127,7 @@ public class CraftingFx extends ParticleBreaking } this.motionY -= 0.04D * (double) this.particleGravity; - this.moveEntity( this.motionX, this.motionY, this.motionZ ); + this.move( this.motionX, this.motionY, this.motionZ ); this.motionX *= 0.9800000190734863D; this.motionY *= 0.9800000190734863D; this.motionZ *= 0.9800000190734863D; diff --git a/src/main/java/appeng/client/render/effects/EnergyFx.java b/src/main/java/appeng/client/render/effects/EnergyFx.java index 4509e4bb1..8067577cb 100644 --- a/src/main/java/appeng/client/render/effects/EnergyFx.java +++ b/src/main/java/appeng/client/render/effects/EnergyFx.java @@ -54,9 +54,9 @@ public class EnergyFx extends ParticleBreaking this.particleScale = 3.5f; this.particleTextureIndex = ParticleTextures.BlockEnergyParticle; - this.startBlkX = MathHelper.floor_double( this.posX ); - this.startBlkY = MathHelper.floor_double( this.posY ); - this.startBlkZ = MathHelper.floor_double( this.posZ ); + this.startBlkX = MathHelper.floor( this.posX ); + this.startBlkY = MathHelper.floor( this.posY ); + this.startBlkZ = MathHelper.floor( this.posZ ); } @Override @@ -78,9 +78,9 @@ public class EnergyFx extends ParticleBreaking final float f12 = (float) ( this.prevPosY + ( this.posY - this.prevPosY ) * partialTicks - interpPosY ); final float f13 = (float) ( this.prevPosZ + ( this.posZ - this.prevPosZ ) * partialTicks - interpPosZ ); - final int blkX = MathHelper.floor_double( this.posX ); - final int blkY = MathHelper.floor_double( this.posY ); - final int blkZ = MathHelper.floor_double( this.posZ ); + final int blkX = MathHelper.floor( this.posX ); + final int blkY = MathHelper.floor( this.posY ); + final int blkZ = MathHelper.floor( this.posZ ); if( blkX == this.startBlkX && blkY == this.startBlkY && blkZ == this.startBlkZ ) { @@ -117,7 +117,7 @@ public class EnergyFx extends ParticleBreaking } this.motionY -= 0.04D * (double) this.particleGravity; - this.moveEntity( this.motionX, this.motionY, this.motionZ ); + this.move( this.motionX, this.motionY, this.motionZ ); this.motionX *= 0.9800000190734863D; this.motionY *= 0.9800000190734863D; this.motionZ *= 0.9800000190734863D; diff --git a/src/main/java/appeng/client/render/effects/LightningFX.java b/src/main/java/appeng/client/render/effects/LightningFX.java index df0653e42..c445bea32 100644 --- a/src/main/java/appeng/client/render/effects/LightningFX.java +++ b/src/main/java/appeng/client/render/effects/LightningFX.java @@ -89,7 +89,7 @@ public class LightningFX extends Particle } this.motionY -= 0.04D * (double)this.particleGravity; - this.moveEntity(this.motionX, this.motionY, this.motionZ); + this.move(this.motionX, this.motionY, this.motionZ); this.motionX *= 0.9800000190734863D; this.motionY *= 0.9800000190734863D; this.motionZ *= 0.9800000190734863D; @@ -125,7 +125,7 @@ public class LightningFX extends Particle double oy = 0; double oz = 0; - final EntityPlayer p = Minecraft.getMinecraft().thePlayer; + final EntityPlayer p = Minecraft.getMinecraft().player; double offX = -rZ; double offY = MathHelper.cos( (float) ( Math.PI / 2.0f + p.rotationPitch * 0.017453292F ) ); double offZ = rX; diff --git a/src/main/java/appeng/client/render/effects/MatterCannonFX.java b/src/main/java/appeng/client/render/effects/MatterCannonFX.java index 26a3f7452..2efd149ed 100644 --- a/src/main/java/appeng/client/render/effects/MatterCannonFX.java +++ b/src/main/java/appeng/client/render/effects/MatterCannonFX.java @@ -68,7 +68,7 @@ public class MatterCannonFX extends ParticleBreaking } this.motionY -= 0.04D * (double) this.particleGravity; - this.moveEntity( this.motionX, this.motionY, this.motionZ ); + this.move( this.motionX, this.motionY, this.motionZ ); this.motionX *= 0.9800000190734863D; this.motionY *= 0.9800000190734863D; this.motionZ *= 0.9800000190734863D; diff --git a/src/main/java/appeng/client/render/model/GlassBakedModel.java b/src/main/java/appeng/client/render/model/GlassBakedModel.java index a8bdb24ec..733184846 100644 --- a/src/main/java/appeng/client/render/model/GlassBakedModel.java +++ b/src/main/java/appeng/client/render/model/GlassBakedModel.java @@ -212,10 +212,10 @@ class GlassBakedModel implements IBakedModel // Apply the u,v shift. // This mirrors the logic from OffsetIcon from 1.7 - float u1 = MathHelper.clamp_float( 0 - uOffset, 0, 16 ); - float u2 = MathHelper.clamp_float( 16 - uOffset, 0, 16 ); - float v1 = MathHelper.clamp_float( 0 - vOffset, 0, 16 ); - float v2 = MathHelper.clamp_float( 16 - vOffset, 0, 16 ); + float u1 = MathHelper.clamp( 0 - uOffset, 0, 16 ); + float u2 = MathHelper.clamp( 16 - uOffset, 0, 16 ); + float v1 = MathHelper.clamp( 0 - vOffset, 0, 16 ); + float v2 = MathHelper.clamp( 16 - vOffset, 0, 16 ); UnpackedBakedQuad.Builder builder = new UnpackedBakedQuad.Builder( vertexFormat ); builder.setTexture( sprite ); diff --git a/src/main/java/appeng/client/render/tesr/SkyCompassTESR.java b/src/main/java/appeng/client/render/tesr/SkyCompassTESR.java index ce687013c..177aab45a 100644 --- a/src/main/java/appeng/client/render/tesr/SkyCompassTESR.java +++ b/src/main/java/appeng/client/render/tesr/SkyCompassTESR.java @@ -50,7 +50,7 @@ public class SkyCompassTESR extends FastTESR public void renderTileEntityFast( TileSkyCompass te, double x, double y, double z, float partialTicks, int destroyStage, VertexBuffer buffer ) { - if( !te.hasWorldObj() ) + if( !te.hasWorld() ) { return; } @@ -63,7 +63,7 @@ public class SkyCompassTESR extends FastTESR BlockPos pos = te.getPos(); IBlockAccess world = MinecraftForgeClient.getRegionRenderCache( te.getWorld(), pos ); IBlockState state = world.getBlockState( pos ); - if( state.getPropertyNames().contains( Properties.StaticProperty ) ) + if( state.getPropertyKeys().contains( Properties.StaticProperty ) ) { state = state.withProperty( Properties.StaticProperty, false ); } diff --git a/src/main/java/appeng/container/AEBaseContainer.java b/src/main/java/appeng/container/AEBaseContainer.java index 909ec0122..bebe3d82e 100644 --- a/src/main/java/appeng/container/AEBaseContainer.java +++ b/src/main/java/appeng/container/AEBaseContainer.java @@ -203,7 +203,7 @@ public abstract class AEBaseContainer extends Container final NBTTagCompound data = CompressedStreamTools.readCompressed( new ByteArrayInputStream( buffer ) ); if( data != null ) { - this.setTargetStack( AEApi.instance().storage().createItemStack( ItemStack.loadItemStackFromNBT( data ) ) ); + this.setTargetStack( AEApi.instance().storage().createItemStack( new ItemStack( data ) ) ); } } catch( final IOException e ) @@ -583,17 +583,17 @@ public abstract class AEBaseContainer extends Container maxSize = d.getSlotStackLimit(); } - int placeAble = maxSize - t.stackSize; + int placeAble = maxSize - t.getCount(); - if( tis.stackSize < placeAble ) + if( tis.getCount() < placeAble ) { - placeAble = tis.stackSize; + placeAble = tis.getCount(); } - t.stackSize += placeAble; - tis.stackSize -= placeAble; + t.setCount( t.getCount() + placeAble ); + tis.setCount( tis.getCount() - placeAble ); - if( tis.stackSize <= 0 ) + if( tis.getCount() <= 0 ) { clickSlot.putStack( null ); d.onSlotChanged(); @@ -635,17 +635,17 @@ public abstract class AEBaseContainer extends Container maxSize = d.getSlotStackLimit(); } - int placeAble = maxSize - t.stackSize; + int placeAble = maxSize - t.getCount(); - if( tis.stackSize < placeAble ) + if( tis.getCount() < placeAble ) { - placeAble = tis.stackSize; + placeAble = tis.getCount(); } - t.stackSize += placeAble; - tis.stackSize -= placeAble; + t.setCount( t.getCount() + placeAble ); + tis.setCount( tis.getCount() - placeAble ); - if( tis.stackSize <= 0 ) + if( tis.getCount() <= 0 ) { clickSlot.putStack( null ); d.onSlotChanged(); @@ -673,15 +673,15 @@ public abstract class AEBaseContainer extends Container } final ItemStack tmp = tis.copy(); - if( tmp.stackSize > maxSize ) + if( tmp.getCount() > maxSize ) { - tmp.stackSize = maxSize; + tmp.setCount( maxSize ); } - tis.stackSize -= tmp.stackSize; + tis.setCount( tis.getCount() - tmp.getCount() ); d.putStack( tmp ); - if( tis.stackSize <= 0 ) + if( tis.getCount() <= 0 ) { clickSlot.putStack( null ); d.onSlotChanged(); @@ -726,7 +726,7 @@ public abstract class AEBaseContainer extends Container { if( this.tileEntity instanceof IInventory ) { - return ( (IInventory) this.tileEntity ).isUseableByPlayer( entityplayer ); + return ( (IInventory) this.tileEntity ).isUsableByPlayer( entityplayer ); } return true; } @@ -781,7 +781,7 @@ public abstract class AEBaseContainer extends Container if( hand != null ) { final ItemStack is = hand.copy(); - is.stackSize = 1; + is.setCount( 1 ); s.putStack( is ); } @@ -793,16 +793,16 @@ public abstract class AEBaseContainer extends Container { if( hand == null ) { - is.stackSize = Math.max( 1, is.stackSize - 1 ); + is.setCount( Math.max( 1, is.getCount() - 1 ) ); } else if( hand.isItemEqual( is ) ) { - is.stackSize = Math.min( is.getMaxStackSize(), is.stackSize + 1 ); + is.setCount(Math.min( is.getMaxStackSize(), is.getCount() + 1 )); } else { is = hand.copy(); - is.stackSize = 1; + is.setCount( 1 ); } s.putStack( is ); @@ -810,7 +810,7 @@ public abstract class AEBaseContainer extends Container else if( hand != null ) { is = hand.copy(); - is.stackSize = 1; + is.setCount( 1 ); s.putStack( is ); } @@ -863,12 +863,12 @@ public abstract class AEBaseContainer extends Container ais.setStackSize( myItem.getMaxStackSize() ); final InventoryAdaptor adp = InventoryAdaptor.getAdaptor( player, EnumFacing.UP ); - myItem.stackSize = (int) ais.getStackSize(); + myItem.setCount( (int) ais.getStackSize() ); myItem = adp.simulateAdd( myItem ); if( myItem != null ) { - ais.setStackSize( ais.getStackSize() - myItem.stackSize ); + ais.setStackSize( ais.getStackSize() - myItem.getCount() ); } ais = Platform.poweredExtraction( this.getPowerSource(), this.getCellInventory(), ais, this.getActionSource() ); @@ -923,7 +923,7 @@ public abstract class AEBaseContainer extends Container if( item != null ) { - if( item.stackSize >= item.getMaxStackSize() ) + if( item.getCount() >= item.getMaxStackSize() ) { liftQty = 0; } @@ -1034,8 +1034,8 @@ public abstract class AEBaseContainer extends Container if( ais == null ) { final ItemStack is = player.inventory.getItemStack(); - is.stackSize--; - if( is.stackSize <= 0 ) + is.setCount( is.getCount() - 1 ); + if( is.getCount() <= 0 ) { player.inventory.setItemStack( null ); } @@ -1048,7 +1048,7 @@ public abstract class AEBaseContainer extends Container if( player.capabilities.isCreativeMode && slotItem != null ) { final ItemStack is = slotItem.getItemStack(); - is.stackSize = is.getMaxStackSize(); + is.setCount( is.getMaxStackSize() ); player.inventory.setItemStack( is ); this.updateHeld( player ); } @@ -1071,12 +1071,12 @@ public abstract class AEBaseContainer extends Container ais.setStackSize( myItem.getMaxStackSize() ); final InventoryAdaptor adp = InventoryAdaptor.getAdaptor( player, EnumFacing.UP ); - myItem.stackSize = (int) ais.getStackSize(); + myItem.setCount( (int) ais.getStackSize() ); myItem = adp.simulateAdd( myItem ); if( myItem != null ) { - ais.setStackSize( ais.getStackSize() - myItem.stackSize ); + ais.setStackSize( ais.getStackSize() - myItem.getCount() ); } ais = Platform.poweredExtraction( this.getPowerSource(), this.getCellInventory(), ais, this.getActionSource() ); @@ -1103,7 +1103,8 @@ public abstract class AEBaseContainer extends Container { try { - NetworkHandler.instance().sendTo( new PacketInventoryAction( InventoryAction.UPDATE_HAND, 0, AEItemStack.create( p.inventory.getItemStack() ) ), p ); + NetworkHandler.instance().sendTo( new PacketInventoryAction( InventoryAction.UPDATE_HAND, 0, AEItemStack.create( p.inventory.getItemStack() ) ), + p ); } catch( final IOException e ) { @@ -1118,7 +1119,8 @@ public abstract class AEBaseContainer extends Container { return input; } - final IAEItemStack ais = Platform.poweredInsert( this.getPowerSource(), this.getCellInventory(), AEApi.instance().storage().createItemStack( input ), this.getActionSource() ); + final IAEItemStack ais = Platform.poweredInsert( this.getPowerSource(), this.getCellInventory(), AEApi.instance().storage().createItemStack( input ), + this.getActionSource() ); if( ais == null ) { return null; @@ -1172,7 +1174,8 @@ public abstract class AEBaseContainer extends Container { try { - NetworkHandler.instance().sendTo( new PacketValueConfig( "CustomName", this.getCustomName() ), (EntityPlayerMP) this.getInventoryPlayer().player ); + NetworkHandler.instance().sendTo( new PacketValueConfig( "CustomName", this.getCustomName() ), + (EntityPlayerMP) this.getInventoryPlayer().player ); } catch( final IOException e ) { @@ -1232,32 +1235,32 @@ public abstract class AEBaseContainer extends Container ItemStack testB = isA == null ? null : isA.copy(); // can put some back? - if( testA != null && testA.stackSize > a.getSlotStackLimit() ) + if( testA != null && testA.getCount() > a.getSlotStackLimit() ) { if( testB != null ) { return; } - final int totalA = testA.stackSize; - testA.stackSize = a.getSlotStackLimit(); + final int totalA = testA.getCount(); + testA.setCount( a.getSlotStackLimit() ); testB = testA.copy(); - testB.stackSize = totalA - testA.stackSize; + testB.setCount( totalA - testA.getCount() ); } - if( testB != null && testB.stackSize > b.getSlotStackLimit() ) + if( testB != null && testB.getCount() > b.getSlotStackLimit() ) { if( testA != null ) { return; } - final int totalB = testB.stackSize; - testB.stackSize = b.getSlotStackLimit(); + final int totalB = testB.getCount(); + testB.setCount( b.getSlotStackLimit() ); testA = testB.copy(); - testA.stackSize = totalB - testA.stackSize; + testA.setCount( totalB - testA.getCount() ); } a.putStack( testA ); diff --git a/src/main/java/appeng/container/implementations/ContainerCellWorkbench.java b/src/main/java/appeng/container/implementations/ContainerCellWorkbench.java index 5e0340e50..98b2cdfcd 100644 --- a/src/main/java/appeng/container/implementations/ContainerCellWorkbench.java +++ b/src/main/java/appeng/container/implementations/ContainerCellWorkbench.java @@ -243,7 +243,7 @@ public class ContainerCellWorkbench extends ContainerUpgradeable if( i.hasNext() ) { final ItemStack g = i.next().getItemStack(); - g.stackSize = 1; + g.setCount( 1 ); inv.setInventorySlotContents( x, g ); } else @@ -331,7 +331,7 @@ public class ContainerCellWorkbench extends ContainerUpgradeable } @Override - public boolean isUseableByPlayer( final EntityPlayer entityplayer ) + public boolean isUsableByPlayer( EntityPlayer player ) { return false; } @@ -383,5 +383,12 @@ public class ContainerCellWorkbench extends ContainerUpgradeable { ContainerCellWorkbench.this.getCellUpgradeInventory().clear(); } + + @Override + public boolean isEmpty() + { + // TODO Auto-generated method stub + return false; + } } } diff --git a/src/main/java/appeng/container/implementations/ContainerCraftAmount.java b/src/main/java/appeng/container/implementations/ContainerCraftAmount.java index 8508464b4..036a28e77 100644 --- a/src/main/java/appeng/container/implementations/ContainerCraftAmount.java +++ b/src/main/java/appeng/container/implementations/ContainerCraftAmount.java @@ -66,7 +66,7 @@ public class ContainerCraftAmount extends AEBaseContainer public World getWorld() { - return this.getPlayerInv().player.worldObj; + return this.getPlayerInv().player.world; } public BaseActionSource getActionSrc() diff --git a/src/main/java/appeng/container/implementations/ContainerCraftConfirm.java b/src/main/java/appeng/container/implementations/ContainerCraftConfirm.java index 1bbff98a6..ca242171c 100644 --- a/src/main/java/appeng/container/implementations/ContainerCraftConfirm.java +++ b/src/main/java/appeng/container/implementations/ContainerCraftConfirm.java @@ -279,7 +279,7 @@ public class ContainerCraftConfirm extends AEBaseContainer } catch( final Throwable e ) { - this.getPlayerInv().player.addChatMessage( new TextComponentString( "Error: " + e.toString() ) ); + this.getPlayerInv().player.sendMessage( new TextComponentString( "Error: " + e.toString() ) ); AELog.debug( e ); this.setValidContainer( false ); this.result = null; @@ -389,7 +389,7 @@ public class ContainerCraftConfirm extends AEBaseContainer public World getWorld() { - return this.getPlayerInv().player.worldObj; + return this.getPlayerInv().player.world; } public boolean isAutoStart() diff --git a/src/main/java/appeng/container/implementations/ContainerCraftingTerm.java b/src/main/java/appeng/container/implementations/ContainerCraftingTerm.java index 5405b8359..7cb8e8a1d 100644 --- a/src/main/java/appeng/container/implementations/ContainerCraftingTerm.java +++ b/src/main/java/appeng/container/implementations/ContainerCraftingTerm.java @@ -80,7 +80,7 @@ public class ContainerCraftingTerm extends ContainerMEMonitorable implements IAE ic.setInventorySlotContents( x, this.craftingSlots[x].getStack() ); } - this.outputSlot.putStack( CraftingManager.getInstance().findMatchingRecipe( ic, this.getPlayerInv().player.worldObj ) ); + this.outputSlot.putStack( CraftingManager.getInstance().findMatchingRecipe( ic, this.getPlayerInv().player.world ) ); } @Override diff --git a/src/main/java/appeng/container/implementations/ContainerInterfaceTerminal.java b/src/main/java/appeng/container/implementations/ContainerInterfaceTerminal.java index b3a145b0f..c7a110fa1 100644 --- a/src/main/java/appeng/container/implementations/ContainerInterfaceTerminal.java +++ b/src/main/java/appeng/container/implementations/ContainerInterfaceTerminal.java @@ -268,7 +268,7 @@ public final class ContainerInterfaceTerminal extends AEBaseContainer } else if( is != null ) { - ItemStack extra = interfaceSlot.removeItems( ( is.stackSize + 1 ) / 2, null, null ); + ItemStack extra = interfaceSlot.removeItems( ( is.getCount() + 1 ) / 2, null, null ); if( extra != null ) { extra = playerHand.addItems( extra ); diff --git a/src/main/java/appeng/container/implementations/ContainerPatternTerm.java b/src/main/java/appeng/container/implementations/ContainerPatternTerm.java index 18e370da5..cd00cb7ee 100644 --- a/src/main/java/appeng/container/implementations/ContainerPatternTerm.java +++ b/src/main/java/appeng/container/implementations/ContainerPatternTerm.java @@ -125,35 +125,28 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA { if( !this.isCraftingMode() ) { - this.craftSlot.xDisplayPosition = -9000; + this.craftSlot.xPos = -9000; for( int y = 0; y < 3; y++ ) { - this.outputSlots[y].xDisplayPosition = this.outputSlots[y].getX(); + this.outputSlots[y].xPos = this.outputSlots[y].getX(); } } else { - this.craftSlot.xDisplayPosition = this.craftSlot.getX(); + this.craftSlot.xPos = this.craftSlot.getX(); for( int y = 0; y < 3; y++ ) { - this.outputSlots[y].xDisplayPosition = -9000; + this.outputSlots[y].xPos = -9000; } } } @Override - public void putStackInSlot( final int par1, final ItemStack par2ItemStack ) + public void putStackInSlot( int slotID, ItemStack stack ) { - super.putStackInSlot( par1, par2ItemStack ); - this.getAndUpdateOutput(); - } - - @Override - public void putStacksInSlots( final ItemStack[] par1ArrayOfItemStack ) - { - super.putStacksInSlots( par1ArrayOfItemStack ); + super.putStackInSlot( slotID, stack ); this.getAndUpdateOutput(); } @@ -166,7 +159,7 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA ic.setInventorySlotContents( x, this.crafting.getStackInSlot( x ) ); } - final ItemStack is = CraftingManager.getInstance().findMatchingRecipe( ic, this.getPlayerInv().player.worldObj ); + final ItemStack is = CraftingManager.getInstance().findMatchingRecipe( ic, this.getPlayerInv().player.world ); this.cOut.setInventorySlotContents( 0, is ); return is; } @@ -210,8 +203,8 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA } // remove one, and clear the input slot. - output.stackSize--; - if( output.stackSize == 0 ) + output.setCount( output.getCount() ); + if( output.getCount() == 0 ) { this.patternSlotIN.putStack( null ); } @@ -277,7 +270,7 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA { final ItemStack out = this.getAndUpdateOutput(); - if( out != null && out.stackSize > 0 ) + if( out != null && out.getCount() > 0 ) { return new ItemStack[] { out }; } @@ -291,7 +284,7 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA { final ItemStack out = outputSlot.getStack(); - if( out != null && out.stackSize > 0 ) + if( out != null && out.getCount() > 0 ) { list.add( out ); hasValue = true; @@ -391,7 +384,7 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA ic.setInventorySlotContents( x, packetPatternSlot.pattern[x] == null ? null : packetPatternSlot.pattern[x].getItemStack() ); } - final IRecipe r = Platform.findMatchingRecipe( ic, p.worldObj ); + final IRecipe r = Platform.findMatchingRecipe( ic, p.world ); if( r == null ) { @@ -407,17 +400,17 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA { if( ic.getStackInSlot( x ) != null ) { - final ItemStack pulled = Platform.extractItemsByRecipe( this.getPowerSource(), this.getActionSource(), storage, p.worldObj, r, is, ic, ic.getStackInSlot( x ), x, all, Actionable.MODULATE, ItemViewCell.createFilter( this.getViewCells() ) ); + final ItemStack pulled = Platform.extractItemsByRecipe( this.getPowerSource(), this.getActionSource(), storage, p.world, r, is, ic, ic.getStackInSlot( x ), x, all, Actionable.MODULATE, ItemViewCell.createFilter( this.getViewCells() ) ); real.setInventorySlotContents( x, pulled ); } } - final IRecipe rr = Platform.findMatchingRecipe( real, p.worldObj ); + final IRecipe rr = Platform.findMatchingRecipe( real, p.world ); if( rr == r && Platform.itemComparisons().isSameItem( rr.getCraftingResult( real ), is ) ) { final SlotCrafting sc = new SlotCrafting( p, real, this.cOut, 0, 0, 0 ); - sc.onPickupFromSlot( p, is ); + sc.onTake( p, is ); for( int x = 0; x < real.getSizeInventory(); x++ ) { diff --git a/src/main/java/appeng/container/implementations/ContainerQuartzKnife.java b/src/main/java/appeng/container/implementations/ContainerQuartzKnife.java index 9f9084d84..75665a8bc 100644 --- a/src/main/java/appeng/container/implementations/ContainerQuartzKnife.java +++ b/src/main/java/appeng/container/implementations/ContainerQuartzKnife.java @@ -171,9 +171,9 @@ public class ContainerQuartzKnife extends AEBaseContainer implements IAEAppEngIn final ItemStack item = this.toolInv.getItemStack(); item.damageItem( 1, this.getPlayerInv().player ); - if( item.stackSize == 0 ) + if( item.getCount() == 0 ) { - this.getPlayerInv().mainInventory[this.getPlayerInv().currentItem] = null; + this.getPlayerInv().mainInventory.add( this.getPlayerInv().currentItem, null ); MinecraftForge.EVENT_BUS.post( new PlayerDestroyItemEvent( this.getPlayerInv().player, item, null ) ); } @@ -222,7 +222,7 @@ public class ContainerQuartzKnife extends AEBaseContainer implements IAEAppEngIn } @Override - public boolean isUseableByPlayer( final EntityPlayer var1 ) + public boolean isUsableByPlayer( EntityPlayer player ) { return false; } @@ -274,4 +274,11 @@ public class ContainerQuartzKnife extends AEBaseContainer implements IAEAppEngIn { this.inSlot.setInventorySlotContents( 0, null ); } + + @Override + public boolean isEmpty() + { + // TODO Auto-generated method stub + return false; + } } diff --git a/src/main/java/appeng/container/implementations/ContainerStorageBus.java b/src/main/java/appeng/container/implementations/ContainerStorageBus.java index 1a4927396..db461a209 100644 --- a/src/main/java/appeng/container/implementations/ContainerStorageBus.java +++ b/src/main/java/appeng/container/implementations/ContainerStorageBus.java @@ -160,7 +160,7 @@ public class ContainerStorageBus extends ContainerUpgradeable if( i.hasNext() && this.isSlotEnabled( ( x / 9 ) - 2 ) ) { final ItemStack g = i.next().getItemStack(); - g.stackSize = 1; + g.setCount( 1 ); inv.setInventorySlotContents( x, g ); } else diff --git a/src/main/java/appeng/container/implementations/ContainerWireless.java b/src/main/java/appeng/container/implementations/ContainerWireless.java index 000cde8d0..a3b073162 100644 --- a/src/main/java/appeng/container/implementations/ContainerWireless.java +++ b/src/main/java/appeng/container/implementations/ContainerWireless.java @@ -51,7 +51,7 @@ public class ContainerWireless extends AEBaseContainer @Override public void detectAndSendChanges() { - final int boosters = this.boosterSlot.getStack() == null ? 0 : this.boosterSlot.getStack().stackSize; + final int boosters = this.boosterSlot.getStack() == null ? 0 : this.boosterSlot.getStack().getCount(); this.setRange( (long) ( 10 * AEConfig.instance().wireless_getMaxRange( boosters ) ) ); this.setDrain( (long) ( 100 * AEConfig.instance().wireless_getPowerDrain( boosters ) ) ); diff --git a/src/main/java/appeng/container/implementations/ContainerWirelessTerm.java b/src/main/java/appeng/container/implementations/ContainerWirelessTerm.java index 67675101b..ee97cdc99 100644 --- a/src/main/java/appeng/container/implementations/ContainerWirelessTerm.java +++ b/src/main/java/appeng/container/implementations/ContainerWirelessTerm.java @@ -47,7 +47,7 @@ public class ContainerWirelessTerm extends ContainerMEPortableCell { if( Platform.isServer() && this.isValidContainer() ) { - this.getPlayerInv().player.addChatMessage( PlayerMessages.OutOfRange.get() ); + this.getPlayerInv().player.sendMessage( PlayerMessages.OutOfRange.get() ); } this.setValidContainer( false ); diff --git a/src/main/java/appeng/container/slot/AppEngCraftingSlot.java b/src/main/java/appeng/container/slot/AppEngCraftingSlot.java index 5724840fa..d9bc163f7 100644 --- a/src/main/java/appeng/container/slot/AppEngCraftingSlot.java +++ b/src/main/java/appeng/container/slot/AppEngCraftingSlot.java @@ -32,6 +32,7 @@ import net.minecraft.item.ItemSword; import net.minecraft.item.ItemTool; import net.minecraft.item.crafting.CraftingManager; import net.minecraft.stats.AchievementList; +import net.minecraft.util.NonNullList; public class AppEngCraftingSlot extends AppEngSlot @@ -85,7 +86,7 @@ public class AppEngCraftingSlot extends AppEngSlot @Override protected void onCrafting( final ItemStack par1ItemStack ) { - par1ItemStack.onCrafting( this.thePlayer.worldObj, this.thePlayer, this.amountCrafted ); + par1ItemStack.onCrafting( this.thePlayer.world, this.thePlayer, this.amountCrafted ); this.amountCrafted = 0; if( par1ItemStack.getItem() == Item.getItemFromBlock( Blocks.CRAFTING_TABLE ) ) @@ -140,7 +141,7 @@ public class AppEngCraftingSlot extends AppEngSlot } @Override - public void onPickupFromSlot( final EntityPlayer playerIn, final ItemStack stack ) + public ItemStack onTake( final EntityPlayer playerIn, final ItemStack stack ) { net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerCraftingEvent( playerIn, stack, this.craftMatrix ); this.onCrafting( stack ); @@ -152,7 +153,7 @@ public class AppEngCraftingSlot extends AppEngSlot ic.setInventorySlotContents( x, this.craftMatrix.getStackInSlot( x ) ); } - final ItemStack[] aitemstack = CraftingManager.getInstance().getRemainingItems( ic, playerIn.worldObj ); + final NonNullList aitemstack = CraftingManager.getInstance().getRemainingItems( ic, playerIn.world ); for( int x = 0; x < this.craftMatrix.getSizeInventory(); x++ ) { @@ -161,10 +162,10 @@ public class AppEngCraftingSlot extends AppEngSlot net.minecraftforge.common.ForgeHooks.setCraftingPlayer( null ); - for( int i = 0; i < aitemstack.length; ++i ) + for( int i = 0; i < aitemstack.size(); ++i ) { final ItemStack itemstack1 = this.craftMatrix.getStackInSlot( i ); - final ItemStack itemstack2 = aitemstack[i]; + final ItemStack itemstack2 = aitemstack.get( i ); if( itemstack1 != null ) { @@ -183,6 +184,8 @@ public class AppEngCraftingSlot extends AppEngSlot } } } + + return stack; } /** @@ -194,7 +197,7 @@ public class AppEngCraftingSlot extends AppEngSlot { if( this.getHasStack() ) { - this.amountCrafted += Math.min( par1, this.getStack().stackSize ); + this.amountCrafted += Math.min( par1, this.getStack().getCount() ); } return super.decrStackSize( par1 ); diff --git a/src/main/java/appeng/container/slot/NullSlot.java b/src/main/java/appeng/container/slot/NullSlot.java index 3ab30bd7d..10fa1faea 100644 --- a/src/main/java/appeng/container/slot/NullSlot.java +++ b/src/main/java/appeng/container/slot/NullSlot.java @@ -40,9 +40,9 @@ public class NullSlot extends Slot } @Override - public void onPickupFromSlot( final EntityPlayer par1EntityPlayer, final ItemStack par2ItemStack ) + public ItemStack onTake( final EntityPlayer par1EntityPlayer, final ItemStack par2ItemStack ) { - + return par2ItemStack; } @Override diff --git a/src/main/java/appeng/container/slot/OptionalSlotFakeTypeOnly.java b/src/main/java/appeng/container/slot/OptionalSlotFakeTypeOnly.java index 666d9b604..dcfe7e28c 100644 --- a/src/main/java/appeng/container/slot/OptionalSlotFakeTypeOnly.java +++ b/src/main/java/appeng/container/slot/OptionalSlotFakeTypeOnly.java @@ -37,13 +37,13 @@ public class OptionalSlotFakeTypeOnly extends OptionalSlotFake if( is != null ) { is = is.copy(); - if( is.stackSize > 1 ) + if( is.getCount() > 1 ) { - is.stackSize = 1; + is.setCount( 1 ); } - else if( is.stackSize < -1 ) + else if( is.getCount() < -1 ) { - is.stackSize = -1; + is.setCount( -1 ); } } diff --git a/src/main/java/appeng/container/slot/SlotCraftingTerm.java b/src/main/java/appeng/container/slot/SlotCraftingTerm.java index ffe00ff7f..09779caff 100644 --- a/src/main/java/appeng/container/slot/SlotCraftingTerm.java +++ b/src/main/java/appeng/container/slot/SlotCraftingTerm.java @@ -81,8 +81,9 @@ public class SlotCraftingTerm extends AppEngCraftingSlot } @Override - public void onPickupFromSlot( final EntityPlayer p, final ItemStack is ) + public ItemStack onTake( final EntityPlayer p, final ItemStack is ) { + return is; } public void doClick( final InventoryAction action, final EntityPlayer who ) @@ -97,7 +98,7 @@ public class SlotCraftingTerm extends AppEngCraftingSlot } final IMEMonitor inv = this.storage.getItemInventory(); - final int howManyPerCraft = this.getStack().stackSize; + final int howManyPerCraft = this.getStack().getCount(); int maxTimesToCraft = 0; InventoryAdaptor ia = null; @@ -141,7 +142,7 @@ public class SlotCraftingTerm extends AppEngCraftingSlot { final List drops = new ArrayList(); drops.add( extra ); - Platform.spawnDrops( who.worldObj, new BlockPos( (int) who.posX, (int) who.posY, (int) who.posZ ), drops ); + Platform.spawnDrops( who.world, new BlockPos( (int) who.posX, (int) who.posY, (int) who.posZ ), drops ); return; } } @@ -171,7 +172,7 @@ public class SlotCraftingTerm extends AppEngCraftingSlot ic.setInventorySlotContents( x, this.getPattern().getStackInSlot( x ) ); } - final IRecipe r = Platform.findMatchingRecipe( ic, p.worldObj ); + final IRecipe r = Platform.findMatchingRecipe( ic, p.world ); if( r == null ) { @@ -193,7 +194,7 @@ public class SlotCraftingTerm extends AppEngCraftingSlot } if( !isBad ) { - super.onPickupFromSlot( p, is ); + super.onTake( p, is ); // actually necessary to cleanup this case... p.openContainer.onCraftMatrixChanged( this.craftInv ); return request; @@ -210,7 +211,7 @@ public class SlotCraftingTerm extends AppEngCraftingSlot { if( this.getPattern().getStackInSlot( x ) != null ) { - set[x] = Platform.extractItemsByRecipe( this.energySrc, this.mySrc, inv, p.worldObj, r, is, ic, this.getPattern().getStackInSlot( x ), x, all, Actionable.MODULATE, ItemViewCell.createFilter( this.container.getViewCells() ) ); + set[x] = Platform.extractItemsByRecipe( this.energySrc, this.mySrc, inv, p.world, r, is, ic, this.getPattern().getStackInSlot( x ), x, all, Actionable.MODULATE, ItemViewCell.createFilter( this.container.getViewCells() ) ); ic.setInventorySlotContents( x, set[x] ); } } @@ -240,7 +241,7 @@ public class SlotCraftingTerm extends AppEngCraftingSlot private void makeItem( final EntityPlayer p, final ItemStack is ) { - super.onPickupFromSlot( p, is ); + super.onTake( p, is ); } private void postCraft( final EntityPlayer p, final IMEMonitor inv, final ItemStack[] set, final ItemStack result ) @@ -271,7 +272,7 @@ public class SlotCraftingTerm extends AppEngCraftingSlot if( drops.size() > 0 ) { - Platform.spawnDrops( p.worldObj, new BlockPos( (int) p.posX, (int) p.posY, (int) p.posZ ), drops ); + Platform.spawnDrops( p.world, new BlockPos( (int) p.posX, (int) p.posY, (int) p.posZ ), drops ); } } diff --git a/src/main/java/appeng/container/slot/SlotFake.java b/src/main/java/appeng/container/slot/SlotFake.java index 28807ee0c..5db083d89 100644 --- a/src/main/java/appeng/container/slot/SlotFake.java +++ b/src/main/java/appeng/container/slot/SlotFake.java @@ -33,8 +33,9 @@ public class SlotFake extends AppEngSlot } @Override - public void onPickupFromSlot( final EntityPlayer par1EntityPlayer, final ItemStack par2ItemStack ) + public ItemStack onTake( final EntityPlayer par1EntityPlayer, final ItemStack par2ItemStack ) { + return par2ItemStack; } @Override diff --git a/src/main/java/appeng/container/slot/SlotFakeBlacklist.java b/src/main/java/appeng/container/slot/SlotFakeBlacklist.java index b0d9ba518..b9304dd78 100644 --- a/src/main/java/appeng/container/slot/SlotFakeBlacklist.java +++ b/src/main/java/appeng/container/slot/SlotFakeBlacklist.java @@ -47,7 +47,7 @@ public class SlotFakeBlacklist extends SlotFakeTypeOnly { if( this.getHasStack() ) { - return this.getStack().stackSize > 0 ? 16 + 14 : 14; + return this.getStack().getCount() > 0 ? 16 + 14 : 14; } return -1; } diff --git a/src/main/java/appeng/container/slot/SlotFakeTypeOnly.java b/src/main/java/appeng/container/slot/SlotFakeTypeOnly.java index 809da8ac0..9a3e9bd34 100644 --- a/src/main/java/appeng/container/slot/SlotFakeTypeOnly.java +++ b/src/main/java/appeng/container/slot/SlotFakeTypeOnly.java @@ -37,13 +37,13 @@ public class SlotFakeTypeOnly extends SlotFake if( is != null ) { is = is.copy(); - if( is.stackSize > 1 ) + if( is.getCount() > 1 ) { - is.stackSize = 1; + is.setCount( 1 ); } - else if( is.stackSize < -1 ) + else if( is.getCount() < -1 ) { - is.stackSize = -1; + is.setCount( -1 ); } } diff --git a/src/main/java/appeng/container/slot/SlotRestrictedInput.java b/src/main/java/appeng/container/slot/SlotRestrictedInput.java index cfbba5c7a..6d7ef5ca3 100644 --- a/src/main/java/appeng/container/slot/SlotRestrictedInput.java +++ b/src/main/java/appeng/container/slot/SlotRestrictedInput.java @@ -130,7 +130,7 @@ public class SlotRestrictedInput extends AppEngSlot if( i.getItem() instanceof ICraftingPatternItem ) { final ICraftingPatternItem b = (ICraftingPatternItem) i.getItem(); - final ICraftingPatternDetails de = b.getPatternForItem( i, this.p.player.worldObj ); + final ICraftingPatternDetails de = b.getPatternForItem( i, this.p.player.world ); if( de != null ) { return de.isCraftable(); diff --git a/src/main/java/appeng/core/AppEng.java b/src/main/java/appeng/core/AppEng.java index 408cf2793..0ee2a0e83 100644 --- a/src/main/java/appeng/core/AppEng.java +++ b/src/main/java/appeng/core/AppEng.java @@ -33,6 +33,7 @@ import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventHandler; +import net.minecraftforge.fml.common.SidedProxy; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLInterModComms; import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; @@ -64,9 +65,12 @@ import appeng.services.version.VersionCheckerConfig; import appeng.util.Platform; -@Mod( modid = AppEng.MOD_ID, acceptedMinecraftVersions = "[1.10.2]", name = AppEng.MOD_NAME, version = AEConfig.VERSION, dependencies = AppEng.MOD_DEPENDENCIES, guiFactory = "appeng.client.gui.config.AEConfigGuiFactory" ) +@Mod( modid = AppEng.MOD_ID, acceptedMinecraftVersions = "[1.11]", name = AppEng.MOD_NAME, version = AEConfig.VERSION, dependencies = AppEng.MOD_DEPENDENCIES, guiFactory = "appeng.client.gui.config.AEConfigGuiFactory" ) public final class AppEng { + @SidedProxy( clientSide = "appeng.client.ClientHelper", serverSide = "appeng.server.ServerHelper", modId = AppEng.MOD_ID ) + public static CommonHelper proxy; + public static final String MOD_ID = "appliedenergistics2"; public static final String MOD_NAME = "Applied Energistics 2"; @@ -78,11 +82,11 @@ public final class AppEng // "after:gregtech_addon;after:Mekanism;after:IC2;after:ThermalExpansion;after:BuildCraft|Core;" + // depend on version of forge used for build. - "after:appliedenergistics2-core;" + "required-after:Forge@[" // require forge. - + net.minecraftforge.common.ForgeVersion.majorVersion + '.' // majorVersion - + net.minecraftforge.common.ForgeVersion.minorVersion + '.' // minorVersion - + net.minecraftforge.common.ForgeVersion.revisionVersion + '.' // revisionVersion - + net.minecraftforge.common.ForgeVersion.buildVersion + ",)"; // buildVersion + "after:appliedenergistics2-core;";// + "required-after:Forge@[" // require forge. + //+ net.minecraftforge.common.ForgeVersion.majorVersion + '.' // majorVersion + //+ net.minecraftforge.common.ForgeVersion.minorVersion + '.' // minorVersion + //+ net.minecraftforge.common.ForgeVersion.revisionVersion + '.' // revisionVersion + //+ net.minecraftforge.common.ForgeVersion.buildVersion + ",)"; // buildVersion @Nonnull private static final AppEng INSTANCE = new AppEng(); @@ -129,7 +133,7 @@ public final class AppEng { if( !Loader.isModLoaded( "appliedenergistics2-core" ) ) { - CommonHelper.proxy.missingCoreMod(); + AppEng.proxy.missingCoreMod(); } final Stopwatch watch = Stopwatch.createStarted(); @@ -161,7 +165,7 @@ public final class AppEng if( Platform.isClient() ) { - CommonHelper.proxy.preinit(); + AppEng.proxy.preinit(); } if( versionCheckerConfig.isVersionCheckingEnabled() ) @@ -226,7 +230,7 @@ public final class AppEng IntegrationRegistry.INSTANCE.postInit(); FMLCommonHandler.instance().registerCrashCallable( new IntegrationCrashEnhancement() ); - CommonHelper.proxy.postInit(); + AppEng.proxy.postInit(); AEConfig.instance().save(); NetworkRegistry.INSTANCE.registerGuiHandler( this, GuiBridge.GUI_Handler ); diff --git a/src/main/java/appeng/core/CommonHelper.java b/src/main/java/appeng/core/CommonHelper.java index c22533aec..ccf3705b7 100644 --- a/src/main/java/appeng/core/CommonHelper.java +++ b/src/main/java/appeng/core/CommonHelper.java @@ -26,7 +26,6 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.math.RayTraceResult; import net.minecraft.world.World; -import net.minecraftforge.fml.common.SidedProxy; import appeng.api.parts.CableRenderMode; import appeng.block.AEBaseBlock; @@ -37,8 +36,6 @@ import appeng.core.sync.AppEngPacket; public abstract class CommonHelper { - @SidedProxy( clientSide = "appeng.client.ClientHelper", serverSide = "appeng.server.ServerHelper" ) - public static CommonHelper proxy; public abstract void preinit(); @@ -52,7 +49,7 @@ public abstract class CommonHelper public abstract void sendToAllNearExcept( EntityPlayer p, double x, double y, double z, double dist, World w, AppEngPacket packet ); - public abstract void spawnEffect( EffectType effect, World worldObj, double posX, double posY, double posZ, Object extra ); + public abstract void spawnEffect( EffectType effect, World world, double posX, double posY, double posZ, Object extra ); public abstract boolean shouldAddParticles( Random r ); diff --git a/src/main/java/appeng/core/CreativeTab.java b/src/main/java/appeng/core/CreativeTab.java index daf765423..09a0d0918 100644 --- a/src/main/java/appeng/core/CreativeTab.java +++ b/src/main/java/appeng/core/CreativeTab.java @@ -23,7 +23,6 @@ import java.util.Optional; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.init.Blocks; -import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import appeng.api.AEApi; @@ -49,9 +48,9 @@ public final class CreativeTab extends CreativeTabs } @Override - public Item getTabIconItem() + public ItemStack getTabIconItem() { - return this.getIconItemStack().getItem(); + return this.getIconItemStack(); } @Override diff --git a/src/main/java/appeng/core/CreativeTabFacade.java b/src/main/java/appeng/core/CreativeTabFacade.java index 4daa4a572..a8dd45fec 100644 --- a/src/main/java/appeng/core/CreativeTabFacade.java +++ b/src/main/java/appeng/core/CreativeTabFacade.java @@ -46,9 +46,9 @@ public final class CreativeTabFacade extends CreativeTabs } @Override - public Item getTabIconItem() + public ItemStack getTabIconItem() { - return this.getIconItemStack().getItem(); + return this.getIconItemStack(); } @Override diff --git a/src/main/java/appeng/core/api/ApiPart.java b/src/main/java/appeng/core/api/ApiPart.java index 8add84cd5..639d0b2de 100644 --- a/src/main/java/appeng/core/api/ApiPart.java +++ b/src/main/java/appeng/core/api/ApiPart.java @@ -55,7 +55,7 @@ import appeng.api.parts.CableRenderMode; import appeng.api.parts.IPartHelper; import appeng.api.parts.LayerBase; import appeng.core.AELog; -import appeng.core.CommonHelper; +import appeng.core.AppEng; import appeng.parts.PartPlacement; import appeng.tile.AEBaseTile; import appeng.tile.networking.TileCableBus; @@ -328,7 +328,7 @@ public class ApiPart implements IPartHelper @Override public CableRenderMode getCableRenderMode() { - return CommonHelper.proxy.getRenderMode(); + return AppEng.proxy.getRenderMode(); } private static class DefaultPackageClassNameRemapper extends Remapper diff --git a/src/main/java/appeng/core/api/definitions/ApiParts.java b/src/main/java/appeng/core/api/definitions/ApiParts.java index 8739ba64d..628b767ce 100644 --- a/src/main/java/appeng/core/api/definitions/ApiParts.java +++ b/src/main/java/appeng/core/api/definitions/ApiParts.java @@ -61,8 +61,8 @@ public final class ApiParts implements IParts private final IItemDefinition p2PTunnelME; private final IItemDefinition p2PTunnelRedstone; private final IItemDefinition p2PTunnelItems; - private final IItemDefinition p2PTunnelLiquids; - private final IItemDefinition p2PTunnelEU; + //private final IItemDefinition p2PTunnelLiquids; + //private final IItemDefinition p2PTunnelEU; // private final IItemDefinition p2PTunnelRF; private final IItemDefinition p2PTunnelLight; // private final IItemDefinition p2PTunnelOpenComputers; @@ -112,8 +112,8 @@ public final class ApiParts implements IParts this.p2PTunnelME = new DamagedItemDefinition( "part.tunnel.me", itemPart.createPart( PartType.P2PTunnelME ) ); this.p2PTunnelRedstone = new DamagedItemDefinition( "part.tunnel.redstone", itemPart.createPart( PartType.P2PTunnelRedstone ) ); this.p2PTunnelItems = new DamagedItemDefinition( "part.tunnel.item", itemPart.createPart( PartType.P2PTunnelItems ) ); - this.p2PTunnelLiquids = new DamagedItemDefinition( "part.tunnel.fluid", itemPart.createPart( PartType.P2PTunnelLiquids ) ); - this.p2PTunnelEU = new DamagedItemDefinition( "part.tunnel.eu", itemPart.createPart( PartType.P2PTunnelEU ) ); + //this.p2PTunnelLiquids = new DamagedItemDefinition( "part.tunnel.fluid", itemPart.createPart( PartType.P2PTunnelLiquids ) ); + //this.p2PTunnelEU = new DamagedItemDefinition( "part.tunnel.eu", itemPart.createPart( PartType.P2PTunnelEU ) ); // this.p2PTunnelRF = new DamagedItemDefinition( itemMultiPart.createPart( PartType.P2PTunnelRF ) ); this.p2PTunnelLight = new DamagedItemDefinition( "part.tunnel.light", itemPart.createPart( PartType.P2PTunnelLight ) ); // this.p2PTunnelOpenComputers = new DamagedItemDefinition( itemMultiPart.createPart( @@ -280,17 +280,17 @@ public final class ApiParts implements IParts return this.p2PTunnelItems; } - @Override - public IItemDefinition p2PTunnelLiquids() - { - return this.p2PTunnelLiquids; - } - - @Override - public IItemDefinition p2PTunnelEU() - { - return this.p2PTunnelEU; - } +// @Override +// public IItemDefinition p2PTunnelLiquids() +// { +// return this.p2PTunnelLiquids; +// } +// +// @Override +// public IItemDefinition p2PTunnelEU() +// { +// return this.p2PTunnelEU; +// } /* @Override * public IItemDefinition p2PTunnelRF() diff --git a/src/main/java/appeng/core/api/imc/IMCGrinder.java b/src/main/java/appeng/core/api/imc/IMCGrinder.java index 7503d1a00..787f024ce 100644 --- a/src/main/java/appeng/core/api/imc/IMCGrinder.java +++ b/src/main/java/appeng/core/api/imc/IMCGrinder.java @@ -70,8 +70,8 @@ public class IMCGrinder implements IIMCProcessor final NBTTagCompound inTag = (NBTTagCompound) msg.getTag( "in" ); final NBTTagCompound outTag = (NBTTagCompound) msg.getTag( "out" ); - final ItemStack in = ItemStack.loadItemStackFromNBT( inTag ); - final ItemStack out = ItemStack.loadItemStackFromNBT( outTag ); + final ItemStack in = new ItemStack( inTag ); + final ItemStack out = new ItemStack( outTag ); final int turns = msg.getInteger( "turns" ); @@ -88,7 +88,7 @@ public class IMCGrinder implements IIMCProcessor if( msg.hasKey( "optional" ) ) { final NBTTagCompound optionalTag = (NBTTagCompound) msg.getTag( "optional" ); - final ItemStack optional = ItemStack.loadItemStackFromNBT( optionalTag ); + final ItemStack optional = new ItemStack( optionalTag ); if( optional == null ) { diff --git a/src/main/java/appeng/core/api/imc/IMCMatterCannon.java b/src/main/java/appeng/core/api/imc/IMCMatterCannon.java index 25bb8ee7f..5a9baa9ec 100644 --- a/src/main/java/appeng/core/api/imc/IMCMatterCannon.java +++ b/src/main/java/appeng/core/api/imc/IMCMatterCannon.java @@ -49,7 +49,7 @@ public class IMCMatterCannon implements IIMCProcessor final NBTTagCompound msg = m.getNBTValue(); final NBTTagCompound item = (NBTTagCompound) msg.getTag( "item" ); - final ItemStack ammo = ItemStack.loadItemStackFromNBT( item ); + final ItemStack ammo = new ItemStack( item ); final double weight = msg.getDouble( "weight" ); if( ammo == null ) diff --git a/src/main/java/appeng/core/features/registries/P2PTunnelRegistry.java b/src/main/java/appeng/core/features/registries/P2PTunnelRegistry.java index e7970de87..f917576b4 100644 --- a/src/main/java/appeng/core/features/registries/P2PTunnelRegistry.java +++ b/src/main/java/appeng/core/features/registries/P2PTunnelRegistry.java @@ -28,8 +28,6 @@ import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidContainerRegistry; -import net.minecraftforge.fml.common.registry.GameRegistry; import net.minecraftforge.oredict.OreDictionary; import appeng.api.AEApi; @@ -134,10 +132,10 @@ public final class P2PTunnelRegistry implements IP2PTunnelRegistry { if( trigger != null ) { - if( FluidContainerRegistry.isContainer( trigger ) ) - { - return TunnelType.FLUID; - } + // if( FluidRegistry.isContainer( trigger ) ) + // { + // return TunnelType.FLUID; + // } for( final ItemStack is : this.tunnels.keySet() ) { @@ -159,7 +157,8 @@ public final class P2PTunnelRegistry implements IP2PTunnelRegistry @Nullable private ItemStack getModItem( final String modID, final String name, final int meta ) { - final Item item = GameRegistry.findItem( modID, name ); + + final Item item = Item.getByNameOrId( modID + ":" + name ); if( item == null ) { diff --git a/src/main/java/appeng/core/features/registries/WirelessRegistry.java b/src/main/java/appeng/core/features/registries/WirelessRegistry.java index 680f56d68..68779e616 100644 --- a/src/main/java/appeng/core/features/registries/WirelessRegistry.java +++ b/src/main/java/appeng/core/features/registries/WirelessRegistry.java @@ -89,7 +89,7 @@ public final class WirelessRegistry implements IWirelessTermRegistry if( !this.isWirelessTerminal( item ) ) { - player.addChatMessage( PlayerMessages.DeviceNotWirelessTerminal.get() ); + player.sendMessage( PlayerMessages.DeviceNotWirelessTerminal.get() ); return; } @@ -97,7 +97,7 @@ public final class WirelessRegistry implements IWirelessTermRegistry final String unparsedKey = handler.getEncryptionKey( item ); if( unparsedKey.isEmpty() ) { - player.addChatMessage( PlayerMessages.DeviceNotLinked.get() ); + player.sendMessage( PlayerMessages.DeviceNotLinked.get() ); return; } @@ -105,7 +105,7 @@ public final class WirelessRegistry implements IWirelessTermRegistry final ILocatable securityStation = AEApi.instance().registries().locatable().getLocatableBy( parsedKey ); if( securityStation == null ) { - player.addChatMessage( PlayerMessages.StationCanNotBeLocated.get() ); + player.sendMessage( PlayerMessages.StationCanNotBeLocated.get() ); return; } @@ -115,7 +115,7 @@ public final class WirelessRegistry implements IWirelessTermRegistry } else { - player.addChatMessage( PlayerMessages.DeviceNotPowered.get() ); + player.sendMessage( PlayerMessages.DeviceNotPowered.get() ); } } } diff --git a/src/main/java/appeng/core/features/registries/grinder/GrinderRecipeManager.java b/src/main/java/appeng/core/features/registries/grinder/GrinderRecipeManager.java index 801af81b4..69325ef01 100644 --- a/src/main/java/appeng/core/features/registries/grinder/GrinderRecipeManager.java +++ b/src/main/java/appeng/core/features/registries/grinder/GrinderRecipeManager.java @@ -258,7 +258,7 @@ public final class GrinderRecipeManager implements IGrinderRegistry, IOreListene if( ratio > 1 ) { final ItemStack extra = is.copy(); - extra.stackSize = ratio - 1; + extra.setCount( ratio - 1 ); this.addRecipe( item, is, extra, (float) ( AEConfig.instance().getOreDoublePercentage() / 100.0 ), 8 ); } else @@ -305,12 +305,12 @@ public final class GrinderRecipeManager implements IGrinderRegistry, IOreListene if( name.equals( d.getValue() ) ) { final ItemStack is = item.copy(); - is.stackSize = 1; + is.setCount( 1 ); final int ratio = this.getDustToOreRatio( name ); if( ratio > 1 ) { final ItemStack extra = is.copy(); - extra.stackSize = ratio - 1; + extra.setCount( ratio - 1 ); this.addRecipe( d.getKey(), is, extra, (float) ( AEConfig.instance().getOreDoublePercentage() / 100.0 ), 8 ); } else diff --git a/src/main/java/appeng/core/sync/GuiBridge.java b/src/main/java/appeng/core/sync/GuiBridge.java index b8065a9bd..e168822c1 100644 --- a/src/main/java/appeng/core/sync/GuiBridge.java +++ b/src/main/java/appeng/core/sync/GuiBridge.java @@ -260,7 +260,7 @@ public enum GuiBridge implements IGuiHandler { it = player.inventory.getCurrentItem(); } - else if( x >= 0 && x < player.inventory.mainInventory.length ) + else if( x >= 0 && x < player.inventory.mainInventory.size() ) { it = player.inventory.getStackInSlot( x ); } @@ -442,7 +442,7 @@ public enum GuiBridge implements IGuiHandler { it = player.inventory.getCurrentItem(); } - else if( x >= 0 && x < player.inventory.mainInventory.length ) + else if( x >= 0 && x < player.inventory.mainInventory.size() ) { it = player.inventory.getStackInSlot( x ); } @@ -505,7 +505,7 @@ public enum GuiBridge implements IGuiHandler final World w = player.getEntityWorld(); final BlockPos pos = new BlockPos( x, y, z ); - if( Platform.hasPermissions( te != null ? new DimensionalCoord( te ) : new DimensionalCoord( player.worldObj, pos ), player ) ) + if( Platform.hasPermissions( te != null ? new DimensionalCoord( te ) : new DimensionalCoord( player.world, pos ), player ) ) { if( this.type.isItem() ) { diff --git a/src/main/java/appeng/core/sync/network/AppEngClientPacketHandler.java b/src/main/java/appeng/core/sync/network/AppEngClientPacketHandler.java index d62599abc..c623a3122 100644 --- a/src/main/java/appeng/core/sync/network/AppEngClientPacketHandler.java +++ b/src/main/java/appeng/core/sync/network/AppEngClientPacketHandler.java @@ -53,7 +53,7 @@ public class AppEngClientPacketHandler extends AppEngPacketHandlerBase implement @Override public void call( final AppEngPacket appEngPacket ) { - appEngPacket.clientPacketData( manager, appEngPacket, Minecraft.getMinecraft().thePlayer ); + appEngPacket.clientPacketData( manager, appEngPacket, Minecraft.getMinecraft().player ); } }; diff --git a/src/main/java/appeng/core/sync/packets/PacketAssemblerAnimation.java b/src/main/java/appeng/core/sync/packets/PacketAssemblerAnimation.java index b84b4a5cb..9f51ea19e 100644 --- a/src/main/java/appeng/core/sync/packets/PacketAssemblerAnimation.java +++ b/src/main/java/appeng/core/sync/packets/PacketAssemblerAnimation.java @@ -31,7 +31,7 @@ import net.minecraftforge.fml.relauncher.SideOnly; import appeng.api.storage.data.IAEItemStack; import appeng.client.EffectType; -import appeng.core.CommonHelper; +import appeng.core.AppEng; import appeng.core.sync.AppEngPacket; import appeng.core.sync.network.INetworkInfo; import appeng.util.item.AEItemStack; @@ -81,6 +81,6 @@ public class PacketAssemblerAnimation extends AppEngPacket final double d1 = 0.5d;// + ((double) (Platform.getRandomFloat() - 0.5F) * 0.26D); final double d2 = 0.5d;// + ((double) (Platform.getRandomFloat() - 0.5F) * 0.26D); - CommonHelper.proxy.spawnEffect( EffectType.Assembler, player.getEntityWorld(), this.x + d0, this.y + d1, this.z + d2, this ); + AppEng.proxy.spawnEffect( EffectType.Assembler, player.getEntityWorld(), this.x + d0, this.y + d1, this.z + d2, this ); } } diff --git a/src/main/java/appeng/core/sync/packets/PacketClick.java b/src/main/java/appeng/core/sync/packets/PacketClick.java index dcf4050b8..084a65722 100644 --- a/src/main/java/appeng/core/sync/packets/PacketClick.java +++ b/src/main/java/appeng/core/sync/packets/PacketClick.java @@ -111,7 +111,7 @@ public class PacketClick extends AppEngPacket if( is.getItem() instanceof ToolNetworkTool ) { final ToolNetworkTool tnt = (ToolNetworkTool) is.getItem(); - tnt.serverSideToolLogic( is, player, this.hand, player.worldObj, new BlockPos( this.x, this.y, this.z ), this.side, this.hitX, this.hitY, this.hitZ ); + tnt.serverSideToolLogic( is, player, this.hand, player.world, new BlockPos( this.x, this.y, this.z ), this.side, this.hitX, this.hitY, this.hitZ ); } else if( maybeMemoryCard.isSameAs( is ) ) diff --git a/src/main/java/appeng/core/sync/packets/PacketCompassRequest.java b/src/main/java/appeng/core/sync/packets/PacketCompassRequest.java index 863c7bbf4..1e913e44b 100644 --- a/src/main/java/appeng/core/sync/packets/PacketCompassRequest.java +++ b/src/main/java/appeng/core/sync/packets/PacketCompassRequest.java @@ -78,7 +78,7 @@ public class PacketCompassRequest extends AppEngPacket implements ICompassCallba { this.talkBackTo = player; - final DimensionalCoord loc = new DimensionalCoord( player.worldObj, this.cx << 4, this.cdy << 5, this.cz << 4 ); + final DimensionalCoord loc = new DimensionalCoord( player.world, this.cx << 4, this.cdy << 5, this.cz << 4 ); WorldData.instance().compassData().service().getCompassDirection( loc, 174, this ); } } diff --git a/src/main/java/appeng/core/sync/packets/PacketInventoryAction.java b/src/main/java/appeng/core/sync/packets/PacketInventoryAction.java index f0ff52927..8bf65813f 100644 --- a/src/main/java/appeng/core/sync/packets/PacketInventoryAction.java +++ b/src/main/java/appeng/core/sync/packets/PacketInventoryAction.java @@ -30,10 +30,10 @@ import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import appeng.api.storage.data.IAEItemStack; -import appeng.client.ClientHelper; import appeng.container.AEBaseContainer; import appeng.container.ContainerOpenContext; import appeng.container.implementations.ContainerCraftAmount; +import appeng.core.AppEng; import appeng.core.sync.AppEngPacket; import appeng.core.sync.GuiBridge; import appeng.core.sync.network.INetworkInfo; @@ -143,7 +143,7 @@ public class PacketInventoryAction extends AppEngPacket { // Force to stack size 1 to fix a client-side display problem... ItemStack displayIs = baseContainer.getTargetStack().getItemStack().copy(); - displayIs.stackSize = 1; + displayIs.setCount( 1 ); cca.getCraftingItem().putStack( displayIs ); // This is the *actual* item that matters, not the display item above cca.setItemToCraft( baseContainer.getTargetStack() ); @@ -167,11 +167,11 @@ public class PacketInventoryAction extends AppEngPacket { if( this.slotItem == null ) { - ClientHelper.proxy.getPlayers().get( 0 ).inventory.setItemStack( null ); + AppEng.proxy.getPlayers().get( 0 ).inventory.setItemStack( null ); } else { - ClientHelper.proxy.getPlayers().get( 0 ).inventory.setItemStack( this.slotItem.getItemStack() ); + AppEng.proxy.getPlayers().get( 0 ).inventory.setItemStack( this.slotItem.getItemStack() ); } } } diff --git a/src/main/java/appeng/core/sync/packets/PacketJEIRecipe.java b/src/main/java/appeng/core/sync/packets/PacketJEIRecipe.java index cb1873061..78c59975b 100644 --- a/src/main/java/appeng/core/sync/packets/PacketJEIRecipe.java +++ b/src/main/java/appeng/core/sync/packets/PacketJEIRecipe.java @@ -84,7 +84,7 @@ public class PacketJEIRecipe extends AppEngPacket this.recipe[x] = new ItemStack[list.tagCount()]; for( int y = 0; y < list.tagCount(); y++ ) { - this.recipe[x][y] = ItemStack.loadItemStackFromNBT( list.getCompoundTagAt( y ) ); + this.recipe[x][y] = new ItemStack( list.getCompoundTagAt( y ) ); } } } @@ -144,7 +144,7 @@ public class PacketJEIRecipe extends AppEngPacket } } - final IRecipe r = Platform.findMatchingRecipe( testInv, pmp.worldObj ); + final IRecipe r = Platform.findMatchingRecipe( testInv, pmp.world ); if( r != null && security.hasPermission( player, SecurityPermissions.EXTRACT ) ) { @@ -164,7 +164,7 @@ public class PacketJEIRecipe extends AppEngPacket if( currentItem != null ) { testInv.setInventorySlotContents( x, currentItem ); - final ItemStack newItemStack = r.matches( testInv, pmp.worldObj ) ? r.getCraftingResult( testInv ) : null; + final ItemStack newItemStack = r.matches( testInv, pmp.world ) ? r.getCraftingResult( testInv ) : null; testInv.setInventorySlotContents( x, patternItem ); if( newItemStack == null || !Platform.itemComparisons().isSameItem( newItemStack, is ) ) @@ -191,7 +191,7 @@ public class PacketJEIRecipe extends AppEngPacket if( patternItem != null && currentItem == null ) { // Grab from network by recipe - ItemStack whichItem = Platform.extractItemsByRecipe( energy, cct.getActionSource(), storage, player.worldObj, r, is, testInv, patternItem, x, all, realForFake, filter ); + ItemStack whichItem = Platform.extractItemsByRecipe( energy, cct.getActionSource(), storage, player.world, r, is, testInv, patternItem, x, all, realForFake, filter ); // If that doesn't get it, grab exact items from network (?) // TODO see if this code is necessary diff --git a/src/main/java/appeng/core/sync/packets/PacketLightning.java b/src/main/java/appeng/core/sync/packets/PacketLightning.java index 359faf429..40a46c102 100644 --- a/src/main/java/appeng/core/sync/packets/PacketLightning.java +++ b/src/main/java/appeng/core/sync/packets/PacketLightning.java @@ -27,9 +27,9 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import appeng.client.ClientHelper; import appeng.client.render.effects.LightningFX; import appeng.core.AEConfig; +import appeng.core.AppEng; import appeng.core.sync.AppEngPacket; import appeng.core.sync.network.INetworkInfo; import appeng.util.Platform; @@ -75,7 +75,7 @@ public class PacketLightning extends AppEngPacket { if( Platform.isClient() && AEConfig.instance().isEnableEffects() ) { - final LightningFX fx = new LightningFX( ClientHelper.proxy.getWorld(), this.x, this.y, this.z, 0.0f, 0.0f, 0.0f ); + final LightningFX fx = new LightningFX( AppEng.proxy.getWorld(), this.x, this.y, this.z, 0.0f, 0.0f, 0.0f ); Minecraft.getMinecraft().effectRenderer.addEffect( fx ); } } diff --git a/src/main/java/appeng/core/sync/packets/PacketMatterCannon.java b/src/main/java/appeng/core/sync/packets/PacketMatterCannon.java index 5a75cf773..f6c6169cd 100644 --- a/src/main/java/appeng/core/sync/packets/PacketMatterCannon.java +++ b/src/main/java/appeng/core/sync/packets/PacketMatterCannon.java @@ -93,7 +93,7 @@ public class PacketMatterCannon extends AppEngPacket try { - final World world = FMLClientHandler.instance().getClient().theWorld; + final World world = FMLClientHandler.instance().getClient().world; for( int a = 1; a < this.len; a++ ) { final MatterCannonFX fx = new MatterCannonFX( world, this.x + this.dx * a, this.y + this.dy * a, this.z + this.dz * a, Items.DIAMOND ); diff --git a/src/main/java/appeng/core/sync/packets/PacketMockExplosion.java b/src/main/java/appeng/core/sync/packets/PacketMockExplosion.java index e0bef759e..829a59e81 100644 --- a/src/main/java/appeng/core/sync/packets/PacketMockExplosion.java +++ b/src/main/java/appeng/core/sync/packets/PacketMockExplosion.java @@ -28,7 +28,7 @@ import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import appeng.core.CommonHelper; +import appeng.core.AppEng; import appeng.core.sync.AppEngPacket; import appeng.core.sync.network.INetworkInfo; @@ -69,7 +69,7 @@ public class PacketMockExplosion extends AppEngPacket @SideOnly( Side.CLIENT ) public void clientPacketData( final INetworkInfo network, final AppEngPacket packet, final EntityPlayer player ) { - final World world = CommonHelper.proxy.getWorld(); + final World world = AppEng.proxy.getWorld(); world.spawnParticle( EnumParticleTypes.EXPLOSION_LARGE, this.x, this.y, this.z, 1.0D, 0.0D, 0.0D, new int[0] ); } } diff --git a/src/main/java/appeng/core/sync/packets/PacketPartPlacement.java b/src/main/java/appeng/core/sync/packets/PacketPartPlacement.java index 0d4e4c6f3..a44ccee3e 100644 --- a/src/main/java/appeng/core/sync/packets/PacketPartPlacement.java +++ b/src/main/java/appeng/core/sync/packets/PacketPartPlacement.java @@ -28,7 +28,7 @@ import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; import net.minecraft.util.math.BlockPos; -import appeng.core.CommonHelper; +import appeng.core.AppEng; import appeng.core.sync.AppEngPacket; import appeng.core.sync.network.INetworkInfo; import appeng.parts.PartPlacement; @@ -75,9 +75,9 @@ public class PacketPartPlacement extends AppEngPacket public void serverPacketData( final INetworkInfo manager, final AppEngPacket packet, final EntityPlayer player ) { final EntityPlayerMP sender = (EntityPlayerMP) player; - CommonHelper.proxy.updateRenderMode( sender ); + AppEng.proxy.updateRenderMode( sender ); PartPlacement.setEyeHeight( this.eyeHeight ); - PartPlacement.place( sender.getHeldItem( hand ), new BlockPos( this.x, this.y, this.z ), EnumFacing.VALUES[this.face], sender, hand, sender.worldObj, PartPlacement.PlaceType.INTERACT_FIRST_PASS, 0 ); - CommonHelper.proxy.updateRenderMode( null ); + PartPlacement.place( sender.getHeldItem( hand ), new BlockPos( this.x, this.y, this.z ), EnumFacing.VALUES[this.face], sender, hand, sender.world, PartPlacement.PlaceType.INTERACT_FIRST_PASS, 0 ); + AppEng.proxy.updateRenderMode( null ); } } diff --git a/src/main/java/appeng/core/sync/packets/PacketTransitionEffect.java b/src/main/java/appeng/core/sync/packets/PacketTransitionEffect.java index 2b9994cbc..00de16162 100644 --- a/src/main/java/appeng/core/sync/packets/PacketTransitionEffect.java +++ b/src/main/java/appeng/core/sync/packets/PacketTransitionEffect.java @@ -34,9 +34,8 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import appeng.api.util.AEPartLocation; -import appeng.client.ClientHelper; import appeng.client.render.effects.EnergyFx; -import appeng.core.CommonHelper; +import appeng.core.AppEng; import appeng.core.sync.AppEngPacket; import appeng.core.sync.network.INetworkInfo; import appeng.util.Platform; @@ -86,11 +85,11 @@ public class PacketTransitionEffect extends AppEngPacket @SideOnly( Side.CLIENT ) public void clientPacketData( final INetworkInfo network, final AppEngPacket packet, final EntityPlayer player ) { - final World world = ClientHelper.proxy.getWorld(); + final World world = AppEng.proxy.getWorld(); for( int zz = 0; zz < ( this.mode ? 32 : 8 ); zz++ ) { - if( CommonHelper.proxy.shouldAddParticles( Platform.getRandom() ) ) + if( AppEng.proxy.shouldAddParticles( Platform.getRandom() ) ) { final EnergyFx fx = new EnergyFx( world, this.x + ( this.mode ? ( Platform.getRandomInt() % 100 ) * 0.01 : ( Platform.getRandomInt() % 100 ) * 0.005 - 0.25 ), this.y + ( this.mode ? ( Platform.getRandomInt() % 100 ) * 0.01 : ( Platform.getRandomInt() % 100 ) * 0.005 - 0.25 ), this.z + ( this.mode ? ( Platform.getRandomInt() % 100 ) * 0.01 : ( Platform.getRandomInt() % 100 ) * 0.005 - 0.25 ), Items.DIAMOND ); diff --git a/src/main/java/appeng/core/worlddata/PlayerData.java b/src/main/java/appeng/core/worlddata/PlayerData.java index cb495edef..c576bd3e4 100644 --- a/src/main/java/appeng/core/worlddata/PlayerData.java +++ b/src/main/java/appeng/core/worlddata/PlayerData.java @@ -33,7 +33,7 @@ import net.minecraftforge.common.config.ConfigCategory; import net.minecraftforge.common.config.Configuration; import net.minecraftforge.common.config.Property; -import appeng.core.CommonHelper; +import appeng.core.AppEng; /** @@ -75,7 +75,7 @@ final class PlayerData implements IWorldPlayerData, IOnWorldStartable, IOnWorldS if( maybe.isPresent() ) { final UUID uuid = maybe.get(); - for( final EntityPlayer player : CommonHelper.proxy.getPlayers() ) + for( final EntityPlayer player : AppEng.proxy.getPlayers() ) { if( player.getUniqueID().equals( uuid ) ) { diff --git a/src/main/java/appeng/coremod/AppEngCore.java b/src/main/java/appeng/coremod/AppEngCore.java index 35b97b454..0f5d00202 100644 --- a/src/main/java/appeng/coremod/AppEngCore.java +++ b/src/main/java/appeng/coremod/AppEngCore.java @@ -37,7 +37,7 @@ import net.minecraftforge.fml.relauncher.IFMLLoadingPlugin.MCVersion; import appeng.core.AEConfig; -@MCVersion( "1.10.2" ) +@MCVersion( "1.11" ) public final class AppEngCore extends DummyModContainer implements IFMLLoadingPlugin { private final ModMetadata metadata = new ModMetadata(); @@ -64,7 +64,7 @@ public final class AppEngCore extends DummyModContainer implements IFMLLoadingPl @Override public String[] getASMTransformerClass() { - return new String[] { "appeng.coremod.asm.ASMIntegration" }; + return null; //new String[] { "appeng.coremod.asm.ASMIntegration" }; } @Override diff --git a/src/main/java/appeng/crafting/CraftingTreeProcess.java b/src/main/java/appeng/crafting/CraftingTreeProcess.java index 0488a3dee..dcd64328d 100644 --- a/src/main/java/appeng/crafting/CraftingTreeProcess.java +++ b/src/main/java/appeng/crafting/CraftingTreeProcess.java @@ -81,7 +81,7 @@ public class CraftingTreeProcess for( int x = 0; x < ic.getSizeInventory(); x++ ) { final ItemStack g = ic.getStackInSlot( x ); - if( g != null && g.stackSize > 1 ) + if( g != null && g.getCount() > 1 ) { this.fullSimulation = true; } diff --git a/src/main/java/appeng/debug/TileChunkLoader.java b/src/main/java/appeng/debug/TileChunkLoader.java index 2d7a1a102..0fcb5e7c2 100644 --- a/src/main/java/appeng/debug/TileChunkLoader.java +++ b/src/main/java/appeng/debug/TileChunkLoader.java @@ -60,17 +60,17 @@ public class TileChunkLoader extends AEBaseTile implements ITickable return; } - this.ct = ForgeChunkManager.requestTicket( AppEng.instance(), this.worldObj, Type.NORMAL ); + this.ct = ForgeChunkManager.requestTicket( AppEng.instance(), this.world, Type.NORMAL ); if( this.ct == null ) { final MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance(); if( server != null ) { - final List pl = server.getPlayerList().getPlayerList(); + final List pl = server.getPlayerList().getPlayers(); for( final EntityPlayerMP p : pl ) { - p.addChatMessage( new TextComponentString( "Can't chunk load.." ) ); + p.sendMessage( new TextComponentString( "Can't chunk load.." ) ); } } return; diff --git a/src/main/java/appeng/debug/TileCubeGenerator.java b/src/main/java/appeng/debug/TileCubeGenerator.java index 657038839..15bfe9103 100644 --- a/src/main/java/appeng/debug/TileCubeGenerator.java +++ b/src/main/java/appeng/debug/TileCubeGenerator.java @@ -28,7 +28,7 @@ import net.minecraft.util.ITickable; import net.minecraft.util.math.BlockPos; import net.minecraft.util.text.TextComponentString; -import appeng.core.CommonHelper; +import appeng.core.AppEng; import appeng.tile.AEBaseTile; import appeng.util.Platform; @@ -50,9 +50,9 @@ public class TileCubeGenerator extends AEBaseTile implements ITickable if( this.countdown % 20 == 0 ) { - for( final EntityPlayer e : CommonHelper.proxy.getPlayers() ) + for( final EntityPlayer e : AppEng.proxy.getPlayers() ) { - e.addChatMessage( new TextComponentString( "Spawning in... " + ( this.countdown / 20 ) ) ); + e.sendMessage( new TextComponentString( "Spawning in... " + ( this.countdown / 20 ) ) ); } } @@ -65,7 +65,7 @@ public class TileCubeGenerator extends AEBaseTile implements ITickable private void spawn() { - this.worldObj.setBlockToAir( this.pos ); + this.world.setBlockToAir( this.pos ); final Item i = this.is.getItem(); final EnumFacing side = EnumFacing.UP; @@ -79,7 +79,7 @@ public class TileCubeGenerator extends AEBaseTile implements ITickable for( int z = -half; z < half; z++ ) { final BlockPos p = this.pos.add( x, y - 1, z ); - i.onItemUse( this.is.copy(), this.who, this.worldObj, p, EnumHand.MAIN_HAND, side, 0.5f, 0.0f, 0.5f ); + i.onItemUse( this.who, this.world, p, EnumHand.MAIN_HAND, side, 0.5f, 0.0f, 0.5f ); } } } @@ -114,7 +114,7 @@ public class TileCubeGenerator extends AEBaseTile implements ITickable this.size = 64; } - player.addChatMessage( new TextComponentString( "Size: " + this.size ) ); + player.sendMessage( new TextComponentString( "Size: " + this.size ) ); } else { diff --git a/src/main/java/appeng/debug/TileItemGen.java b/src/main/java/appeng/debug/TileItemGen.java index 277e034f2..f1466c103 100644 --- a/src/main/java/appeng/debug/TileItemGen.java +++ b/src/main/java/appeng/debug/TileItemGen.java @@ -19,15 +19,14 @@ package appeng.debug; -import java.util.ArrayList; import java.util.LinkedList; -import java.util.List; import java.util.Queue; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.util.NonNullList; import net.minecraft.util.text.ITextComponent; import appeng.tile.AEBaseTile; @@ -56,7 +55,7 @@ public class TileItemGen extends AEBaseTile implements IInventory } else { - final List list = new ArrayList(); + final NonNullList list = NonNullList.create(); mi.getSubItems( mi, mi.getCreativeTab(), list ); POSSIBLE_ITEMS.addAll( list ); } @@ -123,7 +122,7 @@ public class TileItemGen extends AEBaseTile implements IInventory } @Override - public boolean isUseableByPlayer( final EntityPlayer entityplayer ) + public boolean isUsableByPlayer( final EntityPlayer entityplayer ) { return false; } @@ -175,4 +174,11 @@ public class TileItemGen extends AEBaseTile implements IInventory { } + + @Override + public boolean isEmpty() + { + // TODO Auto-generated method stub + return false; + } } diff --git a/src/main/java/appeng/debug/ToolDebugCard.java b/src/main/java/appeng/debug/ToolDebugCard.java index ebcae52bf..acbf2e11e 100644 --- a/src/main/java/appeng/debug/ToolDebugCard.java +++ b/src/main/java/appeng/debug/ToolDebugCard.java @@ -24,7 +24,6 @@ import java.util.Set; import net.minecraft.command.ICommandSender; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumFacing; @@ -57,7 +56,7 @@ import appeng.util.Platform; public class ToolDebugCard extends AEBaseItem { @Override - public EnumActionResult onItemUseFirst( final ItemStack heldItem, final EntityPlayer player, final World world, final BlockPos pos, final EnumFacing side, final float hitX, final float hitY, final float hitZ, final EnumHand hand ) + public EnumActionResult onItemUseFirst( final EntityPlayer player, final World world, final BlockPos pos, final EnumFacing side, final float hitX, final float hitY, final float hitZ, final EnumHand hand ) { if( Platform.isClient() ) { @@ -208,7 +207,7 @@ public class ToolDebugCard extends AEBaseItem private void outputMsg( final ICommandSender player, final String string ) { - player.addChatMessage( new TextComponentString( string ) ); + player.sendMessage( new TextComponentString( string ) ); } private String timeMeasurement( final long nanos ) diff --git a/src/main/java/appeng/debug/ToolEraser.java b/src/main/java/appeng/debug/ToolEraser.java index 51f48ec19..f26284946 100644 --- a/src/main/java/appeng/debug/ToolEraser.java +++ b/src/main/java/appeng/debug/ToolEraser.java @@ -24,7 +24,6 @@ import java.util.List; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; @@ -42,7 +41,7 @@ public class ToolEraser extends AEBaseItem private static final int BLOCK_ERASE_LIMIT = 90000; @Override - public EnumActionResult onItemUseFirst( final ItemStack heldItem, final EntityPlayer player, final World world, final BlockPos pos, final EnumFacing side, final float hitX, final float hitY, final float hitZ, final EnumHand hand ) + public EnumActionResult onItemUseFirst( final EntityPlayer player, final World world, final BlockPos pos, final EnumFacing side, final float hitX, final float hitY, final float hitZ, final EnumHand hand ) { if( Platform.isClient() ) { diff --git a/src/main/java/appeng/debug/ToolMeteoritePlacer.java b/src/main/java/appeng/debug/ToolMeteoritePlacer.java index 2422c213b..af7dbecf2 100644 --- a/src/main/java/appeng/debug/ToolMeteoritePlacer.java +++ b/src/main/java/appeng/debug/ToolMeteoritePlacer.java @@ -20,7 +20,6 @@ package appeng.debug; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; @@ -37,7 +36,7 @@ import appeng.worldgen.meteorite.StandardWorld; public class ToolMeteoritePlacer extends AEBaseItem { @Override - public EnumActionResult onItemUseFirst( final ItemStack heldItem, final EntityPlayer player, final World world, final BlockPos pos, final EnumFacing side, final float hitX, final float hitY, final float hitZ, final EnumHand hand ) + public EnumActionResult onItemUseFirst( final EntityPlayer player, final World world, final BlockPos pos, final EnumFacing side, final float hitX, final float hitY, final float hitZ, final EnumHand hand ) { if( Platform.isClient() ) { @@ -49,7 +48,7 @@ public class ToolMeteoritePlacer extends AEBaseItem if( !worked ) { - player.addChatMessage( new TextComponentString( "Un-suitable Location." ) ); + player.sendMessage( new TextComponentString( "Un-suitable Location." ) ); } return EnumActionResult.SUCCESS; diff --git a/src/main/java/appeng/debug/ToolReplicatorCard.java b/src/main/java/appeng/debug/ToolReplicatorCard.java index 1144c9fe0..3457ab539 100644 --- a/src/main/java/appeng/debug/ToolReplicatorCard.java +++ b/src/main/java/appeng/debug/ToolReplicatorCard.java @@ -23,7 +23,6 @@ import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.command.ICommandSender; 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.EnumActionResult; @@ -47,7 +46,7 @@ import appeng.util.Platform; public class ToolReplicatorCard extends AEBaseItem { @Override - public EnumActionResult onItemUseFirst( final ItemStack heldItem, final EntityPlayer player, final World world, final BlockPos pos, final EnumFacing side, final float hitX, final float hitY, final float hitZ, final EnumHand hand ) + public EnumActionResult onItemUseFirst( final EntityPlayer player, final World world, final BlockPos pos, final EnumFacing side, final float hitX, final float hitY, final float hitZ, final EnumHand hand ) { if( Platform.isClient() ) { @@ -68,7 +67,7 @@ public class ToolReplicatorCard extends AEBaseItem tag.setInteger( "z", z ); tag.setInteger( "side", side.ordinal() ); tag.setInteger( "dimid", world.provider.getDimension() ); - heldItem.setTagCompound( tag ); + player.getHeldItemMainhand().setTagCompound( tag ); } else { @@ -77,7 +76,7 @@ public class ToolReplicatorCard extends AEBaseItem } else { - final NBTTagCompound ish = heldItem.getTagCompound(); + final NBTTagCompound ish = player.getHeldItemMainhand().getTagCompound(); if( ish != null ) { final int src_x = ish.getInteger( "x" ); @@ -178,6 +177,6 @@ public class ToolReplicatorCard extends AEBaseItem private void outputMsg( final ICommandSender player, final String string ) { - player.addChatMessage( new TextComponentString( string ) ); + player.sendMessage( new TextComponentString( string ) ); } } diff --git a/src/main/java/appeng/decorative/solid/BlockChargedQuartzOre.java b/src/main/java/appeng/decorative/solid/BlockChargedQuartzOre.java index 4f65eba8e..f243f6ecf 100644 --- a/src/main/java/appeng/decorative/solid/BlockChargedQuartzOre.java +++ b/src/main/java/appeng/decorative/solid/BlockChargedQuartzOre.java @@ -33,7 +33,7 @@ import appeng.api.AEApi; import appeng.api.exceptions.MissingDefinition; import appeng.client.render.effects.ChargedOreFX; import appeng.core.AEConfig; -import appeng.core.CommonHelper; +import appeng.core.AppEng; public final class BlockChargedQuartzOre extends BlockQuartzOre @@ -98,7 +98,7 @@ public final class BlockChargedQuartzOre extends BlockQuartzOre break; } - if( CommonHelper.proxy.shouldAddParticles( r ) ) + if( AppEng.proxy.shouldAddParticles( r ) ) { final ChargedOreFX fx = new ChargedOreFX( w, pos.getX() + xOff, pos.getY() + yOff, pos.getZ() + zOff, 0.0f, 0.0f, 0.0f ); Minecraft.getMinecraft().effectRenderer.addEffect( fx ); diff --git a/src/main/java/appeng/decorative/solid/BlockQuartzLamp.java b/src/main/java/appeng/decorative/solid/BlockQuartzLamp.java index c04f34363..5c13093f5 100644 --- a/src/main/java/appeng/decorative/solid/BlockQuartzLamp.java +++ b/src/main/java/appeng/decorative/solid/BlockQuartzLamp.java @@ -30,7 +30,7 @@ import net.minecraftforge.fml.relauncher.SideOnly; import appeng.client.render.effects.VibrantFX; import appeng.core.AEConfig; -import appeng.core.CommonHelper; +import appeng.core.AppEng; public class BlockQuartzLamp extends BlockQuartzGlass @@ -50,7 +50,7 @@ public class BlockQuartzLamp extends BlockQuartzGlass return; } - if( CommonHelper.proxy.shouldAddParticles( r ) ) + if( AppEng.proxy.shouldAddParticles( r ) ) { final double d0 = ( r.nextFloat() - 0.5F ) * 0.96D; final double d1 = ( r.nextFloat() - 0.5F ) * 0.96D; diff --git a/src/main/java/appeng/decorative/solid/BlockQuartzOre.java b/src/main/java/appeng/decorative/solid/BlockQuartzOre.java index 1f5594a81..6daf91bc2 100644 --- a/src/main/java/appeng/decorative/solid/BlockQuartzOre.java +++ b/src/main/java/appeng/decorative/solid/BlockQuartzOre.java @@ -104,7 +104,7 @@ public class BlockQuartzOre extends AEBaseBlock if( this.getItemDropped( state, w.rand, fortune ) != Item.getItemFromBlock( this ) ) { - final int xp = MathHelper.getRandomIntegerInRange( w.rand, 2, 5 ); + final int xp = MathHelper.getInt( w.rand, 2, 5 ); this.dropXpOnBlockBreak( w, pos, xp ); } diff --git a/src/main/java/appeng/decorative/solid/BlockSkyStone.java b/src/main/java/appeng/decorative/solid/BlockSkyStone.java index 3ada66025..d5697a9a2 100644 --- a/src/main/java/appeng/decorative/solid/BlockSkyStone.java +++ b/src/main/java/appeng/decorative/solid/BlockSkyStone.java @@ -66,7 +66,7 @@ public class BlockSkyStone extends AEBaseBlock if( is != null && is.getItem() != null ) { - level = is.getItem().getHarvestLevel( is, "pickaxe" ); + level = is.getItem().getHarvestLevel( is, "pickaxe", event.getEntityPlayer(), event.getState() ); } if( this.type != SkystoneType.STONE || level >= 3 || event.getOriginalSpeed() > BREAK_SPEAK_THRESHOLD ) diff --git a/src/main/java/appeng/entity/AEBaseEntityItem.java b/src/main/java/appeng/entity/AEBaseEntityItem.java index cc3db0214..aee25d2d1 100644 --- a/src/main/java/appeng/entity/AEBaseEntityItem.java +++ b/src/main/java/appeng/entity/AEBaseEntityItem.java @@ -43,6 +43,6 @@ public abstract class AEBaseEntityItem extends EntityItem @SuppressWarnings( "unchecked" ) protected List getCheckedEntitiesWithinAABBExcludingEntity( final AxisAlignedBB region ) { - return this.worldObj.getEntitiesWithinAABBExcludingEntity( this, region ); + return this.world.getEntitiesWithinAABBExcludingEntity( this, region ); } } diff --git a/src/main/java/appeng/entity/EntityChargedQuartz.java b/src/main/java/appeng/entity/EntityChargedQuartz.java index a2dbc291b..b0d3a71b9 100644 --- a/src/main/java/appeng/entity/EntityChargedQuartz.java +++ b/src/main/java/appeng/entity/EntityChargedQuartz.java @@ -36,7 +36,7 @@ import appeng.api.AEApi; import appeng.api.definitions.IMaterials; import appeng.client.EffectType; import appeng.core.AEConfig; -import appeng.core.CommonHelper; +import appeng.core.AppEng; import appeng.core.features.AEFeature; import appeng.helpers.Reflected; import appeng.util.Platform; @@ -71,17 +71,17 @@ public final class EntityChargedQuartz extends AEBaseEntityItem if( Platform.isClient() && this.delay > 30 && AEConfig.instance().isEnableEffects() ) { - CommonHelper.proxy.spawnEffect( EffectType.Lightning, this.worldObj, this.posX, this.posY, this.posZ, null ); + AppEng.proxy.spawnEffect( EffectType.Lightning, this.world, this.posX, this.posY, this.posZ, null ); this.delay = 0; } this.delay++; - final int j = MathHelper.floor_double( this.posX ); - final int i = MathHelper.floor_double( ( this.getEntityBoundingBox().minY + this.getEntityBoundingBox().maxY ) / 2.0D ); - final int k = MathHelper.floor_double( this.posZ ); + final int j = MathHelper.floor( this.posX ); + final int i = MathHelper.floor( (this.getEntityBoundingBox().minY + this.getEntityBoundingBox().maxY) / 2.0D ); + final int k = MathHelper.floor( this.posZ ); - IBlockState state = this.worldObj.getBlockState( new BlockPos( j, i, k ) ); + IBlockState state = this.world.getBlockState( new BlockPos( j, i, k ) ); final Material mat = state.getBlock().getMaterial( state ); if( Platform.isServer() && mat.isLiquid() ) @@ -119,7 +119,7 @@ public final class EntityChargedQuartz extends AEBaseEntityItem if( e instanceof EntityItem && !e.isDead ) { final ItemStack other = ( (EntityItem) e ).getEntityItem(); - if( other != null && other.stackSize > 0 ) + if( other != null && other.getCount() > 0 ) { if( Platform.itemComparisons().isEqualItem( other, new ItemStack( Items.REDSTONE ) ) ) { @@ -136,30 +136,30 @@ public final class EntityChargedQuartz extends AEBaseEntityItem if( redstone != null && netherQuartz != null ) { - this.getEntityItem().stackSize--; - redstone.getEntityItem().stackSize--; - netherQuartz.getEntityItem().stackSize--; + this.getEntityItem().grow( -1 ); + redstone.getEntityItem().grow( -1 ); + netherQuartz.getEntityItem().grow( -1 ); - if( this.getEntityItem().stackSize <= 0 ) + if( this.getEntityItem().getCount() <= 0 ) { this.setDead(); } - if( redstone.getEntityItem().stackSize <= 0 ) + if( redstone.getEntityItem().getCount() <= 0 ) { redstone.setDead(); } - if( netherQuartz.getEntityItem().stackSize <= 0 ) + if( netherQuartz.getEntityItem().getCount() <= 0 ) { netherQuartz.setDead(); } materials.fluixCrystal().maybeStack( 2 ).ifPresent( is -> { - final EntityItem entity = new EntityItem( this.worldObj, this.posX, this.posY, this.posZ, is ); + final EntityItem entity = new EntityItem( this.world, this.posX, this.posY, this.posZ, is ); - this.worldObj.spawnEntityInWorld( entity ); + this.world.spawnEntity( entity ); } ); return true; diff --git a/src/main/java/appeng/entity/EntityGrowingCrystal.java b/src/main/java/appeng/entity/EntityGrowingCrystal.java index 3bfad4336..f02a75ffa 100644 --- a/src/main/java/appeng/entity/EntityGrowingCrystal.java +++ b/src/main/java/appeng/entity/EntityGrowingCrystal.java @@ -33,7 +33,7 @@ import appeng.api.implementations.items.IGrowableCrystal; import appeng.api.implementations.tiles.ICrystalGrowthAccelerator; import appeng.client.EffectType; import appeng.core.AEConfig; -import appeng.core.CommonHelper; +import appeng.core.AppEng; import appeng.core.features.AEFeature; import appeng.util.Platform; @@ -69,11 +69,11 @@ public final class EntityGrowingCrystal extends EntityItem if( gc instanceof IGrowableCrystal ) // if it changes this just stops being an issue... { - final int j = MathHelper.floor_double( this.posX ); - final int i = MathHelper.floor_double( (this.getEntityBoundingBox().minY + this.getEntityBoundingBox().maxY) / 2.0D ); - final int k = MathHelper.floor_double( this.posZ ); + final int j = MathHelper.floor( this.posX ); + final int i = MathHelper.floor( (this.getEntityBoundingBox().minY + this.getEntityBoundingBox().maxY) / 2.0D ); + final int k = MathHelper.floor( this.posZ ); - final IBlockState state = this.worldObj.getBlockState( new BlockPos( j, i, k ) ); + final IBlockState state = this.world.getBlockState( new BlockPos( j, i, k ) ); final Material mat = state.getMaterial(); final IGrowableCrystal cry = (IGrowableCrystal) is.getItem(); @@ -135,7 +135,7 @@ public final class EntityGrowingCrystal extends EntityItem if( this.progress_1000 >= len ) { this.progress_1000 = 0; - CommonHelper.proxy.spawnEffect( EffectType.Vibrant, this.worldObj, this.posX, this.posY + 0.2, this.posZ, null ); + AppEng.proxy.spawnEffect( EffectType.Vibrant, this.world, this.posX, this.posY + 0.2, this.posZ, null ); } } else @@ -191,7 +191,7 @@ public final class EntityGrowingCrystal extends EntityItem private boolean isAccelerated( final int x, final int y, final int z ) { - final TileEntity te = this.worldObj.getTileEntity( new BlockPos( x, y, z ) ); + final TileEntity te = this.world.getTileEntity( new BlockPos( x, y, z ) ); return te instanceof ICrystalGrowthAccelerator && ( (ICrystalGrowthAccelerator) te ).isPowered(); } diff --git a/src/main/java/appeng/entity/EntitySingularity.java b/src/main/java/appeng/entity/EntitySingularity.java index 36eb8dcc9..dad351524 100644 --- a/src/main/java/appeng/entity/EntitySingularity.java +++ b/src/main/java/appeng/entity/EntitySingularity.java @@ -120,10 +120,10 @@ public final class EntitySingularity extends AEBaseEntityItem if( matches ) { - while( item.stackSize > 0 && other.stackSize > 0 ) + while( item.getCount() > 0 && other.getCount() > 0 ) { - other.stackSize--; - if( other.stackSize == 0 ) + other.grow( -1 );; + if( other.getCount() == 0 ) { e.setDead(); } @@ -133,14 +133,14 @@ public final class EntitySingularity extends AEBaseEntityItem final NBTTagCompound cmp = Platform.openNbtData( singularityStack ); cmp.setLong( "freq", ( new Date() ).getTime() * 100 + ( randTickSeed ) % 100 ); randTickSeed++; - item.stackSize--; + item.grow( -1 ); - final EntitySingularity entity = new EntitySingularity( this.worldObj, this.posX, this.posY, this.posZ, singularityStack ); - this.worldObj.spawnEntityInWorld( entity ); + final EntitySingularity entity = new EntitySingularity( this.world, this.posX, this.posY, this.posZ, singularityStack ); + this.world.spawnEntity( entity ); } ); } - if( item.stackSize <= 0 ) + if( item.getCount() <= 0 ) { this.setDead(); } diff --git a/src/main/java/appeng/entity/EntityTinyTNTPrimed.java b/src/main/java/appeng/entity/EntityTinyTNTPrimed.java index 81a58c695..a6f46a64d 100644 --- a/src/main/java/appeng/entity/EntityTinyTNTPrimed.java +++ b/src/main/java/appeng/entity/EntityTinyTNTPrimed.java @@ -26,6 +26,7 @@ import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.MoverType; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.item.EntityTNTPrimed; import net.minecraft.init.SoundEvents; @@ -40,7 +41,7 @@ import net.minecraftforge.fml.common.registry.IEntityAdditionalSpawnData; import appeng.api.AEApi; import appeng.core.AEConfig; -import appeng.core.CommonHelper; +import appeng.core.AppEng; import appeng.core.features.AEFeature; import appeng.core.sync.packets.PacketMockExplosion; import appeng.helpers.Reflected; @@ -78,7 +79,7 @@ public final class EntityTinyTNTPrimed extends EntityTNTPrimed implements IEntit this.prevPosY = this.posY; this.prevPosZ = this.posZ; this.motionY -= 0.03999999910593033D; - this.moveEntity( this.motionX, this.motionY, this.motionZ ); + this.move( MoverType.SELF, this.motionX, this.motionY, this.motionZ ); this.motionX *= 0.9800000190734863D; this.motionY *= 0.9800000190734863D; this.motionZ *= 0.9800000190734863D; @@ -93,7 +94,7 @@ public final class EntityTinyTNTPrimed extends EntityTNTPrimed implements IEntit if( this.isInWater() && Platform.isServer() ) // put out the fuse. { AEApi.instance().definitions().blocks().tinyTNT().maybeStack( 1 ).ifPresent( tntStack -> { - final EntityItem item = new EntityItem( this.worldObj, this.posX, this.posY, this.posZ, tntStack ); + final EntityItem item = new EntityItem( this.world, this.posX, this.posY, this.posZ, tntStack ); item.motionX = this.motionX; item.motionY = this.motionY; @@ -102,7 +103,7 @@ public final class EntityTinyTNTPrimed extends EntityTNTPrimed implements IEntit item.prevPosY = this.prevPosY; item.prevPosZ = this.prevPosZ; - this.worldObj.spawnEntityInWorld( item ); + this.world.spawnEntity( item ); this.setDead(); } ); } @@ -111,14 +112,14 @@ public final class EntityTinyTNTPrimed extends EntityTNTPrimed implements IEntit { this.setDead(); - if( !this.worldObj.isRemote ) + if( !this.world.isRemote ) { this.explode(); } } else { - this.worldObj.spawnParticle( EnumParticleTypes.SMOKE_NORMAL, this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D ); + this.world.spawnParticle( EnumParticleTypes.SMOKE_NORMAL, this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D ); } this.setFuse( getFuse() - 1 ); } @@ -126,14 +127,14 @@ public final class EntityTinyTNTPrimed extends EntityTNTPrimed implements IEntit // override :P void explode() { - this.worldObj.playSound( null, this.posX, this.posY, this.posZ, SoundEvents.ENTITY_GENERIC_EXPLODE, SoundCategory.BLOCKS, 4.0F, ( 1.0F + ( this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat() ) * 0.2F ) * 32.9F ); + this.world.playSound( null, this.posX, this.posY, this.posZ, SoundEvents.ENTITY_GENERIC_EXPLODE, SoundCategory.BLOCKS, 4.0F, ( 1.0F + ( this.world.rand.nextFloat() - this.world.rand.nextFloat() ) * 0.2F ) * 32.9F ); if( this.isInWater() ) { return; } - for( final Object e : this.worldObj.getEntitiesWithinAABBExcludingEntity( this, new AxisAlignedBB( this.posX - 1.5, this.posY - 1.5f, this.posZ - 1.5, this.posX + 1.5, this.posY + 1.5, this.posZ + 1.5 ) ) ) + for( final Object e : this.world.getEntitiesWithinAABBExcludingEntity( this, new AxisAlignedBB( this.posX - 1.5, this.posY - 1.5f, this.posZ - 1.5, this.posX + 1.5, this.posY + 1.5, this.posZ + 1.5 ) ) ) { if( e instanceof Entity ) { @@ -144,7 +145,7 @@ public final class EntityTinyTNTPrimed extends EntityTNTPrimed implements IEntit if( AEConfig.instance().isFeatureEnabled( AEFeature.TINY_TNT_BLOCK_DAMAGE ) ) { this.posY -= 0.25; - final Explosion ex = new Explosion( this.worldObj, this, this.posX, this.posY, this.posZ, 0.2f, false, false ); + final Explosion ex = new Explosion( this.world, this, this.posX, this.posY, this.posZ, 0.2f, false, false ); for( int x = (int) ( this.posX - 2 ); x <= this.posX + 2; x++ ) { @@ -153,13 +154,13 @@ public final class EntityTinyTNTPrimed extends EntityTNTPrimed implements IEntit for( int z = (int) ( this.posZ - 2 ); z <= this.posZ + 2; z++ ) { final BlockPos point = new BlockPos( x, y, z ); - final IBlockState state = this.worldObj.getBlockState( point ); + final IBlockState state = this.world.getBlockState( point ); final Block block = state.getBlock(); - if( block != null && !block.isAir( state, this.worldObj, point ) ) + if( block != null && !block.isAir( state, this.world, point ) ) { float strength = (float) ( 2.3f - ( ( ( x + 0.5f ) - this.posX ) * ( ( x + 0.5f ) - this.posX ) + ( ( y + 0.5f ) - this.posY ) * ( ( y + 0.5f ) - this.posY ) + ( ( z + 0.5f ) - this.posZ ) * ( ( z + 0.5f ) - this.posZ ) ) ); - final float resistance = block.getExplosionResistance( this.worldObj, point, this, ex ); + final float resistance = block.getExplosionResistance( this.world, point, this, ex ); strength -= ( resistance + 0.3F ) * 0.11f; if( strength > 0.01 ) @@ -168,10 +169,10 @@ public final class EntityTinyTNTPrimed extends EntityTNTPrimed implements IEntit { if( block.canDropFromExplosion( ex ) ) { - block.dropBlockAsItemWithChance( this.worldObj, point, state, 1.0F / 1.0f, 0 ); + block.dropBlockAsItemWithChance( this.world, point, state, 1.0F / 1.0f, 0 ); } - block.onBlockExploded( this.worldObj, point, ex ); + block.onBlockExploded( this.world, point, ex ); } } } @@ -180,7 +181,7 @@ public final class EntityTinyTNTPrimed extends EntityTNTPrimed implements IEntit } } - CommonHelper.proxy.sendToAllNearExcept( null, this.posX, this.posY, this.posZ, 64, this.worldObj, new PacketMockExplosion( this.posX, this.posY, this.posZ ) ); + AppEng.proxy.sendToAllNearExcept( null, this.posX, this.posY, this.posZ, 64, this.world, new PacketMockExplosion( this.posX, this.posY, this.posZ ) ); } @Override diff --git a/src/main/java/appeng/facade/FacadeContainer.java b/src/main/java/appeng/facade/FacadeContainer.java index 8fffeafda..f11c89f50 100644 --- a/src/main/java/appeng/facade/FacadeContainer.java +++ b/src/main/java/appeng/facade/FacadeContainer.java @@ -164,7 +164,7 @@ public class FacadeContainer implements IFacadeContainer final NBTTagCompound t = c.getCompoundTag( "facade:" + x ); if( t != null ) { - final ItemStack is = ItemStack.loadItemStackFromNBT( t ); + final ItemStack is = new ItemStack( t ); if( is != null ) { final Item i = is.getItem(); diff --git a/src/main/java/appeng/facade/FacadePart.java b/src/main/java/appeng/facade/FacadePart.java index 4a85e29d9..024b3a052 100644 --- a/src/main/java/appeng/facade/FacadePart.java +++ b/src/main/java/appeng/facade/FacadePart.java @@ -48,7 +48,7 @@ public class FacadePart implements IFacadePart, IBoxProvider throw new IllegalArgumentException( "Facade Part constructed on null item." ); } this.facade = facade.copy(); - this.facade.stackSize = 1; + this.facade.setCount( 1 ); this.side = side; } diff --git a/src/main/java/appeng/helpers/DualityInterface.java b/src/main/java/appeng/helpers/DualityInterface.java index 06c433050..9713f2485 100644 --- a/src/main/java/appeng/helpers/DualityInterface.java +++ b/src/main/java/appeng/helpers/DualityInterface.java @@ -245,7 +245,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn final NBTTagCompound c = waitingList.getCompoundTagAt( x ); if( c != null ) { - final ItemStack is = ItemStack.loadItemStackFromNBT( c ); + final ItemStack is = new ItemStack( c ); this.addToSendList( is ); } } @@ -429,10 +429,10 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn } else if( req.isSameType( Stored ) ) // same type ( qty different? )! { - if( req.getStackSize() != Stored.stackSize ) + if( req.getStackSize() != Stored.getCount() ) { this.requireWork[slot] = req.copy(); - this.requireWork[slot].setStackSize( req.getStackSize() - Stored.stackSize ); + this.requireWork[slot].setStackSize( req.getStackSize() - Stored.getCount() ); return; } } @@ -509,7 +509,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn { return true; } - return out.getStackSize() != stack.stackSize; + return out.getStackSize() != stack.getCount(); // ItemStack after = adaptor.simulateAdd( stack ); // if ( after == null ) // return true; @@ -619,15 +619,15 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn final InventoryAdaptor ad = InventoryAdaptor.getAdaptor( te, s.getOpposite() ); if( ad != null ) { - final ItemStack Result = ad.addItems( whatToSend ); + final ItemStack result = ad.addItems( whatToSend ); - if( Result == null ) + if( result == null ) { whatToSend = null; } else { - whatToSend.stackSize -= whatToSend.stackSize - Result.stackSize; + whatToSend.setCount( whatToSend.getCount() - (whatToSend.getCount() - result.getCount()) ); } if( whatToSend == null ) @@ -712,7 +712,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn // make sure strange things didn't happen... final ItemStack canExtract = adaptor.simulateRemove( (int) diff, toStore.getItemStack(), null ); - if( canExtract == null || canExtract.stackSize != diff ) + if( canExtract == null || canExtract.getCount() != diff ) { changed = true; throw new GridAccessException(); @@ -734,7 +734,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn { throw new IllegalStateException( "bad attempt at managing inventory. ( removeItems )" ); } - else if( removed.stackSize != diff ) + else if( removed.getCount() != diff ) { throw new IllegalStateException( "bad attempt at managing inventory. ( removeItems )" ); } @@ -767,7 +767,8 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn { if( this.getInstalledUpgrades( Upgrades.CRAFTING ) > 0 && itemStack != null ) { - return this.craftingTracker.handleCrafting( x, itemStack.getStackSize(), itemStack, d, this.iHost.getTileEntity().getWorld(), this.gridProxy.getGrid(), this.gridProxy.getCrafting(), this.mySource ); + return this.craftingTracker.handleCrafting( x, itemStack.getStackSize(), itemStack, d, this.iHost.getTileEntity().getWorld(), + this.gridProxy.getGrid(), this.gridProxy.getCrafting(), this.mySource ); } } catch( final GridAccessException e ) @@ -883,7 +884,8 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn final DualityInterface di = this; - return new IStorageMonitorable(){ + return new IStorageMonitorable() + { @Override public IMEMonitor getItemInventory() @@ -1274,8 +1276,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn public boolean hasCapability( Capability capabilityClass, EnumFacing facing ) { - return capabilityClass == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY - || capabilityClass == Capabilities.STORAGE_MONITORABLE_ACCESSOR; + return capabilityClass == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY || capabilityClass == Capabilities.STORAGE_MONITORABLE_ACCESSOR; } @SuppressWarnings( "unchecked" ) diff --git a/src/main/java/appeng/helpers/PatternHelper.java b/src/main/java/appeng/helpers/PatternHelper.java index 3eb2ff6d2..6d152a5ec 100644 --- a/src/main/java/appeng/helpers/PatternHelper.java +++ b/src/main/java/appeng/helpers/PatternHelper.java @@ -85,7 +85,7 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable. - */ - -package appeng.integration.modules.ic2; - - -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; - -import ic2.api.recipe.RecipeInputItemStack; - -import appeng.api.AEApi; -import appeng.api.config.TunnelType; -import appeng.api.features.IP2PTunnelRegistry; -import appeng.integration.IntegrationHelper; -import appeng.integration.abstraction.IC2PowerSink; -import appeng.integration.abstraction.IIC2; -import appeng.tile.powersink.IExternalPowerSink; - - -public class IC2Module implements IIC2 -{ - - private static final String[] IC2_CABLE_TYPES = { "copper", "glass", "gold", "iron", "tin", "detector", "splitter" }; - - public IC2Module() - { - IntegrationHelper.testClassExistence( this, ic2.api.energy.tile.IEnergyTile.class ); - IntegrationHelper.testClassExistence( this, ic2.api.item.IC2Items.class ); - IntegrationHelper.testClassExistence( this, ic2.api.recipe.Recipes.class ); - IntegrationHelper.testClassExistence( this, ic2.api.recipe.RecipeInputItemStack.class ); - } - - @Override - public void postInit() - { - final IP2PTunnelRegistry reg = AEApi.instance().registries().p2pTunnel(); - - for( String string : IC2_CABLE_TYPES ) - { - reg.addNewAttunement( this.getCable( string ), TunnelType.IC2_POWER ); - } - } - - private ItemStack getItem( final String name, String variant ) - { - return ic2.api.item.IC2Items.getItem( name, variant ); - } - - private ItemStack getCable( final String type ) - { - return this.getItem( "cable", "type:" + type ); - } - - /** - * Create an IC2 power sink for the given external sink. - */ - @Override - public IC2PowerSink createPowerSink( TileEntity tileEntity, IExternalPowerSink externalSink ) - { - return new IC2PowerSinkAdapter( tileEntity, externalSink ); - } - - @Override - public void maceratorRecipe( ItemStack in, ItemStack out ) - { - ic2.api.recipe.Recipes.macerator.addRecipe( new RecipeInputItemStack( in, in.stackSize ), null, false, out ); - } -} +///* +// * 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.ic2; +// +// +//import net.minecraft.item.ItemStack; +//import net.minecraft.tileentity.TileEntity; +// +//import ic2.api.recipe.RecipeInputItemStack; +// +//import appeng.api.AEApi; +//import appeng.api.config.TunnelType; +//import appeng.api.features.IP2PTunnelRegistry; +//import appeng.integration.IntegrationHelper; +//import appeng.integration.abstraction.IC2PowerSink; +//import appeng.integration.abstraction.IIC2; +//import appeng.tile.powersink.IExternalPowerSink; +// +// +//public class IC2Module implements IIC2 +//{ +// +// private static final String[] IC2_CABLE_TYPES = { "copper", "glass", "gold", "iron", "tin", "detector", "splitter" }; +// +// public IC2Module() +// { +// IntegrationHelper.testClassExistence( this, ic2.api.energy.tile.IEnergyTile.class ); +// IntegrationHelper.testClassExistence( this, ic2.api.item.IC2Items.class ); +// IntegrationHelper.testClassExistence( this, ic2.api.recipe.Recipes.class ); +// IntegrationHelper.testClassExistence( this, ic2.api.recipe.RecipeInputItemStack.class ); +// } +// +// @Override +// public void postInit() +// { +// final IP2PTunnelRegistry reg = AEApi.instance().registries().p2pTunnel(); +// +// for( String string : IC2_CABLE_TYPES ) +// { +// reg.addNewAttunement( this.getCable( string ), TunnelType.IC2_POWER ); +// } +// } +// +// private ItemStack getItem( final String name, String variant ) +// { +// return ic2.api.item.IC2Items.getItem( name, variant ); +// } +// +// private ItemStack getCable( final String type ) +// { +// return this.getItem( "cable", "type:" + type ); +// } +// +// /** +// * Create an IC2 power sink for the given external sink. +// */ +// @Override +// public IC2PowerSink createPowerSink( TileEntity tileEntity, IExternalPowerSink externalSink ) +// { +// return new IC2PowerSinkAdapter( tileEntity, externalSink ); +// } +// +// @Override +// public void maceratorRecipe( ItemStack in, ItemStack out ) +// { +// ic2.api.recipe.Recipes.macerator.addRecipe( new RecipeInputItemStack( in, in.stackSize ), null, false, out ); +// } +//} diff --git a/src/main/java/appeng/integration/modules/ic2/IC2PowerSinkAdapter.java b/src/main/java/appeng/integration/modules/ic2/IC2PowerSinkAdapter.java index ec4dc0d19..289bd8b67 100644 --- a/src/main/java/appeng/integration/modules/ic2/IC2PowerSinkAdapter.java +++ b/src/main/java/appeng/integration/modules/ic2/IC2PowerSinkAdapter.java @@ -1,94 +1,94 @@ -/* - * 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.ic2; - - -import java.util.EnumSet; -import java.util.Set; - -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumFacing; - -import ic2.api.energy.prefab.BasicSink; -import ic2.api.energy.tile.IEnergyEmitter; - -import appeng.api.config.PowerUnits; -import appeng.integration.abstraction.IC2PowerSink; -import appeng.tile.powersink.IExternalPowerSink; - - -/** - * The real implementation of IC2PowerSink. - */ -public class IC2PowerSinkAdapter extends BasicSink implements IC2PowerSink -{ - - private final IExternalPowerSink powerSink; - - private final Set validFaces = EnumSet.allOf( EnumFacing.class ); - - public IC2PowerSinkAdapter( TileEntity tileEntity, IExternalPowerSink powerSink ) - { - super( tileEntity, 0, Integer.MAX_VALUE ); - this.powerSink = powerSink; - } - - @Override - public void invalidate() - { - super.onChunkUnload(); - } - - @Override - public void onChunkUnload() - { - super.onChunkUnload(); - } - - @Override - public void onLoad() - { - super.onLoaded(); - } - - @Override - public double getDemandedEnergy() - { - return powerSink.getExternalPowerDemand( PowerUnits.EU, Double.MAX_VALUE ); - } - - @Override - public double injectEnergy( EnumFacing directionFrom, double amount, double voltage ) - { - return PowerUnits.EU.convertTo( PowerUnits.AE, powerSink.injectExternalPower( PowerUnits.EU, amount ) ); - } - - @Override - public boolean acceptsEnergyFrom( IEnergyEmitter iEnergyEmitter, EnumFacing side ) - { - return validFaces.contains( side ); - } - - @Override - public void setValidFaces( Set faces ) - { - this.validFaces.clear(); - this.validFaces.addAll( faces ); - } -} +///* +// * 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.ic2; +// +// +//import java.util.EnumSet; +//import java.util.Set; +// +//import net.minecraft.tileentity.TileEntity; +//import net.minecraft.util.EnumFacing; +// +//import ic2.api.energy.prefab.BasicSink; +//import ic2.api.energy.tile.IEnergyEmitter; +// +//import appeng.api.config.PowerUnits; +//import appeng.integration.abstraction.IC2PowerSink; +//import appeng.tile.powersink.IExternalPowerSink; +// +// +///** +// * The real implementation of IC2PowerSink. +// */ +//public class IC2PowerSinkAdapter extends BasicSink implements IC2PowerSink +//{ +// +// private final IExternalPowerSink powerSink; +// +// private final Set validFaces = EnumSet.allOf( EnumFacing.class ); +// +// public IC2PowerSinkAdapter( TileEntity tileEntity, IExternalPowerSink powerSink ) +// { +// super( tileEntity, 0, Integer.MAX_VALUE ); +// this.powerSink = powerSink; +// } +// +// @Override +// public void invalidate() +// { +// super.onChunkUnload(); +// } +// +// @Override +// public void onChunkUnload() +// { +// super.onChunkUnload(); +// } +// +// @Override +// public void onLoad() +// { +// super.onLoaded(); +// } +// +// @Override +// public double getDemandedEnergy() +// { +// return powerSink.getExternalPowerDemand( PowerUnits.EU, Double.MAX_VALUE ); +// } +// +// @Override +// public double injectEnergy( EnumFacing directionFrom, double amount, double voltage ) +// { +// return PowerUnits.EU.convertTo( PowerUnits.AE, powerSink.injectExternalPower( PowerUnits.EU, amount ) ); +// } +// +// @Override +// public boolean acceptsEnergyFrom( IEnergyEmitter iEnergyEmitter, EnumFacing side ) +// { +// return validFaces.contains( side ); +// } +// +// @Override +// public void setValidFaces( Set faces ) +// { +// this.validFaces.clear(); +// this.validFaces.addAll( faces ); +// } +//} diff --git a/src/main/java/appeng/integration/modules/jei/CondenserCategory.java b/src/main/java/appeng/integration/modules/jei/CondenserCategory.java index 58499fbad..cd2d6f374 100644 --- a/src/main/java/appeng/integration/modules/jei/CondenserCategory.java +++ b/src/main/java/appeng/integration/modules/jei/CondenserCategory.java @@ -92,15 +92,10 @@ class CondenserCategory extends BlankRecipeCategory return background; } - @Override - public void drawAnimations( Minecraft minecraft ) - { - progress.draw( minecraft ); - } - @Override public void drawExtras( Minecraft minecraft ) { + progress.draw( minecraft ); iconTrash.draw( minecraft ); iconButton.draw( minecraft ); } diff --git a/src/main/java/appeng/integration/modules/jei/CondenserOutputHandler.java b/src/main/java/appeng/integration/modules/jei/CondenserOutputHandler.java index a96803198..8f63fa901 100644 --- a/src/main/java/appeng/integration/modules/jei/CondenserOutputHandler.java +++ b/src/main/java/appeng/integration/modules/jei/CondenserOutputHandler.java @@ -55,12 +55,6 @@ class CondenserOutputHandler implements IRecipeHandler return CondenserOutput.class; } - @Override - public String getRecipeCategoryUid() - { - return CondenserCategory.UID; - } - @Override public String getRecipeCategoryUid( CondenserOutput recipe ) { diff --git a/src/main/java/appeng/integration/modules/jei/FacadeRegistryPlugin.java b/src/main/java/appeng/integration/modules/jei/FacadeRegistryPlugin.java index 98d24c55b..9b588952f 100644 --- a/src/main/java/appeng/integration/modules/jei/FacadeRegistryPlugin.java +++ b/src/main/java/appeng/integration/modules/jei/FacadeRegistryPlugin.java @@ -110,4 +110,10 @@ class FacadeRegistryPlugin implements IRecipeRegistryPlugin return Collections.emptyList(); } + + @Override + public List getRecipeWrappers( IRecipeCategory recipeCategory ) + { + return Collections.emptyList(); + } } diff --git a/src/main/java/appeng/integration/modules/jei/GrinderRecipeHandler.java b/src/main/java/appeng/integration/modules/jei/GrinderRecipeHandler.java index 8b499e4bf..4d6e3b8ec 100644 --- a/src/main/java/appeng/integration/modules/jei/GrinderRecipeHandler.java +++ b/src/main/java/appeng/integration/modules/jei/GrinderRecipeHandler.java @@ -34,13 +34,6 @@ class GrinderRecipeHandler implements IRecipeHandler return IGrinderRecipe.class; } - @Override - public String getRecipeCategoryUid() - { - return GrinderRecipeCategory.UID; - } - - @Override public String getRecipeCategoryUid( IGrinderRecipe recipe ) { return GrinderRecipeCategory.UID; diff --git a/src/main/java/appeng/integration/modules/jei/InscriberRecipeCategory.java b/src/main/java/appeng/integration/modules/jei/InscriberRecipeCategory.java index 71fed2568..dd983989f 100644 --- a/src/main/java/appeng/integration/modules/jei/InscriberRecipeCategory.java +++ b/src/main/java/appeng/integration/modules/jei/InscriberRecipeCategory.java @@ -80,7 +80,7 @@ class InscriberRecipeCategory extends BlankRecipeCategory return IInscriberRecipe.class; } - @Override - public String getRecipeCategoryUid() - { - return InscriberRecipeCategory.UID; - } - @Override public String getRecipeCategoryUid( IInscriberRecipe recipe ) { diff --git a/src/main/java/appeng/integration/modules/jei/InscriberRegistryPlugin.java b/src/main/java/appeng/integration/modules/jei/InscriberRegistryPlugin.java index 555b97fae..13e4aa7de 100644 --- a/src/main/java/appeng/integration/modules/jei/InscriberRegistryPlugin.java +++ b/src/main/java/appeng/integration/modules/jei/InscriberRegistryPlugin.java @@ -66,4 +66,10 @@ class InscriberRegistryPlugin implements IRecipeRegistryPlugin { return null; } + + @Override + public List getRecipeWrappers( IRecipeCategory recipeCategory ) + { + return null; + } } diff --git a/src/main/java/appeng/integration/modules/jei/JEIPlugin.java b/src/main/java/appeng/integration/modules/jei/JEIPlugin.java index e0f8f2b29..614f20b1f 100644 --- a/src/main/java/appeng/integration/modules/jei/JEIPlugin.java +++ b/src/main/java/appeng/integration/modules/jei/JEIPlugin.java @@ -199,7 +199,7 @@ public class JEIPlugin extends BlankModPlugin @Override public void onRuntimeAvailable( IJeiRuntime jeiRuntime ) { - JEIModule jeiModule = (JEIModule) Integrations.jei(); - jeiModule.setJei( new JeiRuntimeAdapter( jeiRuntime ) ); + //JEIModule jeiModule = (JEIModule) Integrations.jei(); + //jeiModule.setJei( new JeiRuntimeAdapter( jeiRuntime ) ); } } diff --git a/src/main/java/appeng/integration/modules/jei/RecipeTransferHandler.java b/src/main/java/appeng/integration/modules/jei/RecipeTransferHandler.java index aacfc6bba..e870169e5 100644 --- a/src/main/java/appeng/integration/modules/jei/RecipeTransferHandler.java +++ b/src/main/java/appeng/integration/modules/jei/RecipeTransferHandler.java @@ -35,7 +35,6 @@ import net.minecraft.nbt.NBTTagList; import mezz.jei.api.gui.IGuiIngredient; import mezz.jei.api.gui.IRecipeLayout; -import mezz.jei.api.recipe.VanillaRecipeCategoryUid; import mezz.jei.api.recipe.transfer.IRecipeTransferError; import mezz.jei.api.recipe.transfer.IRecipeTransferHandler; @@ -63,12 +62,6 @@ class RecipeTransferHandler implements IRecipeTransferHandl return containerClass; } - @Override - public String getRecipeCategoryUid() - { - return VanillaRecipeCategoryUid.CRAFTING; - } - @Nullable @Override public IRecipeTransferError transferRecipe( T container, IRecipeLayout recipeLayout, EntityPlayer player, boolean maxTransfer, boolean doTransfer ) diff --git a/src/main/java/appeng/integration/modules/jei/ShapedRecipeHandler.java b/src/main/java/appeng/integration/modules/jei/ShapedRecipeHandler.java index fbf5050d6..4cd9ecf9a 100644 --- a/src/main/java/appeng/integration/modules/jei/ShapedRecipeHandler.java +++ b/src/main/java/appeng/integration/modules/jei/ShapedRecipeHandler.java @@ -35,12 +35,6 @@ class ShapedRecipeHandler implements IRecipeHandler return ShapedRecipe.class; } - @Override - public String getRecipeCategoryUid() - { - return VanillaRecipeCategoryUid.CRAFTING; - } - @Override public String getRecipeCategoryUid( ShapedRecipe recipe ) { diff --git a/src/main/java/appeng/integration/modules/jei/ShapelessRecipeHandler.java b/src/main/java/appeng/integration/modules/jei/ShapelessRecipeHandler.java index 9631ca97b..99e383a31 100644 --- a/src/main/java/appeng/integration/modules/jei/ShapelessRecipeHandler.java +++ b/src/main/java/appeng/integration/modules/jei/ShapelessRecipeHandler.java @@ -35,12 +35,6 @@ class ShapelessRecipeHandler implements IRecipeHandler return ShapelessRecipe.class; } - @Override - public String getRecipeCategoryUid() - { - return VanillaRecipeCategoryUid.CRAFTING; - } - @Override public String getRecipeCategoryUid( ShapelessRecipe recipe ) { diff --git a/src/main/java/appeng/integration/modules/waila/BaseWailaDataProvider.java b/src/main/java/appeng/integration/modules/waila/BaseWailaDataProvider.java index 3353c5201..842d006b9 100644 --- a/src/main/java/appeng/integration/modules/waila/BaseWailaDataProvider.java +++ b/src/main/java/appeng/integration/modules/waila/BaseWailaDataProvider.java @@ -1,74 +1,74 @@ -/* - * 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.util.math.BlockPos; -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( final IWailaDataAccessor accessor, final IWailaConfigHandler config ) - { - return null; - } - - @Override - public List getWailaHead( final ItemStack itemStack, final List currentToolTip, final IWailaDataAccessor accessor, final IWailaConfigHandler config ) - { - return currentToolTip; - } - - @Override - public List getWailaBody( final ItemStack itemStack, final List currentToolTip, final IWailaDataAccessor accessor, final IWailaConfigHandler config ) - { - return currentToolTip; - } - - @Override - public List getWailaTail( final ItemStack itemStack, final List currentToolTip, final IWailaDataAccessor accessor, final IWailaConfigHandler config ) - { - return currentToolTip; - } - - @Override - public NBTTagCompound getNBTData( EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, BlockPos pos ) - { - return tag; - } -} +///* +// * 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.util.math.BlockPos; +//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( final IWailaDataAccessor accessor, final IWailaConfigHandler config ) +// { +// return null; +// } +// +// @Override +// public List getWailaHead( final ItemStack itemStack, final List currentToolTip, final IWailaDataAccessor accessor, final IWailaConfigHandler config ) +// { +// return currentToolTip; +// } +// +// @Override +// public List getWailaBody( final ItemStack itemStack, final List currentToolTip, final IWailaDataAccessor accessor, final IWailaConfigHandler config ) +// { +// return currentToolTip; +// } +// +// @Override +// public List getWailaTail( final ItemStack itemStack, final List currentToolTip, final IWailaDataAccessor accessor, final IWailaConfigHandler config ) +// { +// return currentToolTip; +// } +// +// @Override +// public NBTTagCompound getNBTData( EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, BlockPos pos ) +// { +// return tag; +// } +//} diff --git a/src/main/java/appeng/integration/modules/waila/PartWailaDataProvider.java b/src/main/java/appeng/integration/modules/waila/PartWailaDataProvider.java index 4d55dccc7..9937b1fd0 100644 --- a/src/main/java/appeng/integration/modules/waila/PartWailaDataProvider.java +++ b/src/main/java/appeng/integration/modules/waila/PartWailaDataProvider.java @@ -1,198 +1,198 @@ -/* - * 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 java.util.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.math.BlockPos; -import net.minecraft.util.math.RayTraceResult; -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.P2PStateWailaDataProvider; -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 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 p2pState = new P2PStateWailaDataProvider(); - final IPartWailaDataProvider partStack = new PartStackWailaDataProvider(); - - this.providers = Lists.newArrayList( channel, storageMonitor, powerState, partStack, p2pState ); - } - - @Override - public ItemStack getWailaStack( final IWailaDataAccessor accessor, final IWailaConfigHandler config ) - { - final TileEntity te = accessor.getTileEntity(); - final RayTraceResult mop = accessor.getMOP(); - - - final Optional maybePart = this.accessor.getMaybePart( te, mop ); - - if( maybePart.isPresent() ) - { - final IPart part = maybePart.get(); - - ItemStack wailaStack = null; - - for( final IPartWailaDataProvider provider : this.providers ) - { - wailaStack = provider.getWailaStack( part, config, wailaStack ); - } - return wailaStack; - } - - return null; - } - - @Override - public List getWailaHead( final ItemStack itemStack, final List currentToolTip, final IWailaDataAccessor accessor, final IWailaConfigHandler config ) - { - final TileEntity te = accessor.getTileEntity(); - final RayTraceResult mop = accessor.getMOP(); - - final Optional maybePart = this.accessor.getMaybePart( te, mop ); - - if( maybePart.isPresent() ) - { - final IPart part = maybePart.get(); - - for( final IPartWailaDataProvider provider : this.providers ) - { - provider.getWailaHead( part, currentToolTip, accessor, config ); - } - } - - return currentToolTip; - } - - @Override - public List getWailaBody( final ItemStack itemStack, final List currentToolTip, final IWailaDataAccessor accessor, final IWailaConfigHandler config ) - { - final TileEntity te = accessor.getTileEntity(); - final RayTraceResult mop = accessor.getMOP(); - - final Optional maybePart = this.accessor.getMaybePart( te, mop ); - - if( maybePart.isPresent() ) - { - final IPart part = maybePart.get(); - - for( final IPartWailaDataProvider provider : this.providers ) - { - provider.getWailaBody( part, currentToolTip, accessor, config ); - } - } - - return currentToolTip; - } - - @Override - public List getWailaTail( final ItemStack itemStack, final List currentToolTip, final IWailaDataAccessor accessor, final IWailaConfigHandler config ) - { - final TileEntity te = accessor.getTileEntity(); - final RayTraceResult mop = accessor.getMOP(); - - final Optional maybePart = this.accessor.getMaybePart( te, mop ); - - if( maybePart.isPresent() ) - { - final IPart part = maybePart.get(); - - for( final IPartWailaDataProvider provider : this.providers ) - { - provider.getWailaTail( part, currentToolTip, accessor, config ); - } - } - - return currentToolTip; - } - - @Override - public NBTTagCompound getNBTData( final EntityPlayerMP player, final TileEntity te, final NBTTagCompound tag, final World world, BlockPos pos ) - { - final RayTraceResult mop = this.tracer.retraceBlock( world, player, pos ); - - if( mop != null ) - { - final Optional maybePart = this.accessor.getMaybePart( te, mop ); - - if( maybePart.isPresent() ) - { - final IPart part = maybePart.get(); - - for( final IPartWailaDataProvider provider : this.providers ) - { - provider.getNBTData( player, part, te, tag, world, pos ); - } - } - } - - return tag; - } -} +///* +// * 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 java.util.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.math.BlockPos; +//import net.minecraft.util.math.RayTraceResult; +//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.P2PStateWailaDataProvider; +//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 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 p2pState = new P2PStateWailaDataProvider(); +// final IPartWailaDataProvider partStack = new PartStackWailaDataProvider(); +// +// this.providers = Lists.newArrayList( channel, storageMonitor, powerState, partStack, p2pState ); +// } +// +// @Override +// public ItemStack getWailaStack( final IWailaDataAccessor accessor, final IWailaConfigHandler config ) +// { +// final TileEntity te = accessor.getTileEntity(); +// final RayTraceResult mop = accessor.getMOP(); +// +// +// final Optional maybePart = this.accessor.getMaybePart( te, mop ); +// +// if( maybePart.isPresent() ) +// { +// final IPart part = maybePart.get(); +// +// ItemStack wailaStack = null; +// +// for( final IPartWailaDataProvider provider : this.providers ) +// { +// wailaStack = provider.getWailaStack( part, config, wailaStack ); +// } +// return wailaStack; +// } +// +// return null; +// } +// +// @Override +// public List getWailaHead( final ItemStack itemStack, final List currentToolTip, final IWailaDataAccessor accessor, final IWailaConfigHandler config ) +// { +// final TileEntity te = accessor.getTileEntity(); +// final RayTraceResult mop = accessor.getMOP(); +// +// final Optional maybePart = this.accessor.getMaybePart( te, mop ); +// +// if( maybePart.isPresent() ) +// { +// final IPart part = maybePart.get(); +// +// for( final IPartWailaDataProvider provider : this.providers ) +// { +// provider.getWailaHead( part, currentToolTip, accessor, config ); +// } +// } +// +// return currentToolTip; +// } +// +// @Override +// public List getWailaBody( final ItemStack itemStack, final List currentToolTip, final IWailaDataAccessor accessor, final IWailaConfigHandler config ) +// { +// final TileEntity te = accessor.getTileEntity(); +// final RayTraceResult mop = accessor.getMOP(); +// +// final Optional maybePart = this.accessor.getMaybePart( te, mop ); +// +// if( maybePart.isPresent() ) +// { +// final IPart part = maybePart.get(); +// +// for( final IPartWailaDataProvider provider : this.providers ) +// { +// provider.getWailaBody( part, currentToolTip, accessor, config ); +// } +// } +// +// return currentToolTip; +// } +// +// @Override +// public List getWailaTail( final ItemStack itemStack, final List currentToolTip, final IWailaDataAccessor accessor, final IWailaConfigHandler config ) +// { +// final TileEntity te = accessor.getTileEntity(); +// final RayTraceResult mop = accessor.getMOP(); +// +// final Optional maybePart = this.accessor.getMaybePart( te, mop ); +// +// if( maybePart.isPresent() ) +// { +// final IPart part = maybePart.get(); +// +// for( final IPartWailaDataProvider provider : this.providers ) +// { +// provider.getWailaTail( part, currentToolTip, accessor, config ); +// } +// } +// +// return currentToolTip; +// } +// +// @Override +// public NBTTagCompound getNBTData( final EntityPlayerMP player, final TileEntity te, final NBTTagCompound tag, final World world, BlockPos pos ) +// { +// final RayTraceResult mop = this.tracer.retraceBlock( world, player, pos ); +// +// if( mop != null ) +// { +// final Optional maybePart = this.accessor.getMaybePart( te, mop ); +// +// if( maybePart.isPresent() ) +// { +// final IPart part = maybePart.get(); +// +// for( final IPartWailaDataProvider provider : this.providers ) +// { +// provider.getNBTData( player, part, te, tag, world, pos ); +// } +// } +// } +// +// return tag; +// } +//} diff --git a/src/main/java/appeng/integration/modules/waila/TileWailaDataProvider.java b/src/main/java/appeng/integration/modules/waila/TileWailaDataProvider.java index d42ea855b..ac386f267 100644 --- a/src/main/java/appeng/integration/modules/waila/TileWailaDataProvider.java +++ b/src/main/java/appeng/integration/modules/waila/TileWailaDataProvider.java @@ -1,119 +1,119 @@ -/* - * 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.util.math.BlockPos; -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( final IWailaDataAccessor accessor, final IWailaConfigHandler config ) - { - return null; - } - - @Override - public List getWailaHead( final ItemStack itemStack, final List currentToolTip, final IWailaDataAccessor accessor, final IWailaConfigHandler config ) - { - for( final IWailaDataProvider provider : this.providers ) - { - provider.getWailaHead( itemStack, currentToolTip, accessor, config ); - } - - return currentToolTip; - } - - @Override - public List getWailaBody( final ItemStack itemStack, final List currentToolTip, final IWailaDataAccessor accessor, final IWailaConfigHandler config ) - { - for( final IWailaDataProvider provider : this.providers ) - { - provider.getWailaBody( itemStack, currentToolTip, accessor, config ); - } - - return currentToolTip; - } - - @Override - public List getWailaTail( final ItemStack itemStack, final List currentToolTip, final IWailaDataAccessor accessor, final IWailaConfigHandler config ) - { - for( final IWailaDataProvider provider : this.providers ) - { - provider.getWailaTail( itemStack, currentToolTip, accessor, config ); - } - - return currentToolTip; - } - - @Override - public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, BlockPos pos) - { - for( final IWailaDataProvider provider : this.providers ) - { - provider.getNBTData( player, te, tag, world, pos ); - } - - return tag; - } -} +///* +// * 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.util.math.BlockPos; +//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( final IWailaDataAccessor accessor, final IWailaConfigHandler config ) +// { +// return null; +// } +// +// @Override +// public List getWailaHead( final ItemStack itemStack, final List currentToolTip, final IWailaDataAccessor accessor, final IWailaConfigHandler config ) +// { +// for( final IWailaDataProvider provider : this.providers ) +// { +// provider.getWailaHead( itemStack, currentToolTip, accessor, config ); +// } +// +// return currentToolTip; +// } +// +// @Override +// public List getWailaBody( final ItemStack itemStack, final List currentToolTip, final IWailaDataAccessor accessor, final IWailaConfigHandler config ) +// { +// for( final IWailaDataProvider provider : this.providers ) +// { +// provider.getWailaBody( itemStack, currentToolTip, accessor, config ); +// } +// +// return currentToolTip; +// } +// +// @Override +// public List getWailaTail( final ItemStack itemStack, final List currentToolTip, final IWailaDataAccessor accessor, final IWailaConfigHandler config ) +// { +// for( final IWailaDataProvider provider : this.providers ) +// { +// provider.getWailaTail( itemStack, currentToolTip, accessor, config ); +// } +// +// return currentToolTip; +// } +// +// @Override +// public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, BlockPos pos) +// { +// for( final IWailaDataProvider provider : this.providers ) +// { +// provider.getNBTData( player, te, tag, world, pos ); +// } +// +// return tag; +// } +//} diff --git a/src/main/java/appeng/integration/modules/waila/WailaModule.java b/src/main/java/appeng/integration/modules/waila/WailaModule.java index 752414969..94da07c1a 100644 --- a/src/main/java/appeng/integration/modules/waila/WailaModule.java +++ b/src/main/java/appeng/integration/modules/waila/WailaModule.java @@ -1,64 +1,64 @@ -/* - * 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 net.minecraftforge.fml.common.event.FMLInterModComms; - -import mcp.mobius.waila.api.IWailaDataProvider; -import mcp.mobius.waila.api.IWailaRegistrar; - -import appeng.integration.IIntegrationModule; -import appeng.integration.IntegrationHelper; -import appeng.tile.AEBaseTile; - - -public class WailaModule implements IIntegrationModule -{ - - public WailaModule() - { - 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( final 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" ); - } - -} +///* +// * 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 net.minecraftforge.fml.common.event.FMLInterModComms; +// +//import mcp.mobius.waila.api.IWailaDataProvider; +//import mcp.mobius.waila.api.IWailaRegistrar; +// +//import appeng.integration.IIntegrationModule; +//import appeng.integration.IntegrationHelper; +//import appeng.tile.AEBaseTile; +// +// +//public class WailaModule implements IIntegrationModule +//{ +// +// public WailaModule() +// { +// 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( final 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" ); +// } +// +//} diff --git a/src/main/java/appeng/integration/modules/waila/part/BasePartWailaDataProvider.java b/src/main/java/appeng/integration/modules/waila/part/BasePartWailaDataProvider.java index 90a22908f..09aaba2ff 100644 --- a/src/main/java/appeng/integration/modules/waila/part/BasePartWailaDataProvider.java +++ b/src/main/java/appeng/integration/modules/waila/part/BasePartWailaDataProvider.java @@ -1,75 +1,75 @@ -/* - * 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.util.math.BlockPos; -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( final IPart part, final IWailaConfigHandler config, final ItemStack partStack ) - { - return null; - } - - @Override - public List getWailaHead( final IPart part, final List currentToolTip, final IWailaDataAccessor accessor, final IWailaConfigHandler config ) - { - return currentToolTip; - } - - @Override - public List getWailaBody( final IPart part, final List currentToolTip, final IWailaDataAccessor accessor, final IWailaConfigHandler config ) - { - return currentToolTip; - } - - @Override - public List getWailaTail( final IPart part, final List currentToolTip, final IWailaDataAccessor accessor, final IWailaConfigHandler config ) - { - return currentToolTip; - } - - @Override - public NBTTagCompound getNBTData( EntityPlayerMP player, IPart part, TileEntity te, NBTTagCompound tag, World world, BlockPos pos ) - { - return tag; - } -} +///* +// * 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.util.math.BlockPos; +//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( final IPart part, final IWailaConfigHandler config, final ItemStack partStack ) +// { +// return null; +// } +// +// @Override +// public List getWailaHead( final IPart part, final List currentToolTip, final IWailaDataAccessor accessor, final IWailaConfigHandler config ) +// { +// return currentToolTip; +// } +// +// @Override +// public List getWailaBody( final IPart part, final List currentToolTip, final IWailaDataAccessor accessor, final IWailaConfigHandler config ) +// { +// return currentToolTip; +// } +// +// @Override +// public List getWailaTail( final IPart part, final List currentToolTip, final IWailaDataAccessor accessor, final IWailaConfigHandler config ) +// { +// return currentToolTip; +// } +// +// @Override +// public NBTTagCompound getNBTData( EntityPlayerMP player, IPart part, TileEntity te, NBTTagCompound tag, World world, BlockPos pos ) +// { +// 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 index 6064daf44..22303f8ed 100644 --- a/src/main/java/appeng/integration/modules/waila/part/ChannelWailaDataProvider.java +++ b/src/main/java/appeng/integration/modules/waila/part/ChannelWailaDataProvider.java @@ -1,163 +1,163 @@ -/* - * 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.util.math.BlockPos; -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( final IPart part, final List currentToolTip, final IWailaDataAccessor accessor, final IWailaConfigHandler config ) - { - if( part instanceof PartCableSmart || part instanceof PartDenseCable ) - { - final NBTTagCompound tag = accessor.getNBTData(); - - final byte usedChannels = this.getUsedChannels( part, tag, this.cache ); - - if( usedChannels >= 0 ) - { - 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( final IPart part, final NBTTagCompound tag, final 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 = -1; - } - - 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 pos pos of the part - * - * @return tag send to the client - */ - @Override - public NBTTagCompound getNBTData( EntityPlayerMP player, IPart part, TileEntity te, NBTTagCompound tag, World world, BlockPos pos ) - { - 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; - } -} +///* +// * 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.util.math.BlockPos; +//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( final IPart part, final List currentToolTip, final IWailaDataAccessor accessor, final IWailaConfigHandler config ) +// { +// if( part instanceof PartCableSmart || part instanceof PartDenseCable ) +// { +// final NBTTagCompound tag = accessor.getNBTData(); +// +// final byte usedChannels = this.getUsedChannels( part, tag, this.cache ); +// +// if( usedChannels >= 0 ) +// { +// 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( final IPart part, final NBTTagCompound tag, final 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 = -1; +// } +// +// 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 pos pos of the part +// * +// * @return tag send to the client +// */ +// @Override +// public NBTTagCompound getNBTData( EntityPlayerMP player, IPart part, TileEntity te, NBTTagCompound tag, World world, BlockPos pos ) +// { +// 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 index 51126ea52..0e1d7ee76 100644 --- a/src/main/java/appeng/integration/modules/waila/part/IPartWailaDataProvider.java +++ b/src/main/java/appeng/integration/modules/waila/part/IPartWailaDataProvider.java @@ -1,56 +1,56 @@ -/* - * 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.util.math.BlockPos; -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, BlockPos pos ); -} +///* +// * 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.util.math.BlockPos; +//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, BlockPos pos ); +//} diff --git a/src/main/java/appeng/integration/modules/waila/part/P2PStateWailaDataProvider.java b/src/main/java/appeng/integration/modules/waila/part/P2PStateWailaDataProvider.java index a9e77fbd3..cf0e16239 100644 --- a/src/main/java/appeng/integration/modules/waila/part/P2PStateWailaDataProvider.java +++ b/src/main/java/appeng/integration/modules/waila/part/P2PStateWailaDataProvider.java @@ -1,158 +1,158 @@ -/* - * 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 com.google.common.collect.Iterators; - -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; - -import mcp.mobius.waila.api.IWailaConfigHandler; -import mcp.mobius.waila.api.IWailaDataAccessor; - -import appeng.api.parts.IPart; -import appeng.core.localization.WailaText; -import appeng.me.GridAccessException; -import appeng.parts.p2p.PartP2PTunnel; - - -/** - * Provides information about a P2P tunnel to WAILA. - */ -public final class P2PStateWailaDataProvider extends BasePartWailaDataProvider -{ - - private static final int STATE_UNLINKED = 0; - private static final int STATE_OUTPUT = 1; - private static final int STATE_INPUT = 2; - public static final String TAG_P2P_STATE = "p2p_state"; - - /** - * 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( final IPart part, final List currentToolTip, final IWailaDataAccessor accessor, final IWailaConfigHandler config ) - { - if( part instanceof PartP2PTunnel ) - { - NBTTagCompound nbtData = accessor.getNBTData(); - if( nbtData.hasKey( TAG_P2P_STATE ) ) - { - int[] stateArr = nbtData.getIntArray( TAG_P2P_STATE ); - if( stateArr.length == 2 ) - { - int state = stateArr[0]; - int outputs = stateArr[1]; - - switch( state ) - { - case STATE_UNLINKED: - currentToolTip.add( WailaText.P2PUnlinked.getLocal() ); - break; - case STATE_OUTPUT: - currentToolTip.add( WailaText.P2POutput.getLocal() ); - break; - case STATE_INPUT: - currentToolTip.add( getOutputText( outputs ) ); - break; - } - } - } - } - - return currentToolTip; - } - - @Override - public NBTTagCompound getNBTData( EntityPlayerMP player, IPart part, TileEntity te, NBTTagCompound tag, World world, BlockPos pos ) - { - if( part instanceof PartP2PTunnel ) - { - PartP2PTunnel tunnel = (PartP2PTunnel) part; - - // The default state - int state = STATE_UNLINKED; - int outputCount = 0; - - if( !tunnel.isOutput() ) - { - outputCount = getOutputCount( tunnel ); - if( outputCount > 0 ) - { - // Only set it to INPUT if we know there are any outputs - state = STATE_INPUT; - } - } - else - { - PartP2PTunnel input = tunnel.getInput(); - if( input != null ) - { - state = STATE_OUTPUT; - } - } - - tag.setIntArray( TAG_P2P_STATE, new int[] { - state, - outputCount - } ); - } - - return tag; - } - - private static int getOutputCount( PartP2PTunnel tunnel ) - { - try - { - return Iterators.size( tunnel.getOutputs().iterator() ); - } - catch( GridAccessException e ) - { - // Well... unknown size it is! - return 0; - } - } - - private static String getOutputText( int outputs ) - { - if( outputs <= 1 ) - { - return WailaText.P2PInputOneOutput.getLocal(); - } - else - { - return String.format( WailaText.P2PInputManyOutputs.getLocal(), outputs ); - } - } - -} +///* +// * 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 com.google.common.collect.Iterators; +// +//import net.minecraft.entity.player.EntityPlayerMP; +//import net.minecraft.nbt.NBTTagCompound; +//import net.minecraft.tileentity.TileEntity; +//import net.minecraft.util.math.BlockPos; +//import net.minecraft.world.World; +// +//import mcp.mobius.waila.api.IWailaConfigHandler; +//import mcp.mobius.waila.api.IWailaDataAccessor; +// +//import appeng.api.parts.IPart; +//import appeng.core.localization.WailaText; +//import appeng.me.GridAccessException; +//import appeng.parts.p2p.PartP2PTunnel; +// +// +///** +// * Provides information about a P2P tunnel to WAILA. +// */ +//public final class P2PStateWailaDataProvider extends BasePartWailaDataProvider +//{ +// +// private static final int STATE_UNLINKED = 0; +// private static final int STATE_OUTPUT = 1; +// private static final int STATE_INPUT = 2; +// public static final String TAG_P2P_STATE = "p2p_state"; +// +// /** +// * 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( final IPart part, final List currentToolTip, final IWailaDataAccessor accessor, final IWailaConfigHandler config ) +// { +// if( part instanceof PartP2PTunnel ) +// { +// NBTTagCompound nbtData = accessor.getNBTData(); +// if( nbtData.hasKey( TAG_P2P_STATE ) ) +// { +// int[] stateArr = nbtData.getIntArray( TAG_P2P_STATE ); +// if( stateArr.length == 2 ) +// { +// int state = stateArr[0]; +// int outputs = stateArr[1]; +// +// switch( state ) +// { +// case STATE_UNLINKED: +// currentToolTip.add( WailaText.P2PUnlinked.getLocal() ); +// break; +// case STATE_OUTPUT: +// currentToolTip.add( WailaText.P2POutput.getLocal() ); +// break; +// case STATE_INPUT: +// currentToolTip.add( getOutputText( outputs ) ); +// break; +// } +// } +// } +// } +// +// return currentToolTip; +// } +// +// @Override +// public NBTTagCompound getNBTData( EntityPlayerMP player, IPart part, TileEntity te, NBTTagCompound tag, World world, BlockPos pos ) +// { +// if( part instanceof PartP2PTunnel ) +// { +// PartP2PTunnel tunnel = (PartP2PTunnel) part; +// +// // The default state +// int state = STATE_UNLINKED; +// int outputCount = 0; +// +// if( !tunnel.isOutput() ) +// { +// outputCount = getOutputCount( tunnel ); +// if( outputCount > 0 ) +// { +// // Only set it to INPUT if we know there are any outputs +// state = STATE_INPUT; +// } +// } +// else +// { +// PartP2PTunnel input = tunnel.getInput(); +// if( input != null ) +// { +// state = STATE_OUTPUT; +// } +// } +// +// tag.setIntArray( TAG_P2P_STATE, new int[] { +// state, +// outputCount +// } ); +// } +// +// return tag; +// } +// +// private static int getOutputCount( PartP2PTunnel tunnel ) +// { +// try +// { +// return Iterators.size( tunnel.getOutputs().iterator() ); +// } +// catch( GridAccessException e ) +// { +// // Well... unknown size it is! +// return 0; +// } +// } +// +// private static String getOutputText( int outputs ) +// { +// if( outputs <= 1 ) +// { +// return WailaText.P2PInputOneOutput.getLocal(); +// } +// else +// { +// return String.format( WailaText.P2PInputManyOutputs.getLocal(), outputs ); +// } +// } +// +//} diff --git a/src/main/java/appeng/integration/modules/waila/part/PartStackWailaDataProvider.java b/src/main/java/appeng/integration/modules/waila/part/PartStackWailaDataProvider.java index 31ab7ddf6..36945ba77 100644 --- a/src/main/java/appeng/integration/modules/waila/part/PartStackWailaDataProvider.java +++ b/src/main/java/appeng/integration/modules/waila/part/PartStackWailaDataProvider.java @@ -1,47 +1,47 @@ -/* - * 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( final IPart part, final IWailaConfigHandler config, ItemStack partStack ) - { - partStack = part.getItemStack( PartItemStack.PICK ); - return partStack; - } - -} +///* +// * 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( final IPart part, final 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 index c7e3a8261..3afcac571 100644 --- a/src/main/java/appeng/integration/modules/waila/part/PowerStateWailaDataProvider.java +++ b/src/main/java/appeng/integration/modules/waila/part/PowerStateWailaDataProvider.java @@ -1,91 +1,91 @@ -/* - * 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( final IPart part, final List currentToolTip, final IWailaDataAccessor accessor, final 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( final boolean isActive, final 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; - } -} +///* +// * 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( final IPart part, final List currentToolTip, final IWailaDataAccessor accessor, final 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( final boolean isActive, final 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 index 829a9c557..817d84995 100644 --- a/src/main/java/appeng/integration/modules/waila/part/StorageMonitorWailaDataProvider.java +++ b/src/main/java/appeng/integration/modules/waila/part/StorageMonitorWailaDataProvider.java @@ -1,81 +1,81 @@ -/* - * 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( final IPart part, final List currentToolTip, final IWailaDataAccessor accessor, final 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 ) - { - final IAEItemStack ais = (IAEItemStack) displayed; - currentToolTip.add( WailaText.Showing.getLocal() + ": " + ais.getItemStack().getDisplayName() ); - } - else if( displayed instanceof IAEFluidStack ) - { - final 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; - } -} +///* +// * 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( final IPart part, final List currentToolTip, final IWailaDataAccessor accessor, final 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 ) +// { +// final IAEItemStack ais = (IAEItemStack) displayed; +// currentToolTip.add( WailaText.Showing.getLocal() + ": " + ais.getItemStack().getDisplayName() ); +// } +// else if( displayed instanceof IAEFluidStack ) +// { +// final 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 index 16c96bf1f..9cce23e65 100644 --- a/src/main/java/appeng/integration/modules/waila/part/Tracer.java +++ b/src/main/java/appeng/integration/modules/waila/part/Tracer.java @@ -72,7 +72,7 @@ public final class Tracer double y = player.posY; double z = player.posZ; - if( player.worldObj.isRemote ) + if( player.world.isRemote ) { // compatibility with eye height changing mods y += player.getEyeHeight() - player.getDefaultEyeHeight(); diff --git a/src/main/java/appeng/integration/modules/waila/tile/ChargerWailaDataProvider.java b/src/main/java/appeng/integration/modules/waila/tile/ChargerWailaDataProvider.java index ebc4339a9..d84425295 100644 --- a/src/main/java/appeng/integration/modules/waila/tile/ChargerWailaDataProvider.java +++ b/src/main/java/appeng/integration/modules/waila/tile/ChargerWailaDataProvider.java @@ -1,78 +1,78 @@ -/* - * 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( final ItemStack itemStack, final List currentToolTip, final IWailaDataAccessor accessor, final 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; - } -} +///* +// * 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( final ItemStack itemStack, final List currentToolTip, final IWailaDataAccessor accessor, final 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 index 7159cfd3d..6745d239c 100644 --- a/src/main/java/appeng/integration/modules/waila/tile/CraftingMonitorWailaDataProvider.java +++ b/src/main/java/appeng/integration/modules/waila/tile/CraftingMonitorWailaDataProvider.java @@ -1,74 +1,74 @@ -/* - * 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( final ItemStack itemStack, final List currentToolTip, final IWailaDataAccessor accessor, final 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; - } -} +///* +// * 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( final ItemStack itemStack, final List currentToolTip, final IWailaDataAccessor accessor, final 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 index cff256ddf..18963f9dc 100644 --- a/src/main/java/appeng/integration/modules/waila/tile/PowerStateWailaDataProvider.java +++ b/src/main/java/appeng/integration/modules/waila/tile/PowerStateWailaDataProvider.java @@ -1,82 +1,82 @@ -/* - * 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( final ItemStack itemStack, final List currentToolTip, final IWailaDataAccessor accessor, final 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 +///* +// * 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( final ItemStack itemStack, final List currentToolTip, final IWailaDataAccessor accessor, final 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 index 7b8942eb8..b51a9382c 100644 --- a/src/main/java/appeng/integration/modules/waila/tile/PowerStorageWailaDataProvider.java +++ b/src/main/java/appeng/integration/modules/waila/tile/PowerStorageWailaDataProvider.java @@ -1,174 +1,174 @@ -/* - * 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.util.math.BlockPos; -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( final ItemStack itemStack, final List currentToolTip, final IWailaDataAccessor accessor, final 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 ); - - if( internalCurrentPower >= 0 ) - { - 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 pos pos of the power storage - * - * @return tag send to the client - */ - @Override - public NBTTagCompound getNBTData( EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, BlockPos pos ) - { - 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( final NBTTagCompound tag, final 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 = -1; - } - - return internalCurrentPower; - } -} +///* +// * 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.util.math.BlockPos; +//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( final ItemStack itemStack, final List currentToolTip, final IWailaDataAccessor accessor, final 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 ); +// +// if( internalCurrentPower >= 0 ) +// { +// 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 pos pos of the power storage +// * +// * @return tag send to the client +// */ +// @Override +// public NBTTagCompound getNBTData( EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, BlockPos pos ) +// { +// 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( final NBTTagCompound tag, final 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 = -1; +// } +// +// return internalCurrentPower; +// } +//} diff --git a/src/main/java/appeng/items/AEBaseItem.java b/src/main/java/appeng/items/AEBaseItem.java index bfafa5ec5..96996a630 100644 --- a/src/main/java/appeng/items/AEBaseItem.java +++ b/src/main/java/appeng/items/AEBaseItem.java @@ -25,6 +25,7 @@ import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.util.NonNullList; public abstract class AEBaseItem extends Item @@ -51,7 +52,7 @@ public abstract class AEBaseItem extends Item @Override @SuppressWarnings( "unchecked" ) - public final void getSubItems( final Item sameItem, final CreativeTabs creativeTab, final List itemStacks ) + public final void getSubItems( final Item sameItem, final CreativeTabs creativeTab, final NonNullList itemStacks ) { this.getCheckedSubItems( sameItem, creativeTab, itemStacks ); } @@ -67,7 +68,7 @@ public abstract class AEBaseItem extends Item super.addInformation( stack, player, lines, displayMoreInfo ); } - protected void getCheckedSubItems( final Item sameItem, final CreativeTabs creativeTab, final List itemStacks ) + protected void getCheckedSubItems( final Item sameItem, final CreativeTabs creativeTab, final NonNullList itemStacks ) { super.getSubItems( sameItem, creativeTab, itemStacks ); } diff --git a/src/main/java/appeng/items/contents/NetworkToolViewer.java b/src/main/java/appeng/items/contents/NetworkToolViewer.java index cef1b6021..bfcfb101b 100644 --- a/src/main/java/appeng/items/contents/NetworkToolViewer.java +++ b/src/main/java/appeng/items/contents/NetworkToolViewer.java @@ -104,9 +104,9 @@ public class NetworkToolViewer implements INetworkTool } @Override - public boolean isUseableByPlayer( final EntityPlayer entityplayer ) + public boolean isUsableByPlayer( final EntityPlayer entityplayer ) { - return this.inv.isUseableByPlayer( entityplayer ); + return this.inv.isUsableByPlayer( entityplayer ); } @Override @@ -168,4 +168,10 @@ public class NetworkToolViewer implements INetworkTool { return this.inv.getDisplayName(); } + + @Override + public boolean isEmpty() + { + return false; + } } diff --git a/src/main/java/appeng/items/materials/ItemMaterial.java b/src/main/java/appeng/items/materials/ItemMaterial.java index c01d33c00..8cada8fe6 100644 --- a/src/main/java/appeng/items/materials/ItemMaterial.java +++ b/src/main/java/appeng/items/materials/ItemMaterial.java @@ -45,6 +45,7 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; +import net.minecraft.util.NonNullList; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; @@ -257,7 +258,7 @@ public final class ItemMaterial extends AEBaseItem implements IStorageComponent, } @Override - protected void getCheckedSubItems( final Item sameItem, final CreativeTabs creativeTab, final List itemStacks ) + protected void getCheckedSubItems( final Item sameItem, final CreativeTabs creativeTab, final NonNullList itemStacks ) { final List types = Arrays.asList( MaterialType.values() ); Collections.sort( types, new Comparator() @@ -280,7 +281,7 @@ public final class ItemMaterial extends AEBaseItem implements IStorageComponent, } @Override - public EnumActionResult onItemUseFirst( final ItemStack is, final EntityPlayer player, final World world, final BlockPos pos, final EnumFacing side, final float hitX, final float hitY, final float hitZ, final EnumHand hand ) + public EnumActionResult onItemUseFirst( final EntityPlayer player, final World world, final BlockPos pos, final EnumFacing side, final float hitX, final float hitY, final float hitZ, final EnumHand hand ) { if( player.isSneaking() ) { @@ -300,29 +301,29 @@ public final class ItemMaterial extends AEBaseItem implements IStorageComponent, upgrades = ( (ISegmentedInventory) te ).getInventoryByName( "upgrades" ); } - if( upgrades != null && is != null && is.getItem() instanceof IUpgradeModule ) + if( upgrades != null && player.getHeldItemMainhand() != null && player.getHeldItemMainhand().getItem() instanceof IUpgradeModule ) { - final IUpgradeModule um = (IUpgradeModule) is.getItem(); - final Upgrades u = um.getType( is ); + final IUpgradeModule um = (IUpgradeModule) player.getHeldItemMainhand().getItem(); + final Upgrades u = um.getType( player.getHeldItemMainhand() ); if( u != null ) { final InventoryAdaptor ad = InventoryAdaptor.getAdaptor( upgrades, EnumFacing.UP ); if( ad != null ) { - if( player.worldObj.isRemote ) + if( player.world.isRemote ) { return EnumActionResult.PASS; } - player.inventory.setInventorySlotContents( player.inventory.currentItem, ad.addItems( is ) ); + player.inventory.setInventorySlotContents( player.inventory.currentItem, ad.addItems( player.getHeldItemMainhand() ) ); return EnumActionResult.SUCCESS; } } } } - return super.onItemUseFirst( is, player, world, pos, side, hitX, hitY, hitZ, hand ); + return super.onItemUseFirst( player, world, pos, side, hitX, hitY, hitZ, hand ); } @Override diff --git a/src/main/java/appeng/items/materials/MaterialType.java b/src/main/java/appeng/items/materials/MaterialType.java index b69bd106e..30eccded2 100644 --- a/src/main/java/appeng/items/materials/MaterialType.java +++ b/src/main/java/appeng/items/materials/MaterialType.java @@ -144,7 +144,8 @@ public enum MaterialType this( metaValue, modelName, features ); this.droppedEntity = c; - EntityRegistry.registerModEntity( this.droppedEntity, this.droppedEntity.getSimpleName(), EntityIds.get( this.droppedEntity ), AppEng.instance(), 16, 4, + EntityRegistry.registerModEntity( new ResourceLocation( this.droppedEntity.getName() ), this.droppedEntity, this.droppedEntity.getSimpleName(), + EntityIds.get( this.droppedEntity ), AppEng.instance(), 16, 4, true ); } @@ -153,7 +154,8 @@ public enum MaterialType this( metaValue, modelName, features ); this.oreName = oreDictionary; this.droppedEntity = c; - EntityRegistry.registerModEntity( this.droppedEntity, this.droppedEntity.getSimpleName(), EntityIds.get( this.droppedEntity ), AppEng.instance(), 16, 4, + EntityRegistry.registerModEntity( new ResourceLocation( this.droppedEntity.getName() ), this.droppedEntity, this.droppedEntity.getSimpleName(), + EntityIds.get( this.droppedEntity ), AppEng.instance(), 16, 4, true ); } diff --git a/src/main/java/appeng/items/misc/ItemCrystalSeed.java b/src/main/java/appeng/items/misc/ItemCrystalSeed.java index 630952e5f..0f0df6ce7 100644 --- a/src/main/java/appeng/items/misc/ItemCrystalSeed.java +++ b/src/main/java/appeng/items/misc/ItemCrystalSeed.java @@ -32,6 +32,8 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.NonNullList; +import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; import net.minecraftforge.fml.common.registry.EntityRegistry; @@ -62,7 +64,7 @@ public class ItemCrystalSeed extends AEBaseItem implements IGrowableCrystal { this.setHasSubtypes( true ); - EntityRegistry.registerModEntity( EntityGrowingCrystal.class, EntityGrowingCrystal.class.getSimpleName(), EntityIds.get( EntityGrowingCrystal.class ), AppEng.instance(), 16, 4, true ); + EntityRegistry.registerModEntity( new ResourceLocation( EntityGrowingCrystal.class.getName() ), EntityGrowingCrystal.class, EntityGrowingCrystal.class.getSimpleName(), EntityIds.get( EntityGrowingCrystal.class ), AppEng.instance(), 16, 4, true ); } @Nullable @@ -109,7 +111,7 @@ public class ItemCrystalSeed extends AEBaseItem implements IGrowableCrystal { final int newDamage = getProgress( is ) + 1; final IMaterials materials = AEApi.instance().definitions().materials(); - final int size = is.stackSize; + final int size = is.getCount(); if( newDamage == CERTUS + SINGLE_OFFSET ) { @@ -237,7 +239,7 @@ public class ItemCrystalSeed extends AEBaseItem implements IGrowableCrystal } @Override - protected void getCheckedSubItems( final Item sameItem, final CreativeTabs creativeTab, final List itemStacks ) + protected void getCheckedSubItems( final Item sameItem, final CreativeTabs creativeTab, final NonNullList itemStacks ) { // lvl 0 itemStacks.add( newStyle( new ItemStack( this, 1, CERTUS ) ) ); diff --git a/src/main/java/appeng/items/misc/ItemEncodedPattern.java b/src/main/java/appeng/items/misc/ItemEncodedPattern.java index 1e05c9563..81614cb03 100644 --- a/src/main/java/appeng/items/misc/ItemEncodedPattern.java +++ b/src/main/java/appeng/items/misc/ItemEncodedPattern.java @@ -38,7 +38,7 @@ import appeng.api.AEApi; import appeng.api.implementations.ICraftingPatternItem; import appeng.api.networking.crafting.ICraftingPatternDetails; import appeng.api.storage.data.IAEItemStack; -import appeng.core.CommonHelper; +import appeng.core.AppEng; import appeng.core.localization.GuiText; import appeng.helpers.PatternHelper; import appeng.items.AEBaseItem; @@ -56,17 +56,17 @@ public class ItemEncodedPattern extends AEBaseItem implements ICraftingPatternIt } @Override - public ActionResult onItemRightClick( final ItemStack stack, final World w, final EntityPlayer player, final EnumHand hand ) + public ActionResult onItemRightClick( final World w, final EntityPlayer player, final EnumHand hand ) { - this.clearPattern( stack, player ); + this.clearPattern( player.getHeldItemMainhand(), player ); - return new ActionResult( EnumActionResult.SUCCESS, stack ); + return new ActionResult( EnumActionResult.SUCCESS, player.getHeldItemMainhand() ); } @Override - public EnumActionResult onItemUseFirst( final ItemStack stack, final EntityPlayer player, final World world, final BlockPos pos, final EnumFacing side, final float hitX, final float hitY, final float hitZ, final EnumHand hand ) + public EnumActionResult onItemUseFirst( final EntityPlayer player, final World world, final BlockPos pos, final EnumFacing side, final float hitX, final float hitY, final float hitZ, final EnumHand hand ) { - return this.clearPattern( stack, player ) ? EnumActionResult.SUCCESS : EnumActionResult.FAIL; + return this.clearPattern( player.getHeldItemMainhand(), player ) ? EnumActionResult.SUCCESS : EnumActionResult.FAIL; } private boolean clearPattern( final ItemStack stack, final EntityPlayer player ) @@ -80,7 +80,7 @@ public class ItemEncodedPattern extends AEBaseItem implements ICraftingPatternIt final InventoryPlayer inv = player.inventory; - ItemStack is = AEApi.instance().definitions().materials().blankPattern().maybeStack( stack.stackSize ).orElse( null ); + ItemStack is = AEApi.instance().definitions().materials().blankPattern().maybeStack( stack.getCount() ).orElse( null ); if( is != null ) { for( int s = 0; s < player.inventory.getSizeInventory(); s++ ) @@ -100,7 +100,7 @@ public class ItemEncodedPattern extends AEBaseItem implements ICraftingPatternIt @Override public void addCheckedInformation( final ItemStack stack, final EntityPlayer player, final List lines, final boolean displayMoreInfo ) { - final ICraftingPatternDetails details = this.getPatternForItem( stack, player.worldObj ); + final ICraftingPatternDetails details = this.getPatternForItem( stack, player.world ); if( details == null ) { @@ -172,7 +172,7 @@ public class ItemEncodedPattern extends AEBaseItem implements ICraftingPatternIt return out; } - final World w = CommonHelper.proxy.getWorld(); + final World w = AppEng.proxy.getWorld(); if( w == null ) { return null; diff --git a/src/main/java/appeng/items/misc/ItemPaintBall.java b/src/main/java/appeng/items/misc/ItemPaintBall.java index 4f3b946af..93f0ab42f 100644 --- a/src/main/java/appeng/items/misc/ItemPaintBall.java +++ b/src/main/java/appeng/items/misc/ItemPaintBall.java @@ -19,11 +19,10 @@ package appeng.items.misc; -import java.util.List; - import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.util.NonNullList; import appeng.api.util.AEColor; import appeng.core.localization.GuiText; @@ -68,7 +67,7 @@ public class ItemPaintBall extends AEBaseItem } @Override - protected void getCheckedSubItems( final Item sameItem, final CreativeTabs creativeTab, final List itemStacks ) + protected void getCheckedSubItems( final Item sameItem, final CreativeTabs creativeTab, final NonNullList itemStacks ) { for( final AEColor c : AEColor.values() ) { diff --git a/src/main/java/appeng/items/parts/ItemFacade.java b/src/main/java/appeng/items/parts/ItemFacade.java index 01016f8a6..dc326ae7d 100644 --- a/src/main/java/appeng/items/parts/ItemFacade.java +++ b/src/main/java/appeng/items/parts/ItemFacade.java @@ -38,6 +38,7 @@ import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumBlockRenderType; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; +import net.minecraft.util.NonNullList; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; @@ -69,9 +70,9 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte } @Override - public EnumActionResult onItemUseFirst( final ItemStack is, final EntityPlayer player, final World world, final BlockPos pos, final EnumFacing side, final float hitX, final float hitY, final float hitZ, final EnumHand hand ) + public EnumActionResult onItemUseFirst( final EntityPlayer player, final World world, final BlockPos pos, final EnumFacing side, final float hitX, final float hitY, final float hitZ, final EnumHand hand ) { - return AEApi.instance().partHelper().placeBus( is, pos, side, player, hand, world ); + return AEApi.instance().partHelper().placeBus( player.getHeldItemMainhand(), pos, side, player, hand, world ); } @Override @@ -94,7 +95,7 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte } @Override - protected void getCheckedSubItems( final Item sameItem, final CreativeTabs creativeTab, final List itemStacks ) + protected void getCheckedSubItems( final Item sameItem, final CreativeTabs creativeTab, final NonNullList itemStacks ) { this.calculateSubTypes(); itemStacks.addAll( this.subTypes ); @@ -116,7 +117,7 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte continue; } - final List tmpList = new ArrayList( 100 ); + final NonNullList tmpList = NonNullList.create(); b.getSubBlocks( item, b.getCreativeTabToDisplayOn(), tmpList ); for( final ItemStack l : tmpList ) { @@ -336,6 +337,6 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte } Block blk = blockState.getBlock(); - return blk.canRenderInLayer( BlockRenderLayer.TRANSLUCENT ); + return blk.canRenderInLayer( blockState, BlockRenderLayer.TRANSLUCENT ); } } diff --git a/src/main/java/appeng/items/parts/ItemPart.java b/src/main/java/appeng/items/parts/ItemPart.java index 49f7d0f0e..a193dd2c4 100644 --- a/src/main/java/appeng/items/parts/ItemPart.java +++ b/src/main/java/appeng/items/parts/ItemPart.java @@ -41,6 +41,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; +import net.minecraft.util.NonNullList; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; @@ -152,14 +153,14 @@ public final class ItemPart extends AEBaseItem implements IPartItem, IItemGroup } @Override - public EnumActionResult onItemUse( final ItemStack is, final EntityPlayer player, final World w, final BlockPos pos, final EnumHand hand, final EnumFacing side, final float hitX, final float hitY, final float hitZ ) + public EnumActionResult onItemUse( final EntityPlayer player, final World w, final BlockPos pos, final EnumHand hand, final EnumFacing side, final float hitX, final float hitY, final float hitZ ) { - if( this.getTypeByStack( is ) == PartType.InvalidType ) + if( this.getTypeByStack( player.getHeldItemMainhand() ) == PartType.InvalidType ) { return EnumActionResult.FAIL; } - return AEApi.instance().partHelper().placeBus( is, pos, side, player, hand, w ); + return AEApi.instance().partHelper().placeBus( player.getHeldItemMainhand(), pos, side, player, hand, w ); } @Override @@ -195,7 +196,7 @@ public final class ItemPart extends AEBaseItem implements IPartItem, IItemGroup } @Override - protected void getCheckedSubItems( final Item sameItem, final CreativeTabs creativeTab, final List itemStacks ) + protected void getCheckedSubItems( final Item sameItem, final CreativeTabs creativeTab, final NonNullList itemStacks ) { final List> types = new ArrayList>( this.registered.entrySet() ); Collections.sort( types, REGISTERED_COMPARATOR ); diff --git a/src/main/java/appeng/items/parts/PartType.java b/src/main/java/appeng/items/parts/PartType.java index af6eb7bea..03fb76141 100644 --- a/src/main/java/appeng/items/parts/PartType.java +++ b/src/main/java/appeng/items/parts/PartType.java @@ -59,10 +59,8 @@ import appeng.parts.networking.PartCableGlass; import appeng.parts.networking.PartCableSmart; import appeng.parts.networking.PartDenseCable; import appeng.parts.networking.PartQuartzFiber; -import appeng.parts.p2p.PartP2PIC2Power; import appeng.parts.p2p.PartP2PItems; import appeng.parts.p2p.PartP2PLight; -import appeng.parts.p2p.PartP2PLiquids; import appeng.parts.p2p.PartP2PRedstone; import appeng.parts.p2p.PartP2PTunnelME; import appeng.parts.reporting.PartConversionMonitor; @@ -226,25 +224,25 @@ public enum PartType } }, - P2PTunnelLiquids( 463, "p2p_tunnel_liquids", EnumSet.of( AEFeature.P2P_TUNNEL, AEFeature.P2P_TUNNEL_LIQUIDS ), EnumSet - .noneOf( IntegrationType.class ), PartP2PLiquids.class, GuiText.FluidTunnel ) - { - @Override - String getUnlocalizedName() - { - return "P2PTunnel"; - } - }, - - P2PTunnelEU( 465, "p2p_tunnel_ic2", EnumSet.of( AEFeature.P2P_TUNNEL, AEFeature.P2P_TUNNEL_EU ), EnumSet - .of( IntegrationType.IC2 ), PartP2PIC2Power.class, GuiText.EUTunnel ) - { - @Override - String getUnlocalizedName() - { - return "P2PTunnel"; - } - }, +// P2PTunnelLiquids( 463, "p2p_tunnel_liquids", EnumSet.of( AEFeature.P2P_TUNNEL, AEFeature.P2P_TUNNEL_LIQUIDS ), EnumSet +// .noneOf( IntegrationType.class ), PartP2PLiquids.class, GuiText.FluidTunnel ) +// { +// @Override +// String getUnlocalizedName() +// { +// return "P2PTunnel"; +// } +// }, +// +// P2PTunnelEU( 465, "p2p_tunnel_ic2", EnumSet.of( AEFeature.P2P_TUNNEL, AEFeature.P2P_TUNNEL_EU ), EnumSet +// .of( IntegrationType.IC2 ), PartP2PIC2Power.class, GuiText.EUTunnel ) +// { +// @Override +// String getUnlocalizedName() +// { +// return "P2PTunnel"; +// } +// }, // P2PTunnelRF( 466, EnumSet.of( AEFeature.P2PTunnel, AEFeature.P2PTunnelRF ), EnumSet.of( IntegrationType.RF ), // PartP2PRFPower.class, GuiText.RFTunnel ), diff --git a/src/main/java/appeng/items/storage/ItemBasicStorageCell.java b/src/main/java/appeng/items/storage/ItemBasicStorageCell.java index 4c7fc2be2..17f0b2d7d 100644 --- a/src/main/java/appeng/items/storage/ItemBasicStorageCell.java +++ b/src/main/java/appeng/items/storage/ItemBasicStorageCell.java @@ -214,10 +214,10 @@ public final class ItemBasicStorageCell extends AEBaseItem implements IStorageCe } @Override - public ActionResult onItemRightClick( final ItemStack stack, final World world, final EntityPlayer player, final EnumHand hand ) + public ActionResult onItemRightClick( final World world, final EntityPlayer player, final EnumHand hand ) { - this.disassembleDrive( stack, world, player ); - return new ActionResult( EnumActionResult.SUCCESS, stack ); + this.disassembleDrive( player.getHeldItemMainhand(), world, player ); + return new ActionResult( EnumActionResult.SUCCESS, player.getHeldItemMainhand() ); } private boolean disassembleDrive( final ItemStack stack, final World world, final EntityPlayer player ) @@ -281,9 +281,9 @@ public final class ItemBasicStorageCell extends AEBaseItem implements IStorageCe } @Override - public EnumActionResult onItemUseFirst( final ItemStack stack, final EntityPlayer player, final World world, final BlockPos pos, final EnumFacing side, final float hitX, final float hitY, final float hitZ, final EnumHand hand ) + public EnumActionResult onItemUseFirst( final EntityPlayer player, final World world, final BlockPos pos, final EnumFacing side, final float hitX, final float hitY, final float hitZ, final EnumHand hand ) { - return this.disassembleDrive( stack, world, player ) ? EnumActionResult.SUCCESS : EnumActionResult.PASS; + return this.disassembleDrive( player.getHeldItemMainhand(), world, player ) ? EnumActionResult.SUCCESS : EnumActionResult.PASS; } @Override diff --git a/src/main/java/appeng/items/tools/ToolBiometricCard.java b/src/main/java/appeng/items/tools/ToolBiometricCard.java index 52c4895b6..00cce88f0 100644 --- a/src/main/java/appeng/items/tools/ToolBiometricCard.java +++ b/src/main/java/appeng/items/tools/ToolBiometricCard.java @@ -51,16 +51,16 @@ public class ToolBiometricCard extends AEBaseItem implements IBiometricCard } @Override - public ActionResult onItemRightClick( final ItemStack is, final World w, final EntityPlayer p, final EnumHand hand ) + public ActionResult onItemRightClick( final World w, final EntityPlayer p, final EnumHand hand ) { if( p.isSneaking() ) { - this.encode( is, p ); + this.encode( p.getHeldItemMainhand(), p ); p.swingArm( hand ); - return new ActionResult( EnumActionResult.SUCCESS, is ); + return new ActionResult( EnumActionResult.SUCCESS, p.getHeldItemMainhand() ); } - return new ActionResult( EnumActionResult.PASS, is ); + return new ActionResult( EnumActionResult.PASS, p.getHeldItemMainhand() ); } @Override diff --git a/src/main/java/appeng/items/tools/ToolMemoryCard.java b/src/main/java/appeng/items/tools/ToolMemoryCard.java index 9b1c6397f..a7d9a8ede 100644 --- a/src/main/java/appeng/items/tools/ToolMemoryCard.java +++ b/src/main/java/appeng/items/tools/ToolMemoryCard.java @@ -124,34 +124,34 @@ public class ToolMemoryCard extends AEBaseItem implements IMemoryCard switch( msg ) { case SETTINGS_CLEARED: - player.addChatMessage( PlayerMessages.SettingCleared.get() ); + player.sendMessage( PlayerMessages.SettingCleared.get() ); break; case INVALID_MACHINE: - player.addChatMessage( PlayerMessages.InvalidMachine.get() ); + player.sendMessage( PlayerMessages.InvalidMachine.get() ); break; case SETTINGS_LOADED: - player.addChatMessage( PlayerMessages.LoadedSettings.get() ); + player.sendMessage( PlayerMessages.LoadedSettings.get() ); break; case SETTINGS_SAVED: - player.addChatMessage( PlayerMessages.SavedSettings.get() ); + player.sendMessage( PlayerMessages.SavedSettings.get() ); break; default: } } @Override - public EnumActionResult onItemUse( final ItemStack is, final EntityPlayer player, final World w, final BlockPos pos, final EnumHand hand, final EnumFacing side, final float hx, final float hy, final float hz ) + public EnumActionResult onItemUse( final EntityPlayer player, final World w, final BlockPos pos, final EnumHand hand, final EnumFacing side, final float hx, final float hy, final float hz ) { if( player.isSneaking() && !w.isRemote ) { - final IMemoryCard mem = (IMemoryCard) is.getItem(); + final IMemoryCard mem = (IMemoryCard) player.getHeldItemMainhand().getItem(); mem.notifyUser( player, MemoryCardMessages.SETTINGS_CLEARED ); - is.setTagCompound( null ); + player.getHeldItemMainhand().setTagCompound( null ); return EnumActionResult.SUCCESS; } else { - return super.onItemUse( is, player, w, pos, hand, side, hx, hy, hz ); + return super.onItemUse( player, w, pos, hand, side, hx, hy, hz ); } } diff --git a/src/main/java/appeng/items/tools/ToolNetworkTool.java b/src/main/java/appeng/items/tools/ToolNetworkTool.java index b510a13af..3b2d24ee2 100644 --- a/src/main/java/appeng/items/tools/ToolNetworkTool.java +++ b/src/main/java/appeng/items/tools/ToolNetworkTool.java @@ -42,8 +42,8 @@ import appeng.api.parts.SelectedPart; import appeng.api.util.AEPartLocation; import appeng.api.util.DimensionalCoord; import appeng.api.util.INetworkToolAgent; -import appeng.client.ClientHelper; import appeng.container.AEBaseContainer; +import appeng.core.AppEng; import appeng.core.sync.GuiBridge; import appeng.core.sync.network.NetworkHandler; import appeng.core.sync.packets.PacketClick; @@ -71,30 +71,30 @@ public class ToolNetworkTool extends AEBaseItem implements IGuiItem, IAEWrench / } @Override - public ActionResult onItemRightClick( final ItemStack it, final World w, final EntityPlayer p, final EnumHand hand ) + public ActionResult onItemRightClick( final World w, final EntityPlayer p, final EnumHand hand ) { if( Platform.isClient() ) { - final RayTraceResult mop = ClientHelper.proxy.getRTR(); + final RayTraceResult mop = AppEng.proxy.getRTR(); if( mop == null ) { - this.onItemUseFirst( it, p, w, new BlockPos( 0, 0, 0 ), null, 0, 0, 0, hand ); // eh? + this.onItemUseFirst( p, w, new BlockPos( 0, 0, 0 ), null, 0, 0, 0, hand ); // eh? } else { if( w.getBlockState( mop.getBlockPos() ).getBlock().isAir( w.getBlockState( mop.getBlockPos() ), w, mop.getBlockPos() ) ) { - this.onItemUseFirst( it, p, w, new BlockPos( 0, 0, 0 ), null, 0, 0, 0, hand ); // eh? + this.onItemUseFirst( p, w, new BlockPos( 0, 0, 0 ), null, 0, 0, 0, hand ); // eh? } } } - return new ActionResult( EnumActionResult.SUCCESS, it ); + return new ActionResult( EnumActionResult.SUCCESS, p.getHeldItemMainhand() ); } @Override - public EnumActionResult onItemUseFirst( final ItemStack stack, final EntityPlayer player, final World world, final BlockPos pos, final EnumFacing side, final float hitX, final float hitY, final float hitZ, final EnumHand hand ) + public EnumActionResult onItemUseFirst( final EntityPlayer player, final World world, final BlockPos pos, final EnumFacing side, final float hitX, final float hitY, final float hitZ, final EnumHand hand ) { final RayTraceResult mop = new RayTraceResult( new Vec3d( hitX, hitY, hitZ ), side, pos ); final TileEntity te = world.getTileEntity( pos ); @@ -151,7 +151,7 @@ public class ToolNetworkTool extends AEBaseItem implements IGuiItem, IAEWrench / { if( b.rotateBlock( w, pos, side ) ) { - b.neighborChanged( Platform.AIR_BLOCK.getDefaultState(), w, pos, Platform.AIR_BLOCK ); + b.neighborChanged( Platform.AIR_BLOCK.getDefaultState(), w, pos, Platform.AIR_BLOCK, null ); p.swingArm( hand ); return !w.isRemote; } @@ -180,7 +180,7 @@ public class ToolNetworkTool extends AEBaseItem implements IGuiItem, IAEWrench / } else { - b.onBlockActivated( w, pos, w.getBlockState( pos ), p, hand, is, side, hitX, hitY, hitZ ); + b.onBlockActivated( w, pos, w.getBlockState( pos ), p, hand, side, hitX, hitY, hitZ ); } } else diff --git a/src/main/java/appeng/items/tools/powered/ToolChargedStaff.java b/src/main/java/appeng/items/tools/powered/ToolChargedStaff.java index f08f37648..1bec996f1 100644 --- a/src/main/java/appeng/items/tools/powered/ToolChargedStaff.java +++ b/src/main/java/appeng/items/tools/powered/ToolChargedStaff.java @@ -25,9 +25,9 @@ import net.minecraft.util.DamageSource; import net.minecraft.util.math.AxisAlignedBB; import appeng.core.AEConfig; +import appeng.core.AppEng; import appeng.core.sync.packets.PacketLightning; import appeng.items.tools.powered.powersink.AEBasePoweredItem; -import appeng.server.ServerHelper; import appeng.util.Platform; @@ -53,10 +53,10 @@ public class ToolChargedStaff extends AEBasePoweredItem final float dx = (float) ( Platform.getRandomFloat() * target.width + entityBoundingBox.minX ); final float dy = (float) ( Platform.getRandomFloat() * target.height + entityBoundingBox.minY ); final float dz = (float) ( Platform.getRandomFloat() * target.width + entityBoundingBox.minZ ); - ServerHelper.proxy.sendToAllNearExcept( null, dx, dy, dz, 32.0, target.worldObj, new PacketLightning( dx, dy, dz ) ); + AppEng.proxy.sendToAllNearExcept( null, dx, dy, dz, 32.0, target.world, new PacketLightning( dx, dy, dz ) ); } } - target.attackEntityFrom( DamageSource.magic, 6 ); + target.attackEntityFrom( DamageSource.MAGIC, 6 ); return true; } diff --git a/src/main/java/appeng/items/tools/powered/ToolColorApplicator.java b/src/main/java/appeng/items/tools/powered/ToolColorApplicator.java index f919dcc7f..5b8fd9f20 100644 --- a/src/main/java/appeng/items/tools/powered/ToolColorApplicator.java +++ b/src/main/java/appeng/items/tools/powered/ToolColorApplicator.java @@ -118,7 +118,7 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe if( option != null ) { paintBall = option.getItemStack(); - paintBall.stackSize = 1; + paintBall.setCount( 1 ); } else { @@ -242,7 +242,7 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe if( c != null && c.hasKey( "color" ) ) { final NBTTagCompound color = c.getCompoundTag( "color" ); - final ItemStack oldColor = ItemStack.loadItemStackFromNBT( color ); + final ItemStack oldColor = new ItemStack( color ); if( oldColor != null ) { return oldColor; diff --git a/src/main/java/appeng/items/tools/powered/ToolEntropyManipulator.java b/src/main/java/appeng/items/tools/powered/ToolEntropyManipulator.java index ec4b00464..78e10df7d 100644 --- a/src/main/java/appeng/items/tools/powered/ToolEntropyManipulator.java +++ b/src/main/java/appeng/items/tools/powered/ToolEntropyManipulator.java @@ -209,13 +209,13 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT } @Override - public ActionResult onItemRightClick( final ItemStack item, final World w, final EntityPlayer p, final EnumHand hand ) + public ActionResult onItemRightClick( final World w, final EntityPlayer p, final EnumHand hand ) { final RayTraceResult target = this.rayTrace( w, p, true ); if( target == null ) { - return new ActionResult( EnumActionResult.FAIL, item ); + return new ActionResult( EnumActionResult.FAIL, p.getHeldItemMainhand() ); } else { @@ -226,13 +226,13 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT { if( Platform.hasPermissions( new DimensionalCoord( w, target.getBlockPos() ), p ) ) { - this.onItemUse( item, p, w, target.getBlockPos(), hand, EnumFacing.UP, 0.0F, 0.0F, 0.0F ); + this.onItemUse( p, w, target.getBlockPos(), hand, EnumFacing.UP, 0.0F, 0.0F, 0.0F ); } } } } - return new ActionResult( EnumActionResult.SUCCESS, item ); + return new ActionResult( EnumActionResult.SUCCESS, p.getHeldItemMainhand() ); } @Override diff --git a/src/main/java/appeng/items/tools/powered/ToolMatterCannon.java b/src/main/java/appeng/items/tools/powered/ToolMatterCannon.java index cd2729bc1..3a1ef5b36 100644 --- a/src/main/java/appeng/items/tools/powered/ToolMatterCannon.java +++ b/src/main/java/appeng/items/tools/powered/ToolMatterCannon.java @@ -61,7 +61,7 @@ import appeng.api.util.AEColor; import appeng.api.util.DimensionalCoord; import appeng.core.AEConfig; import appeng.core.AELog; -import appeng.core.CommonHelper; +import appeng.core.AppEng; import appeng.core.features.AEFeature; import appeng.core.localization.GuiText; import appeng.core.localization.PlayerMessages; @@ -106,19 +106,19 @@ public class ToolMatterCannon extends AEBasePoweredItem implements IStorageCell } @Override - public ActionResult onItemRightClick( final ItemStack item, final World w, final EntityPlayer p, final @Nullable EnumHand hand ) + public ActionResult onItemRightClick( final World w, final EntityPlayer p, final @Nullable EnumHand hand ) { - if( this.getAECurrentPower( item ) > 1600 ) + if( this.getAECurrentPower( p.getHeldItemMainhand() ) > 1600 ) { int shots = 1; - final CellUpgrades cu = (CellUpgrades) this.getUpgradesInventory( item ); + final CellUpgrades cu = (CellUpgrades) this.getUpgradesInventory( p.getHeldItemMainhand() ); if( cu != null ) { shots += cu.getInstalledUpgrades( Upgrades.SPEED ); } - final IMEInventory inv = AEApi.instance().registries().cell().getCellInventory( item, null, StorageChannel.ITEMS ); + final IMEInventory inv = AEApi.instance().registries().cell().getCellInventory( p.getHeldItemMainhand(), null, StorageChannel.ITEMS ); if( inv != null ) { final IItemList itemList = inv.getAvailableItems( AEApi.instance().storage().createItemList() ); @@ -128,25 +128,25 @@ public class ToolMatterCannon extends AEBasePoweredItem implements IStorageCell shots = Math.min( shots, (int) aeAmmo.getStackSize() ); for( int sh = 0; sh < shots; sh++ ) { - this.extractAEPower( item, 1600 ); + this.extractAEPower( p.getHeldItemMainhand(), 1600 ); if( Platform.isClient() ) { - return new ActionResult( EnumActionResult.SUCCESS, item ); + return new ActionResult( EnumActionResult.SUCCESS, p.getHeldItemMainhand() ); } aeAmmo.setStackSize( 1 ); final ItemStack ammo = ( (IAEItemStack) aeAmmo ).getItemStack(); if( ammo == null ) { - return new ActionResult( EnumActionResult.SUCCESS, item ); + return new ActionResult( EnumActionResult.SUCCESS, p.getHeldItemMainhand() ); } - ammo.stackSize = 1; + ammo.setCount( 1 ); aeAmmo = inv.extractItems( aeAmmo, Actionable.MODULATE, new PlayerSource( p, null ) ); if( aeAmmo == null ) { - return new ActionResult( EnumActionResult.SUCCESS, item ); + return new ActionResult( EnumActionResult.SUCCESS, p.getHeldItemMainhand() ); } final LookDirection dir = Platform.getPlayerRay( p, p.getEyeHeight() ); @@ -168,7 +168,7 @@ public class ToolMatterCannon extends AEBasePoweredItem implements IStorageCell { this.shootPaintBalls( type, w, p, Vec3d, Vec3d1, direction, d0, d1, d2 ); } - return new ActionResult( EnumActionResult.SUCCESS, item ); + return new ActionResult( EnumActionResult.SUCCESS, p.getHeldItemMainhand() ); } else { @@ -180,13 +180,13 @@ public class ToolMatterCannon extends AEBasePoweredItem implements IStorageCell { if( Platform.isServer() ) { - p.addChatMessage( PlayerMessages.AmmoDepleted.get() ); + p.sendMessage( PlayerMessages.AmmoDepleted.get() ); } - return new ActionResult( EnumActionResult.SUCCESS, item ); + return new ActionResult( EnumActionResult.SUCCESS, p.getHeldItemMainhand() ); } } } - return new ActionResult( EnumActionResult.FAIL, item ); + return new ActionResult( EnumActionResult.FAIL, p.getHeldItemMainhand() ); } private void shootPaintBalls( final ItemStack type, final World w, final EntityPlayer p, final Vec3d Vec3d, final Vec3d Vec3d1, final Vec3d direction, final double d0, final double d1, final double d2 ) @@ -244,7 +244,7 @@ public class ToolMatterCannon extends AEBasePoweredItem implements IStorageCell try { - CommonHelper.proxy.sendToAllNearExcept( null, d0, d1, d2, 128, w, new PacketMatterCannon( d0, d1, d2, (float) direction.xCoord, (float) direction.yCoord, (float) direction.zCoord, (byte) ( pos == null ? 32 : pos.hitVec.squareDistanceTo( vec ) + 1 ) ) ); + AppEng.proxy.sendToAllNearExcept( null, d0, d1, d2, 128, w, new PacketMatterCannon( d0, d1, d2, (float) direction.xCoord, (float) direction.yCoord, (float) direction.zCoord, (byte) ( pos == null ? 32 : pos.hitVec.squareDistanceTo( vec ) + 1 ) ) ); } catch( final Exception err ) { @@ -361,7 +361,7 @@ public class ToolMatterCannon extends AEBasePoweredItem implements IStorageCell try { - CommonHelper.proxy.sendToAllNearExcept( null, d0, d1, d2, 128, w, new PacketMatterCannon( d0, d1, d2, (float) direction.xCoord, (float) direction.yCoord, (float) direction.zCoord, (byte) ( pos == null ? 32 : pos.hitVec.squareDistanceTo( vec ) + 1 ) ) ); + AppEng.proxy.sendToAllNearExcept( null, d0, d1, d2, 128, w, new PacketMatterCannon( d0, d1, d2, (float) direction.xCoord, (float) direction.yCoord, (float) direction.zCoord, (byte) ( pos == null ? 32 : pos.hitVec.squareDistanceTo( vec ) + 1 ) ) ); } catch( final Exception err ) { diff --git a/src/main/java/appeng/items/tools/powered/ToolPortableCell.java b/src/main/java/appeng/items/tools/powered/ToolPortableCell.java index e4a6e7267..210453ad5 100644 --- a/src/main/java/appeng/items/tools/powered/ToolPortableCell.java +++ b/src/main/java/appeng/items/tools/powered/ToolPortableCell.java @@ -64,10 +64,10 @@ public class ToolPortableCell extends AEBasePoweredItem implements IStorageCell, } @Override - public ActionResult onItemRightClick( final ItemStack item, final World w, final EntityPlayer player, final EnumHand hand ) + public ActionResult onItemRightClick( final World w, final EntityPlayer player, final EnumHand hand ) { Platform.openGUI( player, null, AEPartLocation.INTERNAL, GuiBridge.GUI_PORTABLE_CELL ); - return new ActionResult( EnumActionResult.SUCCESS, item ); + return new ActionResult( EnumActionResult.SUCCESS, player.getHeldItemMainhand() ); } @SideOnly( Side.CLIENT ) diff --git a/src/main/java/appeng/items/tools/powered/ToolWirelessTerminal.java b/src/main/java/appeng/items/tools/powered/ToolWirelessTerminal.java index e8875e890..c8fd84ef8 100644 --- a/src/main/java/appeng/items/tools/powered/ToolWirelessTerminal.java +++ b/src/main/java/appeng/items/tools/powered/ToolWirelessTerminal.java @@ -56,10 +56,10 @@ public class ToolWirelessTerminal extends AEBasePoweredItem implements IWireless } @Override - public ActionResult onItemRightClick( final ItemStack item, final World w, final EntityPlayer player, final EnumHand hand ) + public ActionResult onItemRightClick( final World w, final EntityPlayer player, final EnumHand hand ) { - AEApi.instance().registries().wireless().openWirelessTerminalGui( item, w, player ); - return new ActionResult( EnumActionResult.SUCCESS, item ); + AEApi.instance().registries().wireless().openWirelessTerminalGui( player.getHeldItemMainhand(), w, player ); + return new ActionResult( EnumActionResult.SUCCESS, player.getHeldItemMainhand() ); } @SideOnly( Side.CLIENT ) diff --git a/src/main/java/appeng/items/tools/powered/powersink/AERootPoweredItem.java b/src/main/java/appeng/items/tools/powered/powersink/AERootPoweredItem.java index eaa4e6d76..48af3a492 100644 --- a/src/main/java/appeng/items/tools/powered/powersink/AERootPoweredItem.java +++ b/src/main/java/appeng/items/tools/powered/powersink/AERootPoweredItem.java @@ -27,6 +27,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.NonNullList; import net.minecraftforge.common.capabilities.ICapabilityProvider; import appeng.api.config.AccessRestriction; @@ -75,7 +76,7 @@ public abstract class AERootPoweredItem extends AEBaseItem implements IAEItemPow } @Override - protected void getCheckedSubItems( final Item sameItem, final CreativeTabs creativeTab, final List itemStacks ) + protected void getCheckedSubItems( final Item sameItem, final CreativeTabs creativeTab, final NonNullList itemStacks ) { super.getCheckedSubItems( sameItem, creativeTab, itemStacks ); diff --git a/src/main/java/appeng/items/tools/powered/powersink/IC2.java b/src/main/java/appeng/items/tools/powered/powersink/IC2.java index 1bad83379..aab674f37 100644 --- a/src/main/java/appeng/items/tools/powered/powersink/IC2.java +++ b/src/main/java/appeng/items/tools/powered/powersink/IC2.java @@ -1,125 +1,125 @@ -/* - * 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.items.tools.powered.powersink; - - -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.item.ItemStack; - -import ic2.api.item.IElectricItemManager; -import ic2.api.item.ISpecialElectricItem; - -import appeng.api.config.PowerUnits; -import appeng.coremod.annotations.Integration.Interface; -import appeng.coremod.annotations.Integration.InterfaceList; -import appeng.coremod.annotations.Integration.Method; -import appeng.integration.IntegrationType; - - -@InterfaceList( value = { - @Interface( iface = "ic2.api.item.ISpecialElectricItem", iname = IntegrationType.IC2 ), - @Interface( iface = "ic2.api.item.IElectricItemManager", iname = IntegrationType.IC2 ) -} ) -public abstract class IC2 extends AERootPoweredItem implements IElectricItemManager, ISpecialElectricItem -{ - public IC2( double powerCapacity ) - { - super( powerCapacity ); - } - - @Override - public double charge( ItemStack is, double amount, int tier, boolean ignoreTransferLimit, boolean simulate ) - { - double addedAmt = amount; - double limit = this.getTransferLimit( is ); - - if( !ignoreTransferLimit && amount > limit ) - { - addedAmt = limit; - } - - return addedAmt - ( (int) this.injectExternalPower( PowerUnits.EU, is, addedAmt, simulate ) ); - } - - @Override - public double discharge( ItemStack itemStack, double amount, int tier, boolean ignoreTransferLimit, boolean externally, boolean simulate ) - { - return 0; - } - - @Override - public double getCharge( ItemStack is ) - { - return (int) PowerUnits.AE.convertTo( PowerUnits.EU, this.getAECurrentPower( is ) ); - } - - @Override - public boolean canUse( ItemStack is, double amount ) - { - return this.getCharge( is ) > amount; - } - - @Override - public boolean use( ItemStack is, double amount, EntityLivingBase entity ) - { - if( this.canUse( is, amount ) ) - { - // use the power.. - this.extractAEPower( is, PowerUnits.EU.convertTo( PowerUnits.AE, amount ) ); - return true; - } - return false; - } - - @Override - public void chargeFromArmor( ItemStack itemStack, EntityLivingBase entity ) - { - // wtf? - } - - @Override - public String getToolTip( ItemStack itemStack ) - { - return null; - } - - @Override - public double getMaxCharge( ItemStack itemStack ) - { - return PowerUnits.AE.convertTo( PowerUnits.EU, this.getAEMaxPower( itemStack ) ); - } - - @Override - public int getTier( ItemStack itemStack ) - { - return 1; - } - - private double getTransferLimit( ItemStack itemStack ) - { - return Math.max( 32, this.getMaxCharge( itemStack ) / 200 ); - } - - @Override - @Method( iname = IntegrationType.IC2 ) - public IElectricItemManager getManager( ItemStack itemStack ) - { - return this; - } -} +///* +// * 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.items.tools.powered.powersink; +// +// +//import net.minecraft.entity.EntityLivingBase; +//import net.minecraft.item.ItemStack; +// +//import ic2.api.item.IElectricItemManager; +//import ic2.api.item.ISpecialElectricItem; +// +//import appeng.api.config.PowerUnits; +//import appeng.coremod.annotations.Integration.Interface; +//import appeng.coremod.annotations.Integration.InterfaceList; +//import appeng.coremod.annotations.Integration.Method; +//import appeng.integration.IntegrationType; +// +// +//@InterfaceList( value = { +// @Interface( iface = "ic2.api.item.ISpecialElectricItem", iname = IntegrationType.IC2 ), +// @Interface( iface = "ic2.api.item.IElectricItemManager", iname = IntegrationType.IC2 ) +//} ) +//public abstract class IC2 extends AERootPoweredItem implements IElectricItemManager, ISpecialElectricItem +//{ +// public IC2( double powerCapacity ) +// { +// super( powerCapacity ); +// } +// +// @Override +// public double charge( ItemStack is, double amount, int tier, boolean ignoreTransferLimit, boolean simulate ) +// { +// double addedAmt = amount; +// double limit = this.getTransferLimit( is ); +// +// if( !ignoreTransferLimit && amount > limit ) +// { +// addedAmt = limit; +// } +// +// return addedAmt - ( (int) this.injectExternalPower( PowerUnits.EU, is, addedAmt, simulate ) ); +// } +// +// @Override +// public double discharge( ItemStack itemStack, double amount, int tier, boolean ignoreTransferLimit, boolean externally, boolean simulate ) +// { +// return 0; +// } +// +// @Override +// public double getCharge( ItemStack is ) +// { +// return (int) PowerUnits.AE.convertTo( PowerUnits.EU, this.getAECurrentPower( is ) ); +// } +// +// @Override +// public boolean canUse( ItemStack is, double amount ) +// { +// return this.getCharge( is ) > amount; +// } +// +// @Override +// public boolean use( ItemStack is, double amount, EntityLivingBase entity ) +// { +// if( this.canUse( is, amount ) ) +// { +// // use the power.. +// this.extractAEPower( is, PowerUnits.EU.convertTo( PowerUnits.AE, amount ) ); +// return true; +// } +// return false; +// } +// +// @Override +// public void chargeFromArmor( ItemStack itemStack, EntityLivingBase entity ) +// { +// // wtf? +// } +// +// @Override +// public String getToolTip( ItemStack itemStack ) +// { +// return null; +// } +// +// @Override +// public double getMaxCharge( ItemStack itemStack ) +// { +// return PowerUnits.AE.convertTo( PowerUnits.EU, this.getAEMaxPower( itemStack ) ); +// } +// +// @Override +// public int getTier( ItemStack itemStack ) +// { +// return 1; +// } +// +// private double getTransferLimit( ItemStack itemStack ) +// { +// return Math.max( 32, this.getMaxCharge( itemStack ) / 200 ); +// } +// +// @Override +// @Method( iname = IntegrationType.IC2 ) +// public IElectricItemManager getManager( ItemStack itemStack ) +// { +// return this; +// } +//} diff --git a/src/main/java/appeng/items/tools/powered/powersink/RedstoneFlux.java b/src/main/java/appeng/items/tools/powered/powersink/RedstoneFlux.java index e05e11c53..1c9a365e3 100644 --- a/src/main/java/appeng/items/tools/powered/powersink/RedstoneFlux.java +++ b/src/main/java/appeng/items/tools/powered/powersink/RedstoneFlux.java @@ -29,7 +29,7 @@ import appeng.integration.IntegrationType; @Interface( iface = "cofh.api.energy.IEnergyContainerItem", iname = IntegrationType.RFItem ) -public abstract class RedstoneFlux extends IC2 implements IEnergyContainerItem +public abstract class RedstoneFlux extends AERootPoweredItem implements IEnergyContainerItem { public RedstoneFlux( final double powerCapacity ) { diff --git a/src/main/java/appeng/items/tools/quartz/ToolQuartzCuttingKnife.java b/src/main/java/appeng/items/tools/quartz/ToolQuartzCuttingKnife.java index 80c9023f3..b54cc59eb 100644 --- a/src/main/java/appeng/items/tools/quartz/ToolQuartzCuttingKnife.java +++ b/src/main/java/appeng/items/tools/quartz/ToolQuartzCuttingKnife.java @@ -50,7 +50,7 @@ public class ToolQuartzCuttingKnife extends AEBaseItem implements IGuiItem } @Override - public EnumActionResult onItemUse( final ItemStack stack, final EntityPlayer p, final World worldIn, final BlockPos pos, final EnumHand hand, final EnumFacing side, final float hitX, final float hitY, final float hitZ ) + public EnumActionResult onItemUse( final EntityPlayer p, final World worldIn, final BlockPos pos, final EnumHand hand, final EnumFacing side, final float hitX, final float hitY, final float hitZ ) { if( Platform.isServer() ) { @@ -60,14 +60,14 @@ public class ToolQuartzCuttingKnife extends AEBaseItem implements IGuiItem } @Override - public ActionResult onItemRightClick( final ItemStack it, final World w, final EntityPlayer p, final EnumHand hand ) + public ActionResult onItemRightClick( final World w, final EntityPlayer p, final EnumHand hand ) { if( Platform.isServer() ) { Platform.openGUI( p, null, AEPartLocation.INTERNAL, GuiBridge.GUI_QUARTZ_KNIFE ); } p.swingArm( hand ); - return new ActionResult( EnumActionResult.SUCCESS, it ); + return new ActionResult( EnumActionResult.SUCCESS, p.getHeldItemMainhand() ); } @Override diff --git a/src/main/java/appeng/items/tools/quartz/ToolQuartzWrench.java b/src/main/java/appeng/items/tools/quartz/ToolQuartzWrench.java index 836522882..cf43fdc13 100644 --- a/src/main/java/appeng/items/tools/quartz/ToolQuartzWrench.java +++ b/src/main/java/appeng/items/tools/quartz/ToolQuartzWrench.java @@ -47,7 +47,7 @@ public class ToolQuartzWrench extends AEBaseItem implements IAEWrench /* , ITool } @Override - public EnumActionResult onItemUseFirst( final ItemStack stack, final EntityPlayer player, final World world, final BlockPos pos, final EnumFacing side, final float hitX, final float hitY, final float hitZ, final EnumHand hand ) + public EnumActionResult onItemUseFirst( final EntityPlayer player, final World world, final BlockPos pos, final EnumFacing side, final float hitX, final float hitY, final float hitZ, final EnumHand hand ) { final Block b = world.getBlockState( pos ).getBlock(); if( b != null && !player.isSneaking() && Platform.hasPermissions( new DimensionalCoord( world, pos ), player ) ) @@ -60,7 +60,7 @@ public class ToolQuartzWrench extends AEBaseItem implements IAEWrench /* , ITool if( b.rotateBlock( world, pos, side ) ) { - b.neighborChanged( Platform.AIR_BLOCK.getDefaultState(), world, pos, Platform.AIR_BLOCK ); + b.neighborChanged( Platform.AIR_BLOCK.getDefaultState(), world, pos, Platform.AIR_BLOCK, pos ); player.swingArm( hand ); return !world.isRemote ? EnumActionResult.SUCCESS : EnumActionResult.FAIL; } diff --git a/src/main/java/appeng/me/cluster/MBCalculator.java b/src/main/java/appeng/me/cluster/MBCalculator.java index cacd4bc29..2a352b72d 100644 --- a/src/main/java/appeng/me/cluster/MBCalculator.java +++ b/src/main/java/appeng/me/cluster/MBCalculator.java @@ -162,7 +162,7 @@ public abstract class MBCalculator */ public abstract IAECluster createCluster( World w, WorldCoord min, WorldCoord max ); - public abstract boolean verifyInternalStructure( World worldObj, WorldCoord min, WorldCoord max ); + public abstract boolean verifyInternalStructure( World world, WorldCoord min, WorldCoord max ); /** * disassembles the multi-block. diff --git a/src/main/java/appeng/me/cluster/implementations/CraftingCPUCluster.java b/src/main/java/appeng/me/cluster/implementations/CraftingCPUCluster.java index cfae99af4..a29e50b44 100644 --- a/src/main/java/appeng/me/cluster/implementations/CraftingCPUCluster.java +++ b/src/main/java/appeng/me/cluster/implementations/CraftingCPUCluster.java @@ -506,7 +506,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU final IAEItemStack ais = this.inventory.extractItems( fuzz, Actionable.SIMULATE, this.machineSrc ); final ItemStack is = ais == null ? null : ais.getItemStack(); - if( is != null && is.stackSize == g.getStackSize() ) + if( is != null && is.getCount() == g.getStackSize() ) { found = true; break; @@ -514,7 +514,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU else if( is != null ) { g = g.copy(); - g.decStackSize( is.stackSize ); + g.decStackSize( is.getCount() ); } } @@ -528,7 +528,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU final IAEItemStack ais = this.inventory.extractItems( g.copy(), Actionable.SIMULATE, this.machineSrc ); final ItemStack is = ais == null ? null : ais.getItemStack(); - if( is == null || is.stackSize < g.getStackSize() ) + if( is == null || is.getCount() < g.getStackSize() ) { return false; } @@ -714,7 +714,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU { this.postChange( input[x], this.machineSrc ); ic.setInventorySlotContents( x, is ); - if( is.stackSize == input[x].getStackSize() ) + if( is.getCount() == input[x].getStackSize() ) { found = true; continue; diff --git a/src/main/java/appeng/me/storage/CellInventory.java b/src/main/java/appeng/me/storage/CellInventory.java index 72e183e71..465835636 100644 --- a/src/main/java/appeng/me/storage/CellInventory.java +++ b/src/main/java/appeng/me/storage/CellInventory.java @@ -270,14 +270,14 @@ public class CellInventory implements ICellInventory if( input.getStackSize() > remainingItemCount ) { final ItemStack toReturn = Platform.cloneItemStack( sharedItemStack ); - toReturn.stackSize = sharedItemStack.stackSize - remainingItemCount; + toReturn.setCount( sharedItemStack.getCount() - remainingItemCount ); if( mode == Actionable.MODULATE ) { final ItemStack toWrite = Platform.cloneItemStack( sharedItemStack ); - toWrite.stackSize = remainingItemCount; + toWrite.setCount( remainingItemCount ); this.cellItems.add( AEItemStack.create( toWrite ) ); - this.updateItemCount( toWrite.stackSize ); + this.updateItemCount( toWrite.getCount() ); this.saveChanges(); } @@ -461,7 +461,7 @@ public class CellInventory implements ICellInventory final ItemStack t; try { - t = ItemStack.loadItemStackFromNBT( compoundTag ); + t = new ItemStack( compoundTag ); if( t == null ) { AELog.warn( "Removing item " + compoundTag + " from storage cell because the associated item type couldn't be found." ); @@ -478,9 +478,9 @@ public class CellInventory implements ICellInventory throw ex; } - t.stackSize = stackSize; + t.setCount( stackSize ); - if( t.stackSize > 0 ) + if( t.getCount() > 0 ) { try { @@ -555,7 +555,8 @@ public class CellInventory implements ICellInventory public boolean canHoldNewItem() { final long bytesFree = this.getFreeBytes(); - return ( bytesFree > this.getBytesPerType() || ( bytesFree == this.getBytesPerType() && this.getUnusedItemCount() > 0 ) ) && this.getRemainingItemTypes() > 0; + return ( bytesFree > this.getBytesPerType() || ( bytesFree == this.getBytesPerType() && this.getUnusedItemCount() > 0 ) ) && this + .getRemainingItemTypes() > 0; } @Override diff --git a/src/main/java/appeng/me/storage/MEMonitorIInventory.java b/src/main/java/appeng/me/storage/MEMonitorIInventory.java index 6c3888d70..a95697964 100644 --- a/src/main/java/appeng/me/storage/MEMonitorIInventory.java +++ b/src/main/java/appeng/me/storage/MEMonitorIInventory.java @@ -98,7 +98,7 @@ public class MEMonitorIInventory implements IMEMonitor, ITickingMo // better then doing construction from scratch :3 final IAEItemStack o = input.copy(); - o.setStackSize( out.stackSize ); + o.setStackSize( out.getCount() ); return o; } @@ -123,7 +123,7 @@ public class MEMonitorIInventory implements IMEMonitor, ITickingMo // better then doing construction from scratch :3 final IAEItemStack o = request.copy(); - o.setStackSize( out.stackSize ); + o.setStackSize( out.getCount() ); if( type == Actionable.MODULATE ) { @@ -177,8 +177,8 @@ public class MEMonitorIInventory implements IMEMonitor, ITickingMo } else { - final int newSize = ( newIS == null ? 0 : newIS.stackSize ); - final int diff = newSize - ( oldIS == null ? 0 : oldIS.stackSize ); + final int newSize = ( newIS == null ? 0 : newIS.getCount() ); + final int diff = newSize - ( oldIS == null ? 0 : oldIS.getCount() ); final IAEItemStack stack = ( old == null || old.aeStack == null ? AEApi.instance().storage().createItemStack( newIS ) : old.aeStack.copy() ); if( stack != null ) diff --git a/src/main/java/appeng/parts/AEBasePart.java b/src/main/java/appeng/parts/AEBasePart.java index c54725b8d..f0d9b0c44 100644 --- a/src/main/java/appeng/parts/AEBasePart.java +++ b/src/main/java/appeng/parts/AEBasePart.java @@ -119,13 +119,13 @@ public abstract class AEBasePart implements IPart, IGridProxyable, IActionHost, @Override public void securityBreak() { - if( this.getItemStack().stackSize > 0 ) + if( this.getItemStack().getCount() > 0 ) { final List items = new ArrayList(); items.add( this.is.copy() ); this.host.removePart( this.side, false ); Platform.spawnDrops( this.tile.getWorld(), this.tile.getPos(), items ); - this.is.stackSize = 0; + this.is.setCount( 0 ); } } diff --git a/src/main/java/appeng/parts/CableBusContainer.java b/src/main/java/appeng/parts/CableBusContainer.java index e806283bb..cbbf74b0e 100644 --- a/src/main/java/appeng/parts/CableBusContainer.java +++ b/src/main/java/appeng/parts/CableBusContainer.java @@ -143,7 +143,7 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I final IPartItem bi = (IPartItem) is.getItem(); is = is.copy(); - is.stackSize = 1; + is.setCount( 1 ); final IPart bp = bi.createPartFromItemStack( is ); if( bp != null ) @@ -191,7 +191,7 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I final IPartItem bi = (IPartItem) is.getItem(); is = is.copy(); - is.stackSize = 1; + is.setCount( 1 ); final IPart bp = bi.createPartFromItemStack( is ); if( bp instanceof IPartCable ) @@ -1051,7 +1051,7 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I if( def != null && extra != null ) { IPart p = this.getPart( side ); - final ItemStack iss = ItemStack.loadItemStackFromNBT( def ); + final ItemStack iss = new ItemStack( def ); if( iss == null ) { continue; diff --git a/src/main/java/appeng/parts/PartPlacement.java b/src/main/java/appeng/parts/PartPlacement.java index 40d15d798..a9f91aa03 100644 --- a/src/main/java/appeng/parts/PartPlacement.java +++ b/src/main/java/appeng/parts/PartPlacement.java @@ -55,7 +55,7 @@ import appeng.api.parts.PartItemStack; import appeng.api.parts.SelectedPart; import appeng.api.util.AEPartLocation; import appeng.api.util.DimensionalCoord; -import appeng.core.CommonHelper; +import appeng.core.AppEng; import appeng.core.sync.network.NetworkHandler; import appeng.core.sync.packets.PacketClick; import appeng.core.sync.packets.PacketPartPlacement; @@ -104,7 +104,8 @@ public class PartPlacement if( mop != null ) { final List is = new LinkedList(); - final SelectedPart sp = selectPart( player, host, mop.hitVec.addVector( -mop.getBlockPos().getX(), -mop.getBlockPos().getY(), -mop.getBlockPos().getZ() ) ); + final SelectedPart sp = selectPart( player, host, + mop.hitVec.addVector( -mop.getBlockPos().getX(), -mop.getBlockPos().getY(), -mop.getBlockPos().getZ() ) ); if( sp.part != null ) { @@ -172,10 +173,11 @@ public class PartPlacement host.markForUpdate(); if( !player.capabilities.isCreativeMode ) { - held.stackSize--; - if( held.stackSize == 0 ) + held.grow( -1 ); + ; + if( held.getCount() == 0 ) { - player.inventory.mainInventory[player.inventory.currentItem] = null; + player.inventory.mainInventory.add( player.inventory.currentItem, null ); MinecraftForge.EVENT_BUS.post( new PlayerDestroyItemEvent( player, held, hand ) ); } } @@ -259,7 +261,8 @@ public class PartPlacement final boolean multiPartPresent = maybeMultiPartBlock.isPresent() && maybeMultiPartStack.isPresent() && maybeMultiPartItemBlock.isPresent(); final boolean canMultiPartBePlaced = maybeMultiPartBlock.get().canPlaceBlockAt( world, te_pos ); - if( hostIsNotPresent && multiPartPresent && canMultiPartBePlaced && maybeMultiPartItemBlock.get().placeBlockAt( maybeMultiPartStack.get(), player, world, te_pos, side, 0.5f, 0.5f, 0.5f, maybeMultiPartBlock.get().getDefaultState() ) ) + if( hostIsNotPresent && multiPartPresent && canMultiPartBePlaced && maybeMultiPartItemBlock.get().placeBlockAt( maybeMultiPartStack.get(), player, + world, te_pos, side, 0.5f, 0.5f, 0.5f, maybeMultiPartBlock.get().getDefaultState() ) ) { if( !world.isRemote ) { @@ -300,7 +303,8 @@ public class PartPlacement if( blkID == null || blkID.isReplaceable( world, te_pos ) || host != null ) { - return place( held, te_pos, side.getOpposite(), player, hand, world, pass == PlaceType.INTERACT_FIRST_PASS ? PlaceType.INTERACT_SECOND_PASS : PlaceType.PLACE_ITEM, depth + 1 ); + return place( held, te_pos, side.getOpposite(), player, hand, world, + pass == PlaceType.INTERACT_FIRST_PASS ? PlaceType.INTERACT_SECOND_PASS : PlaceType.PLACE_ITEM, depth + 1 ); } } return EnumActionResult.PASS; @@ -314,7 +318,8 @@ public class PartPlacement if( mop != null ) { - final SelectedPart sp = selectPart( player, host, mop.hitVec.addVector( -mop.getBlockPos().getX(), -mop.getBlockPos().getY(), -mop.getBlockPos().getZ() ) ); + final SelectedPart sp = selectPart( player, host, + mop.hitVec.addVector( -mop.getBlockPos().getX(), -mop.getBlockPos().getY(), -mop.getBlockPos().getZ() ) ); if( sp.part != null ) { @@ -334,18 +339,20 @@ public class PartPlacement final AEPartLocation mySide = host.addPart( held, AEPartLocation.fromFacing( side ), player, hand ); if( mySide != null ) { - multiPart.maybeBlock().ifPresent( multiPartBlock -> { - final SoundType ss = multiPartBlock.getSoundType(state, world, pos, player); + multiPart.maybeBlock().ifPresent( multiPartBlock -> + { + final SoundType ss = multiPartBlock.getSoundType( state, world, pos, player ); world.playSound( null, pos, ss.getPlaceSound(), SoundCategory.BLOCKS, ( ss.getVolume() + 1.0F ) / 2.0F, ss.getPitch() * 0.8F ); - }); + } ); if( !player.capabilities.isCreativeMode ) { - held.stackSize--; - if( held.stackSize == 0 ) + held.grow( -1 ); + ; + if( held.getCount() == 0 ) { - player.inventory.mainInventory[player.inventory.currentItem] = null; + player.inventory.mainInventory.add( player.inventory.currentItem, null ); MinecraftForge.EVENT_BUS.post( new PlayerDestroyItemEvent( player, held, hand ) ); } } @@ -360,7 +367,7 @@ public class PartPlacement private static float getEyeOffset( final EntityPlayer p ) { - if( p.worldObj.isRemote ) + if( p.world.isRemote ) { return Platform.getEyeOffset( p ); } @@ -370,9 +377,9 @@ public class PartPlacement private static SelectedPart selectPart( final EntityPlayer player, final IPartHost host, final Vec3d pos ) { - CommonHelper.proxy.updateRenderMode( player ); + AppEng.proxy.updateRenderMode( player ); final SelectedPart sp = host.selectPart( pos ); - CommonHelper.proxy.updateRenderMode( null ); + AppEng.proxy.updateRenderMode( null ); return sp; } @@ -402,7 +409,7 @@ public class PartPlacement return; } - if( event instanceof PlayerInteractEvent.RightClickEmpty && event.getEntityPlayer().worldObj.isRemote ) + if( event instanceof PlayerInteractEvent.RightClickEmpty && event.getEntityPlayer().world.isRemote ) { // re-check to see if this event was already channeled, cause these two events are really stupid... final RayTraceResult mop = Platform.rayTrace( event.getEntityPlayer(), true, false ); @@ -414,7 +421,7 @@ public class PartPlacement if( mop != null && mop.hitVec.distanceTo( vec3 ) < d0 ) { - final World w = event.getEntity().worldObj; + final World w = event.getEntity().world; final TileEntity te = w.getTileEntity( mop.getBlockPos() ); if( te instanceof IPartHost && this.wasCanceled ) { @@ -435,7 +442,7 @@ public class PartPlacement } } } - else if( event instanceof PlayerInteractEvent.RightClickBlock && !event.getEntityPlayer().worldObj.isRemote ) + else if( event instanceof PlayerInteractEvent.RightClickBlock && !event.getEntityPlayer().world.isRemote ) { if( this.placing.get() != null ) { @@ -445,7 +452,8 @@ public class PartPlacement this.placing.set( event ); final ItemStack held = event.getEntityPlayer().getHeldItem( event.getHand() ); - if( place( held, event.getPos(), event.getFace(), event.getEntityPlayer(), event.getHand(), event.getEntityPlayer().worldObj, PlaceType.INTERACT_FIRST_PASS, 0 ) == EnumActionResult.SUCCESS ) + if( place( held, event.getPos(), event.getFace(), event.getEntityPlayer(), event.getHand(), event.getEntityPlayer().world, + PlaceType.INTERACT_FIRST_PASS, 0 ) == EnumActionResult.SUCCESS ) { event.setCanceled( true ); this.wasCanceled = true; diff --git a/src/main/java/appeng/parts/automation/PartAnnihilationPlane.java b/src/main/java/appeng/parts/automation/PartAnnihilationPlane.java index dd5e5f384..2643423b2 100644 --- a/src/main/java/appeng/parts/automation/PartAnnihilationPlane.java +++ b/src/main/java/appeng/parts/automation/PartAnnihilationPlane.java @@ -56,13 +56,13 @@ import appeng.api.parts.IPartModel; import appeng.api.storage.data.IAEItemStack; import appeng.api.util.AECableType; import appeng.api.util.AEPartLocation; +import appeng.core.AppEng; import appeng.core.settings.TickRates; import appeng.core.sync.packets.PacketTransitionEffect; import appeng.hooks.TickHandler; import appeng.items.parts.PartModels; import appeng.me.GridAccessException; import appeng.parts.PartBasicState; -import appeng.server.ServerHelper; import appeng.util.IWorldCallable; import appeng.util.Platform; import appeng.util.item.AEItemStack; @@ -292,8 +292,7 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab if( changed ) { - ServerHelper.proxy.sendToAllNearExcept( null, pos.getX(), pos.getY(), pos.getZ(), 64, this.getTile().getWorld(), - new PacketTransitionEffect( entity.posX, entity.posY, entity.posZ, this.getSide(), false ) ); + AppEng.proxy.sendToAllNearExcept( null, pos.getX(), pos.getY(), pos.getZ(), 64, this.getTile().getWorld(), new PacketTransitionEffect( entity.posX, entity.posY, entity.posZ, this.getSide(), false ) ); } } } @@ -368,11 +367,11 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab return true; } - final int oldStackSize = entityItem.getEntityItem().stackSize; + final int oldStackSize = entityItem.getEntityItem().getCount(); final int newStackSize = (int) overflow.getStackSize(); final boolean changed = oldStackSize != newStackSize; - entityItem.getEntityItem().stackSize = newStackSize; + entityItem.getEntityItem().setCount( newStackSize ); return changed; } @@ -402,7 +401,7 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab overflowEntity.motionY = 0; overflowEntity.motionZ = 0; - w.spawnEntityInWorld( overflowEntity ); + w.spawnEntity( overflowEntity ); } protected boolean isAnnihilationPlane( final TileEntity blockTileEntity, final AEPartLocation side ) @@ -457,8 +456,7 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab { energy.extractAEPower( requiredPower, Actionable.MODULATE, PowerMultiplier.CONFIG ); this.breakBlockAndStoreItems( w, pos, items ); - ServerHelper.proxy.sendToAllNearExcept( null, pos.getX(), pos.getY(), pos.getZ(), 64, w, - new PacketTransitionEffect( pos.getX(), pos.getY(), pos.getZ(), this.getSide(), true ) ); + AppEng.proxy.sendToAllNearExcept( null, pos.getX(), pos.getY(), pos.getZ(), 64, w, new PacketTransitionEffect( pos.getX(), pos.getY(), pos.getZ(), this.getSide(), true ) ); } else { @@ -531,7 +529,7 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab float requiredEnergy = 1 + hardness; for( final ItemStack is : items ) { - requiredEnergy += is.stackSize; + requiredEnergy += is.getCount(); } return requiredEnergy; diff --git a/src/main/java/appeng/parts/automation/PartExportBus.java b/src/main/java/appeng/parts/automation/PartExportBus.java index 0d7c9078c..1c87bd020 100644 --- a/src/main/java/appeng/parts/automation/PartExportBus.java +++ b/src/main/java/appeng/parts/automation/PartExportBus.java @@ -305,10 +305,10 @@ public class PartExportBus extends PartSharedItemBus implements ICraftingRequest private void pushItemIntoTarget( final InventoryAdaptor d, final IEnergyGrid energy, final IMEInventory inv, IAEItemStack ais ) { final ItemStack is = ais.getItemStack(); - is.stackSize = (int) this.itemToSend; + is.setCount( (int) this.itemToSend ); final ItemStack o = d.simulateAdd( is ); - final long canFit = o == null ? this.itemToSend : this.itemToSend - o.stackSize; + final long canFit = o == null ? this.itemToSend : this.itemToSend - o.getCount(); if( canFit > 0 ) { @@ -323,7 +323,7 @@ public class PartExportBus extends PartSharedItemBus implements ICraftingRequest final ItemStack failed = d.addItems( itemsToAdd.getItemStack() ); if( failed != null ) { - ais.setStackSize( failed.stackSize ); + ais.setStackSize( failed.getCount() ); inv.injectItems( ais, Actionable.MODULATE, this.mySrc ); } else diff --git a/src/main/java/appeng/parts/automation/PartFormationPlane.java b/src/main/java/appeng/parts/automation/PartFormationPlane.java index b9386be73..ca658b3b5 100644 --- a/src/main/java/appeng/parts/automation/PartFormationPlane.java +++ b/src/main/java/appeng/parts/automation/PartFormationPlane.java @@ -471,7 +471,7 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine * } */ - maxStorage = is.stackSize; + maxStorage = is.getCount(); worked = true; if( type == Actionable.MODULATE ) { @@ -481,33 +481,33 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine if( side.xOffset == 0 && side.zOffset == 0 ) { - Worked = i.onItemUse( is, player, w, tePos.offset( side.getFacing() ), null, side.getFacing().getOpposite(), side.xOffset, + Worked = i.onItemUse( player, w, tePos.offset( side.getFacing() ), null, side.getFacing().getOpposite(), side.xOffset, side.yOffset, side.zOffset ) == EnumActionResult.SUCCESS; } if( !Worked && side.xOffset == 0 && side.zOffset == 0 ) { - Worked = i.onItemUse( is, player, w, tePos.offset( side.getFacing().getOpposite() ), null, side.getFacing(), side.xOffset, + Worked = i.onItemUse( player, w, tePos.offset( side.getFacing().getOpposite() ), null, side.getFacing(), side.xOffset, side.yOffset, side.zOffset ) == EnumActionResult.SUCCESS; } if( !Worked && side.yOffset == 0 ) { - Worked = i.onItemUse( is, player, w, tePos.offset( EnumFacing.DOWN ), null, EnumFacing.UP, side.xOffset, side.yOffset, + Worked = i.onItemUse( player, w, tePos.offset( EnumFacing.DOWN ), null, EnumFacing.UP, side.xOffset, side.yOffset, side.zOffset ) == EnumActionResult.SUCCESS; } if( !Worked ) { - i.onItemUse( is, player, w, tePos, null, side.getFacing().getOpposite(), side.xOffset, side.yOffset, side.zOffset ); + i.onItemUse( player, w, tePos, null, side.getFacing().getOpposite(), side.xOffset, side.yOffset, side.zOffset ); } - maxStorage -= is.stackSize; + maxStorage -= is.getCount(); } else { - i.onItemUse( is, player, w, tePos, null, side.getFacing().getOpposite(), side.xOffset, side.yOffset, side.zOffset ); - maxStorage -= is.stackSize; + i.onItemUse( player, w, tePos, null, side.getFacing().getOpposite(), side.xOffset, side.yOffset, side.zOffset ); + maxStorage -= is.getCount(); } } else @@ -534,7 +534,7 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine { if( type == Actionable.MODULATE ) { - is.stackSize = (int) maxStorage; + is.setCount( (int) maxStorage ); final double x = ( side.xOffset != 0 ? 0 : .7 * ( Platform.getRandomFloat() - .5 ) ) + side.xOffset + .5 + te.getPos().getX(); final double y = ( side.yOffset != 0 ? 0 : .7 * ( Platform.getRandomFloat() - .5 ) ) + side.yOffset + .5 + te.getPos().getY(); final double z = ( side.zOffset != 0 ? 0 : .7 * ( Platform.getRandomFloat() - .5 ) ) + side.zOffset + .5 + te.getPos().getZ(); @@ -560,7 +560,7 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine } } - if( !w.spawnEntityInWorld( result ) ) + if( !w.spawnEntity( result ) ) { result.setDead(); worked = false; diff --git a/src/main/java/appeng/parts/automation/PartImportBus.java b/src/main/java/appeng/parts/automation/PartImportBus.java index 730423086..eb655d979 100644 --- a/src/main/java/appeng/parts/automation/PartImportBus.java +++ b/src/main/java/appeng/parts/automation/PartImportBus.java @@ -99,7 +99,7 @@ public class PartImportBus extends PartSharedItemBus implements IInventoryDestin { return true; } - return out.getStackSize() != stack.stackSize; + return out.getStackSize() != stack.getCount(); } @Override @@ -226,9 +226,9 @@ public class PartImportBus extends PartSharedItemBus implements IInventoryDestin if( newItems != null ) { - newItems.stackSize = (int) ( Math.min( newItems.stackSize, - energy.extractAEPower( newItems.stackSize, Actionable.SIMULATE, PowerMultiplier.CONFIG ) ) + 0.01 ); - this.itemToSend -= newItems.stackSize; + newItems.setCount( (int) ( Math.min( newItems.getCount(), + energy.extractAEPower( newItems.getCount(), Actionable.SIMULATE, PowerMultiplier.CONFIG ) ) + 0.01 ) ); + this.itemToSend -= newItems.getCount(); if( this.lastItemChecked == null || !this.lastItemChecked.isSameType( newItems ) ) { @@ -236,7 +236,7 @@ public class PartImportBus extends PartSharedItemBus implements IInventoryDestin } else { - this.lastItemChecked.setStackSize( newItems.stackSize ); + this.lastItemChecked.setStackSize( newItems.getCount() ); } final IAEItemStack failed = Platform.poweredInsert( energy, this.destination, this.lastItemChecked, this.source ); @@ -288,7 +288,7 @@ public class PartImportBus extends PartSharedItemBus implements IInventoryDestin if( itemAmountNotStorable != null ) { - return (int) Math.min( simResult.stackSize - itemAmountNotStorable.getStackSize(), toSend ); + return (int) Math.min( simResult.getCount() - itemAmountNotStorable.getStackSize(), toSend ); } return toSend; diff --git a/src/main/java/appeng/parts/layers/LayerIEnergySink.java b/src/main/java/appeng/parts/layers/LayerIEnergySink.java index b000b0882..04d0d2087 100644 --- a/src/main/java/appeng/parts/layers/LayerIEnergySink.java +++ b/src/main/java/appeng/parts/layers/LayerIEnergySink.java @@ -1,204 +1,204 @@ -/* - * 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.parts.layers; - - -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumFacing; -import net.minecraft.world.World; -import net.minecraftforge.common.MinecraftForge; - -import ic2.api.energy.tile.IEnergyAcceptor; -import ic2.api.energy.tile.IEnergyEmitter; -import ic2.api.energy.tile.IEnergySink; -import ic2.api.energy.tile.IEnergyTile; - -import appeng.api.parts.IPart; -import appeng.api.parts.IPartHost; -import appeng.api.parts.LayerBase; -import appeng.api.parts.LayerFlags; -import appeng.util.Platform; - - -public class LayerIEnergySink extends LayerBase implements IEnergySink -{ - - private TileEntity getEnergySinkTile() - { - IPartHost host = (IPartHost) this; - return host.getTile(); - } - - private World getEnergySinkWorld() - { - if( this.getEnergySinkTile() == null ) - { - return null; - } - - return this.getEnergySinkTile().getWorld(); - } - - private boolean isTileValid() - { - TileEntity te = this.getEnergySinkTile(); - - if( te == null ) - { - return false; - } - - return !te.isInvalid() && te.getWorld().isBlockLoaded( te.getPos() ); - } - - private void addToENet() - { - if( this.getEnergySinkWorld() == null ) - { - return; - } - - // re-add - this.removeFromENet(); - - if( !this.isInIC2() && Platform.isServer() && this.isTileValid() ) - { - this.getLayerFlags().add( LayerFlags.IC2_ENET ); - MinecraftForge.EVENT_BUS.post( new ic2.api.energy.event.EnergyTileLoadEvent( (IEnergyTile) this.getEnergySinkTile() ) ); - } - } - - private void removeFromENet() - { - if( this.getEnergySinkWorld() == null ) - { - return; - } - - if( this.isInIC2() && Platform.isServer() ) - { - this.getLayerFlags().remove( LayerFlags.IC2_ENET ); - MinecraftForge.EVENT_BUS.post( new ic2.api.energy.event.EnergyTileUnloadEvent( (IEnergyTile) this.getEnergySinkTile() ) ); - } - } - - private boolean interestedInIC2() - { - if( !( (IPartHost) this ).isInWorld() ) - { - return false; - } - - int interested = 0; - for( EnumFacing dir : EnumFacing.values() ) - { - IPart part = this.getPart( dir ); - if( part instanceof IEnergyTile ) - { - interested++; - } - } - return interested == 1;// if more then one tile is interested we need to abandon... - } - - @Override - public void partChanged() - { - super.partChanged(); - - if( this.interestedInIC2() ) - { - this.addToENet(); - } - else - { - this.removeFromENet(); - } - } - - @Override - public boolean acceptsEnergyFrom( IEnergyEmitter emitter, EnumFacing direction ) - { - if( !this.isInIC2() ) - { - return false; - } - - IPart part = this.getPart( direction ); - if( part instanceof IEnergySink ) - { - return ( (IEnergyAcceptor) part ).acceptsEnergyFrom( emitter, direction ); - } - return false; - } - - private boolean isInIC2() - { - return this.getLayerFlags().contains( LayerFlags.IC2_ENET ); - } - - @Override - public double getDemandedEnergy() - { - if( !this.isInIC2() ) - { - return 0; - } - - // this is a flawed implementation, that requires a change to the IC2 API. - - for( EnumFacing dir : EnumFacing.values() ) - { - IPart part = this.getPart( dir ); - if( part instanceof IEnergySink ) - { - // use lower number cause ic2 deletes power it sends that isn't received. - return ( (IEnergySink) part ).getDemandedEnergy(); - } - } - - return 0; - } - - @Override - public int getSinkTier() - { - return Integer.MAX_VALUE; // no real options here... - } - - @Override - public double injectEnergy( EnumFacing directionFrom, double amount, double voltage ) - { - if( !this.isInIC2() ) - { - return amount; - } - - for( EnumFacing dir : EnumFacing.values() ) - { - IPart part = this.getPart( dir ); - if( part instanceof IEnergySink ) - { - return ( (IEnergySink) part ).injectEnergy( directionFrom, amount, voltage ); - } - } - - return amount; - } -} +///* +// * 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.parts.layers; +// +// +//import net.minecraft.tileentity.TileEntity; +//import net.minecraft.util.EnumFacing; +//import net.minecraft.world.World; +//import net.minecraftforge.common.MinecraftForge; +// +//import ic2.api.energy.tile.IEnergyAcceptor; +//import ic2.api.energy.tile.IEnergyEmitter; +//import ic2.api.energy.tile.IEnergySink; +//import ic2.api.energy.tile.IEnergyTile; +// +//import appeng.api.parts.IPart; +//import appeng.api.parts.IPartHost; +//import appeng.api.parts.LayerBase; +//import appeng.api.parts.LayerFlags; +//import appeng.util.Platform; +// +// +//public class LayerIEnergySink extends LayerBase implements IEnergySink +//{ +// +// private TileEntity getEnergySinkTile() +// { +// IPartHost host = (IPartHost) this; +// return host.getTile(); +// } +// +// private World getEnergySinkWorld() +// { +// if( this.getEnergySinkTile() == null ) +// { +// return null; +// } +// +// return this.getEnergySinkTile().getWorld(); +// } +// +// private boolean isTileValid() +// { +// TileEntity te = this.getEnergySinkTile(); +// +// if( te == null ) +// { +// return false; +// } +// +// return !te.isInvalid() && te.getWorld().isBlockLoaded( te.getPos() ); +// } +// +// private void addToENet() +// { +// if( this.getEnergySinkWorld() == null ) +// { +// return; +// } +// +// // re-add +// this.removeFromENet(); +// +// if( !this.isInIC2() && Platform.isServer() && this.isTileValid() ) +// { +// this.getLayerFlags().add( LayerFlags.IC2_ENET ); +// MinecraftForge.EVENT_BUS.post( new ic2.api.energy.event.EnergyTileLoadEvent( (IEnergyTile) this.getEnergySinkTile() ) ); +// } +// } +// +// private void removeFromENet() +// { +// if( this.getEnergySinkWorld() == null ) +// { +// return; +// } +// +// if( this.isInIC2() && Platform.isServer() ) +// { +// this.getLayerFlags().remove( LayerFlags.IC2_ENET ); +// MinecraftForge.EVENT_BUS.post( new ic2.api.energy.event.EnergyTileUnloadEvent( (IEnergyTile) this.getEnergySinkTile() ) ); +// } +// } +// +// private boolean interestedInIC2() +// { +// if( !( (IPartHost) this ).isInWorld() ) +// { +// return false; +// } +// +// int interested = 0; +// for( EnumFacing dir : EnumFacing.values() ) +// { +// IPart part = this.getPart( dir ); +// if( part instanceof IEnergyTile ) +// { +// interested++; +// } +// } +// return interested == 1;// if more then one tile is interested we need to abandon... +// } +// +// @Override +// public void partChanged() +// { +// super.partChanged(); +// +// if( this.interestedInIC2() ) +// { +// this.addToENet(); +// } +// else +// { +// this.removeFromENet(); +// } +// } +// +// @Override +// public boolean acceptsEnergyFrom( IEnergyEmitter emitter, EnumFacing direction ) +// { +// if( !this.isInIC2() ) +// { +// return false; +// } +// +// IPart part = this.getPart( direction ); +// if( part instanceof IEnergySink ) +// { +// return ( (IEnergyAcceptor) part ).acceptsEnergyFrom( emitter, direction ); +// } +// return false; +// } +// +// private boolean isInIC2() +// { +// return this.getLayerFlags().contains( LayerFlags.IC2_ENET ); +// } +// +// @Override +// public double getDemandedEnergy() +// { +// if( !this.isInIC2() ) +// { +// return 0; +// } +// +// // this is a flawed implementation, that requires a change to the IC2 API. +// +// for( EnumFacing dir : EnumFacing.values() ) +// { +// IPart part = this.getPart( dir ); +// if( part instanceof IEnergySink ) +// { +// // use lower number cause ic2 deletes power it sends that isn't received. +// return ( (IEnergySink) part ).getDemandedEnergy(); +// } +// } +// +// return 0; +// } +// +// @Override +// public int getSinkTier() +// { +// return Integer.MAX_VALUE; // no real options here... +// } +// +// @Override +// public double injectEnergy( EnumFacing directionFrom, double amount, double voltage ) +// { +// if( !this.isInIC2() ) +// { +// return amount; +// } +// +// for( EnumFacing dir : EnumFacing.values() ) +// { +// IPart part = this.getPart( dir ); +// if( part instanceof IEnergySink ) +// { +// return ( (IEnergySink) part ).injectEnergy( directionFrom, amount, voltage ); +// } +// } +// +// return amount; +// } +//} diff --git a/src/main/java/appeng/parts/layers/LayerIEnergySource.java b/src/main/java/appeng/parts/layers/LayerIEnergySource.java index 652492b7e..d81acd087 100644 --- a/src/main/java/appeng/parts/layers/LayerIEnergySource.java +++ b/src/main/java/appeng/parts/layers/LayerIEnergySource.java @@ -1,207 +1,207 @@ -/* - * 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.parts.layers; - - -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumFacing; -import net.minecraft.world.World; -import net.minecraftforge.common.MinecraftForge; - -import ic2.api.energy.tile.IEnergyAcceptor; -import ic2.api.energy.tile.IEnergyEmitter; -import ic2.api.energy.tile.IEnergySource; -import ic2.api.energy.tile.IEnergyTile; - -import appeng.api.parts.IPart; -import appeng.api.parts.IPartHost; -import appeng.api.parts.LayerBase; -import appeng.api.parts.LayerFlags; -import appeng.util.Platform; - - -public class LayerIEnergySource extends LayerBase implements IEnergySource -{ - - private TileEntity getEnergySourceTile() - { - IPartHost host = (IPartHost) this; - return host.getTile(); - } - - private World getEnergySourceWorld() - { - if( this.getEnergySourceTile() == null ) - { - return null; - } - return this.getEnergySourceTile().getWorld(); - } - - private boolean isTileValid() - { - TileEntity te = this.getEnergySourceTile(); - return te != null && !te.isInvalid(); - } - - private void addToENet() - { - if( this.getEnergySourceWorld() == null ) - { - return; - } - - // re-add - this.removeFromENet(); - - if( !this.isInIC2() && Platform.isServer() && this.isTileValid() ) - { - this.getLayerFlags().add( LayerFlags.IC2_ENET ); - MinecraftForge.EVENT_BUS.post( new ic2.api.energy.event.EnergyTileLoadEvent( (IEnergyTile) this.getEnergySourceTile() ) ); - } - } - - private void removeFromENet() - { - if( this.getEnergySourceWorld() == null ) - { - return; - } - - if( this.isInIC2() && Platform.isServer() ) - { - this.getLayerFlags().remove( LayerFlags.IC2_ENET ); - MinecraftForge.EVENT_BUS.post( new ic2.api.energy.event.EnergyTileUnloadEvent( (IEnergyTile) this.getEnergySourceTile() ) ); - } - } - - private boolean interestedInIC2() - { - if( !( (IPartHost) this ).isInWorld() ) - { - return false; - } - - int interested = 0; - for( EnumFacing dir : EnumFacing.values() ) - { - IPart part = this.getPart( dir ); - if( part instanceof IEnergyTile ) - { - interested++; - } - } - return interested == 1;// if more then one tile is interested we need to abandon... - } - - @Override - public void partChanged() - { - super.partChanged(); - - if( this.interestedInIC2() ) - { - this.addToENet(); - } - else - { - this.removeFromENet(); - } - } - - @Override - public boolean emitsEnergyTo( IEnergyAcceptor receiver, EnumFacing direction ) - { - if( !this.isInIC2() ) - { - return false; - } - - IPart part = this.getPart( direction ); - if( part instanceof IEnergyEmitter ) - { - return ( (IEnergyEmitter) part ).emitsEnergyTo( receiver, direction ); - } - return false; - } - - private boolean isInIC2() - { - return this.getLayerFlags().contains( LayerFlags.IC2_ENET ); - } - - @Override - public double getOfferedEnergy() - { - if( !this.isInIC2() ) - { - return 0; - } - - // this is a flawed implementation, that requires a change to the IC2 API. - - for( EnumFacing dir : EnumFacing.values() ) - { - IPart part = this.getPart( dir ); - if( part instanceof IEnergySource ) - { - // use lower number cause ic2 deletes power it sends that isn't received. - return ( (IEnergySource) part ).getOfferedEnergy(); - } - } - - return 0; - } - - @Override - public void drawEnergy( double amount ) - { - // this is a flawed implementation, that requires a change to the IC2 API. - - for( EnumFacing dir : EnumFacing.values() ) - { - IPart part = this.getPart( dir ); - if( part instanceof IEnergySource ) - { - ( (IEnergySource) part ).drawEnergy( amount ); - return; - } - } - } - - @Override - public int getSourceTier() - { - // this is a flawed implementation, that requires a change to the IC2 API. - - for( EnumFacing dir : EnumFacing.values() ) - { - IPart part = this.getPart( dir ); - if( part instanceof IEnergySource ) - { - return ( (IEnergySource) part ).getSourceTier(); - } - } - - return 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.parts.layers; +// +// +//import net.minecraft.tileentity.TileEntity; +//import net.minecraft.util.EnumFacing; +//import net.minecraft.world.World; +//import net.minecraftforge.common.MinecraftForge; +// +//import ic2.api.energy.tile.IEnergyAcceptor; +//import ic2.api.energy.tile.IEnergyEmitter; +//import ic2.api.energy.tile.IEnergySource; +//import ic2.api.energy.tile.IEnergyTile; +// +//import appeng.api.parts.IPart; +//import appeng.api.parts.IPartHost; +//import appeng.api.parts.LayerBase; +//import appeng.api.parts.LayerFlags; +//import appeng.util.Platform; +// +// +//public class LayerIEnergySource extends LayerBase implements IEnergySource +//{ +// +// private TileEntity getEnergySourceTile() +// { +// IPartHost host = (IPartHost) this; +// return host.getTile(); +// } +// +// private World getEnergySourceWorld() +// { +// if( this.getEnergySourceTile() == null ) +// { +// return null; +// } +// return this.getEnergySourceTile().getWorld(); +// } +// +// private boolean isTileValid() +// { +// TileEntity te = this.getEnergySourceTile(); +// return te != null && !te.isInvalid(); +// } +// +// private void addToENet() +// { +// if( this.getEnergySourceWorld() == null ) +// { +// return; +// } +// +// // re-add +// this.removeFromENet(); +// +// if( !this.isInIC2() && Platform.isServer() && this.isTileValid() ) +// { +// this.getLayerFlags().add( LayerFlags.IC2_ENET ); +// MinecraftForge.EVENT_BUS.post( new ic2.api.energy.event.EnergyTileLoadEvent( (IEnergyTile) this.getEnergySourceTile() ) ); +// } +// } +// +// private void removeFromENet() +// { +// if( this.getEnergySourceWorld() == null ) +// { +// return; +// } +// +// if( this.isInIC2() && Platform.isServer() ) +// { +// this.getLayerFlags().remove( LayerFlags.IC2_ENET ); +// MinecraftForge.EVENT_BUS.post( new ic2.api.energy.event.EnergyTileUnloadEvent( (IEnergyTile) this.getEnergySourceTile() ) ); +// } +// } +// +// private boolean interestedInIC2() +// { +// if( !( (IPartHost) this ).isInWorld() ) +// { +// return false; +// } +// +// int interested = 0; +// for( EnumFacing dir : EnumFacing.values() ) +// { +// IPart part = this.getPart( dir ); +// if( part instanceof IEnergyTile ) +// { +// interested++; +// } +// } +// return interested == 1;// if more then one tile is interested we need to abandon... +// } +// +// @Override +// public void partChanged() +// { +// super.partChanged(); +// +// if( this.interestedInIC2() ) +// { +// this.addToENet(); +// } +// else +// { +// this.removeFromENet(); +// } +// } +// +// @Override +// public boolean emitsEnergyTo( IEnergyAcceptor receiver, EnumFacing direction ) +// { +// if( !this.isInIC2() ) +// { +// return false; +// } +// +// IPart part = this.getPart( direction ); +// if( part instanceof IEnergyEmitter ) +// { +// return ( (IEnergyEmitter) part ).emitsEnergyTo( receiver, direction ); +// } +// return false; +// } +// +// private boolean isInIC2() +// { +// return this.getLayerFlags().contains( LayerFlags.IC2_ENET ); +// } +// +// @Override +// public double getOfferedEnergy() +// { +// if( !this.isInIC2() ) +// { +// return 0; +// } +// +// // this is a flawed implementation, that requires a change to the IC2 API. +// +// for( EnumFacing dir : EnumFacing.values() ) +// { +// IPart part = this.getPart( dir ); +// if( part instanceof IEnergySource ) +// { +// // use lower number cause ic2 deletes power it sends that isn't received. +// return ( (IEnergySource) part ).getOfferedEnergy(); +// } +// } +// +// return 0; +// } +// +// @Override +// public void drawEnergy( double amount ) +// { +// // this is a flawed implementation, that requires a change to the IC2 API. +// +// for( EnumFacing dir : EnumFacing.values() ) +// { +// IPart part = this.getPart( dir ); +// if( part instanceof IEnergySource ) +// { +// ( (IEnergySource) part ).drawEnergy( amount ); +// return; +// } +// } +// } +// +// @Override +// public int getSourceTier() +// { +// // this is a flawed implementation, that requires a change to the IC2 API. +// +// for( EnumFacing dir : EnumFacing.values() ) +// { +// IPart part = this.getPart( dir ); +// if( part instanceof IEnergySource ) +// { +// return ( (IEnergySource) part ).getSourceTier(); +// } +// } +// +// return 0; +// } +// +// +// +//} diff --git a/src/main/java/appeng/parts/misc/ItemHandlerAdapter.java b/src/main/java/appeng/parts/misc/ItemHandlerAdapter.java index b5fe6115c..2e6c29cee 100644 --- a/src/main/java/appeng/parts/misc/ItemHandlerAdapter.java +++ b/src/main/java/appeng/parts/misc/ItemHandlerAdapter.java @@ -100,7 +100,7 @@ class ItemHandlerAdapter implements IMEInventory, IBaseMonitor, IBaseMonitor @@ -127,13 +127,13 @@ class ItemHandlerAdapter implements IMEInventory, IBaseMonitor remainingCurrentSlot ) + if( extracted.getCount() > remainingCurrentSlot ) { // Something broke. It should never return more than we requested... // We're going to silently eat the remainder AELog.warn( "Mod that provided item handler %1 is broken. Returned %2 items, even though we requested %3.", - itemHandler.getClass().getSimpleName(), extracted.stackSize, remainingCurrentSlot ); - extracted.stackSize = remainingCurrentSlot; + itemHandler.getClass().getSimpleName(), extracted.getCount(), remainingCurrentSlot ); + extracted.setCount( remainingCurrentSlot ); } // We're just gonna use the first stack we get our hands on as the template for the rest @@ -143,9 +143,9 @@ class ItemHandlerAdapter implements IMEInventory, IBaseMonitor 0 ); @@ -257,12 +257,12 @@ class ItemHandlerAdapter implements IMEInventory, IBaseMonitor changes ) { // Still the same item, but amount might have changed - long diff = newIS.stackSize - oldAeIS.getStackSize(); + long diff = newIS.getCount() - oldAeIS.getStackSize(); if( diff != 0 ) { IAEItemStack stack = oldAeIS.copy(); - stack.setStackSize( newIS.stackSize ); + stack.setStackSize( newIS.getCount() ); cachedStacks[slot] = newIS; cachedAeStacks[slot] = stack; diff --git a/src/main/java/appeng/parts/misc/PartInterface.java b/src/main/java/appeng/parts/misc/PartInterface.java index 905ef84d3..267756704 100644 --- a/src/main/java/appeng/parts/misc/PartInterface.java +++ b/src/main/java/appeng/parts/misc/PartInterface.java @@ -272,9 +272,9 @@ public class PartInterface extends PartBasicState implements IGridTickable, ISto } @Override - public boolean isUseableByPlayer( final EntityPlayer entityplayer ) + public boolean isUsableByPlayer( final EntityPlayer entityplayer ) { - return this.duality.getStorage().isUseableByPlayer( entityplayer ); + return this.duality.getStorage().isUsableByPlayer( entityplayer ); } @Override @@ -444,4 +444,11 @@ public class PartInterface extends PartBasicState implements IGridTickable, ISto return this.duality.getCapability( capabilityClass, getSide().getFacing() ); } + @Override + public boolean isEmpty() + { + // TODO Auto-generated method stub + return false; + } + } diff --git a/src/main/java/appeng/parts/misc/PartToggleBus.java b/src/main/java/appeng/parts/misc/PartToggleBus.java index f5cde0471..6d9f8ba5c 100644 --- a/src/main/java/appeng/parts/misc/PartToggleBus.java +++ b/src/main/java/appeng/parts/misc/PartToggleBus.java @@ -105,13 +105,13 @@ public class PartToggleBus extends PartBasicState @Override public void securityBreak() { - if( this.getItemStack().stackSize > 0 ) + if( this.getItemStack().getCount() > 0 ) { final List items = new ArrayList(); items.add( this.getItemStack().copy() ); this.getHost().removePart( this.getSide(), false ); Platform.spawnDrops( this.getTile().getWorld(), this.getTile().getPos(), items ); - this.getItemStack().stackSize = 0; + this.getItemStack().setCount( 0 ); } } diff --git a/src/main/java/appeng/parts/p2p/PartP2PIC2Power.java b/src/main/java/appeng/parts/p2p/PartP2PIC2Power.java index a597d8fd2..7b102c83d 100644 --- a/src/main/java/appeng/parts/p2p/PartP2PIC2Power.java +++ b/src/main/java/appeng/parts/p2p/PartP2PIC2Power.java @@ -1,263 +1,263 @@ -/* - * 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.parts.p2p; - - -import java.util.LinkedList; -import java.util.List; - -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.EnumFacing; - -import ic2.api.energy.tile.IEnergyAcceptor; -import ic2.api.energy.tile.IEnergyEmitter; -import ic2.api.energy.tile.IEnergySink; -import ic2.api.energy.tile.IEnergySource; - -import appeng.api.config.PowerUnits; -import appeng.api.parts.IPartModel; -import appeng.coremod.annotations.Integration.Interface; -import appeng.coremod.annotations.Integration.InterfaceList; -import appeng.integration.IntegrationType; -import appeng.items.parts.PartModels; -import appeng.me.GridAccessException; -import appeng.me.cache.helpers.TunnelCollection; -import appeng.util.Platform; - - -@InterfaceList( value = { - @Interface( iface = "ic2.api.energy.tile.IEnergySink", iname = IntegrationType.IC2 ), - @Interface( iface = "ic2.api.energy.tile.IEnergySource", iname = IntegrationType.IC2 ) -} ) -public class PartP2PIC2Power extends PartP2PTunnel implements IEnergySink, IEnergySource -{ - - private static final String TAG_BUFFERED_ENERGY_1 = "bufferedEnergy1"; - private static final String TAG_BUFFERED_ENERGY_2 = "bufferedEnergy2"; - private static final String TAG_BUFFERED_VOLTAGE_1 = "outputPacket1"; - private static final String TAG_BUFFERED_VOLTAGE_2 = "outputPacket2"; - - private static final P2PModels MODELS = new P2PModels( "part/p2p/p2p_tunnel_ic2" ); - - @PartModels - public static List getModels() - { - return MODELS.getModels(); - } - - // Buffer the energy + voltage for two IC2 ENET packets - private double bufferedEnergy1; - private double bufferedVoltage1; - private double bufferedEnergy2; - private double bufferedVoltage2; - - public PartP2PIC2Power( ItemStack is ) - { - super( is ); - } - - @Override - public void readFromNBT( NBTTagCompound tag ) - { - super.readFromNBT( tag ); - this.bufferedEnergy1 = tag.getDouble( TAG_BUFFERED_ENERGY_1 ); - this.bufferedEnergy2 = tag.getDouble( TAG_BUFFERED_ENERGY_2 ); - this.bufferedVoltage1 = tag.getDouble( TAG_BUFFERED_VOLTAGE_1 ); - this.bufferedVoltage2 = tag.getDouble( TAG_BUFFERED_VOLTAGE_2 ); - } - - @Override - public void writeToNBT( NBTTagCompound tag ) - { - super.writeToNBT( tag ); - tag.setDouble( TAG_BUFFERED_ENERGY_1, this.bufferedEnergy1 ); - tag.setDouble( TAG_BUFFERED_ENERGY_2, this.bufferedEnergy2 ); - tag.setDouble( TAG_BUFFERED_VOLTAGE_1, this.bufferedVoltage1 ); - tag.setDouble( TAG_BUFFERED_VOLTAGE_2, this.bufferedVoltage2 ); - } - - @Override - public void onTunnelConfigChange() - { - this.getHost().partChanged(); - } - - @Override - public void onTunnelNetworkChange() - { - this.getHost().notifyNeighbors(); - } - - @Override - public boolean acceptsEnergyFrom( IEnergyEmitter emitter, EnumFacing direction ) - { - return !this.isOutput() && direction == this.getSide().getFacing(); - } - - @Override - public boolean emitsEnergyTo( IEnergyAcceptor receiver, EnumFacing direction ) - { - return this.isOutput() && direction == this.getSide().getFacing(); - } - - @Override - public double getDemandedEnergy() - { - if( this.isOutput() ) - { - return 0; - } - - try - { - for( PartP2PIC2Power t : this.getOutputs() ) - { - if( t.bufferedEnergy1 <= 0.0001 || t.bufferedEnergy2 <= 0.0001 ) - { - return 2048; - } - } - } - catch( GridAccessException e ) - { - return 0; - } - - return 0; - } - - @Override - public int getSinkTier() - { - return 4; - } - - @Override - public double injectEnergy( EnumFacing directionFrom, double amount, double voltage ) - { - TunnelCollection outs; - try - { - outs = this.getOutputs(); - } - catch( GridAccessException e ) - { - return amount; - } - - if( outs.isEmpty() ) - { - return amount; - } - - LinkedList options = new LinkedList<>(); - for( PartP2PIC2Power o : outs ) - { - if( o.bufferedEnergy1 <= 0.01 ) - { - options.add( o ); - } - } - - if( options.isEmpty() ) - { - for( PartP2PIC2Power o : outs ) - { - if( o.bufferedEnergy2 <= 0.01 ) - { - options.add( o ); - } - } - } - - if( options.isEmpty() ) - { - for( PartP2PIC2Power o : outs ) - { - options.add( o ); - } - } - - if( options.isEmpty() ) - { - return amount; - } - - PartP2PIC2Power x = Platform.pickRandom( options ); - - if( x != null && x.bufferedEnergy1 <= 0.001 ) - { - this.queueTunnelDrain( PowerUnits.EU, amount ); - x.bufferedEnergy1 = amount; - x.bufferedVoltage1 = voltage; - return 0; - } - - if( x != null && x.bufferedEnergy2 <= 0.001 ) - { - this.queueTunnelDrain( PowerUnits.EU, amount ); - x.bufferedEnergy2 = amount; - x.bufferedVoltage2 = voltage; - return 0; - } - - return amount; - } - - @Override - public double getOfferedEnergy() - { - if( this.isOutput() ) - { - return this.bufferedEnergy1; - } - return 0; - } - - @Override - public void drawEnergy( double amount ) - { - this.bufferedEnergy1 -= amount; - if( this.bufferedEnergy1 < 0.001 ) - { - this.bufferedEnergy1 = this.bufferedEnergy2; - this.bufferedEnergy2 = 0; - - this.bufferedVoltage1 = this.bufferedVoltage2; - this.bufferedVoltage2 = 0; - } - } - - @Override - public int getSourceTier() - { - // Sadly IC2 doesn't support changing the tier once we're registered, so we - // go with the highest here... At this point it's somewhat unclear as to what effect - // this realistically has. - return 4; - } - - @Override - public IPartModel getStaticModels() - { - return MODELS.getModel( isPowered(), isActive() ); - } - -} +///* +// * 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.parts.p2p; +// +// +//import java.util.LinkedList; +//import java.util.List; +// +//import net.minecraft.item.ItemStack; +//import net.minecraft.nbt.NBTTagCompound; +//import net.minecraft.util.EnumFacing; +// +//import ic2.api.energy.tile.IEnergyAcceptor; +//import ic2.api.energy.tile.IEnergyEmitter; +//import ic2.api.energy.tile.IEnergySink; +// +//import appeng.api.config.PowerUnits; +//import appeng.api.networking.energy.IEnergySource; +//import appeng.api.parts.IPartModel; +//import appeng.coremod.annotations.Integration.Interface; +//import appeng.coremod.annotations.Integration.InterfaceList; +//import appeng.integration.IntegrationType; +//import appeng.items.parts.PartModels; +//import appeng.me.GridAccessException; +//import appeng.me.cache.helpers.TunnelCollection; +//import appeng.util.Platform; +// +// +//@InterfaceList( value = { +// @Interface( iface = "ic2.api.energy.tile.IEnergySink", iname = IntegrationType.IC2 ), +// @Interface( iface = "ic2.api.energy.tile.IEnergySource", iname = IntegrationType.IC2 ) +//} ) +//public class PartP2PIC2Power extends PartP2PTunnel implements IEnergySink, IEnergySource +//{ +// +// private static final String TAG_BUFFERED_ENERGY_1 = "bufferedEnergy1"; +// private static final String TAG_BUFFERED_ENERGY_2 = "bufferedEnergy2"; +// private static final String TAG_BUFFERED_VOLTAGE_1 = "outputPacket1"; +// private static final String TAG_BUFFERED_VOLTAGE_2 = "outputPacket2"; +// +// private static final P2PModels MODELS = new P2PModels( "part/p2p/p2p_tunnel_ic2" ); +// +// @PartModels +// public static List getModels() +// { +// return MODELS.getModels(); +// } +// +// // Buffer the energy + voltage for two IC2 ENET packets +// private double bufferedEnergy1; +// private double bufferedVoltage1; +// private double bufferedEnergy2; +// private double bufferedVoltage2; +// +// public PartP2PIC2Power( ItemStack is ) +// { +// super( is ); +// } +// +// @Override +// public void readFromNBT( NBTTagCompound tag ) +// { +// super.readFromNBT( tag ); +// this.bufferedEnergy1 = tag.getDouble( TAG_BUFFERED_ENERGY_1 ); +// this.bufferedEnergy2 = tag.getDouble( TAG_BUFFERED_ENERGY_2 ); +// this.bufferedVoltage1 = tag.getDouble( TAG_BUFFERED_VOLTAGE_1 ); +// this.bufferedVoltage2 = tag.getDouble( TAG_BUFFERED_VOLTAGE_2 ); +// } +// +// @Override +// public void writeToNBT( NBTTagCompound tag ) +// { +// super.writeToNBT( tag ); +// tag.setDouble( TAG_BUFFERED_ENERGY_1, this.bufferedEnergy1 ); +// tag.setDouble( TAG_BUFFERED_ENERGY_2, this.bufferedEnergy2 ); +// tag.setDouble( TAG_BUFFERED_VOLTAGE_1, this.bufferedVoltage1 ); +// tag.setDouble( TAG_BUFFERED_VOLTAGE_2, this.bufferedVoltage2 ); +// } +// +// @Override +// public void onTunnelConfigChange() +// { +// this.getHost().partChanged(); +// } +// +// @Override +// public void onTunnelNetworkChange() +// { +// this.getHost().notifyNeighbors(); +// } +// +// @Override +// public boolean acceptsEnergyFrom( IEnergyEmitter emitter, EnumFacing direction ) +// { +// return !this.isOutput() && direction == this.getSide().getFacing(); +// } +// +// @Override +// public boolean emitsEnergyTo( IEnergyAcceptor receiver, EnumFacing direction ) +// { +// return this.isOutput() && direction == this.getSide().getFacing(); +// } +// +// @Override +// public double getDemandedEnergy() +// { +// if( this.isOutput() ) +// { +// return 0; +// } +// +// try +// { +// for( PartP2PIC2Power t : this.getOutputs() ) +// { +// if( t.bufferedEnergy1 <= 0.0001 || t.bufferedEnergy2 <= 0.0001 ) +// { +// return 2048; +// } +// } +// } +// catch( GridAccessException e ) +// { +// return 0; +// } +// +// return 0; +// } +// +// @Override +// public int getSinkTier() +// { +// return 4; +// } +// +// @Override +// public double injectEnergy( EnumFacing directionFrom, double amount, double voltage ) +// { +// TunnelCollection outs; +// try +// { +// outs = this.getOutputs(); +// } +// catch( GridAccessException e ) +// { +// return amount; +// } +// +// if( outs.isEmpty() ) +// { +// return amount; +// } +// +// LinkedList options = new LinkedList<>(); +// for( PartP2PIC2Power o : outs ) +// { +// if( o.bufferedEnergy1 <= 0.01 ) +// { +// options.add( o ); +// } +// } +// +// if( options.isEmpty() ) +// { +// for( PartP2PIC2Power o : outs ) +// { +// if( o.bufferedEnergy2 <= 0.01 ) +// { +// options.add( o ); +// } +// } +// } +// +// if( options.isEmpty() ) +// { +// for( PartP2PIC2Power o : outs ) +// { +// options.add( o ); +// } +// } +// +// if( options.isEmpty() ) +// { +// return amount; +// } +// +// PartP2PIC2Power x = Platform.pickRandom( options ); +// +// if( x != null && x.bufferedEnergy1 <= 0.001 ) +// { +// this.queueTunnelDrain( PowerUnits.EU, amount ); +// x.bufferedEnergy1 = amount; +// x.bufferedVoltage1 = voltage; +// return 0; +// } +// +// if( x != null && x.bufferedEnergy2 <= 0.001 ) +// { +// this.queueTunnelDrain( PowerUnits.EU, amount ); +// x.bufferedEnergy2 = amount; +// x.bufferedVoltage2 = voltage; +// return 0; +// } +// +// return amount; +// } +// +// @Override +// public double getOfferedEnergy() +// { +// if( this.isOutput() ) +// { +// return this.bufferedEnergy1; +// } +// return 0; +// } +// +// @Override +// public void drawEnergy( double amount ) +// { +// this.bufferedEnergy1 -= amount; +// if( this.bufferedEnergy1 < 0.001 ) +// { +// this.bufferedEnergy1 = this.bufferedEnergy2; +// this.bufferedEnergy2 = 0; +// +// this.bufferedVoltage1 = this.bufferedVoltage2; +// this.bufferedVoltage2 = 0; +// } +// } +// +// @Override +// public int getSourceTier() +// { +// // Sadly IC2 doesn't support changing the tier once we're registered, so we +// // go with the highest here... At this point it's somewhat unclear as to what effect +// // this realistically has. +// return 4; +// } +// +// @Override +// public IPartModel getStaticModels() +// { +// return MODELS.getModel( isPowered(), isActive() ); +// } +// +//} \ No newline at end of file diff --git a/src/main/java/appeng/parts/p2p/PartP2PItems.java b/src/main/java/appeng/parts/p2p/PartP2PItems.java index 4f82d938c..fb5f9cb27 100644 --- a/src/main/java/appeng/parts/p2p/PartP2PItems.java +++ b/src/main/java/appeng/parts/p2p/PartP2PItems.java @@ -315,7 +315,7 @@ public class PartP2PItems extends PartP2PTunnel implements /* IPip } @Override - public boolean isUseableByPlayer( final EntityPlayer entityplayer ) + public boolean isUsableByPlayer( final EntityPlayer entityplayer ) { return false; } @@ -396,4 +396,11 @@ public class PartP2PItems extends PartP2PTunnel implements /* IPip return MODELS.getModel( isPowered(), isActive() ); } + @Override + public boolean isEmpty() + { + // TODO Auto-generated method stub + return false; + } + } diff --git a/src/main/java/appeng/parts/p2p/PartP2PLiquids.java b/src/main/java/appeng/parts/p2p/PartP2PLiquids.java index 9549d65eb..ea625e4c6 100644 --- a/src/main/java/appeng/parts/p2p/PartP2PLiquids.java +++ b/src/main/java/appeng/parts/p2p/PartP2PLiquids.java @@ -1,312 +1,312 @@ -/* - * 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.parts.p2p; - - -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Stack; - -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumFacing; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.FluidTankInfo; -import net.minecraftforge.fluids.IFluidHandler; - -import appeng.api.parts.IPartModel; -import appeng.items.parts.PartModels; -import appeng.me.GridAccessException; - - -public class PartP2PLiquids extends PartP2PTunnel implements IFluidHandler -{ - - private static final P2PModels MODELS = new P2PModels( "part/p2p/p2p_tunnel_liquids" ); - - @PartModels - public static List getModels() - { - return MODELS.getModels(); - } - - private static final ThreadLocal> DEPTH = new ThreadLocal>(); - private static final FluidTankInfo[] ACTIVE_TANK = { new FluidTankInfo( null, 10000 ) }; - private static final FluidTankInfo[] INACTIVE_TANK = { new FluidTankInfo( null, 0 ) }; - private IFluidHandler cachedTank; - private int tmpUsed; - - public PartP2PLiquids( final ItemStack is ) - { - super( is ); - } - - public float getPowerDrainPerTick() - { - return 2.0f; - } - - @Override - public void onTunnelNetworkChange() - { - this.cachedTank = null; - } - - @Override - public void onNeighborChanged() - { - this.cachedTank = null; - if( this.isOutput() ) - { - final PartP2PLiquids in = this.getInput(); - if( in != null ) - { - in.onTunnelNetworkChange(); - } - } - } - - @Override - public int fill( final EnumFacing from, final FluidStack resource, final boolean doFill ) - { - final Stack stack = this.getDepth(); - - for( final PartP2PLiquids t : stack ) - { - if( t == this ) - { - return 0; - } - } - - stack.push( this ); - - final List list = this.getOutputs( resource.getFluid() ); - int requestTotal = 0; - - Iterator i = list.iterator(); - while( i.hasNext() ) - { - final PartP2PLiquids l = i.next(); - final IFluidHandler tank = l.getTarget(); - if( tank != null ) - { - l.tmpUsed = tank.fill( l.getSide().getFacing().getOpposite(), resource.copy(), false ); - } - else - { - l.tmpUsed = 0; - } - - if( l.tmpUsed <= 0 ) - { - i.remove(); - } - else - { - requestTotal += l.tmpUsed; - } - } - - if( requestTotal <= 0 ) - { - if( stack.pop() != this ) - { - throw new IllegalStateException( "Invalid Recursion detected." ); - } - - return 0; - } - - if( !doFill ) - { - if( stack.pop() != this ) - { - throw new IllegalStateException( "Invalid Recursion detected." ); - } - - return Math.min( resource.amount, requestTotal ); - } - - int available = resource.amount; - - i = list.iterator(); - int used = 0; - while( i.hasNext() ) - { - final PartP2PLiquids l = i.next(); - - final FluidStack insert = resource.copy(); - insert.amount = (int) Math.ceil( insert.amount * ( (double) l.tmpUsed / (double) requestTotal ) ); - if( insert.amount > available ) - { - insert.amount = available; - } - - final IFluidHandler tank = l.getTarget(); - if( tank != null ) - { - l.tmpUsed = tank.fill( l.getSide().getFacing().getOpposite(), insert.copy(), true ); - } - else - { - l.tmpUsed = 0; - } - - available -= insert.amount; - used += insert.amount; - } - - if( stack.pop() != this ) - { - throw new IllegalStateException( "Invalid Recursion detected." ); - } - - return used; - } - - private Stack getDepth() - { - Stack s = DEPTH.get(); - - if( s == null ) - { - DEPTH.set( s = new Stack() ); - } - - return s; - } - - private List getOutputs( final Fluid input ) - { - final List outs = new LinkedList(); - - try - { - for( final PartP2PLiquids l : this.getOutputs() ) - { - final IFluidHandler handler = l.getTarget(); - if( handler != null ) - { - if( handler.canFill( l.getSide().getFacing().getOpposite(), input ) ) - { - outs.add( l ); - } - } - } - } - catch( final GridAccessException e ) - { - // :P - } - - return outs; - } - - private IFluidHandler getTarget() - { - if( !this.getProxy().isActive() ) - { - return null; - } - - if( this.cachedTank != null ) - { - return this.cachedTank; - } - - final TileEntity te = this.getTile().getWorld().getTileEntity( this.getTile().getPos().offset( this.getSide().getFacing() ) ); - if( te instanceof IFluidHandler ) - { - return this.cachedTank = (IFluidHandler) te; - } - - return null; - } - - @Override - public FluidStack drain( final EnumFacing from, final FluidStack resource, final boolean doDrain ) - { - return null; - } - - @Override - public FluidStack drain( final EnumFacing from, final int maxDrain, final boolean doDrain ) - { - return null; - } - - @Override - public boolean canFill( final EnumFacing from, final Fluid fluid ) - { - return !this.isOutput() && from == this.getSide().getFacing() && !this.getOutputs( fluid ).isEmpty(); - } - - @Override - public boolean canDrain( final EnumFacing from, final Fluid fluid ) - { - return false; - } - - @Override - public FluidTankInfo[] getTankInfo( final EnumFacing from ) - { - if( from == this.getSide().getFacing() ) - { - return this.getTank(); - } - return new FluidTankInfo[0]; - } - - private FluidTankInfo[] getTank() - { - if( this.isOutput() ) - { - final PartP2PLiquids tun = this.getInput(); - if( tun != null ) - { - return ACTIVE_TANK; - } - } - else - { - try - { - if( !this.getOutputs().isEmpty() ) - { - return ACTIVE_TANK; - } - } - catch( final GridAccessException e ) - { - // :( - } - } - return INACTIVE_TANK; - } - - @Override - public IPartModel getStaticModels() - { - return MODELS.getModel( isPowered(), isActive() ); - } - -} +///* +// * 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.parts.p2p; +// +// +//import java.util.Iterator; +//import java.util.LinkedList; +//import java.util.List; +//import java.util.Stack; +// +//import net.minecraft.item.ItemStack; +//import net.minecraft.tileentity.TileEntity; +//import net.minecraft.util.EnumFacing; +//import net.minecraftforge.fluids.Fluid; +//import net.minecraftforge.fluids.FluidStack; +//import net.minecraftforge.fluids.FluidTankInfo; +//import net.minecraftforge.fluids.capability.IFluidHandler; +// +//import appeng.api.parts.IPartModel; +//import appeng.items.parts.PartModels; +//import appeng.me.GridAccessException; +// +// +//public class PartP2PLiquids extends PartP2PTunnel implements IFluidHandler +//{ +// +// private static final P2PModels MODELS = new P2PModels( "part/p2p/p2p_tunnel_liquids" ); +// +// @PartModels +// public static List getModels() +// { +// return MODELS.getModels(); +// } +// +// private static final ThreadLocal> DEPTH = new ThreadLocal>(); +// private static final FluidTankInfo[] ACTIVE_TANK = { new FluidTankInfo( null, 10000 ) }; +// private static final FluidTankInfo[] INACTIVE_TANK = { new FluidTankInfo( null, 0 ) }; +// private IFluidHandler cachedTank; +// private int tmpUsed; +// +// public PartP2PLiquids( final ItemStack is ) +// { +// super( is ); +// } +// +// public float getPowerDrainPerTick() +// { +// return 2.0f; +// } +// +// @Override +// public void onTunnelNetworkChange() +// { +// this.cachedTank = null; +// } +// +// @Override +// public void onNeighborChanged() +// { +// this.cachedTank = null; +// if( this.isOutput() ) +// { +// final PartP2PLiquids in = this.getInput(); +// if( in != null ) +// { +// in.onTunnelNetworkChange(); +// } +// } +// } +// +// @Override +// public int fill( final EnumFacing from, final FluidStack resource, final boolean doFill ) +// { +// final Stack stack = this.getDepth(); +// +// for( final PartP2PLiquids t : stack ) +// { +// if( t == this ) +// { +// return 0; +// } +// } +// +// stack.push( this ); +// +// final List list = this.getOutputs( resource.getFluid() ); +// int requestTotal = 0; +// +// Iterator i = list.iterator(); +// while( i.hasNext() ) +// { +// final PartP2PLiquids l = i.next(); +// final IFluidHandler tank = l.getTarget(); +// if( tank != null ) +// { +// l.tmpUsed = tank.fill( l.getSide().getFacing().getOpposite(), resource.copy(), false ); +// } +// else +// { +// l.tmpUsed = 0; +// } +// +// if( l.tmpUsed <= 0 ) +// { +// i.remove(); +// } +// else +// { +// requestTotal += l.tmpUsed; +// } +// } +// +// if( requestTotal <= 0 ) +// { +// if( stack.pop() != this ) +// { +// throw new IllegalStateException( "Invalid Recursion detected." ); +// } +// +// return 0; +// } +// +// if( !doFill ) +// { +// if( stack.pop() != this ) +// { +// throw new IllegalStateException( "Invalid Recursion detected." ); +// } +// +// return Math.min( resource.amount, requestTotal ); +// } +// +// int available = resource.amount; +// +// i = list.iterator(); +// int used = 0; +// while( i.hasNext() ) +// { +// final PartP2PLiquids l = i.next(); +// +// final FluidStack insert = resource.copy(); +// insert.amount = (int) Math.ceil( insert.amount * ( (double) l.tmpUsed / (double) requestTotal ) ); +// if( insert.amount > available ) +// { +// insert.amount = available; +// } +// +// final IFluidHandler tank = l.getTarget(); +// if( tank != null ) +// { +// l.tmpUsed = tank.fill( l.getSide().getFacing().getOpposite(), insert.copy(), true ); +// } +// else +// { +// l.tmpUsed = 0; +// } +// +// available -= insert.amount; +// used += insert.amount; +// } +// +// if( stack.pop() != this ) +// { +// throw new IllegalStateException( "Invalid Recursion detected." ); +// } +// +// return used; +// } +// +// private Stack getDepth() +// { +// Stack s = DEPTH.get(); +// +// if( s == null ) +// { +// DEPTH.set( s = new Stack() ); +// } +// +// return s; +// } +// +// private List getOutputs( final Fluid input ) +// { +// final List outs = new LinkedList(); +// +// try +// { +// for( final PartP2PLiquids l : this.getOutputs() ) +// { +// final IFluidHandler handler = l.getTarget(); +// if( handler != null ) +// { +// if( handler.canFill( l.getSide().getFacing().getOpposite(), input ) ) +// { +// outs.add( l ); +// } +// } +// } +// } +// catch( final GridAccessException e ) +// { +// // :P +// } +// +// return outs; +// } +// +// private IFluidHandler getTarget() +// { +// if( !this.getProxy().isActive() ) +// { +// return null; +// } +// +// if( this.cachedTank != null ) +// { +// return this.cachedTank; +// } +// +// final TileEntity te = this.getTile().getWorld().getTileEntity( this.getTile().getPos().offset( this.getSide().getFacing() ) ); +// if( te instanceof IFluidHandler ) +// { +// return this.cachedTank = (IFluidHandler) te; +// } +// +// return null; +// } +// +// @Override +// public FluidStack drain( final EnumFacing from, final FluidStack resource, final boolean doDrain ) +// { +// return null; +// } +// +// @Override +// public FluidStack drain( final EnumFacing from, final int maxDrain, final boolean doDrain ) +// { +// return null; +// } +// +// @Override +// public boolean canFill( final EnumFacing from, final Fluid fluid ) +// { +// return !this.isOutput() && from == this.getSide().getFacing() && !this.getOutputs( fluid ).isEmpty(); +// } +// +// @Override +// public boolean canDrain( final EnumFacing from, final Fluid fluid ) +// { +// return false; +// } +// +// @Override +// public FluidTankInfo[] getTankInfo( final EnumFacing from ) +// { +// if( from == this.getSide().getFacing() ) +// { +// return this.getTank(); +// } +// return new FluidTankInfo[0]; +// } +// +// private FluidTankInfo[] getTank() +// { +// if( this.isOutput() ) +// { +// final PartP2PLiquids tun = this.getInput(); +// if( tun != null ) +// { +// return ACTIVE_TANK; +// } +// } +// else +// { +// try +// { +// if( !this.getOutputs().isEmpty() ) +// { +// return ACTIVE_TANK; +// } +// } +// catch( final GridAccessException e ) +// { +// // :( +// } +// } +// return INACTIVE_TANK; +// } +// +// @Override +// public IPartModel getStaticModels() +// { +// return MODELS.getModel( isPowered(), isActive() ); +// } +// +//} \ No newline at end of file diff --git a/src/main/java/appeng/parts/p2p/PartP2PRFPower.java b/src/main/java/appeng/parts/p2p/PartP2PRFPower.java index 43165f424..0aefbe82e 100644 --- a/src/main/java/appeng/parts/p2p/PartP2PRFPower.java +++ b/src/main/java/appeng/parts/p2p/PartP2PRFPower.java @@ -170,7 +170,7 @@ package appeng.parts.p2p; // if( !this.cachedTarget ) // { // TileEntity self = this.getTile(); -// TileEntity te = self.getWorldObj().getTileEntity( self.xCoord + this.side.offsetX, self.yCoord + this.side.offsetY, self.zCoord + this.side.offsetZ ); +// TileEntity te = self.getworld().getTileEntity( self.xCoord + this.side.offsetX, self.yCoord + this.side.offsetY, self.zCoord + this.side.offsetZ ); // this.outputTarget = te instanceof IEnergyReceiver ? (IEnergyReceiver) te : null; // this.cachedTarget = true; // } diff --git a/src/main/java/appeng/parts/p2p/PartP2PRedstone.java b/src/main/java/appeng/parts/p2p/PartP2PRedstone.java index b62a98d25..60a8f3046 100644 --- a/src/main/java/appeng/parts/p2p/PartP2PRedstone.java +++ b/src/main/java/appeng/parts/p2p/PartP2PRedstone.java @@ -99,14 +99,14 @@ public class PartP2PRedstone extends PartP2PTunnel private void notifyNeighbors() { - final World worldObj = this.getTile().getWorld(); + final World world = this.getTile().getWorld(); - Platform.notifyBlocksOfNeighbors( worldObj, this.getTile().getPos() ); + Platform.notifyBlocksOfNeighbors( world, this.getTile().getPos() ); // and this cause sometimes it can go thought walls. for( final EnumFacing face : EnumFacing.VALUES ) { - Platform.notifyBlocksOfNeighbors( worldObj, this.getTile().getPos().offset( face ) ); + Platform.notifyBlocksOfNeighbors( world, this.getTile().getPos().offset( face ) ); } } diff --git a/src/main/java/appeng/parts/p2p/PartP2PTunnel.java b/src/main/java/appeng/parts/p2p/PartP2PTunnel.java index 9cb1cef01..946a8dedc 100644 --- a/src/main/java/appeng/parts/p2p/PartP2PTunnel.java +++ b/src/main/java/appeng/parts/p2p/PartP2PTunnel.java @@ -171,7 +171,7 @@ public abstract class PartP2PTunnel extends PartBasicSt final IMemoryCard mc = (IMemoryCard) is.getItem(); final NBTTagCompound data = mc.getData( is ); - final ItemStack newType = ItemStack.loadItemStackFromNBT( data ); + final ItemStack newType = new ItemStack( data ); final long freq = data.getLong( "freq" ); if( newType != null ) @@ -231,13 +231,13 @@ public abstract class PartP2PTunnel extends PartBasicSt * break; */ - case FLUID: - newType = parts.p2PTunnelLiquids().maybeStack( 1 ).orElse( null ); - break; + //case FLUID: + // newType = parts.p2PTunnelLiquids().maybeStack( 1 ).orElse( null ); + // break; - case IC2_POWER: - newType = parts.p2PTunnelEU().maybeStack( 1 ).orElse( null ); - break; + //case IC2_POWER: + // newType = parts.p2PTunnelEU().maybeStack( 1 ).orElse( null ); + // break; case ITEM: newType = parts.p2PTunnelItems().maybeStack( 1 ).orElse( null ); diff --git a/src/main/java/appeng/parts/reporting/AbstractPartMonitor.java b/src/main/java/appeng/parts/reporting/AbstractPartMonitor.java index 4d63db1a7..bc0955d19 100644 --- a/src/main/java/appeng/parts/reporting/AbstractPartMonitor.java +++ b/src/main/java/appeng/parts/reporting/AbstractPartMonitor.java @@ -167,7 +167,7 @@ public abstract class AbstractPartMonitor extends AbstractPartDisplay implements if( Platform.isWrench( player, eq, te.getPos() ) ) { this.isLocked = !this.isLocked; - player.addChatMessage( ( this.isLocked ? PlayerMessages.isNowLocked : PlayerMessages.isNowUnlocked ).get() ); + player.sendMessage( ( this.isLocked ? PlayerMessages.isNowLocked : PlayerMessages.isNowUnlocked ).get() ); this.getHost().markForUpdate(); } else if( !this.isLocked ) diff --git a/src/main/java/appeng/parts/reporting/AbstractPartReporting.java b/src/main/java/appeng/parts/reporting/AbstractPartReporting.java index 96bb65acd..2e232f49e 100644 --- a/src/main/java/appeng/parts/reporting/AbstractPartReporting.java +++ b/src/main/java/appeng/parts/reporting/AbstractPartReporting.java @@ -235,7 +235,7 @@ public abstract class AbstractPartReporting extends AEBasePart implements IPartM { super.onPlacement( player, hand, held, side ); - final byte rotation = (byte) ( MathHelper.floor_double( ( player.rotationYaw * 4F ) / 360F + 2.5D ) & 3 ); + final byte rotation = (byte) ( MathHelper.floor( ( player.rotationYaw * 4F ) / 360F + 2.5D ) & 3 ); if( side == AEPartLocation.UP ) { this.spin = rotation; diff --git a/src/main/java/appeng/parts/reporting/PartConversionMonitor.java b/src/main/java/appeng/parts/reporting/PartConversionMonitor.java index 886936967..fc91d110d 100644 --- a/src/main/java/appeng/parts/reporting/PartConversionMonitor.java +++ b/src/main/java/appeng/parts/reporting/PartConversionMonitor.java @@ -118,7 +118,7 @@ public class PartConversionMonitor extends AbstractPartMonitor if( input.equals( targetStack ) ) { final IAEItemStack insertItem = input.copy(); - insertItem.setStackSize( targetStack.stackSize ); + insertItem.setStackSize( targetStack.getCount() ); final IAEItemStack failedToInsert = Platform.poweredInsert( energy, cell, insertItem, new PlayerSource( player, this ) ); player.inventory.setInventorySlotContents( x, failedToInsert == null ? null : failedToInsert.getItemStack() ); } @@ -167,7 +167,7 @@ public class PartConversionMonitor extends AbstractPartMonitor { final TileEntity te = this.getTile(); final List list = Collections.singletonList( newItems ); - Platform.spawnDrops( player.worldObj, te.getPos().offset( this.getSide().getFacing() ), list ); + Platform.spawnDrops( player.world, te.getPos().offset( this.getSide().getFacing() ), list ); } if( player.openContainer != null ) diff --git a/src/main/java/appeng/parts/reporting/PartPatternTerminal.java b/src/main/java/appeng/parts/reporting/PartPatternTerminal.java index 0da4790ba..fb78dd130 100644 --- a/src/main/java/appeng/parts/reporting/PartPatternTerminal.java +++ b/src/main/java/appeng/parts/reporting/PartPatternTerminal.java @@ -165,7 +165,7 @@ public class PartPatternTerminal extends AbstractPartTerminal final ItemStack is = this.crafting.getStackInSlot( x ); if( is != null ) { - is.stackSize = 1; + is.setCount( 1 ); } } } diff --git a/src/main/java/appeng/recipes/GroupIngredient.java b/src/main/java/appeng/recipes/GroupIngredient.java index 3c06399ce..926f053fd 100644 --- a/src/main/java/appeng/recipes/GroupIngredient.java +++ b/src/main/java/appeng/recipes/GroupIngredient.java @@ -117,7 +117,7 @@ public class GroupIngredient implements IIngredient for( final ItemStack is : out ) { - is.stackSize = this.qty; + is.setCount( this.qty ); } return out.toArray( new ItemStack[out.size()] ); diff --git a/src/main/java/appeng/recipes/Ingredient.java b/src/main/java/appeng/recipes/Ingredient.java index 9d1fc0c91..dbdee0832 100644 --- a/src/main/java/appeng/recipes/Ingredient.java +++ b/src/main/java/appeng/recipes/Ingredient.java @@ -27,7 +27,6 @@ import net.minecraft.block.Block; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import net.minecraftforge.fml.common.registry.GameRegistry; import net.minecraftforge.oredict.OreDictionary; import appeng.api.AEApi; @@ -159,10 +158,10 @@ public class Ingredient implements IIngredient throw new RegistrationError( "Recipe format expected a single item, but got a set of items." ); } - Block blk = GameRegistry.findBlock( this.nameSpace, this.itemName ); + Block blk = Block.getBlockFromName( this.nameSpace + ":" + this.itemName ); if( blk == null ) { - blk = GameRegistry.findBlock( this.nameSpace, "tile." + this.itemName ); + blk = Block.getBlockFromName( this.nameSpace + ":" + "tile." + this.itemName ); } if( blk != null ) @@ -174,10 +173,10 @@ public class Ingredient implements IIngredient } } - Item it = GameRegistry.findItem( this.nameSpace, this.itemName ); + Item it = Item.getByNameOrId( this.nameSpace + ":" + this.itemName ); if( it == null ) { - it = GameRegistry.findItem( this.nameSpace, "item." + this.itemName ); + it = Item.getByNameOrId( this.nameSpace + ":" + "item." + this.itemName ); } if( it != null ) @@ -222,7 +221,7 @@ public class Ingredient implements IIngredient for( int x = 0; x < set.length; x++ ) { final ItemStack is = set[x].copy(); - is.stackSize = this.qty; + is.setCount( this.qty ); set[x] = is; } diff --git a/src/main/java/appeng/recipes/IngredientSet.java b/src/main/java/appeng/recipes/IngredientSet.java index 5927d5661..01b54d525 100644 --- a/src/main/java/appeng/recipes/IngredientSet.java +++ b/src/main/java/appeng/recipes/IngredientSet.java @@ -83,7 +83,7 @@ public class IngredientSet implements IIngredient for( final ItemStack is : out ) { - is.stackSize = this.qty; + is.setCount( this.qty ); } return out.toArray( new ItemStack[out.size()] ); diff --git a/src/main/java/appeng/recipes/game/DisassembleRecipe.java b/src/main/java/appeng/recipes/game/DisassembleRecipe.java index 4cb718f57..ba8886794 100644 --- a/src/main/java/appeng/recipes/game/DisassembleRecipe.java +++ b/src/main/java/appeng/recipes/game/DisassembleRecipe.java @@ -30,6 +30,7 @@ import net.minecraft.inventory.IInventory; import net.minecraft.inventory.InventoryCrafting; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.IRecipe; +import net.minecraft.util.NonNullList; import net.minecraft.world.World; import net.minecraftforge.common.ForgeHooks; @@ -174,7 +175,7 @@ public final class DisassembleRecipe implements IRecipe } @Override - public ItemStack[] getRemainingItems( final InventoryCrafting inv ) + public NonNullList getRemainingItems( final InventoryCrafting inv ) { return ForgeHooks.defaultRecipeGetRemainingItems( inv ); } diff --git a/src/main/java/appeng/recipes/game/FacadeRecipe.java b/src/main/java/appeng/recipes/game/FacadeRecipe.java index a7ab1d76e..73ae60e3b 100644 --- a/src/main/java/appeng/recipes/game/FacadeRecipe.java +++ b/src/main/java/appeng/recipes/game/FacadeRecipe.java @@ -25,6 +25,7 @@ import net.minecraft.inventory.IInventory; import net.minecraft.inventory.InventoryCrafting; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.IRecipe; +import net.minecraft.util.NonNullList; import net.minecraft.world.World; import net.minecraftforge.common.ForgeHooks; @@ -63,7 +64,7 @@ public final class FacadeRecipe implements IRecipe final ItemStack facades = facade.createFacadeForItem( inv.getStackInSlot( 4 ), !createFacade ); if( facades != null && createFacade ) { - facades.stackSize = 4; + facades.setCount( 4 ); } return facades; } @@ -91,7 +92,7 @@ public final class FacadeRecipe implements IRecipe } @Override - public ItemStack[] getRemainingItems( final InventoryCrafting inv ) + public NonNullList getRemainingItems( final InventoryCrafting inv ) { return ForgeHooks.defaultRecipeGetRemainingItems( inv ); } diff --git a/src/main/java/appeng/recipes/game/ShapedRecipe.java b/src/main/java/appeng/recipes/game/ShapedRecipe.java index 2e7a4f0e3..8093dc8b3 100644 --- a/src/main/java/appeng/recipes/game/ShapedRecipe.java +++ b/src/main/java/appeng/recipes/game/ShapedRecipe.java @@ -26,6 +26,7 @@ import java.util.Map; import net.minecraft.inventory.InventoryCrafting; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.IRecipe; +import net.minecraft.util.NonNullList; import net.minecraft.world.World; import net.minecraftforge.common.ForgeHooks; import net.minecraftforge.oredict.OreDictionary; @@ -327,7 +328,7 @@ public class ShapedRecipe implements IRecipe, IRecipeBakeable } @Override - public ItemStack[] getRemainingItems( final InventoryCrafting inv ) + public NonNullList getRemainingItems( final InventoryCrafting inv ) { return ForgeHooks.defaultRecipeGetRemainingItems( inv ); } diff --git a/src/main/java/appeng/recipes/game/ShapelessRecipe.java b/src/main/java/appeng/recipes/game/ShapelessRecipe.java index 2e2a5a6f0..7dd97826d 100644 --- a/src/main/java/appeng/recipes/game/ShapelessRecipe.java +++ b/src/main/java/appeng/recipes/game/ShapelessRecipe.java @@ -24,6 +24,7 @@ import java.util.ArrayList; import net.minecraft.inventory.InventoryCrafting; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.IRecipe; +import net.minecraft.util.NonNullList; import net.minecraft.world.World; import net.minecraftforge.common.ForgeHooks; import net.minecraftforge.oredict.OreDictionary; @@ -182,7 +183,7 @@ public class ShapelessRecipe implements IRecipe, IRecipeBakeable } @Override - public ItemStack[] getRemainingItems( final InventoryCrafting inv ) + public NonNullList getRemainingItems( final InventoryCrafting inv ) { return ForgeHooks.defaultRecipeGetRemainingItems( inv ); } diff --git a/src/main/java/appeng/server/AECommand.java b/src/main/java/appeng/server/AECommand.java index 133ef254f..4d274a1db 100644 --- a/src/main/java/appeng/server/AECommand.java +++ b/src/main/java/appeng/server/AECommand.java @@ -44,13 +44,13 @@ public final class AECommand extends CommandBase } @Override - public String getCommandName() + public String getName() { return "ae2"; } @Override - public String getCommandUsage( final ICommandSender icommandsender ) + public String getUsage( final ICommandSender icommandsender ) { return "commands.ae2.usage"; } @@ -90,7 +90,7 @@ public final class AECommand extends CommandBase try { final Commands c = Commands.valueOf( args[0] ); - if( sender.canCommandSenderUseCommand( c.level, this.getCommandName() ) ) + if( sender.canUseCommand( c.level, this.getName() ) ) { c.command.call( this.srv, args, sender ); } diff --git a/src/main/java/appeng/server/ServerHelper.java b/src/main/java/appeng/server/ServerHelper.java index 92f2650b8..1e232639f 100644 --- a/src/main/java/appeng/server/ServerHelper.java +++ b/src/main/java/appeng/server/ServerHelper.java @@ -82,7 +82,7 @@ public class ServerHelper extends CommonHelper if( server != null ) { - return (List) server.getPlayerList().getPlayerList(); + return (List) server.getPlayerList().getPlayers(); } } @@ -101,7 +101,7 @@ public class ServerHelper extends CommonHelper { final EntityPlayerMP entityplayermp = (EntityPlayerMP) o; - if( entityplayermp != p && entityplayermp.worldObj == w ) + if( entityplayermp != p && entityplayermp.world == w ) { final double dX = x - entityplayermp.posX; final double dY = y - entityplayermp.posY; @@ -116,7 +116,7 @@ public class ServerHelper extends CommonHelper } @Override - public void spawnEffect( final EffectType type, final World worldObj, final double posX, final double posY, final double posZ, final Object o ) + public void spawnEffect( final EffectType type, final World world, final double posX, final double posY, final double posZ, final Object o ) { // :P } diff --git a/src/main/java/appeng/server/subcommands/ChunkLogger.java b/src/main/java/appeng/server/subcommands/ChunkLogger.java index 58fb35911..0bd4db521 100644 --- a/src/main/java/appeng/server/subcommands/ChunkLogger.java +++ b/src/main/java/appeng/server/subcommands/ChunkLogger.java @@ -90,12 +90,12 @@ public class ChunkLogger implements ISubCommand if( this.enabled ) { MinecraftForge.EVENT_BUS.register( this ); - sender.addChatMessage( new TextComponentTranslation( "commands.ae2.ChunkLoggerOn" ) ); + sender.sendMessage( new TextComponentTranslation( "commands.ae2.ChunkLoggerOn" ) ); } else { MinecraftForge.EVENT_BUS.unregister( this ); - sender.addChatMessage( new TextComponentTranslation( "commands.ae2.ChunkLoggerOff" ) ); + sender.sendMessage( new TextComponentTranslation( "commands.ae2.ChunkLoggerOff" ) ); } } } diff --git a/src/main/java/appeng/server/subcommands/Supporters.java b/src/main/java/appeng/server/subcommands/Supporters.java index 0bd32df55..aef35eba7 100644 --- a/src/main/java/appeng/server/subcommands/Supporters.java +++ b/src/main/java/appeng/server/subcommands/Supporters.java @@ -41,6 +41,6 @@ public class Supporters implements ISubCommand public void call( final MinecraftServer srv, final String[] data, final ICommandSender sender ) { final String[] who = { "Stig Halvorsen", "Josh Ricker", "Jenny \"Othlon\" Sutherland", "Hristo Bogdanov", "BevoLJ" }; - sender.addChatMessage( new TextComponentString( "Special thanks to " + Joiner.on( ", " ).join( who ) ) ); + sender.sendMessage( new TextComponentString( "Special thanks to " + Joiner.on( ", " ).join( who ) ) ); } } diff --git a/src/main/java/appeng/services/export/MinecraftItemCSVExporter.java b/src/main/java/appeng/services/export/MinecraftItemCSVExporter.java index 440a52c73..67f6e9cfa 100644 --- a/src/main/java/appeng/services/export/MinecraftItemCSVExporter.java +++ b/src/main/java/appeng/services/export/MinecraftItemCSVExporter.java @@ -43,6 +43,7 @@ import net.minecraft.creativetab.CreativeTabs; import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.util.NonNullList; import net.minecraft.util.text.translation.I18n; import net.minecraftforge.fml.common.registry.FMLControlledNamespacedRegistry; @@ -235,7 +236,7 @@ final class MinecraftItemCSVExporter implements Exporter if( hasSubtypes ) { final CreativeTabs creativeTab = input.getCreativeTab(); - final List stacks = Lists.newArrayList(); + final NonNullList stacks = NonNullList.create(); // modifies the stacks list and adds the different sub types to it try diff --git a/src/main/java/appeng/spatial/CachedPlane.java b/src/main/java/appeng/spatial/CachedPlane.java index 1f45c8f01..d680f750a 100644 --- a/src/main/java/appeng/spatial/CachedPlane.java +++ b/src/main/java/appeng/spatial/CachedPlane.java @@ -315,7 +315,7 @@ public class CachedPlane final BlockPos pos = new BlockPos( x, y, z ); // attempt recovery... - te.setWorldObj( this.world ); + te.setWorld( this.world ); te.setPos( pos ); c.c.addTileEntity( new BlockPos( c.x, y + y, c.z ), te ); // c.c.setChunkTileEntity( c.x, y + y, c.z, te ); @@ -407,7 +407,7 @@ public class CachedPlane ExtendedBlockStorage extendedblockstorage = this.storage[by]; if( extendedblockstorage == null ) { - extendedblockstorage = this.storage[by] = new ExtendedBlockStorage( by << 4, !this.c.getWorld().provider.getHasNoSky() ); + extendedblockstorage = this.storage[by] = new ExtendedBlockStorage( by << 4, !this.c.getWorld().provider.hasNoSky() ); } } } diff --git a/src/main/java/appeng/spatial/DefaultSpatialHandler.java b/src/main/java/appeng/spatial/DefaultSpatialHandler.java index 011e448d4..510769fd0 100644 --- a/src/main/java/appeng/spatial/DefaultSpatialHandler.java +++ b/src/main/java/appeng/spatial/DefaultSpatialHandler.java @@ -46,7 +46,7 @@ public class DefaultSpatialHandler implements IMovableHandler @Override public void moveTile( final TileEntity te, final World w, final BlockPos newPosition ) { - te.setWorldObj( w ); + te.setWorld( w ); te.setPos( newPosition ); final Chunk c = w.getChunkFromBlockCoords( newPosition ); diff --git a/src/main/java/appeng/spatial/StorageChunkProvider.java b/src/main/java/appeng/spatial/StorageChunkProvider.java index c8a78709d..257f8f541 100644 --- a/src/main/java/appeng/spatial/StorageChunkProvider.java +++ b/src/main/java/appeng/spatial/StorageChunkProvider.java @@ -52,7 +52,7 @@ public class StorageChunkProvider extends ChunkProviderOverworld final byte[] biomes = chunk.getBiomeArray(); Biome biome = AppEng.instance().getRegistration().getStorageBiome(); - byte biomeId = (byte) Biome.getIdForBiome(biome); + byte biomeId = (byte) Biome.getIdForBiome( biome ); for( int k = 0; k < biomes.length; ++k ) { @@ -105,7 +105,7 @@ public class StorageChunkProvider extends ChunkProviderOverworld } @Override - public BlockPos getStrongholdGen( World worldIn, String structureName, BlockPos position ) + public BlockPos getStrongholdGen( World worldIn, String structureName, BlockPos position, boolean p_180513_4_ ) { return null; } @@ -113,6 +113,6 @@ public class StorageChunkProvider extends ChunkProviderOverworld @Override public void recreateStructures( Chunk chunkIn, int x, int z ) { - + } } diff --git a/src/main/java/appeng/spatial/StorageHelper.java b/src/main/java/appeng/spatial/StorageHelper.java index aa339f0a9..676b1924c 100644 --- a/src/main/java/appeng/spatial/StorageHelper.java +++ b/src/main/java/appeng/spatial/StorageHelper.java @@ -69,7 +69,7 @@ public class StorageHelper try { - oldWorld = (WorldServer) entity.worldObj; + oldWorld = (WorldServer) entity.world; newWorld = (WorldServer) link.dim; player = ( entity instanceof EntityPlayerMP ) ? (EntityPlayerMP) entity : null; } @@ -86,13 +86,13 @@ public class StorageHelper { return entity; } - + // Are we riding something? Teleport it instead. if( entity.isRiding() ) { return this.teleportEntity( entity.getRidingEntity(), link ); } - + // Is something riding us? Handle it first. final List passangers = entity.getPassengers(); final List passangersOnOtherSide = new ArrayList<>(); @@ -107,7 +107,7 @@ public class StorageHelper } // load the chunk! - newWorld.getChunkProvider().provideChunk( MathHelper.floor_double( link.x ) >> 4, MathHelper.floor_double( link.z ) >> 4 ); + newWorld.getChunkProvider().provideChunk( MathHelper.floor( link.x ) >> 4, MathHelper.floor( link.z ) >> 4 ); if( newWorld != oldWorld ) { @@ -122,7 +122,8 @@ public class StorageHelper } else { - entity.getServer().getPlayerList().transferEntityToWorld( entity, entity.dimension, entity.getServer().worldServerForDimension( entity.dimension ), (WorldServer) link.dim, new METeleporter( newWorld, link ) ); + entity.getServer().getPlayerList().transferEntityToWorld( entity, entity.dimension, + entity.getServer().worldServerForDimension( entity.dimension ), (WorldServer) link.dim, new METeleporter( newWorld, link ) ); } } @@ -130,7 +131,7 @@ public class StorageHelper { if( player != null ) { - entity.worldObj.updateEntityWithOptionalForce( entity, true ); + entity.world.updateEntityWithOptionalForce( entity, true ); } for( Entity passanger : passangersOnOtherSide ) @@ -172,15 +173,10 @@ public class StorageHelper } } - public void swapRegions( final World srcWorld, - final int srcX, final int srcY, final int srcZ, - final World dstWorld, - final int dstX, final int dstY, final int dstZ, - final int scaleX, final int scaleY, final int scaleZ ) + public void swapRegions( final World srcWorld, final int srcX, final int srcY, final int srcZ, final World dstWorld, final int dstX, final int dstY, final int dstZ, final int scaleX, final int scaleY, final int scaleZ ) { - AEApi.instance().definitions().blocks().matrixFrame().maybeBlock().ifPresent( matrixFrameBlock -> - this.transverseEdges( dstX - 1, dstY - 1, dstZ - 1, dstX + scaleX + 1, dstY + scaleY + 1, dstZ + scaleZ + 1, new WrapInMatrixFrame( matrixFrameBlock.getDefaultState(), dstWorld ) ) - ); + AEApi.instance().definitions().blocks().matrixFrame().maybeBlock().ifPresent( matrixFrameBlock -> this.transverseEdges( dstX - 1, dstY - 1, dstZ - 1, + dstX + scaleX + 1, dstY + scaleY + 1, dstZ + scaleZ + 1, new WrapInMatrixFrame( matrixFrameBlock.getDefaultState(), dstWorld ) ) ); final AxisAlignedBB srcBox = new AxisAlignedBB( srcX, srcY, srcZ, srcX + scaleX + 1, srcY + scaleY + 1, srcZ + scaleZ + 1 ); @@ -207,12 +203,12 @@ public class StorageHelper for( final WorldCoord wc : cDst.getUpdates() ) { - cSrc.getWorld().notifyBlockOfStateChange( wc.getPos(), Platform.AIR_BLOCK ); + cSrc.getWorld().notifyNeighborsOfStateChange( wc.getPos(), Platform.AIR_BLOCK, true ); } for( final WorldCoord wc : cSrc.getUpdates() ) { - cSrc.getWorld().notifyBlockOfStateChange( wc.getPos(), Platform.AIR_BLOCK ); + cSrc.getWorld().notifyNeighborsOfStateChange( wc.getPos(), Platform.AIR_BLOCK, true ); } this.transverseEdges( srcX - 1, srcY - 1, srcZ - 1, srcX + scaleX + 1, srcY + scaleY + 1, srcZ + scaleZ + 1, new TriggerUpdates( srcWorld ) ); @@ -244,7 +240,7 @@ public class StorageHelper public void visit( final BlockPos pos ) { final Block blk = this.dst.getBlockState( pos ).getBlock(); - blk.neighborChanged( Platform.AIR_BLOCK.getDefaultState(), this.dst, pos, Platform.AIR_BLOCK ); + blk.neighborChanged( Platform.AIR_BLOCK.getDefaultState(), this.dst, pos, Platform.AIR_BLOCK, pos ); } } diff --git a/src/main/java/appeng/spatial/StorageWorldProvider.java b/src/main/java/appeng/spatial/StorageWorldProvider.java index d1a520b67..3081e3428 100644 --- a/src/main/java/appeng/spatial/StorageWorldProvider.java +++ b/src/main/java/appeng/spatial/StorageWorldProvider.java @@ -51,7 +51,7 @@ public class StorageWorldProvider extends WorldProvider @Override public IChunkGenerator createChunkGenerator() { - return new StorageChunkProvider( this.worldObj, 0 ); + return new StorageChunkProvider( this.world, 0 ); } @Override diff --git a/src/main/java/appeng/tile/AEBaseInvTile.java b/src/main/java/appeng/tile/AEBaseInvTile.java index b72dfc33b..f8ef56226 100644 --- a/src/main/java/appeng/tile/AEBaseInvTile.java +++ b/src/main/java/appeng/tile/AEBaseInvTile.java @@ -66,7 +66,7 @@ public abstract class AEBaseInvTile extends AEBaseTile implements ISidedInventor for( int x = 0; x < inv.getSizeInventory(); x++ ) { final NBTTagCompound item = opt.getCompoundTag( "item" + x ); - inv.setInventorySlotContents( x, ItemStack.loadItemStackFromNBT( item ) ); + inv.setInventorySlotContents( x, new ItemStack( item ) ); } } @@ -136,11 +136,11 @@ public abstract class AEBaseInvTile extends AEBaseTile implements ISidedInventor } @Override - public boolean isUseableByPlayer( final EntityPlayer p ) + public boolean isUsableByPlayer( final EntityPlayer p ) { final double squaredMCReach = 64.0D; - return this.worldObj.getTileEntity( this.pos ) == this && p.getDistanceSq( this.pos.getX() + 0.5D, this.pos.getY() + 0.5D, this.pos.getZ() + 0.5D ) <= squaredMCReach; + return this.world.getTileEntity( this.pos ) == this && p.getDistanceSq( this.pos.getX() + 0.5D, this.pos.getY() + 0.5D, this.pos.getZ() + 0.5D ) <= squaredMCReach; } @Override @@ -169,7 +169,7 @@ public abstract class AEBaseInvTile extends AEBaseTile implements ISidedInventor @Override public int[] getSlotsForFace( final EnumFacing side ) { - final Block blk = this.worldObj.getBlockState( this.pos ).getBlock(); + final Block blk = this.world.getBlockState( this.pos ).getBlock(); if( blk instanceof AEBaseBlock ) { return this.getAccessibleSlotsBySide( ( (AEBaseBlock) blk ).mapRotation( this, side ) ); diff --git a/src/main/java/appeng/tile/AEBaseTile.java b/src/main/java/appeng/tile/AEBaseTile.java index 234c68c5a..ce14fc0ba 100644 --- a/src/main/java/appeng/tile/AEBaseTile.java +++ b/src/main/java/appeng/tile/AEBaseTile.java @@ -95,7 +95,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile, public boolean notLoaded() { - return !this.worldObj.isBlockLoaded( this.pos ); + return !this.world.isBlockLoaded( this.pos ); } @Nonnull @@ -120,7 +120,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile, { if( state == null ) { - state = worldObj.getBlockState( getPos() ); + state = world.getBlockState( getPos() ); } return state; } @@ -337,10 +337,10 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile, else { // TODO: Optimize Network Load - if( this.worldObj != null ) + if( this.world != null ) { AELog.blockUpdate( this.pos, this ); - this.worldObj.notifyBlockUpdate( this.pos, getBlockState(), getBlockState(), 3 ); + this.world.notifyBlockUpdate( this.pos, getBlockState(), getBlockState(), 3 ); } } } @@ -472,7 +472,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile, this.forward = inForward; this.up = inUp; this.markForUpdate(); - Platform.notifyBlocksOfNeighbors( this.worldObj, this.pos ); + Platform.notifyBlocksOfNeighbors( this.world, this.pos ); } public void onPlacement( final ItemStack stack, final EntityPlayer player, final EnumFacing side ) @@ -618,7 +618,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile, public void securityBreak() { - this.worldObj.destroyBlock( this.pos, true ); + this.world.destroyBlock( this.pos, true ); this.disableDrops(); } diff --git a/src/main/java/appeng/tile/crafting/TileCraftingStorageTile.java b/src/main/java/appeng/tile/crafting/TileCraftingStorageTile.java index d202ac582..c48a885c9 100644 --- a/src/main/java/appeng/tile/crafting/TileCraftingStorageTile.java +++ b/src/main/java/appeng/tile/crafting/TileCraftingStorageTile.java @@ -74,12 +74,12 @@ public class TileCraftingStorageTile extends TileCraftingTile @Override public int getStorageBytes() { - if( this.worldObj == null || this.notLoaded() ) + if( this.world == null || this.notLoaded() ) { return 0; } - final BlockCraftingUnit unit = (BlockCraftingUnit) this.worldObj.getBlockState( this.pos ).getBlock(); + final BlockCraftingUnit unit = (BlockCraftingUnit) this.world.getBlockState( this.pos ).getBlock(); switch( unit.type ) { default: diff --git a/src/main/java/appeng/tile/crafting/TileCraftingTile.java b/src/main/java/appeng/tile/crafting/TileCraftingTile.java index 8980b2119..38d867c48 100644 --- a/src/main/java/appeng/tile/crafting/TileCraftingTile.java +++ b/src/main/java/appeng/tile/crafting/TileCraftingTile.java @@ -93,7 +93,7 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP @Override public boolean canBeRotated() { - return true;// return BlockCraftingUnit.checkType( worldObj.getBlockMetadata( xCoord, yCoord, zCoord ), + return true;// return BlockCraftingUnit.checkType( world.getBlockMetadata( xCoord, yCoord, zCoord ), // BlockCraftingUnit.BASE_MONITOR ); } @@ -109,12 +109,12 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP public boolean isAccelerator() { - if( this.worldObj == null ) + if( this.world == null ) { return false; } - final BlockCraftingUnit unit = (BlockCraftingUnit) this.worldObj.getBlockState( this.pos ).getBlock(); + final BlockCraftingUnit unit = (BlockCraftingUnit) this.world.getBlockState( this.pos ).getBlock(); return unit.type == CraftingUnitType.ACCELERATOR; } @@ -128,7 +128,7 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP public void updateMultiBlock() { - this.calc.calculateMultiblock( this.worldObj, this.getLocation() ); + this.calc.calculateMultiblock( this.world, this.getLocation() ); } public void updateStatus( final CraftingCPUCluster c ) @@ -144,7 +144,7 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP public void updateMeta( final boolean updateFormed ) { - if( this.worldObj == null || this.notLoaded() ) + if( this.world == null || this.notLoaded() ) { return; } @@ -157,7 +157,7 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP power = this.getProxy().isActive(); } - final IBlockState current = this.worldObj.getBlockState( this.pos ); + final IBlockState current = this.world.getBlockState( this.pos ); // The tile might try to update while being destroyed if( current.getBlock() instanceof BlockCraftingUnit ) @@ -168,7 +168,7 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP { // Not using flag 2 here (only send to clients, prevent block update) will cause infinite loops // In case there is an inconsistency in the crafting clusters. - this.worldObj.setBlockState( this.pos, newState, 2 ); + this.world.setBlockState( this.pos, newState, 2 ); } } @@ -189,7 +189,7 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP { if( Platform.isClient() ) { - return (boolean) this.worldObj.getBlockState( this.pos ).getValue( BlockCraftingUnit.FORMED ); + return (boolean) this.world.getBlockState( this.pos ).getValue( BlockCraftingUnit.FORMED ); } return this.cluster != null; } @@ -298,7 +298,7 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP { final WorldCoord wc = new WorldCoord( te ); wc.add( d, 1 ); - if( this.worldObj.isAirBlock( wc.getPos() ) ) + if( this.world.isAirBlock( wc.getPos() ) ) { places.add( wc ); } @@ -328,7 +328,7 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP final WorldCoord wc = places.poll(); places.add( wc ); - Platform.spawnDrops( this.worldObj, wc.getPos(), Collections.singletonList( g.getItemStack() ) ); + Platform.spawnDrops( this.world, wc.getPos(), Collections.singletonList( g.getItemStack() ) ); } } @@ -341,7 +341,7 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP { if( Platform.isClient() ) { - return (boolean) this.worldObj.getBlockState( this.pos ).getValue( BlockCraftingUnit.POWERED ); + return (boolean) this.world.getBlockState( this.pos ).getValue( BlockCraftingUnit.POWERED ); } return this.getProxy().isActive(); } diff --git a/src/main/java/appeng/tile/crafting/TileMolecularAssembler.java b/src/main/java/appeng/tile/crafting/TileMolecularAssembler.java index 7009fbfd6..3c4f68f54 100644 --- a/src/main/java/appeng/tile/crafting/TileMolecularAssembler.java +++ b/src/main/java/appeng/tile/crafting/TileMolecularAssembler.java @@ -236,7 +236,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade { if( data.hasKey( "myPlan" ) ) { - final ItemStack myPat = ItemStack.loadItemStackFromNBT( data.getCompoundTag( "myPlan" ) ); + final ItemStack myPat = new ItemStack( data.getCompoundTag( "myPlan" ) ); if( myPat != null && myPat.getItem() instanceof ItemEncodedPattern ) { @@ -509,7 +509,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade try { - final TargetPoint where = new TargetPoint( this.worldObj.provider.getDimension(), this.pos.getX(), this.pos.getY(), this.pos.getZ(), 32 ); + final TargetPoint where = new TargetPoint( this.world.provider.getDimension(), this.pos.getX(), this.pos.getY(), this.pos.getZ(), 32 ); final IAEItemStack item = AEItemStack.create( output ); NetworkHandler.instance().sendToAllAround( new PacketAssemblerAnimation( this.pos, (byte) speed, item ), where ); } @@ -536,7 +536,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade final ItemStack is = this.inv.getStackInSlot( x ); if( is != null ) { - if( this.myPlan == null || !this.myPlan.isValidItemForSlot( x, is, this.worldObj ) ) + if( this.myPlan == null || !this.myPlan.isValidItemForSlot( x, is, this.world ) ) { this.inv.setInventorySlotContents( 9, is ); this.inv.setInventorySlotContents( x, null ); @@ -604,9 +604,9 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade return output; } - final int size = output.stackSize; + final int size = output.getCount(); output = adaptor.addItems( output ); - final int newSize = output == null ? 0 : output.stackSize; + final int newSize = output == null ? 0 : output.getCount(); if( size != newSize ) { @@ -654,4 +654,11 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade return this.isPowered; } + @Override + public boolean isEmpty() + { + // TODO Auto-generated method stub + return false; + } + } diff --git a/src/main/java/appeng/tile/grindstone/TileCrank.java b/src/main/java/appeng/tile/grindstone/TileCrank.java index 2890aca38..fa372f501 100644 --- a/src/main/java/appeng/tile/grindstone/TileCrank.java +++ b/src/main/java/appeng/tile/grindstone/TileCrank.java @@ -82,7 +82,7 @@ public class TileCrank extends AEBaseTile implements ICustomCollision, ITickable } final EnumFacing grinder = this.getUp().getOpposite(); - final TileEntity te = this.worldObj.getTileEntity( this.pos.offset( grinder ) ); + final TileEntity te = this.world.getTileEntity( this.pos.offset( grinder ) ); if( te instanceof ICrankable ) { return (ICrankable) te; @@ -107,8 +107,8 @@ public class TileCrank extends AEBaseTile implements ICustomCollision, ITickable public void setOrientation( final EnumFacing inForward, final EnumFacing inUp ) { super.setOrientation( inForward, inUp ); - final IBlockState state = this.worldObj.getBlockState( this.pos ); - this.getBlockType().neighborChanged( state, this.worldObj, this.pos, state.getBlock() ); + final IBlockState state = this.world.getBlockState( this.pos ); + this.getBlockType().neighborChanged( state, this.world, this.pos, state.getBlock(), this.pos ); } @Override @@ -144,7 +144,7 @@ public class TileCrank extends AEBaseTile implements ICustomCollision, ITickable this.hits++; if( this.hits > 10 ) { - this.worldObj.destroyBlock( this.pos, false ); + this.world.destroyBlock( this.pos, false ); } } } diff --git a/src/main/java/appeng/tile/grindstone/TileGrinder.java b/src/main/java/appeng/tile/grindstone/TileGrinder.java index 0d0bee0e5..71ba1d4a3 100644 --- a/src/main/java/appeng/tile/grindstone/TileGrinder.java +++ b/src/main/java/appeng/tile/grindstone/TileGrinder.java @@ -50,8 +50,8 @@ public class TileGrinder extends AEBaseInvTile implements ICrankable public void setOrientation( final EnumFacing inForward, final EnumFacing inUp ) { super.setOrientation( inForward, inUp ); - final IBlockState state = this.worldObj.getBlockState( this.pos ); - this.getBlockType().neighborChanged( state, this.worldObj, this.pos, state.getBlock() ); + final IBlockState state = this.world.getBlockState( this.pos ); + this.getBlockType().neighborChanged( state, this.world, this.pos, state.getBlock(), this.pos ); } @Override @@ -111,13 +111,13 @@ public class TileGrinder extends AEBaseInvTile implements ICrankable final IGrinderRecipe r = AEApi.instance().registries().grinder().getRecipeForInput( item ); if( r != null ) { - if( item.stackSize >= r.getInput().stackSize ) + if( item.getCount() >= r.getInput().getCount() ) { - item.stackSize -= r.getInput().stackSize; + item.grow( -r.getInput().getCount() ); final ItemStack ais = item.copy(); - ais.stackSize = r.getInput().stackSize; + ais.setCount( r.getInput().getCount() ); - if( item.stackSize <= 0 ) + if( item.getCount() <= 0 ) { item = null; } @@ -194,7 +194,7 @@ public class TileGrinder extends AEBaseInvTile implements ICrankable final List out = new ArrayList(); out.add( notAdded ); - Platform.spawnDrops( this.worldObj, this.pos.offset( this.getForward() ), out ); + Platform.spawnDrops( this.world, this.pos.offset( this.getForward() ), out ); } } @@ -203,4 +203,11 @@ public class TileGrinder extends AEBaseInvTile implements ICrankable { return this.getUp() == directionToCrank; } + + @Override + public boolean isEmpty() + { + // TODO Auto-generated method stub + return false; + } } diff --git a/src/main/java/appeng/tile/inventory/AppEngInternalAEInventory.java b/src/main/java/appeng/tile/inventory/AppEngInternalAEInventory.java index 7d778b493..b42c0e61d 100644 --- a/src/main/java/appeng/tile/inventory/AppEngInternalAEInventory.java +++ b/src/main/java/appeng/tile/inventory/AppEngInternalAEInventory.java @@ -156,7 +156,7 @@ public class AppEngInternalAEInventory implements IInventory, Iterable= split.stackSize ) + if( qty >= split.getCount() ) { ns = this.getStackInSlot( slot ); this.inv[slot] = null; @@ -196,16 +196,16 @@ public class AppEngInternalAEInventory implements IInventory, Iterable newItemStack.stackSize ) + if( oldStack.getCount() > newItemStack.getCount() ) { removed = removed.copy(); - removed.stackSize -= newItemStack.stackSize; + removed.grow( -newItemStack.getCount() ); added = null; } - else if( oldStack.stackSize < newItemStack.stackSize ) + else if( oldStack.getCount() < newItemStack.getCount() ) { added = added.copy(); - added.stackSize -= oldStack.stackSize; + added.grow( -oldStack.getCount() ); removed = null; } else @@ -246,7 +246,7 @@ public class AppEngInternalAEInventory implements IInventory, Iterable final ItemStack split = this.getStackInSlot( slot ); ItemStack ns = null; - if( qty >= split.stackSize ) + if( qty >= split.getCount() ) { ns = this.inv[slot]; this.inv[slot] = null; @@ -126,16 +126,16 @@ public class AppEngInternalInventory implements IInventory, Iterable if( oldStack != null && newItemStack != null && Platform.itemComparisons().isEqualItem( oldStack, newItemStack ) ) { - if( oldStack.stackSize > newItemStack.stackSize ) + if( oldStack.getCount() > newItemStack.getCount() ) { removed = removed.copy(); - removed.stackSize -= newItemStack.stackSize; + removed.grow( -newItemStack.getCount() ); added = null; } - else if( oldStack.stackSize < newItemStack.stackSize ) + else if( oldStack.getCount() < newItemStack.getCount() ) { added = added.copy(); - added.stackSize -= oldStack.stackSize; + added.grow( -oldStack.getCount() ); removed = null; } else @@ -178,7 +178,7 @@ public class AppEngInternalInventory implements IInventory, Iterable } @Override - public boolean isUseableByPlayer( final EntityPlayer var1 ) + public boolean isUsableByPlayer( final EntityPlayer var1 ) { return true; } @@ -250,7 +250,7 @@ public class AppEngInternalInventory implements IInventory, Iterable if( c != null ) { - this.inv[x] = ItemStack.loadItemStackFromNBT( c ); + this.inv[x] = new ItemStack( c ); } } catch( final Exception e ) diff --git a/src/main/java/appeng/tile/inventory/AppEngNullInventory.java b/src/main/java/appeng/tile/inventory/AppEngNullInventory.java index 3a85a9b13..b9696e105 100644 --- a/src/main/java/appeng/tile/inventory/AppEngNullInventory.java +++ b/src/main/java/appeng/tile/inventory/AppEngNullInventory.java @@ -92,7 +92,7 @@ public class AppEngNullInventory implements IInventory } @Override - public boolean isUseableByPlayer( final EntityPlayer var1 ) + public boolean isUsableByPlayer( final EntityPlayer var1 ) { return false; } @@ -144,4 +144,10 @@ public class AppEngNullInventory implements IInventory { } + + @Override + public boolean isEmpty() + { + return true; + } } diff --git a/src/main/java/appeng/tile/misc/TileCharger.java b/src/main/java/appeng/tile/misc/TileCharger.java index 843b8638e..bfd9c777d 100644 --- a/src/main/java/appeng/tile/misc/TileCharger.java +++ b/src/main/java/appeng/tile/misc/TileCharger.java @@ -142,7 +142,7 @@ public class TileCharger extends AENetworkPowerTile implements ICrankable, IGrid { this.extractAEPower( this.getInternalMaxPower(), Actionable.MODULATE, PowerMultiplier.CONFIG );// 1500 - materials.certusQuartzCrystalCharged().maybeStack( myItem.stackSize ).ifPresent( charged -> this.setInventorySlotContents( 0, charged ) ); + materials.certusQuartzCrystalCharged().maybeStack( myItem.getCount() ).ifPresent( charged -> this.setInventorySlotContents( 0, charged ) ); } } } @@ -232,7 +232,7 @@ public class TileCharger extends AENetworkPowerTile implements ICrankable, IGrid final List drops = new ArrayList(); drops.add( myItem ); this.setInventorySlotContents( 0, null ); - Platform.spawnDrops( this.worldObj, this.pos.offset( this.getForward() ), drops ); + Platform.spawnDrops( this.world, this.pos.offset( this.getForward() ), drops ); } } @@ -296,10 +296,17 @@ public class TileCharger extends AENetworkPowerTile implements ICrankable, IGrid { this.extractAEPower( this.getInternalMaxPower(), Actionable.MODULATE, PowerMultiplier.CONFIG );// 1500 - materials.certusQuartzCrystalCharged().maybeStack( myItem.stackSize ).ifPresent( charged -> this.setInventorySlotContents( 0, charged ) ); + materials.certusQuartzCrystalCharged().maybeStack( myItem.getCount() ).ifPresent( charged -> this.setInventorySlotContents( 0, charged ) ); } } return true; } + + @Override + public boolean isEmpty() + { + // TODO Auto-generated method stub + return false; + } } diff --git a/src/main/java/appeng/tile/misc/TileCondenser.java b/src/main/java/appeng/tile/misc/TileCondenser.java index a47b91e24..9c508e572 100644 --- a/src/main/java/appeng/tile/misc/TileCondenser.java +++ b/src/main/java/appeng/tile/misc/TileCondenser.java @@ -135,7 +135,8 @@ public class TileCondenser extends AEBaseInvTile implements IConfigManagerHost, private boolean canAddOutput( final ItemStack output ) { final ItemStack outputStack = this.getStackInSlot( 1 ); - return outputStack == null || ( Platform.itemComparisons().isEqualItem( outputStack, output ) && outputStack.stackSize < outputStack.getMaxStackSize() ); + return outputStack == null || ( Platform.itemComparisons().isEqualItem( outputStack, + output ) && outputStack.getCount() < outputStack.getMaxStackSize() ); } /** @@ -152,7 +153,7 @@ public class TileCondenser extends AEBaseInvTile implements IConfigManagerHost, } else { - outputStack.stackSize++; + outputStack.grow( 1 ); this.setInventorySlotContents( 1, outputStack ); } } @@ -193,7 +194,7 @@ public class TileCondenser extends AEBaseInvTile implements IConfigManagerHost, { if( itemstack != null ) { - this.addPower( itemstack.stackSize ); + this.addPower( itemstack.getCount() ); } } else @@ -216,7 +217,7 @@ public class TileCondenser extends AEBaseInvTile implements IConfigManagerHost, final ItemStack is = inv.getStackInSlot( 0 ); if( is != null ) { - this.addPower( is.stackSize ); + this.addPower( is.getCount() ); inv.setInventorySlotContents( 0, null ); } } @@ -325,7 +326,7 @@ public class TileCondenser extends AEBaseInvTile implements IConfigManagerHost, } if( !simulate && stack != null ) { - addPower( stack.stackSize ); + addPower( stack.getCount() ); } return null; } @@ -335,12 +336,16 @@ public class TileCondenser extends AEBaseInvTile implements IConfigManagerHost, { return null; } + + @Override + public int getSlotLimit( int slot ) + { + return 0; + } } - private static final IFluidTankProperties[] EMPTY = { new FluidTankProperties( null, 10, true, false ) }; - /** * A fluid handler that exposes a 10 bucket tank that can only be filled, and - when filled - will add power * to this condenser. @@ -380,10 +385,11 @@ public class TileCondenser extends AEBaseInvTile implements IConfigManagerHost, } } - /** - * This is used to expose a fake ME subnetwork that is only composed of this condenser tile. The purpose of this is to enable the condenser to - * override the {@link appeng.api.storage.IMEInventoryHandler#validForPass(int)} method to make sure a condenser is only ever used if an item + * This is used to expose a fake ME subnetwork that is only composed of this condenser tile. The purpose of this is + * to enable the condenser to + * override the {@link appeng.api.storage.IMEInventoryHandler#validForPass(int)} method to make sure a condenser is + * only ever used if an item * can't go anywhere else. */ private class MEHandler implements IStorageMonitorableAccessor, IStorageMonitorable @@ -411,4 +417,11 @@ public class TileCondenser extends AEBaseInvTile implements IConfigManagerHost, return fluidInventory; } } + + @Override + public boolean isEmpty() + { + // TODO Auto-generated method stub + return false; + } } diff --git a/src/main/java/appeng/tile/misc/TileInscriber.java b/src/main/java/appeng/tile/misc/TileInscriber.java index ef6e168a7..99daf0a27 100644 --- a/src/main/java/appeng/tile/misc/TileInscriber.java +++ b/src/main/java/appeng/tile/misc/TileInscriber.java @@ -344,17 +344,17 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable, final ItemStack plateB = this.getStackInSlot( 1 ); ItemStack renamedItem = this.getStackInSlot( 2 ); - if( plateA != null && plateA.stackSize > 1 ) + if( plateA != null && plateA.getCount() > 1 ) { return null; } - if( plateB != null && plateB.stackSize > 1 ) + if( plateB != null && plateB.getCount() > 1 ) { return null; } - if( renamedItem != null && renamedItem.stackSize > 1 ) + if( renamedItem != null && renamedItem.getCount() > 1 ) { return null; } @@ -723,6 +723,20 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable, } } + @Override + public int getSlotLimit( int slot ) + { + // TODO Auto-generated method stub + return 0; + } + + } + + @Override + public boolean isEmpty() + { + // TODO Auto-generated method stub + return false; } } diff --git a/src/main/java/appeng/tile/misc/TileInterface.java b/src/main/java/appeng/tile/misc/TileInterface.java index ca3f1e0d1..2574d67c2 100644 --- a/src/main/java/appeng/tile/misc/TileInterface.java +++ b/src/main/java/appeng/tile/misc/TileInterface.java @@ -361,4 +361,11 @@ public class TileInterface extends AENetworkInvTile implements IGridTickable, II } return super.getCapability( capability, facing ); } + + @Override + public boolean isEmpty() + { + // TODO Auto-generated method stub + return false; + } } diff --git a/src/main/java/appeng/tile/misc/TileLightDetector.java b/src/main/java/appeng/tile/misc/TileLightDetector.java index c514a5ee8..a6ab84b2e 100644 --- a/src/main/java/appeng/tile/misc/TileLightDetector.java +++ b/src/main/java/appeng/tile/misc/TileLightDetector.java @@ -49,12 +49,12 @@ public class TileLightDetector extends AEBaseTile implements ITickable public void updateLight() { - final int val = this.worldObj.getLight( this.pos ); + final int val = this.world.getLight( this.pos ); if( this.lastLight != val ) { this.lastLight = val; - Platform.notifyBlocksOfNeighbors( this.worldObj, this.pos ); + Platform.notifyBlocksOfNeighbors( this.world, this.pos ); } } diff --git a/src/main/java/appeng/tile/misc/TilePaint.java b/src/main/java/appeng/tile/misc/TilePaint.java index 373326ca4..bd38ba9d8 100644 --- a/src/main/java/appeng/tile/misc/TilePaint.java +++ b/src/main/java/appeng/tile/misc/TilePaint.java @@ -130,9 +130,9 @@ public class TilePaint extends AEBaseTile this.isLit = 14; } - if( this.worldObj != null ) + if( this.world != null ) { - this.worldObj.getLightFor( EnumSkyBlock.BLOCK, this.pos ); + this.world.getLightFor( EnumSkyBlock.BLOCK, this.pos ); } } @@ -170,8 +170,8 @@ public class TilePaint extends AEBaseTile public boolean isSideValid( final EnumFacing side ) { final BlockPos p = this.pos.offset( side ); - final IBlockState blk = this.worldObj.getBlockState( p ); - return blk.getBlock().isSideSolid( this.worldObj.getBlockState( p ), this.worldObj, p, side.getOpposite() ); + final IBlockState blk = this.world.getBlockState( p ); + return blk.getBlock().isSideSolid( this.world.getBlockState( p ), this.world, p, side.getOpposite() ); } private void removeSide( final EnumFacing side ) @@ -210,7 +210,7 @@ public class TilePaint extends AEBaseTile if( this.dots == null ) { - this.worldObj.setBlockToAir( this.pos ); + this.world.setBlockToAir( this.pos ); } } @@ -235,8 +235,8 @@ public class TilePaint extends AEBaseTile { final BlockPos p = this.pos.offset( side ); - final IBlockState blk = this.worldObj.getBlockState( p ); - if( blk.getBlock().isSideSolid( this.worldObj.getBlockState( p ), this.worldObj, p, side.getOpposite() ) ) + final IBlockState blk = this.world.getBlockState( p ); + if( blk.getBlock().isSideSolid( this.world.getBlockState( p ), this.world, p, side.getOpposite() ) ) { final ItemPaintBall ipb = (ItemPaintBall) type.getItem(); diff --git a/src/main/java/appeng/tile/misc/TileSecurityStation.java b/src/main/java/appeng/tile/misc/TileSecurityStation.java index 37175d71e..4a6b8d3f4 100644 --- a/src/main/java/appeng/tile/misc/TileSecurityStation.java +++ b/src/main/java/appeng/tile/misc/TileSecurityStation.java @@ -194,7 +194,7 @@ public class TileSecurityStation extends AENetworkTile implements ITerminalHost, final NBTBase obj = storedItems.getTag( (String) key ); if( obj instanceof NBTTagCompound ) { - this.inventory.getStoredItems().add( AEItemStack.create( ItemStack.loadItemStackFromNBT( (NBTTagCompound) obj ) ) ); + this.inventory.getStoredItems().add( AEItemStack.create( new ItemStack( (NBTTagCompound) obj ) ) ); } } } diff --git a/src/main/java/appeng/tile/misc/TileVibrationChamber.java b/src/main/java/appeng/tile/misc/TileVibrationChamber.java index ae3997b57..55fafebd0 100644 --- a/src/main/java/appeng/tile/misc/TileVibrationChamber.java +++ b/src/main/java/appeng/tile/misc/TileVibrationChamber.java @@ -160,7 +160,7 @@ public class TileVibrationChamber extends AENetworkInvTile implements IGridTicka if( is != null ) { final int newBurnTime = TileEntityFurnace.getItemBurnTime( is ); - if( newBurnTime > 0 && is.stackSize > 0 ) + if( newBurnTime > 0 && is.getCount() > 0 ) { return true; } @@ -247,12 +247,12 @@ public class TileVibrationChamber extends AENetworkInvTile implements IGridTicka if( is != null ) { final int newBurnTime = TileEntityFurnace.getItemBurnTime( is ); - if( newBurnTime > 0 && is.stackSize > 0 ) + if( newBurnTime > 0 && is.getCount() > 0 ) { this.setBurnTime( this.getBurnTime() + newBurnTime ); this.setMaxBurnTime( this.getBurnTime() ); - is.stackSize--; - if( is.stackSize <= 0 ) + is.grow( -1 ); + if( is.getCount() <= 0 ) { ItemStack container = null; @@ -290,9 +290,9 @@ public class TileVibrationChamber extends AENetworkInvTile implements IGridTicka this.isOn = this.getBurnTime() > 0; this.markForUpdate(); - if( this.hasWorldObj() ) + if( this.hasWorld() ) { - Platform.notifyBlocksOfNeighbors( this.worldObj, this.pos ); + Platform.notifyBlocksOfNeighbors( this.world, this.pos ); } } } @@ -326,4 +326,11 @@ public class TileVibrationChamber extends AENetworkInvTile implements IGridTicka { this.burnTime = burnTime; } + + @Override + public boolean isEmpty() + { + // TODO Auto-generated method stub + return false; + } } diff --git a/src/main/java/appeng/tile/networking/TileCableBus.java b/src/main/java/appeng/tile/networking/TileCableBus.java index 8f410d7c8..f9b1b13bb 100644 --- a/src/main/java/appeng/tile/networking/TileCableBus.java +++ b/src/main/java/appeng/tile/networking/TileCableBus.java @@ -87,7 +87,7 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl if( newLV != this.oldLV ) { this.oldLV = newLV; - this.worldObj.checkLight( this.pos ); + this.world.checkLight( this.pos ); } this.updateTileSetting(); @@ -176,7 +176,7 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl @Override public void markForUpdate() { - if( this.worldObj == null ) + if( this.world == null ) { return; } @@ -185,8 +185,8 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl if( newLV != this.oldLV ) { this.oldLV = newLV; - this.worldObj.checkLight( this.pos ); - // worldObj.updateAllLightTypes( xCoord, yCoord, zCoord ); + this.world.checkLight( this.pos ); + // world.updateAllLightTypes( xCoord, yCoord, zCoord ); } super.markForUpdate(); @@ -216,9 +216,9 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl super.onReady(); if( this.getCableBus().isEmpty() ) { - if( this.worldObj.getTileEntity( this.pos ) == this ) + if( this.world.getTileEntity( this.pos ) == this ) { - this.worldObj.destroyBlock( this.pos, true ); + this.world.destroyBlock( this.pos, true ); } } else @@ -354,9 +354,9 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl @Override public void notifyNeighbors() { - if( this.worldObj != null && this.worldObj.isBlockLoaded( this.pos ) && !CableBusContainer.isLoading() ) + if( this.world != null && this.world.isBlockLoaded( this.pos ) && !CableBusContainer.isLoading() ) { - Platform.notifyBlocksOfNeighbors( this.worldObj, this.pos ); + Platform.notifyBlocksOfNeighbors( this.world, this.pos ); } } diff --git a/src/main/java/appeng/tile/networking/TileController.java b/src/main/java/appeng/tile/networking/TileController.java index f37b3cacd..f14040068 100644 --- a/src/main/java/appeng/tile/networking/TileController.java +++ b/src/main/java/appeng/tile/networking/TileController.java @@ -128,9 +128,9 @@ public class TileController extends AENetworkPowerTile metaState = ControllerBlockState.offline; } - if( this.checkController( this.pos ) && this.worldObj.getBlockState( this.pos ).getValue( BlockController.CONTROLLER_STATE ) != metaState ) + if( this.checkController( this.pos ) && this.world.getBlockState( this.pos ).getValue( BlockController.CONTROLLER_STATE ) != metaState ) { - this.worldObj.setBlockState( this.pos, this.worldObj.getBlockState( this.pos ).withProperty( BlockController.CONTROLLER_STATE, metaState ) ); + this.world.setBlockState( this.pos, this.world.getBlockState( this.pos ).withProperty( BlockController.CONTROLLER_STATE, metaState ) ); } } @@ -219,11 +219,18 @@ public class TileController extends AENetworkPowerTile private boolean checkController( final BlockPos pos ) { final BlockPos ownPos = this.getPos(); - if( this.worldObj.getChunkProvider().getLoadedChunk( ownPos.getX() >> 4, ownPos.getZ() >> 4 ) != null ) + if( this.world.getChunkProvider().getLoadedChunk( ownPos.getX() >> 4, ownPos.getZ() >> 4 ) != null ) { - return this.worldObj.getTileEntity( pos ) instanceof TileController; + return this.world.getTileEntity( pos ) instanceof TileController; } return false; } + + @Override + public boolean isEmpty() + { + // TODO Auto-generated method stub + return false; + } } diff --git a/src/main/java/appeng/tile/networking/TileEnergyAcceptor.java b/src/main/java/appeng/tile/networking/TileEnergyAcceptor.java index 90cb03cdf..77196906d 100644 --- a/src/main/java/appeng/tile/networking/TileEnergyAcceptor.java +++ b/src/main/java/appeng/tile/networking/TileEnergyAcceptor.java @@ -119,4 +119,11 @@ public class TileEnergyAcceptor extends AENetworkPowerTile return this.sides; } + @Override + public boolean isEmpty() + { + // TODO Auto-generated method stub + return false; + } + } diff --git a/src/main/java/appeng/tile/networking/TileEnergyCell.java b/src/main/java/appeng/tile/networking/TileEnergyCell.java index 14eaacc45..89c4ba168 100644 --- a/src/main/java/appeng/tile/networking/TileEnergyCell.java +++ b/src/main/java/appeng/tile/networking/TileEnergyCell.java @@ -60,7 +60,7 @@ public class TileEnergyCell extends AENetworkTile implements IAEPowerStorage public void onReady() { super.onReady(); - final int value = this.worldObj.getBlockState( this.pos ).getValue( BlockEnergyCell.ENERGY_STORAGE ); + final int value = this.world.getBlockState( this.pos ).getValue( BlockEnergyCell.ENERGY_STORAGE ); this.currentMeta = (byte) value; this.changePowerLevel(); } @@ -95,14 +95,14 @@ public class TileEnergyCell extends AENetworkTile implements IAEPowerStorage if( this.currentMeta != storageLevel ) { this.currentMeta = (byte) storageLevel; - this.worldObj.setBlockState( this.pos, this.worldObj.getBlockState( this.pos ).withProperty( BlockEnergyCell.ENERGY_STORAGE, storageLevel ) ); + this.world.setBlockState( this.pos, this.world.getBlockState( this.pos ).withProperty( BlockEnergyCell.ENERGY_STORAGE, storageLevel ) ); } } @TileEvent( TileEventType.WORLD_NBT_WRITE ) public void writeToNBT_TileEnergyCell( final NBTTagCompound data ) { - if( !this.worldObj.isRemote ) + if( !this.world.isRemote ) { data.setDouble( "internalCurrentPower", this.internalCurrentPower ); } diff --git a/src/main/java/appeng/tile/networking/TileWireless.java b/src/main/java/appeng/tile/networking/TileWireless.java index 3a198798e..ccac20976 100644 --- a/src/main/java/appeng/tile/networking/TileWireless.java +++ b/src/main/java/appeng/tile/networking/TileWireless.java @@ -169,7 +169,7 @@ public class TileWireless extends AENetworkInvTile implements IWirelessAccessPoi private int getBoosters() { final ItemStack boosters = this.inv.getStackInSlot( 0 ); - return boosters == null ? 0 : boosters.stackSize; + return boosters == null ? 0 : boosters.getCount(); } @Override @@ -223,4 +223,11 @@ public class TileWireless extends AENetworkInvTile implements IWirelessAccessPoi { this.clientFlags = clientFlags; } + + @Override + public boolean isEmpty() + { + // TODO Auto-generated method stub + return false; + } } diff --git a/src/main/java/appeng/tile/qnb/TileQuantumBridge.java b/src/main/java/appeng/tile/qnb/TileQuantumBridge.java index 22f003702..2a13e5e48 100644 --- a/src/main/java/appeng/tile/qnb/TileQuantumBridge.java +++ b/src/main/java/appeng/tile/qnb/TileQuantumBridge.java @@ -259,7 +259,7 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock for( final EnumFacing d : EnumFacing.values() ) { - final TileEntity te = this.worldObj.getTileEntity( this.pos.offset( d ) ); + final TileEntity te = this.world.getTileEntity( this.pos.offset( d ) ); if( te instanceof TileQuantumBridge ) { set.add( d ); @@ -315,7 +315,7 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock public void neighborUpdate() { - this.calc.calculateMultiblock( this.worldObj, this.getLocation() ); + this.calc.calculateMultiblock( this.world, this.getLocation() ); } @Override @@ -345,4 +345,11 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock { return this.corner; } + + @Override + public boolean isEmpty() + { + // TODO Auto-generated method stub + return false; + } } diff --git a/src/main/java/appeng/tile/spatial/TileSpatialIOPort.java b/src/main/java/appeng/tile/spatial/TileSpatialIOPort.java index 103423a9c..5f8b1e462 100644 --- a/src/main/java/appeng/tile/spatial/TileSpatialIOPort.java +++ b/src/main/java/appeng/tile/spatial/TileSpatialIOPort.java @@ -89,7 +89,7 @@ public class TileSpatialIOPort extends AENetworkInvTile implements IWorldCallabl public void updateRedstoneState() { - final YesNo currentState = this.worldObj.isBlockIndirectlyGettingPowered( this.pos ) != 0 ? YesNo.YES : YesNo.NO; + final YesNo currentState = this.world.isBlockIndirectlyGettingPowered( this.pos ) != 0 ? YesNo.YES : YesNo.NO; if( this.lastRedstoneState != currentState ) { this.lastRedstoneState = currentState; @@ -143,7 +143,7 @@ public class TileSpatialIOPort extends AENetworkInvTile implements IWorldCallabl final MENetworkEvent res = gi.postEvent( new MENetworkSpatialEvent( this, req ) ); if( !res.isCanceled() ) { - final TransitionResult tr = sc.doSpatialTransition( cell, this.worldObj, spc.getMin(), spc.getMax(), true ); + final TransitionResult tr = sc.doSpatialTransition( cell, this.world, spc.getMin(), spc.getMax(), true ); if( tr.success ) { energy.extractAEPower( req, Actionable.MODULATE, PowerMultiplier.CONFIG ); @@ -205,4 +205,11 @@ public class TileSpatialIOPort extends AENetworkInvTile implements IWorldCallabl { return this.sides; } + + @Override + public boolean isEmpty() + { + // TODO Auto-generated method stub + return false; + } } diff --git a/src/main/java/appeng/tile/spatial/TileSpatialPylon.java b/src/main/java/appeng/tile/spatial/TileSpatialPylon.java index 736c493cd..c649ef1ec 100644 --- a/src/main/java/appeng/tile/spatial/TileSpatialPylon.java +++ b/src/main/java/appeng/tile/spatial/TileSpatialPylon.java @@ -96,7 +96,7 @@ public class TileSpatialPylon extends AENetworkTile implements IAEMultiBlock public void neighborChanged() { - this.calc.calculateMultiblock( this.worldObj, this.getLocation() ); + this.calc.calculateMultiblock( this.world, this.getLocation() ); } @Override @@ -197,8 +197,8 @@ public class TileSpatialPylon extends AENetworkTile implements IAEMultiBlock if( hasLight != this.didHaveLight ) { this.didHaveLight = hasLight; - this.worldObj.checkLight( this.pos ); - // worldObj.updateAllLightTypes( xCoord, yCoord, zCoord ); + this.world.checkLight( this.pos ); + // world.updateAllLightTypes( xCoord, yCoord, zCoord ); } } diff --git a/src/main/java/appeng/tile/storage/TileChest.java b/src/main/java/appeng/tile/storage/TileChest.java index ff1def6ec..465a26a83 100644 --- a/src/main/java/appeng/tile/storage/TileChest.java +++ b/src/main/java/appeng/tile/storage/TileChest.java @@ -35,10 +35,6 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumFacing; import net.minecraft.util.ITickable; import net.minecraftforge.common.capabilities.Capability; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.FluidTankInfo; -import net.minecraftforge.fluids.IFluidHandler; import appeng.api.AEApi; import appeng.api.config.AccessRestriction; @@ -95,10 +91,9 @@ import appeng.tile.inventory.InvOperation; import appeng.util.ConfigManager; import appeng.util.IConfigManagerHost; import appeng.util.Platform; -import appeng.util.item.AEFluidStack; -public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHandler, ITerminalHost, IPriorityHost, IConfigManagerHost, IColorableTile, ITickable +public class TileChest extends AENetworkPowerTile implements IMEChest, ITerminalHost, IPriorityHost, IConfigManagerHost, IColorableTile, ITickable { private static final ChestNoHandler NO_HANDLER = new ChestNoHandler(); @@ -336,7 +331,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan @Override public boolean isCellBlinking( final int slot ) { - final long now = this.worldObj.getTotalWorldTime(); + final long now = this.world.getTotalWorldTime(); if( now - this.lastStateChange > 8 ) { return false; @@ -371,7 +366,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan @Override public void update() { - if( this.worldObj.isRemote ) + if( this.world.isRemote ) { return; } @@ -407,7 +402,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan @TileEvent( TileEventType.NETWORK_WRITE ) public void writeToStream_TileChest( final ByteBuf data ) { - if( this.worldObj.getTotalWorldTime() - this.lastStateChange > 8 ) + if( this.world.getTotalWorldTime() - this.lastStateChange > 8 ) { this.state = 0; } @@ -466,7 +461,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan this.storageType = new ItemStack( Item.getItemById( item & 0xffff ), 1, item >> Platform.DEF_OFFSET ); } - this.lastStateChange = this.worldObj.getTotalWorldTime(); + this.lastStateChange = this.world.getTotalWorldTime(); return oldPaintedColor != this.paintedColor || ( this.state & 0xDB6DB6DB ) != ( oldState & 0xDB6DB6DB ) || !Platform.itemComparisons().isSameItem( oldType, this.storageType ); } @@ -549,9 +544,9 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan } // update the neighbors - if( this.worldObj != null ) + if( this.world != null ) { - Platform.notifyBlocksOfNeighbors( this.worldObj, this.pos ); + Platform.notifyBlocksOfNeighbors( this.world, this.pos ); this.markForUpdate(); } } @@ -577,7 +572,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan { final IMEInventory cell = this.getHandler( StorageChannel.ITEMS ); final IAEItemStack returns = cell.injectItems( AEApi.instance().storage().createItemStack( this.inv.getStackInSlot( 0 ) ), Actionable.SIMULATE, this.mySrc ); - return returns == null || returns.getStackSize() != insertingItem.stackSize; + return returns == null || returns.getStackSize() != insertingItem.getCount(); } catch( final ChestNoHandler ignored ) { @@ -687,7 +682,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan @Override public void blinkCell( final int slot ) { - final long now = this.worldObj.getTotalWorldTime(); + final long now = this.world.getTotalWorldTime(); if( now - this.lastStateChange > 8 ) { this.state = 0; @@ -699,84 +694,6 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan this.recalculateDisplay(); } - @Override - public int fill( final EnumFacing from, final FluidStack resource, final boolean doFill ) - { - final double req = resource.amount / 500.0; - final double available = this.extractAEPower( req, Actionable.SIMULATE, PowerMultiplier.CONFIG ); - if( available >= req - 0.01 ) - { - try - { - final IMEInventoryHandler h = this.getHandler( StorageChannel.FLUIDS ); - - this.extractAEPower( req, Actionable.MODULATE, PowerMultiplier.CONFIG ); - final IAEStack results = h.injectItems( AEFluidStack.create( resource ), doFill ? Actionable.MODULATE : Actionable.SIMULATE, this.mySrc ); - - if( results == null ) - { - return resource.amount; - } - - return resource.amount - (int) results.getStackSize(); - } - catch( final ChestNoHandler ignored ) - { - } - } - return 0; - } - - @Override - public FluidStack drain( final EnumFacing from, final FluidStack resource, final boolean doDrain ) - { - return null; - } - - @Override - public FluidStack drain( final EnumFacing from, final int maxDrain, final boolean doDrain ) - { - return null; - } - - @Override - public boolean canFill( final EnumFacing from, final Fluid fluid ) - { - try - { - final IMEInventoryHandler h = this.getHandler( StorageChannel.FLUIDS ); - return h.canAccept( AEFluidStack.create( new FluidStack( fluid, 1 ) ) ); - } - catch( final ChestNoHandler ignored ) - { - } - return false; - } - - @Override - public boolean canDrain( final EnumFacing from, final Fluid fluid ) - { - return false; - } - - @Override - public FluidTankInfo[] getTankInfo( final EnumFacing from ) - { - try - { - final IMEInventoryHandler h = this.getHandler( StorageChannel.FLUIDS ); - if( h.getChannel() == StorageChannel.FLUIDS ) - { - return new FluidTankInfo[] { new FluidTankInfo( null, 1 ) }; // eh? - } - } - catch( final ChestNoHandler ignored ) - { - } - - return null; - } - public ItemStack getStorageType() { if( this.isPowered() ) @@ -854,7 +771,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan @Override public void saveChanges( final IMEInventory cellInventory ) { - this.worldObj.markChunkDirty( this.pos, this ); + this.world.markChunkDirty( this.pos, this ); } private static class ChestNoHandler extends Exception @@ -1022,4 +939,11 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan } } + @Override + public boolean isEmpty() + { + // TODO Auto-generated method stub + return false; + } + } diff --git a/src/main/java/appeng/tile/storage/TileDrive.java b/src/main/java/appeng/tile/storage/TileDrive.java index c64334d9c..e7e73b430 100644 --- a/src/main/java/appeng/tile/storage/TileDrive.java +++ b/src/main/java/appeng/tile/storage/TileDrive.java @@ -407,6 +407,13 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior @Override public void saveChanges( final IMEInventory cellInventory ) { - this.worldObj.markChunkDirty( this.pos, this ); + this.world.markChunkDirty( this.pos, this ); + } + + @Override + public boolean isEmpty() + { + // TODO Auto-generated method stub + return false; } } diff --git a/src/main/java/appeng/tile/storage/TileIOPort.java b/src/main/java/appeng/tile/storage/TileIOPort.java index 42d2f3f6b..63273e0d4 100644 --- a/src/main/java/appeng/tile/storage/TileIOPort.java +++ b/src/main/java/appeng/tile/storage/TileIOPort.java @@ -175,7 +175,7 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC public void updateRedstoneState() { - final YesNo currentState = this.worldObj.isBlockIndirectlyGettingPowered( this.pos ) != 0 ? YesNo.YES : YesNo.NO; + final YesNo currentState = this.world.isBlockIndirectlyGettingPowered( this.pos ) != 0 ? YesNo.YES : YesNo.NO; if( this.lastRedstoneState != currentState ) { this.lastRedstoneState = currentState; @@ -578,4 +578,11 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC } } } + + @Override + public boolean isEmpty() + { + // TODO Auto-generated method stub + return false; + } } diff --git a/src/main/java/appeng/tile/storage/TileSkyChest.java b/src/main/java/appeng/tile/storage/TileSkyChest.java index 833986dee..fc2b93273 100644 --- a/src/main/java/appeng/tile/storage/TileSkyChest.java +++ b/src/main/java/appeng/tile/storage/TileSkyChest.java @@ -128,9 +128,9 @@ public class TileSkyChest extends AEBaseInvTile implements ITickable if( !player.isSpectator() ) { this.setPlayerOpen( this.getPlayerOpen() + 1 ); - this.worldObj.addBlockEvent( this.pos, this.getBlockType(), 1, this.numPlayersUsing ); - this.worldObj.notifyNeighborsOfStateChange( this.pos, this.getBlockType() ); - this.worldObj.notifyNeighborsOfStateChange( this.pos.down(), this.getBlockType() ); + this.world.addBlockEvent( this.pos, this.getBlockType(), 1, this.numPlayersUsing ); + this.world.notifyNeighborsOfStateChange( this.pos, this.getBlockType(), true ); + this.world.notifyNeighborsOfStateChange( this.pos.down(), this.getBlockType(), true ); if( this.getPlayerOpen() == 1 ) { @@ -146,9 +146,9 @@ public class TileSkyChest extends AEBaseInvTile implements ITickable if( !player.isSpectator() ) { this.setPlayerOpen( this.getPlayerOpen() - 1 ); - this.worldObj.addBlockEvent( this.pos, this.getBlockType(), 1, this.numPlayersUsing ); - this.worldObj.notifyNeighborsOfStateChange( this.pos, this.getBlockType() ); - this.worldObj.notifyNeighborsOfStateChange( this.pos.down(), this.getBlockType() ); + this.world.addBlockEvent( this.pos, this.getBlockType(), 1, this.numPlayersUsing ); + this.world.notifyNeighborsOfStateChange( this.pos, this.getBlockType(), true ); + this.world.notifyNeighborsOfStateChange( this.pos.down(), this.getBlockType(), true ); if( this.getPlayerOpen() < 0 ) { @@ -252,4 +252,11 @@ public class TileSkyChest extends AEBaseInvTile implements ITickable { this.lastEvent = lastEvent; } + + @Override + public boolean isEmpty() + { + // TODO Auto-generated method stub + return false; + } } diff --git a/src/main/java/appeng/util/BlockUpdate.java b/src/main/java/appeng/util/BlockUpdate.java index 23fc29510..3efafc862 100644 --- a/src/main/java/appeng/util/BlockUpdate.java +++ b/src/main/java/appeng/util/BlockUpdate.java @@ -37,7 +37,7 @@ public class BlockUpdate implements IWorldCallable { if( world.isBlockLoaded( this.pos ) ) { - world.notifyNeighborsOfStateChange( this.pos, Platform.AIR_BLOCK ); + world.notifyNeighborsOfStateChange( this.pos, Platform.AIR_BLOCK, true ); } return true; diff --git a/src/main/java/appeng/util/Platform.java b/src/main/java/appeng/util/Platform.java index 73c17a2bf..f22c35878 100644 --- a/src/main/java/appeng/util/Platform.java +++ b/src/main/java/appeng/util/Platform.java @@ -537,13 +537,14 @@ public class Platform { if( i != null ) { - if( i.stackSize > 0 ) + if( i.getCount() > 0 ) { final double offset_x = ( getRandomInt() % 32 - 16 ) / 82; final double offset_y = ( getRandomInt() % 32 - 16 ) / 82; final double offset_z = ( getRandomInt() % 32 - 16 ) / 82; - final EntityItem ei = new EntityItem( w, 0.5 + offset_x + pos.getX(), 0.5 + offset_y + pos.getY(), 0.2 + offset_z + pos.getZ(), i.copy() ); - w.spawnEntityInWorld( ei ); + final EntityItem ei = new EntityItem( w, 0.5 + offset_x + pos.getX(), 0.5 + offset_y + pos.getY(), 0.2 + offset_z + pos.getZ(), i + .copy() ); + w.spawnEntity( ei ); } } } @@ -664,9 +665,9 @@ public class Platform return false; } - public static ItemStack findMatchingRecipeOutput( final InventoryCrafting ic, final World worldObj ) + public static ItemStack findMatchingRecipeOutput( final InventoryCrafting ic, final World world ) { - return CraftingManager.getInstance().findMatchingRecipe( ic, worldObj ); + return CraftingManager.getInstance().findMatchingRecipe( ic, world ); } @SideOnly( Side.CLIENT ) @@ -694,7 +695,7 @@ public class Platform try { - return itemStack.getTooltip( Minecraft.getMinecraft().thePlayer, false ); + return itemStack.getTooltip( Minecraft.getMinecraft().player, false ); } catch( final Exception errB ) { @@ -1493,7 +1494,8 @@ public class Platform if( AEConfig.instance().isFeatureEnabled( AEFeature.LOG_SECURITY_AUDITS ) ) { AELog.info( - "Audit: " + a_isSecure + " : " + b_isSecure + " @ " + a.getLastSecurityKey() + " vs " + b.getLastSecurityKey() + " & " + a.getPlayerID() + " vs " + b.getPlayerID() ); + "Audit: " + a_isSecure + " : " + b_isSecure + " @ " + a.getLastSecurityKey() + " vs " + b.getLastSecurityKey() + " & " + a + .getPlayerID() + " vs " + b.getPlayerID() ); } // can't do that son... @@ -1644,7 +1646,8 @@ public class Platform } } - final boolean checkFuzzy = ae_req.isOre() || providedTemplate.getItemDamage() == OreDictionary.WILDCARD_VALUE || providedTemplate.hasTagCompound() || providedTemplate.isItemStackDamageable(); + final boolean checkFuzzy = ae_req.isOre() || providedTemplate.getItemDamage() == OreDictionary.WILDCARD_VALUE || providedTemplate + .hasTagCompound() || providedTemplate.isItemStackDamageable(); if( items != null && checkFuzzy ) { @@ -1655,7 +1658,7 @@ public class Platform sh ) || ae_req.sameOre( x ) ) && !Platform.itemComparisons().isEqualItem( sh, output ) ) { // Platform.isSameItemType( sh, providedTemplate ) final ItemStack cp = Platform.cloneItemStack( sh ); - cp.stackSize = 1; + cp.setCount( 1 ); ci.setInventorySlotContents( slot, cp ); if( r.matches( ci, w ) && Platform.itemComparisons().isEqualItem( r.getCraftingResult( ci ), output ) ) { @@ -1694,9 +1697,9 @@ public class Platform final Item i = stackInSlot.getItem(); if( i == null || !i.hasContainerItem( stackInSlot ) ) { - if( stackInSlot.stackSize > 1 ) + if( stackInSlot.getCount() > 1 ) { - stackInSlot.stackSize--; + stackInSlot.setCount( stackInSlot.getCount() - 1 ); return stackInSlot; } return null; @@ -1711,11 +1714,11 @@ public class Platform return ci; } - public static void notifyBlocksOfNeighbors( final World worldObj, final BlockPos pos ) + public static void notifyBlocksOfNeighbors( final World world, final BlockPos pos ) { - if( !worldObj.isRemote ) + if( !world.isRemote ) { - TickHandler.INSTANCE.addCallable( worldObj, new BlockUpdate( pos ) ); + TickHandler.INSTANCE.addCallable( world, new BlockUpdate( pos ) ); } } @@ -1792,7 +1795,7 @@ public class Platform public static float getEyeOffset( final EntityPlayer player ) { - assert player.worldObj.isRemote : "Valid only on client"; + assert player.world.isRemote : "Valid only on client"; return (float) ( player.posY + player.getEyeHeight() - player.getDefaultEyeHeight() ); } diff --git a/src/main/java/appeng/util/inv/AdaptorIInventory.java b/src/main/java/appeng/util/inv/AdaptorIInventory.java index b4a574ede..fa2c41452 100644 --- a/src/main/java/appeng/util/inv/AdaptorIInventory.java +++ b/src/main/java/appeng/util/inv/AdaptorIInventory.java @@ -53,9 +53,9 @@ public class AdaptorIInventory extends InventoryAdaptor if( is != null && this.canRemoveStackFromSlot( x, is ) && ( filter == null || Platform.itemComparisons().isSameItem( is, filter ) ) ) { int boundAmounts = amount; - if( boundAmounts > is.stackSize ) + if( boundAmounts > is.getCount() ) { - boundAmounts = is.stackSize; + boundAmounts = is.getCount(); } if( destination != null && !destination.canInsert( is ) ) { @@ -68,16 +68,16 @@ public class AdaptorIInventory extends InventoryAdaptor { rv = is.copy(); filter = rv; - rv.stackSize = boundAmounts; + rv.setCount( boundAmounts ); amount -= boundAmounts; } else { - rv.stackSize += boundAmounts; + rv.grow( boundAmounts ); amount -= boundAmounts; } - if( is.stackSize == boundAmounts ) + if( is.getCount() == boundAmounts ) { this.i.setInventorySlotContents( x, null ); this.i.markDirty(); @@ -85,7 +85,7 @@ public class AdaptorIInventory extends InventoryAdaptor else { final ItemStack po = is.copy(); - po.stackSize -= boundAmounts; + po.grow( -boundAmounts ); this.i.setInventorySlotContents( x, po ); this.i.markDirty(); } @@ -111,9 +111,9 @@ public class AdaptorIInventory extends InventoryAdaptor if( is != null && this.canRemoveStackFromSlot( x, is ) && ( filter == null || Platform.itemComparisons().isSameItem( is, filter ) ) ) { int boundAmount = amount; - if( boundAmount > is.stackSize ) + if( boundAmount > is.getCount() ) { - boundAmount = is.stackSize; + boundAmount = is.getCount(); } if( destination != null && !destination.canInsert( is ) ) { @@ -125,12 +125,12 @@ public class AdaptorIInventory extends InventoryAdaptor if( rv == null ) { rv = is.copy(); - rv.stackSize = boundAmount; + rv.setCount( boundAmount ); amount -= boundAmount; } else { - rv.stackSize += boundAmount; + rv.grow( boundAmount ); amount -= boundAmount; } } @@ -147,12 +147,13 @@ public class AdaptorIInventory extends InventoryAdaptor for( int x = 0; x < s; x++ ) { final ItemStack is = this.i.getStackInSlot( x ); - if( is != null && this.canRemoveStackFromSlot( x, is ) && ( filter == null || Platform.itemComparisons().isFuzzyEqualItem( is, filter, fuzzyMode ) ) ) + if( is != null && this.canRemoveStackFromSlot( x, + is ) && ( filter == null || Platform.itemComparisons().isFuzzyEqualItem( is, filter, fuzzyMode ) ) ) { int newAmount = amount; - if( newAmount > is.stackSize ) + if( newAmount > is.getCount() ) { - newAmount = is.stackSize; + newAmount = is.getCount(); } if( destination != null && !destination.canInsert( is ) ) { @@ -163,9 +164,9 @@ public class AdaptorIInventory extends InventoryAdaptor if( newAmount > 0 ) { rv = is.copy(); - rv.stackSize = newAmount; + rv.setCount( newAmount ); - if( is.stackSize == rv.stackSize ) + if( is.getCount() == rv.getCount() ) { this.i.setInventorySlotContents( x, null ); this.i.markDirty(); @@ -173,7 +174,7 @@ public class AdaptorIInventory extends InventoryAdaptor else { final ItemStack po = is.copy(); - po.stackSize -= rv.stackSize; + po.grow( -rv.getCount() ); this.i.setInventorySlotContents( x, po ); this.i.markDirty(); } @@ -197,12 +198,13 @@ public class AdaptorIInventory extends InventoryAdaptor { final ItemStack is = this.i.getStackInSlot( x ); - if( is != null && this.canRemoveStackFromSlot( x, is ) && ( filter == null || Platform.itemComparisons().isFuzzyEqualItem( is, filter, fuzzyMode ) ) ) + if( is != null && this.canRemoveStackFromSlot( x, + is ) && ( filter == null || Platform.itemComparisons().isFuzzyEqualItem( is, filter, fuzzyMode ) ) ) { int boundAmount = amount; - if( boundAmount > is.stackSize ) + if( boundAmount > is.getCount() ) { - boundAmount = is.stackSize; + boundAmount = is.getCount(); } if( destination != null && !destination.canInsert( is ) ) { @@ -212,7 +214,7 @@ public class AdaptorIInventory extends InventoryAdaptor if( boundAmount > 0 ) { final ItemStack rv = is.copy(); - rv.stackSize = boundAmount; + rv.setCount( boundAmount ); return rv; } } @@ -260,7 +262,7 @@ public class AdaptorIInventory extends InventoryAdaptor */ private ItemStack addItems( final ItemStack itemsToAdd, final boolean modulate ) { - if( itemsToAdd == null || itemsToAdd.stackSize == 0 ) + if( itemsToAdd == null || itemsToAdd.getCount() == 0 ) { return null; } @@ -273,14 +275,14 @@ public class AdaptorIInventory extends InventoryAdaptor for( int slot = 0; slot < inventorySize; slot++ ) { final ItemStack next = left.copy(); - next.stackSize = Math.min( perOperationLimit, next.stackSize ); + next.setCount( Math.min( perOperationLimit, next.getCount() ) ); if( this.i.isItemValidForSlot( slot, next ) ) { final ItemStack is = this.i.getStackInSlot( slot ); if( is == null ) { - left.stackSize -= next.stackSize; + left.grow( -next.getCount() ); if( modulate ) { @@ -288,25 +290,25 @@ public class AdaptorIInventory extends InventoryAdaptor this.i.markDirty(); } - if( left.stackSize <= 0 ) + if( left.getCount() <= 0 ) { return null; } } - else if( Platform.itemComparisons().isSameItem( is, left ) && is.stackSize < perOperationLimit ) + else if( Platform.itemComparisons().isSameItem( is, left ) && is.getCount() < perOperationLimit ) { - final int room = perOperationLimit - is.stackSize; - final int used = Math.min( left.stackSize, room ); + final int room = perOperationLimit - is.getCount(); + final int used = Math.min( left.getCount(), room ); if( modulate ) { - is.stackSize += used; + is.grow( used ); this.i.setInventorySlotContents( slot, is ); this.i.markDirty(); } - left.stackSize -= used; - if( left.stackSize <= 0 ) + left.grow( -used ); + if( left.getCount() <= 0 ) { return null; } diff --git a/src/main/java/appeng/util/inv/AdaptorItemHandler.java b/src/main/java/appeng/util/inv/AdaptorItemHandler.java index e1953084c..b2d8d38e9 100644 --- a/src/main/java/appeng/util/inv/AdaptorItemHandler.java +++ b/src/main/java/appeng/util/inv/AdaptorItemHandler.java @@ -79,13 +79,13 @@ public class AdaptorItemHandler extends InventoryAdaptor // Use the first stack as a template for the result rv = extracted; filter = extracted; - amount -= extracted.stackSize; + amount -= extracted.getCount(); } else { // Subsequent stacks will just increase the extracted size - rv.stackSize += extracted.stackSize; - amount -= extracted.stackSize; + rv.grow( extracted.getCount() ); + amount -= extracted.getCount(); } } @@ -123,13 +123,13 @@ public class AdaptorItemHandler extends InventoryAdaptor // Use the first stack as a template for the result rv = extracted.copy(); filter = extracted; - amount -= extracted.stackSize; + amount -= extracted.getCount(); } else { // Subsequent stacks will just increase the extracted size - rv.stackSize += extracted.stackSize; - amount -= extracted.stackSize; + rv.grow( extracted.getCount() ); + amount -= extracted.getCount(); } } } @@ -138,7 +138,8 @@ public class AdaptorItemHandler extends InventoryAdaptor } /** - * For fuzzy extract, we will only ever extract one slot, since we're afraid of merging two item stacks with different damage values. + * For fuzzy extract, we will only ever extract one slot, since we're afraid of merging two item stacks with + * different damage values. */ @Override public ItemStack removeSimilarItems( int amount, ItemStack filter, FuzzyMode fuzzyMode, IInventoryDestination destination ) @@ -218,7 +219,7 @@ public class AdaptorItemHandler extends InventoryAdaptor private ItemStack addItems( final ItemStack itemsToAdd, final boolean simulate ) { - if( itemsToAdd == null || itemsToAdd.stackSize == 0 ) + if( itemsToAdd == null || itemsToAdd.getCount() == 0 ) { return null; } @@ -233,7 +234,7 @@ public class AdaptorItemHandler extends InventoryAdaptor { left = itemHandler.insertItem( slot, left, simulate ); - if( left == null || left.stackSize <= 0 ) + if( left == null || left.getCount() <= 0 ) { return null; } diff --git a/src/main/java/appeng/util/inv/AdaptorList.java b/src/main/java/appeng/util/inv/AdaptorList.java index 5d801a996..ca329ab38 100644 --- a/src/main/java/appeng/util/inv/AdaptorList.java +++ b/src/main/java/appeng/util/inv/AdaptorList.java @@ -49,9 +49,9 @@ public class AdaptorList extends InventoryAdaptor final ItemStack is = this.i.get( x ); if( is != null && ( filter == null || Platform.itemComparisons().isSameItem( is, filter ) ) ) { - if( amount > is.stackSize ) + if( amount > is.getCount() ) { - amount = is.stackSize; + amount = is.getCount(); } if( destination != null && !destination.canInsert( is ) ) { @@ -61,11 +61,11 @@ public class AdaptorList extends InventoryAdaptor if( amount > 0 ) { final ItemStack rv = is.copy(); - rv.stackSize = amount; - is.stackSize -= amount; + rv.setCount( amount ); + is.grow( -amount ); // remove it.. - if( is.stackSize <= 0 ) + if( is.getCount() <= 0 ) { this.i.remove( x ); } @@ -84,9 +84,9 @@ public class AdaptorList extends InventoryAdaptor { if( is != null && ( filter == null || Platform.itemComparisons().isSameItem( is, filter ) ) ) { - if( amount > is.stackSize ) + if( amount > is.getCount() ) { - amount = is.stackSize; + amount = is.getCount(); } if( destination != null && !destination.canInsert( is ) ) { @@ -96,7 +96,7 @@ public class AdaptorList extends InventoryAdaptor if( amount > 0 ) { final ItemStack rv = is.copy(); - rv.stackSize = amount; + rv.setCount( amount ); return rv; } } @@ -113,9 +113,9 @@ public class AdaptorList extends InventoryAdaptor final ItemStack is = this.i.get( x ); if( is != null && ( filter == null || Platform.itemComparisons().isFuzzyEqualItem( is, filter, fuzzyMode ) ) ) { - if( amount > is.stackSize ) + if( amount > is.getCount() ) { - amount = is.stackSize; + amount = is.getCount(); } if( destination != null && !destination.canInsert( is ) ) { @@ -125,11 +125,11 @@ public class AdaptorList extends InventoryAdaptor if( amount > 0 ) { final ItemStack rv = is.copy(); - rv.stackSize = amount; - is.stackSize -= amount; + rv.setCount( amount ); + is.grow( -amount ); // remove it.. - if( is.stackSize <= 0 ) + if( is.getCount() <= 0 ) { this.i.remove( x ); } @@ -148,9 +148,9 @@ public class AdaptorList extends InventoryAdaptor { if( is != null && ( filter == null || Platform.itemComparisons().isFuzzyEqualItem( is, filter, fuzzyMode ) ) ) { - if( amount > is.stackSize ) + if( amount > is.getCount() ) { - amount = is.stackSize; + amount = is.getCount(); } if( destination != null && !destination.canInsert( is ) ) { @@ -160,7 +160,7 @@ public class AdaptorList extends InventoryAdaptor if( amount > 0 ) { final ItemStack rv = is.copy(); - rv.stackSize = amount; + rv.setCount( amount ); return rv; } } @@ -175,7 +175,7 @@ public class AdaptorList extends InventoryAdaptor { return null; } - if( toBeAdded.stackSize == 0 ) + if( toBeAdded.getCount() == 0 ) { return null; } @@ -186,7 +186,7 @@ public class AdaptorList extends InventoryAdaptor { if( Platform.itemComparisons().isEqualItem( is, left ) ) { - is.stackSize += left.stackSize; + is.grow( left.getCount() ); return null; } } diff --git a/src/main/java/appeng/util/inv/AdaptorPlayerHand.java b/src/main/java/appeng/util/inv/AdaptorPlayerHand.java index 95290073b..8811626be 100644 --- a/src/main/java/appeng/util/inv/AdaptorPlayerHand.java +++ b/src/main/java/appeng/util/inv/AdaptorPlayerHand.java @@ -55,9 +55,9 @@ public class AdaptorPlayerHand extends InventoryAdaptor if( filter == null || Platform.itemComparisons().isSameItem( filter, hand ) ) { final ItemStack result = hand.copy(); - result.stackSize = hand.stackSize > amount ? amount : hand.stackSize; - hand.stackSize -= amount; - if( hand.stackSize <= 0 ) + result.setCount( hand.getCount() > amount ? amount : hand.getCount() ); + hand.grow( -amount ); + if( hand.getCount() <= 0 ) { this.player.inventory.setItemStack( null ); } @@ -80,7 +80,7 @@ public class AdaptorPlayerHand extends InventoryAdaptor if( filter == null || Platform.itemComparisons().isSameItem( filter, hand ) ) { final ItemStack result = hand.copy(); - result.stackSize = hand.stackSize > amount ? amount : hand.stackSize; + result.setCount( hand.getCount() > amount ? amount : hand.getCount() ); return result; } @@ -99,9 +99,9 @@ public class AdaptorPlayerHand extends InventoryAdaptor if( filter == null || Platform.itemComparisons().isFuzzyEqualItem( filter, hand, fuzzyMode ) ) { final ItemStack result = hand.copy(); - result.stackSize = hand.stackSize > amount ? amount : hand.stackSize; - hand.stackSize -= amount; - if( hand.stackSize <= 0 ) + result.setCount( hand.getCount() > amount ? amount : hand.getCount() ); + hand.grow( -amount ); + if( hand.getCount() <= 0 ) { this.player.inventory.setItemStack( null ); } @@ -124,7 +124,7 @@ public class AdaptorPlayerHand extends InventoryAdaptor if( filter == null || Platform.itemComparisons().isFuzzyEqualItem( filter, hand, fuzzyMode ) ) { final ItemStack result = hand.copy(); - result.stackSize = hand.stackSize > amount ? amount : hand.stackSize; + result.setCount( hand.getCount() > amount ? amount : hand.getCount() ); return result; } @@ -139,7 +139,7 @@ public class AdaptorPlayerHand extends InventoryAdaptor { return null; } - if( toBeAdded.stackSize == 0 ) + if( toBeAdded.getCount() == 0 ) { return null; } @@ -168,15 +168,15 @@ public class AdaptorPlayerHand extends InventoryAdaptor else { newHand = hand; - original = hand.stackSize; - newHand.stackSize += toBeAdded.stackSize; + original = hand.getCount(); + newHand.grow( toBeAdded.getCount() ); } - if( newHand.stackSize > newHand.getMaxStackSize() ) + if( newHand.getCount() > newHand.getMaxStackSize() ) { - newHand.stackSize = newHand.getMaxStackSize(); + newHand.setCount( newHand.getMaxStackSize() ); final ItemStack B = toBeAdded.copy(); - B.stackSize -= newHand.stackSize - original; + B.grow( -( newHand.getCount() - original ) ); this.player.inventory.setItemStack( newHand ); return B; } @@ -208,15 +208,15 @@ public class AdaptorPlayerHand extends InventoryAdaptor else { newHand = hand.copy(); - original = hand.stackSize; - newHand.stackSize += toBeSimulated.stackSize; + original = hand.getCount(); + newHand.grow( toBeSimulated.getCount() ); } - if( newHand.stackSize > newHand.getMaxStackSize() ) + if( newHand.getCount() > newHand.getMaxStackSize() ) { - newHand.stackSize = newHand.getMaxStackSize(); + newHand.setCount( newHand.getMaxStackSize() ); final ItemStack B = toBeSimulated.copy(); - B.stackSize -= newHand.stackSize - original; + B.grow( -( newHand.getCount() - original ) ); return B; } diff --git a/src/main/java/appeng/util/inv/AdaptorPlayerInventory.java b/src/main/java/appeng/util/inv/AdaptorPlayerInventory.java index 6a4203d85..bd15f7263 100644 --- a/src/main/java/appeng/util/inv/AdaptorPlayerInventory.java +++ b/src/main/java/appeng/util/inv/AdaptorPlayerInventory.java @@ -100,9 +100,9 @@ public class AdaptorPlayerInventory implements IInventory } @Override - public boolean isUseableByPlayer( final EntityPlayer var1 ) + public boolean isUsableByPlayer( final EntityPlayer var1 ) { - return this.src.isUseableByPlayer( var1 ); + return this.src.isUsableByPlayer( var1 ); } @Override @@ -153,4 +153,10 @@ public class AdaptorPlayerInventory implements IInventory { this.src.clear(); } + + @Override + public boolean isEmpty() + { + return this.src.isEmpty(); + } } diff --git a/src/main/java/appeng/util/inv/IMEInventoryDestination.java b/src/main/java/appeng/util/inv/IMEInventoryDestination.java index af3663492..49c7a5447 100644 --- a/src/main/java/appeng/util/inv/IMEInventoryDestination.java +++ b/src/main/java/appeng/util/inv/IMEInventoryDestination.java @@ -52,6 +52,6 @@ public class IMEInventoryDestination implements IInventoryDestination { return true; } - return failed.getStackSize() != stack.stackSize; + return failed.getStackSize() != stack.getCount(); } } diff --git a/src/main/java/appeng/util/inv/WrapperChainedInventory.java b/src/main/java/appeng/util/inv/WrapperChainedInventory.java index 0f30429cb..56d65d022 100644 --- a/src/main/java/appeng/util/inv/WrapperChainedInventory.java +++ b/src/main/java/appeng/util/inv/WrapperChainedInventory.java @@ -202,7 +202,7 @@ public class WrapperChainedInventory implements IInventory } @Override - public boolean isUseableByPlayer( final EntityPlayer var1 ) + public boolean isUsableByPlayer( final EntityPlayer var1 ) { return false; } @@ -265,4 +265,11 @@ public class WrapperChainedInventory implements IInventory { } + + @Override + public boolean isEmpty() + { + // TODO Auto-generated method stub + return false; + } } diff --git a/src/main/java/appeng/util/inv/WrapperInvSlot.java b/src/main/java/appeng/util/inv/WrapperInvSlot.java index 5aeb364f9..7e0910847 100644 --- a/src/main/java/appeng/util/inv/WrapperInvSlot.java +++ b/src/main/java/appeng/util/inv/WrapperInvSlot.java @@ -100,9 +100,9 @@ public class WrapperInvSlot } @Override - public boolean isUseableByPlayer( final EntityPlayer entityplayer ) + public boolean isUsableByPlayer( final EntityPlayer entityplayer ) { - return this.inv.isUseableByPlayer( entityplayer ); + return this.inv.isUsableByPlayer( entityplayer ); } @Override @@ -164,5 +164,12 @@ public class WrapperInvSlot { this.inv.setField( id, value ); } + + @Override + public boolean isEmpty() + { + // TODO Auto-generated method stub + return false; + } } } diff --git a/src/main/java/appeng/util/inv/WrapperInventoryRange.java b/src/main/java/appeng/util/inv/WrapperInventoryRange.java index d6679d062..71a5050ed 100644 --- a/src/main/java/appeng/util/inv/WrapperInventoryRange.java +++ b/src/main/java/appeng/util/inv/WrapperInventoryRange.java @@ -117,9 +117,9 @@ public class WrapperInventoryRange implements IInventory } @Override - public boolean isUseableByPlayer( final EntityPlayer var1 ) + public boolean isUsableByPlayer( final EntityPlayer var1 ) { - return this.src.isUseableByPlayer( var1 ); + return this.src.isUsableByPlayer( var1 ); } @Override @@ -206,4 +206,11 @@ public class WrapperInventoryRange implements IInventory { this.slots = slots; } + + @Override + public boolean isEmpty() + { + // TODO Auto-generated method stub + return false; + } } diff --git a/src/main/java/appeng/util/item/AEFluidStack.java b/src/main/java/appeng/util/item/AEFluidStack.java index 1d9729815..89106f5bf 100644 --- a/src/main/java/appeng/util/item/AEFluidStack.java +++ b/src/main/java/appeng/util/item/AEFluidStack.java @@ -82,7 +82,7 @@ public final class AEFluidStack extends AEStack implements IAEFlu public static IAEFluidStack loadFluidStackFromNBT( final NBTTagCompound i ) { - final ItemStack itemstack = ItemStack.loadItemStackFromNBT( i ); + final ItemStack itemstack = new ItemStack( i ); if( itemstack == null ) { return null; diff --git a/src/main/java/appeng/util/item/AEItemStack.java b/src/main/java/appeng/util/item/AEItemStack.java index 734831b09..969bd4b29 100644 --- a/src/main/java/appeng/util/item/AEItemStack.java +++ b/src/main/java/appeng/util/item/AEItemStack.java @@ -108,7 +108,7 @@ public final class AEItemStack extends AEStack implements IAEItemS this.getDefinition().setTagCompound( (AESharedNBT) AESharedNBT.getSharedTagCompound( tagCompound, is ) ); } - this.setStackSize( is.stackSize ); + this.setStackSize( is.getCount() ); this.setCraftable( false ); this.setCountRequestable( 0 ); @@ -123,7 +123,7 @@ public final class AEItemStack extends AEStack implements IAEItemS return null; } - final ItemStack itemstack = ItemStack.loadItemStackFromNBT( i ); + final ItemStack itemstack = new ItemStack( i ); if( itemstack == null ) { return null; @@ -181,7 +181,7 @@ public final class AEItemStack extends AEStack implements IAEItemS final long stackSize = getPacketValue( stackType, data ); final long countRequestable = getPacketValue( countReqType, data ); - final ItemStack itemstack = ItemStack.loadItemStackFromNBT( d ); + final ItemStack itemstack = new ItemStack( d ); if( itemstack == null ) { return null; diff --git a/src/main/java/appeng/worldgen/MeteoritePlacer.java b/src/main/java/appeng/worldgen/MeteoritePlacer.java index 1ba38ece9..fc9143b65 100644 --- a/src/main/java/appeng/worldgen/MeteoritePlacer.java +++ b/src/main/java/appeng/worldgen/MeteoritePlacer.java @@ -313,7 +313,7 @@ public final class MeteoritePlacer if( nugget != null ) { nugget = nugget.copy(); - nugget.stackSize = (int) ( Math.random() * 12 ) + 1; + nugget.setCount( (int) ( Math.random() * 12 ) + 1 ); ap.addItems( nugget ); } break; diff --git a/src/main/java/appeng/worldgen/QuartzWorldGen.java b/src/main/java/appeng/worldgen/QuartzWorldGen.java index 7c1fd4ff2..8a0db969b 100644 --- a/src/main/java/appeng/worldgen/QuartzWorldGen.java +++ b/src/main/java/appeng/worldgen/QuartzWorldGen.java @@ -64,7 +64,7 @@ public final class QuartzWorldGen implements IWorldGenerator { final int x = ( chunkX << 4 ) + 8; final int z = ( chunkZ << 4 ) + 8; - seaLevel = w.getHeightmapHeight( x, z ); + seaLevel = w.getHeight( x, z ); } if( this.oreNormal == null || this.oreCharged == null ) diff --git a/src/main/java/appeng/worldgen/meteorite/StandardWorld.java b/src/main/java/appeng/worldgen/meteorite/StandardWorld.java index 63cc4e23a..c25131f77 100644 --- a/src/main/java/appeng/worldgen/meteorite/StandardWorld.java +++ b/src/main/java/appeng/worldgen/meteorite/StandardWorld.java @@ -66,7 +66,7 @@ public class StandardWorld implements IMeteoriteWorld @Override public boolean hasNoSky() { - return !this.getWorld().provider.getHasNoSky(); + return !this.getWorld().provider.hasNoSky(); } @Override