diff --git a/block/AEBaseBlock.java b/block/AEBaseBlock.java index 112854b7..00c6d23b 100644 --- a/block/AEBaseBlock.java +++ b/block/AEBaseBlock.java @@ -8,21 +8,21 @@ import net.minecraft.block.Block; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.texture.IconRegister; -import net.minecraft.client.resources.Resource; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.client.resources.IResource; import net.minecraft.entity.Entity; 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.AxisAlignedBB; -import net.minecraft.util.Icon; +import net.minecraft.util.IIcon; import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.ResourceLocation; import net.minecraft.util.Vec3; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.implementations.items.IMemoryCard; import appeng.api.implementations.items.MemoryCardMessages; import appeng.api.util.IOrientable; @@ -32,7 +32,6 @@ import appeng.client.render.BaseBlockRender; import appeng.client.render.BlockRenderInfo; import appeng.client.render.WorldRender; import appeng.client.texture.FlipableIcon; -import appeng.core.Configuration; import appeng.core.features.AEFeature; import appeng.core.features.AEFeatureHandler; import appeng.core.features.IAEFeature; @@ -58,7 +57,7 @@ public class AEBaseBlock extends BlockContainer implements IAEFeature protected boolean isFullSize = true; @SideOnly(Side.CLIENT) - public Icon renderIcon; + public IIcon renderIcon; @SideOnly(Side.CLIENT) BlockRenderInfo renderInfo; @@ -83,9 +82,9 @@ public class AEBaseBlock extends BlockContainer implements IAEFeature } @SideOnly(Side.CLIENT) - private FlipableIcon optionaIcon(IconRegister ir, String Name, Icon substitute) + private FlipableIcon optionaIcon(IIconRegister ir, String Name, IIcon substitute) { - // if the input is an flippable icon find the original. + // if the input is an flippable IIcon find the original. while (substitute instanceof FlipableIcon) substitute = ((FlipableIcon) substitute).getOriginal(); @@ -94,9 +93,10 @@ public class AEBaseBlock extends BlockContainer implements IAEFeature try { ResourceLocation resLoc = new ResourceLocation( Name ); - resLoc = new ResourceLocation( resLoc.getResourceDomain(), String.format( "%s/%s%s", new Object[] { "textures/blocks", resLoc.getResourcePath(), ".png" } ) ); + resLoc = new ResourceLocation( resLoc.getResourceDomain(), String.format( "%s/%s%s", new Object[] { "textures/blocks", + resLoc.getResourcePath(), ".png" } ) ); - Resource res = Minecraft.getMinecraft().getResourceManager().getResource( resLoc ); + IResource res = Minecraft.getMinecraft().getResourceManager().getResource( resLoc ); if ( res != null ) return new FlipableIcon( ir.registerIcon( Name ) ); } @@ -111,7 +111,7 @@ public class AEBaseBlock extends BlockContainer implements IAEFeature @Override @SideOnly(Side.CLIENT) - public void registerIcons(IconRegister iconRegistry) + public void registerBlockIcons(IIconRegister iconRegistry) { BlockRenderInfo info = getRendererInstance(); FlipableIcon topIcon; @@ -135,7 +135,7 @@ public class AEBaseBlock extends BlockContainer implements IAEFeature @Override @SideOnly(Side.CLIENT) - public Icon getIcon(int direction, int metadata) + public IIcon getIcon(int direction, int metadata) { if ( renderIcon != null ) return renderIcon; @@ -144,7 +144,7 @@ public class AEBaseBlock extends BlockContainer implements IAEFeature } @Override - public Icon getBlockTexture(IBlockAccess w, int x, int y, int z, int s) + public IIcon getIcon(IBlockAccess w, int x, int y, int z, int s) { return getIcon( mapRotation( w, x, y, z, s ), 0 ); } @@ -163,19 +163,19 @@ public class AEBaseBlock extends BlockContainer implements IAEFeature protected AEBaseBlock(Class c, Material mat) { this( c, mat, null ); setLightOpacity( 15 ); - setLightValue( 0 ); + setLightLevel( 0 ); setHardness( 1.2F ); } protected AEBaseBlock(Class c, Material mat, String subname) { - super( Configuration.instance.getBlockID( c, subname ), mat ); + super( mat ); if ( mat == Material.glass ) - setStepSound( Block.soundGlassFootstep ); + setStepSound( Block.soundTypeGlass ); else if ( mat == Material.rock ) - setStepSound( Block.soundStoneFootstep ); + setStepSound( Block.soundTypeStone ); else - setStepSound( Block.soundMetalFootstep ); + setStepSound( Block.soundTypeMetal ); FeatureFullname = AEFeatureHandler.getName( c, subname ); FeatureSubname = subname; @@ -205,7 +205,7 @@ public class AEBaseBlock extends BlockContainer implements IAEFeature } @Override - final public boolean isBlockNormalCube(World world, int x, int y, int z) + final public boolean isNormalCube(IBlockAccess world, int x, int y, int z) { return isFullSize; } @@ -243,7 +243,7 @@ public class AEBaseBlock extends BlockContainer implements IAEFeature } @Override - final public TileEntity createTileEntity(World world, int metadata) + final public TileEntity createNewTileEntity(World var1, int var2) { try { @@ -255,18 +255,12 @@ public class AEBaseBlock extends BlockContainer implements IAEFeature } } - @Override - final public TileEntity createNewTileEntity(World world) - { - return createTileEntity( world, 0 ); - } - final public T getTileEntity(IBlockAccess w, int x, int y, int z) { if ( !hasBlockTileEntity() ) return null; - TileEntity te = w.getBlockTileEntity( x, y, z ); + TileEntity te = w.getTileEntity( x, y, z ); if ( tileEntityType.isInstance( te ) ) return (T) te; @@ -387,7 +381,7 @@ public class AEBaseBlock extends BlockContainer implements IAEFeature } @Override - public void breakBlock(World w, int x, int y, int z, int a, int b) + public void breakBlock(World w, int x, int y, int z, Block a, int b) { AEBaseTile te = getTileEntity( w, x, y, z ); if ( te != null ) @@ -404,7 +398,7 @@ public class AEBaseBlock extends BlockContainer implements IAEFeature super.breakBlock( w, x, y, z, a, b ); if ( te != null ) - w.setBlockTileEntity( x, y, z, null ); + w.setTileEntity( x, y, z, null ); } @Override @@ -598,8 +592,8 @@ public class AEBaseBlock extends BlockContainer implements IAEFeature { if ( Platform.isWrench( player, is, x, y, z ) && player.isSneaking() ) { - int id = w.getBlockId( x, y, z ); - if ( id != 0 ) + Block id = w.getBlock( x, y, z ); + if ( id != null ) { AEBaseTile tile = getTileEntity( w, x, y, z ); ItemStack[] drops = Platform.getBlockDrops( w, x, y, z ); @@ -621,7 +615,7 @@ public class AEBaseBlock extends BlockContainer implements IAEFeature } } - if ( Block.blocksList[id].removeBlockByPlayer( w, player, x, y, z ) ) + if ( id.removedByPlayer( w, player, x, y, z ) ) { List l = new ArrayList(); for (ItemStack iss : drops) diff --git a/block/AEBaseItemBlock.java b/block/AEBaseItemBlock.java index 2d029431..92c6dd70 100644 --- a/block/AEBaseItemBlock.java +++ b/block/AEBaseItemBlock.java @@ -9,7 +9,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.MathHelper; import net.minecraft.world.World; import net.minecraftforge.client.MinecraftForgeClient; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.util.IOrientable; import appeng.api.util.IOrientableBlock; import appeng.block.networking.BlockWireless; @@ -23,19 +23,17 @@ public class AEBaseItemBlock extends ItemBlock final AEBaseBlock blockType; - public AEBaseItemBlock(int id) { + public AEBaseItemBlock(Block id) { super( id ); - blockType = (AEBaseBlock) Block.blocksList[id + 256]; + blockType = (AEBaseBlock) id; if ( Platform.isClient() ) - MinecraftForgeClient.registerItemRenderer( blockType.blockID, ItemRenderer.instance ); + MinecraftForgeClient.registerItemRenderer( this, ItemRenderer.instance ); } @Override public void addInformation(ItemStack is, EntityPlayer player, List lines, boolean advancedItemTooltips) { - Block blk = Block.blocksList[getBlockID()]; - if ( blk instanceof AEBaseBlock ) - ((AEBaseBlock) blk).addInformation( is, player, lines, advancedItemTooltips ); + blockType.addInformation( is, player, lines, advancedItemTooltips ); } @Override diff --git a/block/AEBaseItemBlockChargeable.java b/block/AEBaseItemBlockChargeable.java index 2e680c6d..42111f74 100644 --- a/block/AEBaseItemBlockChargeable.java +++ b/block/AEBaseItemBlockChargeable.java @@ -17,7 +17,7 @@ import appeng.util.Platform; public class AEBaseItemBlockChargeable extends AEBaseItemBlock implements IAEItemPowerStorage { - public AEBaseItemBlockChargeable(int id) { + public AEBaseItemBlockChargeable(Block id) { super( id ); } @@ -36,14 +36,13 @@ public class AEBaseItemBlockChargeable extends AEBaseItemBlock implements IAEIte double percent = internalCurrentPower / internalMaxPower; lines.add( GuiText.StoredEnergy.getLocal() + ":" + MessageFormat.format( " {0,number,#} ", internalCurrentPower ) - + Platform.gui_localize( PowerUnits.AE.unlocalizedName ) + " - " - + MessageFormat.format( " {0,number,#.##%} ", percent ) ); + + Platform.gui_localize( PowerUnits.AE.unlocalizedName ) + " - " + MessageFormat.format( " {0,number,#.##%} ", percent ) ); } private double getMax(ItemStack is) { - Block blk = Block.blocksList[getBlockID()]; + Block blk = Block.getBlockFromItem( this ); if ( blk == AEApi.instance().blocks().blockEnergyCell.block() ) return 200000; else diff --git a/block/grindstone/BlockCrank.java b/block/grindstone/BlockCrank.java index 7208349c..336f4a9c 100644 --- a/block/grindstone/BlockCrank.java +++ b/block/grindstone/BlockCrank.java @@ -2,13 +2,14 @@ package appeng.block.grindstone; import java.util.EnumSet; +import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.implementations.tiles.ICrankable; import appeng.block.AEBaseBlock; import appeng.client.render.BaseBlockRender; @@ -47,7 +48,7 @@ public class BlockCrank extends AEBaseBlock private boolean isCrankable(World w, int x, int y, int z, ForgeDirection offset) { - TileEntity te = w.getBlockTileEntity( x + offset.offsetX, y + offset.offsetY, z + offset.offsetZ ); + TileEntity te = w.getTileEntity( x + offset.offsetX, y + offset.offsetY, z + offset.offsetZ ); if ( te instanceof ICrankable ) { return ((ICrankable) te).canCrankAttach( offset.getOpposite() ); @@ -72,13 +73,13 @@ public class BlockCrank extends AEBaseBlock @Override public boolean isValidOrientation(World w, int x, int y, int z, ForgeDirection forward, ForgeDirection up) { - TileEntity te = w.getBlockTileEntity( x, y, z ); + TileEntity te = w.getTileEntity( x, y, z ); return !(te instanceof TileCrank) || isCrankable( w, x, y, z, up.getOpposite() ); } private void dropCrank(World w, int x, int y, int z) { - w.destroyBlock( x, y, z, true ); + w.func_147480_a( x, y, z, true ); // w.destroyBlock( x, y, z, true ); w.markBlockForUpdate( x, y, z ); } @@ -99,7 +100,7 @@ public class BlockCrank extends AEBaseBlock } @Override - public void onNeighborBlockChange(World w, int x, int y, int z, int id) + public void onNeighborBlockChange(World w, int x, int y, int z, Block id) { AEBaseTile tile = getTileEntity( w, x, y, z ); if ( tile != null ) diff --git a/block/grindstone/BlockGrinder.java b/block/grindstone/BlockGrinder.java index 2bea3bd7..5b61ea27 100644 --- a/block/grindstone/BlockGrinder.java +++ b/block/grindstone/BlockGrinder.java @@ -5,7 +5,7 @@ import java.util.EnumSet; import net.minecraft.block.material.Material; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.world.World; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.block.AEBaseBlock; import appeng.core.features.AEFeature; import appeng.core.sync.GuiBridge; diff --git a/block/misc/BlockCellWorkbench.java b/block/misc/BlockCellWorkbench.java index 011f6ea1..6647a5a9 100644 --- a/block/misc/BlockCellWorkbench.java +++ b/block/misc/BlockCellWorkbench.java @@ -5,7 +5,7 @@ import java.util.EnumSet; import net.minecraft.block.material.Material; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.world.World; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.block.AEBaseBlock; import appeng.core.features.AEFeature; import appeng.core.sync.GuiBridge; diff --git a/block/misc/BlockCharger.java b/block/misc/BlockCharger.java index bb4d6744..e78ec6b6 100644 --- a/block/misc/BlockCharger.java +++ b/block/misc/BlockCharger.java @@ -12,7 +12,7 @@ import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.AxisAlignedBB; import net.minecraft.world.World; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.AEApi; import appeng.block.AEBaseBlock; import appeng.client.render.BaseBlockRender; diff --git a/block/misc/BlockCondenser.java b/block/misc/BlockCondenser.java index c91e41d4..89bddecb 100644 --- a/block/misc/BlockCondenser.java +++ b/block/misc/BlockCondenser.java @@ -5,7 +5,7 @@ import java.util.EnumSet; import net.minecraft.block.material.Material; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.world.World; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.block.AEBaseBlock; import appeng.core.features.AEFeature; import appeng.core.sync.GuiBridge; diff --git a/block/misc/BlockInterface.java b/block/misc/BlockInterface.java index 36ba7336..45bb6806 100644 --- a/block/misc/BlockInterface.java +++ b/block/misc/BlockInterface.java @@ -5,7 +5,7 @@ import java.util.EnumSet; import net.minecraft.block.material.Material; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.world.World; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.block.AEBaseBlock; import appeng.core.features.AEFeature; import appeng.core.sync.GuiBridge; diff --git a/block/misc/BlockQuartzTorch.java b/block/misc/BlockQuartzTorch.java index 4d2a3b49..d8c5d87b 100644 --- a/block/misc/BlockQuartzTorch.java +++ b/block/misc/BlockQuartzTorch.java @@ -5,6 +5,7 @@ import java.util.EnumSet; import java.util.List; import java.util.Random; +import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.Minecraft; import net.minecraft.client.particle.EntityFX; @@ -12,7 +13,7 @@ import net.minecraft.entity.Entity; import net.minecraft.util.AxisAlignedBB; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.util.IOrientable; import appeng.api.util.IOrientableBlock; import appeng.block.AEBaseBlock; @@ -34,7 +35,7 @@ public class BlockQuartzTorch extends AEBaseBlock implements IOrientableBlock, I super( BlockQuartzTorch.class, Material.circuits ); setfeature( EnumSet.of( AEFeature.DecorativeLights ) ); setLightOpacity( 0 ); - setLightValue( 0.9375F ); + setLightLevel( 0.9375F ); isFullSize = isOpaque = false; } @@ -52,7 +53,8 @@ public class BlockQuartzTorch extends AEBaseBlock implements IOrientableBlock, I private void dropTorch(World w, int x, int y, int z) { - w.destroyBlock( x, y, z, true ); + w.func_147480_a( x, y, z, true ); + // w.destroyBlock( x, y, z, true ); w.markBlockForUpdate( x, y, z ); } @@ -67,7 +69,7 @@ public class BlockQuartzTorch extends AEBaseBlock implements IOrientableBlock, I private boolean canPlaceAt(World w, int x, int y, int z, ForgeDirection dir) { - return w.isBlockSolidOnSide( x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ, dir.getOpposite(), false ); + return w.isSideSolid( x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ, dir.getOpposite(), false ); } @Override @@ -77,7 +79,7 @@ public class BlockQuartzTorch extends AEBaseBlock implements IOrientableBlock, I } @Override - public void onNeighborBlockChange(World w, int x, int y, int z, int id) + public void onNeighborBlockChange(World w, int x, int y, int z, Block id) { ForgeDirection up = getOrientable( w, x, y, z ).getUp(); if ( !canPlaceAt( w, x, y, z, up.getOpposite() ) ) @@ -97,11 +99,10 @@ public class BlockQuartzTorch extends AEBaseBlock implements IOrientableBlock, I @Override public void addCollidingBlockToList(World w, int x, int y, int z, AxisAlignedBB bb, List out, Entity e) {/* - * double xOff = -0.15 * getUp().offsetX; double yOff = -0.15 * - * getUp().offsetY; double zOff = -0.15 * getUp().offsetZ; out.add( - * AxisAlignedBB.getAABBPool().getAABB( xOff + (double) x + 0.15, yOff + - * (double) y + 0.15, zOff + (double) z + 0.15,// ahh xOff + (double) x + - * 0.85, yOff + (double) y + 0.85, zOff + (double) z + 0.85 ) ); + * double xOff = -0.15 * getUp().offsetX; double yOff = -0.15 * getUp().offsetY; double zOff = -0.15 * + * getUp().offsetZ; out.add( AxisAlignedBB.getAABBPool().getAABB( xOff + (double) x + 0.15, yOff + (double) y + + * 0.15, zOff + (double) z + 0.15,// ahh xOff + (double) x + 0.85, yOff + (double) y + 0.85, zOff + (double) z + + * 0.85 ) ); */ } diff --git a/block/misc/BlockSecurity.java b/block/misc/BlockSecurity.java index 0f70aa56..d2c9f183 100644 --- a/block/misc/BlockSecurity.java +++ b/block/misc/BlockSecurity.java @@ -5,7 +5,7 @@ import java.util.EnumSet; import net.minecraft.block.material.Material; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.world.World; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.block.AEBaseBlock; import appeng.client.render.BaseBlockRender; import appeng.client.render.blocks.RendererSecurity; @@ -46,7 +46,7 @@ public class BlockSecurity extends AEBaseBlock Platform.openGUI( p, tg, ForgeDirection.getOrientation( side ), GuiBridge.GUI_SECURITY ); } else - p.sendChatToPlayer( PlayerMessages.MachineNotPowered.get() ); + p.addChatMessage( PlayerMessages.MachineNotPowered.get() ); } return true; diff --git a/block/misc/BlockTinyTNT.java b/block/misc/BlockTinyTNT.java index 5cfd2cac..59a52eda 100644 --- a/block/misc/BlockTinyTNT.java +++ b/block/misc/BlockTinyTNT.java @@ -7,14 +7,15 @@ import java.util.List; import net.minecraft.block.Block; import net.minecraft.block.BlockDispenser; import net.minecraft.block.material.Material; -import net.minecraft.client.renderer.texture.IconRegister; +import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.projectile.EntityArrow; -import net.minecraft.item.Item; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.Icon; +import net.minecraft.util.IIcon; import net.minecraft.world.Explosion; import net.minecraft.world.World; import appeng.block.AEBaseBlock; @@ -40,7 +41,7 @@ public class BlockTinyTNT extends AEBaseBlock implements ICustomCollision isFullSize = isOpaque = false; EntityRegistry.registerModEntity( EntityTinyTNTPrimed.class, "EntityTinyTNTPrimed", EntityIds.TINY_TNT, AppEng.instance, 16, 4, true ); - BlockDispenser.dispenseBehaviorRegistry.putObject( Item.itemsList[blockID], new DispenserBehaviorTinyTNT() ); + BlockDispenser.dispenseBehaviorRegistry.putObject( Block.getIdFromBlock( this ), new DispenserBehaviorTinyTNT() ); } @Override @@ -50,15 +51,15 @@ public class BlockTinyTNT extends AEBaseBlock implements ICustomCollision } @Override - public void registerIcons(IconRegister iconRegistry) + public void registerBlockIcons(IIconRegister iconRegistry) { // no images required. } @Override - public Icon getIcon(int direction, int metadata) + public IIcon getIcon(int direction, int metadata) { - return new FullIcon( Block.tnt.getIcon( direction, metadata ) ); + return new FullIcon( Blocks.tnt.getIcon( direction, metadata ) ); } @Override @@ -89,7 +90,7 @@ public class BlockTinyTNT extends AEBaseBlock implements ICustomCollision } @Override - public void onNeighborBlockChange(World w, int x, int y, int z, int id) + public void onNeighborBlockChange(World w, int x, int y, int z, Block id) { if ( w.isBlockIndirectlyGettingPowered( x, y, z ) ) { @@ -101,7 +102,7 @@ public class BlockTinyTNT extends AEBaseBlock implements ICustomCollision @Override public boolean onActivated(World w, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { - if ( player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().itemID == Item.flintAndSteel.itemID ) + if ( player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() == Items.flint_and_steel ) { this.startFuse( w, x, y, z, player ); w.setBlockToAir( x, y, z ); diff --git a/block/misc/BlockVibrationChamber.java b/block/misc/BlockVibrationChamber.java index b0dc531c..5010860d 100644 --- a/block/misc/BlockVibrationChamber.java +++ b/block/misc/BlockVibrationChamber.java @@ -5,10 +5,10 @@ import java.util.Random; import net.minecraft.block.material.Material; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.util.Icon; +import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.block.AEBaseBlock; import appeng.client.texture.ExtraTextures; import appeng.core.Configuration; @@ -38,7 +38,7 @@ public class BlockVibrationChamber extends AEBaseBlock TileVibrationChamber tc = getTileEntity( w, x, y, z ); if ( tc != null && !player.isSneaking() ) { - Platform.openGUI( player, tc, ForgeDirection.getOrientation(side),GuiBridge.GUI_VIBRATIONCHAMBER ); + Platform.openGUI( player, tc, ForgeDirection.getOrientation( side ), GuiBridge.GUI_VIBRATIONCHAMBER ); return true; } } @@ -47,9 +47,9 @@ public class BlockVibrationChamber extends AEBaseBlock } @Override - public Icon getBlockTexture(IBlockAccess w, int x, int y, int z, int s) + public IIcon getIcon(IBlockAccess w, int x, int y, int z, int s) { - Icon ico = super.getBlockTexture( w, x, y, z, s ); + IIcon ico = super.getIcon( w, x, y, z, s ); TileVibrationChamber tvc = getTileEntity( w, x, y, z ); if ( tvc != null && tvc.isOn && ico == getRendererInstance().getTexture( ForgeDirection.SOUTH ) ) diff --git a/block/networking/BlockCableBus.java b/block/networking/BlockCableBus.java index 7c0bb092..7d4455b3 100644 --- a/block/networking/BlockCableBus.java +++ b/block/networking/BlockCableBus.java @@ -6,25 +6,26 @@ import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.material.Material; -import net.minecraft.client.renderer.texture.IconRegister; +import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.Icon; +import net.minecraft.util.IIcon; import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.Vec3; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.parts.PartItemStack; import appeng.api.parts.SelectedPart; import appeng.block.AEBaseBlock; import appeng.client.render.BaseBlockRender; import appeng.client.render.blocks.RendererCableBus; -import appeng.client.texture.CableBusTextures; +import appeng.client.texture.ExtraTextures; import appeng.core.Api; import appeng.core.AppEng; import appeng.core.CommonHelper; @@ -49,7 +50,7 @@ public class BlockCableBus extends AEBaseBlock } @Override - public boolean isLadder(World world, int x, int y, int z, EntityLivingBase entity) + public boolean isLadder(IBlockAccess world, int x, int y, int z, EntityLivingBase entity) { return cb( world, x, y, z ).isLadder( entity ); } @@ -76,7 +77,7 @@ public class BlockCableBus extends AEBaseBlock @Override public int getLightValue(IBlockAccess world, int x, int y, int z) { - Block block = blocksList[world.getBlockId( x, y, z )]; + Block block = world.getBlock( x, y, z ); if ( block != null && block != this ) { return block.getLightValue( world, x, y, z ); @@ -101,13 +102,13 @@ public class BlockCableBus extends AEBaseBlock } @Override - public boolean isBlockReplaceable(World world, int x, int y, int z) + public boolean isReplaceable(IBlockAccess world, int x, int y, int z) { return cb( world, x, y, z ).isEmpty(); } @Override - public boolean removeBlockByPlayer(World world, EntityPlayer player, int x, int y, int z) + public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z) { if ( player.capabilities.isCreativeMode ) { @@ -116,23 +117,23 @@ public class BlockCableBus extends AEBaseBlock tile.dropItems = false; // maybe ray trace? } - return super.removeBlockByPlayer( world, player, x, y, z ); + return super.removedByPlayer( world, player, x, y, z ); } @Override - public Icon getBlockTexture(IBlockAccess w, int x, int y, int z, int s) + public IIcon getIcon(IBlockAccess w, int x, int y, int z, int s) { return getIcon( s, 0 ); } @Override - public Icon getIcon(int direction, int metadata) + public IIcon getIcon(int direction, int metadata) { - Icon i = super.getIcon( direction, metadata ); + IIcon i = super.getIcon( direction, metadata ); if ( i != null ) return i; - return CableBusTextures.getMissing(); + return ExtraTextures.BlockQuartzGlassB.getIcon(); } @Override @@ -142,7 +143,7 @@ public class BlockCableBus extends AEBaseBlock } @Override - public void registerIcons(IconRegister iconRegistry) + public void registerBlockIcons(IIconRegister iconRegistry) { } @@ -154,21 +155,21 @@ public class BlockCableBus extends AEBaseBlock } @Override - public boolean isBlockSolidOnSide(World w, int x, int y, int z, ForgeDirection side) + public boolean isSideSolid(IBlockAccess w, int x, int y, int z, ForgeDirection side) { return cb( w, x, y, z ).isSolidOnSide( side ); } @Override - public void onNeighborBlockChange(World w, int x, int y, int z, int meh) + public void onNeighborBlockChange(World w, int x, int y, int z, Block meh) { cb( w, x, y, z ).onNeighborChanged(); } @Override - public int idDropped(int i, Random r, int k) + public Item getItemDropped(int i, Random r, int k) { - return 0; + return null; } @Override @@ -216,7 +217,7 @@ public class BlockCableBus extends AEBaseBlock } @Override - public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List) + public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) { } @@ -230,7 +231,7 @@ public class BlockCableBus extends AEBaseBlock private ICableBusContainer cb(IBlockAccess w, int x, int y, int z) { - TileEntity te = w.getBlockTileEntity( x, y, z ); + TileEntity te = w.getTileEntity( x, y, z ); if ( te instanceof TileCableBus ) return ((TileCableBus) te).cb; diff --git a/block/networking/BlockController.java b/block/networking/BlockController.java index d409691e..90152f65 100644 --- a/block/networking/BlockController.java +++ b/block/networking/BlockController.java @@ -2,6 +2,7 @@ package appeng.block.networking; import java.util.EnumSet; +import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.world.World; import appeng.block.AEBaseBlock; @@ -20,7 +21,7 @@ public class BlockController extends AEBaseBlock } @Override - public void onNeighborBlockChange(World w, int x, int y, int z, int id_junk) + public void onNeighborBlockChange(World w, int x, int y, int z, Block id_junk) { TileController tc = getTileEntity( w, x, y, z ); if ( tc != null ) diff --git a/block/networking/BlockDenseEnergyCell.java b/block/networking/BlockDenseEnergyCell.java index 405a9bf3..edc5e9c2 100644 --- a/block/networking/BlockDenseEnergyCell.java +++ b/block/networking/BlockDenseEnergyCell.java @@ -2,7 +2,7 @@ package appeng.block.networking; import java.util.EnumSet; -import net.minecraft.util.Icon; +import net.minecraft.util.IIcon; import appeng.client.texture.ExtraTextures; import appeng.core.features.AEFeature; import appeng.tile.networking.TileDenseEnergyCell; @@ -23,7 +23,7 @@ public class BlockDenseEnergyCell extends BlockEnergyCell } @Override - public Icon getIcon(int direction, int metadata) + public IIcon getIcon(int direction, int metadata) { switch (metadata) { diff --git a/block/networking/BlockEnergyCell.java b/block/networking/BlockEnergyCell.java index 133cfec2..676494db 100644 --- a/block/networking/BlockEnergyCell.java +++ b/block/networking/BlockEnergyCell.java @@ -5,9 +5,10 @@ import java.util.List; import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.Icon; +import net.minecraft.util.IIcon; import appeng.block.AEBaseBlock; import appeng.block.AEBaseItemBlockChargeable; import appeng.client.render.BaseBlockRender; @@ -36,7 +37,7 @@ public class BlockEnergyCell extends AEBaseBlock } @Override - public void getSubBlocks(int id, CreativeTabs tab, List list) + public void getSubBlocks(Item id, CreativeTabs tab, List list) { super.getSubBlocks( id, tab, list ); @@ -54,7 +55,7 @@ public class BlockEnergyCell extends AEBaseBlock } @Override - public Icon getIcon(int direction, int metadata) + public IIcon getIcon(int direction, int metadata) { switch (metadata) { diff --git a/block/networking/BlockWireless.java b/block/networking/BlockWireless.java index 880595b0..d8bbbe5e 100644 --- a/block/networking/BlockWireless.java +++ b/block/networking/BlockWireless.java @@ -8,9 +8,9 @@ import net.minecraft.block.material.Material; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.Icon; +import net.minecraft.util.IIcon; import net.minecraft.world.World; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.block.AEBaseBlock; import appeng.client.render.BaseBlockRender; import appeng.client.render.blocks.RenderBlockWireless; @@ -39,7 +39,7 @@ public class BlockWireless extends AEBaseBlock implements ICustomCollision } @Override - public Icon getIcon(int direction, int metadata) + public IIcon getIcon(int direction, int metadata) { return super.getIcon( direction, metadata ); } diff --git a/block/qnb/BlockQuantumLinkChamber.java b/block/qnb/BlockQuantumLinkChamber.java index b1b02912..7ace4994 100644 --- a/block/qnb/BlockQuantumLinkChamber.java +++ b/block/qnb/BlockQuantumLinkChamber.java @@ -3,10 +3,11 @@ package appeng.block.qnb; import java.util.EnumSet; import java.util.Random; +import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.world.World; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.block.AEBaseBlock; import appeng.client.render.BaseBlockRender; import appeng.client.render.blocks.RenderQNB; @@ -47,7 +48,7 @@ public class BlockQuantumLinkChamber extends AEBaseBlock } @Override - public void onNeighborBlockChange(World w, int x, int y, int z, int pointlessnumber) + public void onNeighborBlockChange(World w, int x, int y, int z, Block pointlessnumber) { TileQuantumBridge bridge = getTileEntity( w, x, y, z ); if ( bridge != null ) diff --git a/block/qnb/BlockQuantumRing.java b/block/qnb/BlockQuantumRing.java index deb76050..30aed95d 100644 --- a/block/qnb/BlockQuantumRing.java +++ b/block/qnb/BlockQuantumRing.java @@ -2,6 +2,7 @@ package appeng.block.qnb; import java.util.EnumSet; +import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.world.World; import appeng.block.AEBaseBlock; @@ -24,7 +25,7 @@ public class BlockQuantumRing extends AEBaseBlock } @Override - public void onNeighborBlockChange(World w, int x, int y, int z, int pointlessnumber) + public void onNeighborBlockChange(World w, int x, int y, int z, Block pointlessnumber) { TileQuantumBridge bridge = getTileEntity( w, x, y, z ); if ( bridge != null ) diff --git a/block/solids/BlockMatrixFrame.java b/block/solids/BlockMatrixFrame.java index 373e8f58..7584ccc6 100644 --- a/block/solids/BlockMatrixFrame.java +++ b/block/solids/BlockMatrixFrame.java @@ -5,6 +5,7 @@ import java.util.List; import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.Item; import appeng.block.AEBaseBlock; import appeng.client.render.BaseBlockRender; import appeng.client.render.blocks.RenderNull; @@ -29,7 +30,7 @@ public class BlockMatrixFrame extends AEBaseBlock } @Override - public void getSubBlocks(int id, CreativeTabs tab, List list) + public void getSubBlocks(Item id, CreativeTabs tab, List list) { } diff --git a/block/solids/BlockQuartzGlass.java b/block/solids/BlockQuartzGlass.java index 64b0937c..3fc64b5b 100644 --- a/block/solids/BlockQuartzGlass.java +++ b/block/solids/BlockQuartzGlass.java @@ -2,7 +2,6 @@ package appeng.block.solids; import java.util.EnumSet; -import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.world.IBlockAccess; import appeng.block.AEBaseBlock; @@ -29,9 +28,9 @@ public class BlockQuartzGlass extends AEBaseBlock @Override public boolean shouldSideBeRendered(IBlockAccess w, int x, int y, int z, int side) { - if ( w.getBlockMaterial( x, y, z ) == Material.glass ) + if ( w.getBlock( x, y, z ).getMaterial() == Material.glass ) { - if ( Block.blocksList[w.getBlockId( x, y, z )].getRenderType() == this.getRenderType() ) + if ( w.getBlock( x, y, z ).getRenderType() == this.getRenderType() ) return false; } return super.shouldSideBeRendered( w, x, y, z, side ); diff --git a/block/solids/BlockQuartzLamp.java b/block/solids/BlockQuartzLamp.java index 6b321779..f4df0444 100644 --- a/block/solids/BlockQuartzLamp.java +++ b/block/solids/BlockQuartzLamp.java @@ -19,8 +19,8 @@ public class BlockQuartzLamp extends BlockQuartzGlass public BlockQuartzLamp() { super( BlockQuartzLamp.class ); setfeature( EnumSet.of( AEFeature.DecorativeQuartzBlocks, AEFeature.DecorativeLights ) ); - setLightValue( 1.0f ); - setTextureName( "BlockQuartzGlass" ); + setLightLevel( 1.0f ); + setBlockTextureName( "BlockQuartzGlass" ); } @Override diff --git a/block/solids/OreQuartz.java b/block/solids/OreQuartz.java index af88271f..6ba2cb9a 100644 --- a/block/solids/OreQuartz.java +++ b/block/solids/OreQuartz.java @@ -4,6 +4,7 @@ import java.util.EnumSet; import java.util.Random; import net.minecraft.block.material.Material; +import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.MathHelper; import net.minecraft.world.IBlockAccess; @@ -83,9 +84,9 @@ public class OreQuartz extends AEBaseBlock implements IOrientableBlock } @Override - public int idDropped(int id, Random rand, int meta) + public Item getItemDropped(int id, Random rand, int meta) { - return getItemDropped().itemID; + return getItemDropped().getItem(); } @Override @@ -103,7 +104,7 @@ public class OreQuartz extends AEBaseBlock implements IOrientableBlock @Override public int quantityDroppedWithBonus(int fortune, Random rand) { - if ( fortune > 0 && this.blockID != this.idDropped( 0, rand, fortune ) ) + if ( fortune > 0 && Item.getItemFromBlock( this ) != getItemDropped( 0, rand, fortune ) ) { int j = rand.nextInt( fortune + 2 ) - 1; @@ -125,7 +126,7 @@ public class OreQuartz extends AEBaseBlock implements IOrientableBlock { super.dropBlockAsItemWithChance( w, x, y, z, blockid, something, meta ); - if ( this.idDropped( blockid, w.rand, meta ) != this.blockID ) + if ( getItemDropped( blockid, w.rand, meta ) != Item.getItemFromBlock( this ) ) { int xp = MathHelper.getRandomIntegerInRange( w.rand, 2, 5 ); diff --git a/block/spatial/BlockSpatialIOPort.java b/block/spatial/BlockSpatialIOPort.java index 201e431a..e8567f44 100644 --- a/block/spatial/BlockSpatialIOPort.java +++ b/block/spatial/BlockSpatialIOPort.java @@ -2,6 +2,7 @@ package appeng.block.spatial; import java.util.EnumSet; +import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.world.World; import appeng.block.AEBaseBlock; @@ -18,7 +19,7 @@ public class BlockSpatialIOPort extends AEBaseBlock } @Override - public final void onNeighborBlockChange(World w, int x, int y, int z, int junk) + public final void onNeighborBlockChange(World w, int x, int y, int z, Block junk) { TileSpatialIOPort te = getTileEntity( w, x, y, z ); if ( te != null ) diff --git a/block/spatial/BlockSpatialPylon.java b/block/spatial/BlockSpatialPylon.java index b17c221a..6e5d56d2 100644 --- a/block/spatial/BlockSpatialPylon.java +++ b/block/spatial/BlockSpatialPylon.java @@ -2,6 +2,7 @@ package appeng.block.spatial; import java.util.EnumSet; +import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -21,7 +22,7 @@ public class BlockSpatialPylon extends AEBaseBlock } @Override - public void onNeighborBlockChange(World w, int x, int y, int z, int junk) + public void onNeighborBlockChange(World w, int x, int y, int z, Block junk) { TileSpatialPylon tsp = getTileEntity( w, x, y, z ); if ( tsp != null ) diff --git a/block/storage/BlockChest.java b/block/storage/BlockChest.java index 3863be70..7298767f 100644 --- a/block/storage/BlockChest.java +++ b/block/storage/BlockChest.java @@ -7,7 +7,7 @@ import net.minecraft.block.material.Material; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.world.World; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.AEApi; import appeng.api.storage.ICellHandler; import appeng.api.storage.IMEInventoryHandler; @@ -73,10 +73,10 @@ public class BlockChest extends AEBaseBlock } } - p.sendChatToPlayer( PlayerMessages.ChestCannotReadStorageCell.get() ); + p.addChatMessage( PlayerMessages.ChestCannotReadStorageCell.get() ); } else - p.sendChatToPlayer( PlayerMessages.MachineNotPowered.get() ); + p.addChatMessage( PlayerMessages.MachineNotPowered.get() ); return true; } diff --git a/block/storage/BlockDrive.java b/block/storage/BlockDrive.java index 18ee7fcc..a06b0155 100644 --- a/block/storage/BlockDrive.java +++ b/block/storage/BlockDrive.java @@ -5,7 +5,7 @@ import java.util.EnumSet; import net.minecraft.block.material.Material; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.world.World; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.block.AEBaseBlock; import appeng.client.render.BaseBlockRender; import appeng.client.render.blocks.RenderDrive; diff --git a/block/storage/BlockIOPort.java b/block/storage/BlockIOPort.java index 41506382..942ffe42 100644 --- a/block/storage/BlockIOPort.java +++ b/block/storage/BlockIOPort.java @@ -2,10 +2,11 @@ package appeng.block.storage; import java.util.EnumSet; +import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.world.World; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.block.AEBaseBlock; import appeng.core.features.AEFeature; import appeng.core.sync.GuiBridge; @@ -22,7 +23,7 @@ public class BlockIOPort extends AEBaseBlock } @Override - public final void onNeighborBlockChange(World w, int x, int y, int z, int junk) + public final void onNeighborBlockChange(World w, int x, int y, int z, Block junk) { TileIOPort te = getTileEntity( w, x, y, z ); if ( te != null ) diff --git a/client/ClientHelper.java b/client/ClientHelper.java index c02d23f7..f7f21ab7 100644 --- a/client/ClientHelper.java +++ b/client/ClientHelper.java @@ -8,11 +8,10 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.particle.EntityFX; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; +import net.minecraft.init.Items; import net.minecraft.world.World; import net.minecraftforge.client.event.TextureStitchEvent; import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.event.ForgeSubscribe; import appeng.block.AEBaseBlock; import appeng.client.render.BaseBlockRender; import appeng.client.render.TESRWrapper; @@ -27,6 +26,7 @@ import appeng.server.ServerHelper; import appeng.util.Platform; import cpw.mods.fml.client.registry.ClientRegistry; import cpw.mods.fml.client.registry.RenderingRegistry; +import cpw.mods.fml.common.eventhandler.SubscribeEvent; public class ClientHelper extends ServerHelper { @@ -40,10 +40,10 @@ public class ClientHelper extends ServerHelper RenderManager.instance.entityRenderMap.put( EntityTinyTNTPrimed.class, new RenderTinyTNTPrimed() ); } - @ForgeSubscribe + @SubscribeEvent public void updateTextureSheet(TextureStitchEvent.Pre ev) { - if ( ev.map.textureType == 0 ) + if ( ev.map.getTextureType() == 0 ) { for (ExtraTextures et : ExtraTextures.values()) et.registerIcon( ev.map ); @@ -97,7 +97,7 @@ public class ClientHelper extends ServerHelper float y = (float) (((Platform.getRandomInt() % 100) * 0.01) - 0.5) * 0.7f; float z = (float) (((Platform.getRandomInt() % 100) * 0.01) - 0.5) * 0.7f; - EnergyFx fx = new EnergyFx( w, posX + x, posY + y, posZ + z, Item.diamond ); + EnergyFx fx = new EnergyFx( w, posX + x, posY + y, posZ + z, Items.diamond ); fx.motionX = -x * 0.1; fx.motionY = -y * 0.1; diff --git a/client/gui/AEBaseGui.java b/client/gui/AEBaseGui.java index 10bcc40c..85f8a18d 100644 --- a/client/gui/AEBaseGui.java +++ b/client/gui/AEBaseGui.java @@ -39,9 +39,10 @@ import appeng.container.slot.SlotInaccessable; import appeng.container.slot.SlotOutput; import appeng.container.slot.SlotRestrictedInput; import appeng.core.AELog; +import appeng.core.sync.network.NetworkHandler; import appeng.core.sync.packets.PacketInventoryAction; import appeng.helpers.InventoryAction; -import cpw.mods.fml.common.network.PacketDispatcher; +import appeng.util.Platform; public abstract class AEBaseGui extends GuiContainer { @@ -115,7 +116,7 @@ public abstract class AEBaseGui extends GuiContainer try { p = new PacketInventoryAction( action, slotIdx, stack ); - PacketDispatcher.sendPacketToServer( p.getPacket() ); + NetworkHandler.instance.sendToServer( p ); } catch (IOException e) { @@ -144,7 +145,7 @@ public abstract class AEBaseGui extends GuiContainer try { p = new PacketInventoryAction( action, slotIdx, stack ); - PacketDispatcher.sendPacketToServer( p.getPacket() ); + NetworkHandler.instance.sendToServer( p ); } catch (IOException e) { @@ -194,7 +195,7 @@ public abstract class AEBaseGui extends GuiContainer try { p = new PacketInventoryAction( action, inventorySlots.inventorySlots.size(), stack ); - PacketDispatcher.sendPacketToServer( p.getPacket() ); + NetworkHandler.instance.sendToServer( p ); } catch (IOException e) { @@ -255,7 +256,7 @@ public abstract class AEBaseGui extends GuiContainer for (var6 = 0; var6 < var4.length; ++var6) { - var7 = fontRenderer.getStringWidth( (String) var4[var6] ); + var7 = fontRendererObj.getStringWidth( (String) var4[var6] ); if ( var7 > var5 ) { @@ -281,7 +282,7 @@ public abstract class AEBaseGui extends GuiContainer var5 = forceWidth; this.zLevel = 300.0F; - itemRenderer.zLevel = 300.0F; + itemRender.zLevel = 300.0F; int var10 = -267386864; this.drawGradientRect( var6 - 3, var7 - 4, var6 + var5 + 3, var7 - 3, var10, var10 ); this.drawGradientRect( var6 - 3, var7 + var9 + 3, var6 + var5 + 3, var7 + var9 + 4, var10, var10 ); @@ -308,7 +309,7 @@ public abstract class AEBaseGui extends GuiContainer var14 = "\u00a77" + var14; } - this.fontRenderer.drawStringWithShadow( var14, var6, var7, -1 ); + this.fontRendererObj.drawStringWithShadow( var14, var6, var7, -1 ); if ( var13 == 0 ) { @@ -319,7 +320,7 @@ public abstract class AEBaseGui extends GuiContainer } this.zLevel = 0.0F; - itemRenderer.zLevel = 0.0F; + itemRender.zLevel = 0.0F; } GL11.glPopAttrib(); } @@ -343,15 +344,15 @@ public abstract class AEBaseGui extends GuiContainer protected void drawItem(int x, int y, ItemStack is) { this.zLevel = 100.0F; - itemRenderer.zLevel = 100.0F; + itemRender.zLevel = 100.0F; GL11.glEnable( GL11.GL_LIGHTING ); GL11.glEnable( GL12.GL_RESCALE_NORMAL ); RenderHelper.enableGUIStandardItemLighting(); - itemRenderer.renderItemAndEffectIntoGUI( this.fontRenderer, this.mc.renderEngine, is, x, y ); + itemRender.renderItemAndEffectIntoGUI( this.fontRendererObj, this.mc.renderEngine, is, x, y ); GL11.glDisable( GL11.GL_LIGHTING ); - itemRenderer.zLevel = 0.0F; + itemRender.zLevel = 0.0F; this.zLevel = 0.0F; } @@ -401,7 +402,9 @@ public abstract class AEBaseGui extends GuiContainer for (int j1 = 0; j1 < this.inventorySlots.inventorySlots.size(); ++j1) { Slot slot = (Slot) this.inventorySlots.inventorySlots.get( j1 ); - if ( isPointInRegion( slot.xDisplayPosition, slot.yDisplayPosition, 16, 16, mousex, mousey ) ) + + // isPointInRegion + if ( func_146978_c( slot.xDisplayPosition, slot.yDisplayPosition, 16, 16, mousex, mousey ) ) { return slot; } @@ -430,12 +433,13 @@ public abstract class AEBaseGui extends GuiContainer { try { - super.drawSlotInventory( s ); + // drawSlotInventory + // super.func_146977_a( s ); } catch (Exception err) { Tessellator tessellator = Tessellator.instance; - if ( tessellator.isDrawing ) + if ( Platform.isDrawing( tessellator ) ) tessellator.draw(); } } @@ -447,17 +451,18 @@ public abstract class AEBaseGui extends GuiContainer return true; } - @Override + // @Override + // private void func_146977_a(Slot p_146977_1_) protected void drawSlotInventory(Slot s) { if ( s instanceof SlotME ) { - RenderItem pIR = itemRenderer; - itemRenderer = aeri; + RenderItem pIR = itemRender; + itemRender = aeri; try { this.zLevel = 100.0F; - itemRenderer.zLevel = 100.0F; + itemRender.zLevel = 100.0F; if ( !isPowered() ) { @@ -467,7 +472,7 @@ public abstract class AEBaseGui extends GuiContainer } this.zLevel = 0.0F; - itemRenderer.zLevel = 0.0F; + itemRender.zLevel = 0.0F; if ( s instanceof SlotME ) aeri.aestack = ((SlotME) s).getAEStack(); @@ -479,10 +484,10 @@ public abstract class AEBaseGui extends GuiContainer catch (Exception err) { AELog.warning( "[AppEng] AE prevented crash while drawing slot: " + err.toString() ); - if ( Tessellator.instance.isDrawing ) + if ( Platform.isDrawing( Tessellator.instance ) ) Tessellator.instance.draw(); } - itemRenderer = pIR; + itemRender = pIR; return; } else @@ -522,10 +527,10 @@ public abstract class AEBaseGui extends GuiContainer tessellator.setColorRGBA_F( 1.0f, 1.0f, 1.0f, aes.getOpacityOfIcon() ); tessellator.addVertexWithUV( (double) (par1 + 0), (double) (par2 + par6), (double) this.zLevel, (double) ((float) (par3 + 0) * f), (double) ((float) (par4 + par6) * f1) ); - tessellator.addVertexWithUV( (double) (par1 + par5), (double) (par2 + par6), (double) this.zLevel, (double) ((float) (par3 + par5) * f), - (double) ((float) (par4 + par6) * f1) ); - tessellator.addVertexWithUV( (double) (par1 + par5), (double) (par2 + 0), (double) this.zLevel, (double) ((float) (par3 + par5) * f), - (double) ((float) (par4 + 0) * f1) ); + tessellator.addVertexWithUV( (double) (par1 + par5), (double) (par2 + par6), (double) this.zLevel, + (double) ((float) (par3 + par5) * f), (double) ((float) (par4 + par6) * f1) ); + tessellator.addVertexWithUV( (double) (par1 + par5), (double) (par2 + 0), (double) this.zLevel, + (double) ((float) (par3 + par5) * f), (double) ((float) (par4 + 0) * f1) ); tessellator.addVertexWithUV( (double) (par1 + 0), (double) (par2 + 0), (double) this.zLevel, (double) ((float) (par3 + 0) * f), (double) ((float) (par4 + 0) * f1) ); tessellator.setColorRGBA_F( 1.0f, 1.0f, 1.0f, 1.0f ); @@ -533,7 +538,7 @@ public abstract class AEBaseGui extends GuiContainer } catch (Exception err) { - if ( tessellator.isDrawing ) + if ( Platform.isDrawing( tessellator ) ) tessellator.draw(); } GL11.glPopAttrib(); @@ -563,14 +568,14 @@ public abstract class AEBaseGui extends GuiContainer if ( ((AppEngSlot) s).isValid == hasCalculatedValidness.Invalid ) { this.zLevel = 100.0F; - itemRenderer.zLevel = 100.0F; + itemRender.zLevel = 100.0F; GL11.glDisable( GL11.GL_LIGHTING ); super.drawRect( s.xDisplayPosition, s.yDisplayPosition, 16 + s.xDisplayPosition, 16 + s.yDisplayPosition, 0x66ff6666 ); GL11.glEnable( GL11.GL_LIGHTING ); this.zLevel = 0.0F; - itemRenderer.zLevel = 0.0F; + itemRender.zLevel = 0.0F; } } @@ -592,4 +597,5 @@ public abstract class AEBaseGui extends GuiContainer // do the usual for non-ME Slots. safeDrawSlot( s ); } + } diff --git a/client/gui/AEBaseMEGui.java b/client/gui/AEBaseMEGui.java index e7fcadf7..d4a2dbfe 100644 --- a/client/gui/AEBaseMEGui.java +++ b/client/gui/AEBaseMEGui.java @@ -57,7 +57,6 @@ public abstract class AEBaseMEGui extends AEBaseGui } // Vanillia version... - @Override protected void drawItemStackTooltip(ItemStack stack, int x, int y) { Slot s = getSlot( x, y ); @@ -96,7 +95,7 @@ public abstract class AEBaseMEGui extends AEBaseGui return; } } - super.drawItemStackTooltip( stack, x, y ); + // super.drawItemStackTooltip( stack, x, y ); } } \ No newline at end of file diff --git a/client/gui/implementations/GuiCellWorkbench.java b/client/gui/implementations/GuiCellWorkbench.java index bb2ef5bc..1cdf27b0 100644 --- a/client/gui/implementations/GuiCellWorkbench.java +++ b/client/gui/implementations/GuiCellWorkbench.java @@ -17,10 +17,10 @@ import appeng.api.implementations.items.IUpgradeModule; import appeng.client.gui.widgets.GuiImgButton; import appeng.container.implementations.ContainerCellWorkbench; import appeng.core.localization.GuiText; +import appeng.core.sync.network.NetworkHandler; import appeng.core.sync.packets.PacketValueConfig; import appeng.tile.misc.TileCellWorkbench; import appeng.util.Platform; -import cpw.mods.fml.common.network.PacketDispatcher; public class GuiCellWorkbench extends GuiUpgradeable { @@ -104,11 +104,11 @@ public class GuiCellWorkbench extends GuiUpgradeable { if ( btn == partition ) { - PacketDispatcher.sendPacketToServer( (new PacketValueConfig( "CellWorkbench.Action", "Partition" )).getPacket() ); + NetworkHandler.instance.sendToServer( new PacketValueConfig( "CellWorkbench.Action", "Partition" ) ); } else if ( btn == clear ) { - PacketDispatcher.sendPacketToServer( (new PacketValueConfig( "CellWorkbench.Action", "Clear" )).getPacket() ); + NetworkHandler.instance.sendToServer( new PacketValueConfig( "CellWorkbench.Action", "Clear" ) ); } else if ( btn == fuzzyMode ) { @@ -117,7 +117,7 @@ public class GuiCellWorkbench extends GuiUpgradeable FuzzyMode fz = (FuzzyMode) fuzzyMode.getCurrentValue(); fz = Platform.rotateEnum( fz, backwards, Settings.FUZZY_MODE.getPossibleValues() ); - PacketDispatcher.sendPacketToServer( (new PacketValueConfig( "CellWorkbench.Fuzzy", fz.name() )).getPacket() ); + NetworkHandler.instance.sendToServer( new PacketValueConfig( "CellWorkbench.Fuzzy", fz.name() ) ); } else super.actionPerformed( btn ); diff --git a/client/gui/implementations/GuiChest.java b/client/gui/implementations/GuiChest.java index a71a9509..c360b686 100644 --- a/client/gui/implementations/GuiChest.java +++ b/client/gui/implementations/GuiChest.java @@ -10,9 +10,9 @@ import appeng.container.implementations.ContainerChest; import appeng.core.AELog; import appeng.core.localization.GuiText; import appeng.core.sync.GuiBridge; +import appeng.core.sync.network.NetworkHandler; import appeng.core.sync.packets.PacketSwitchGuis; import appeng.tile.storage.TileChest; -import cpw.mods.fml.common.network.PacketDispatcher; public class GuiChest extends AEBaseGui { @@ -28,7 +28,7 @@ public class GuiChest extends AEBaseGui { try { - PacketDispatcher.sendPacketToServer( (new PacketSwitchGuis( GuiBridge.GUI_PRIORITY )).getPacket() ); + NetworkHandler.instance.sendToServer( new PacketSwitchGuis( GuiBridge.GUI_PRIORITY ) ); } catch (IOException e) { @@ -42,7 +42,7 @@ public class GuiChest extends AEBaseGui { super.initGui(); - buttonList.add( priority = new GuiTabButton( this.guiLeft + 154, this.guiTop, 2 + 4 * 16, GuiText.Priority.getLocal(), itemRenderer ) ); + buttonList.add( priority = new GuiTabButton( this.guiLeft + 154, this.guiTop, 2 + 4 * 16, GuiText.Priority.getLocal(), itemRender ) ); } public GuiChest(InventoryPlayer inventoryPlayer, TileChest te) { @@ -60,8 +60,8 @@ public class GuiChest extends AEBaseGui @Override public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY) { - fontRenderer.drawString( GuiText.Chest.getLocal(), 8, 6, 4210752 ); - fontRenderer.drawString( GuiText.inventory.getLocal(), 8, ySize - 96 + 3, 4210752 ); + fontRendererObj.drawString( GuiText.Chest.getLocal(), 8, 6, 4210752 ); + fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, ySize - 96 + 3, 4210752 ); } } diff --git a/client/gui/implementations/GuiCondenser.java b/client/gui/implementations/GuiCondenser.java index 6a0e69aa..87e8f102 100644 --- a/client/gui/implementations/GuiCondenser.java +++ b/client/gui/implementations/GuiCondenser.java @@ -15,9 +15,9 @@ import appeng.client.gui.widgets.GuiProgressBar.Direction; import appeng.container.implementations.ContainerCondenser; import appeng.core.AELog; import appeng.core.localization.GuiText; +import appeng.core.sync.network.NetworkHandler; import appeng.core.sync.packets.PacketConfigButton; import appeng.tile.misc.TileCondenser; -import cpw.mods.fml.common.network.PacketDispatcher; public class GuiCondenser extends AEBaseGui { @@ -43,7 +43,7 @@ public class GuiCondenser extends AEBaseGui { try { - PacketDispatcher.sendPacketToServer( (new PacketConfigButton( Settings.CONDENSER_OUTPUT, backwards )).getPacket() ); + NetworkHandler.instance.sendToServer( new PacketConfigButton( Settings.CONDENSER_OUTPUT, backwards ) ); } catch (IOException e) { @@ -77,8 +77,8 @@ public class GuiCondenser extends AEBaseGui @Override public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY) { - fontRenderer.drawString( GuiText.Condenser.getLocal(), 8, 6, 4210752 ); - fontRenderer.drawString( GuiText.inventory.getLocal(), 8, ySize - 96 + 3, 4210752 ); + fontRendererObj.drawString( GuiText.Condenser.getLocal(), 8, 6, 4210752 ); + fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, ySize - 96 + 3, 4210752 ); mode.set( cvc.output ); mode.FillVar = "" + cvc.output.requiredPower; diff --git a/client/gui/implementations/GuiCraftingTerm.java b/client/gui/implementations/GuiCraftingTerm.java index 232b6829..7b70dcae 100644 --- a/client/gui/implementations/GuiCraftingTerm.java +++ b/client/gui/implementations/GuiCraftingTerm.java @@ -22,7 +22,7 @@ public class GuiCraftingTerm extends GuiMEMonitorable public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY) { super.drawFG( offsetX, offsetY, mouseX, mouseY ); - fontRenderer.drawString( GuiText.CraftingTerminal.getLocal(), 8, ySize - 96 + 1 - reservedSpace, 4210752 ); + fontRendererObj.drawString( GuiText.CraftingTerminal.getLocal(), 8, ySize - 96 + 1 - reservedSpace, 4210752 ); } } diff --git a/client/gui/implementations/GuiDrive.java b/client/gui/implementations/GuiDrive.java index c858e630..9d0a2935 100644 --- a/client/gui/implementations/GuiDrive.java +++ b/client/gui/implementations/GuiDrive.java @@ -10,9 +10,9 @@ import appeng.container.implementations.ContainerDrive; import appeng.core.AELog; import appeng.core.localization.GuiText; import appeng.core.sync.GuiBridge; +import appeng.core.sync.network.NetworkHandler; import appeng.core.sync.packets.PacketSwitchGuis; import appeng.tile.storage.TileDrive; -import cpw.mods.fml.common.network.PacketDispatcher; public class GuiDrive extends AEBaseGui { @@ -28,7 +28,7 @@ public class GuiDrive extends AEBaseGui { try { - PacketDispatcher.sendPacketToServer( (new PacketSwitchGuis( GuiBridge.GUI_PRIORITY )).getPacket() ); + NetworkHandler.instance.sendToServer( new PacketSwitchGuis( GuiBridge.GUI_PRIORITY ) ); } catch (IOException e) { @@ -42,7 +42,7 @@ public class GuiDrive extends AEBaseGui { super.initGui(); - buttonList.add( priority = new GuiTabButton( this.guiLeft + 154, this.guiTop, 2 + 4 * 16, GuiText.Priority.getLocal(), itemRenderer ) ); + buttonList.add( priority = new GuiTabButton( this.guiLeft + 154, this.guiTop, 2 + 4 * 16, GuiText.Priority.getLocal(), itemRender ) ); } public GuiDrive(InventoryPlayer inventoryPlayer, TileDrive te) { @@ -60,8 +60,8 @@ public class GuiDrive extends AEBaseGui @Override public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY) { - fontRenderer.drawString( GuiText.Drive.getLocal(), 8, 6, 4210752 ); - fontRenderer.drawString( GuiText.inventory.getLocal(), 8, ySize - 96 + 3, 4210752 ); + fontRendererObj.drawString( GuiText.Drive.getLocal(), 8, 6, 4210752 ); + fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, ySize - 96 + 3, 4210752 ); } } diff --git a/client/gui/implementations/GuiGrinder.java b/client/gui/implementations/GuiGrinder.java index febdd648..5e3faeb9 100644 --- a/client/gui/implementations/GuiGrinder.java +++ b/client/gui/implementations/GuiGrinder.java @@ -24,8 +24,8 @@ public class GuiGrinder extends AEBaseGui @Override public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY) { - fontRenderer.drawString( GuiText.GrindStone.getLocal(), 8, 6, 4210752 ); - fontRenderer.drawString( GuiText.inventory.getLocal(), 8, ySize - 96 + 3, 4210752 ); + fontRendererObj.drawString( GuiText.GrindStone.getLocal(), 8, 6, 4210752 ); + fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, ySize - 96 + 3, 4210752 ); } } diff --git a/client/gui/implementations/GuiIOPort.java b/client/gui/implementations/GuiIOPort.java index ebdd3dea..5be80bde 100644 --- a/client/gui/implementations/GuiIOPort.java +++ b/client/gui/implementations/GuiIOPort.java @@ -16,9 +16,9 @@ import appeng.client.gui.widgets.GuiImgButton; import appeng.container.implementations.ContainerIOPort; import appeng.core.AELog; import appeng.core.localization.GuiText; +import appeng.core.sync.network.NetworkHandler; import appeng.core.sync.packets.PacketConfigButton; import appeng.tile.storage.TileIOPort; -import cpw.mods.fml.common.network.PacketDispatcher; public class GuiIOPort extends GuiUpgradeable { @@ -42,8 +42,8 @@ public class GuiIOPort extends GuiUpgradeable @Override public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY) { - fontRenderer.drawString( GuiText.IOPort.getLocal(), 8, 6, 4210752 ); - fontRenderer.drawString( GuiText.inventory.getLocal(), 8, ySize - 96 + 3, 4210752 ); + fontRendererObj.drawString( GuiText.IOPort.getLocal(), 8, 6, 4210752 ); + fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, ySize - 96 + 3, 4210752 ); if ( redstoneMode != null ) redstoneMode.set( cvb.rsMode ); @@ -77,10 +77,10 @@ public class GuiIOPort extends GuiUpgradeable try { if ( btn == fullMode ) - PacketDispatcher.sendPacketToServer( (new PacketConfigButton( fullMode.getSetting(), backwards )).getPacket() ); + NetworkHandler.instance.sendToServer( new PacketConfigButton( fullMode.getSetting(), backwards ) ); if ( btn == operationMode ) - PacketDispatcher.sendPacketToServer( (new PacketConfigButton( operationMode.getSetting(), backwards )).getPacket() ); + NetworkHandler.instance.sendToServer( new PacketConfigButton( operationMode.getSetting(), backwards ) ); } catch (IOException e) { diff --git a/client/gui/implementations/GuiInterface.java b/client/gui/implementations/GuiInterface.java index 6ce765ae..a77949df 100644 --- a/client/gui/implementations/GuiInterface.java +++ b/client/gui/implementations/GuiInterface.java @@ -24,13 +24,13 @@ public class GuiInterface extends AEBaseGui @Override public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY) { - fontRenderer.drawString( GuiText.Interface.getLocal(), 8, 6, 4210752 ); + fontRendererObj.drawString( GuiText.Interface.getLocal(), 8, 6, 4210752 ); - fontRenderer.drawString( GuiText.Config.getLocal(), 18, 6 + 11 + 7, 4210752 ); - fontRenderer.drawString( GuiText.StoredItems.getLocal(), 18, 6 + 60 + 7, 4210752 ); - fontRenderer.drawString( GuiText.Patterns.getLocal(), 8, 6 + 73 + 7, 4210752 ); + fontRendererObj.drawString( GuiText.Config.getLocal(), 18, 6 + 11 + 7, 4210752 ); + fontRendererObj.drawString( GuiText.StoredItems.getLocal(), 18, 6 + 60 + 7, 4210752 ); + fontRendererObj.drawString( GuiText.Patterns.getLocal(), 8, 6 + 73 + 7, 4210752 ); - fontRenderer.drawString( GuiText.inventory.getLocal(), 8, ySize - 96 + 3, 4210752 ); + fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, ySize - 96 + 3, 4210752 ); } } diff --git a/client/gui/implementations/GuiLevelEmitter.java b/client/gui/implementations/GuiLevelEmitter.java index f1983611..98638783 100644 --- a/client/gui/implementations/GuiLevelEmitter.java +++ b/client/gui/implementations/GuiLevelEmitter.java @@ -13,9 +13,9 @@ import appeng.client.gui.widgets.GuiImgButton; import appeng.container.implementations.ContainerLevelEmitter; import appeng.core.AELog; import appeng.core.localization.GuiText; +import appeng.core.sync.network.NetworkHandler; import appeng.core.sync.packets.PacketValueConfig; import appeng.parts.automation.PartLevelEmitter; -import cpw.mods.fml.common.network.PacketDispatcher; public class GuiLevelEmitter extends GuiUpgradeable { @@ -34,7 +34,7 @@ public class GuiLevelEmitter extends GuiUpgradeable { super.initGui(); - level = new GuiTextField( this.fontRenderer, this.guiLeft + 44, this.guiTop + 43, 59, this.fontRenderer.FONT_HEIGHT ); + level = new GuiTextField( fontRendererObj, this.guiLeft + 44, this.guiTop + 43, 59, fontRendererObj.FONT_HEIGHT ); level.setEnableBackgroundDrawing( false ); level.setMaxStringLength( 16 ); level.setTextColor( 0xFFFFFF ); @@ -112,7 +112,7 @@ public class GuiLevelEmitter extends GuiUpgradeable level.setText( Out = Long.toString( result ) ); - PacketDispatcher.sendPacketToServer( (new PacketValueConfig( "LevelEmitter.Value", Out )).getPacket() ); + NetworkHandler.instance.sendToServer( new PacketValueConfig( "LevelEmitter.Value", Out ) ); } catch (IOException e) { @@ -149,7 +149,7 @@ public class GuiLevelEmitter extends GuiUpgradeable if ( Out.length() == 0 ) Out = "0"; - PacketDispatcher.sendPacketToServer( (new PacketValueConfig( "LevelEmitter.Value", Out )).getPacket() ); + NetworkHandler.instance.sendToServer( new PacketValueConfig( "LevelEmitter.Value", Out ) ); } catch (IOException e) { diff --git a/client/gui/implementations/GuiMEMonitorable.java b/client/gui/implementations/GuiMEMonitorable.java index ddcb42f7..7ad084ea 100644 --- a/client/gui/implementations/GuiMEMonitorable.java +++ b/client/gui/implementations/GuiMEMonitorable.java @@ -124,7 +124,7 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource buttonList.add( new GuiImgButton( this.guiLeft - 18, offset, Settings.SORT_DIRECTION, Configuration.instance.settings .getSetting( Settings.SORT_DIRECTION ) ) ); - searchField = new GuiTextField( this.fontRenderer, this.guiLeft + Math.max( 82, xoffset ), this.guiTop + 6, 89, this.fontRenderer.FONT_HEIGHT ); + searchField = new GuiTextField( fontRendererObj, this.guiLeft + Math.max( 82, xoffset ), this.guiTop + 6, 89, fontRendererObj.FONT_HEIGHT ); searchField.setEnableBackgroundDrawing( false ); searchField.setMaxStringLength( 25 ); searchField.setTextColor( 0xFFFFFF ); @@ -201,8 +201,8 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource @Override public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY) { - fontRenderer.drawString( myName.getLocal(), 8, 6, 4210752 ); - fontRenderer.drawString( GuiText.inventory.getLocal(), 8, ySize - 96 + 3, 4210752 ); + fontRendererObj.drawString( myName.getLocal(), 8, 6, 4210752 ); + fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, ySize - 96 + 3, 4210752 ); } @Override diff --git a/client/gui/implementations/GuiNetworkStatus.java b/client/gui/implementations/GuiNetworkStatus.java index 07fae3e5..054c4ed1 100644 --- a/client/gui/implementations/GuiNetworkStatus.java +++ b/client/gui/implementations/GuiNetworkStatus.java @@ -108,10 +108,10 @@ public class GuiNetworkStatus extends AEBaseGui implements ISortSource { ContainerNetworkStatus ns = (ContainerNetworkStatus) inventorySlots; - fontRenderer.drawString( GuiText.NetworkDetails.getLocal(), 8, 6, 4210752 ); + fontRendererObj.drawString( GuiText.NetworkDetails.getLocal(), 8, 6, 4210752 ); - fontRenderer.drawString( GuiText.PowerInputRate.getLocal() + ": " + formatPowerLong( ns.avgAddition ), 8, 16, 4210752 ); - fontRenderer.drawString( GuiText.PowerUsageRate.getLocal() + ": " + formatPowerLong( ns.powerUsage ), 8, 26, 4210752 ); + fontRendererObj.drawString( GuiText.PowerInputRate.getLocal() + ": " + formatPowerLong( ns.avgAddition ), 8, 16, 4210752 ); + fontRendererObj.drawString( GuiText.PowerUsageRate.getLocal() + ": " + formatPowerLong( ns.powerUsage ), 8, 26, 4210752 ); int sectionLength = 30; @@ -138,8 +138,8 @@ public class GuiNetworkStatus extends AEBaseGui implements ISortSource if ( refStack.getStackSize() >= 10000 ) str = Long.toString( refStack.getStackSize() / 1000 ) + StatCollector.translateToLocal( "AppEng.Sizes.1000" ); - int w = fontRenderer.getStringWidth( str ); - fontRenderer.drawString( str, (int) ((x * sectionLength + xo + sectionLength - 19 - ((float) w * 0.5)) * 2), (int) ((y * 18 + yo + 6) * 2), + int w = fontRendererObj.getStringWidth( str ); + fontRendererObj.drawString( str, (int) ((x * sectionLength + xo + sectionLength - 19 - ((float) w * 0.5)) * 2), (int) ((y * 18 + yo + 6) * 2), 4210752 ); GL11.glPopMatrix(); @@ -216,7 +216,6 @@ public class GuiNetworkStatus extends AEBaseGui implements ISortSource } // Vanillia version... - @Override protected void drawItemStackTooltip(ItemStack stack, int x, int y) { Slot s = getSlot( x, y ); @@ -246,7 +245,7 @@ public class GuiNetworkStatus extends AEBaseGui implements ISortSource drawTooltip( x, y, 0, join( currenttip, "\n" ) ); } } - super.drawItemStackTooltip( stack, x, y ); + // super.drawItemStackTooltip( stack, x, y ); } @Override diff --git a/client/gui/implementations/GuiNetworkTool.java b/client/gui/implementations/GuiNetworkTool.java index 3de51db4..3bf3025f 100644 --- a/client/gui/implementations/GuiNetworkTool.java +++ b/client/gui/implementations/GuiNetworkTool.java @@ -24,8 +24,8 @@ public class GuiNetworkTool extends AEBaseGui @Override public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY) { - fontRenderer.drawString( GuiText.NetworkTool.getLocal(), 8, 6, 4210752 ); - fontRenderer.drawString( GuiText.inventory.getLocal(), 8, ySize - 96 + 3, 4210752 ); + fontRendererObj.drawString( GuiText.NetworkTool.getLocal(), 8, 6, 4210752 ); + fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, ySize - 96 + 3, 4210752 ); } } diff --git a/client/gui/implementations/GuiPriority.java b/client/gui/implementations/GuiPriority.java index 79042ae6..27694052 100644 --- a/client/gui/implementations/GuiPriority.java +++ b/client/gui/implementations/GuiPriority.java @@ -14,13 +14,13 @@ import appeng.container.implementations.ContainerPriority; import appeng.core.AELog; import appeng.core.localization.GuiText; import appeng.core.sync.GuiBridge; +import appeng.core.sync.network.NetworkHandler; import appeng.core.sync.packets.PacketSwitchGuis; import appeng.core.sync.packets.PacketValueConfig; import appeng.helpers.IPriorityHost; import appeng.parts.misc.PartStorageBus; import appeng.tile.storage.TileChest; import appeng.tile.storage.TileDrive; -import cpw.mods.fml.common.network.PacketDispatcher; public class GuiPriority extends AEBaseGui { @@ -74,9 +74,9 @@ public class GuiPriority extends AEBaseGui } if ( OriginalGui != null ) - buttonList.add( originalGuiBtn = new GuiTabButton( this.guiLeft + 154, this.guiTop, myIcon, myIcon.getDisplayName(), itemRenderer ) ); + buttonList.add( originalGuiBtn = new GuiTabButton( this.guiLeft + 154, this.guiTop, myIcon, myIcon.getDisplayName(), itemRender ) ); - priority = new GuiTextField( this.fontRenderer, this.guiLeft + 62, this.guiTop + 57, 59, this.fontRenderer.FONT_HEIGHT ); + priority = new GuiTextField( fontRendererObj, this.guiLeft + 62, this.guiTop + 57, 59, fontRendererObj.FONT_HEIGHT ); priority.setEnableBackgroundDrawing( false ); priority.setMaxStringLength( 16 ); priority.setTextColor( 0xFFFFFF ); @@ -94,7 +94,7 @@ public class GuiPriority extends AEBaseGui { try { - PacketDispatcher.sendPacketToServer( (new PacketSwitchGuis( OriginalGui )).getPacket() ); + NetworkHandler.instance.sendToServer( new PacketSwitchGuis( OriginalGui ) ); } catch (IOException e) { @@ -144,7 +144,7 @@ public class GuiPriority extends AEBaseGui priority.setText( Out = Long.toString( result ) ); - PacketDispatcher.sendPacketToServer( (new PacketValueConfig( "PriorityHost.Priority", Out )).getPacket() ); + NetworkHandler.instance.sendToServer( new PacketValueConfig( "PriorityHost.Priority", Out ) ); } catch (IOException e) { @@ -157,7 +157,8 @@ public class GuiPriority extends AEBaseGui { if ( !this.checkHotbarKeys( key ) ) { - if ( (key == 211 || key == 205 || key == 203 || key == 14 || character == '-' || Character.isDigit( character )) && priority.textboxKeyTyped( character, key ) ) + if ( (key == 211 || key == 205 || key == 203 || key == 14 || character == '-' || Character.isDigit( character )) + && priority.textboxKeyTyped( character, key ) ) { try { @@ -176,7 +177,7 @@ public class GuiPriority extends AEBaseGui if ( Out.length() == 0 ) Out = "0"; - PacketDispatcher.sendPacketToServer( (new PacketValueConfig( "PriorityHost.Priority", Out )).getPacket() ); + NetworkHandler.instance.sendToServer( new PacketValueConfig( "PriorityHost.Priority", Out ) ); } catch (IOException e) { @@ -207,6 +208,6 @@ public class GuiPriority extends AEBaseGui @Override public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY) { - fontRenderer.drawString( GuiText.Priority.getLocal(), 8, 6, 4210752 ); + fontRendererObj.drawString( GuiText.Priority.getLocal(), 8, 6, 4210752 ); } } diff --git a/client/gui/implementations/GuiQNB.java b/client/gui/implementations/GuiQNB.java index f97d3407..bd90dda3 100644 --- a/client/gui/implementations/GuiQNB.java +++ b/client/gui/implementations/GuiQNB.java @@ -24,8 +24,8 @@ public class GuiQNB extends AEBaseGui @Override public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY) { - fontRenderer.drawString( GuiText.QuantumLinkChamber.getLocal(), 8, 6, 4210752 ); - fontRenderer.drawString( GuiText.inventory.getLocal(), 8, ySize - 96 + 3, 4210752 ); + fontRendererObj.drawString( GuiText.QuantumLinkChamber.getLocal(), 8, 6, 4210752 ); + fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, ySize - 96 + 3, 4210752 ); } } diff --git a/client/gui/implementations/GuiSecurity.java b/client/gui/implementations/GuiSecurity.java index 0582ab48..c4476b6c 100644 --- a/client/gui/implementations/GuiSecurity.java +++ b/client/gui/implementations/GuiSecurity.java @@ -10,8 +10,8 @@ import appeng.client.gui.widgets.GuiToggleButton; import appeng.container.implementations.ContainerSecurity; import appeng.core.AELog; import appeng.core.localization.GuiText; +import appeng.core.sync.network.NetworkHandler; import appeng.core.sync.packets.PacketValueConfig; -import cpw.mods.fml.common.network.PacketDispatcher; public class GuiSecurity extends GuiMEMonitorable { @@ -31,11 +31,11 @@ public class GuiSecurity extends GuiMEMonitorable super.initGui(); int top = this.guiTop + this.ySize - 116; - buttonList.add( inject = new GuiToggleButton( this.guiLeft + 56 + 18 * 0, top, 11 * 16 + 0, 12 * 16 + 0, SecurityPermissions.INJECT.getUnlocalizedName(), - SecurityPermissions.INJECT.getUnlocalizedTip() ) ); + buttonList.add( inject = new GuiToggleButton( this.guiLeft + 56 + 18 * 0, top, 11 * 16 + 0, 12 * 16 + 0, SecurityPermissions.INJECT + .getUnlocalizedName(), SecurityPermissions.INJECT.getUnlocalizedTip() ) ); - buttonList.add( extract = new GuiToggleButton( this.guiLeft + 56 + 18 * 1, top, 11 * 16 + 1, 12 * 16 + 1, SecurityPermissions.EXTRACT.getUnlocalizedName(), - SecurityPermissions.EXTRACT.getUnlocalizedTip() ) ); + buttonList.add( extract = new GuiToggleButton( this.guiLeft + 56 + 18 * 1, top, 11 * 16 + 1, 12 * 16 + 1, SecurityPermissions.EXTRACT + .getUnlocalizedName(), SecurityPermissions.EXTRACT.getUnlocalizedTip() ) ); buttonList.add( craft = new GuiToggleButton( this.guiLeft + 56 + 18 * 2, top, 11 * 16 + 2, 12 * 16 + 2, SecurityPermissions.CRAFT.getUnlocalizedName(), SecurityPermissions.CRAFT.getUnlocalizedTip() ) ); @@ -43,8 +43,8 @@ public class GuiSecurity extends GuiMEMonitorable buttonList.add( build = new GuiToggleButton( this.guiLeft + 56 + 18 * 3, top, 11 * 16 + 3, 12 * 16 + 3, SecurityPermissions.BUILD.getUnlocalizedName(), SecurityPermissions.BUILD.getUnlocalizedTip() ) ); - buttonList.add( security = new GuiToggleButton( this.guiLeft + 56 + 18 * 4, top, 11 * 16 + 4, 12 * 16 + 4, SecurityPermissions.SECURITY.getUnlocalizedName(), - SecurityPermissions.SECURITY.getUnlocalizedTip() ) ); + buttonList.add( security = new GuiToggleButton( this.guiLeft + 56 + 18 * 4, top, 11 * 16 + 4, 12 * 16 + 4, SecurityPermissions.SECURITY + .getUnlocalizedName(), SecurityPermissions.SECURITY.getUnlocalizedTip() ) ); } protected void actionPerformed(net.minecraft.client.gui.GuiButton btn) @@ -68,7 +68,7 @@ public class GuiSecurity extends GuiMEMonitorable { try { - PacketDispatcher.sendPacketToServer( (new PacketValueConfig( "TileSecurity.ToggleOption", toggleSetting.name() )).getPacket() ); + NetworkHandler.instance.sendToServer( new PacketValueConfig( "TileSecurity.ToggleOption", toggleSetting.name() ) ); } catch (IOException e) { @@ -95,7 +95,7 @@ public class GuiSecurity extends GuiMEMonitorable public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY) { super.drawFG( offsetX, offsetY, mouseX, mouseY ); - fontRenderer.drawString( GuiText.SecurityCardEditor.getLocal(), 8, ySize - 96 + 1 - reservedSpace, 4210752 ); + fontRendererObj.drawString( GuiText.SecurityCardEditor.getLocal(), 8, ySize - 96 + 1 - reservedSpace, 4210752 ); } @Override diff --git a/client/gui/implementations/GuiSpatialIOPort.java b/client/gui/implementations/GuiSpatialIOPort.java index 71f35ee4..f5313b96 100644 --- a/client/gui/implementations/GuiSpatialIOPort.java +++ b/client/gui/implementations/GuiSpatialIOPort.java @@ -24,8 +24,8 @@ public class GuiSpatialIOPort extends AEBaseGui @Override public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY) { - fontRenderer.drawString( GuiText.SpatialIOPort.getLocal(), 8, 6, 4210752 ); - fontRenderer.drawString( GuiText.inventory.getLocal(), 8, ySize - 96 + 3, 4210752 ); + fontRendererObj.drawString( GuiText.SpatialIOPort.getLocal(), 8, 6, 4210752 ); + fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, ySize - 96 + 3, 4210752 ); } } diff --git a/client/gui/implementations/GuiStorageBus.java b/client/gui/implementations/GuiStorageBus.java index ab2b550d..ee50eb84 100644 --- a/client/gui/implementations/GuiStorageBus.java +++ b/client/gui/implementations/GuiStorageBus.java @@ -16,10 +16,10 @@ import appeng.container.implementations.ContainerStorageBus; import appeng.core.AELog; import appeng.core.localization.GuiText; import appeng.core.sync.GuiBridge; +import appeng.core.sync.network.NetworkHandler; import appeng.core.sync.packets.PacketConfigButton; import appeng.core.sync.packets.PacketSwitchGuis; import appeng.parts.misc.PartStorageBus; -import cpw.mods.fml.common.network.PacketDispatcher; public class GuiStorageBus extends GuiUpgradeable { @@ -41,8 +41,8 @@ public class GuiStorageBus extends GuiUpgradeable @Override public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY) { - fontRenderer.drawString( GuiText.StorageBus.getLocal(), 8, 6, 4210752 ); - fontRenderer.drawString( GuiText.inventory.getLocal(), 8, ySize - 96 + 3, 4210752 ); + fontRendererObj.drawString( GuiText.StorageBus.getLocal(), 8, 6, 4210752 ); + fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, ySize - 96 + 3, 4210752 ); if ( fuzzyMode != null ) fuzzyMode.set( cvb.fzMode ); @@ -57,7 +57,7 @@ public class GuiStorageBus extends GuiUpgradeable fuzzyMode = new GuiImgButton( this.guiLeft - 18, guiTop + 28, Settings.FUZZY_MODE, FuzzyMode.IGNORE_ALL ); rwMode = new GuiImgButton( this.guiLeft - 18, guiTop + 8, Settings.ACCESS, AccessRestriction.READ_WRITE ); - buttonList.add( priority = new GuiTabButton( this.guiLeft + 154, this.guiTop, 2 + 4 * 16, GuiText.Priority.getLocal(), itemRenderer ) ); + buttonList.add( priority = new GuiTabButton( this.guiLeft + 154, this.guiTop, 2 + 4 * 16, GuiText.Priority.getLocal(), itemRender ) ); buttonList.add( fuzzyMode ); buttonList.add( rwMode ); @@ -74,7 +74,7 @@ public class GuiStorageBus extends GuiUpgradeable { try { - PacketDispatcher.sendPacketToServer( (new PacketSwitchGuis( GuiBridge.GUI_PRIORITY )).getPacket() ); + NetworkHandler.instance.sendToServer( new PacketSwitchGuis( GuiBridge.GUI_PRIORITY ) ); } catch (IOException e) { @@ -84,10 +84,10 @@ public class GuiStorageBus extends GuiUpgradeable try { if ( btn == fuzzyMode ) - PacketDispatcher.sendPacketToServer( (new PacketConfigButton( fuzzyMode.getSetting(), backwards )).getPacket() ); + NetworkHandler.instance.sendToServer( new PacketConfigButton( fuzzyMode.getSetting(), backwards ) ); if ( btn == rwMode ) - PacketDispatcher.sendPacketToServer( (new PacketConfigButton( rwMode.getSetting(), backwards )).getPacket() ); + NetworkHandler.instance.sendToServer( new PacketConfigButton( rwMode.getSetting(), backwards ) ); } catch (IOException e) { diff --git a/client/gui/implementations/GuiUpgradeable.java b/client/gui/implementations/GuiUpgradeable.java index 2d4d66db..6963f6df 100644 --- a/client/gui/implementations/GuiUpgradeable.java +++ b/client/gui/implementations/GuiUpgradeable.java @@ -17,9 +17,9 @@ import appeng.client.gui.widgets.GuiImgButton; import appeng.container.implementations.ContainerUpgradeable; import appeng.core.AELog; import appeng.core.localization.GuiText; +import appeng.core.sync.network.NetworkHandler; import appeng.core.sync.packets.PacketConfigButton; import appeng.parts.automation.PartImportBus; -import cpw.mods.fml.common.network.PacketDispatcher; public class GuiUpgradeable extends AEBaseGui { @@ -69,10 +69,10 @@ public class GuiUpgradeable extends AEBaseGui try { if ( btn == redstoneMode ) - PacketDispatcher.sendPacketToServer( (new PacketConfigButton( redstoneMode.getSetting(), backwards )).getPacket() ); + NetworkHandler.instance.sendToServer( new PacketConfigButton( redstoneMode.getSetting(), backwards ) ); if ( btn == fuzzyMode ) - PacketDispatcher.sendPacketToServer( (new PacketConfigButton( fuzzyMode.getSetting(), backwards )).getPacket() ); + NetworkHandler.instance.sendToServer( new PacketConfigButton( fuzzyMode.getSetting(), backwards ) ); } catch (IOException e) @@ -120,8 +120,8 @@ public class GuiUpgradeable extends AEBaseGui @Override public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY) { - fontRenderer.drawString( getName().getLocal(), 8, 6, 4210752 ); - fontRenderer.drawString( GuiText.inventory.getLocal(), 8, ySize - 96 + 3, 4210752 ); + fontRendererObj.drawString( getName().getLocal(), 8, 6, 4210752 ); + fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, ySize - 96 + 3, 4210752 ); if ( redstoneMode != null ) redstoneMode.set( cvb.rsMode ); diff --git a/client/gui/implementations/GuiVibrationChamber.java b/client/gui/implementations/GuiVibrationChamber.java index 904649aa..4c75340d 100644 --- a/client/gui/implementations/GuiVibrationChamber.java +++ b/client/gui/implementations/GuiVibrationChamber.java @@ -44,8 +44,8 @@ public class GuiVibrationChamber extends AEBaseGui @Override public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY) { - fontRenderer.drawString( GuiText.VibrationChamber.getLocal(), 8, 6, 4210752 ); - fontRenderer.drawString( GuiText.inventory.getLocal(), 8, ySize - 96 + 3, 4210752 ); + fontRendererObj.drawString( GuiText.VibrationChamber.getLocal(), 8, 6, 4210752 ); + fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, ySize - 96 + 3, 4210752 ); int k = 25; int l = -15; diff --git a/client/gui/implementations/GuiWireless.java b/client/gui/implementations/GuiWireless.java index 098ab4f0..fabbf956 100644 --- a/client/gui/implementations/GuiWireless.java +++ b/client/gui/implementations/GuiWireless.java @@ -24,8 +24,8 @@ public class GuiWireless extends AEBaseGui @Override public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY) { - fontRenderer.drawString( GuiText.Wireless.getLocal(), 8, 6, 4210752 ); - fontRenderer.drawString( GuiText.inventory.getLocal(), 8, ySize - 96 + 3, 4210752 ); + fontRendererObj.drawString( GuiText.Wireless.getLocal(), 8, 6, 4210752 ); + fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, ySize - 96 + 3, 4210752 ); } } diff --git a/client/gui/widgets/GuiImgButton.java b/client/gui/widgets/GuiImgButton.java index fe981493..7c8206b4 100644 --- a/client/gui/widgets/GuiImgButton.java +++ b/client/gui/widgets/GuiImgButton.java @@ -72,18 +72,18 @@ public class GuiImgButton extends GuiButton implements ITooltip static private Map Appearances; - private void registerApp(int icon, Settings setting, Enum val, ButtonToolTips title, Object hint) + private void registerApp(int IIcon, Settings setting, Enum val, ButtonToolTips title, Object hint) { BtnAppearance a = new BtnAppearance(); a.DisplayName = title.getUnlocalized(); a.DisplayValue = (String) (hint instanceof String ? hint : ((ButtonToolTips) hint).getUnlocalized()); - a.index = icon; + a.index = IIcon; Appearances.put( new EnumPair( setting, val ), a ); } public void setVisibility(boolean vis) { - drawButton = vis; + visible = vis; enabled = vis; } @@ -174,13 +174,13 @@ public class GuiImgButton extends GuiButton implements ITooltip @Override public boolean isVisible() { - return drawButton; + return visible; } @Override public void drawButton(Minecraft par1Minecraft, int par2, int par3) { - if ( this.drawButton ) + if ( this.visible ) { int iconIndex = getIconIndex(); @@ -195,7 +195,8 @@ public class GuiImgButton extends GuiButton implements ITooltip GL11.glColor4f( 1.0f, 1.0f, 1.0f, 1.0f ); par1Minecraft.renderEngine.bindTexture( ExtraTextures.GuiTexture( "guis/states.png" ) ); - this.field_82253_i = par2 >= this.xPosition && par3 >= this.yPosition && par2 < this.xPosition + this.width && par3 < this.yPosition + this.height; + this.field_146123_n = par2 >= this.xPosition && par3 >= this.yPosition && par2 < this.xPosition + this.width + && par3 < this.yPosition + this.height; int uv_y = (int) Math.floor( iconIndex / 16 ); int uv_x = iconIndex - uv_y * 16; @@ -210,7 +211,8 @@ public class GuiImgButton extends GuiButton implements ITooltip { GL11.glColor4f( 1.0f, 1.0f, 1.0f, 1.0f ); par1Minecraft.renderEngine.bindTexture( ExtraTextures.GuiTexture( "guis/states.png" ) ); - this.field_82253_i = par2 >= this.xPosition && par3 >= this.yPosition && par2 < this.xPosition + this.width && par3 < this.yPosition + this.height; + this.field_146123_n = par2 >= this.xPosition && par3 >= this.yPosition && par2 < this.xPosition + this.width + && par3 < this.yPosition + this.height; int uv_y = (int) Math.floor( iconIndex / 16 ); int uv_x = iconIndex - uv_y * 16; diff --git a/client/gui/widgets/GuiProgressBar.java b/client/gui/widgets/GuiProgressBar.java index 8dcf9cee..92410e21 100644 --- a/client/gui/widgets/GuiProgressBar.java +++ b/client/gui/widgets/GuiProgressBar.java @@ -43,7 +43,7 @@ public class GuiProgressBar extends GuiButton implements ITooltip @Override public void drawButton(Minecraft par1Minecraft, int par2, int par3) { - if ( this.drawButton ) + if ( this.visible ) { par1Minecraft.getTextureManager().bindTexture( texture ); diff --git a/client/gui/widgets/GuiTabButton.java b/client/gui/widgets/GuiTabButton.java index ad90f346..03b39081 100644 --- a/client/gui/widgets/GuiTabButton.java +++ b/client/gui/widgets/GuiTabButton.java @@ -24,7 +24,7 @@ public class GuiTabButton extends GuiButton implements ITooltip public void setVisibility(boolean vis) { - drawButton = vis; + visible = vis; enabled = vis; } @@ -53,17 +53,17 @@ public class GuiTabButton extends GuiButton implements ITooltip @Override public boolean isVisible() { - return drawButton; + return visible; } @Override public void drawButton(Minecraft par1Minecraft, int par2, int par3) { - if ( this.drawButton ) + if ( this.visible ) { GL11.glColor4f( 1.0f, 1.0f, 1.0f, 1.0f ); par1Minecraft.renderEngine.bindTexture( ExtraTextures.GuiTexture( "guis/states.png" ) ); - this.field_82253_i = par2 >= this.xPosition && par3 >= this.yPosition && par2 < this.xPosition + this.width && par3 < this.yPosition + this.height; + this.field_146123_n = par2 >= this.xPosition && par3 >= this.yPosition && par2 < this.xPosition + this.width && par3 < this.yPosition + this.height; int uv_y = (int) Math.floor( 13 / 16 ); int uv_x = 13 - uv_y * 16; diff --git a/client/gui/widgets/GuiToggleButton.java b/client/gui/widgets/GuiToggleButton.java index a2b4d110..eea11aa5 100644 --- a/client/gui/widgets/GuiToggleButton.java +++ b/client/gui/widgets/GuiToggleButton.java @@ -26,7 +26,7 @@ public class GuiToggleButton extends GuiButton implements ITooltip public void setVisibility(boolean vis) { - drawButton = vis; + visible = vis; enabled = vis; } @@ -45,19 +45,19 @@ public class GuiToggleButton extends GuiButton implements ITooltip @Override public boolean isVisible() { - return drawButton; + return visible; } @Override public void drawButton(Minecraft par1Minecraft, int par2, int par3) { - if ( this.drawButton ) + if ( this.visible ) { int iconIndex = getIconIndex(); GL11.glColor4f( 1.0f, 1.0f, 1.0f, 1.0f ); par1Minecraft.renderEngine.bindTexture( ExtraTextures.GuiTexture( "guis/states.png" ) ); - this.field_82253_i = par2 >= this.xPosition && par3 >= this.yPosition && par2 < this.xPosition + this.width && par3 < this.yPosition + this.height; + this.field_146123_n = par2 >= this.xPosition && par3 >= this.yPosition && par2 < this.xPosition + this.width && par3 < this.yPosition + this.height; int uv_y = (int) Math.floor( iconIndex / 16 ); int uv_x = iconIndex - uv_y * 16; diff --git a/client/render/BaseBlockRender.java b/client/render/BaseBlockRender.java index 8f513250..9c4a178b 100644 --- a/client/render/BaseBlockRender.java +++ b/client/render/BaseBlockRender.java @@ -14,9 +14,9 @@ import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.entity.item.EntityItem; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.Icon; +import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import org.lwjgl.BufferUtils; import org.lwjgl.opengl.GL11; @@ -248,9 +248,9 @@ public class BaseBlockRender return MAX_DISTANCE; } - public Icon firstNotNull(Icon... s) + public IIcon firstNotNull(IIcon... s) { - for (Icon o : s) + for (IIcon o : s) if ( o != null ) return o; return ExtraTextures.getMissing(); @@ -258,7 +258,7 @@ public class BaseBlockRender public void renderInvBlock(EnumSet sides, AEBaseBlock block, Tessellator tess, int color, RenderBlocks renderer) { - if ( tess.isDrawing ) + if ( Platform.isDrawing( tess ) ) tess.draw(); if ( sides.contains( ForgeDirection.DOWN ) ) @@ -517,7 +517,7 @@ public class BaseBlockRender @SideOnly(Side.CLIENT) private void renderFace(Tessellator tess, double offsetX, double offsetY, double offsetZ, double ax, double ay, double az, double bx, double by, double bz, - double ua, double ub, double va, double vb, Icon ico, boolean flip) + double ua, double ub, double va, double vb, IIcon ico, boolean flip) { if ( flip ) { @@ -544,7 +544,7 @@ public class BaseBlockRender } @SideOnly(Side.CLIENT) - protected void renderCutoutFace(Block block, Icon ico, int x, int y, int z, RenderBlocks renderer, ForgeDirection orientation, float edgeThickness) + protected void renderCutoutFace(Block block, IIcon ico, int x, int y, int z, RenderBlocks renderer, ForgeDirection orientation, float edgeThickness) { Tessellator tess = Tessellator.instance; @@ -631,7 +631,7 @@ public class BaseBlockRender } @SideOnly(Side.CLIENT) - protected void renderFace(int x, int y, int z, Block block, Icon ico, RenderBlocks renderer, ForgeDirection orientation) + protected void renderFace(int x, int y, int z, Block block, IIcon ico, RenderBlocks renderer, ForgeDirection orientation) { switch (orientation) { @@ -729,7 +729,7 @@ public class BaseBlockRender { if ( itemstack != null ) { - EntityItem entityitem = new EntityItem( par1EntityItemFrame.worldObj, 0.0D, 0.0D, 0.0D, itemstack ); + EntityItem entityitem = new EntityItem( par1EntityItemFrame.getWorldObj(), 0.0D, 0.0D, 0.0D, itemstack ); entityitem.getEntityItem().stackSize = 1; // set all this stuff and then do shit? meh? diff --git a/client/render/BlockRenderInfo.java b/client/render/BlockRenderInfo.java index c93399a8..da8bf174 100644 --- a/client/render/BlockRenderInfo.java +++ b/client/render/BlockRenderInfo.java @@ -2,8 +2,8 @@ package appeng.client.render; import appeng.client.texture.FlipableIcon; import appeng.client.texture.TmpFlipableIcon; -import net.minecraft.util.Icon; -import net.minecraftforge.common.ForgeDirection; +import net.minecraft.util.IIcon; +import net.minecraftforge.common.util.ForgeDirection; public class BlockRenderInfo { @@ -41,24 +41,24 @@ public class BlockRenderInfo } - public void setTemporaryRenderIcon(Icon icon) + public void setTemporaryRenderIcon(IIcon IIcon) { - if ( icon == null ) + if ( IIcon == null ) useTmp = false; else { useTmp = true; - tmpTopIcon.setOriginal( icon ); - tmpBottomIcon.setOriginal( icon ); - tmpSouthIcon.setOriginal( icon ); - tmpNorthIcon.setOriginal( icon ); - tmpEastIcon.setOriginal( icon ); - tmpWestIcon.setOriginal( icon ); + tmpTopIcon.setOriginal( IIcon ); + tmpBottomIcon.setOriginal( IIcon ); + tmpSouthIcon.setOriginal( IIcon ); + tmpNorthIcon.setOriginal( IIcon ); + tmpEastIcon.setOriginal( IIcon ); + tmpWestIcon.setOriginal( IIcon ); } } - public void setTemporaryRenderIcons(Icon nTopIcon, Icon nBottomIcon, Icon nSouthIcon, Icon nNorthIcon, Icon nEastIcon, - Icon nWestIcon) + public void setTemporaryRenderIcons(IIcon nTopIcon, IIcon nBottomIcon, IIcon nSouthIcon, IIcon nNorthIcon, IIcon nEastIcon, + IIcon nWestIcon) { tmpTopIcon.setOriginal( nTopIcon == null ? getTexture( ForgeDirection.UP ) : nTopIcon ); tmpBottomIcon.setOriginal( nBottomIcon == null ? getTexture( ForgeDirection.DOWN ) : nBottomIcon ); diff --git a/client/render/BusRenderHelper.java b/client/render/BusRenderHelper.java index c4ac4a69..8d09f35f 100644 --- a/client/render/BusRenderHelper.java +++ b/client/render/BusRenderHelper.java @@ -5,8 +5,8 @@ import java.util.EnumSet; import net.minecraft.block.Block; import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.client.renderer.Tessellator; -import net.minecraft.util.Icon; -import net.minecraftforge.common.ForgeDirection; +import net.minecraft.util.IIcon; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.AEApi; import appeng.api.parts.IPart; import appeng.api.parts.IPartCollsionHelper; @@ -149,15 +149,15 @@ public class BusRenderHelper implements IPartRenderHelper } @Override - public void setTexture(Icon ico) + public void setTexture(IIcon ico) { blk.getRendererInstance().setTemporaryRenderIcon( ico ); } @Override - public void setTexture(Icon Down, Icon Up, Icon North, Icon South, Icon West, Icon East) + public void setTexture(IIcon Down, IIcon Up, IIcon North, IIcon South, IIcon West, IIcon East) { - Icon list[] = new Icon[6]; + IIcon list[] = new IIcon[6]; list[0] = Down; list[1] = Up; @@ -215,10 +215,10 @@ public class BusRenderHelper implements IPartRenderHelper } @Override - public void renderInventoryFace(Icon icon, ForgeDirection face, RenderBlocks renderer) + public void renderInventoryFace(IIcon IIcon, ForgeDirection face, RenderBlocks renderer) { renderer.setRenderBounds( minX / 16.0, minY / 16.0, minZ / 16.0, maxX / 16.0, maxY / 16.0, maxZ / 16.0 ); - setTexture( icon ); + setTexture( IIcon ); bbr.renderInvBlock( EnumSet.of( face ), blk, Tessellator.instance, color, renderer ); } @@ -241,11 +241,7 @@ public class BusRenderHelper implements IPartRenderHelper bbr.renderBlockBounds( renderer, minX, minY, minZ, maxX, maxY, maxZ, ax, ay, az ); - int blkId = renderer.blockAccess.getBlockId( x, y, z ); - if ( Block.blocksList[blkId] == null ) - return; - - renderer.renderStandardBlock( blk, x, y, z ); + renderer.renderStandardBlock( renderer.blockAccess.getBlock( x, y, z ), x, y, z ); } @Override @@ -261,15 +257,11 @@ public class BusRenderHelper implements IPartRenderHelper public void renderBlockCurrentBounds(int x, int y, int z, RenderBlocks renderer) { - int blkId = renderer.blockAccess.getBlockId( x, y, z ); - if ( Block.blocksList[blkId] == null ) - return; - - renderer.renderStandardBlock( blk, x, y, z ); + renderer.renderStandardBlock( renderer.blockAccess.getBlock( x, y, z ), x, y, z ); } @Override - public void renderFaceCutout(int x, int y, int z, Icon ico, ForgeDirection face, float edgeThickness, RenderBlocks renderer) + public void renderFaceCutout(int x, int y, int z, IIcon ico, ForgeDirection face, float edgeThickness, RenderBlocks renderer) { switch (face) { @@ -301,7 +293,7 @@ public class BusRenderHelper implements IPartRenderHelper } @Override - public void renderFace(int x, int y, int z, Icon ico, ForgeDirection face, RenderBlocks renderer) + public void renderFace(int x, int y, int z, IIcon ico, ForgeDirection face, RenderBlocks renderer) { prepareBounds( renderer ); switch (face) diff --git a/client/render/BusRenderer.java b/client/render/BusRenderer.java index c53a24d6..e4940640 100644 --- a/client/render/BusRenderer.java +++ b/client/render/BusRenderer.java @@ -3,9 +3,10 @@ package appeng.client.render; import java.util.HashMap; import net.minecraft.client.renderer.Tessellator; +import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraftforge.client.IItemRenderer; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import org.lwjgl.opengl.GL11; @@ -29,7 +30,7 @@ public class BusRenderer implements IItemRenderer public IPart getRenderer(ItemStack is, IPartItem c) { - int id = (is.getItem().itemID << Platform.DEF_OFFSET) | is.getItemDamage(); + int id = (Item.getIdFromItem( is.getItem() ) << Platform.DEF_OFFSET) | is.getItemDamage(); IPart part = renderPart.get( id ); if ( part == null ) @@ -61,6 +62,11 @@ public class BusRenderer implements IItemRenderer return; GL11.glPushMatrix(); + GL11.glPushAttrib( GL11.GL_ALL_ATTRIB_BITS ); + GL11.glEnable( GL11.GL_ALPHA_TEST ); + GL11.glEnable( GL11.GL_DEPTH_TEST ); + GL11.glEnable( GL11.GL_BLEND ); + if ( type == ItemRenderType.ENTITY ) GL11.glTranslatef( -0.5f, -0.5f, -0.5f ); if ( type == ItemRenderType.INVENTORY ) @@ -96,6 +102,7 @@ public class BusRenderer implements IItemRenderer ip.renderInventory( BusRenderHelper.instance, renderer ); } + GL11.glPopAttrib(); GL11.glPopMatrix(); } } diff --git a/client/render/CableRenderHelper.java b/client/render/CableRenderHelper.java index 67a7d47a..02caf226 100644 --- a/client/render/CableRenderHelper.java +++ b/client/render/CableRenderHelper.java @@ -7,7 +7,7 @@ import java.util.List; import net.minecraft.client.Minecraft; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.parts.IFacadePart; import appeng.api.parts.IPart; import appeng.facade.FacadeContainer; diff --git a/client/render/ItemRenderer.java b/client/render/ItemRenderer.java index 6befdae3..f1977925 100644 --- a/client/render/ItemRenderer.java +++ b/client/render/ItemRenderer.java @@ -26,11 +26,19 @@ public class ItemRenderer implements IItemRenderer public void renderItem(ItemRenderType type, ItemStack item, Object... data) { GL11.glPushMatrix(); + GL11.glPushAttrib( GL11.GL_ALL_ATTRIB_BITS ); + GL11.glEnable( GL11.GL_ALPHA_TEST ); + GL11.glEnable( GL11.GL_DEPTH_TEST ); + GL11.glEnable( GL11.GL_BLEND ); + GL11.glColor4f( 1.0f, 1.0f, 1.0f, 1.0f ); + if ( type == ItemRenderType.ENTITY ) GL11.glTranslatef( -0.5f, -0.5f, -0.5f ); if ( type == ItemRenderType.INVENTORY ) GL11.glTranslatef( 0.0f, -0.1f, 0.0f ); WorldRender.instance.renderItemBlock( item ); + + GL11.glPopAttrib(); GL11.glPopMatrix(); } diff --git a/client/render/RenderBlocksWorkaround.java b/client/render/RenderBlocksWorkaround.java index a975bdd0..aa056c66 100644 --- a/client/render/RenderBlocksWorkaround.java +++ b/client/render/RenderBlocksWorkaround.java @@ -6,8 +6,8 @@ import java.util.EnumSet; import net.minecraft.block.Block; import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.client.renderer.Tessellator; -import net.minecraft.util.Icon; -import net.minecraftforge.common.ForgeDirection; +import net.minecraft.util.IIcon; +import net.minecraftforge.common.util.ForgeDirection; import appeng.core.AELog; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -19,12 +19,12 @@ public class RenderBlocksWorkaround extends RenderBlocks public boolean calculations = true; public EnumSet faces = EnumSet.allOf( ForgeDirection.class ); - private Icon rXPos = null; - private Icon rXNeg = null; - private Icon rYPos = null; - private Icon rYNeg = null; - private Icon rZPos = null; - private Icon rZNeg = null; + private IIcon rXPos = null; + private IIcon rXNeg = null; + private IIcon rYPos = null; + private IIcon rYNeg = null; + private IIcon rZPos = null; + private IIcon rZNeg = null; private boolean isAO = false; @@ -71,7 +71,7 @@ public class RenderBlocksWorkaround extends RenderBlocks } } - public void setTexture(Icon ico) + public void setTexture(IIcon ico) { rXPos = rXNeg = rYPos = rYNeg = rZPos = rZNeg = ico; } @@ -169,7 +169,7 @@ public class RenderBlocksWorkaround extends RenderBlocks } @Override - public void renderFaceXNeg(Block par1Block, double par2, double par4, double par6, Icon par8Icon) + public void renderFaceXNeg(Block par1Block, double par2, double par4, double par6, IIcon par8Icon) { if ( faces.contains( ForgeDirection.WEST ) ) { @@ -220,7 +220,7 @@ public class RenderBlocksWorkaround extends RenderBlocks } @Override - public void renderFaceXPos(Block par1Block, double par2, double par4, double par6, Icon par8Icon) + public void renderFaceXPos(Block par1Block, double par2, double par4, double par6, IIcon par8Icon) { if ( faces.contains( ForgeDirection.EAST ) ) { @@ -299,7 +299,7 @@ public class RenderBlocksWorkaround extends RenderBlocks } @Override - public void renderFaceYNeg(Block par1Block, double par2, double par4, double par6, Icon par8Icon) + public void renderFaceYNeg(Block par1Block, double par2, double par4, double par6, IIcon par8Icon) { if ( faces.contains( ForgeDirection.DOWN ) ) { @@ -350,7 +350,7 @@ public class RenderBlocksWorkaround extends RenderBlocks } @Override - public void renderFaceYPos(Block par1Block, double par2, double par4, double par6, Icon par8Icon) + public void renderFaceYPos(Block par1Block, double par2, double par4, double par6, IIcon par8Icon) { if ( faces.contains( ForgeDirection.UP ) ) { @@ -401,7 +401,7 @@ public class RenderBlocksWorkaround extends RenderBlocks } @Override - public void renderFaceZNeg(Block par1Block, double par2, double par4, double par6, Icon par8Icon) + public void renderFaceZNeg(Block par1Block, double par2, double par4, double par6, IIcon par8Icon) { if ( faces.contains( ForgeDirection.NORTH ) ) { @@ -452,7 +452,7 @@ public class RenderBlocksWorkaround extends RenderBlocks } @Override - public void renderFaceZPos(Block par1Block, double par2, double par4, double par6, Icon par8Icon) + public void renderFaceZPos(Block par1Block, double par2, double par4, double par6, IIcon par8Icon) { if ( faces.contains( ForgeDirection.SOUTH ) ) { diff --git a/client/render/TESRWrapper.java b/client/render/TESRWrapper.java index b6a11f27..d3f02f56 100644 --- a/client/render/TESRWrapper.java +++ b/client/render/TESRWrapper.java @@ -11,6 +11,7 @@ import org.lwjgl.opengl.GL11; import appeng.block.AEBaseBlock; import appeng.core.AELog; import appeng.tile.AEBaseTile; +import appeng.util.Platform; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -42,7 +43,7 @@ public class TESRWrapper extends TileEntitySpecialRenderer Tessellator tess = Tessellator.instance; - if ( tess.isDrawing ) + if ( Platform.isDrawing( tess ) ) return; try @@ -50,10 +51,10 @@ public class TESRWrapper extends TileEntitySpecialRenderer GL11.glPushMatrix(); GL11.glPushAttrib( GL11.GL_ALL_ATTRIB_BITS ); - rbinstance.blockAccess = te.worldObj; + rbinstance.blockAccess = te.getWorldObj(); blkRender.renderTile( (AEBaseBlock) b, (AEBaseTile) te, tess, x, y, z, f, rbinstance ); - if ( tess.isDrawing ) + if ( Platform.isDrawing( tess ) ) throw new RuntimeException( "Error durring rendering." ); GL11.glPopAttrib(); diff --git a/client/render/WorldRender.java b/client/render/WorldRender.java index 6bf683f8..85c5db77 100644 --- a/client/render/WorldRender.java +++ b/client/render/WorldRender.java @@ -45,7 +45,7 @@ public class WorldRender implements ISimpleBlockRenderingHandler } @Override - public boolean shouldRender3DInInventory() + public boolean shouldRender3DInInventory(int modelId) { return true; } @@ -58,7 +58,7 @@ public class WorldRender implements ISimpleBlockRenderingHandler public void renderItemBlock(ItemStack item) { - AEBaseBlock block = (AEBaseBlock) Block.blocksList[item.itemID]; + AEBaseBlock block = (AEBaseBlock) Block.getBlockFromItem( item.getItem() ); renderer.setRenderBoundsFromBlock( block ); getRender( block ).renderInventory( block, item, renderer ); } diff --git a/client/render/blocks/RenderBlockCharger.java b/client/render/blocks/RenderBlockCharger.java index 6b603ce1..efcb0d04 100644 --- a/client/render/blocks/RenderBlockCharger.java +++ b/client/render/blocks/RenderBlockCharger.java @@ -9,7 +9,7 @@ import net.minecraft.client.renderer.Tessellator; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import net.minecraft.world.IBlockAccess; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL12; @@ -123,15 +123,15 @@ public class RenderBlockCharger extends BaseBlockRender GL11.glScalef( 1.0f / 1.1f, 1.0f / 1.1f, 1.0f / 1.1f ); GL11.glScalef( 1.0f, 1.0f, 1.0f ); - int k = sis.itemID; - if ( sis.getItemSpriteNumber() == 0 && block != null && RenderBlocks.renderItemIn3d( Block.blocksList[k].getRenderType() ) ) + Block blk = Block.getBlockFromItem( sis.getItem() ); + if ( sis.getItemSpriteNumber() == 0 && block != null && RenderBlocks.renderItemIn3d( blk.getRenderType() ) ) { GL11.glRotatef( 25.0f, 1.0f, 0.0f, 0.0f ); GL11.glRotatef( 15.0f, 0.0f, 1.0f, 0.0f ); GL11.glRotatef( 30.0f, 0.0f, 1.0f, 0.0f ); } - int light = tile.worldObj.getLightBrightnessForSkyBlocks( tile.xCoord, tile.yCoord, tile.zCoord, 0 ); + int light = tile.getWorldObj().getLightBrightnessForSkyBlocks( tile.xCoord, tile.yCoord, tile.zCoord, 0 ); int br = light;// << 20 | light << 4; int var11 = br % 65536; int var12 = br / 65536; diff --git a/client/render/blocks/RenderBlockController.java b/client/render/blocks/RenderBlockController.java index 9e2f8261..15717a36 100644 --- a/client/render/blocks/RenderBlockController.java +++ b/client/render/blocks/RenderBlockController.java @@ -19,9 +19,9 @@ public class RenderBlockController extends BaseBlockRender public boolean renderInWorld(AEBaseBlock blk, IBlockAccess world, int x, int y, int z, RenderBlocks renderer) { - boolean xx = world.getBlockTileEntity( x - 1, y, z ) instanceof TileController && world.getBlockTileEntity( x + 1, y, z ) instanceof TileController; - boolean yy = world.getBlockTileEntity( x, y - 1, z ) instanceof TileController && world.getBlockTileEntity( x, y + 1, z ) instanceof TileController; - boolean zz = world.getBlockTileEntity( x, y, z - 1 ) instanceof TileController && world.getBlockTileEntity( x, y, z + 1 ) instanceof TileController; + boolean xx = world.getTileEntity( x - 1, y, z ) instanceof TileController && world.getTileEntity( x + 1, y, z ) instanceof TileController; + boolean yy = world.getTileEntity( x, y - 1, z ) instanceof TileController && world.getTileEntity( x, y + 1, z ) instanceof TileController; + boolean zz = world.getTileEntity( x, y, z - 1 ) instanceof TileController && world.getTileEntity( x, y, z + 1 ) instanceof TileController; int meta = world.getBlockMetadata( x, y, z ); boolean hasPower = meta > 0; diff --git a/client/render/blocks/RenderBlockCrank.java b/client/render/blocks/RenderBlockCrank.java index 30cb8880..219924a1 100644 --- a/client/render/blocks/RenderBlockCrank.java +++ b/client/render/blocks/RenderBlockCrank.java @@ -7,7 +7,7 @@ import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.item.ItemStack; import net.minecraft.world.IBlockAccess; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import org.lwjgl.opengl.GL11; @@ -69,7 +69,7 @@ public class RenderBlockCrank extends BaseBlockRender tess.setTranslation( -tc.xCoord, -tc.yCoord, -tc.zCoord ); tess.startDrawingQuads(); rbinstance.renderAllFaces = true; - rbinstance.blockAccess = tc.worldObj; + rbinstance.blockAccess = tc.getWorldObj(); rbinstance.setRenderBounds( 0.5D - 0.05, 0.5D - 0.5, 0.5D - 0.05, 0.5D + 0.05, 0.5D + 0.1, 0.5D + 0.05 ); diff --git a/client/render/blocks/RenderBlockWireless.java b/client/render/blocks/RenderBlockWireless.java index 5d18041c..223de06e 100644 --- a/client/render/blocks/RenderBlockWireless.java +++ b/client/render/blocks/RenderBlockWireless.java @@ -5,9 +5,9 @@ import java.util.EnumSet; import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.client.renderer.Tessellator; import net.minecraft.item.ItemStack; -import net.minecraft.util.Icon; +import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.util.AEColor; import appeng.block.AEBaseBlock; import appeng.client.render.BaseBlockRender; @@ -39,7 +39,7 @@ public class RenderBlockWireless extends BaseBlockRender renderer.renderAllFaces = true; - Icon r = CableBusTextures.PartMonitorSidesStatus.getIcon(); + IIcon r = CableBusTextures.PartMonitorSidesStatus.getIcon(); ri.setTemporaryRenderIcons( r, r, CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon(), r, r ); renderBlockBounds( renderer, 5, 5, 0, 11, 11, 1, ForgeDirection.EAST, ForgeDirection.UP, ForgeDirection.SOUTH ); renderInvBlock( EnumSet.allOf( ForgeDirection.class ), blk, tess, 0xffffff, renderer ); @@ -107,7 +107,7 @@ public class RenderBlockWireless extends BaseBlockRender renderer.renderAllFaces = true; - Icon r = CableBusTextures.PartMonitorSidesStatus.getIcon(); + IIcon r = CableBusTextures.PartMonitorSidesStatus.getIcon(); ri.setTemporaryRenderIcons( r, r, CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon(), r, r ); renderBlockBounds( renderer, 5, 5, 0, 11, 11, 1, fdx, fdy, fdz ); super.renderInWorld( blk, world, x, y, z, renderer ); @@ -193,8 +193,8 @@ public class RenderBlockWireless extends BaseBlockRender private void renderTorchAtAngle(RenderBlocks renderer, ForgeDirection x, ForgeDirection y, ForgeDirection z) { - Icon r = (hasChan ? CableBusTextures.BlockWirelessOn.getIcon() : blk.getIcon( 0, 0 )); - Icon sides = new OffsetIcon( r, 0.0f, -2.0f ); + IIcon r = (hasChan ? CableBusTextures.BlockWirelessOn.getIcon() : blk.getIcon( 0, 0 )); + IIcon sides = new OffsetIcon( r, 0.0f, -2.0f ); switch (z) { diff --git a/client/render/blocks/RenderDrive.java b/client/render/blocks/RenderDrive.java index f4f778dd..402071bb 100644 --- a/client/render/blocks/RenderDrive.java +++ b/client/render/blocks/RenderDrive.java @@ -5,9 +5,9 @@ import java.util.EnumSet; import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.client.renderer.Tessellator; import net.minecraft.item.ItemStack; -import net.minecraft.util.Icon; +import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.block.AEBaseBlock; import appeng.client.render.BaseBlockRender; import appeng.client.texture.ExtraTextures; @@ -44,7 +44,7 @@ public class RenderDrive extends BaseBlockRender boolean result = super.renderInWorld( imb, world, x, y, z, renderer ); Tessellator tess = Tessellator.instance; - Icon ico = ExtraTextures.MEStorageCellTextures.getIcon(); + IIcon ico = ExtraTextures.MEStorageCellTextures.getIcon(); int b = world.getLightBrightnessForSkyBlocks( x + forward.offsetX, y + forward.offsetY, z + forward.offsetZ, 0 ); @@ -236,7 +236,7 @@ public class RenderDrive extends BaseBlockRender if ( stat != 0 ) { - Icon wico = ExtraTextures.White.getIcon(); + IIcon wico = ExtraTextures.White.getIcon(); u1 = wico.getInterpolatedU( (spin % 4 < 2) ? 1 : 6 ); u2 = wico.getInterpolatedU( ((spin + 1) % 4 < 2) ? 1 : 6 ); u3 = wico.getInterpolatedU( ((spin + 2) % 4 < 2) ? 1 : 6 ); diff --git a/client/render/blocks/RenderMEChest.java b/client/render/blocks/RenderMEChest.java index 7d1971b9..c53af956 100644 --- a/client/render/blocks/RenderMEChest.java +++ b/client/render/blocks/RenderMEChest.java @@ -5,9 +5,9 @@ import java.util.EnumSet; import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.client.renderer.Tessellator; import net.minecraft.item.ItemStack; -import net.minecraft.util.Icon; +import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.AEApi; import appeng.api.storage.ICellHandler; import appeng.block.AEBaseBlock; @@ -108,7 +108,7 @@ public class RenderMEChest extends BaseBlockRender renderer.setRenderBounds( 0, 0, 0, 1, 1, 1 ); ICellHandler ch = AEApi.instance().registries().cell().getHander( sp.getStorageType() ); - Icon ico = ch == null ? null : ch.getTopTexture(); + IIcon ico = ch == null ? null : ch.getTopTexture(); renderFace( x, y, z, imb, ico == null ? ExtraTextures.MEChest.getIcon() : ico, renderer, up ); renderer.overrideBlockTexture = null; diff --git a/client/render/blocks/RenderQNB.java b/client/render/blocks/RenderQNB.java index eadc613c..26fcd20c 100644 --- a/client/render/blocks/RenderQNB.java +++ b/client/render/blocks/RenderQNB.java @@ -6,9 +6,9 @@ import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.client.renderer.Tessellator; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.Icon; +import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.AEApi; import appeng.api.util.AEColor; import appeng.api.util.AEColoredItemDefinition; @@ -20,7 +20,7 @@ import appeng.tile.qnb.TileQuantumBridge; public class RenderQNB extends BaseBlockRender { - public void renderCableAt(double Thickness, IBlockAccess world, int x, int y, int z, AEBaseBlock block, RenderBlocks renderer, Icon texture, double pull, + public void renderCableAt(double Thickness, IBlockAccess world, int x, int y, int z, AEBaseBlock block, RenderBlocks renderer, IIcon texture, double pull, EnumSet connections) { block.getRendererInstance().setTemporaryRenderIcon( texture ); diff --git a/client/render/blocks/RenderQuartzGlass.java b/client/render/blocks/RenderQuartzGlass.java index eaa64b66..40050222 100644 --- a/client/render/blocks/RenderQuartzGlass.java +++ b/client/render/blocks/RenderQuartzGlass.java @@ -5,7 +5,7 @@ import java.util.Random; import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.item.ItemStack; import net.minecraft.world.IBlockAccess; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.AEApi; import appeng.block.AEBaseBlock; import appeng.client.render.BaseBlockRender; @@ -36,8 +36,8 @@ public class RenderQuartzGlass extends BaseBlockRender boolean isGlass(AEBaseBlock imb, IBlockAccess world, int x, int y, int z) { - return world.getBlockId( x, y, z ) == AEApi.instance().blocks().blockQuartzGlass.block().blockID - || world.getBlockId( x, y, z ) == AEApi.instance().blocks().blockQuartzVibrantGlass.block().blockID; + return world.getBlock( x, y, z ) == AEApi.instance().blocks().blockQuartzGlass.block() + || world.getBlock( x, y, z ) == AEApi.instance().blocks().blockQuartzVibrantGlass.block(); } void renderEdge(AEBaseBlock imb, IBlockAccess world, int x, int y, int z, RenderBlocks renderer, ForgeDirection side, ForgeDirection direction) diff --git a/client/render/blocks/RenderQuartzTorch.java b/client/render/blocks/RenderQuartzTorch.java index c14b03e7..50e5c84a 100644 --- a/client/render/blocks/RenderQuartzTorch.java +++ b/client/render/blocks/RenderQuartzTorch.java @@ -2,12 +2,12 @@ package appeng.client.render.blocks; import java.util.EnumSet; -import net.minecraft.block.Block; import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.client.renderer.Tessellator; +import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.world.IBlockAccess; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.util.IOrientable; import appeng.block.AEBaseBlock; import appeng.block.misc.BlockQuartzTorch; @@ -51,7 +51,7 @@ public class RenderQuartzTorch extends BaseBlockRender renderInvBlock( EnumSet.allOf( ForgeDirection.class ), blk, tess, 0xffffff, renderer ); - blk.getRendererInstance().setTemporaryRenderIcon( Block.hopperBlock.getIcon( 0, 0 ) ); + blk.getRendererInstance().setTemporaryRenderIcon( Blocks.hopper.getIcon( 0, 0 ) ); renderer.renderAllFaces = true; renderer.setRenderBounds( Point2 + xOff, bottom + yOff, Point2 + zOff, Point13 + xOff, top + yOff, Point3 + zOff ); @@ -125,7 +125,7 @@ public class RenderQuartzTorch extends BaseBlockRender super.renderInWorld( block, world, x, y, z, renderer ); } - blk.getRendererInstance().setTemporaryRenderIcon( Block.hopperBlock.getIcon( 0, 0 ) ); + blk.getRendererInstance().setTemporaryRenderIcon( Blocks.hopper.getIcon( 0, 0 ) ); renderer.setRenderBounds( Point2 + xOff, bottom + yOff, Point2 + zOff, Point13 + xOff, top + yOff, Point3 + zOff ); boolean out = renderer.renderStandardBlock( blk, x, y, z ); diff --git a/client/render/blocks/RenderSpatialPylon.java b/client/render/blocks/RenderSpatialPylon.java index 8e46eaf2..16d6d281 100644 --- a/client/render/blocks/RenderSpatialPylon.java +++ b/client/render/blocks/RenderSpatialPylon.java @@ -3,9 +3,9 @@ package appeng.client.render.blocks; import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.client.renderer.Tessellator; import net.minecraft.item.ItemStack; -import net.minecraft.util.Icon; +import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.block.AEBaseBlock; import appeng.client.render.BaseBlockRender; import appeng.client.render.BlockRenderInfo; @@ -149,7 +149,7 @@ public class RenderSpatialPylon extends BaseBlockRender return result; } - private Icon getBlockTextureFromSideOutside(AEBaseBlock blk, TileSpatialPylon sp, int displayBits, ForgeDirection ori, ForgeDirection dir) + private IIcon getBlockTextureFromSideOutside(AEBaseBlock blk, TileSpatialPylon sp, int displayBits, ForgeDirection ori, ForgeDirection dir) { if ( ori.equals( dir ) || ori.getOpposite().equals( dir ) ) @@ -167,7 +167,7 @@ public class RenderSpatialPylon extends BaseBlockRender return blk.getIcon( 0, 0 ); } - private Icon getBlockTextureFromSideInside(AEBaseBlock blk, TileSpatialPylon sp, int displayBits, ForgeDirection ori, ForgeDirection dir) + private IIcon getBlockTextureFromSideInside(AEBaseBlock blk, TileSpatialPylon sp, int displayBits, ForgeDirection ori, ForgeDirection dir) { boolean good = (displayBits & sp.DISPLAY_ENABLED) == sp.DISPLAY_ENABLED; diff --git a/client/render/blocks/RenderStorageMonitor.java b/client/render/blocks/RenderStorageMonitor.java index 21b3653d..4ccd4132 100644 --- a/client/render/blocks/RenderStorageMonitor.java +++ b/client/render/blocks/RenderStorageMonitor.java @@ -48,9 +48,8 @@ public class RenderStorageMonitor extends BaseBlockRender GL11.glScalef( 1.0f / 1.5f, 1.0f / 1.5f, 1.0f / 1.5f ); GL11.glScalef( 1.0f, -1.0f, 0.005f ); - int k = sis.itemID; - Block block = (k < Block.blocksList.length ? Block.blocksList[k] : null); - if ( sis.getItemSpriteNumber() == 0 && block != null && RenderBlocks.renderItemIn3d( Block.blocksList[k].getRenderType() ) ) + Block block = Block.getBlockFromItem( sis.getItem() ); + if ( sis.getItemSpriteNumber() == 0 && block != null && RenderBlocks.renderItemIn3d( block.getRenderType() ) ) { GL11.glRotatef( 25.0f, 1.0f, 0.0f, 0.0f ); GL11.glRotatef( 15.0f, 0.0f, 1.0f, 0.0f ); diff --git a/client/render/blocks/RendererSecurity.java b/client/render/blocks/RendererSecurity.java index cec55a55..f928e108 100644 --- a/client/render/blocks/RendererSecurity.java +++ b/client/render/blocks/RendererSecurity.java @@ -5,9 +5,9 @@ import java.util.EnumSet; import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.client.renderer.Tessellator; import net.minecraft.item.ItemStack; -import net.minecraft.util.Icon; +import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.block.AEBaseBlock; import appeng.client.render.BaseBlockRender; import appeng.client.texture.ExtraTextures; @@ -55,7 +55,7 @@ public class RendererSecurity extends BaseBlockRender Tessellator.instance.setColorOpaque_I( 0xffffff ); renderer.setRenderBounds( 0, 0, 0, 1, 1, 1 ); - Icon ico = sp.isActive() ? ExtraTextures.BlockMESecurityOn.getIcon() : ExtraTextures.MEChest.getIcon(); + IIcon ico = sp.isActive() ? ExtraTextures.BlockMESecurityOn.getIcon() : ExtraTextures.MEChest.getIcon(); renderFace( x, y, z, imb, ico, renderer, up ); renderer.overrideBlockTexture = null; diff --git a/client/render/effects/EnergyFx.java b/client/render/effects/EnergyFx.java index c0f5244a..c0e1c21f 100644 --- a/client/render/effects/EnergyFx.java +++ b/client/render/effects/EnergyFx.java @@ -5,9 +5,9 @@ import net.minecraft.client.particle.EntityBreakingFX; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.item.Item; -import net.minecraft.util.Icon; +import net.minecraft.util.IIcon; import net.minecraft.world.World; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import org.lwjgl.opengl.GL11; @@ -19,7 +19,7 @@ import cpw.mods.fml.relauncher.SideOnly; public class EnergyFx extends EntityBreakingFX { - private Icon particleTextureIndex; + private IIcon particleTextureIndex; public EnergyFx(World par1World, double par2, double par4, double par6, Item par8Item) { super( par1World, par2, par4, par6, par8Item ); diff --git a/client/render/effects/MatterCannonEffect.java b/client/render/effects/MatterCannonEffect.java index 95872c76..f7a332d9 100644 --- a/client/render/effects/MatterCannonEffect.java +++ b/client/render/effects/MatterCannonEffect.java @@ -5,15 +5,15 @@ import net.minecraft.client.particle.EntityBreakingFX; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.item.Item; -import net.minecraft.util.Icon; +import net.minecraft.util.IIcon; import net.minecraft.world.World; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.client.texture.ExtraTextures; public class MatterCannonEffect extends EntityBreakingFX { - private Icon particleTextureIndex; + private IIcon particleTextureIndex; public MatterCannonEffect(World par1World, double par2, double par4, double par6, Item par8Item) { super( par1World, par2, par4, par6, par8Item ); diff --git a/client/render/entity/RenderTinyTNTPrimed.java b/client/render/entity/RenderTinyTNTPrimed.java index aff39e96..45741569 100644 --- a/client/render/entity/RenderTinyTNTPrimed.java +++ b/client/render/entity/RenderTinyTNTPrimed.java @@ -1,11 +1,11 @@ package appeng.client.render.entity; -import net.minecraft.block.Block; import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.client.renderer.entity.Render; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.entity.Entity; +import net.minecraft.init.Blocks; import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; @@ -54,7 +54,7 @@ public class RenderTinyTNTPrimed extends Render GL11.glScalef( 0.5f, 0.5f, 0.5f ); f2 = (1.0F - ((float) tnt.fuse - life + 1.0F) / 100.0F) * 0.8F; this.bindEntityTexture( tnt ); - this.blockRenderer.renderBlockAsItem( Block.tnt, 0, tnt.getBrightness( life ) ); + this.blockRenderer.renderBlockAsItem( Blocks.tnt, 0, tnt.getBrightness( life ) ); if ( tnt.fuse / 5 % 2 == 0 ) { @@ -63,7 +63,7 @@ public class RenderTinyTNTPrimed extends Render GL11.glEnable( GL11.GL_BLEND ); GL11.glBlendFunc( GL11.GL_SRC_ALPHA, GL11.GL_DST_ALPHA ); GL11.glColor4f( 1.0F, 1.0F, 1.0F, f2 ); - this.blockRenderer.renderBlockAsItem( Block.tnt, 0, 1.0F ); + this.blockRenderer.renderBlockAsItem( Blocks.tnt, 0, 1.0F ); GL11.glColor4f( 1.0F, 1.0F, 1.0F, 1.0F ); GL11.glDisable( GL11.GL_BLEND ); GL11.glEnable( GL11.GL_LIGHTING ); diff --git a/client/render/items/ToolBiometricCardRender.java b/client/render/items/ToolBiometricCardRender.java index 073748db..91ff9751 100644 --- a/client/render/items/ToolBiometricCardRender.java +++ b/client/render/items/ToolBiometricCardRender.java @@ -2,10 +2,10 @@ package appeng.client.render.items; import net.minecraft.client.renderer.ItemRenderer; import net.minecraft.client.renderer.Tessellator; -import net.minecraft.item.Item; +import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.Icon; +import net.minecraft.util.IIcon; import net.minecraftforge.client.IItemRenderer; import org.lwjgl.opengl.GL11; @@ -31,12 +31,12 @@ public class ToolBiometricCardRender implements IItemRenderer @Override public void renderItem(ItemRenderType type, ItemStack item, Object... data) { - Icon par2Icon = item.getIconIndex(); + IIcon par2Icon = item.getIconIndex(); - float f4 = ((Icon) par2Icon).getMinU(); - float f5 = ((Icon) par2Icon).getMaxU(); - float f6 = ((Icon) par2Icon).getMinV(); - float f7 = ((Icon) par2Icon).getMaxV(); + float f4 = ((IIcon) par2Icon).getMinU(); + float f5 = ((IIcon) par2Icon).getMaxU(); + float f6 = ((IIcon) par2Icon).getMinV(); + float f7 = ((IIcon) par2Icon).getMaxV(); float f12 = 0.0625F; Tessellator tessellator = Tessellator.instance; @@ -49,6 +49,7 @@ public class ToolBiometricCardRender implements IItemRenderer GL11.glScalef( 16F, 16F, 10F ); GL11.glTranslatef( 0.0F, 1.0F, 0.0F ); GL11.glRotatef( 180F, 1.0F, 0.0F, 0.0F ); + GL11.glEnable( GL11.GL_ALPHA_TEST ); tessellator.startDrawingQuads(); tessellator.setNormal( 0.0F, 1.0F, 0.0F ); @@ -61,7 +62,7 @@ public class ToolBiometricCardRender implements IItemRenderer else { GL11.glTranslatef( -0.5F, -0.3F, 0.01F ); - ItemRenderer.renderItemIn2D( tessellator, f5, f6, f4, f7, ((Icon) par2Icon).getIconWidth(), ((Icon) par2Icon).getIconHeight(), f12 ); + ItemRenderer.renderItemIn2D( tessellator, f5, f6, f4, f7, ((IIcon) par2Icon).getIconWidth(), ((IIcon) par2Icon).getIconHeight(), f12 ); GL11.glDisable( GL11.GL_CULL_FACE ); GL11.glColor4f( 1, 1, 1, 1.0F ); @@ -70,8 +71,8 @@ public class ToolBiometricCardRender implements IItemRenderer GL11.glRotatef( 180F, 1.0F, 0.0F, 0.0F ); } - float u = Item.snowball.getIconFromDamage( 0 ).getInterpolatedU( 8.1 ); - float v = Item.snowball.getIconFromDamage( 0 ).getInterpolatedV( 8.1 ); + float u = Items.snowball.getIconFromDamage( 0 ).getInterpolatedU( 8.1 ); + float v = Items.snowball.getIconFromDamage( 0 ).getInterpolatedV( 8.1 ); NBTTagCompound myTag = Platform.openNbtData( item ); String username = myTag.getString( "username" ); @@ -80,6 +81,7 @@ public class ToolBiometricCardRender implements IItemRenderer GL11.glScalef( 1F / 16F, 1F / 16F, 1F ); GL11.glTranslatef( 4, 6, 0 ); GL11.glDisable( GL11.GL_LIGHTING ); + tessellator.startDrawingQuads(); float z = 0; diff --git a/client/texture/CableBusTextures.java b/client/texture/CableBusTextures.java index 590482ee..670a0c76 100644 --- a/client/texture/CableBusTextures.java +++ b/client/texture/CableBusTextures.java @@ -2,7 +2,7 @@ package appeng.client.texture; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.texture.TextureMap; -import net.minecraft.util.Icon; +import net.minecraft.util.IIcon; import net.minecraft.util.ResourceLocation; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -72,7 +72,7 @@ public enum CableBusTextures ItemPartLevelEmitterOn("ItemPart.LevelEmitterOn.png"), PartTransitionPlaneBack("PartTransitionPlaneBack"); final private String name; - public Icon icon; + public IIcon IIcon; public static ResourceLocation GuiTexture(String string) { @@ -88,18 +88,18 @@ public enum CableBusTextures this.name = name; } - public Icon getIcon() + public IIcon getIcon() { - return icon; + return IIcon; } public void registerIcon(TextureMap map) { - icon = map.registerIcon( "appliedenergistics2:" + name ); + IIcon = map.registerIcon( "appliedenergistics2:" + name ); } @SideOnly(Side.CLIENT) - public static Icon getMissing() + public static IIcon getMissing() { return ((TextureMap) Minecraft.getMinecraft().getTextureManager().getTexture( TextureMap.locationBlocksTexture )).getAtlasSprite( "missingno" ); } diff --git a/client/texture/ExtraTextures.java b/client/texture/ExtraTextures.java index ca6855b3..650318bb 100644 --- a/client/texture/ExtraTextures.java +++ b/client/texture/ExtraTextures.java @@ -2,7 +2,7 @@ package appeng.client.texture; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.texture.TextureMap; -import net.minecraft.util.Icon; +import net.minecraft.util.IIcon; import net.minecraft.util.ResourceLocation; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -53,7 +53,7 @@ public enum ExtraTextures BlockMESecurityOn("BlockMESecurityOn"); final private String name; - public Icon icon; + public IIcon IIcon; public static ResourceLocation GuiTexture(String string) { @@ -69,18 +69,18 @@ public enum ExtraTextures this.name = name; } - public Icon getIcon() + public IIcon getIcon() { - return icon; + return IIcon; } public void registerIcon(TextureMap map) { - icon = map.registerIcon( "appliedenergistics2:" + name ); + IIcon = map.registerIcon( "appliedenergistics2:" + name ); } @SideOnly(Side.CLIENT) - public static Icon getMissing() + public static IIcon getMissing() { return ((TextureMap) Minecraft.getMinecraft().getTextureManager().getTexture( TextureMap.locationBlocksTexture )).getAtlasSprite( "missingno" ); } diff --git a/client/texture/FlipableIcon.java b/client/texture/FlipableIcon.java index 16ea5f18..bc233198 100644 --- a/client/texture/FlipableIcon.java +++ b/client/texture/FlipableIcon.java @@ -1,15 +1,15 @@ package appeng.client.texture; -import net.minecraft.util.Icon; +import net.minecraft.util.IIcon; -public class FlipableIcon implements Icon +public class FlipableIcon implements IIcon { - protected Icon original; + protected IIcon original; boolean flip_u; boolean flip_v; - public FlipableIcon(Icon o) { + public FlipableIcon(IIcon o) { original = o; flip_u = false; flip_v = false; @@ -81,7 +81,7 @@ public class FlipableIcon implements Icon return original.getIconName(); } - public Icon getOriginal() + public IIcon getOriginal() { return original; } diff --git a/client/texture/FullIcon.java b/client/texture/FullIcon.java index 11f5009e..59f0d1ca 100644 --- a/client/texture/FullIcon.java +++ b/client/texture/FullIcon.java @@ -1,15 +1,15 @@ package appeng.client.texture; -import net.minecraft.util.Icon; +import net.minecraft.util.IIcon; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -public class FullIcon implements Icon +public class FullIcon implements IIcon { - private Icon p; + private IIcon p; - public FullIcon(Icon o) { + public FullIcon(IIcon o) { p = o; } diff --git a/client/texture/OffsetIcon.java b/client/texture/OffsetIcon.java index 99c96f2e..f8c676a0 100644 --- a/client/texture/OffsetIcon.java +++ b/client/texture/OffsetIcon.java @@ -1,18 +1,18 @@ package appeng.client.texture; -import net.minecraft.util.Icon; +import net.minecraft.util.IIcon; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -public class OffsetIcon implements Icon +public class OffsetIcon implements IIcon { final float offsetX; final float offsetY; - private Icon p; + private IIcon p; - public OffsetIcon(Icon o, float x, float y) { + public OffsetIcon(IIcon o, float x, float y) { p = o; offsetX = x; offsetY = y; diff --git a/client/texture/TaughtIcon.java b/client/texture/TaughtIcon.java index 9638d75c..cb3490cb 100644 --- a/client/texture/TaughtIcon.java +++ b/client/texture/TaughtIcon.java @@ -1,17 +1,17 @@ package appeng.client.texture; -import net.minecraft.util.Icon; +import net.minecraft.util.IIcon; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -public class TaughtIcon implements Icon +public class TaughtIcon implements IIcon { final float tightness; - private Icon p; + private IIcon p; - public TaughtIcon(Icon o, float tightness) { + public TaughtIcon(IIcon o, float tightness) { p = o; this.tightness = tightness; } diff --git a/client/texture/TmpFlipableIcon.java b/client/texture/TmpFlipableIcon.java index 66d9d8cd..725fac1d 100644 --- a/client/texture/TmpFlipableIcon.java +++ b/client/texture/TmpFlipableIcon.java @@ -1,6 +1,6 @@ package appeng.client.texture; -import net.minecraft.util.Icon; +import net.minecraft.util.IIcon; public class TmpFlipableIcon extends FlipableIcon { @@ -9,7 +9,7 @@ public class TmpFlipableIcon extends FlipableIcon super( null ); } - public void setOriginal(Icon i) + public void setOriginal(IIcon i) { while (i instanceof FlipableIcon) i = ((FlipableIcon) i).getOriginal(); diff --git a/container/AEBaseContainer.java b/container/AEBaseContainer.java index 74215045..83762a9e 100644 --- a/container/AEBaseContainer.java +++ b/container/AEBaseContainer.java @@ -12,7 +12,7 @@ import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.AEApi; import appeng.api.config.Actionable; import appeng.api.config.SecurityPermissions; @@ -50,6 +50,7 @@ public abstract class AEBaseContainer extends Container final IPart part; final protected BaseActionSource mySrc; + public boolean isContainerValid = true; int ticksSinceCheck = 900; @@ -71,7 +72,9 @@ public abstract class AEBaseContainer extends Container host = (IActionHost) part; if ( host == null ) - invPlayer.player.closeScreen();// close! + { + isContainerValid = false; + } else { IGridNode gn = host.getActionableNode(); @@ -85,14 +88,14 @@ public abstract class AEBaseContainer extends Container IEnergyGrid eg = g.getCache( IEnergyGrid.class ); if ( !eg.isNetworkPowered() ) { - invPlayer.player.closeScreen(); + isContainerValid = false; return; } } ISecurityGrid sg = g.getCache( ISecurityGrid.class ); if ( !sg.hasPermission( invPlayer.player, security ) ) - invPlayer.player.closeScreen(); + isContainerValid = false; } } } @@ -152,9 +155,13 @@ public abstract class AEBaseContainer extends Container @Override public boolean canInteractWith(EntityPlayer entityplayer) { - if ( tileEntity instanceof IInventory ) - return ((IInventory) tileEntity).isUseableByPlayer( entityplayer ); - return true; + if ( isContainerValid ) + { + if ( tileEntity instanceof IInventory ) + return ((IInventory) tileEntity).isUseableByPlayer( entityplayer ); + return true; + } + return false; } @Override @@ -337,7 +344,7 @@ public abstract class AEBaseContainer extends Container d.onSlotChanged(); // if ( worldEntity != null ) - // worldEntity.onInventoryChanged(); + // worldEntity.markDirty(); // if ( hasMETiles ) updateClient(); updateSlot( clickSlot ); @@ -367,7 +374,7 @@ public abstract class AEBaseContainer extends Container d.onSlotChanged(); // if ( worldEntity != null ) - // worldEntity.onInventoryChanged(); + // worldEntity.markDirty(); // if ( hasMETiles ) updateClient(); updateSlot( clickSlot ); diff --git a/container/ContainerOpenContext.java b/container/ContainerOpenContext.java index 01031c70..1f58c645 100644 --- a/container/ContainerOpenContext.java +++ b/container/ContainerOpenContext.java @@ -1,7 +1,7 @@ package appeng.container; import net.minecraft.world.World; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; public class ContainerOpenContext { diff --git a/container/implementations/ContainerCellWorkbench.java b/container/implementations/ContainerCellWorkbench.java index 3717a8be..d33f1bf1 100644 --- a/container/implementations/ContainerCellWorkbench.java +++ b/container/implementations/ContainerCellWorkbench.java @@ -72,7 +72,7 @@ public class ContainerCellWorkbench extends ContainerUpgradeable { IInventory inv = getCellUpgradeInventory(); ItemStack is = inv.decrStackSize( i, j ); - inv.onInventoryChanged(); + inv.markDirty(); return is; } @@ -81,7 +81,7 @@ public class ContainerCellWorkbench extends ContainerUpgradeable { IInventory inv = getCellUpgradeInventory(); ItemStack is = inv.getStackInSlotOnClosing( i ); - inv.onInventoryChanged(); + inv.markDirty(); return is; } @@ -90,17 +90,17 @@ public class ContainerCellWorkbench extends ContainerUpgradeable { IInventory inv = getCellUpgradeInventory(); inv.setInventorySlotContents( i, itemstack ); - inv.onInventoryChanged(); + inv.markDirty(); } @Override - public String getInvName() + public String getInventoryName() { return "Upgrades"; } @Override - public boolean isInvNameLocalized() + public boolean hasCustomInventoryName() { return false; } @@ -112,7 +112,7 @@ public class ContainerCellWorkbench extends ContainerUpgradeable } @Override - public void onInventoryChanged() + public void markDirty() { } @@ -124,12 +124,12 @@ public class ContainerCellWorkbench extends ContainerUpgradeable } @Override - public void openChest() + public void openInventory() { } @Override - public void closeChest() + public void closeInventory() { } @@ -239,7 +239,7 @@ public class ContainerCellWorkbench extends ContainerUpgradeable icrafting.sendSlotContents( this, sri.slotNumber, sri.getStack() ); } } - ((EntityPlayerMP) icrafting).playerInventoryBeingManipulated = false; + ((EntityPlayerMP) icrafting).isChangingQuantityOnly = false; } } diff --git a/container/implementations/ContainerCondenser.java b/container/implementations/ContainerCondenser.java index 396883ff..d47dbcf0 100644 --- a/container/implementations/ContainerCondenser.java +++ b/container/implementations/ContainerCondenser.java @@ -70,7 +70,7 @@ public class ContainerCondenser extends AEBaseContainer if ( changed ) { // if the bars changed an item was probably made, so just send shit! - ((EntityPlayerMP) icrafting).playerInventoryBeingManipulated = false; + ((EntityPlayerMP) icrafting).isChangingQuantityOnly = false; } } diff --git a/container/implementations/ContainerIOPort.java b/container/implementations/ContainerIOPort.java index 8b58082d..85dc8a99 100644 --- a/container/implementations/ContainerIOPort.java +++ b/container/implementations/ContainerIOPort.java @@ -60,7 +60,7 @@ public class ContainerIOPort extends ContainerUpgradeable offy = 17; for (int y = 0; y < 3; y++) for (int x = 0; x < 2; x++) - addSlotToContainer( new SlotOutput( cells, 6 + x + y * 2, offx + x * 18, offy + y * 18, PlaceableItemType.STORAGE_CELLS.icon ) ); + addSlotToContainer( new SlotOutput( cells, 6 + x + y * 2, offx + x * 18, offy + y * 18, PlaceableItemType.STORAGE_CELLS.IIcon ) ); IInventory upgrades = myte.getInventoryByName( "upgrades" ); addSlotToContainer( (new SlotRestrictedInput( PlaceableItemType.UPGRADES, upgrades, 0, 187, 8 + 18 * 0 )).setNotDraggable() ); diff --git a/container/implementations/ContainerMEMonitorable.java b/container/implementations/ContainerMEMonitorable.java index 398a4593..5495fb84 100644 --- a/container/implementations/ContainerMEMonitorable.java +++ b/container/implementations/ContainerMEMonitorable.java @@ -4,11 +4,11 @@ import java.io.IOException; import java.nio.BufferOverflowException; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.ICrafting; -import net.minecraft.network.packet.Packet; import net.minecraft.tileentity.TileEntity; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.implementations.guiobjects.IPortableCell; import appeng.api.implementations.tiles.IMEChest; import appeng.api.networking.IGrid; @@ -24,11 +24,10 @@ import appeng.api.storage.data.IAEItemStack; import appeng.api.storage.data.IItemList; import appeng.container.AEBaseContainer; import appeng.core.AELog; +import appeng.core.sync.network.NetworkHandler; import appeng.core.sync.packets.PacketMEInventoryUpdate; import appeng.util.Platform; import appeng.util.item.ItemList; -import cpw.mods.fml.common.network.PacketDispatcher; -import cpw.mods.fml.common.network.Player; public class ContainerMEMonitorable extends AEBaseContainer implements IMEMonitorHandlerReciever { @@ -64,7 +63,7 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IMEMonito } } else - ip.player.closeScreen(); + isContainerValid = false; } else monitor = null; @@ -104,13 +103,12 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IMEMonito if ( !piu.isEmpty() ) { - Packet p = piu.getPacket(); items.resetStatus(); for (Object c : this.crafters) { - if ( c instanceof Player ) - PacketDispatcher.sendPacketToPlayer( p, (Player) c ); + if ( c instanceof EntityPlayer ) + NetworkHandler.instance.sendTo( piu, (EntityPlayerMP) c ); } } } @@ -129,7 +127,7 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IMEMonito { super.addCraftingToCrafters( c ); - if ( Platform.isServer() && c instanceof Player && monitor != null ) + if ( Platform.isServer() && c instanceof EntityPlayer && monitor != null ) { try { @@ -144,16 +142,14 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IMEMonito } catch (BufferOverflowException boe) { - Packet p = piu.getPacket(); - PacketDispatcher.sendPacketToPlayer( p, (Player) c ); + NetworkHandler.instance.sendTo( piu, (EntityPlayerMP) c ); piu = new PacketMEInventoryUpdate(); piu.appendItem( send ); } } - Packet p = piu.getPacket(); - PacketDispatcher.sendPacketToPlayer( p, (Player) c ); + NetworkHandler.instance.sendTo( piu, (EntityPlayerMP) c ); } catch (IOException e) { diff --git a/container/implementations/ContainerMEPortableCell.java b/container/implementations/ContainerMEPortableCell.java index f741792e..08fc3097 100644 --- a/container/implementations/ContainerMEPortableCell.java +++ b/container/implementations/ContainerMEPortableCell.java @@ -37,14 +37,14 @@ public class ContainerMEPortableCell extends ContainerMEMonitorable if ( Platform.isSameItem( civ.getItemStack(), currentItem ) ) getPlayerInv().setInventorySlotContents( getPlayerInv().currentItem, civ.getItemStack() ); else - getPlayerInv().player.closeScreen(); + isContainerValid = false; } else - getPlayerInv().player.closeScreen(); + isContainerValid = false; } } else - getPlayerInv().player.closeScreen(); + isContainerValid = false; // drain 1 ae t ticks++; diff --git a/container/implementations/ContainerNetworkStatus.java b/container/implementations/ContainerNetworkStatus.java index bd755ce8..53af09e5 100644 --- a/container/implementations/ContainerNetworkStatus.java +++ b/container/implementations/ContainerNetworkStatus.java @@ -2,11 +2,12 @@ package appeng.container.implementations; import java.io.IOException; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.ICrafting; import net.minecraft.item.ItemStack; -import net.minecraft.network.packet.Packet; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.AEApi; import appeng.api.implementations.guiobjects.INetworkTool; import appeng.api.networking.IGrid; @@ -17,11 +18,10 @@ import appeng.api.networking.energy.IEnergyGrid; import appeng.api.storage.data.IAEItemStack; import appeng.api.storage.data.IItemList; import appeng.container.AEBaseContainer; +import appeng.core.sync.network.NetworkHandler; import appeng.core.sync.packets.PacketMEInventoryUpdate; import appeng.util.Platform; import appeng.util.item.AEItemStack; -import cpw.mods.fml.common.network.PacketDispatcher; -import cpw.mods.fml.common.network.Player; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -42,7 +42,7 @@ public class ContainerNetworkStatus extends AEBaseContainer } if ( network == null && Platform.isServer() ) - ip.player.closeScreen(); + isContainerValid = false; } private void findNode(IGridHost host, ForgeDirection d) @@ -142,11 +142,10 @@ public class ContainerNetworkStatus extends AEBaseContainer piu.appendItem( ais ); } - Packet p = piu.getPacket(); for (Object c : this.crafters) { - if ( c instanceof Player ) - PacketDispatcher.sendPacketToPlayer( p, (Player) c ); + if ( c instanceof EntityPlayer ) + NetworkHandler.instance.sendTo( piu, (EntityPlayerMP) c ); } } catch (IOException e) diff --git a/container/implementations/ContainerNetworkTool.java b/container/implementations/ContainerNetworkTool.java index d468ce72..385958df 100644 --- a/container/implementations/ContainerNetworkTool.java +++ b/container/implementations/ContainerNetworkTool.java @@ -38,10 +38,10 @@ public class ContainerNetworkTool extends AEBaseContainer if ( Platform.isSameItem( toolInv.getItemStack(), currentItem ) ) getPlayerInv().setInventorySlotContents( getPlayerInv().currentItem, toolInv.getItemStack() ); else - getPlayerInv().player.closeScreen(); + isContainerValid = false; } else - getPlayerInv().player.closeScreen(); + isContainerValid = false; } super.detectAndSendChanges(); diff --git a/container/implementations/ContainerSecurity.java b/container/implementations/ContainerSecurity.java index cedcebe0..1dbeceba 100644 --- a/container/implementations/ContainerSecurity.java +++ b/container/implementations/ContainerSecurity.java @@ -53,10 +53,10 @@ public class ContainerSecurity extends ContainerMEMonitorable implements IAEAppE super.onContainerClosed( player ); if ( wirelessIn.getHasStack() ) - player.dropPlayerItem( wirelessIn.getStack() ); + player.dropPlayerItemWithRandomChoice( wirelessIn.getStack(), false ); if ( wirelessOut.getHasStack() ) - player.dropPlayerItem( wirelessOut.getStack() ); + player.dropPlayerItemWithRandomChoice( wirelessOut.getStack(), false ); } public void toggleSetting(String value, EntityPlayer player) diff --git a/container/implementations/ContainerSpatialIOPort.java b/container/implementations/ContainerSpatialIOPort.java index 57b82d51..5aaa0567 100644 --- a/container/implementations/ContainerSpatialIOPort.java +++ b/container/implementations/ContainerSpatialIOPort.java @@ -18,7 +18,7 @@ public class ContainerSpatialIOPort extends AEBaseContainer myte = te; addSlotToContainer( new SlotRestrictedInput( PlaceableItemType.SPATIAL_STORAGE_CELLS, te, 0, 71, 14 ) ); - addSlotToContainer( new SlotOutput( te, 1, 71, 14, PlaceableItemType.SPATIAL_STORAGE_CELLS.icon ) ); + addSlotToContainer( new SlotOutput( te, 1, 71, 14, PlaceableItemType.SPATIAL_STORAGE_CELLS.IIcon ) ); bindPlayerInventory( ip, 0, 199 - /* height of playerinventory */82 ); } diff --git a/container/implementations/ContainerUpgradeable.java b/container/implementations/ContainerUpgradeable.java index dc38a982..2113c8bb 100644 --- a/container/implementations/ContainerUpgradeable.java +++ b/container/implementations/ContainerUpgradeable.java @@ -149,10 +149,10 @@ public class ContainerUpgradeable extends AEBaseContainer implements IOptionalSl if ( Platform.isSameItem( tbinv.getItemStack(), currentItem ) ) getPlayerInv().setInventorySlotContents( tbslot, tbinv.getItemStack() ); else - getPlayerInv().player.closeScreen(); + isContainerValid = false; } else - getPlayerInv().player.closeScreen(); + isContainerValid = false; } } } diff --git a/container/implementations/ContainerWirelessTerm.java b/container/implementations/ContainerWirelessTerm.java index 2d01949b..574024be 100644 --- a/container/implementations/ContainerWirelessTerm.java +++ b/container/implementations/ContainerWirelessTerm.java @@ -22,8 +22,8 @@ public class ContainerWirelessTerm extends ContainerMEPortableCell if ( !wtgo.rangeCheck() ) { - getPlayerInv().player.closeScreen(); - getPlayerInv().player.sendChatToPlayer( PlayerMessages.OutOfRange.get() ); + isContainerValid = false; + getPlayerInv().player.addChatMessage( PlayerMessages.OutOfRange.get() ); } else { diff --git a/container/slot/AppEngCraftingSlot.java b/container/slot/AppEngCraftingSlot.java index d5497619..3af67db7 100644 --- a/container/slot/AppEngCraftingSlot.java +++ b/container/slot/AppEngCraftingSlot.java @@ -1,14 +1,18 @@ package appeng.container.slot; -import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; import net.minecraft.inventory.IInventory; import net.minecraft.item.Item; +import net.minecraft.item.ItemHoe; +import net.minecraft.item.ItemPickaxe; import net.minecraft.item.ItemStack; +import net.minecraft.item.ItemSword; import net.minecraft.stats.AchievementList; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.player.PlayerDestroyItemEvent; -import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.common.FMLCommonHandler; public class AppEngCraftingSlot extends AppEngSlot { @@ -70,43 +74,52 @@ public class AppEngCraftingSlot extends AppEngSlot par1ItemStack.onCrafting( this.thePlayer.worldObj, this.thePlayer, this.amountCrafted ); this.amountCrafted = 0; - if ( par1ItemStack.itemID == Block.workbench.blockID ) + if ( par1ItemStack.getItem() == Item.getItemFromBlock( Blocks.crafting_table ) ) { this.thePlayer.addStat( AchievementList.buildWorkBench, 1 ); } - else if ( par1ItemStack.itemID == Item.pickaxeWood.itemID ) + + if ( par1ItemStack.getItem() instanceof ItemPickaxe ) { this.thePlayer.addStat( AchievementList.buildPickaxe, 1 ); } - else if ( par1ItemStack.itemID == Block.furnaceIdle.blockID ) + + if ( par1ItemStack.getItem() == Item.getItemFromBlock( Blocks.furnace ) ) { this.thePlayer.addStat( AchievementList.buildFurnace, 1 ); } - else if ( par1ItemStack.itemID == Item.hoeWood.itemID ) + + if ( par1ItemStack.getItem() instanceof ItemHoe ) { this.thePlayer.addStat( AchievementList.buildHoe, 1 ); } - else if ( par1ItemStack.itemID == Item.bread.itemID ) + + if ( par1ItemStack.getItem() == Items.bread ) { this.thePlayer.addStat( AchievementList.makeBread, 1 ); } - else if ( par1ItemStack.itemID == Item.cake.itemID ) + + if ( par1ItemStack.getItem() == Items.cake ) { this.thePlayer.addStat( AchievementList.bakeCake, 1 ); } - else if ( par1ItemStack.itemID == Item.pickaxeStone.itemID ) + + if ( par1ItemStack.getItem() instanceof ItemPickaxe && ((ItemPickaxe) par1ItemStack.getItem()).func_150913_i() != Item.ToolMaterial.WOOD ) { this.thePlayer.addStat( AchievementList.buildBetterPickaxe, 1 ); } - else if ( par1ItemStack.itemID == Item.swordWood.itemID ) + + if ( par1ItemStack.getItem() instanceof ItemSword ) { this.thePlayer.addStat( AchievementList.buildSword, 1 ); } - else if ( par1ItemStack.itemID == Block.enchantmentTable.blockID ) + + if ( par1ItemStack.getItem() == Item.getItemFromBlock( Blocks.enchanting_table ) ) { this.thePlayer.addStat( AchievementList.enchantments, 1 ); } - else if ( par1ItemStack.itemID == Block.bookShelf.blockID ) + + if ( par1ItemStack.getItem() == Item.getItemFromBlock( Blocks.bookshelf ) ) { this.thePlayer.addStat( AchievementList.bookcase, 1 ); } @@ -114,7 +127,7 @@ public class AppEngCraftingSlot extends AppEngSlot public void onPickupFromSlot(EntityPlayer par1EntityPlayer, ItemStack par2ItemStack) { - GameRegistry.onItemCrafted( par1EntityPlayer, par2ItemStack, craftMatrix ); + FMLCommonHandler.instance().firePlayerCraftingEvent( par1EntityPlayer, par2ItemStack, craftMatrix ); this.onCrafting( par2ItemStack ); for (int i = 0; i < this.craftMatrix.getSizeInventory(); ++i) @@ -125,19 +138,18 @@ public class AppEngCraftingSlot extends AppEngSlot { this.craftMatrix.decrStackSize( i, 1 ); - if ( itemstack1.getItem().hasContainerItem() ) + if ( itemstack1.getItem().hasContainerItem( itemstack1 ) ) { - ItemStack itemstack2 = itemstack1.getItem().getContainerItemStack( itemstack1 ); + ItemStack itemstack2 = itemstack1.getItem().getContainerItem( itemstack1 ); - if ( itemstack2.isItemStackDamageable() && itemstack2.getItemDamage() > itemstack2.getMaxDamage() ) + if ( itemstack2 != null && itemstack2.isItemStackDamageable() && itemstack2.getItemDamage() > itemstack2.getMaxDamage() ) { MinecraftForge.EVENT_BUS.post( new PlayerDestroyItemEvent( thePlayer, itemstack2 ) ); - itemstack2 = null; + continue; } - if ( itemstack2 != null - && (!itemstack1.getItem().doesContainerItemLeaveCraftingGrid( itemstack1 ) || !this.thePlayer.inventory - .addItemStackToInventory( itemstack2 )) ) + if ( !itemstack1.getItem().doesContainerItemLeaveCraftingGrid( itemstack1 ) + || !this.thePlayer.inventory.addItemStackToInventory( itemstack2 ) ) { if ( this.craftMatrix.getStackInSlot( i ) == null ) { @@ -145,7 +157,7 @@ public class AppEngCraftingSlot extends AppEngSlot } else { - this.thePlayer.dropPlayerItem( itemstack2 ); + this.thePlayer.dropPlayerItemWithRandomChoice( itemstack2, false ); } } } diff --git a/container/slot/AppEngSlot.java b/container/slot/AppEngSlot.java index a4ea81e0..334f67f9 100644 --- a/container/slot/AppEngSlot.java +++ b/container/slot/AppEngSlot.java @@ -29,7 +29,7 @@ public class AppEngSlot extends Slot return this; } - public int icon = -1; + public int IIcon = -1; public hasCalculatedValidness isValid; public int defX, defY; @@ -53,7 +53,7 @@ public class AppEngSlot extends Slot public void onSlotChanged() { if ( inventory instanceof AppEngInternalInventory ) - ((AppEngInternalInventory) inventory).onInventoryChanged( getSlotIndex() ); + ((AppEngInternalInventory) inventory).markDirty( getSlotIndex() ); else super.onSlotChanged(); @@ -131,7 +131,7 @@ public class AppEngSlot extends Slot public int getIcon() { - return icon; + return IIcon; } public boolean isPlayerSide() diff --git a/container/slot/SlotOutput.java b/container/slot/SlotOutput.java index 4f7da7bd..fd73612c 100644 --- a/container/slot/SlotOutput.java +++ b/container/slot/SlotOutput.java @@ -8,7 +8,7 @@ public class SlotOutput extends AppEngSlot public SlotOutput(IInventory a, int b, int c, int d, int i) { super( a, b, c, d ); - icon = i; + IIcon = i; } @Override diff --git a/container/slot/SlotRestrictedInput.java b/container/slot/SlotRestrictedInput.java index 9a68661f..23d5f311 100644 --- a/container/slot/SlotRestrictedInput.java +++ b/container/slot/SlotRestrictedInput.java @@ -27,10 +27,10 @@ public class SlotRestrictedInput extends AppEngSlot 6 * 16 + 15), QE_SINGULARTIY(10 * 16 + 15), SPATIAL_STORAGE_CELLS(11 * 16 + 15), FUEL(12 * 16 + 15), UPGRADES(13 * 16 + 15), WORKBENCH_CELL(15), BIOMETRIC_CARD( 14 * 16 + 15); - public final int icon; + public final int IIcon; private PlaceableItemType(int o) { - icon = o; + IIcon = o; } }; @@ -66,7 +66,7 @@ public class SlotRestrictedInput extends AppEngSlot public SlotRestrictedInput(PlaceableItemType valid, IInventory i, int slotnum, int x, int y) { super( i, slotnum, x, y ); which = valid; - icon = valid.icon; + IIcon = valid.IIcon; } @Override diff --git a/core/AELog.java b/core/AELog.java index e8b57dc2..f163fe3b 100644 --- a/core/AELog.java +++ b/core/AELog.java @@ -1,6 +1,6 @@ package appeng.core; -import java.util.logging.Level; +import org.apache.logging.log4j.Level; import appeng.core.features.AEFeature; import appeng.util.Platform; @@ -24,12 +24,12 @@ public class AELog public static void severe(String format, Object... data) { - log( Level.SEVERE, format, data ); + log( Level.ERROR, format, data ); } public static void warning(String format, Object... data) { - log( Level.WARNING, format, data ); + log( Level.WARN, format, data ); } public static void info(String format, Object... data) @@ -39,7 +39,7 @@ public class AELog public static void grinder(String o) { - log( Level.FINEST, "grinder: " + o ); + log( Level.DEBUG, "grinder: " + o ); } public static void error(Throwable e) diff --git a/core/Api.java b/core/Api.java index e7224854..a72fca94 100644 --- a/core/Api.java +++ b/core/Api.java @@ -1,6 +1,6 @@ package appeng.core; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.IAppEngApi; import appeng.api.definitions.Blocks; import appeng.api.definitions.Items; diff --git a/core/AppEng.java b/core/AppEng.java index 73c35ce8..e3bc8a6b 100644 --- a/core/AppEng.java +++ b/core/AppEng.java @@ -1,11 +1,10 @@ package appeng.core; -import net.minecraft.item.ItemStack; import appeng.core.crash.CrashEnhancement; import appeng.core.crash.CrashInfo; import appeng.core.features.AEFeature; -import appeng.core.sync.AppEngClientPacketHandler; -import appeng.core.sync.AppEngServerPacketHandler; +import appeng.core.sync.GuiBridge; +import appeng.core.sync.network.NetworkHandler; import appeng.helpers.TickHandler; import appeng.integration.IntegrationRegistry; import appeng.integration.IntegrationSide; @@ -21,11 +20,9 @@ import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.event.FMLServerStartingEvent; import cpw.mods.fml.common.event.FMLServerStoppingEvent; -import cpw.mods.fml.common.network.NetworkMod; -import cpw.mods.fml.common.network.NetworkMod.SidedPacketHandler; +import cpw.mods.fml.common.network.NetworkRegistry; @Mod(modid = AppEng.modid, name = AppEng.name, version = Configuration.VERSION, dependencies = AppEng.dependencies) -@NetworkMod(clientSideRequired = true, serverSideRequired = true, clientPacketHandlerSpec = @SidedPacketHandler(channels = { Configuration.PACKET_CHANNEL }, packetHandler = AppEngClientPacketHandler.class), serverPacketHandlerSpec = @SidedPacketHandler(channels = (Configuration.PACKET_CHANNEL), packetHandler = AppEngServerPacketHandler.class)) public class AppEng { @@ -53,17 +50,6 @@ public class AppEng for (CrashInfo ci : CrashInfo.values()) FMLCommonHandler.instance().registerCrashCallable( new CrashEnhancement( ci ) ); - - // detect funny obfuscation issues? - try - { - new ItemStack( 1, 1, 0 ).getItemDamage(); - } - catch (Throwable t) - { - throw new Error( "AE2 is incompatible with this environment, please verify your using the correct version of AE2." ); - } - } private IntegrationRegistry integrationModules = new IntegrationRegistry( new Object[] { @@ -161,6 +147,9 @@ public class AppEng Configuration.instance.save(); + NetworkRegistry.INSTANCE.registerGuiHandler( this, GuiBridge.GUI_Handler ); + NetworkHandler.instance = new NetworkHandler( "AE2" ); + AELog.info( "PostInit ( end )" ); } diff --git a/core/CommonHelper.java b/core/CommonHelper.java index 5a952ed5..f5ac2cbe 100644 --- a/core/CommonHelper.java +++ b/core/CommonHelper.java @@ -4,9 +4,9 @@ import java.util.List; import java.util.Random; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.network.packet.Packet; import net.minecraft.world.World; import appeng.block.AEBaseBlock; +import appeng.core.sync.AppEngPacket; import cpw.mods.fml.common.SidedProxy; public abstract class CommonHelper @@ -23,7 +23,7 @@ public abstract class CommonHelper public abstract List getPlayers(); - public abstract void sendToAllNearExcept(EntityPlayer p, double x, double y, double z, double dist, World w, Packet packet); + public abstract void sendToAllNearExcept(EntityPlayer p, double x, double y, double z, double dist, World w, AppEngPacket packet); public abstract void spawnLightning(World worldObj, double posX, double posY, double posZ); diff --git a/core/Configuration.java b/core/Configuration.java index 63b9cede..1542e875 100644 --- a/core/Configuration.java +++ b/core/Configuration.java @@ -3,7 +3,7 @@ package appeng.core; import java.io.File; import java.util.EnumSet; -import net.minecraftforge.common.Property; +import net.minecraftforge.common.config.Property; import appeng.api.config.CondenserOuput; import appeng.api.config.PowerMultiplier; import appeng.api.config.PowerUnits; @@ -14,11 +14,10 @@ import appeng.api.config.YesNo; import appeng.api.util.IConfigManager; import appeng.api.util.IConfigureableObject; import appeng.core.features.AEFeature; -import appeng.core.features.AEFeatureHandler; import appeng.util.ConfigManager; import appeng.util.IConfigManagerHost; -public class Configuration extends net.minecraftforge.common.Configuration implements IConfigureableObject, IConfigManagerHost +public class Configuration extends net.minecraftforge.common.config.Configuration implements IConfigureableObject, IConfigManagerHost { public static Configuration instance; @@ -65,9 +64,6 @@ public class Configuration extends net.minecraftforge.common.Configuration imple public double spatialPowerScaler = 1.5; public double spatialPowerMultiplier = 1500.0; - private int blkBaseNumber = 900; - private int blkItemNumber = 3841; - public String grinderOres[] = { // Vanilla Items "Obsidian", "Ender", "Coal", "Iron", "Gold", "Charcoal", "NetherQuartz", @@ -123,9 +119,11 @@ public class Configuration extends net.minecraftforge.common.Configuration imple WirelessBaseCost = get( "wireless", "WirelessBaseCost", WirelessBaseCost ).getDouble( WirelessBaseCost ); WirelessCostMultiplier = get( "wireless", "WirelessCostMultiplier", WirelessCostMultiplier ).getDouble( WirelessCostMultiplier ); WirelessBaseRange = get( "wireless", "WirelessBaseRange", WirelessBaseRange ).getDouble( WirelessBaseRange ); - WirelessBoosterRangeMultiplier = get( "wireless", "WirelessBoosterRangeMultiplier", WirelessBoosterRangeMultiplier ).getDouble( WirelessBoosterRangeMultiplier ); + WirelessBoosterRangeMultiplier = get( "wireless", "WirelessBoosterRangeMultiplier", WirelessBoosterRangeMultiplier ).getDouble( + WirelessBoosterRangeMultiplier ); WirelessBoosterExp = get( "wireless", "WirelessBoosterExp", WirelessBoosterExp ).getDouble( WirelessBoosterExp ); - WirelessTerminalDrainMultiplier = get( "wireless", "WirelessTerminalDrainMultiplier", WirelessTerminalDrainMultiplier ).getDouble( WirelessTerminalDrainMultiplier ); + WirelessTerminalDrainMultiplier = get( "wireless", "WirelessTerminalDrainMultiplier", WirelessTerminalDrainMultiplier ).getDouble( + WirelessTerminalDrainMultiplier ); wireless_battery = get( "battery", "wireless", wireless_battery ).getInt( wireless_battery ); staff_battery = get( "battery", "staff", staff_battery ).getInt( staff_battery ); @@ -218,12 +216,14 @@ public class Configuration extends net.minecraftforge.common.Configuration imple public int getBlockID(Class c, String subname) { - return getBlock( AEFeatureHandler.getName( c, subname ), blkBaseNumber++ ).getInt(); + return 0; + // return getBlock( AEFeatureHandler.getName( c, subname ), blkBaseNumber++ ).getInt(); } public int getItemID(Class c, String subname) { - return getItem( AEFeatureHandler.getName( c, subname ), blkItemNumber++ ).getInt(); + return 0; + // return getItem( AEFeatureHandler.getName( c, subname ), blkItemNumber++ ).getInt(); } public boolean useTerminalUseLargeFont() diff --git a/core/CreativeTab.java b/core/CreativeTab.java index 922b5636..30ada923 100644 --- a/core/CreativeTab.java +++ b/core/CreativeTab.java @@ -1,7 +1,8 @@ package appeng.core; -import net.minecraft.block.Block; import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.init.Blocks; +import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import appeng.api.AEApi; import appeng.api.util.AEItemDefinition; @@ -15,11 +16,17 @@ public final class CreativeTab extends CreativeTabs super( "appliedenergistics2" ); } + @Override + public Item getTabIconItem() + { + return getIconItemStack().getItem(); + } + @Override public ItemStack getIconItemStack() { - return findFirst( AEApi.instance().blocks().blockController, AEApi.instance().blocks().blockChest, AEApi.instance().blocks().blockCellWorkbench, - AEApi.instance().blocks().blockFluix, AEApi.instance().items().itemCell1k, AEApi.instance().items().itemNetworkTool, + return findFirst( AEApi.instance().blocks().blockController, AEApi.instance().blocks().blockChest, AEApi.instance().blocks().blockCellWorkbench, AEApi + .instance().blocks().blockFluix, AEApi.instance().items().itemCell1k, AEApi.instance().items().itemNetworkTool, AEApi.instance().materials().materialFluixCrystal, AEApi.instance().materials().materialCertusQuartzCrystal ); } @@ -32,7 +39,7 @@ public final class CreativeTab extends CreativeTabs return is; } - return new ItemStack( Block.chest ); + return new ItemStack( Blocks.chest ); } public static void init() diff --git a/core/CreativeTabFacade.java b/core/CreativeTabFacade.java index c59caa2f..e0820e6d 100644 --- a/core/CreativeTabFacade.java +++ b/core/CreativeTabFacade.java @@ -1,6 +1,7 @@ package appeng.core; import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import appeng.api.AEApi; import appeng.items.parts.ItemFacade; @@ -14,6 +15,12 @@ public final class CreativeTabFacade extends CreativeTabs super( "appliedenergistics2.facades" ); } + @Override + public Item getTabIconItem() + { + return getIconItemStack().getItem(); + } + @Override public ItemStack getIconItemStack() { diff --git a/core/FacadeConfig.java b/core/FacadeConfig.java index 6a41a630..4862f893 100644 --- a/core/FacadeConfig.java +++ b/core/FacadeConfig.java @@ -6,11 +6,10 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; import net.minecraft.block.Block; -import net.minecraftforge.common.Configuration; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.GameRegistry.UniqueIdentifier; -public class FacadeConfig extends Configuration +public class FacadeConfig extends net.minecraftforge.common.config.Configuration { public static FacadeConfig instance; @@ -23,7 +22,7 @@ public class FacadeConfig extends Configuration public boolean checkEnabled(Block id, boolean automatic) { - if ( id == null || id.blockID == 0 ) + if ( id == null ) return false; UniqueIdentifier blk = GameRegistry.findUniqueIdentifierFor( id ); diff --git a/core/Registration.java b/core/Registration.java index 609494f9..99a6881f 100644 --- a/core/Registration.java +++ b/core/Registration.java @@ -69,7 +69,6 @@ import appeng.core.features.registries.entries.BasicCellHandler; import appeng.core.features.registries.entries.CreativeCellHandler; import appeng.core.localization.GuiText; import appeng.core.localization.PlayerMessages; -import appeng.core.sync.GuiBridge; import appeng.debug.BlockChunkloader; import appeng.debug.BlockItemGen; import appeng.debug.ToolDebugCard; @@ -114,14 +113,12 @@ import appeng.recipes.ores.OreDictionaryHandler; import com.google.common.collect.ArrayListMultimap; import com.google.common.collect.Multimap; +import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; -import cpw.mods.fml.common.network.NetworkRegistry; import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.common.registry.TickRegistry; import cpw.mods.fml.common.registry.VillagerRegistry; -import cpw.mods.fml.relauncher.Side; public class Registration { @@ -409,10 +406,7 @@ public class Registration ph.registerNewLayer( "appeng.api.parts.layers.LayerIFluidHandler", "net.minecraftforge.fluids.IFluidHandler" ); ph.registerNewLayer( "appeng.api.parts.layers.LayerITileStorageMonitorable", "appeng.api.implementations.tiles.ITileStorageMonitorable" ); - TickRegistry.registerTickHandler( TickHandler.instance, Side.SERVER ); - TickRegistry.registerTickHandler( TickHandler.instance, Side.CLIENT ); - - MinecraftForge.EVENT_BUS.register( TickHandler.instance ); + FMLCommonHandler.instance().bus().register( TickHandler.instance ); MinecraftForge.EVENT_BUS.register( new PartPlacement() ); IGridCacheRegistry gcr = AEApi.instance().registries().gridCache(); @@ -434,7 +428,7 @@ public class Registration // default settings.. ((P2PTunnelRegistry) AEApi.instance().registries().p2pTunnel()).configure(); - NetworkRegistry.instance().registerGuiHandler( AppEng.instance, GuiBridge.GUI_Handler ); + // NetworkRegistry.instance().registerGuiHandler( AppEng.instance, GuiBridge.GUI_Handler ); } public void PostInit(FMLPostInitializationEvent event) @@ -502,7 +496,7 @@ public class Registration VillagerRegistry.instance().registerVillageTradeHandler( 3, new AETrading() ); if ( Configuration.instance.isFeatureEnabled( AEFeature.CertusQuartzWorldGen ) ) - GameRegistry.registerWorldGenerator( new QuartzWorldGen() ); + GameRegistry.registerWorldGenerator( new QuartzWorldGen(), 0 ); } } diff --git a/core/WorldSettings.java b/core/WorldSettings.java index bac599e0..d85e7cb0 100644 --- a/core/WorldSettings.java +++ b/core/WorldSettings.java @@ -5,14 +5,13 @@ import java.lang.ref.WeakReference; import java.util.Map.Entry; import java.util.WeakHashMap; -import net.minecraftforge.common.ConfigCategory; -import net.minecraftforge.common.Configuration; +import net.minecraft.entity.player.EntityPlayer; import net.minecraftforge.common.DimensionManager; -import net.minecraftforge.common.Property; +import net.minecraftforge.common.config.ConfigCategory; +import net.minecraftforge.common.config.Property; import appeng.api.util.WorldCoord; import appeng.me.GridStorage; import appeng.me.GridStorageSearch; -import cpw.mods.fml.common.network.Player; public class WorldSettings extends Configuration { @@ -47,7 +46,7 @@ public class WorldSettings extends Configuration return instance; } - public void sendToPlayer(Player player) + public void sendToPlayer(EntityPlayer player) { } diff --git a/core/api/ApiPart.java b/core/api/ApiPart.java index 5fb782c8..4a0385b7 100644 --- a/core/api/ApiPart.java +++ b/core/api/ApiPart.java @@ -1,5 +1,6 @@ package appeng.core.api; +import java.io.IOException; import java.io.InputStream; import java.util.HashMap; import java.util.Iterator; @@ -65,8 +66,10 @@ public class ApiPart implements IPartHelper ClassLoader loader = getClass().getClassLoader();// ClassLoader.getSystemClassLoader(); Class root = ClassLoader.class; Class cls = loader.getClass(); - java.lang.reflect.Method defineClassMethod = root.getDeclaredMethod( "defineClass", new Class[] { String.class, byte[].class, int.class, int.class } ); - java.lang.reflect.Method runTransformersMethod = cls.getDeclaredMethod( "runTransformers", new Class[] { String.class, String.class, byte[].class } ); + java.lang.reflect.Method defineClassMethod = root.getDeclaredMethod( "defineClass", + new Class[] { String.class, byte[].class, int.class, int.class } ); + java.lang.reflect.Method runTransformersMethod = cls + .getDeclaredMethod( "runTransformers", new Class[] { String.class, String.class, byte[].class } ); runTransformersMethod.setAccessible( true ); defineClassMethod.setAccessible( true ); @@ -92,40 +95,19 @@ public class ApiPart implements IPartHelper return clazz; } - public ClassNode getReader(String name) + public ClassNode getReader(String name) throws IOException { - // if ( readerCache.get( name ) != null ) - // return readerCache.get( name ); - ClassReader cr; - try - { - String path = "/" + name.replace( ".", "/" ) + ".class"; - InputStream is = getClass().getResourceAsStream( path ); - cr = new ClassReader( is ); - ClassNode cn = new ClassNode(); - cr.accept( cn, ClassReader.EXPAND_FRAMES ); - // readerCache.put( name, cn ); - return cn; - } - catch (Throwable e) - { - AELog.error( e ); - } - - return null; + String path = "/" + name.replace( ".", "/" ) + ".class"; + InputStream is = getClass().getResourceAsStream( path ); + cr = new ClassReader( is ); + ClassNode cn = new ClassNode(); + cr.accept( cn, ClassReader.EXPAND_FRAMES ); + return cn; } - public Class getCombinedInstance(String base)// , CableBusContainer cbc) + public Class getCombinedInstance(String base) { - /* - * List desc = new LinkedList(); for (ForgeDirection side : - * ForgeDirection.values()) { IBusPart part = cbc.getPart( side ); if ( - * part != null ) { for (Class c : interfaces2Layer.keySet()) { if ( - * c.isInstance( part ) ) desc.add( interfaces2Layer.get( c ).getName() - * ); } } } - */ - if ( desc.size() == 0 ) { try @@ -177,14 +159,16 @@ public class ApiPart implements IPartHelper for (String name : desc) { - path = path + ";" + name; try { - myCLass = getClassByDesc( Addendum, path, f, interfaces2Layer.get( Class.forName( name ) ) ); + String newPath = path + ";" + name; + myCLass = getClassByDesc( Addendum, newPath, f, interfaces2Layer.get( Class.forName( name ) ) ); + path = newPath; } catch (Throwable t) { - throw new RuntimeException( t ); + AELog.error( t ); + // throw new RuntimeException( t ); } f = myCLass.getName(); } @@ -217,7 +201,7 @@ public class ApiPart implements IPartHelper } - public Class getClassByDesc(String Addendum, String fullPath, String root, String next) + public Class getClassByDesc(String Addendum, String fullPath, String root, String next) throws IOException { if ( roots.get( fullPath ) != null ) return roots.get( fullPath ); @@ -225,6 +209,7 @@ public class ApiPart implements IPartHelper ClassWriter cw = new ClassWriter( ClassWriter.COMPUTE_MAXS ); ClassNode n = getReader( next ); String originalName = n.name; + try { n.name = n.name + "_" + Addendum; @@ -321,7 +306,7 @@ public class ApiPart implements IPartHelper public void setItemBusRenderer(IPartItem i) { if ( Platform.isClient() && i instanceof Item ) - MinecraftForgeClient.registerItemRenderer( ((Item) i).itemID, BusRenderer.instance ); + MinecraftForgeClient.registerItemRenderer( (Item) i, BusRenderer.instance ); } @Override diff --git a/core/api/ApiStorage.java b/core/api/ApiStorage.java index 5b0bea17..3e1125d9 100644 --- a/core/api/ApiStorage.java +++ b/core/api/ApiStorage.java @@ -1,6 +1,7 @@ package appeng.core.api; -import java.io.DataInputStream; +import io.netty.buffer.ByteBuf; + import java.io.IOException; import net.minecraft.item.ItemStack; @@ -51,13 +52,13 @@ public class ApiStorage implements IStorageHelper } @Override - public IAEItemStack readItemFromPacket(DataInputStream input) throws IOException + public IAEItemStack readItemFromPacket(ByteBuf input) throws IOException { return AEItemStack.loadItemStackFromPacket( input ); } @Override - public IAEFluidStack readFluidFromPacket(DataInputStream input) throws IOException + public IAEFluidStack readFluidFromPacket(ByteBuf input) throws IOException { return AEFluidStack.loadFluidStackFromPacket( input ); } diff --git a/core/features/AEFeatureHandler.java b/core/features/AEFeatureHandler.java index 791712f2..b912b7e1 100644 --- a/core/features/AEFeatureHandler.java +++ b/core/features/AEFeatureHandler.java @@ -27,7 +27,6 @@ public class AEFeatureHandler implements AEItemDefinition private Item ItemData; private Block BlockData; - private ItemStack StackData; public AEFeatureHandler(EnumSet featureSet, IAEFeature _obj, String _subname) { myFeatures = featureSet; @@ -71,7 +70,6 @@ public class AEFeatureHandler implements AEItemDefinition private void initItem(Item i) { ItemData = i; - StackData = new ItemStack( i ); String name = getName( i.getClass(), subname ); i.setTextureName( "appliedenergistics2:" + name ); @@ -88,12 +86,11 @@ public class AEFeatureHandler implements AEItemDefinition private void initBlock(Block b) { BlockData = b; - StackData = new ItemStack( b ); String name = getName( b.getClass(), subname ); b.setCreativeTab( CreativeTab.instance ); - b.setUnlocalizedName( /* "tile." */"appliedenergistics2." + name ); - b.setTextureName( "appliedenergistics2:" + name ); + b.setBlockName( /* "tile." */"appliedenergistics2." + name ); + b.setBlockTextureName( "appliedenergistics2:" + name ); if ( Platform.isClient() && BlockData instanceof AEBaseBlock ) { @@ -152,7 +149,13 @@ public class AEFeatureHandler implements AEItemDefinition { if ( isFeatureAvailable() ) { - ItemStack rv = StackData.copy(); + ItemStack rv = null; + + if ( ItemData != null ) + rv = new ItemStack( ItemData ); + else + rv = new ItemStack( BlockData ); + rv.stackSize = stackSize; return rv; } @@ -163,7 +166,7 @@ public class AEFeatureHandler implements AEItemDefinition public boolean sameAs(ItemStack is) { if ( isFeatureAvailable() ) - return Platform.isSameItemType( is, StackData ); + return Platform.isSameItemType( is, stack( 1 ) ); return false; } diff --git a/core/features/registries/ExternalStorageRegistry.java b/core/features/registries/ExternalStorageRegistry.java index 6a6d75ab..cd7762e6 100644 --- a/core/features/registries/ExternalStorageRegistry.java +++ b/core/features/registries/ExternalStorageRegistry.java @@ -4,7 +4,7 @@ import java.util.ArrayList; import java.util.List; import net.minecraft.tileentity.TileEntity; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.storage.IExternalStorageHandler; import appeng.api.storage.IExternalStorageRegistry; import appeng.api.storage.StorageChannel; diff --git a/core/features/registries/GrinderRecipeManager.java b/core/features/registries/GrinderRecipeManager.java index 23c0a84b..b58dfb49 100644 --- a/core/features/registries/GrinderRecipeManager.java +++ b/core/features/registries/GrinderRecipeManager.java @@ -6,8 +6,8 @@ import java.util.List; import java.util.Map; import java.util.Map.Entry; -import net.minecraft.block.Block; -import net.minecraft.item.Item; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import appeng.api.features.IGrinderEntry; import appeng.api.features.IGrinderRegistry; @@ -33,22 +33,22 @@ public class GrinderRecipeManager implements IGrinderRegistry, IOreListener public GrinderRecipeManager() { RecipeList = new ArrayList(); - addOre( "Coal", new ItemStack( Item.coal ) ); - addOre( "Charcoal", new ItemStack( Item.coal, 1, 1 ) ); + addOre( "Coal", new ItemStack( Items.coal ) ); + addOre( "Charcoal", new ItemStack( Items.coal, 1, 1 ) ); - addOre( "NetherQuartz", new ItemStack( Block.oreNetherQuartz ) ); - addIngot( "NetherQuartz", new ItemStack( Item.netherQuartz ) ); + addOre( "NetherQuartz", new ItemStack( Blocks.quartz_ore ) ); + addIngot( "NetherQuartz", new ItemStack( Items.quartz ) ); - addOre( "Gold", new ItemStack( Block.oreGold ) ); - addIngot( "Gold", new ItemStack( Item.ingotGold ) ); + addOre( "Gold", new ItemStack( Blocks.gold_ore ) ); + addIngot( "Gold", new ItemStack( Items.gold_ingot ) ); - addOre( "Iron", new ItemStack( Block.oreIron ) ); - addIngot( "Iron", new ItemStack( Item.ingotIron ) ); + addOre( "Iron", new ItemStack( Blocks.iron_ore ) ); + addIngot( "Iron", new ItemStack( Items.iron_ingot ) ); - addOre( "Obsidian", new ItemStack( Block.obsidian ) ); - addIngot( "Ender", new ItemStack( Item.enderPearl ) ); + addOre( "Obsidian", new ItemStack( Blocks.obsidian ) ); + addIngot( "Ender", new ItemStack( Items.ender_pearl ) ); - addIngot( "Wheat", new ItemStack( Item.wheat ) ); + addIngot( "Wheat", new ItemStack( Items.wheat ) ); OreDictionaryHandler.instance.observe( this ); } diff --git a/core/features/registries/LocateableRegistry.java b/core/features/registries/LocateableRegistry.java index 3b50997f..c27c7b7f 100644 --- a/core/features/registries/LocateableRegistry.java +++ b/core/features/registries/LocateableRegistry.java @@ -3,19 +3,19 @@ package appeng.core.features.registries; import java.util.HashMap; import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.event.ForgeSubscribe; import appeng.api.events.LocatableEventAnnounce; import appeng.api.events.LocatableEventAnnounce.LocatableEvent; import appeng.api.features.ILocatable; import appeng.api.features.ILocateableRegistry; import appeng.util.Platform; +import cpw.mods.fml.common.eventhandler.SubscribeEvent; public class LocateableRegistry implements ILocateableRegistry { private HashMap set; - @ForgeSubscribe + @SubscribeEvent public void updateLocateable(LocatableEventAnnounce e) { if ( Platform.isClient() ) diff --git a/core/features/registries/MatterCannonAmmoRegistry.java b/core/features/registries/MatterCannonAmmoRegistry.java index 43c9aa23..ece12374 100644 --- a/core/features/registries/MatterCannonAmmoRegistry.java +++ b/core/features/registries/MatterCannonAmmoRegistry.java @@ -2,7 +2,7 @@ package appeng.core.features.registries; import java.util.HashMap; -import net.minecraft.item.Item; +import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import appeng.api.features.IMatterCannonAmmoRegistry; import appeng.recipes.ores.IOreListener; @@ -109,7 +109,7 @@ public class MatterCannonAmmoRegistry implements IOreListener, IMatterCannonAmmo public MatterCannonAmmoRegistry() { OreDictionaryHandler.instance.observe( this ); - registerAmmo( new ItemStack( Item.goldNugget ), 196.96655 ); + registerAmmo( new ItemStack( Items.gold_nugget ), 196.96655 ); } @Override diff --git a/core/features/registries/P2PTunnelRegistry.java b/core/features/registries/P2PTunnelRegistry.java index 08c29022..9bd13afc 100644 --- a/core/features/registries/P2PTunnelRegistry.java +++ b/core/features/registries/P2PTunnelRegistry.java @@ -2,13 +2,12 @@ package appeng.core.features.registries; import java.util.HashMap; -import net.minecraft.block.Block; -import net.minecraft.item.Item; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidContainerRegistry; import appeng.api.AEApi; import appeng.api.config.TunnelType; -import appeng.api.definitions.Blocks; import appeng.api.definitions.Parts; import appeng.api.features.IP2PTunnelRegistry; import appeng.api.util.AEColor; @@ -24,41 +23,40 @@ public class P2PTunnelRegistry implements IP2PTunnelRegistry /** * attune based on most redstone base items. */ - addNewAttunement( new ItemStack( Item.redstone ), TunnelType.REDSTONE ); - addNewAttunement( new ItemStack( Item.redstoneRepeater ), TunnelType.REDSTONE ); - addNewAttunement( new ItemStack( Block.redstoneLampActive ), TunnelType.REDSTONE ); - addNewAttunement( new ItemStack( Block.redstoneLampIdle ), TunnelType.REDSTONE ); - addNewAttunement( new ItemStack( Block.redstoneComparatorActive ), TunnelType.REDSTONE ); - addNewAttunement( new ItemStack( Block.redstoneComparatorIdle ), TunnelType.REDSTONE ); - addNewAttunement( new ItemStack( Block.redstoneRepeaterActive ), TunnelType.REDSTONE ); - addNewAttunement( new ItemStack( Block.redstoneRepeaterIdle ), TunnelType.REDSTONE ); - addNewAttunement( new ItemStack( Block.daylightSensor ), TunnelType.REDSTONE ); - addNewAttunement( new ItemStack( Block.redstoneWire ), TunnelType.REDSTONE ); - addNewAttunement( new ItemStack( Block.blockRedstone ), TunnelType.REDSTONE ); - addNewAttunement( new ItemStack( Block.lever ), TunnelType.REDSTONE ); + addNewAttunement( new ItemStack( Items.redstone ), TunnelType.REDSTONE ); + addNewAttunement( new ItemStack( Items.repeater ), TunnelType.REDSTONE ); + addNewAttunement( new ItemStack( Blocks.redstone_lamp ), TunnelType.REDSTONE ); + addNewAttunement( new ItemStack( Blocks.unpowered_comparator ), TunnelType.REDSTONE ); + addNewAttunement( new ItemStack( Blocks.powered_comparator ), TunnelType.REDSTONE ); + addNewAttunement( new ItemStack( Blocks.powered_repeater ), TunnelType.REDSTONE ); + addNewAttunement( new ItemStack( Blocks.unpowered_repeater ), TunnelType.REDSTONE ); + addNewAttunement( new ItemStack( Blocks.daylight_detector ), TunnelType.REDSTONE ); + addNewAttunement( new ItemStack( Blocks.redstone_wire ), TunnelType.REDSTONE ); + addNewAttunement( new ItemStack( Blocks.redstone_block ), TunnelType.REDSTONE ); + addNewAttunement( new ItemStack( Blocks.lever ), TunnelType.REDSTONE ); /** * attune based on lots of random item related stuff */ - Blocks Blocks = AEApi.instance().blocks(); + appeng.api.definitions.Blocks AEBlocks = AEApi.instance().blocks(); Parts Parts = AEApi.instance().parts(); - addNewAttunement( Blocks.blockInterface.stack( 1 ), TunnelType.ITEM ); + addNewAttunement( AEBlocks.blockInterface.stack( 1 ), TunnelType.ITEM ); addNewAttunement( Parts.partInterface.stack( 1 ), TunnelType.ITEM ); addNewAttunement( Parts.partStorageBus.stack( 1 ), TunnelType.ITEM ); addNewAttunement( Parts.partImportBus.stack( 1 ), TunnelType.ITEM ); addNewAttunement( Parts.partExportBus.stack( 1 ), TunnelType.ITEM ); - addNewAttunement( new ItemStack( Block.hopperBlock ), TunnelType.ITEM ); - addNewAttunement( new ItemStack( Block.chest ), TunnelType.ITEM ); - addNewAttunement( new ItemStack( Block.chestTrapped ), TunnelType.ITEM ); + addNewAttunement( new ItemStack( Blocks.hopper ), TunnelType.ITEM ); + addNewAttunement( new ItemStack( Blocks.chest ), TunnelType.ITEM ); + addNewAttunement( new ItemStack( Blocks.trapped_chest ), TunnelType.ITEM ); /** * attune based on lots of random item related stuff */ - addNewAttunement( new ItemStack( Item.bucketEmpty ), TunnelType.FLUID ); - addNewAttunement( new ItemStack( Item.bucketLava ), TunnelType.FLUID ); - addNewAttunement( new ItemStack( Item.bucketMilk ), TunnelType.FLUID ); - addNewAttunement( new ItemStack( Item.bucketWater ), TunnelType.FLUID ); + addNewAttunement( new ItemStack( Items.bucket ), TunnelType.FLUID ); + addNewAttunement( new ItemStack( Items.lava_bucket ), TunnelType.FLUID ); + addNewAttunement( new ItemStack( Items.milk_bucket ), TunnelType.FLUID ); + addNewAttunement( new ItemStack( Items.water_bucket ), TunnelType.FLUID ); for (AEColor c : AEColor.values()) { diff --git a/core/features/registries/PlayerRegistry.java b/core/features/registries/PlayerRegistry.java index 30043c95..0104439d 100644 --- a/core/features/registries/PlayerRegistry.java +++ b/core/features/registries/PlayerRegistry.java @@ -16,7 +16,7 @@ public class PlayerRegistry implements IPlayerRegistry @Override public int getID(EntityPlayer player) { - return WorldSettings.getInstance().getPlayerID( player.username ); + return WorldSettings.getInstance().getPlayerID( player.getCommandSenderName() ); } @Override diff --git a/core/features/registries/WirelessRegistry.java b/core/features/registries/WirelessRegistry.java index 7f77ac56..4296a146 100644 --- a/core/features/registries/WirelessRegistry.java +++ b/core/features/registries/WirelessRegistry.java @@ -5,6 +5,7 @@ import java.util.List; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; +import net.minecraft.util.ChatComponentText; import net.minecraft.world.World; import appeng.api.features.IWirelessTermHandler; import appeng.api.features.IWirelessTermRegistery; @@ -59,7 +60,7 @@ public class WirelessRegistry implements IWirelessTermRegistery IWirelessTermHandler handler = getWirelessTerminalHandler( item ); if ( handler == null ) { - player.addChatMessage( "Item is not a wireless terminal." ); + player.addChatMessage( new ChatComponentText( "Item is not a wireless terminal." ) ); return; } @@ -68,7 +69,7 @@ public class WirelessRegistry implements IWirelessTermRegistery Platform.openGUI( player, null, null, GuiBridge.GUI_WIRELESS_TERM ); } else - player.sendChatToPlayer( PlayerMessages.DeviceNotPowered.get() ); + player.addChatMessage( PlayerMessages.DeviceNotPowered.get() ); } diff --git a/core/features/registries/entries/BasicCellHandler.java b/core/features/registries/entries/BasicCellHandler.java index 254749b7..3d0defc8 100644 --- a/core/features/registries/entries/BasicCellHandler.java +++ b/core/features/registries/entries/BasicCellHandler.java @@ -2,7 +2,7 @@ package appeng.core.features.registries.entries; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; -import net.minecraft.util.Icon; +import net.minecraft.util.IIcon; import appeng.api.implementations.tiles.IChestOrDrive; import appeng.api.storage.ICellHandler; import appeng.api.storage.IMEInventory; @@ -33,7 +33,7 @@ public class BasicCellHandler implements ICellHandler } @Override - public Icon getTopTexture() + public IIcon getTopTexture() { return ExtraTextures.BlockMEChestItems.getIcon(); } diff --git a/core/features/registries/entries/CreativeCellHandler.java b/core/features/registries/entries/CreativeCellHandler.java index 42f269a3..bdfa11f9 100644 --- a/core/features/registries/entries/CreativeCellHandler.java +++ b/core/features/registries/entries/CreativeCellHandler.java @@ -2,7 +2,7 @@ package appeng.core.features.registries.entries; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; -import net.minecraft.util.Icon; +import net.minecraft.util.IIcon; import appeng.api.implementations.tiles.IChestOrDrive; import appeng.api.storage.ICellHandler; import appeng.api.storage.IMEInventory; @@ -33,7 +33,7 @@ public class CreativeCellHandler implements ICellHandler } @Override - public Icon getTopTexture() + public IIcon getTopTexture() { return ExtraTextures.BlockMEChestItems.getIcon(); } diff --git a/core/localization/PlayerMessages.java b/core/localization/PlayerMessages.java index 88ed8edf..56bb615b 100644 --- a/core/localization/PlayerMessages.java +++ b/core/localization/PlayerMessages.java @@ -1,6 +1,7 @@ package appeng.core.localization; -import net.minecraft.util.ChatMessageComponent; +import net.minecraft.util.ChatComponentTranslation; +import net.minecraft.util.IChatComponent; public enum PlayerMessages { @@ -13,9 +14,9 @@ public enum PlayerMessages return "chat.appliedenergistics2." + toString(); } - public ChatMessageComponent get() + public IChatComponent get() { - return ChatMessageComponent.createFromTranslationKey( getName() ); + return new ChatComponentTranslation( getName() ); } } diff --git a/core/sync/AppEngClientPacketHandler.java b/core/sync/AppEngClientPacketHandler.java deleted file mode 100644 index ff909826..00000000 --- a/core/sync/AppEngClientPacketHandler.java +++ /dev/null @@ -1,53 +0,0 @@ -package appeng.core.sync; - -import java.io.ByteArrayInputStream; -import java.io.DataInputStream; -import java.io.IOException; -import java.lang.reflect.InvocationTargetException; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.network.INetworkManager; -import net.minecraft.network.packet.Packet250CustomPayload; -import appeng.core.AELog; -import cpw.mods.fml.common.network.IPacketHandler; -import cpw.mods.fml.common.network.Player; - -public class AppEngClientPacketHandler extends AppEngPacketHandlerBase implements IPacketHandler -{ - - @Override - public void onPacketData(INetworkManager network, Packet250CustomPayload packet, Player player) - { - DataInputStream stream = new DataInputStream( new ByteArrayInputStream( packet.data ) ); - // Determine packet type and coordinates of affected tile entity - int packetType = -1; - - try - { - packetType = stream.readInt(); - AppEngPacket pack = PacketTypes.getPacket( packetType ).parsePacket( stream ); - pack.clientPacketData( network, pack, (EntityPlayer) player ); - } - catch (IOException e) - { - AELog.error( e ); - } - catch (InstantiationException e) - { - AELog.error( e ); - } - catch (IllegalAccessException e) - { - AELog.error( e ); - } - catch (IllegalArgumentException e) - { - AELog.error( e ); - } - catch (InvocationTargetException e) - { - AELog.error( e ); - } - - } -} diff --git a/core/sync/AppEngConnectionHandler.java b/core/sync/AppEngConnectionHandler.java deleted file mode 100644 index a262b47a..00000000 --- a/core/sync/AppEngConnectionHandler.java +++ /dev/null @@ -1,49 +0,0 @@ -package appeng.core.sync; - -import net.minecraft.network.INetworkManager; -import net.minecraft.network.NetLoginHandler; -import net.minecraft.network.packet.NetHandler; -import net.minecraft.network.packet.Packet1Login; -import net.minecraft.server.MinecraftServer; -import appeng.core.WorldSettings; -import cpw.mods.fml.common.network.IConnectionHandler; -import cpw.mods.fml.common.network.Player; - -public class AppEngConnectionHandler implements IConnectionHandler -{ - - @Override - public void playerLoggedIn(Player player, NetHandler netHandler, INetworkManager manager) - { - WorldSettings.getInstance().sendToPlayer( player ); - } - - @Override - public String connectionReceived(NetLoginHandler netHandler, INetworkManager manager) - { - return null; - } - - @Override - public void connectionOpened(NetHandler netClientHandler, String server, int port, INetworkManager manager) - { - } - - @Override - public void connectionOpened(NetHandler netClientHandler, MinecraftServer server, INetworkManager manager) - { - - } - - @Override - public void connectionClosed(INetworkManager manager) - { - - } - - @Override - public void clientLoggedIn(NetHandler clientHandler, INetworkManager manager, Packet1Login login) - { - } - -} diff --git a/core/sync/AppEngPacket.java b/core/sync/AppEngPacket.java index d8d1bf6a..3eea3a8c 100644 --- a/core/sync/AppEngPacket.java +++ b/core/sync/AppEngPacket.java @@ -1,15 +1,15 @@ package appeng.core.sync; +import io.netty.buffer.ByteBuf; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.network.INetworkManager; -import net.minecraft.network.packet.Packet250CustomPayload; -import appeng.core.Configuration; +import appeng.core.sync.network.INetworkInfo; +import appeng.core.sync.network.NetworkHandler; +import cpw.mods.fml.common.network.internal.FMLProxyPacket; public abstract class AppEngPacket { - private Packet250CustomPayload p; - protected boolean isChunkDataPacket; + private ByteBuf p; AppEngPacketHandlerBase.PacketTypes id; @@ -18,26 +18,24 @@ public abstract class AppEngPacket return AppEngPacketHandlerBase.PacketTypes.getID( this.getClass() ).ordinal(); } - public void serverPacketData(INetworkManager manager, AppEngPacket packet, EntityPlayer player) + public void serverPacketData(INetworkInfo manager, AppEngPacket packet, EntityPlayer player) { throw new RuntimeException( "This packet ( " + getPacketID() + " does not implement a server side handler." ); } - public void clientPacketData(INetworkManager network, AppEngPacket packet, EntityPlayer player) + public void clientPacketData(INetworkInfo network, AppEngPacket packet, EntityPlayer player) { throw new RuntimeException( "This packet ( " + getPacketID() + " does not implement a client side handler." ); } - public Packet250CustomPayload getPacket() + protected void configureWrite(ByteBuf data) { - // / += p.getPacketSize(); - return p; + p = data; } - protected void configureWrite(byte[] par2ArrayOfByte) + public FMLProxyPacket getProxy() { - p = new Packet250CustomPayload( Configuration.PACKET_CHANNEL, par2ArrayOfByte ); - p.isChunkDataPacket = isChunkDataPacket; + return new FMLProxyPacket( p, NetworkHandler.instance.getChannel() ); } } diff --git a/core/sync/AppEngPacketHandlerBase.java b/core/sync/AppEngPacketHandlerBase.java index 7adac36f..a582d6e1 100644 --- a/core/sync/AppEngPacketHandlerBase.java +++ b/core/sync/AppEngPacketHandlerBase.java @@ -1,6 +1,7 @@ package appeng.core.sync; -import java.io.DataInputStream; +import io.netty.buffer.ByteBuf; + import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; import java.util.HashMap; @@ -9,7 +10,6 @@ import java.util.Map; import appeng.core.sync.packets.PacketConfigButton; import appeng.core.sync.packets.PacketInventoryAction; import appeng.core.sync.packets.PacketLightning; -import appeng.core.sync.packets.PacketLocalizedChatMsg; import appeng.core.sync.packets.PacketMEInventoryUpdate; import appeng.core.sync.packets.PacketMatterCannon; import appeng.core.sync.packets.PacketMockExplosion; @@ -41,8 +41,6 @@ public class AppEngPacketHandlerBase PACKET_MOCKEXPLOSION(PacketMockExplosion.class), - PACKET_LOCALIZED_CHATMSG(PacketLocalizedChatMsg.class), - PACKET_VALUE_CONFIG(PacketValueConfig.class), PACKET_SWITCH_GUIS(PacketSwitchGuis.class); @@ -56,7 +54,7 @@ public class AppEngPacketHandlerBase Constructor x = null; try { - x = pc.getConstructor( DataInputStream.class ); + x = pc.getConstructor( ByteBuf.class ); } catch (NoSuchMethodException e) { @@ -72,7 +70,7 @@ public class AppEngPacketHandlerBase throw new RuntimeException( "Invalid Packet Class, must be constructable on DataInputStream" ); } - AppEngPacket parsePacket(DataInputStream in) throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException + public AppEngPacket parsePacket(ByteBuf in) throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException { return (AppEngPacket) con.newInstance( in ); } diff --git a/core/sync/GuiBridge.java b/core/sync/GuiBridge.java index 7724316c..73ce7b6c 100644 --- a/core/sync/GuiBridge.java +++ b/core/sync/GuiBridge.java @@ -7,7 +7,7 @@ import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.AEApi; import appeng.api.config.SecurityPermissions; import appeng.api.exceptions.AppEngException; @@ -231,7 +231,7 @@ public enum GuiBridge implements IGuiHandler } else { - TileEntity TE = w.getBlockTileEntity( x, y, z ); + TileEntity TE = w.getTileEntity( x, y, z ); if ( TE instanceof IPartHost ) { ((IPartHost) TE).getPart( side ); @@ -286,7 +286,7 @@ public enum GuiBridge implements IGuiHandler } else { - TileEntity TE = w.getBlockTileEntity( x, y, z ); + TileEntity TE = w.getTileEntity( x, y, z ); if ( TE instanceof IPartHost ) { @@ -325,7 +325,7 @@ public enum GuiBridge implements IGuiHandler } else { - TileEntity TE = w.getBlockTileEntity( x, y, z ); + TileEntity TE = w.getTileEntity( x, y, z ); if ( TE instanceof IPartHost ) { ((IPartHost) TE).getPart( side ); diff --git a/core/sync/network/AppEngClientPacketHandler.java b/core/sync/network/AppEngClientPacketHandler.java new file mode 100644 index 00000000..591a8d03 --- /dev/null +++ b/core/sync/network/AppEngClientPacketHandler.java @@ -0,0 +1,46 @@ +package appeng.core.sync.network; + +import io.netty.buffer.ByteBuf; + +import java.lang.reflect.InvocationTargetException; + +import net.minecraft.entity.player.EntityPlayer; +import appeng.core.AELog; +import appeng.core.sync.AppEngPacket; +import appeng.core.sync.AppEngPacketHandlerBase; +import cpw.mods.fml.common.network.internal.FMLProxyPacket; + +public class AppEngClientPacketHandler extends AppEngPacketHandlerBase implements IPacketHandler +{ + + @Override + public void onPacketData(INetworkInfo network, FMLProxyPacket packet, EntityPlayer player) + { + ByteBuf stream = packet.payload(); + int packetType = -1; + + try + { + packetType = stream.readInt(); + AppEngPacket pack = PacketTypes.getPacket( packetType ).parsePacket( stream ); + pack.clientPacketData( network, pack, player ); + } + catch (InstantiationException e) + { + AELog.error( e ); + } + catch (IllegalAccessException e) + { + AELog.error( e ); + } + catch (IllegalArgumentException e) + { + AELog.error( e ); + } + catch (InvocationTargetException e) + { + AELog.error( e ); + } + + } +} diff --git a/core/sync/AppEngServerPacketHandler.java b/core/sync/network/AppEngServerPacketHandler.java similarity index 53% rename from core/sync/AppEngServerPacketHandler.java rename to core/sync/network/AppEngServerPacketHandler.java index 60beb027..0b855b02 100644 --- a/core/sync/AppEngServerPacketHandler.java +++ b/core/sync/network/AppEngServerPacketHandler.java @@ -1,25 +1,22 @@ -package appeng.core.sync; +package appeng.core.sync.network; + +import io.netty.buffer.ByteBuf; -import java.io.ByteArrayInputStream; -import java.io.DataInputStream; -import java.io.IOException; import java.lang.reflect.InvocationTargetException; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.network.INetworkManager; -import net.minecraft.network.packet.Packet250CustomPayload; import appeng.core.AELog; -import cpw.mods.fml.common.network.IPacketHandler; -import cpw.mods.fml.common.network.Player; +import appeng.core.sync.AppEngPacket; +import appeng.core.sync.AppEngPacketHandlerBase; +import cpw.mods.fml.common.network.internal.FMLProxyPacket; public final class AppEngServerPacketHandler extends AppEngPacketHandlerBase implements IPacketHandler { @Override - public void onPacketData(INetworkManager manager, Packet250CustomPayload packet, Player player) + public void onPacketData(INetworkInfo manager, FMLProxyPacket packet, EntityPlayer player) { - DataInputStream stream = new DataInputStream( new ByteArrayInputStream( packet.data ) ); - // Determine packet type and coordinates of affected tile entity + ByteBuf stream = packet.payload(); int packetType = -1; try @@ -28,10 +25,6 @@ public final class AppEngServerPacketHandler extends AppEngPacketHandlerBase imp AppEngPacket pack = PacketTypes.getPacket( packetType ).parsePacket( stream ); pack.serverPacketData( manager, pack, (EntityPlayer) player ); } - catch (IOException e) - { - AELog.error( e ); - } catch (InstantiationException e) { AELog.error( e ); diff --git a/core/sync/network/INetworkInfo.java b/core/sync/network/INetworkInfo.java new file mode 100644 index 00000000..8e5f8251 --- /dev/null +++ b/core/sync/network/INetworkInfo.java @@ -0,0 +1,7 @@ +package appeng.core.sync.network; + + +public interface INetworkInfo +{ + +} diff --git a/core/sync/network/IPacketHandler.java b/core/sync/network/IPacketHandler.java new file mode 100644 index 00000000..747d86f5 --- /dev/null +++ b/core/sync/network/IPacketHandler.java @@ -0,0 +1,11 @@ +package appeng.core.sync.network; + +import net.minecraft.entity.player.EntityPlayer; +import cpw.mods.fml.common.network.internal.FMLProxyPacket; + +public interface IPacketHandler +{ + + void onPacketData(INetworkInfo manager, FMLProxyPacket packet, EntityPlayer player); + +} diff --git a/core/sync/network/NetworkHandler.java b/core/sync/network/NetworkHandler.java new file mode 100644 index 00000000..3560e657 --- /dev/null +++ b/core/sync/network/NetworkHandler.java @@ -0,0 +1,82 @@ +package appeng.core.sync.network; + +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.network.NetHandlerPlayServer; +import appeng.core.WorldSettings; +import appeng.core.sync.AppEngPacket; +import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import cpw.mods.fml.common.gameevent.PlayerEvent.PlayerLoggedInEvent; +import cpw.mods.fml.common.network.FMLEventChannel; +import cpw.mods.fml.common.network.FMLNetworkEvent.ClientCustomPacketEvent; +import cpw.mods.fml.common.network.FMLNetworkEvent.ServerCustomPacketEvent; +import cpw.mods.fml.common.network.NetworkRegistry; + +public class NetworkHandler +{ + + public static NetworkHandler instance; + + final FMLEventChannel ec; + final String myChannelName; + + final IPacketHandler clientHandler; + final IPacketHandler serveHandler; + + public NetworkHandler(String channelName) { + ec = NetworkRegistry.INSTANCE.newEventDrivenChannel( myChannelName = channelName ); + ec.register( this ); + + clientHandler = new AppEngClientPacketHandler(); + serveHandler = new AppEngServerPacketHandler(); + } + + @SubscribeEvent + public void newPlayer(PlayerLoggedInEvent ev) + { + WorldSettings.getInstance().sendToPlayer( ev.player ); + } + + @SubscribeEvent + public void serverPacket(ServerCustomPacketEvent ev) + { + NetHandlerPlayServer srv = (NetHandlerPlayServer) ev.packet.handler(); + serveHandler.onPacketData( null, ev.packet, srv.playerEntity ); + } + + @SubscribeEvent + public void clientPacket(ClientCustomPacketEvent ev) + { + clientHandler.onPacketData( null, ev.packet, null ); + } + + public String getChannel() + { + return myChannelName; + } + + public void sendToAll(AppEngPacket message) + { + ec.sendToAll( message.getProxy() ); + } + + public void sendTo(AppEngPacket message, EntityPlayerMP player) + { + ec.sendTo( message.getProxy(), player ); + } + + public void sendToAllAround(AppEngPacket message, NetworkRegistry.TargetPoint point) + { + ec.sendToAllAround( message.getProxy(), point ); + } + + public void sendToDimension(AppEngPacket message, int dimensionId) + { + ec.sendToDimension( message.getProxy(), dimensionId ); + } + + public void sendToServer(AppEngPacket message) + { + ec.sendToServer( message.getProxy() ); + } + +} diff --git a/core/sync/packets/PacketConfigButton.java b/core/sync/packets/PacketConfigButton.java index a6193ea3..cd1e883a 100644 --- a/core/sync/packets/PacketConfigButton.java +++ b/core/sync/packets/PacketConfigButton.java @@ -1,18 +1,18 @@ package appeng.core.sync.packets; -import java.io.ByteArrayOutputStream; -import java.io.DataInputStream; -import java.io.DataOutputStream; +import io.netty.buffer.ByteBuf; +import io.netty.buffer.Unpooled; + import java.io.IOException; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.network.INetworkManager; import appeng.api.config.Settings; import appeng.api.util.IConfigManager; import appeng.api.util.IConfigureableObject; import appeng.container.AEBaseContainer; import appeng.core.sync.AppEngPacket; +import appeng.core.sync.network.INetworkInfo; import appeng.util.Platform; public class PacketConfigButton extends AppEngPacket @@ -22,13 +22,13 @@ public class PacketConfigButton extends AppEngPacket final public boolean rotationDirection; // automatic. - public PacketConfigButton(DataInputStream stream) throws IOException { + public PacketConfigButton(ByteBuf stream) throws IOException { option = Settings.values()[stream.readInt()]; rotationDirection = stream.readBoolean(); } @Override - public void serverPacketData(INetworkManager manager, AppEngPacket packet, EntityPlayer player) + public void serverPacketData(INetworkInfo manager, AppEngPacket packet, EntityPlayer player) { EntityPlayerMP sender = (EntityPlayerMP) player; AEBaseContainer aebc = (AEBaseContainer) sender.openContainer; @@ -45,14 +45,12 @@ public class PacketConfigButton extends AppEngPacket this.option = option; this.rotationDirection = rotationDirection; - ByteArrayOutputStream bytes = new ByteArrayOutputStream(); - DataOutputStream data = new DataOutputStream( bytes ); + ByteBuf data = Unpooled.buffer(); data.writeInt( getPacketID() ); data.writeInt( option.ordinal() ); data.writeBoolean( rotationDirection ); - isChunkDataPacket = false; - configureWrite( bytes.toByteArray() ); + configureWrite( data ); } } diff --git a/core/sync/packets/PacketInventoryAction.java b/core/sync/packets/PacketInventoryAction.java index c98c2fe4..40805bff 100644 --- a/core/sync/packets/PacketInventoryAction.java +++ b/core/sync/packets/PacketInventoryAction.java @@ -1,16 +1,16 @@ package appeng.core.sync.packets; -import java.io.ByteArrayOutputStream; -import java.io.DataInputStream; -import java.io.DataOutputStream; +import io.netty.buffer.ByteBuf; +import io.netty.buffer.Unpooled; + import java.io.IOException; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.network.INetworkManager; import appeng.api.storage.data.IAEItemStack; import appeng.container.AEBaseContainer; import appeng.core.sync.AppEngPacket; +import appeng.core.sync.network.INetworkInfo; import appeng.helpers.InventoryAction; import appeng.util.item.AEItemStack; @@ -22,7 +22,7 @@ public class PacketInventoryAction extends AppEngPacket final public IAEItemStack slotItem; // automatic. - public PacketInventoryAction(DataInputStream stream) throws IOException { + public PacketInventoryAction(ByteBuf stream) throws IOException { action = InventoryAction.values()[stream.readInt()]; slot = stream.readInt(); boolean hasItem = stream.readBoolean(); @@ -33,7 +33,7 @@ public class PacketInventoryAction extends AppEngPacket } @Override - public void serverPacketData(INetworkManager manager, AppEngPacket packet, EntityPlayer player) + public void serverPacketData(INetworkInfo manager, AppEngPacket packet, EntityPlayer player) { EntityPlayerMP sender = (EntityPlayerMP) player; if ( sender.openContainer instanceof AEBaseContainer ) @@ -49,8 +49,7 @@ public class PacketInventoryAction extends AppEngPacket this.slot = slot; this.slotItem = slotItem; - ByteArrayOutputStream bytes = new ByteArrayOutputStream(); - DataOutputStream data = new DataOutputStream( bytes ); + ByteBuf data = Unpooled.buffer(); data.writeInt( getPacketID() ); data.writeInt( action.ordinal() ); @@ -64,8 +63,7 @@ public class PacketInventoryAction extends AppEngPacket slotItem.writeToPacket( data ); } - isChunkDataPacket = false; - configureWrite( bytes.toByteArray() ); + configureWrite( data ); } } diff --git a/core/sync/packets/PacketLightning.java b/core/sync/packets/PacketLightning.java index e061610f..8337ac72 100644 --- a/core/sync/packets/PacketLightning.java +++ b/core/sync/packets/PacketLightning.java @@ -1,18 +1,18 @@ package appeng.core.sync.packets; -import java.io.ByteArrayOutputStream; -import java.io.DataInputStream; -import java.io.DataOutputStream; +import io.netty.buffer.ByteBuf; +import io.netty.buffer.Unpooled; + import java.io.IOException; import net.minecraft.client.Minecraft; import net.minecraft.client.particle.EntityFX; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.network.INetworkManager; import appeng.client.ClientHelper; import appeng.client.render.effects.LightningEffect; import appeng.core.Configuration; import appeng.core.sync.AppEngPacket; +import appeng.core.sync.network.INetworkInfo; import appeng.util.Platform; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -25,7 +25,7 @@ public class PacketLightning extends AppEngPacket final double z; // automatic. - public PacketLightning(DataInputStream stream) throws IOException { + public PacketLightning(ByteBuf stream) throws IOException { x = stream.readFloat(); y = stream.readFloat(); z = stream.readFloat(); @@ -33,7 +33,7 @@ public class PacketLightning extends AppEngPacket @Override @SideOnly(Side.CLIENT) - public void clientPacketData(INetworkManager network, AppEngPacket packet, EntityPlayer player) + public void clientPacketData(INetworkInfo network, AppEngPacket packet, EntityPlayer player) { try { @@ -55,16 +55,14 @@ public class PacketLightning extends AppEngPacket this.y = y; this.z = z; - ByteArrayOutputStream bytes = new ByteArrayOutputStream(); - DataOutputStream data = new DataOutputStream( bytes ); + ByteBuf data = Unpooled.buffer(); data.writeInt( getPacketID() ); data.writeFloat( (float) x ); data.writeFloat( (float) y ); data.writeFloat( (float) z ); - isChunkDataPacket = false; - configureWrite( bytes.toByteArray() ); + configureWrite( data ); } } diff --git a/core/sync/packets/PacketLocalizedChatMsg.java b/core/sync/packets/PacketLocalizedChatMsg.java deleted file mode 100644 index a55ca87a..00000000 --- a/core/sync/packets/PacketLocalizedChatMsg.java +++ /dev/null @@ -1,46 +0,0 @@ -package appeng.core.sync.packets; - -import java.io.ByteArrayOutputStream; -import java.io.DataInputStream; -import java.io.DataOutputStream; -import java.io.IOException; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.network.INetworkManager; -import net.minecraft.util.ChatMessageComponent; -import appeng.core.sync.AppEngPacket; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -public class PacketLocalizedChatMsg extends AppEngPacket -{ - - final public String msg; - - // automatic. - public PacketLocalizedChatMsg(DataInputStream stream) throws IOException { - msg = stream.readUTF(); - } - - @Override - @SideOnly(Side.CLIENT) - public void clientPacketData(INetworkManager network, AppEngPacket packet, EntityPlayer player) - { - ((EntityPlayer) player).sendChatToPlayer( ChatMessageComponent.createFromTranslationWithSubstitutions( msg ) ); - } - - // api - public PacketLocalizedChatMsg(String msg) throws IOException { - this.msg = msg; - - ByteArrayOutputStream bytes = new ByteArrayOutputStream(); - DataOutputStream data = new DataOutputStream( bytes ); - - data.writeInt( getPacketID() ); - data.writeUTF( msg ); - - isChunkDataPacket = false; - configureWrite( bytes.toByteArray() ); - } - -} diff --git a/core/sync/packets/PacketMEInventoryUpdate.java b/core/sync/packets/PacketMEInventoryUpdate.java index b8f364da..3f7d1397 100644 --- a/core/sync/packets/PacketMEInventoryUpdate.java +++ b/core/sync/packets/PacketMEInventoryUpdate.java @@ -1,8 +1,8 @@ package appeng.core.sync.packets; -import java.io.ByteArrayOutputStream; -import java.io.DataInputStream; -import java.io.DataOutputStream; +import io.netty.buffer.ByteBuf; +import io.netty.buffer.Unpooled; + import java.io.IOException; import java.nio.BufferOverflowException; import java.util.LinkedList; @@ -11,13 +11,13 @@ import java.util.List; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiScreen; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.network.INetworkManager; -import net.minecraft.network.packet.Packet250CustomPayload; import appeng.api.storage.data.IAEItemStack; import appeng.client.gui.implementations.GuiMEMonitorable; import appeng.client.gui.implementations.GuiNetworkStatus; import appeng.core.sync.AppEngPacket; +import appeng.core.sync.network.INetworkInfo; import appeng.util.item.AEItemStack; +import cpw.mods.fml.common.network.internal.FMLProxyPacket; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -25,8 +25,7 @@ public class PacketMEInventoryUpdate extends AppEngPacket { // output... - final private ByteArrayOutputStream bytes; - final private DataOutputStream data; + final private ByteBuf data; int lastSize = 0; boolean empty = true; @@ -34,18 +33,17 @@ public class PacketMEInventoryUpdate extends AppEngPacket final List list; // automatic. - public PacketMEInventoryUpdate(DataInputStream stream) throws IOException { - bytes = null; + public PacketMEInventoryUpdate(ByteBuf stream) throws IOException { data = null; list = new LinkedList(); - while (stream.available() > 0) + while (stream.readableBytes() > 0) list.add( AEItemStack.loadItemStackFromPacket( stream ) ); empty = list.isEmpty(); } @Override @SideOnly(Side.CLIENT) - public void clientPacketData(INetworkManager network, AppEngPacket packet, EntityPlayer player) + public void clientPacketData(INetworkInfo network, AppEngPacket packet, EntityPlayer player) { GuiScreen gs = Minecraft.getMinecraft().currentScreen; @@ -58,36 +56,34 @@ public class PacketMEInventoryUpdate extends AppEngPacket } @Override - public Packet250CustomPayload getPacket() + public FMLProxyPacket getProxy() { - isChunkDataPacket = false; - byte[] dataOut = new byte[lastSize]; - System.arraycopy( bytes.toByteArray(), 0, dataOut, 0, lastSize ); - configureWrite( dataOut ); - return super.getPacket(); + data.capacity( lastSize ); + configureWrite( data ); + return super.getProxy(); } // api public PacketMEInventoryUpdate() throws IOException { - bytes = new ByteArrayOutputStream(); - data = new DataOutputStream( bytes ); + data = Unpooled.buffer( 2048 ); list = null; data.writeInt( getPacketID() ); + lastSize = data.readableBytes(); } public void appendItem(IAEItemStack is) throws IOException, BufferOverflowException { is.writeToPacket( data ); empty = false; - if ( bytes.size() > 20000 ) + if ( data.readableBytes() > 20000 ) throw new BufferOverflowException(); else - lastSize = bytes.size(); + lastSize = data.readableBytes(); } public int getLength() { - return data.size(); + return data.readableBytes(); } public boolean isEmpty() diff --git a/core/sync/packets/PacketMatterCannon.java b/core/sync/packets/PacketMatterCannon.java index 136079aa..9259a738 100644 --- a/core/sync/packets/PacketMatterCannon.java +++ b/core/sync/packets/PacketMatterCannon.java @@ -1,18 +1,18 @@ package appeng.core.sync.packets; -import java.io.ByteArrayOutputStream; -import java.io.DataInputStream; -import java.io.DataOutputStream; +import io.netty.buffer.ByteBuf; +import io.netty.buffer.Unpooled; + import java.io.IOException; import net.minecraft.client.Minecraft; import net.minecraft.client.particle.EntityFX; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.network.INetworkManager; +import net.minecraft.init.Items; import net.minecraft.world.World; import appeng.client.render.effects.MatterCannonEffect; import appeng.core.sync.AppEngPacket; +import appeng.core.sync.network.INetworkInfo; import cpw.mods.fml.client.FMLClientHandler; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -29,7 +29,7 @@ public class PacketMatterCannon extends AppEngPacket final byte len; // automatic. - public PacketMatterCannon(DataInputStream stream) throws IOException { + public PacketMatterCannon(ByteBuf stream) throws IOException { x = stream.readFloat(); y = stream.readFloat(); z = stream.readFloat(); @@ -41,7 +41,7 @@ public class PacketMatterCannon extends AppEngPacket @Override @SideOnly(Side.CLIENT) - public void clientPacketData(INetworkManager network, AppEngPacket packet, EntityPlayer player) + public void clientPacketData(INetworkInfo network, AppEngPacket packet, EntityPlayer player) { try { @@ -49,7 +49,7 @@ public class PacketMatterCannon extends AppEngPacket World world = FMLClientHandler.instance().getClient().theWorld; for (int a = 1; a < len; a++) { - MatterCannonEffect fx = new MatterCannonEffect( world, x + dx * a, y + dy * a, z + dz * a, Item.diamond ); + MatterCannonEffect fx = new MatterCannonEffect( world, x + dx * a, y + dy * a, z + dz * a, Items.diamond ); Minecraft.getMinecraft().effectRenderer.addEffect( (EntityFX) fx ); } @@ -72,8 +72,7 @@ public class PacketMatterCannon extends AppEngPacket this.dz = dz / dlz; this.len = len; - ByteArrayOutputStream bytes = new ByteArrayOutputStream(); - DataOutputStream data = new DataOutputStream( bytes ); + ByteBuf data = Unpooled.buffer(); data.writeInt( getPacketID() ); data.writeFloat( (float) x ); @@ -84,8 +83,7 @@ public class PacketMatterCannon extends AppEngPacket data.writeFloat( (float) this.dz ); data.writeByte( len ); - isChunkDataPacket = false; - configureWrite( bytes.toByteArray() ); + configureWrite( data ); } } diff --git a/core/sync/packets/PacketMockExplosion.java b/core/sync/packets/PacketMockExplosion.java index 72481139..bd9b3481 100644 --- a/core/sync/packets/PacketMockExplosion.java +++ b/core/sync/packets/PacketMockExplosion.java @@ -1,15 +1,15 @@ package appeng.core.sync.packets; -import java.io.ByteArrayOutputStream; -import java.io.DataInputStream; -import java.io.DataOutputStream; +import io.netty.buffer.ByteBuf; +import io.netty.buffer.Unpooled; + import java.io.IOException; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.network.INetworkManager; import net.minecraft.world.World; import appeng.core.CommonHelper; import appeng.core.sync.AppEngPacket; +import appeng.core.sync.network.INetworkInfo; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -22,14 +22,14 @@ public class PacketMockExplosion extends AppEngPacket @Override @SideOnly(Side.CLIENT) - public void clientPacketData(INetworkManager network, AppEngPacket packet, EntityPlayer player) + public void clientPacketData(INetworkInfo network, AppEngPacket packet, EntityPlayer player) { World world = CommonHelper.proxy.getWorld(); world.spawnParticle( "largeexplode", this.x, this.y, this.z, 1.0D, 0.0D, 0.0D ); } // automatic. - public PacketMockExplosion(DataInputStream stream) throws IOException { + public PacketMockExplosion(ByteBuf stream) throws IOException { x = stream.readDouble(); y = stream.readDouble(); z = stream.readDouble(); @@ -41,16 +41,14 @@ public class PacketMockExplosion extends AppEngPacket this.y = y; this.z = z; - ByteArrayOutputStream bytes = new ByteArrayOutputStream(); - DataOutputStream data = new DataOutputStream( bytes ); + ByteBuf data = Unpooled.buffer(); data.writeInt( getPacketID() ); data.writeDouble( x ); data.writeDouble( y ); data.writeDouble( z ); - isChunkDataPacket = false; - configureWrite( bytes.toByteArray() ); + configureWrite( data ); } } diff --git a/core/sync/packets/PacketMultiPart.java b/core/sync/packets/PacketMultiPart.java index 81b5727e..fad705e4 100644 --- a/core/sync/packets/PacketMultiPart.java +++ b/core/sync/packets/PacketMultiPart.java @@ -1,42 +1,45 @@ package appeng.core.sync.packets; -import java.io.ByteArrayOutputStream; -import java.io.DataInputStream; -import java.io.DataOutputStream; +import io.netty.buffer.ByteBuf; +import io.netty.buffer.Unpooled; + import java.io.IOException; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.network.INetworkManager; import net.minecraftforge.common.MinecraftForge; +import appeng.core.AppEng; import appeng.core.sync.AppEngPacket; -import appeng.integration.modules.helpers.FMPPacketEvent; +import appeng.core.sync.network.INetworkInfo; +import appeng.integration.abstraction.IFMP; public class PacketMultiPart extends AppEngPacket { // automatic. - public PacketMultiPart(DataInputStream stream) throws IOException { + public PacketMultiPart(ByteBuf stream) throws IOException { } @Override - public void serverPacketData(INetworkManager manager, AppEngPacket packet, EntityPlayer player) + public void serverPacketData(INetworkInfo manager, AppEngPacket packet, EntityPlayer player) { - EntityPlayerMP sender = (EntityPlayerMP) player; - MinecraftForge.EVENT_BUS.post( new FMPPacketEvent( sender ) ); + IFMP fmp = (IFMP) AppEng.instance.getIntegration( "FMP" ); + if ( fmp != null ) + { + EntityPlayerMP sender = (EntityPlayerMP) player; + MinecraftForge.EVENT_BUS.post( fmp.newFMPPacketEvent( sender ) ); // when received it just pots this event. + } } // api public PacketMultiPart() throws IOException { - ByteArrayOutputStream bytes = new ByteArrayOutputStream(); - DataOutputStream data = new DataOutputStream( bytes ); + ByteBuf data = Unpooled.buffer(); data.writeInt( getPacketID() ); - isChunkDataPacket = false; - configureWrite( bytes.toByteArray() ); + configureWrite( data ); } } diff --git a/core/sync/packets/PacketPartPlacement.java b/core/sync/packets/PacketPartPlacement.java index 50e8f21f..209c2e5c 100644 --- a/core/sync/packets/PacketPartPlacement.java +++ b/core/sync/packets/PacketPartPlacement.java @@ -1,14 +1,14 @@ package appeng.core.sync.packets; -import java.io.ByteArrayOutputStream; -import java.io.DataInputStream; -import java.io.DataOutputStream; +import io.netty.buffer.ByteBuf; +import io.netty.buffer.Unpooled; + import java.io.IOException; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.network.INetworkManager; import appeng.core.sync.AppEngPacket; +import appeng.core.sync.network.INetworkInfo; import appeng.helpers.PartPlacement; public class PacketPartPlacement extends AppEngPacket @@ -17,7 +17,7 @@ public class PacketPartPlacement extends AppEngPacket int x, y, z, face; // automatic. - public PacketPartPlacement(DataInputStream stream) throws IOException { + public PacketPartPlacement(ByteBuf stream) throws IOException { x = stream.readInt(); y = stream.readInt(); z = stream.readInt(); @@ -25,7 +25,7 @@ public class PacketPartPlacement extends AppEngPacket } @Override - public void serverPacketData(INetworkManager manager, AppEngPacket packet, EntityPlayer player) + public void serverPacketData(INetworkInfo manager, AppEngPacket packet, EntityPlayer player) { EntityPlayerMP sender = (EntityPlayerMP) player; PartPlacement.place( sender.getHeldItem(), x, y, z, face, sender, sender.worldObj, PartPlacement.PlaceType.INTERACT_FIRST_PASS, 0 ); @@ -34,8 +34,7 @@ public class PacketPartPlacement extends AppEngPacket // api public PacketPartPlacement(int x, int y, int z, int face) throws IOException { - ByteArrayOutputStream bytes = new ByteArrayOutputStream(); - DataOutputStream data = new DataOutputStream( bytes ); + ByteBuf data = Unpooled.buffer(); data.writeInt( getPacketID() ); data.writeInt( x ); @@ -43,8 +42,7 @@ public class PacketPartPlacement extends AppEngPacket data.writeInt( z ); data.writeByte( face ); - isChunkDataPacket = false; - configureWrite( bytes.toByteArray() ); + configureWrite( data ); } } diff --git a/core/sync/packets/PacketSwitchGuis.java b/core/sync/packets/PacketSwitchGuis.java index 9acba4c2..718d97cf 100644 --- a/core/sync/packets/PacketSwitchGuis.java +++ b/core/sync/packets/PacketSwitchGuis.java @@ -1,18 +1,18 @@ package appeng.core.sync.packets; -import java.io.ByteArrayOutputStream; -import java.io.DataInputStream; -import java.io.DataOutputStream; +import io.netty.buffer.ByteBuf; +import io.netty.buffer.Unpooled; + import java.io.IOException; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; -import net.minecraft.network.INetworkManager; import net.minecraft.tileentity.TileEntity; import appeng.container.AEBaseContainer; import appeng.container.ContainerOpenContext; import appeng.core.sync.AppEngPacket; import appeng.core.sync.GuiBridge; +import appeng.core.sync.network.INetworkInfo; import appeng.util.Platform; public class PacketSwitchGuis extends AppEngPacket @@ -21,12 +21,12 @@ public class PacketSwitchGuis extends AppEngPacket final GuiBridge newGui; // automatic. - public PacketSwitchGuis(DataInputStream stream) throws IOException { + public PacketSwitchGuis(ByteBuf stream) throws IOException { newGui = GuiBridge.values()[stream.readInt()]; } @Override - public void serverPacketData(INetworkManager manager, AppEngPacket packet, EntityPlayer player) + public void serverPacketData(INetworkInfo manager, AppEngPacket packet, EntityPlayer player) { Container c = player.openContainer; if ( c instanceof AEBaseContainer ) @@ -35,7 +35,7 @@ public class PacketSwitchGuis extends AppEngPacket ContainerOpenContext context = bc.openContext; if ( context != null ) { - TileEntity te = context.w.getBlockTileEntity( context.x, context.y, context.z ); + TileEntity te = context.w.getTileEntity( context.x, context.y, context.z ); Platform.openGUI( player, te, context.side, newGui ); } } @@ -46,13 +46,11 @@ public class PacketSwitchGuis extends AppEngPacket this.newGui = newGui; - ByteArrayOutputStream bytes = new ByteArrayOutputStream(); - DataOutputStream data = new DataOutputStream( bytes ); + ByteBuf data = Unpooled.buffer(); data.writeInt( getPacketID() ); data.writeInt( newGui.ordinal() ); - isChunkDataPacket = false; - configureWrite( bytes.toByteArray() ); + configureWrite( data ); } } diff --git a/core/sync/packets/PacketValueConfig.java b/core/sync/packets/PacketValueConfig.java index 725c2b92..adc6f94e 100644 --- a/core/sync/packets/PacketValueConfig.java +++ b/core/sync/packets/PacketValueConfig.java @@ -1,19 +1,24 @@ package appeng.core.sync.packets; -import java.io.ByteArrayOutputStream; +import io.netty.buffer.ByteBuf; +import io.netty.buffer.Unpooled; + import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.IOException; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; -import net.minecraft.network.INetworkManager; import appeng.api.config.FuzzyMode; import appeng.container.implementations.ContainerCellWorkbench; import appeng.container.implementations.ContainerLevelEmitter; import appeng.container.implementations.ContainerPriority; import appeng.container.implementations.ContainerSecurity; import appeng.core.sync.AppEngPacket; +import appeng.core.sync.network.INetworkInfo; + +import com.sun.xml.internal.messaging.saaj.util.ByteInputStream; +import com.sun.xml.internal.messaging.saaj.util.ByteOutputStream; public class PacketValueConfig extends AppEngPacket { @@ -22,13 +27,15 @@ public class PacketValueConfig extends AppEngPacket final public String Value; // automatic. - public PacketValueConfig(DataInputStream stream) throws IOException { - Name = stream.readUTF(); - Value = stream.readUTF(); + public PacketValueConfig(ByteBuf stream) throws IOException { + DataInputStream dis = new DataInputStream( new ByteInputStream( stream.array(), 0, stream.readableBytes() ) ); + Name = dis.readUTF(); + Value = dis.readUTF(); + dis.close(); } @Override - public void serverPacketData(INetworkManager manager, AppEngPacket packet, EntityPlayer player) + public void serverPacketData(INetworkInfo manager, AppEngPacket packet, EntityPlayer player) { Container c = player.openContainer; @@ -77,14 +84,18 @@ public class PacketValueConfig extends AppEngPacket this.Name = Name; this.Value = Value; - ByteArrayOutputStream bytes = new ByteArrayOutputStream(); - DataOutputStream data = new DataOutputStream( bytes ); + ByteBuf data = Unpooled.buffer(); data.writeInt( getPacketID() ); - data.writeUTF( Name ); - data.writeUTF( Value ); - isChunkDataPacket = false; - configureWrite( bytes.toByteArray() ); + ByteOutputStream bos = new ByteOutputStream(); + DataOutputStream dos = new DataOutputStream( bos ); + data.writeBytes( Name.getBytes() ); + data.writeBytes( Value.getBytes() ); + dos.close(); + + data.writeBytes( bos.getBytes() ); + + configureWrite( data ); } } diff --git a/debug/TileChunkLoader.java b/debug/TileChunkLoader.java index f2d59c6c..27d5b854 100644 --- a/debug/TileChunkLoader.java +++ b/debug/TileChunkLoader.java @@ -4,6 +4,7 @@ import java.util.List; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.server.MinecraftServer; +import net.minecraft.util.ChatComponentText; import net.minecraft.world.ChunkCoordIntPair; import net.minecraftforge.common.ForgeChunkManager; import net.minecraftforge.common.ForgeChunkManager.Ticket; @@ -60,7 +61,7 @@ public class TileChunkLoader extends AEBaseTile List pl = server.getConfigurationManager().playerEntityList; for (EntityPlayerMP p : pl) { - p.addChatMessage( "Can't chunk load.." ); + p.addChatMessage( new ChatComponentText( "Can't chunk load.." ) ); } } return; diff --git a/debug/TileItemGen.java b/debug/TileItemGen.java index a77079bb..d535e905 100644 --- a/debug/TileItemGen.java +++ b/debug/TileItemGen.java @@ -19,9 +19,9 @@ public class TileItemGen extends AEBaseTile implements IInventory public TileItemGen() { if ( possibleItems.isEmpty() ) { - for (int x = 0; x < Item.itemsList.length; x++) + for (Object obj : Item.itemRegistry) { - Item mi = Item.itemsList[x]; + Item mi = (Item) obj; if ( mi != null ) { if ( mi.isDamageable() ) @@ -32,7 +32,7 @@ public class TileItemGen extends AEBaseTile implements IInventory else { List list = new ArrayList(); - mi.getSubItems( x, mi.getCreativeTab(), list ); + mi.getSubItems( mi, mi.getCreativeTab(), list ); possibleItems.addAll( list ); } } @@ -80,13 +80,13 @@ public class TileItemGen extends AEBaseTile implements IInventory } @Override - public String getInvName() + public String getInventoryName() { return null; } @Override - public boolean isInvNameLocalized() + public boolean hasCustomInventoryName() { return false; } @@ -98,13 +98,13 @@ public class TileItemGen extends AEBaseTile implements IInventory } @Override - public void openChest() + public void openInventory() { } @Override - public void closeChest() + public void closeInventory() { } diff --git a/debug/ToolDebugCard.java b/debug/ToolDebugCard.java index 253ae018..2a0b188e 100644 --- a/debug/ToolDebugCard.java +++ b/debug/ToolDebugCard.java @@ -5,9 +5,9 @@ import java.util.EnumSet; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.ChatMessageComponent; +import net.minecraft.util.ChatComponentText; import net.minecraft.world.World; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.networking.IGridConnection; import appeng.api.networking.IGridHost; import appeng.api.networking.IGridNode; @@ -63,7 +63,7 @@ public class ToolDebugCard extends AEBaseItem } else { - TileEntity te = world.getBlockTileEntity( x, y, z ); + TileEntity te = world.getTileEntity( x, y, z ); if ( te instanceof IGridHost ) { @@ -144,7 +144,7 @@ public class ToolDebugCard extends AEBaseItem private void outputMsg(EntityPlayer player, String string) { - player.sendChatToPlayer( ChatMessageComponent.createFromText( string ) ); + player.addChatMessage( new ChatComponentText( string ) ); } } diff --git a/debug/ToolReplicatorCard.java b/debug/ToolReplicatorCard.java index 6b0ba974..854262c4 100644 --- a/debug/ToolReplicatorCard.java +++ b/debug/ToolReplicatorCard.java @@ -7,10 +7,10 @@ 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.ChatMessageComponent; +import net.minecraft.util.ChatComponentText; import net.minecraft.world.World; import net.minecraftforge.common.DimensionManager; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.networking.IGrid; import appeng.api.networking.IGridHost; import appeng.api.networking.IGridNode; @@ -36,7 +36,7 @@ public class ToolReplicatorCard extends AEBaseItem if ( player.isSneaking() ) { - if ( world.getBlockTileEntity( x, y, z ) instanceof IGridHost ) + if ( world.getTileEntity( x, y, z ) instanceof IGridHost ) { NBTTagCompound tag = new NBTTagCompound(); tag.setInteger( "x", x ); @@ -61,7 +61,7 @@ public class ToolReplicatorCard extends AEBaseItem int dimid = ish.getInteger( "dimid" ); World src_w = DimensionManager.getWorld( dimid ); - TileEntity te = src_w.getBlockTileEntity( src_x, src_y, src_z ); + TileEntity te = src_w.getTileEntity( src_x, src_y, src_z ); if ( te instanceof IGridHost ) { IGridHost gh = (IGridHost) te; @@ -99,19 +99,18 @@ public class ToolReplicatorCard extends AEBaseItem for (int j = 1; j < scale_y; j++) for (int k = 1; k < scale_z; k++) { - int id = src_w.getBlockId( min_x + i, min_y + j, min_z + k ); + Block blk = src_w.getBlock( min_x + i, min_y + j, min_z + k ); int meta = src_w.getBlockMetadata( min_x + i, min_y + j, min_z + k ); - world.setBlock( i + rel_x, j + rel_y, k + rel_z, id, meta, 4 ); + world.setBlock( i + rel_x, j + rel_y, k + rel_z, blk, meta, 4 ); - Block blk = Block.blocksList[id]; if ( blk != null && blk.hasTileEntity( meta ) ) { - TileEntity ote = src_w.getBlockTileEntity( min_x + i, min_y + j, min_z + k ); + TileEntity ote = src_w.getTileEntity( min_x + i, min_y + j, min_z + k ); TileEntity nte = blk.createTileEntity( world, meta ); NBTTagCompound data = new NBTTagCompound(); ote.writeToNBT( data ); nte.readFromNBT( (NBTTagCompound) data.copy() ); - world.setBlockTileEntity( i + rel_x, j + rel_y, k + rel_z, nte ); + world.setTileEntity( i + rel_x, j + rel_y, k + rel_z, nte ); } world.markBlockForUpdate( i + rel_x, j + rel_y, k + rel_z ); } @@ -137,7 +136,7 @@ public class ToolReplicatorCard extends AEBaseItem private void outputMsg(EntityPlayer player, String string) { - player.sendChatToPlayer( ChatMessageComponent.createFromText( string ) ); + player.addChatMessage( new ChatComponentText( string ) ); } } diff --git a/entity/EntityChargedQuartz.java b/entity/EntityChargedQuartz.java index 6aff96c2..f017f21b 100644 --- a/entity/EntityChargedQuartz.java +++ b/entity/EntityChargedQuartz.java @@ -6,7 +6,7 @@ import java.util.List; import net.minecraft.block.material.Material; import net.minecraft.entity.Entity; import net.minecraft.entity.item.EntityItem; -import net.minecraft.item.Item; +import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.MathHelper; @@ -45,7 +45,7 @@ final public class EntityChargedQuartz extends EntityItem int i = MathHelper.floor_double( this.posY ); int k = MathHelper.floor_double( this.posZ ); - Material mat = worldObj.getBlockMaterial( j, i, k ); + Material mat = worldObj.getBlock( j, i, k ).getMaterial(); if ( Platform.isServer() && mat.isLiquid() ) { transformTime++; @@ -77,10 +77,10 @@ final public class EntityChargedQuartz extends EntityItem ItemStack other = ((EntityItem) e).getEntityItem(); if ( other != null && other.stackSize > 0 ) { - if ( Platform.isSameItem( other, new ItemStack( Item.redstone ) ) ) + if ( Platform.isSameItem( other, new ItemStack( Items.redstone ) ) ) redstone = (EntityItem) e; - if ( Platform.isSameItem( other, new ItemStack( Item.netherQuartz ) ) ) + if ( Platform.isSameItem( other, new ItemStack( Items.quartz ) ) ) netherQuartz = (EntityItem) e; } } diff --git a/entity/EntityTinyTNTPrimed.java b/entity/EntityTinyTNTPrimed.java index 1eb63394..f3bc24f2 100644 --- a/entity/EntityTinyTNTPrimed.java +++ b/entity/EntityTinyTNTPrimed.java @@ -1,5 +1,7 @@ package appeng.entity; +import io.netty.buffer.ByteBuf; + import java.io.IOException; import net.minecraft.block.Block; @@ -16,10 +18,6 @@ import appeng.core.Configuration; import appeng.core.features.AEFeature; import appeng.core.sync.packets.PacketMockExplosion; import appeng.util.Platform; - -import com.google.common.io.ByteArrayDataInput; -import com.google.common.io.ByteArrayDataOutput; - import cpw.mods.fml.common.registry.IEntityAdditionalSpawnData; final public class EntityTinyTNTPrimed extends EntityTNTPrimed implements IEntityAdditionalSpawnData @@ -109,9 +107,8 @@ final public class EntityTinyTNTPrimed extends EntityTNTPrimed implements IEntit { for (int z = (int) (posZ - 2); z <= posZ + 2; z++) { - int l = worldObj.getBlockId( x, y, z ); - Block block = Block.blocksList[l]; - if ( block != null && !block.isAirBlock( worldObj, x, y, z ) ) + Block block = worldObj.getBlock( x, y, z ); + if ( block != null && !block.isAir( worldObj, x, y, z ) ) { float strength = (float) (2.3f - (((x + 0.5f) - posX) * ((x + 0.5f) - posX) + ((y + 0.5f) - posY) * ((y + 0.5f) - posY) + ((z + 0.5f) - posZ) * ((z + 0.5f) - posZ))); @@ -120,7 +117,8 @@ final public class EntityTinyTNTPrimed extends EntityTNTPrimed implements IEntit strength -= (resistance + 0.3F) * 0.11f; if ( strength > 0.01 ) { - worldObj.destroyBlock( x, y, z, true ); + worldObj.func_147480_a( x, y, z, true ); + // worldObj.destroyBlock( x, y, z, true ); } } } @@ -130,7 +128,7 @@ final public class EntityTinyTNTPrimed extends EntityTNTPrimed implements IEntit try { - CommonHelper.proxy.sendToAllNearExcept( null, posX, posY, posZ, 64, this.worldObj, (new PacketMockExplosion( posX, posY, posZ )).getPacket() ); + CommonHelper.proxy.sendToAllNearExcept( null, posX, posY, posZ, 64, this.worldObj, new PacketMockExplosion( posX, posY, posZ ) ); } catch (IOException e1) { @@ -148,13 +146,13 @@ final public class EntityTinyTNTPrimed extends EntityTNTPrimed implements IEntit } @Override - public void writeSpawnData(ByteArrayDataOutput data) + public void writeSpawnData(ByteBuf data) { data.writeByte( fuse ); } @Override - public void readSpawnData(ByteArrayDataInput data) + public void readSpawnData(ByteBuf data) { fuse = data.readByte(); } diff --git a/facade/FacadeContainer.java b/facade/FacadeContainer.java index dfa0ea17..72f5cba5 100644 --- a/facade/FacadeContainer.java +++ b/facade/FacadeContainer.java @@ -1,13 +1,13 @@ package appeng.facade; -import java.io.DataInputStream; -import java.io.DataOutputStream; +import io.netty.buffer.ByteBuf; + import java.io.IOException; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.AEApi; import appeng.api.parts.IFacadeContainer; import appeng.api.parts.IFacadePart; @@ -21,7 +21,7 @@ public class FacadeContainer implements IFacadeContainer final private IFacadePart facades[] = new FacadePart[6]; - public void writeToStream(DataOutputStream out) throws IOException + public void writeToStream(ByteBuf out) throws IOException { int facadeSides = 0; for (int x = 0; x < facades.length; x++) @@ -36,7 +36,7 @@ public class FacadeContainer implements IFacadeContainer IFacadePart part = getFacade( ForgeDirection.getOrientation( x ) ); if ( part != null ) { - int itemID = part.getItem().itemID; + int itemID = Item.getIdFromItem( part.getItem() ); int dmgValue = part.getItemDamage(); out.writeInt( itemID * (part.isBC() ? -1 : 1) ); out.writeInt( dmgValue ); @@ -44,7 +44,7 @@ public class FacadeContainer implements IFacadeContainer } } - public boolean readFromStream(DataInputStream out) throws IOException + public boolean readFromStream(ByteBuf out) throws IOException { int facadeSides = out.readByte(); @@ -116,7 +116,7 @@ public class FacadeContainer implements IFacadeContainer { NBTTagCompound data = new NBTTagCompound(); facades[x].getItemStack().writeToNBT( data ); - c.setCompoundTag( "facade:" + x, data ); + c.setTag( "facade:" + x, data ); } } } diff --git a/facade/FacadePart.java b/facade/FacadePart.java index 23ee4934..9509c4c6 100644 --- a/facade/FacadePart.java +++ b/facade/FacadePart.java @@ -9,8 +9,8 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.Icon; -import net.minecraftforge.common.ForgeDirection; +import net.minecraft.util.IIcon; +import net.minecraftforge.common.util.ForgeDirection; import org.lwjgl.opengl.GL11; @@ -77,7 +77,8 @@ public class FacadePart implements IFacadePart @Override @SideOnly(Side.CLIENT) - public void renderStatic(int x, int y, int z, IPartRenderHelper instance2, RenderBlocks renderer, IFacadeContainer fc, AxisAlignedBB busBounds, boolean renderStilt) + public void renderStatic(int x, int y, int z, IPartRenderHelper instance2, RenderBlocks renderer, IFacadeContainer fc, AxisAlignedBB busBounds, + boolean renderStilt) { if ( facade != null ) { @@ -96,7 +97,7 @@ public class FacadePart implements IFacadePart rbw.calculations = true; } - Icon myIcon = null; + IIcon myIcon = null; if ( isBC() ) { IBC bc = (IBC) AppEng.instance.getIntegration( "BC" ); @@ -123,7 +124,7 @@ public class FacadePart implements IFacadePart if ( randomItem.getItem() instanceof ItemBlock ) { ItemBlock ib = (ItemBlock) randomItem.getItem(); - Block blk = Block.blocksList[ib.getBlockID()]; + Block blk = Block.getBlockFromItem( ib ); try { @@ -253,8 +254,8 @@ public class FacadePart implements IFacadePart } @SideOnly(Side.CLIENT) - private void renderSegmentBlockCurrentBounds(BusRenderHelper instance, int x, int y, int z, RenderBlocks renderer, double minX, double minY, double minZ, double maxX, - double maxY, double maxZ) + private void renderSegmentBlockCurrentBounds(BusRenderHelper instance, int x, int y, int z, RenderBlocks renderer, double minX, double minY, double minZ, + double maxX, double maxY, double maxZ) { double oldMinX = renderer.renderMinX; double oldMinY = renderer.renderMinY; @@ -307,7 +308,7 @@ public class FacadePart implements IFacadePart if ( randomItem.getItem() instanceof ItemBlock ) { ItemBlock ib = (ItemBlock) randomItem.getItem(); - Block blk = Block.blocksList[ib.getBlockID()]; + Block blk = Block.getBlockFromItem( ib ); try { diff --git a/facade/IFacadeItem.java b/facade/IFacadeItem.java index 9d706425..502079a1 100644 --- a/facade/IFacadeItem.java +++ b/facade/IFacadeItem.java @@ -2,7 +2,7 @@ package appeng.facade; import net.minecraft.block.Block; import net.minecraft.item.ItemStack; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; public interface IFacadeItem { diff --git a/fmp/CableBusPart.java b/fmp/CableBusPart.java index 30fb479c..5429b7d0 100644 --- a/fmp/CableBusPart.java +++ b/fmp/CableBusPart.java @@ -19,7 +19,7 @@ import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.Vec3; import net.minecraft.world.World; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import powercrystals.minefactoryreloaded.api.rednet.RedNetConnectionType; import appeng.api.networking.IGridNode; import appeng.api.parts.IFacadeContainer; @@ -429,7 +429,7 @@ public class CableBusPart extends JCuboidPart implements JNormalOcclusion, IReds @Override public void markForSave() { - this.getTile().onInventoryChanged(); + this.getTile().markDirty(); } @Override diff --git a/fmp/QuartzTorchPart.java b/fmp/QuartzTorchPart.java index eb72c39f..eb808056 100644 --- a/fmp/QuartzTorchPart.java +++ b/fmp/QuartzTorchPart.java @@ -4,7 +4,7 @@ import java.util.Random; import net.minecraft.block.Block; import net.minecraft.world.World; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.AEApi; import codechicken.lib.vec.BlockCoord; import codechicken.lib.vec.Cuboid6; diff --git a/helpers/AETrading.java b/helpers/AETrading.java index 00bff3a9..1d25e997 100644 --- a/helpers/AETrading.java +++ b/helpers/AETrading.java @@ -3,7 +3,7 @@ package appeng.helpers; import java.util.Random; import net.minecraft.entity.passive.EntityVillager; -import net.minecraft.item.Item; +import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.village.MerchantRecipe; import net.minecraft.village.MerchantRecipeList; @@ -44,7 +44,7 @@ public class AETrading implements IVillageTradeHandler { // Sell ItemStack From = item.copy(); - ItemStack To = new ItemStack( Item.emerald ); + ItemStack To = new ItemStack( Items.emerald ); int multiplier = (Math.abs( rand.nextInt() ) % 6); emera += (Math.abs( rand.nextInt() ) % greed) - multiplier; diff --git a/helpers/DispenserBehaviorTinyTNT.java b/helpers/DispenserBehaviorTinyTNT.java index 04408660..15377172 100644 --- a/helpers/DispenserBehaviorTinyTNT.java +++ b/helpers/DispenserBehaviorTinyTNT.java @@ -15,7 +15,7 @@ final public class DispenserBehaviorTinyTNT extends BehaviorDefaultDispenseItem @Override protected ItemStack dispenseStack(IBlockSource dispenser, ItemStack dispensedItem) { - EnumFacing enumfacing = BlockDispenser.getFacing( dispenser.getBlockMetadata() ); + EnumFacing enumfacing = BlockDispenser.func_149937_b( dispenser.getBlockMetadata() ); World world = dispenser.getWorld(); int i = dispenser.getXInt() + enumfacing.getFrontOffsetX(); int j = dispenser.getYInt() + enumfacing.getFrontOffsetY(); diff --git a/helpers/DualityInterface.java b/helpers/DualityInterface.java index 430cffc7..5b478f6b 100644 --- a/helpers/DualityInterface.java +++ b/helpers/DualityInterface.java @@ -4,10 +4,11 @@ import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.AEApi; import appeng.api.config.Actionable; import appeng.api.implementations.tiles.ISegmentedInventory; +import appeng.api.networking.GridFlags; import appeng.api.networking.IGridNode; import appeng.api.networking.energy.IEnergySource; import appeng.api.networking.security.BaseActionSource; @@ -51,6 +52,8 @@ public class DualityInterface implements IGridTickable, ISegmentedInventory, ISt public DualityInterface(AENetworkProxy prox, IInterfaceHost ih) { gridProxy = prox; + gridProxy.setFlags( GridFlags.REQUIRE_CHANNEL ); + iHost = ih; mySrc = fluids.changeSource = items.changeSource = new MachineSource( iHost ); } @@ -99,9 +102,9 @@ public class DualityInterface implements IGridTickable, ISegmentedInventory, ISt } TileEntity te = iHost.getTileEntity(); - if ( hadConfig != hasConfig && te != null && te.worldObj != null ) + if ( hadConfig != hasConfig && te != null && te.getWorldObj() != null ) { - te.worldObj.notifyBlocksOfNeighborChange( te.xCoord, te.yCoord, te.zCoord, 0 ); + te.getWorldObj().notifyBlocksOfNeighborChange( te.xCoord, te.yCoord, te.zCoord, Platform.air ); } } @@ -299,7 +302,7 @@ public class DualityInterface implements IGridTickable, ISegmentedInventory, ISt } TileEntity te = iHost.getTileEntity(); - te.worldObj.notifyBlocksOfNeighborChange( te.xCoord, te.yCoord, te.zCoord, 0 ); + te.getWorldObj().notifyBlocksOfNeighborChange( te.xCoord, te.yCoord, te.zCoord, Platform.air ); } public AECableType getCableConnectionType(ForgeDirection dir) @@ -317,10 +320,10 @@ public class DualityInterface implements IGridTickable, ISegmentedInventory, ISt return storage; } - public void onInventoryChanged() + public void markDirty() { for (int slot = 0; slot < storage.getSizeInventory(); slot++) - onChangeInventory( storage, slot, InvOperation.onInventoryChanged, null, null ); + onChangeInventory( storage, slot, InvOperation.markDirty, null, null ); } @Override diff --git a/helpers/LocationRotation.java b/helpers/LocationRotation.java index 650ce224..fdde4a2d 100644 --- a/helpers/LocationRotation.java +++ b/helpers/LocationRotation.java @@ -1,7 +1,7 @@ package appeng.helpers; import net.minecraft.world.IBlockAccess; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.util.IOrientable; public class LocationRotation implements IOrientable diff --git a/helpers/MetaRotation.java b/helpers/MetaRotation.java index 14849952..dd951fda 100644 --- a/helpers/MetaRotation.java +++ b/helpers/MetaRotation.java @@ -2,7 +2,7 @@ package appeng.helpers; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.util.IOrientable; public class MetaRotation implements IOrientable diff --git a/helpers/PartPlacement.java b/helpers/PartPlacement.java index 0321be4c..3344f56c 100644 --- a/helpers/PartPlacement.java +++ b/helpers/PartPlacement.java @@ -5,16 +5,15 @@ import java.util.LinkedList; import java.util.List; import net.minecraft.block.Block; -import net.minecraft.block.StepSound; +import net.minecraft.block.Block.SoundType; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; -import net.minecraftforge.common.ForgeDirection; import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.event.ForgeSubscribe; +import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.event.entity.player.PlayerDestroyItemEvent; import net.minecraftforge.event.entity.player.PlayerInteractEvent; import net.minecraftforge.event.entity.player.PlayerInteractEvent.Action; @@ -26,20 +25,21 @@ import appeng.api.parts.PartItemStack; import appeng.api.parts.SelectedPart; import appeng.core.AELog; import appeng.core.AppEng; +import appeng.core.sync.network.NetworkHandler; import appeng.core.sync.packets.PacketPartPlacement; import appeng.facade.IFacadeItem; import appeng.integration.abstraction.IBC; import appeng.integration.abstraction.IFMP; import appeng.util.LookDirection; import appeng.util.Platform; -import cpw.mods.fml.common.network.PacketDispatcher; +import cpw.mods.fml.common.eventhandler.SubscribeEvent; public class PartPlacement { private ThreadLocal placing = new ThreadLocal(); - @ForgeSubscribe + @SubscribeEvent public void playerInteract(PlayerInteractEvent event) { if ( event.action == Action.RIGHT_CLICK_BLOCK && event.entityPlayer.worldObj.isRemote ) @@ -71,8 +71,8 @@ public class PartPlacement if ( held != null && Platform.isWrench( player, held, x, y, z ) && player.isSneaking() ) { - int block = world.getBlockId( x, y, z ); - TileEntity tile = world.getBlockTileEntity( x, y, z ); + Block block = world.getBlock( x, y, z ); + TileEntity tile = world.getTileEntity( x, y, z ); IPartHost host = null; if ( tile instanceof IPartHost ) @@ -83,7 +83,7 @@ public class PartPlacement if ( !world.isRemote ) { LookDirection dir = Platform.getPlayerRay( player ); - MovingObjectPosition mop = Block.blocksList[block].collisionRayTrace( world, x, y, z, dir.a, dir.b ); + MovingObjectPosition mop = block.collisionRayTrace( world, x, y, z, dir.a, dir.b ); if ( mop != null ) { List is = new LinkedList(); @@ -100,11 +100,11 @@ public class PartPlacement { is.add( sp.facade.getItemStack() ); host.getFacadeContainer().removeFacade( host, sp.side ); - world.notifyBlocksOfNeighborChange( x, y, z, 0 ); + world.notifyBlocksOfNeighborChange( x, y, z, Platform.air ); } if ( host.isEmpty() ) - world.setBlock( x, y, z, 0 ); + world.setBlock( x, y, z, Platform.air ); if ( is != null && !is.isEmpty() ) { @@ -117,7 +117,7 @@ public class PartPlacement player.swingItem(); try { - PacketDispatcher.sendPacketToServer( (new PacketPartPlacement( x, y, z, face )).getPacket() ); + NetworkHandler.instance.sendToServer( new PacketPartPlacement( x, y, z, face ) ); } catch (IOException e) { @@ -130,7 +130,7 @@ public class PartPlacement return false; } - TileEntity tile = world.getBlockTileEntity( x, y, z ); + TileEntity tile = world.getTileEntity( x, y, z ); IPartHost host = null; if ( tile instanceof IPartHost ) @@ -168,7 +168,7 @@ public class PartPlacement player.swingItem(); try { - PacketDispatcher.sendPacketToServer( (new PacketPartPlacement( x, y, z, face )).getPacket() ); + NetworkHandler.instance.sendToServer( new PacketPartPlacement( x, y, z, face ) ); } catch (IOException e) { @@ -185,11 +185,11 @@ public class PartPlacement // if ( held == null ) { - int block = world.getBlockId( x, y, z ); - if ( host != null && player.isSneaking() && Block.blocksList[block] != null ) + Block block = world.getBlock( x, y, z ); + if ( host != null && player.isSneaking() && block != null ) { LookDirection dir = Platform.getPlayerRay( player ); - MovingObjectPosition mop = Block.blocksList[block].collisionRayTrace( world, x, y, z, dir.a, dir.b ); + MovingObjectPosition mop = block.collisionRayTrace( world, x, y, z, dir.a, dir.b ); if ( mop != null ) { mop.hitVec = mop.hitVec.addVector( -mop.blockX, -mop.blockY, -mop.blockZ ); @@ -201,7 +201,7 @@ public class PartPlacement { try { - PacketDispatcher.sendPacketToServer( (new PacketPartPlacement( x, y, z, face )).getPacket() ); + NetworkHandler.instance.sendToServer( new PacketPartPlacement( x, y, z, face ) ); } catch (IOException e) { @@ -228,8 +228,8 @@ public class PartPlacement ItemBlock ib = (ItemBlock) is.getItem(); ForgeDirection offset = ForgeDirection.UNKNOWN; - int blkID = world.getBlockId( x, y, z ); - if ( blkID != 0 && !Block.blocksList[blkID].isBlockReplaceable( world, x, y, z ) ) + Block blkID = world.getBlock( x, y, z ); + if ( blkID != null && !blkID.isReplaceable( world, x, y, z ) ) { offset = side; if ( Platform.isServer() ) @@ -240,7 +240,7 @@ public class PartPlacement te_y = y + offset.offsetY; te_z = z + offset.offsetZ; - tile = world.getBlockTileEntity( te_x, te_y, te_z ); + tile = world.getTileEntity( te_x, te_y, te_z ); if ( tile instanceof IPartHost ) host = (IPartHost) tile; @@ -252,7 +252,7 @@ public class PartPlacement { if ( !world.isRemote ) { - tile = world.getBlockTileEntity( te_x, te_y, te_z ); + tile = world.getTileEntity( te_x, te_y, te_z ); if ( tile instanceof IPartHost ) host = (IPartHost) tile; @@ -264,7 +264,7 @@ public class PartPlacement player.swingItem(); try { - PacketDispatcher.sendPacketToServer( (new PacketPartPlacement( x, y, z, face )).getPacket() ); + NetworkHandler.instance.sendToServer( new PacketPartPlacement( x, y, z, face ) ); } catch (IOException e) { @@ -290,15 +290,15 @@ public class PartPlacement te_y = y + offset.offsetY; te_z = z + offset.offsetZ; - int blkID = world.getBlockId( te_x, te_y, te_z ); - tile = world.getBlockTileEntity( te_x, te_y, te_z ); + Block blkID = world.getBlock( te_x, te_y, te_z ); + tile = world.getTileEntity( te_x, te_y, te_z ); if ( tile != null && AppEng.instance.isIntegrationEnabled( "FMP" ) ) host = ((IFMP) AppEng.instance.getIntegration( "FMP" )).getOrCreateHost( tile ); - if ( (blkID == 0 || Block.blocksList[blkID].isBlockReplaceable( world, te_x, te_y, te_z ) || host != null) && offset != ForgeDirection.UNKNOWN ) - return place( held, te_x, te_y, te_z, side.getOpposite().ordinal(), player, world, pass == PlaceType.INTERACT_FIRST_PASS ? PlaceType.INTERACT_SECOND_PASS - : PlaceType.PLACE_ITEM, depth + 1 ); + if ( (blkID == null || blkID.isReplaceable( world, te_x, te_y, te_z ) || host != null) && offset != ForgeDirection.UNKNOWN ) + return place( held, te_x, te_y, te_z, side.getOpposite().ordinal(), player, world, + pass == PlaceType.INTERACT_FIRST_PASS ? PlaceType.INTERACT_SECOND_PASS : PlaceType.PLACE_ITEM, depth + 1 ); } return false; } @@ -308,8 +308,10 @@ public class PartPlacement ForgeDirection mySide = host.addPart( held, side, player ); if ( mySide != null ) { - StepSound ss = AEApi.instance().blocks().blockMultiPart.block().stepSound; - world.playSoundEffect( 0.5 + x, 0.5 + y, 0.5 + z, ss.getPlaceSound(), (ss.getVolume() + 1.0F) / 2.0F, ss.getPitch() * 0.8F ); + SoundType ss = AEApi.instance().blocks().blockMultiPart.block().stepSound; + + // ss.getPlaceSound() + world.playSoundEffect( 0.5 + x, 0.5 + y, 0.5 + z, ss.func_150496_b(), (ss.getVolume() + 1.0F) / 2.0F, ss.getPitch() * 0.8F ); if ( !player.capabilities.isCreativeMode ) { @@ -327,7 +329,7 @@ public class PartPlacement player.swingItem(); try { - PacketDispatcher.sendPacketToServer( (new PacketPartPlacement( x, y, z, face )).getPacket() ); + NetworkHandler.instance.sendToServer( new PacketPartPlacement( x, y, z, face ) ); } catch (IOException e) { diff --git a/helpers/QuartzWorldGen.java b/helpers/QuartzWorldGen.java index e1fe1b3d..bf1a2a51 100644 --- a/helpers/QuartzWorldGen.java +++ b/helpers/QuartzWorldGen.java @@ -3,6 +3,7 @@ package appeng.helpers; import java.util.Random; import net.minecraft.block.Block; +import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.world.World; import net.minecraft.world.chunk.IChunkProvider; @@ -18,13 +19,16 @@ final public class QuartzWorldGen implements IWorldGenerator final WorldGenMinable oreCharged; public QuartzWorldGen() { - ItemStack normal = AEApi.instance().blocks().blockQuartzOre.stack( 1 ); - ItemStack charged = AEApi.instance().blocks().blockQuartzOreCharged.stack( 1 ); + Block normal = AEApi.instance().blocks().blockQuartzOre.block(); + Block charged = AEApi.instance().blocks().blockQuartzOreCharged.block(); + + ItemStack is_normal = AEApi.instance().blocks().blockQuartzOre.stack( 1 ); + ItemStack is_charged = AEApi.instance().blocks().blockQuartzOreCharged.stack( 1 ); if ( normal == null || charged == null ) { - oreNormal = new WorldGenMinable( normal.itemID, normal.getItemDamage(), Configuration.instance.oresPerCluster, Block.stone.blockID ); - oreCharged = new WorldGenMinable( normal.itemID, normal.getItemDamage(), Configuration.instance.oresPerCluster, Block.stone.blockID ); + oreNormal = new WorldGenMinable( normal, is_normal.getItemDamage(), Configuration.instance.oresPerCluster, Blocks.stone ); + oreCharged = new WorldGenMinable( charged, is_charged.getItemDamage(), Configuration.instance.oresPerCluster, Blocks.stone ); } else oreNormal = oreCharged = null; diff --git a/helpers/TickHandler.java b/helpers/TickHandler.java index cf2ccb73..8e290e26 100644 --- a/helpers/TickHandler.java +++ b/helpers/TickHandler.java @@ -1,21 +1,20 @@ package appeng.helpers; -import java.util.EnumSet; import java.util.LinkedList; import java.util.Queue; import java.util.concurrent.Callable; -import net.minecraftforge.event.ForgeSubscribe; import net.minecraftforge.event.world.WorldEvent; import appeng.api.networking.IGridNode; import appeng.core.AELog; import appeng.me.Grid; import appeng.tile.AEBaseTile; import appeng.util.Platform; -import cpw.mods.fml.common.ITickHandler; -import cpw.mods.fml.common.TickType; +import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import cpw.mods.fml.common.gameevent.TickEvent; +import cpw.mods.fml.common.gameevent.TickEvent.Type; -public class TickHandler implements ITickHandler +public class TickHandler { class HandlerRep @@ -79,7 +78,7 @@ public class TickHandler implements ITickHandler getRepo().clear(); } - @ForgeSubscribe + @SubscribeEvent public void unloadWorld(WorldEvent.Unload ev) { if ( Platform.isServer() ) @@ -100,50 +99,36 @@ public class TickHandler implements ITickHandler } } - @Override - public void tickStart(EnumSet type, Object... tickData) + @SubscribeEvent + public void onTick(TickEvent ev) { - - } - - @Override - public void tickEnd(EnumSet type, Object... tickData) - { - HandlerRep repo = getRepo(); - while (!repo.tiles.isEmpty()) + if ( ev.type == Type.SERVER ) { - AEBaseTile bt = repo.tiles.poll(); - bt.onReady(); - } - - for (Grid g : getRepo().networks) - { - g.update(); - } - - Callable c = null; - while ((c = callQueue.poll()) != null) - { - try + HandlerRep repo = getRepo(); + while (!repo.tiles.isEmpty()) { - c.call(); + AEBaseTile bt = repo.tiles.poll(); + bt.onReady(); } - catch (Exception e) + + for (Grid g : getRepo().networks) { - AELog.error( e ); + g.update(); + } + + Callable c = null; + while ((c = callQueue.poll()) != null) + { + try + { + c.call(); + } + catch (Exception e) + { + AELog.error( e ); + } } } } - @Override - public EnumSet ticks() - { - return EnumSet.of( TickType.SERVER ); - } - - @Override - public String getLabel() - { - return "AE-TickHandler"; - } } diff --git a/helpers/WirelessTerminalGuiObject.java b/helpers/WirelessTerminalGuiObject.java index 5019b43e..b3fc48a1 100644 --- a/helpers/WirelessTerminalGuiObject.java +++ b/helpers/WirelessTerminalGuiObject.java @@ -3,7 +3,7 @@ package appeng.helpers; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.world.World; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.AEApi; import appeng.api.config.AccessRestriction; import appeng.api.config.Actionable; @@ -107,7 +107,7 @@ public class WirelessTerminalGuiObject implements IPortableCell double rangeLimit = wap.getRange(); rangeLimit *= rangeLimit; - if ( wap.worldObj == myPlayer.worldObj ) + if ( wap.getWorldObj() == myPlayer.worldObj ) { double offX = (double) wap.xCoord - myPlayer.posX; double offY = (double) wap.yCoord - myPlayer.posY; diff --git a/integration/abstraction/IBC.java b/integration/abstraction/IBC.java index e2d7f3fd..cac9605c 100644 --- a/integration/abstraction/IBC.java +++ b/integration/abstraction/IBC.java @@ -4,8 +4,8 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.Icon; -import net.minecraftforge.common.ForgeDirection; +import net.minecraft.util.IIcon; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.parts.IFacadePart; public interface IBC @@ -39,6 +39,6 @@ public interface IBC ItemStack getTextureForFacade(ItemStack facade); - Icon getFacadeTexture(); + IIcon getFacadeTexture(); } diff --git a/integration/abstraction/IBS.java b/integration/abstraction/IBS.java index 6e7e14ae..43737248 100644 --- a/integration/abstraction/IBS.java +++ b/integration/abstraction/IBS.java @@ -1,6 +1,6 @@ package appeng.integration.abstraction; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.util.InventoryAdaptor; public interface IBS diff --git a/integration/abstraction/IFMP.java b/integration/abstraction/IFMP.java index 19a69d6e..40cd5781 100644 --- a/integration/abstraction/IFMP.java +++ b/integration/abstraction/IFMP.java @@ -1,8 +1,10 @@ package appeng.integration.abstraction; +import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.tileentity.TileEntity; import appeng.api.parts.IPartHost; import appeng.parts.CableBusContainer; +import cpw.mods.fml.common.eventhandler.Event; public interface IFMP { @@ -13,4 +15,6 @@ public interface IFMP void registerPassThru(Class layerInterface); + Event newFMPPacketEvent(EntityPlayerMP sender); + } diff --git a/integration/abstraction/IMJ.java b/integration/abstraction/IMJ.java index 6aeefd76..828d802e 100644 --- a/integration/abstraction/IMJ.java +++ b/integration/abstraction/IMJ.java @@ -1,6 +1,6 @@ package appeng.integration.abstraction; -import appeng.integration.modules.helpers.BaseBCperdition; +import appeng.integration.abstraction.helpers.BaseBCperdition; import appeng.tile.powersink.BuildCraft; public interface IMJ diff --git a/integration/abstraction/ITE.java b/integration/abstraction/ITE.java index 8c1fea5a..adb1c485 100644 --- a/integration/abstraction/ITE.java +++ b/integration/abstraction/ITE.java @@ -2,7 +2,7 @@ package appeng.integration.abstraction; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; public interface ITE { diff --git a/integration/modules/helpers/BaseBCperdition.java b/integration/abstraction/helpers/BaseBCperdition.java similarity index 90% rename from integration/modules/helpers/BaseBCperdition.java rename to integration/abstraction/helpers/BaseBCperdition.java index 9cc9d42d..b3fd467b 100644 --- a/integration/modules/helpers/BaseBCperdition.java +++ b/integration/abstraction/helpers/BaseBCperdition.java @@ -1,24 +1,24 @@ -package appeng.integration.modules.helpers; - -import appeng.tile.events.AETileEventHandler; -import appeng.tile.events.TileEventType; -import buildcraft.api.power.PowerHandler.PowerReceiver; -import cpw.mods.fml.common.Optional.Method; - -public abstract class BaseBCperdition extends AETileEventHandler -{ - - public BaseBCperdition() { - super( TileEventType.TICK, TileEventType.WORLD_NBT ); - } - - @Method(modid = "BuildCraftAPI|power") - public abstract PowerReceiver getPowerReceiver(); - - public abstract double useEnergy(float f, float requred, boolean b); - - public abstract void addEnergy(float failed); - - public abstract void configure(int i, int j, float f, int k); - -} +package appeng.integration.abstraction.helpers; + +import appeng.tile.events.AETileEventHandler; +import appeng.tile.events.TileEventType; +import buildcraft.api.power.PowerHandler.PowerReceiver; +import cpw.mods.fml.common.Optional.Method; + +public abstract class BaseBCperdition extends AETileEventHandler +{ + + public BaseBCperdition() { + super( TileEventType.TICK, TileEventType.WORLD_NBT ); + } + + @Method(modid = "BuildCraftAPI|power") + public abstract PowerReceiver getPowerReceiver(); + + public abstract double useEnergy(float f, float requred, boolean b); + + public abstract void addEnergy(float failed); + + public abstract void configure(int i, int j, float f, int k); + +} diff --git a/integration/modules/BC.java b/integration/modules/BC.java index 5712e77f..05ef56b8 100644 --- a/integration/modules/BC.java +++ b/integration/modules/BC.java @@ -5,8 +5,8 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.Icon; -import net.minecraftforge.common.ForgeDirection; +import net.minecraft.util.IIcon; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.AEApi; import appeng.api.config.TunnelType; import appeng.api.features.IP2PTunnelRegistry; @@ -207,7 +207,7 @@ public class BC implements IIntegrationModule, IBC } @Override - public Icon getFacadeTexture() + public IIcon getFacadeTexture() { try { diff --git a/integration/modules/BS.java b/integration/modules/BS.java index e7a83acd..232a25c3 100644 --- a/integration/modules/BS.java +++ b/integration/modules/BS.java @@ -1,7 +1,7 @@ package appeng.integration.modules; import net.mcft.copy.betterstorage.api.ICrateStorage; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.AEApi; import appeng.integration.IIntegrationModule; import appeng.integration.abstraction.IBS; diff --git a/integration/modules/FMP.java b/integration/modules/FMP.java index a0161a69..c58edff0 100644 --- a/integration/modules/FMP.java +++ b/integration/modules/FMP.java @@ -56,7 +56,7 @@ public class FMP implements IIntegrationModule, IPartFactory, IPartConverter, IF if ( part instanceof CableBusPart ) { CableBusPart cbp = (CableBusPart) part; - cbp.convertFromTile( world.getBlockTileEntity( pos.x, pos.y, pos.z ) ); + cbp.convertFromTile( world.getTileEntity( pos.x, pos.y, pos.z ) ); } return part; diff --git a/integration/modules/FZ.java b/integration/modules/FZ.java index 4eb497ad..b440775c 100644 --- a/integration/modules/FZ.java +++ b/integration/modules/FZ.java @@ -114,7 +114,7 @@ public class FZ implements IFZ, IIntegrationModule else item.set( te, input == null ? null : input.copy() ); - te.onInventoryChanged(); + te.markDirty(); } catch (IllegalArgumentException e) { @@ -134,7 +134,7 @@ public class FZ implements IFZ, IIntegrationModule else setItemCount.invoke( te, max ); - te.onInventoryChanged(); + te.markDirty(); } catch (IllegalAccessException e) { diff --git a/integration/modules/GT.java b/integration/modules/GT.java index 6a34520a..5f4159ef 100644 --- a/integration/modules/GT.java +++ b/integration/modules/GT.java @@ -3,7 +3,7 @@ package appeng.integration.modules; import gregtechmod.api.interfaces.IDigitalChest; import net.minecraft.inventory.IInventory; import net.minecraft.tileentity.TileEntity; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.AEApi; import appeng.api.storage.IMEInventory; import appeng.integration.IIntegrationModule; diff --git a/integration/modules/TE.java b/integration/modules/TE.java index 9f3bdd66..3d43299b 100644 --- a/integration/modules/TE.java +++ b/integration/modules/TE.java @@ -4,7 +4,7 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.AEApi; import appeng.integration.IIntegrationModule; import appeng.integration.abstraction.ITE; @@ -42,8 +42,8 @@ public class TE implements IIntegrationModule, ITE { NBTTagCompound toSend = new NBTTagCompound(); toSend.setInteger( "energy", 3200 ); - toSend.setCompoundTag( "input", new NBTTagCompound() ); - toSend.setCompoundTag( "primaryOutput", new NBTTagCompound() ); + toSend.setTag( "input", new NBTTagCompound() ); + toSend.setTag( "primaryOutput", new NBTTagCompound() ); in.writeToNBT( toSend.getCompoundTag( "input" ) ); out.writeToNBT( toSend.getCompoundTag( "primaryOutput" ) ); diff --git a/integration/modules/helpers/BCPipeHandler.java b/integration/modules/helpers/BCPipeHandler.java index 185db8b0..dea7ac16 100644 --- a/integration/modules/helpers/BCPipeHandler.java +++ b/integration/modules/helpers/BCPipeHandler.java @@ -1,7 +1,7 @@ package appeng.integration.modules.helpers; import net.minecraft.tileentity.TileEntity; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.storage.IExternalStorageHandler; import appeng.api.storage.IMEInventory; import appeng.api.storage.StorageChannel; diff --git a/integration/modules/helpers/BCPipeInventory.java b/integration/modules/helpers/BCPipeInventory.java index 4f0c6d8c..99f7afec 100644 --- a/integration/modules/helpers/BCPipeInventory.java +++ b/integration/modules/helpers/BCPipeInventory.java @@ -1,7 +1,7 @@ package appeng.integration.modules.helpers; import net.minecraft.tileentity.TileEntity; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.config.Actionable; import appeng.api.networking.security.BaseActionSource; import appeng.api.storage.IMEInventory; diff --git a/integration/modules/helpers/BSCrate.java b/integration/modules/helpers/BSCrate.java index 9a22dea3..10a35388 100644 --- a/integration/modules/helpers/BSCrate.java +++ b/integration/modules/helpers/BSCrate.java @@ -2,7 +2,7 @@ package appeng.integration.modules.helpers; import net.mcft.copy.betterstorage.api.ICrateStorage; import net.minecraft.item.ItemStack; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.config.Actionable; import appeng.api.networking.security.BaseActionSource; import appeng.api.storage.IMEInventory; diff --git a/integration/modules/helpers/BSCrateHandler.java b/integration/modules/helpers/BSCrateHandler.java index 0b091ee9..24373587 100644 --- a/integration/modules/helpers/BSCrateHandler.java +++ b/integration/modules/helpers/BSCrateHandler.java @@ -2,7 +2,7 @@ package appeng.integration.modules.helpers; import net.mcft.copy.betterstorage.api.ICrateStorage; import net.minecraft.tileentity.TileEntity; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.storage.IExternalStorageHandler; import appeng.api.storage.IMEInventory; import appeng.api.storage.StorageChannel; diff --git a/integration/modules/helpers/BSCrateStorageAdaptor.java b/integration/modules/helpers/BSCrateStorageAdaptor.java index f565602b..cc290fee 100644 --- a/integration/modules/helpers/BSCrateStorageAdaptor.java +++ b/integration/modules/helpers/BSCrateStorageAdaptor.java @@ -4,7 +4,7 @@ import java.util.Iterator; import net.mcft.copy.betterstorage.api.ICrateStorage; import net.minecraft.item.ItemStack; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.config.FuzzyMode; import appeng.util.InventoryAdaptor; import appeng.util.Platform; diff --git a/integration/modules/helpers/FactorizationHandler.java b/integration/modules/helpers/FactorizationHandler.java index 017d8d15..dd0057e1 100644 --- a/integration/modules/helpers/FactorizationHandler.java +++ b/integration/modules/helpers/FactorizationHandler.java @@ -1,7 +1,7 @@ package appeng.integration.modules.helpers; import net.minecraft.tileentity.TileEntity; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.storage.IExternalStorageHandler; import appeng.api.storage.IMEInventory; import appeng.api.storage.StorageChannel; diff --git a/integration/modules/helpers/GregTechHandler.java b/integration/modules/helpers/GregTechHandler.java index a1f3fdba..f122bcb1 100644 --- a/integration/modules/helpers/GregTechHandler.java +++ b/integration/modules/helpers/GregTechHandler.java @@ -1,7 +1,7 @@ package appeng.integration.modules.helpers; import net.minecraft.tileentity.TileEntity; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.storage.IExternalStorageHandler; import appeng.api.storage.IMEInventory; import appeng.api.storage.StorageChannel; diff --git a/integration/modules/helpers/MFRDSUHandler.java b/integration/modules/helpers/MFRDSUHandler.java index 11fa9bd5..4e2aa597 100644 --- a/integration/modules/helpers/MFRDSUHandler.java +++ b/integration/modules/helpers/MFRDSUHandler.java @@ -1,7 +1,7 @@ package appeng.integration.modules.helpers; import net.minecraft.tileentity.TileEntity; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.storage.IExternalStorageHandler; import appeng.api.storage.IMEInventory; import appeng.api.storage.StorageChannel; diff --git a/items/AEBaseItem.java b/items/AEBaseItem.java index 68564bf5..419e05ec 100644 --- a/items/AEBaseItem.java +++ b/items/AEBaseItem.java @@ -4,7 +4,6 @@ import java.util.EnumSet; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import appeng.core.Configuration; import appeng.core.features.AEFeature; import appeng.core.features.AEFeatureHandler; import appeng.core.features.IAEFeature; @@ -39,7 +38,6 @@ public class AEBaseItem extends Item implements IAEFeature } public AEBaseItem(Class c, String subname) { - super( Configuration.instance.getItemID( c, subname ) ); FeatureSubname = subname; FeatureFullname = AEFeatureHandler.getName( c, subname ); } diff --git a/items/contents/CellConfig.java b/items/contents/CellConfig.java index fefefaa6..1da94c05 100644 --- a/items/contents/CellConfig.java +++ b/items/contents/CellConfig.java @@ -16,7 +16,7 @@ public class CellConfig extends AppEngInternalInventory } @Override - public void onInventoryChanged() + public void markDirty() { writeToNBT( Platform.openNbtData( is ), "list" ); } diff --git a/items/contents/CellUpgrades.java b/items/contents/CellUpgrades.java index 8cebd178..24dc7545 100644 --- a/items/contents/CellUpgrades.java +++ b/items/contents/CellUpgrades.java @@ -16,7 +16,7 @@ public class CellUpgrades extends UpgradeInventory } @Override - public void onInventoryChanged() + public void markDirty() { writeToNBT( Platform.openNbtData( is ), "upgrades" ); } diff --git a/items/contents/NetworkToolViewer.java b/items/contents/NetworkToolViewer.java index 07857d82..dd09f1f0 100644 --- a/items/contents/NetworkToolViewer.java +++ b/items/contents/NetworkToolViewer.java @@ -54,15 +54,15 @@ public class NetworkToolViewer implements INetworkTool } @Override - public String getInvName() + public String getInventoryName() { - return inv.getInvName(); + return inv.getInventoryName(); } @Override - public boolean isInvNameLocalized() + public boolean hasCustomInventoryName() { - return inv.isInvNameLocalized(); + return inv.hasCustomInventoryName(); } @Override @@ -72,9 +72,9 @@ public class NetworkToolViewer implements INetworkTool } @Override - public void onInventoryChanged() + public void markDirty() { - inv.onInventoryChanged(); + inv.markDirty(); inv.writeToNBT( Platform.openNbtData( is ), "inv" ); } @@ -85,15 +85,15 @@ public class NetworkToolViewer implements INetworkTool } @Override - public void openChest() + public void openInventory() { - inv.openChest(); + inv.openInventory(); } @Override - public void closeChest() + public void closeInventory() { - inv.closeChest(); + inv.closeInventory(); } @Override diff --git a/items/materials/ItemMaterial.java b/items/materials/ItemMaterial.java index bab3f84a..706c94d8 100644 --- a/items/materials/ItemMaterial.java +++ b/items/materials/ItemMaterial.java @@ -10,13 +10,14 @@ import java.util.Map.Entry; import java.util.regex.Matcher; import java.util.regex.Pattern; -import net.minecraft.client.renderer.texture.IconRegister; +import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.Entity; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.Icon; +import net.minecraft.util.IIcon; import net.minecraft.world.World; import net.minecraftforge.oredict.OreDictionary; import appeng.api.config.Upgrades; @@ -145,9 +146,9 @@ public class ItemMaterial extends AEBaseItem implements IStorageComponent, IUpgr } @Override - public Icon getIconFromDamage(int dmg) + public IIcon getIconFromDamage(int dmg) { - return dmgToMaterial.get( dmg ).icon; + return dmgToMaterial.get( dmg ).IIcon; } private String nameOf(ItemStack is) @@ -162,14 +163,14 @@ public class ItemMaterial extends AEBaseItem implements IStorageComponent, IUpgr } @Override - public void registerIcons(IconRegister icoRegister) + public void registerIcons(IIconRegister icoRegister) { for (MaterialType mat : MaterialType.values()) { if ( mat.damageValue != -1 ) { String tex = "appliedenergistics2:" + nameOf( new ItemStack( this, 1, mat.damageValue ) ); - mat.icon = icoRegister.registerIcon( tex ); + mat.IIcon = icoRegister.registerIcon( tex ); } } } @@ -260,7 +261,7 @@ public class ItemMaterial extends AEBaseItem implements IStorageComponent, IUpgr } @Override - public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List cList) + public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List cList) { for (MaterialType mat : MaterialType.values()) { diff --git a/items/materials/MaterialType.java b/items/materials/MaterialType.java index fe784dc2..75cb7dce 100644 --- a/items/materials/MaterialType.java +++ b/items/materials/MaterialType.java @@ -3,7 +3,7 @@ package appeng.items.materials; import java.util.EnumSet; import net.minecraft.entity.Entity; -import net.minecraft.util.Icon; +import net.minecraft.util.IIcon; import net.minecraftforge.oredict.OreDictionary; import appeng.client.render.entity.EntityIds; import appeng.core.AppEng; @@ -55,9 +55,9 @@ public enum MaterialType private EnumSet features; private Class droppedEntity; - // icon for the material. + // IIcon for the material. @SideOnly(Side.CLIENT) - public Icon icon; + public IIcon IIcon; public int damageValue = -1; MaterialType() { diff --git a/items/parts/ItemFacade.java b/items/parts/ItemFacade.java index e7282710..40504c82 100644 --- a/items/parts/ItemFacade.java +++ b/items/parts/ItemFacade.java @@ -8,12 +8,14 @@ import net.minecraft.block.Block; import net.minecraft.block.BlockGlass; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.World; import net.minecraftforge.client.MinecraftForgeClient; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.AEApi; import appeng.block.solids.OreQuartz; import appeng.client.render.BusRenderer; @@ -34,7 +36,7 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem setfeature( EnumSet.of( AEFeature.Facades ) ); setHasSubtypes( true ); if ( Platform.isClient() ) - MinecraftForgeClient.registerItemRenderer( itemID, BusRenderer.instance ); + MinecraftForgeClient.registerItemRenderer( this, BusRenderer.instance ); } @Override @@ -65,12 +67,12 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem { calculateSubTypes(); if ( subTypes.isEmpty() ) - return new ItemStack( Item.cake ); + return new ItemStack( Items.cake ); return subTypes.get( 0 ); } @Override - public void getSubItems(int number, CreativeTabs tab, List list) + public void getSubItems(Item number, CreativeTabs tab, List list) { calculateSubTypes(); list.addAll( subTypes ); @@ -99,23 +101,25 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem if ( subTypes == null ) { subTypes = new ArrayList(); - for (int id = 0; id < Block.blocksList.length; id++) + for (Object blk : Block.blockRegistry) { - Block b = Block.blocksList[id]; + Block b = (Block) blk; if ( b != null && FacadeConfig.instance.checkEnabled( b, b.isOpaqueCube() && !b.getTickRandomly() && !(b instanceof OreQuartz) || b instanceof BlockGlass ) ) { try { + Item item = Item.getItemFromBlock( b ); + List tmpList = new ArrayList(); - b.getSubBlocks( b.blockID, b.getCreativeTabToDisplayOn(), tmpList ); + b.getSubBlocks( item, b.getCreativeTabToDisplayOn(), tmpList ); for (ItemStack l : tmpList) { ItemStack is = new ItemStack( this ); NBTTagCompound data = new NBTTagCompound(); int[] ds = new int[2]; - ds[0] = l.itemID; + ds[0] = Item.getIdFromItem( l.getItem() ); ds[1] = l.getItem().getMetadata( l.getItemDamage() ); data.setIntArray( "x", ds ); is.setTagCompound( data ); @@ -144,9 +148,9 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem { int[] blk = data.getIntArray( "x" ); if ( blk != null && blk.length == 2 ) - return Block.blocksList[blk[0]]; + return Block.getBlockById( blk[0] ); } - return Block.glass; + return Blocks.glass; } @Override @@ -163,14 +167,14 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem } @Override - public String getItemDisplayName(ItemStack is) + public String getItemStackDisplayName(ItemStack is) { try { ItemStack in = getTextureItem( is ); if ( in != null ) { - return super.getItemDisplayName( is ) + " - " + in.getDisplayName(); + return super.getItemStackDisplayName( is ) + " - " + in.getDisplayName(); } } catch (Throwable t) @@ -178,7 +182,7 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem } - return super.getItemDisplayName( is ); + return super.getItemStackDisplayName( is ); } } diff --git a/items/parts/ItemPart.java b/items/parts/ItemPart.java index 68ccae93..edc5137f 100644 --- a/items/parts/ItemPart.java +++ b/items/parts/ItemPart.java @@ -5,11 +5,12 @@ import java.util.HashMap; import java.util.List; import java.util.Map.Entry; -import net.minecraft.client.renderer.texture.IconRegister; +import net.minecraft.client.renderer.texture.IIconRegister; 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.Icon; +import net.minecraft.util.IIcon; import net.minecraft.world.World; import appeng.api.AEApi; import appeng.api.implementations.items.IItemGroup; @@ -33,7 +34,7 @@ public class ItemPart extends AEBaseItem implements IPartItem, IItemGroup int varient; @SideOnly(Side.CLIENT) - Icon ico; + IIcon ico; }; @@ -109,9 +110,9 @@ public class ItemPart extends AEBaseItem implements IPartItem, IItemGroup } @Override - public Icon getIconFromDamage(int dmg) + public IIcon getIconFromDamage(int dmg) { - Icon ico = dmgToPart.get( dmg ).ico; + IIcon ico = dmgToPart.get( dmg ).ico; return ico; } @@ -127,7 +128,7 @@ public class ItemPart extends AEBaseItem implements IPartItem, IItemGroup } @Override - public String getItemDisplayName(ItemStack is) + public String getItemStackDisplayName(ItemStack is) { PartType pt = getTypeByStack( is ); if ( pt == null ) @@ -136,16 +137,16 @@ public class ItemPart extends AEBaseItem implements IPartItem, IItemGroup Enum[] varients = pt.getVarients(); if ( varients != null ) - return super.getItemDisplayName( is ) + " - " + varients[dmgToPart.get( is.getItemDamage() ).varient].toString(); + return super.getItemStackDisplayName( is ) + " - " + varients[dmgToPart.get( is.getItemDamage() ).varient].toString(); if ( pt.getExtraName() != null ) - return super.getItemDisplayName( is ) + " - " + pt.getExtraName().getLocal(); + return super.getItemStackDisplayName( is ) + " - " + pt.getExtraName().getLocal(); - return super.getItemDisplayName( is ); + return super.getItemStackDisplayName( is ); } @Override - public void registerIcons(IconRegister par1IconRegister) + public void registerIcons(IIconRegister par1IconRegister) { for (Entry part : dmgToPart.entrySet()) { @@ -178,7 +179,7 @@ public class ItemPart extends AEBaseItem implements IPartItem, IItemGroup } @Override - public void getSubItems(int number, CreativeTabs tab, List cList) + public void getSubItems(Item number, CreativeTabs tab, List cList) { for (Entry part : dmgToPart.entrySet()) cList.add( new ItemStack( this, 1, part.getKey() ) ); diff --git a/items/tools/ToolBiometricCard.java b/items/tools/ToolBiometricCard.java index 4853f818..d34a7489 100644 --- a/items/tools/ToolBiometricCard.java +++ b/items/tools/ToolBiometricCard.java @@ -25,16 +25,14 @@ public class ToolBiometricCard extends AEBaseItem implements IBiometricCard setfeature( EnumSet.of( AEFeature.Security ) ); setMaxStackSize( 1 ); if ( Platform.isClient() ) - MinecraftForgeClient.registerItemRenderer( itemID, new ToolBiometricCardRender() ); + MinecraftForgeClient.registerItemRenderer( this, new ToolBiometricCardRender() ); } @Override - public String getItemDisplayName(ItemStack is) + public String getItemStackDisplayName(ItemStack is) { String username = getUsername( is ); - return username.length() > 0 ? super.getItemDisplayName( is ) + " - " + username : super.getItemDisplayName( is );// GuiText.Encoded.getLocal() - // // - // ); + return username.length() > 0 ? super.getItemStackDisplayName( is ) + " - " + username : super.getItemStackDisplayName( is ); } @Override @@ -67,10 +65,10 @@ public class ToolBiometricCard extends AEBaseItem implements IBiometricCard private void encode(ItemStack is, EntityPlayer p) { String username = getUsername( is ); - if ( p.username.equals( username ) ) + if ( p.getCommandSenderName().equals( username ) ) setUsername( is, "" ); else - setUsername( is, p.username ); + setUsername( is, p.getCommandSenderName() ); } @Override diff --git a/items/tools/ToolMemoryCard.java b/items/tools/ToolMemoryCard.java index f4fb55a8..462a07e6 100644 --- a/items/tools/ToolMemoryCard.java +++ b/items/tools/ToolMemoryCard.java @@ -40,7 +40,7 @@ public class ToolMemoryCard extends AEBaseItem implements IMemoryCard { NBTTagCompound c = Platform.openNbtData( is ); c.setString( "Config", SettingsName ); - c.setCompoundTag( "Data", data ); + c.setTag( "Data", data ); } @Override @@ -70,13 +70,13 @@ public class ToolMemoryCard extends AEBaseItem implements IMemoryCard switch (msg) { case INVALID_MACHINE: - player.sendChatToPlayer( PlayerMessages.InvalidMachine.get() ); + player.addChatMessage( PlayerMessages.InvalidMachine.get() ); break; case SETTINGS_LOADED: - player.sendChatToPlayer( PlayerMessages.LoadedSettings.get() ); + player.addChatMessage( PlayerMessages.LoadedSettings.get() ); break; case SETTINGS_SAVED: - player.sendChatToPlayer( PlayerMessages.SavedSettings.get() ); + player.addChatMessage( PlayerMessages.SavedSettings.get() ); break; default: } diff --git a/items/tools/ToolNetworkTool.java b/items/tools/ToolNetworkTool.java index 7d8c9925..dec8f00a 100644 --- a/items/tools/ToolNetworkTool.java +++ b/items/tools/ToolNetworkTool.java @@ -7,7 +7,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.implementations.guiobjects.IGuiItem; import appeng.api.implementations.guiobjects.IGuiItemObject; import appeng.api.implementations.items.IAEWrench; @@ -34,19 +34,18 @@ public class ToolNetworkTool extends AEBaseItem implements IGuiItem, IAEWrench, @Override public IGuiItemObject getGuiObject(ItemStack is, World world, int x, int y, int z) { - TileEntity te = world.getBlockTileEntity( x, y, z ); + TileEntity te = world.getTileEntity( x, y, z ); return new NetworkToolViewer( is, (IGridHost) (te instanceof IGridHost ? te : null) ); } @Override public boolean onItemUseFirst(ItemStack is, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ) { - int id = world.getBlockId( x, y, z ); - if ( id > 0 && !player.isSneaking() ) + Block b = world.getBlock( x, y, z ); + if ( b != null && !player.isSneaking() ) { - Block b = Block.blocksList[id]; - TileEntity te = world.getBlockTileEntity( x, y, z ); - if ( b != null && !(te instanceof IGridHost) ) + TileEntity te = world.getTileEntity( x, y, z ); + if ( !(te instanceof IGridHost) ) { if ( b.rotateBlock( world, x, y, z, ForgeDirection.getOrientation( side ) ) ) { @@ -69,7 +68,7 @@ public class ToolNetworkTool extends AEBaseItem implements IGuiItem, IAEWrench, if ( p.openContainer instanceof AEBaseContainer ) return true; - TileEntity te = w.getBlockTileEntity( x, y, z ); + TileEntity te = w.getTileEntity( x, y, z ); if ( te instanceof IGridHost ) Platform.openGUI( p, te, ForgeDirection.getOrientation( side ), GuiBridge.GUI_NETWORK_STATUS ); else @@ -88,7 +87,7 @@ public class ToolNetworkTool extends AEBaseItem implements IGuiItem, IAEWrench, } @Override - public boolean shouldPassSneakingClickToBlock(World w, int x, int y, int z) + public boolean doesSneakBypassUse(World world, int x, int y, int z, EntityPlayer player) { return true; } diff --git a/items/tools/powered/ToolChargedStaff.java b/items/tools/powered/ToolChargedStaff.java index 4a967191..8f622007 100644 --- a/items/tools/powered/ToolChargedStaff.java +++ b/items/tools/powered/ToolChargedStaff.java @@ -37,7 +37,7 @@ public class ToolChargedStaff extends AEBasePoweredItem float dx = (float) (Platform.getRandomFloat() * target.width + target.boundingBox.minX); float dy = (float) (Platform.getRandomFloat() * target.height + target.boundingBox.minY); float dz = (float) (Platform.getRandomFloat() * target.width + target.boundingBox.minZ); - ServerHelper.proxy.sendToAllNearExcept( null, dx, dy, dz, 32.0, target.worldObj, (new PacketLightning( dx, dy, dz )).getPacket() ); + ServerHelper.proxy.sendToAllNearExcept( null, dx, dy, dz, 32.0, target.worldObj, new PacketLightning( dx, dy, dz ) ); } } catch (IOException e) diff --git a/items/tools/powered/ToolEntropyManipulator.java b/items/tools/powered/ToolEntropyManipulator.java index 41d5163e..ec394ae4 100644 --- a/items/tools/powered/ToolEntropyManipulator.java +++ b/items/tools/powered/ToolEntropyManipulator.java @@ -9,14 +9,16 @@ import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.FurnaceRecipes; -import net.minecraft.util.EnumMovingObjectType; import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.MovingObjectPosition.MovingObjectType; import net.minecraft.world.World; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.oredict.OreDictionary; import appeng.core.Configuration; import appeng.core.features.AEFeature; import appeng.items.tools.powered.powersink.AEBasePoweredItem; @@ -26,25 +28,50 @@ import appeng.util.Platform; public class ToolEntropyManipulator extends AEBasePoweredItem { - static private Hashtable heatUp; - static private Hashtable coolDown; - - static public void heat(int BlockID, int Metadata, World w, int x, int y, int z) + static class Combo { - InWorldToolOperationResult r = heatUp.get( BlockID + ":" + Metadata ); + + final public Block blk; + final public int meta; + + public Combo(Block b, int m) { + blk = b; + meta = m; + } + + @Override + public int hashCode() + { + return blk.hashCode() ^ meta; + } + + @Override + public boolean equals(Object obj) + { + return blk == ((Combo) obj).blk && meta == ((Combo) obj).meta; + } + + }; + + static private Hashtable heatUp; + static private Hashtable coolDown; + + static public void heat(Block BlockID, int Metadata, World w, int x, int y, int z) + { + InWorldToolOperationResult r = heatUp.get( new Combo( BlockID, Metadata ) ); if ( r == null ) { - r = heatUp.get( BlockID + ":*" ); + r = heatUp.get( new Combo( BlockID, OreDictionary.WILDCARD_VALUE ) ); } if ( r.BlockItem != null ) { - w.setBlock( x, y, z, r.BlockItem.itemID, r.BlockItem.getItemDamage(), 3 ); + w.setBlock( x, y, z, Block.getBlockFromItem( r.BlockItem.getItem() ), r.BlockItem.getItemDamage(), 3 ); } else { - w.setBlock( x, y, z, 0, 0, 3 ); + w.setBlock( x, y, z, Platform.air, 0, 3 ); } if ( r.Drops != null ) @@ -53,34 +80,34 @@ public class ToolEntropyManipulator extends AEBasePoweredItem } } - static public boolean canHeat(int BlockID, int Metadata) + static public boolean canHeat(Block BlockID, int Metadata) { - InWorldToolOperationResult r = heatUp.get( BlockID + ":" + Metadata ); + InWorldToolOperationResult r = heatUp.get( new Combo( BlockID, Metadata ) ); if ( r == null ) { - r = heatUp.get( BlockID + ":*" ); + r = heatUp.get( new Combo( BlockID, OreDictionary.WILDCARD_VALUE ) ); } return r != null; } - static public void cool(int BlockID, int Metadata, World w, int x, int y, int z) + static public void cool(Block BlockID, int Metadata, World w, int x, int y, int z) { - InWorldToolOperationResult r = coolDown.get( BlockID + ":" + Metadata ); + InWorldToolOperationResult r = coolDown.get( new Combo( BlockID, Metadata ) ); if ( r == null ) { - r = coolDown.get( BlockID + ":*" ); + r = coolDown.get( new Combo( BlockID, OreDictionary.WILDCARD_VALUE ) ); } if ( r.BlockItem != null ) { - w.setBlock( x, y, z, r.BlockItem.itemID, r.BlockItem.getItemDamage(), 3 ); + w.setBlock( x, y, z, Block.getBlockFromItem( r.BlockItem.getItem() ), r.BlockItem.getItemDamage(), 3 ); } else { - w.setBlock( x, y, z, 0, 0, 3 ); + w.setBlock( x, y, z, Platform.air, 0, 3 ); } if ( r.Drops != null ) @@ -89,13 +116,13 @@ public class ToolEntropyManipulator extends AEBasePoweredItem } } - static public boolean canCool(int BlockID, int Metadata) + static public boolean canCool(Block BlockID, int Metadata) { - InWorldToolOperationResult r = coolDown.get( BlockID + ":" + Metadata ); + InWorldToolOperationResult r = coolDown.get( new Combo( BlockID, Metadata ) ); if ( r == null ) { - r = coolDown.get( BlockID + ":*" ); + r = coolDown.get( new Combo( BlockID, OreDictionary.WILDCARD_VALUE ) ); } return r != null; @@ -106,23 +133,23 @@ public class ToolEntropyManipulator extends AEBasePoweredItem setfeature( EnumSet.of( AEFeature.EntropyManipulator, AEFeature.PoweredTools ) ); maxStoredPower = Configuration.instance.manipulator_battery; - coolDown = new Hashtable(); - coolDown.put( Block.stone.blockID + ":0", new InWorldToolOperationResult( new ItemStack( Block.cobblestone ) ) ); - coolDown.put( Block.stoneBrick.blockID + ":0", new InWorldToolOperationResult( new ItemStack( Block.stoneBrick, 1, 2 ) ) ); - coolDown.put( Block.lavaStill.blockID + ":*", new InWorldToolOperationResult( new ItemStack( Block.obsidian ) ) ); - coolDown.put( Block.lavaMoving.blockID + ":*", new InWorldToolOperationResult( new ItemStack( Block.obsidian ) ) ); - coolDown.put( Block.grass.blockID + ":*", new InWorldToolOperationResult( new ItemStack( Block.dirt ) ) ); + coolDown = new Hashtable(); + coolDown.put( new Combo( Blocks.stone, 0 ), new InWorldToolOperationResult( new ItemStack( Blocks.cobblestone ) ) ); + coolDown.put( new Combo( Blocks.stonebrick, 0 ), new InWorldToolOperationResult( new ItemStack( Blocks.stonebrick, 1, 2 ) ) ); + coolDown.put( new Combo( Blocks.lava, OreDictionary.WILDCARD_VALUE ), new InWorldToolOperationResult( new ItemStack( Blocks.obsidian ) ) ); + coolDown.put( new Combo( Blocks.flowing_lava, OreDictionary.WILDCARD_VALUE ), new InWorldToolOperationResult( new ItemStack( Blocks.obsidian ) ) ); + coolDown.put( new Combo( Blocks.grass, OreDictionary.WILDCARD_VALUE ), new InWorldToolOperationResult( new ItemStack( Blocks.dirt ) ) ); List snowBalls = new ArrayList(); - snowBalls.add( new ItemStack( Item.snowball ) ); - coolDown.put( Block.waterMoving.blockID + ":*", new InWorldToolOperationResult( null, snowBalls ) ); - coolDown.put( Block.waterStill.blockID + ":*", new InWorldToolOperationResult( new ItemStack( Block.ice ) ) ); + snowBalls.add( new ItemStack( Items.snowball ) ); + coolDown.put( new Combo( Blocks.flowing_water, OreDictionary.WILDCARD_VALUE ), new InWorldToolOperationResult( null, snowBalls ) ); + coolDown.put( new Combo( Blocks.water, OreDictionary.WILDCARD_VALUE ), new InWorldToolOperationResult( new ItemStack( Blocks.ice ) ) ); - heatUp = new Hashtable(); - heatUp.put( Block.ice.blockID + ":0", new InWorldToolOperationResult( new ItemStack( Block.waterStill ) ) ); - heatUp.put( Block.waterMoving.blockID + ":*", new InWorldToolOperationResult() ); - heatUp.put( Block.waterStill.blockID + ":*", new InWorldToolOperationResult() ); - heatUp.put( Block.blockSnow.blockID + ":*", new InWorldToolOperationResult( new ItemStack( Block.waterStill ) ) ); + heatUp = new Hashtable(); + heatUp.put( new Combo( Blocks.ice, 0 ), new InWorldToolOperationResult( new ItemStack( Blocks.water ) ) ); + heatUp.put( new Combo( Blocks.flowing_water, OreDictionary.WILDCARD_VALUE ), new InWorldToolOperationResult() ); + heatUp.put( new Combo( Blocks.water, OreDictionary.WILDCARD_VALUE ), new InWorldToolOperationResult() ); + heatUp.put( new Combo( Blocks.snow, OreDictionary.WILDCARD_VALUE ), new InWorldToolOperationResult( new ItemStack( Blocks.flowing_water ) ) ); } @Override @@ -146,13 +173,13 @@ public class ToolEntropyManipulator extends AEBasePoweredItem return item; else { - if ( target.typeOfHit == EnumMovingObjectType.TILE ) + if ( target.typeOfHit == MovingObjectType.BLOCK ) { int x = target.blockX; int y = target.blockY; int z = target.blockZ; - if ( w.getBlockMaterial( x, y, z ) == Material.lava || w.getBlockMaterial( x, y, z ) == Material.water ) + if ( w.getBlock( x, y, z ).getMaterial() == Material.lava || w.getBlock( x, y, z ).getMaterial() == Material.water ) { if ( w.canMineBlock( p, x, y, z ) ) { @@ -173,7 +200,7 @@ public class ToolEntropyManipulator extends AEBasePoweredItem if ( !p.canPlayerEdit( x, y, z, side, item ) ) return false; - int BlockID = w.getBlockId( x, y, z ); + Block BlockID = w.getBlock( x, y, z ); int Metadata = w.getBlockMetadata( x, y, z ); if ( p.isSneaking() ) @@ -207,7 +234,7 @@ public class ToolEntropyManipulator extends AEBasePoweredItem { if ( result.getItem() instanceof ItemBlock ) { - if ( ((ItemBlock) result.getItem()).getBlockID() == BlockID && result.getItem().getDamage( result ) == Metadata ) + if ( Block.getBlockFromItem( (ItemBlock) result.getItem() ) == BlockID && result.getItem().getDamage( result ) == Metadata ) { canFurnaceable = false; } @@ -230,11 +257,11 @@ public class ToolEntropyManipulator extends AEBasePoweredItem if ( or.BlockItem == null ) { - w.setBlock( x, y, z, 0, 0, 3 ); + w.setBlock( x, y, z, Platform.air, 0, 3 ); } else { - w.setBlock( x, y, z, or.BlockItem.itemID, or.BlockItem.getItemDamage(), 3 ); + w.setBlock( x, y, z, Block.getBlockFromItem( or.BlockItem.getItem() ), or.BlockItem.getItemDamage(), 3 ); } if ( or.Drops != null ) @@ -258,7 +285,7 @@ public class ToolEntropyManipulator extends AEBasePoweredItem { extractAEPower( item, 1600 ); w.playSoundEffect( (double) x + 0.5D, (double) y + 0.5D, (double) z + 0.5D, "fire.ignite", 1.0F, itemRand.nextFloat() * 0.4F + 0.8F ); - w.setBlock( x, y, z, Block.fire.blockID ); + w.setBlock( x, y, z, Blocks.fire ); } return true; diff --git a/items/tools/powered/ToolMassCannon.java b/items/tools/powered/ToolMassCannon.java index 5e9c6e8c..0025ab32 100644 --- a/items/tools/powered/ToolMassCannon.java +++ b/items/tools/powered/ToolMassCannon.java @@ -12,9 +12,9 @@ import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.DamageSource; -import net.minecraft.util.EnumMovingObjectType; import net.minecraft.util.MathHelper; import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.MovingObjectPosition.MovingObjectType; import net.minecraft.util.Vec3; import net.minecraft.world.World; import appeng.api.AEApi; @@ -131,9 +131,9 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell AxisAlignedBB bb = AxisAlignedBB .getAABBPool() - .getAABB( Math.min( vec3.xCoord, vec31.xCoord ), Math.min( vec3.yCoord, vec31.yCoord ), Math.min( vec3.zCoord, vec31.zCoord ), - Math.max( vec3.xCoord, vec31.xCoord ), Math.max( vec3.yCoord, vec31.yCoord ), Math.max( vec3.zCoord, vec31.zCoord ) ) - .expand( 16, 16, 16 ); + .getAABB( Math.min( vec3.xCoord, vec31.xCoord ), Math.min( vec3.yCoord, vec31.yCoord ), + Math.min( vec3.zCoord, vec31.zCoord ), Math.max( vec3.xCoord, vec31.xCoord ), + Math.max( vec3.yCoord, vec31.yCoord ), Math.max( vec3.zCoord, vec31.zCoord ) ).expand( 16, 16, 16 ); Entity entity = null; List list = w.getEntitiesWithinAABBExcludingEntity( p, bb ); @@ -171,7 +171,7 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell } Vec3 Srec = w.getWorldVec3Pool().getVecFromPool( d0, d1, d2 ); - MovingObjectPosition pos = w.rayTraceBlocks_do_do( vec3, vec31, true, false ); + MovingObjectPosition pos = w.rayTraceBlocks( vec3, vec31, true ); if ( entity != null && pos != null && pos.hitVec.squareDistanceTo( Srec ) > Closeest ) { pos = new MovingObjectPosition( entity ); @@ -183,8 +183,8 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell try { - CommonHelper.proxy.sendToAllNearExcept( null, d0, d1, d2, 128, w, (new PacketMatterCannon( d0, d1, d2, (float) (f7 * d3), (float) (f6 * d3), - (float) (f8 * d3), (byte) (pos == null ? 32 : pos.hitVec.squareDistanceTo( Srec ) + 1) )).getPacket() ); + CommonHelper.proxy.sendToAllNearExcept( null, d0, d1, d2, 128, w, new PacketMatterCannon( d0, d1, d2, (float) (f7 * d3), + (float) (f6 * d3), (float) (f8 * d3), (byte) (pos == null ? 32 : pos.hitVec.squareDistanceTo( Srec ) + 1) ) ); } catch (Exception err) @@ -197,7 +197,7 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell DamageSource dmgSrc = DamageSource.causePlayerDamage( p ); dmgSrc.damageType = "masscannon"; - if ( pos.typeOfHit == EnumMovingObjectType.ENTITY ) + if ( pos.typeOfHit == MovingObjectType.ENTITY ) { int dmg = (int) Math.ceil( penitration / 20.0f ); if ( pos.entityHit instanceof EntityLivingBase ) @@ -221,29 +221,26 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell hasDestroyedSomething = true; } } - else if ( pos.typeOfHit == EnumMovingObjectType.TILE ) + else if ( pos.typeOfHit == MovingObjectType.BLOCK ) { if ( !Configuration.instance.isFeatureEnabled( AEFeature.MassCannonBlockDamage ) ) penitration = 0; else { - int bid = w.getBlockId( pos.blockX, pos.blockY, pos.blockZ ); + Block b = w.getBlock( pos.blockX, pos.blockY, pos.blockZ ); // int meta = w.getBlockMetadata( // pos.blockX, pos.blockY, pos.blockZ ); - if ( bid > 0 ) + float hardness = b.getBlockHardness( w, pos.blockX, pos.blockY, pos.blockZ ) * 9.0f; + if ( hardness >= 0.0 ) { - Block b = Block.blocksList[bid]; - float hardness = b.getBlockHardness( w, pos.blockX, pos.blockY, pos.blockZ ) * 9.0f; - if ( hardness >= 0.0 ) + if ( penitration > hardness ) { - if ( penitration > hardness ) - { - hasDestroyedSomething = true; - penitration -= hardness; - penitration *= 0.60; - w.destroyBlock( pos.blockX, pos.blockY, pos.blockZ, true ); - } + hasDestroyedSomething = true; + penitration -= hardness; + penitration *= 0.60; + w.func_147480_a( pos.blockX, pos.blockY, pos.blockZ, true ); + // w.destroyBlock( pos.blockX, pos.blockY, pos.blockZ, true ); } } } @@ -255,7 +252,7 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell else { if ( Platform.isServer() ) - p.sendChatToPlayer( PlayerMessages.AmmoDepleted.get() ); + p.addChatMessage( PlayerMessages.AmmoDepleted.get() ); return item; } } diff --git a/items/tools/powered/ToolPortableCell.java b/items/tools/powered/ToolPortableCell.java index d8593b05..024227a2 100644 --- a/items/tools/powered/ToolPortableCell.java +++ b/items/tools/powered/ToolPortableCell.java @@ -7,7 +7,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import net.minecraft.world.World; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.AEApi; import appeng.api.config.FuzzyMode; import appeng.api.implementations.guiobjects.IGuiItem; diff --git a/items/tools/powered/powersink/AERootPoweredItem.java b/items/tools/powered/powersink/AERootPoweredItem.java index b9a93f15..9014ab62 100644 --- a/items/tools/powered/powersink/AERootPoweredItem.java +++ b/items/tools/powered/powersink/AERootPoweredItem.java @@ -5,6 +5,7 @@ import java.util.List; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import appeng.api.config.AccessRestriction; @@ -166,7 +167,7 @@ public class AERootPoweredItem extends AEBaseItem implements IAEItemPowerStorage } @Override - public void getSubItems(int id, CreativeTabs tab, List list) + public void getSubItems(Item id, CreativeTabs tab, List list) { super.getSubItems( id, tab, list ); diff --git a/items/tools/powered/powersink/ThermalExpansion.java b/items/tools/powered/powersink/ThermalExpansion.java index bc211319..e1160ffb 100644 --- a/items/tools/powered/powersink/ThermalExpansion.java +++ b/items/tools/powered/powersink/ThermalExpansion.java @@ -34,7 +34,7 @@ public class ThermalExpansion extends IC2 implements IEnergyContainerItem @Override public int getMaxEnergyStored(ItemStack is) { - return (int) PowerUnits.AE.convertTo( PowerUnits.EU, getMaxEnergyStored( is ) ); + return (int) PowerUnits.AE.convertTo( PowerUnits.RF, getAEMaxPower( is ) ); } } diff --git a/items/tools/quartz/ToolQuartzAxe.java b/items/tools/quartz/ToolQuartzAxe.java index 5ab2cf45..1f154e81 100644 --- a/items/tools/quartz/ToolQuartzAxe.java +++ b/items/tools/quartz/ToolQuartzAxe.java @@ -2,10 +2,7 @@ package appeng.items.tools.quartz; import java.util.EnumSet; -import net.minecraft.item.EnumToolMaterial; import net.minecraft.item.ItemAxe; -import net.minecraftforge.common.MinecraftForge; -import appeng.core.Configuration; import appeng.core.features.AEFeature; import appeng.core.features.AEFeatureHandler; import appeng.core.features.IAEFeature; @@ -22,8 +19,7 @@ public class ToolQuartzAxe extends ItemAxe implements IAEFeature } public ToolQuartzAxe(AEFeature Type) { - super( Configuration.instance.getItemID( ToolQuartzAxe.class, Type.name() ), EnumToolMaterial.IRON ); - MinecraftForge.setToolClass( this, "axe", EnumToolMaterial.IRON.getHarvestLevel() ); + super( ToolMaterial.IRON ); feature = new AEFeatureHandler( EnumSet.of( Type, AEFeature.QuartzAxe ), this, Type.name() ); } diff --git a/items/tools/quartz/ToolQuartzCuttingKnife.java b/items/tools/quartz/ToolQuartzCuttingKnife.java index 0a1e074b..30d7c72c 100644 --- a/items/tools/quartz/ToolQuartzCuttingKnife.java +++ b/items/tools/quartz/ToolQuartzCuttingKnife.java @@ -35,7 +35,7 @@ public class ToolQuartzCuttingKnife extends AEBaseItem } @Override - public ItemStack getContainerItemStack(ItemStack itemStack) + public ItemStack getContainerItem(ItemStack itemStack) { itemStack.setItemDamage( itemStack.getItemDamage() + 1 ); return itemStack; diff --git a/items/tools/quartz/ToolQuartzHoe.java b/items/tools/quartz/ToolQuartzHoe.java index 5d6d240c..1c121bf8 100644 --- a/items/tools/quartz/ToolQuartzHoe.java +++ b/items/tools/quartz/ToolQuartzHoe.java @@ -2,10 +2,7 @@ package appeng.items.tools.quartz; import java.util.EnumSet; -import net.minecraft.item.EnumToolMaterial; import net.minecraft.item.ItemHoe; -import net.minecraftforge.common.MinecraftForge; -import appeng.core.Configuration; import appeng.core.features.AEFeature; import appeng.core.features.AEFeatureHandler; import appeng.core.features.IAEFeature; @@ -22,8 +19,7 @@ public class ToolQuartzHoe extends ItemHoe implements IAEFeature } public ToolQuartzHoe(AEFeature Type) { - super( Configuration.instance.getItemID( ToolQuartzHoe.class, Type.name() ), EnumToolMaterial.IRON ); - MinecraftForge.setToolClass( this, "hoe", EnumToolMaterial.IRON.getHarvestLevel() ); + super( ToolMaterial.IRON ); feature = new AEFeatureHandler( EnumSet.of( Type, AEFeature.QuartzHoe ), this, Type.name() ); } diff --git a/items/tools/quartz/ToolQuartzPickaxe.java b/items/tools/quartz/ToolQuartzPickaxe.java index 8c67097b..967c0337 100644 --- a/items/tools/quartz/ToolQuartzPickaxe.java +++ b/items/tools/quartz/ToolQuartzPickaxe.java @@ -2,10 +2,7 @@ package appeng.items.tools.quartz; import java.util.EnumSet; -import net.minecraft.item.EnumToolMaterial; import net.minecraft.item.ItemPickaxe; -import net.minecraftforge.common.MinecraftForge; -import appeng.core.Configuration; import appeng.core.features.AEFeature; import appeng.core.features.AEFeatureHandler; import appeng.core.features.IAEFeature; @@ -22,8 +19,7 @@ public class ToolQuartzPickaxe extends ItemPickaxe implements IAEFeature } public ToolQuartzPickaxe(AEFeature Type) { - super( Configuration.instance.getItemID( ToolQuartzPickaxe.class, Type.name() ), EnumToolMaterial.IRON ); - MinecraftForge.setToolClass( this, "pickaxe", EnumToolMaterial.IRON.getHarvestLevel() ); + super( ToolMaterial.IRON ); feature = new AEFeatureHandler( EnumSet.of( Type, AEFeature.QuartzPickaxe ), this, Type.name() ); } diff --git a/items/tools/quartz/ToolQuartzSpade.java b/items/tools/quartz/ToolQuartzSpade.java index fd3765a6..2ce1762c 100644 --- a/items/tools/quartz/ToolQuartzSpade.java +++ b/items/tools/quartz/ToolQuartzSpade.java @@ -2,10 +2,7 @@ package appeng.items.tools.quartz; import java.util.EnumSet; -import net.minecraft.item.EnumToolMaterial; import net.minecraft.item.ItemSpade; -import net.minecraftforge.common.MinecraftForge; -import appeng.core.Configuration; import appeng.core.features.AEFeature; import appeng.core.features.AEFeatureHandler; import appeng.core.features.IAEFeature; @@ -22,8 +19,7 @@ public class ToolQuartzSpade extends ItemSpade implements IAEFeature } public ToolQuartzSpade(AEFeature Type) { - super( Configuration.instance.getItemID( ToolQuartzSpade.class, Type.name() ), EnumToolMaterial.IRON ); - MinecraftForge.setToolClass( this, "shovel", EnumToolMaterial.IRON.getHarvestLevel() ); + super( ToolMaterial.IRON ); feature = new AEFeatureHandler( EnumSet.of( Type, AEFeature.QuartzSpade ), this, Type.name() ); } diff --git a/items/tools/quartz/ToolQuartzSword.java b/items/tools/quartz/ToolQuartzSword.java index 415eba8f..5381c6ab 100644 --- a/items/tools/quartz/ToolQuartzSword.java +++ b/items/tools/quartz/ToolQuartzSword.java @@ -2,9 +2,7 @@ package appeng.items.tools.quartz; import java.util.EnumSet; -import net.minecraft.item.EnumToolMaterial; import net.minecraft.item.ItemSword; -import appeng.core.Configuration; import appeng.core.features.AEFeature; import appeng.core.features.AEFeatureHandler; import appeng.core.features.IAEFeature; @@ -21,7 +19,7 @@ public class ToolQuartzSword extends ItemSword implements IAEFeature } public ToolQuartzSword(AEFeature Type) { - super( Configuration.instance.getItemID( ToolQuartzSword.class, Type.name() ), EnumToolMaterial.IRON ); + super( ToolMaterial.IRON ); feature = new AEFeatureHandler( EnumSet.of( Type, AEFeature.QuartzSword ), this, Type.name() ); } diff --git a/items/tools/quartz/ToolQuartzWrench.java b/items/tools/quartz/ToolQuartzWrench.java index 88cecfdd..c5127f7d 100644 --- a/items/tools/quartz/ToolQuartzWrench.java +++ b/items/tools/quartz/ToolQuartzWrench.java @@ -6,7 +6,7 @@ import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.world.World; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.implementations.items.IAEWrench; import appeng.core.features.AEFeature; import appeng.items.AEBaseItem; @@ -26,24 +26,21 @@ public class ToolQuartzWrench extends AEBaseItem implements IAEWrench, IToolWren @Override public boolean onItemUseFirst(ItemStack is, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ) { - int id = world.getBlockId( x, y, z ); - if ( id > 0 && !player.isSneaking() ) + Block b = world.getBlock( x, y, z ); + if ( b != null && !player.isSneaking() ) { - Block b = Block.blocksList[id]; - if ( b != null ) + if ( b.rotateBlock( world, x, y, z, ForgeDirection.getOrientation( side ) ) ) { - if ( b.rotateBlock( world, x, y, z, ForgeDirection.getOrientation( side ) ) ) - { - player.swingItem(); - return !world.isRemote; - } + player.swingItem(); + return !world.isRemote; } } return false; } @Override - public boolean shouldPassSneakingClickToBlock(World w, int x, int y, int z) + // public boolean shouldPassSneakingClickToBlock(World w, int x, int y, int z) + public boolean doesSneakBypassUse(World world, int x, int y, int z, EntityPlayer player) { return true; } diff --git a/me/GridConnection.java b/me/GridConnection.java index a84fe3b8..450a3d47 100644 --- a/me/GridConnection.java +++ b/me/GridConnection.java @@ -3,7 +3,7 @@ package appeng.me; import java.util.Arrays; import java.util.EnumSet; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.exceptions.FailedConnection; import appeng.api.networking.GridFlags; import appeng.api.networking.IGridConnection; diff --git a/me/GridNode.java b/me/GridNode.java index 8ae7bf65..94415826 100644 --- a/me/GridNode.java +++ b/me/GridNode.java @@ -8,7 +8,7 @@ import java.util.concurrent.Callable; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.exceptions.FailedConnection; import appeng.api.networking.GridFlags; import appeng.api.networking.GridNotification; @@ -106,7 +106,7 @@ public class GridNode implements IGridNode, IPathItem node.setLong( "k", lastSecurityKey ); node.setLong( "g", myStorage.getID() ); - nodeData.setCompoundTag( name, node ); + nodeData.setTag( name, node ); } else nodeData.removeTag( name ); @@ -345,7 +345,7 @@ public class GridNode implements IGridNode, IPathItem { if ( world.blockExists( x, y, z ) ) { - TileEntity te = world.getBlockTileEntity( x, y, z ); + TileEntity te = world.getTileEntity( x, y, z ); if ( te instanceof IGridHost ) return (IGridHost) te; } diff --git a/me/GridStorage.java b/me/GridStorage.java index 5f62f60f..3a880268 100644 --- a/me/GridStorage.java +++ b/me/GridStorage.java @@ -8,9 +8,6 @@ import java.util.Set; import net.minecraft.nbt.CompressedStreamTools; import net.minecraft.nbt.NBTTagCompound; - -import org.bouncycastle.util.encoders.Base64; - import appeng.api.networking.IGrid; import appeng.api.networking.IGridStorage; import appeng.core.AELog; @@ -55,7 +52,7 @@ public class GridStorage implements IGridStorage try { - byte[] dbata = Base64.decode( input ); + byte[] dbata = javax.xml.bind.DatatypeConverter.parseBase64Binary( input ); myTag = CompressedStreamTools.readCompressed( new ByteArrayInputStream( dbata ) ); } catch (Throwable t) @@ -88,7 +85,7 @@ public class GridStorage implements IGridStorage { ByteArrayOutputStream out = new ByteArrayOutputStream(); CompressedStreamTools.writeCompressed( data, out ); - return new String( Base64.encode( out.toByteArray() ), "UTF-8" ); + return javax.xml.bind.DatatypeConverter.printBase64Binary( out.toByteArray() ); } catch (IOException e) { diff --git a/me/cache/PathGridCache.java b/me/cache/PathGridCache.java index 4316797e..fbf1899a 100644 --- a/me/cache/PathGridCache.java +++ b/me/cache/PathGridCache.java @@ -6,7 +6,7 @@ import java.util.LinkedList; import java.util.List; import java.util.Set; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.networking.GridFlags; import appeng.api.networking.IGrid; import appeng.api.networking.IGridBlock; diff --git a/me/cache/SecurityCache.java b/me/cache/SecurityCache.java index f8f97d5e..1015f62a 100644 --- a/me/cache/SecurityCache.java +++ b/me/cache/SecurityCache.java @@ -56,7 +56,7 @@ public class SecurityCache implements IGridCache, ISecurityGrid @Override public boolean hasPermission(EntityPlayer player, SecurityPermissions perm) { - return hasPermission( WorldSettings.getInstance().getPlayerID( player.username ), perm ); + return hasPermission( WorldSettings.getInstance().getPlayerID( player.getCommandSenderName() ), perm ); } @Override diff --git a/me/cluster/MBCalculator.java b/me/cluster/MBCalculator.java index 3159cf23..1151c0fd 100644 --- a/me/cluster/MBCalculator.java +++ b/me/cluster/MBCalculator.java @@ -2,7 +2,7 @@ package appeng.me.cluster; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.util.WorldCoord; import appeng.core.AELog; import appeng.util.Platform; @@ -60,7 +60,7 @@ public abstract class MBCalculator public boolean isValidTileAt(World w, int x, int y, int z) { - return isValidTile( w.getBlockTileEntity( x, y, z ) ); + return isValidTile( w.getTileEntity( x, y, z ) ); } public void calculateMultiblock(World worldObj, WorldCoord loc) @@ -173,7 +173,7 @@ public abstract class MBCalculator { for (int z = minz; z <= maxz; z++) { - TileEntity te = w.getBlockTileEntity( x, y, z ); + TileEntity te = w.getTileEntity( x, y, z ); if ( isValidTile( te ) ) return true; } diff --git a/me/cluster/implementations/QuantumCalculator.java b/me/cluster/implementations/QuantumCalculator.java index 52bfe6f4..55068f93 100644 --- a/me/cluster/implementations/QuantumCalculator.java +++ b/me/cluster/implementations/QuantumCalculator.java @@ -54,7 +54,7 @@ public class QuantumCalculator extends MBCalculator { for (int z = min.z; z <= max.z; z++) { - TileQuantumBridge te = (TileQuantumBridge) w.getBlockTileEntity( x, y, z ); + TileQuantumBridge te = (TileQuantumBridge) w.getTileEntity( x, y, z ); byte flags = 0; @@ -104,7 +104,7 @@ public class QuantumCalculator extends MBCalculator { for (int z = min.z; z <= max.z; z++) { - IAEMultiBlock te = (IAEMultiBlock) w.getBlockTileEntity( x, y, z ); + IAEMultiBlock te = (IAEMultiBlock) w.getTileEntity( x, y, z ); if ( !te.isValid() ) return false; diff --git a/me/cluster/implementations/QuantumCluster.java b/me/cluster/implementations/QuantumCluster.java index c3bd4dba..32d1e031 100644 --- a/me/cluster/implementations/QuantumCluster.java +++ b/me/cluster/implementations/QuantumCluster.java @@ -3,9 +3,8 @@ package appeng.me.cluster.implementations; import java.util.Iterator; import net.minecraft.world.chunk.Chunk; -import net.minecraftforge.common.ForgeDirection; import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.event.ForgeSubscribe; +import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.event.world.WorldEvent; import appeng.api.AEApi; import appeng.api.events.LocatableEventAnnounce; @@ -19,6 +18,7 @@ import appeng.me.cache.helpers.ConnectionWrapper; import appeng.me.cluster.IAECluster; import appeng.tile.qnb.TileQuantumBridge; import appeng.util.iterators.ChainedIterator; +import cpw.mods.fml.common.eventhandler.SubscribeEvent; public class QuantumCluster implements ILocatable, IAECluster { @@ -62,7 +62,7 @@ public class QuantumCluster implements ILocatable, IAECluster { if ( !qc.isDestroyed ) { - Chunk c = qc.center.worldObj.getChunkFromBlockCoords( qc.center.xCoord, qc.center.zCoord ); + Chunk c = qc.center.getWorldObj().getChunkFromBlockCoords( qc.center.xCoord, qc.center.zCoord ); if ( c.isChunkLoaded ) return false; } @@ -70,10 +70,10 @@ public class QuantumCluster implements ILocatable, IAECluster return true; } - @ForgeSubscribe + @SubscribeEvent public void onUnload(WorldEvent.Unload e) { - if ( center.worldObj == e.world ) + if ( center.getWorldObj() == e.world ) { destroy(); } diff --git a/me/cluster/implementations/SpatialPylonCalculator.java b/me/cluster/implementations/SpatialPylonCalculator.java index 24f7c731..c9205cec 100644 --- a/me/cluster/implementations/SpatialPylonCalculator.java +++ b/me/cluster/implementations/SpatialPylonCalculator.java @@ -42,7 +42,7 @@ public class SpatialPylonCalculator extends MBCalculator { for (int z = min.z; z <= max.z; z++) { - TileSpatialPylon te = (TileSpatialPylon) w.getBlockTileEntity( x, y, z ); + TileSpatialPylon te = (TileSpatialPylon) w.getTileEntity( x, y, z ); te.updateStatus( c ); c.line.add( (te) ); } @@ -73,7 +73,7 @@ public class SpatialPylonCalculator extends MBCalculator { for (int z = min.z; z <= max.z; z++) { - IAEMultiBlock te = (IAEMultiBlock) w.getBlockTileEntity( x, y, z ); + IAEMultiBlock te = (IAEMultiBlock) w.getTileEntity( x, y, z ); if ( !te.isValid() ) return false; diff --git a/me/helpers/AENetworkProxy.java b/me/helpers/AENetworkProxy.java index b150aca1..724a120f 100644 --- a/me/helpers/AENetworkProxy.java +++ b/me/helpers/AENetworkProxy.java @@ -5,7 +5,7 @@ import java.util.EnumSet; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.AEApi; import appeng.api.networking.GridFlags; import appeng.api.networking.GridNotification; @@ -82,7 +82,7 @@ public class AENetworkProxy implements IGridBlock } else if ( node != null && owner != null ) { - node.setPlayerID( WorldSettings.getInstance().getPlayerID( owner.username ) ); + node.setPlayerID( WorldSettings.getInstance().getPlayerID( owner.getCommandSenderName() ) ); owner = null; } } diff --git a/me/storage/AEExternalHandler.java b/me/storage/AEExternalHandler.java index f9bae218..2197a841 100644 --- a/me/storage/AEExternalHandler.java +++ b/me/storage/AEExternalHandler.java @@ -2,7 +2,7 @@ package appeng.me.storage; import net.minecraft.inventory.IInventory; import net.minecraft.tileentity.TileEntity; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.implementations.tiles.ITileStorageMonitorable; import appeng.api.storage.IExternalStorageHandler; import appeng.api.storage.IMEInventory; diff --git a/me/storage/CellInventory.java b/me/storage/CellInventory.java index 6d90fdaa..10d57259 100644 --- a/me/storage/CellInventory.java +++ b/me/storage/CellInventory.java @@ -8,8 +8,6 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTBase; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagInt; -import net.minecraft.nbt.NBTTagShort; import net.minecraftforge.oredict.OreDictionary; import appeng.api.config.Actionable; import appeng.api.config.FuzzyMode; @@ -99,31 +97,32 @@ public class CellInventory implements IMEInventory { NBTTagCompound g = new NBTTagCompound(); v.writeToNBT( g ); - tagCompound.setCompoundTag( ITEM_SLOT_ARR[x], g ); + tagCompound.setTag( ITEM_SLOT_ARR[x], g ); } - NBTBase tagSlotCount = tagCompound.getTag( ITEM_SLOTCOUNT_ARR[x] ); - if ( tagSlotCount instanceof NBTTagInt ) - ((NBTTagInt) tagSlotCount).data = (int) v.getStackSize(); - else - tagCompound.setInteger( ITEM_SLOTCOUNT_ARR[x], (int) v.getStackSize() ); + /* + * NBTBase tagSlotCount = tagCompound.getTag( ITEM_SLOTCOUNT_ARR[x] ); if ( tagSlotCount instanceof + * NBTTagInt ) ((NBTTagInt) tagSlotCount).data = (int) v.getStackSize(); else + */ + tagCompound.setInteger( ITEM_SLOTCOUNT_ARR[x], (int) v.getStackSize() ); x++; } - NBTBase tagType = tagCompound.getTag( ITEM_TYPE_TAG ); - NBTBase tagCount = tagCompound.getTag( ITEM_COUNT_TAG ); + // NBTBase tagType = tagCompound.getTag( ITEM_TYPE_TAG ); + // NBTBase tagCount = tagCompound.getTag( ITEM_COUNT_TAG ); short oldStoreditems = storedItems; - if ( tagType instanceof NBTTagShort ) - ((NBTTagShort) tagType).data = storedItems = (short) cellItems.size(); - else - tagCompound.setShort( ITEM_TYPE_TAG, storedItems = (short) cellItems.size() ); + /* + * if ( tagType instanceof NBTTagShort ) ((NBTTagShort) tagType).data = storedItems = (short) cellItems.size(); + * else + */ + tagCompound.setShort( ITEM_TYPE_TAG, storedItems = (short) cellItems.size() ); - if ( tagCount instanceof NBTTagInt ) - ((NBTTagInt) tagCount).data = storedItemCount = itemCount; - else - tagCompound.setInteger( ITEM_COUNT_TAG, storedItemCount = itemCount ); + /* + * if ( tagCount instanceof NBTTagInt ) ((NBTTagInt) tagCount).data = storedItemCount = itemCount; else + */ + tagCompound.setInteger( ITEM_COUNT_TAG, storedItemCount = itemCount ); // clean any old crusty stuff... for (; x < oldStoreditems && x < MAX_ITEM_TYPES; x++) @@ -327,9 +326,9 @@ public class CellInventory implements IMEInventory public static boolean isBlackListed(IAEItemStack input) { - if ( blackList.contains( (OreDictionary.WILDCARD_VALUE << Platform.DEF_OFFSET) | input.getItem().itemID ) ) + if ( blackList.contains( (OreDictionary.WILDCARD_VALUE << Platform.DEF_OFFSET) | Item.getIdFromItem( input.getItem() ) ) ) return true; - return blackList.contains( (input.getItemDamage() << Platform.DEF_OFFSET) | input.getItem().itemID ); + return blackList.contains( (input.getItemDamage() << Platform.DEF_OFFSET) | Item.getIdFromItem( input.getItem() ) ); } private boolean isEmpty(IMEInventory meinv) diff --git a/me/storage/MEMonitorIInventory.java b/me/storage/MEMonitorIInventory.java index 0bb75cbd..e6fb9594 100644 --- a/me/storage/MEMonitorIInventory.java +++ b/me/storage/MEMonitorIInventory.java @@ -7,7 +7,7 @@ import java.util.TreeMap; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.AEApi; import appeng.api.config.AccessRestriction; import appeng.api.config.Actionable; diff --git a/parts/AEBasePart.java b/parts/AEBasePart.java index c46dd0ed..71564c55 100644 --- a/parts/AEBasePart.java +++ b/parts/AEBasePart.java @@ -1,7 +1,7 @@ package appeng.parts; -import java.io.DataInputStream; -import java.io.DataOutputStream; +import io.netty.buffer.ByteBuf; + import java.io.IOException; import java.util.ArrayList; import java.util.EnumSet; @@ -18,7 +18,7 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.Vec3; import net.minecraft.world.World; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.config.Upgrades; import appeng.api.implementations.IUpgradeableHost; import appeng.api.networking.IGridNode; @@ -131,13 +131,13 @@ public class AEBasePart implements IPart, IGridProxyable, IActionHost, IUpgradea } @Override - public void writeToStream(DataOutputStream data) throws IOException + public void writeToStream(ByteBuf data) throws IOException { } @Override - public boolean readFromStream(DataInputStream data) throws IOException + public boolean readFromStream(ByteBuf data) throws IOException { return false; } @@ -303,7 +303,7 @@ public class AEBasePart implements IPart, IGridProxyable, IActionHost, IUpgradea List items = new ArrayList(); items.add( is.copy() ); host.removePart( side, false ); - Platform.spawnDrops( tile.worldObj, tile.xCoord, tile.yCoord, tile.zCoord, items ); + Platform.spawnDrops( tile.getWorldObj(), tile.xCoord, tile.yCoord, tile.zCoord, items ); is.stackSize = 0; } } diff --git a/parts/BusCollisionHelper.java b/parts/BusCollisionHelper.java index 33896f59..ef5dee41 100644 --- a/parts/BusCollisionHelper.java +++ b/parts/BusCollisionHelper.java @@ -4,7 +4,7 @@ import java.util.List; import net.minecraft.entity.Entity; import net.minecraft.util.AxisAlignedBB; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.parts.IPartCollsionHelper; public class BusCollisionHelper implements IPartCollsionHelper diff --git a/parts/CableBusContainer.java b/parts/CableBusContainer.java index d86526fb..e57f6823 100644 --- a/parts/CableBusContainer.java +++ b/parts/CableBusContainer.java @@ -1,7 +1,7 @@ package appeng.parts; -import java.io.DataInputStream; -import java.io.DataOutputStream; +import io.netty.buffer.ByteBuf; + import java.io.IOException; import java.util.EnumSet; import java.util.LinkedList; @@ -18,7 +18,7 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.Vec3; import net.minecraft.world.World; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import powercrystals.minefactoryreloaded.api.rednet.RedNetConnectionType; import appeng.api.AEApi; import appeng.api.exceptions.FailedConnection; @@ -292,7 +292,7 @@ public class CableBusContainer implements AEMultiTile, ICableBusContainer inWorld = true; TileEntity te = getTile(); - hasRedstone = te.worldObj.isBlockIndirectlyGettingPowered( te.xCoord, te.yCoord, te.zCoord ); + hasRedstone = te.getWorldObj().isBlockIndirectlyGettingPowered( te.xCoord, te.yCoord, te.zCoord ); // start with the center, then install the side parts into the grid. for (int x = 6; x >= 0; x--) @@ -439,7 +439,7 @@ public class CableBusContainer implements AEMultiTile, ICableBusContainer public void onNeighborChanged() { TileEntity te = getTile(); - hasRedstone = te.worldObj.isBlockIndirectlyGettingPowered( te.xCoord, te.yCoord, te.zCoord ); + hasRedstone = te.getWorldObj().isBlockIndirectlyGettingPowered( te.xCoord, te.yCoord, te.zCoord ); for (ForgeDirection s : ForgeDirection.values()) { @@ -532,7 +532,7 @@ public class CableBusContainer implements AEMultiTile, ICableBusContainer CableRenderHelper.getInstance().renderDynamic( this, x, y, z ); } - public void writeToStream(DataOutputStream data) throws IOException + public void writeToStream(ByteBuf data) throws IOException { int sides = 0; for (int x = 0; x < 7; x++) @@ -555,7 +555,7 @@ public class CableBusContainer implements AEMultiTile, ICableBusContainer is = p.getItemStack( PartItemStack.Network ); is.setTagCompound( null ); - data.writeShort( is.getItem().itemID ); + data.writeShort( Item.getIdFromItem( is.getItem() ) ); data.writeShort( is.getItemDamage() ); if ( p != null ) @@ -566,7 +566,7 @@ public class CableBusContainer implements AEMultiTile, ICableBusContainer fc.writeToStream( data ); } - public boolean readFromStream(DataInputStream data) throws IOException + public boolean readFromStream(ByteBuf data) throws IOException { byte sides = data.readByte(); @@ -580,13 +580,15 @@ public class CableBusContainer implements AEMultiTile, ICableBusContainer short itemID = data.readShort(); short dmgValue = data.readShort(); + Item myItem = Item.getItemById( itemID ); + ItemStack current = p != null ? p.getItemStack( PartItemStack.Network ) : null; - if ( current != null && current.getItem().itemID == itemID && current.getItemDamage() == dmgValue ) + if ( current != null && current.getItem() == myItem && current.getItemDamage() == dmgValue ) p.readFromStream( data ); else { removePart( side, false ); - side = addPart( new ItemStack( Item.itemsList[itemID], 1, dmgValue ), side, null ); + side = addPart( new ItemStack( myItem, 1, dmgValue ), side, null ); if ( side != null ) { p = getPart( side ); @@ -633,8 +635,8 @@ public class CableBusContainer implements AEMultiTile, ICableBusContainer NBTTagCompound extra = new NBTTagCompound(); part.writeToNBT( extra ); - data.setCompoundTag( "def:" + getSide( part ).ordinal(), def ); - data.setCompoundTag( "extra:" + getSide( part ).ordinal(), extra ); + data.setTag( "def:" + getSide( part ).ordinal(), def ); + data.setTag( "extra:" + getSide( part ).ordinal(), extra ); } } } diff --git a/parts/ICableBusContainer.java b/parts/ICableBusContainer.java index e7fe8704..a1888835 100644 --- a/parts/ICableBusContainer.java +++ b/parts/ICableBusContainer.java @@ -8,7 +8,7 @@ import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.Vec3; import net.minecraft.world.World; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.parts.SelectedPart; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; diff --git a/parts/NullCableBusContainer.java b/parts/NullCableBusContainer.java index 014387f8..caba57f5 100644 --- a/parts/NullCableBusContainer.java +++ b/parts/NullCableBusContainer.java @@ -8,7 +8,7 @@ import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.Vec3; import net.minecraft.world.World; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.parts.SelectedPart; public class NullCableBusContainer implements ICableBusContainer diff --git a/parts/PartBasicState.java b/parts/PartBasicState.java index 01304383..73d489d5 100644 --- a/parts/PartBasicState.java +++ b/parts/PartBasicState.java @@ -1,13 +1,13 @@ package appeng.parts; -import java.io.DataInputStream; -import java.io.DataOutputStream; +import io.netty.buffer.ByteBuf; + import java.io.IOException; import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.client.renderer.Tessellator; import net.minecraft.item.ItemStack; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.networking.GridFlags; import appeng.api.networking.events.MENetworkChannelsChanged; import appeng.api.networking.events.MENetworkEventSubscribe; @@ -71,7 +71,7 @@ public class PartBasicState extends AEBasePart } @Override - public void writeToStream(DataOutputStream data) throws IOException + public void writeToStream(ByteBuf data) throws IOException { super.writeToStream( data ); @@ -101,7 +101,7 @@ public class PartBasicState extends AEBasePart } @Override - public boolean readFromStream(DataInputStream data) throws IOException + public boolean readFromStream(ByteBuf data) throws IOException { boolean eh = super.readFromStream( data ); diff --git a/parts/automation/PartAnnihilationPlane.java b/parts/automation/PartAnnihilationPlane.java index f5005c07..107e7251 100644 --- a/parts/automation/PartAnnihilationPlane.java +++ b/parts/automation/PartAnnihilationPlane.java @@ -3,7 +3,7 @@ package appeng.parts.automation; import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.parts.IPart; import appeng.api.parts.IPartCollsionHelper; import appeng.api.parts.IPartHost; @@ -48,16 +48,16 @@ public class PartAnnihilationPlane extends PartBasicState TileEntity te = getHost().getTile(); - if ( isTransitionPlane( te.worldObj.getBlockTileEntity( x - e.offsetX, y - e.offsetY, z - e.offsetZ ), side ) ) + if ( isTransitionPlane( te.getWorldObj().getTileEntity( x - e.offsetX, y - e.offsetY, z - e.offsetZ ), side ) ) minX = 0; - if ( isTransitionPlane( te.worldObj.getBlockTileEntity( x + e.offsetX, y + e.offsetY, z + e.offsetZ ), side ) ) + if ( isTransitionPlane( te.getWorldObj().getTileEntity( x + e.offsetX, y + e.offsetY, z + e.offsetZ ), side ) ) maxX = 16; - if ( isTransitionPlane( te.worldObj.getBlockTileEntity( x - u.offsetX, y - u.offsetY, z - u.offsetZ ), side ) ) + if ( isTransitionPlane( te.getWorldObj().getTileEntity( x - u.offsetX, y - u.offsetY, z - u.offsetZ ), side ) ) minY = 0; - if ( isTransitionPlane( te.worldObj.getBlockTileEntity( x + u.offsetX, y + u.offsetY, z + u.offsetZ ), side ) ) + if ( isTransitionPlane( te.getWorldObj().getTileEntity( x + u.offsetX, y + u.offsetY, z + u.offsetZ ), side ) ) maxY = 16; boolean isActive = (clientFlags & (POWERED_FLAG | CHANNEL_FLAG)) == (POWERED_FLAG | CHANNEL_FLAG); @@ -107,16 +107,16 @@ public class PartAnnihilationPlane extends PartBasicState ForgeDirection e = bch.getWorldX(); ForgeDirection u = bch.getWorldY(); - if ( isTransitionPlane( te.worldObj.getBlockTileEntity( x - e.offsetX, y - e.offsetY, z - e.offsetZ ), side ) ) + if ( isTransitionPlane( te.getWorldObj().getTileEntity( x - e.offsetX, y - e.offsetY, z - e.offsetZ ), side ) ) minX = 0; - if ( isTransitionPlane( te.worldObj.getBlockTileEntity( x + e.offsetX, y + e.offsetY, z + e.offsetZ ), side ) ) + if ( isTransitionPlane( te.getWorldObj().getTileEntity( x + e.offsetX, y + e.offsetY, z + e.offsetZ ), side ) ) maxX = 16; - if ( isTransitionPlane( te.worldObj.getBlockTileEntity( x - u.offsetX, y - u.offsetY, z - u.offsetZ ), side ) ) + if ( isTransitionPlane( te.getWorldObj().getTileEntity( x - u.offsetX, y - u.offsetY, z - u.offsetZ ), side ) ) minY = 0; - if ( isTransitionPlane( te.worldObj.getBlockTileEntity( x + u.offsetX, y + u.offsetY, z + u.offsetZ ), side ) ) + if ( isTransitionPlane( te.getWorldObj().getTileEntity( x + u.offsetX, y + u.offsetY, z + u.offsetZ ), side ) ) maxY = 16; bch.addBox( 5, 5, 14, 11, 11, 15 ); diff --git a/parts/automation/PartFormationPlane.java b/parts/automation/PartFormationPlane.java index 55ba8055..eeeda6e1 100644 --- a/parts/automation/PartFormationPlane.java +++ b/parts/automation/PartFormationPlane.java @@ -3,7 +3,7 @@ package appeng.parts.automation; import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.parts.IPart; import appeng.api.parts.IPartCollsionHelper; import appeng.api.parts.IPartHost; @@ -48,16 +48,16 @@ public class PartFormationPlane extends PartBasicState TileEntity te = getHost().getTile(); - if ( isTransitionPlane( te.worldObj.getBlockTileEntity( x - e.offsetX, y - e.offsetY, z - e.offsetZ ), side ) ) + if ( isTransitionPlane( te.getWorldObj().getTileEntity( x - e.offsetX, y - e.offsetY, z - e.offsetZ ), side ) ) minX = 0; - if ( isTransitionPlane( te.worldObj.getBlockTileEntity( x + e.offsetX, y + e.offsetY, z + e.offsetZ ), side ) ) + if ( isTransitionPlane( te.getWorldObj().getTileEntity( x + e.offsetX, y + e.offsetY, z + e.offsetZ ), side ) ) maxX = 16; - if ( isTransitionPlane( te.worldObj.getBlockTileEntity( x - u.offsetX, y - u.offsetY, z - u.offsetZ ), side ) ) + if ( isTransitionPlane( te.getWorldObj().getTileEntity( x - u.offsetX, y - u.offsetY, z - u.offsetZ ), side ) ) minY = 0; - if ( isTransitionPlane( te.worldObj.getBlockTileEntity( x + u.offsetX, y + u.offsetY, z + u.offsetZ ), side ) ) + if ( isTransitionPlane( te.getWorldObj().getTileEntity( x + u.offsetX, y + u.offsetY, z + u.offsetZ ), side ) ) maxY = 16; boolean isActive = (clientFlags & (POWERED_FLAG | CHANNEL_FLAG)) == (POWERED_FLAG | CHANNEL_FLAG); @@ -107,16 +107,16 @@ public class PartFormationPlane extends PartBasicState ForgeDirection e = bch.getWorldX(); ForgeDirection u = bch.getWorldY(); - if ( isTransitionPlane( te.worldObj.getBlockTileEntity( x - e.offsetX, y - e.offsetY, z - e.offsetZ ), side ) ) + if ( isTransitionPlane( te.getWorldObj().getTileEntity( x - e.offsetX, y - e.offsetY, z - e.offsetZ ), side ) ) minX = 0; - if ( isTransitionPlane( te.worldObj.getBlockTileEntity( x + e.offsetX, y + e.offsetY, z + e.offsetZ ), side ) ) + if ( isTransitionPlane( te.getWorldObj().getTileEntity( x + e.offsetX, y + e.offsetY, z + e.offsetZ ), side ) ) maxX = 16; - if ( isTransitionPlane( te.worldObj.getBlockTileEntity( x - u.offsetX, y - u.offsetY, z - u.offsetZ ), side ) ) + if ( isTransitionPlane( te.getWorldObj().getTileEntity( x - u.offsetX, y - u.offsetY, z - u.offsetZ ), side ) ) minY = 0; - if ( isTransitionPlane( te.worldObj.getBlockTileEntity( x + u.offsetX, y + u.offsetY, z + u.offsetZ ), side ) ) + if ( isTransitionPlane( te.getWorldObj().getTileEntity( x + u.offsetX, y + u.offsetY, z + u.offsetZ ), side ) ) maxY = 16; bch.addBox( 5, 5, 14, 11, 11, 15 ); diff --git a/parts/automation/PartLevelEmitter.java b/parts/automation/PartLevelEmitter.java index 016b8860..7da138d1 100644 --- a/parts/automation/PartLevelEmitter.java +++ b/parts/automation/PartLevelEmitter.java @@ -10,10 +10,10 @@ import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.Icon; +import net.minecraft.util.IIcon; import net.minecraft.util.Vec3; import net.minecraft.world.World; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.config.FuzzyMode; import appeng.api.config.RedstoneMode; import appeng.api.config.Settings; @@ -97,8 +97,8 @@ public class PartLevelEmitter extends PartUpgradeable implements IStackWatcherHo host.markForUpdate(); TileEntity te = host.getTile(); prevState = isLevelEmitterOn(); - te.worldObj.notifyBlocksOfNeighborChange( te.xCoord, te.yCoord, te.zCoord, 0 ); - te.worldObj.notifyBlocksOfNeighborChange( te.xCoord + side.offsetX, te.yCoord + side.offsetY, te.zCoord + side.offsetZ, 0 ); + te.getWorldObj().notifyBlocksOfNeighborChange( te.xCoord, te.yCoord, te.zCoord, Platform.air ); + te.getWorldObj().notifyBlocksOfNeighborChange( te.xCoord + side.offsetX, te.yCoord + side.offsetY, te.zCoord + side.offsetZ, Platform.air ); } } @@ -336,7 +336,7 @@ public class PartLevelEmitter extends PartUpgradeable implements IStackWatcherHo public void renderTorchAtAngle(double baseX, double baseY, double baseZ) { boolean isOn = isLevelEmitterOn(); - Icon icon = (isOn ? CableBusTextures.LevelEmitterTorchOn.getIcon() : is.getIconIndex()); + IIcon IIcon = (isOn ? CableBusTextures.LevelEmitterTorchOn.getIcon() : is.getIconIndex()); // cenx = baseX + 0.5; ceny = baseY + 0.5; @@ -349,33 +349,33 @@ public class PartLevelEmitter extends PartUpgradeable implements IStackWatcherHo double Zero = 0; /* - * double d5 = (double)icon.func_94209_e(); double d6 = (double)icon.func_94206_g(); double d7 = - * (double)icon.func_94212_f(); double d8 = (double)icon.func_94210_h(); double d9 = - * (double)icon.func_94214_a(7.0D); double d10 = (double)icon.func_94207_b(6.0D); double d11 = - * (double)icon.func_94214_a(9.0D); double d12 = (double)icon.func_94207_b(8.0D); double d13 = - * (double)icon.func_94214_a(7.0D); double d14 = (double)icon.func_94207_b(13.0D); double d15 = - * (double)icon.func_94214_a(9.0D); double d16 = (double)icon.func_94207_b(15.0D); + * double d5 = (double)IIcon.func_94209_e(); double d6 = (double)IIcon.func_94206_g(); double d7 = + * (double)IIcon.func_94212_f(); double d8 = (double)IIcon.func_94210_h(); double d9 = + * (double)IIcon.func_94214_a(7.0D); double d10 = (double)IIcon.func_94207_b(6.0D); double d11 = + * (double)IIcon.func_94214_a(9.0D); double d12 = (double)IIcon.func_94207_b(8.0D); double d13 = + * (double)IIcon.func_94214_a(7.0D); double d14 = (double)IIcon.func_94207_b(13.0D); double d15 = + * (double)IIcon.func_94214_a(9.0D); double d16 = (double)IIcon.func_94207_b(15.0D); */ - float var16 = icon.getMinU(); - float var17 = icon.getMaxU(); - float var18 = icon.getMinV(); - float var19 = icon.getMaxV(); + float var16 = IIcon.getMinU(); + float var17 = IIcon.getMaxU(); + float var18 = IIcon.getMinV(); + float var19 = IIcon.getMaxV(); /* * float var16 = (float)var14 / 256.0F; float var17 = ((float)var14 + 15.99F) / 256.0F; float var18 = * (float)var15 / 256.0F; float var19 = ((float)var15 + 15.99F) / 256.0F; */ - double var20 = (double) icon.getInterpolatedU( 7.0D ); - double var24 = (double) icon.getInterpolatedU( 9.0D ); - double var22 = (double) icon.getInterpolatedV( 6.0D + (isOn ? 0 : 1.0D) ); - double var26 = (double) icon.getInterpolatedV( 8.0D + (isOn ? 0 : 1.0D) ); - double var28 = (double) icon.getInterpolatedU( 7.0D ); - double var30 = (double) icon.getInterpolatedV( 13.0D ); - double var32 = (double) icon.getInterpolatedU( 9.0D ); - double var34 = (double) icon.getInterpolatedV( 15.0D ); + double var20 = (double) IIcon.getInterpolatedU( 7.0D ); + double var24 = (double) IIcon.getInterpolatedU( 9.0D ); + double var22 = (double) IIcon.getInterpolatedV( 6.0D + (isOn ? 0 : 1.0D) ); + double var26 = (double) IIcon.getInterpolatedV( 8.0D + (isOn ? 0 : 1.0D) ); + double var28 = (double) IIcon.getInterpolatedU( 7.0D ); + double var30 = (double) IIcon.getInterpolatedV( 13.0D ); + double var32 = (double) IIcon.getInterpolatedU( 9.0D ); + double var34 = (double) IIcon.getInterpolatedV( 15.0D ); - double var22b = (double) icon.getInterpolatedV( 9.0D ); - double var26b = (double) icon.getInterpolatedV( 11.0D ); + double var22b = (double) IIcon.getInterpolatedV( 9.0D ); + double var26b = (double) IIcon.getInterpolatedV( 11.0D ); baseX += 0.5D; baseZ += 0.5D; @@ -464,7 +464,7 @@ public class PartLevelEmitter extends PartUpgradeable implements IStackWatcherHo renderer.renderAllFaces = true; Tessellator tess = Tessellator.instance; - tess.setBrightness( rh.getBlock().getMixedBrightnessForBlock( this.getHost().getTile().worldObj, x, y, z ) ); + tess.setBrightness( rh.getBlock().getMixedBrightnessForBlock( this.getHost().getTile().getWorldObj(), x, y, z ) ); tess.setColorOpaque_F( 1.0F, 1.0F, 1.0F ); renderTorchAtAngle( x, y, z ); diff --git a/parts/automation/PartSharedItemBus.java b/parts/automation/PartSharedItemBus.java index b933ba27..a48e01c7 100644 --- a/parts/automation/PartSharedItemBus.java +++ b/parts/automation/PartSharedItemBus.java @@ -18,13 +18,13 @@ import appeng.util.Platform; public abstract class PartSharedItemBus extends PartUpgradeable implements IGridTickable { - private TileEntity getBlockTileEntity(TileEntity self, int x, int y, int z) + private TileEntity getTileEntity(TileEntity self, int x, int y, int z) { - World w = self.worldObj; + World w = self.getWorldObj(); if ( w.getChunkProvider().chunkExists( x >> 4, z >> 4 ) ) { - TileEntity te = w.getBlockTileEntity( x, y, z ); + TileEntity te = w.getTileEntity( x, y, z ); return te; } @@ -71,7 +71,7 @@ public abstract class PartSharedItemBus extends PartUpgradeable implements IGrid cached = true; TileEntity self = getHost().getTile(); - TileEntity target = getBlockTileEntity( self, self.xCoord + side.offsetX, self.yCoord + side.offsetY, self.zCoord + side.offsetZ ); + TileEntity target = getTileEntity( self, self.xCoord + side.offsetX, self.yCoord + side.offsetY, self.zCoord + side.offsetZ ); int newAdaptorHash = Platform.generateTileHash( target ); diff --git a/parts/automation/UpgradeInventory.java b/parts/automation/UpgradeInventory.java index 37c54aa9..3761c979 100644 --- a/parts/automation/UpgradeInventory.java +++ b/parts/automation/UpgradeInventory.java @@ -72,7 +72,7 @@ public class UpgradeInventory extends AppEngInternalInventory implements IAEAppE max = u.getSupported().get( is ); break; } - else if ( is.getItem() instanceof ItemBlock && Block.blocksList[((ItemBlock) is.getItem()).getBlockID()] == itemorblock ) + else if ( is.getItem() instanceof ItemBlock && Block.getBlockFromItem( is.getItem() ) == itemorblock ) { max = u.getSupported().get( is ); break; diff --git a/parts/misc/PartCableAnchor.java b/parts/misc/PartCableAnchor.java index cc9dee7d..4d0e07b6 100644 --- a/parts/misc/PartCableAnchor.java +++ b/parts/misc/PartCableAnchor.java @@ -1,7 +1,7 @@ package appeng.parts.misc; -import java.io.DataInputStream; -import java.io.DataOutputStream; +import io.netty.buffer.ByteBuf; + import java.io.IOException; import java.util.List; import java.util.Random; @@ -13,10 +13,10 @@ 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.Icon; +import net.minecraft.util.IIcon; import net.minecraft.util.Vec3; import net.minecraft.world.World; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.networking.IGridNode; import appeng.api.parts.BusSupport; import appeng.api.parts.IPart; @@ -41,7 +41,7 @@ public class PartCableAnchor implements IPart @SideOnly(Side.CLIENT) public void renderStatic(int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer) { - Icon myIcon = is.getIconIndex(); + IIcon myIcon = is.getIconIndex(); rh.setTexture( myIcon ); rh.setBounds( 7, 7, 10, 9, 9, 16 ); rh.renderBlock( x, y, z, renderer ); @@ -139,13 +139,13 @@ public class PartCableAnchor implements IPart } @Override - public void writeToStream(DataOutputStream data) throws IOException + public void writeToStream(ByteBuf data) throws IOException { } @Override - public boolean readFromStream(DataInputStream data) throws IOException + public boolean readFromStream(ByteBuf data) throws IOException { return false; } diff --git a/parts/misc/PartInterface.java b/parts/misc/PartInterface.java index a39352dd..dd268bc4 100644 --- a/parts/misc/PartInterface.java +++ b/parts/misc/PartInterface.java @@ -8,7 +8,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.Vec3; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.implementations.tiles.ISegmentedInventory; import appeng.api.implementations.tiles.ITileStorageMonitorable; import appeng.api.networking.IGridNode; @@ -189,15 +189,15 @@ public class PartInterface extends PartBasicState implements IGridTickable, ISeg } @Override - public String getInvName() + public String getInventoryName() { - return duality.getStorage().getInvName(); + return duality.getStorage().getInventoryName(); } @Override - public boolean isInvNameLocalized() + public boolean hasCustomInventoryName() { - return duality.getStorage().isInvNameLocalized(); + return duality.getStorage().hasCustomInventoryName(); } @Override @@ -207,9 +207,9 @@ public class PartInterface extends PartBasicState implements IGridTickable, ISeg } @Override - public void onInventoryChanged() + public void markDirty() { - duality.getStorage().onInventoryChanged(); + duality.getStorage().markDirty(); } @Override @@ -219,15 +219,15 @@ public class PartInterface extends PartBasicState implements IGridTickable, ISeg } @Override - public void openChest() + public void openInventory() { - duality.getStorage().openChest(); + duality.getStorage().openInventory(); } @Override - public void closeChest() + public void closeInventory() { - duality.getStorage().closeChest(); + duality.getStorage().closeInventory(); } @Override diff --git a/parts/misc/PartStorageBus.java b/parts/misc/PartStorageBus.java index cccd9d9b..ae349b83 100644 --- a/parts/misc/PartStorageBus.java +++ b/parts/misc/PartStorageBus.java @@ -10,7 +10,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.Vec3; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.AEApi; import appeng.api.config.AccessRestriction; import appeng.api.config.FuzzyMode; @@ -190,7 +190,7 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC cached = true; TileEntity self = getHost().getTile(); - TileEntity target = self.worldObj.getBlockTileEntity( self.xCoord + side.offsetX, self.yCoord + side.offsetY, self.zCoord + side.offsetZ ); + TileEntity target = self.getWorldObj().getTileEntity( self.xCoord + side.offsetX, self.yCoord + side.offsetY, self.zCoord + side.offsetZ ); int newHandlerHash = Platform.generateTileHash( target ); diff --git a/parts/misc/PartToggleBus.java b/parts/misc/PartToggleBus.java index 0b29644d..d9a34eda 100644 --- a/parts/misc/PartToggleBus.java +++ b/parts/misc/PartToggleBus.java @@ -9,7 +9,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import org.lwjgl.opengl.GL11; @@ -227,7 +227,7 @@ public class PartToggleBus extends PartBasicState List items = new ArrayList(); items.add( is.copy() ); host.removePart( side, false ); - Platform.spawnDrops( tile.worldObj, tile.xCoord, tile.yCoord, tile.zCoord, items ); + Platform.spawnDrops( tile.getWorldObj(), tile.xCoord, tile.yCoord, tile.zCoord, items ); is.stackSize = 0; } } diff --git a/parts/networking/PartCable.java b/parts/networking/PartCable.java index 2f568c22..9cb305a7 100644 --- a/parts/networking/PartCable.java +++ b/parts/networking/PartCable.java @@ -1,7 +1,7 @@ package appeng.parts.networking; -import java.io.DataInputStream; -import java.io.DataOutputStream; +import io.netty.buffer.ByteBuf; + import java.io.IOException; import java.util.EnumSet; @@ -9,8 +9,8 @@ import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.client.renderer.Tessellator; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.Icon; -import net.minecraftforge.common.ForgeDirection; +import net.minecraft.util.IIcon; +import net.minecraftforge.common.util.ForgeDirection; import org.lwjgl.opengl.GL11; @@ -60,7 +60,7 @@ public class PartCable extends AEBasePart implements IPartCable return BusSupport.CABLE; } - public Icon getGlassTexture(AEColor c) + public IIcon getGlassTexture(AEColor c) { switch (c) { @@ -102,12 +102,12 @@ public class PartCable extends AEBasePart implements IPartCable AEApi.instance().parts().partCableGlass.stack( AEColor.Transparent, 1 ) ); } - public Icon getTexture(AEColor c) + public IIcon getTexture(AEColor c) { return getGlassTexture( c ); } - public Icon getCoveredTexture(AEColor c) + public IIcon getCoveredTexture(AEColor c) { switch (c) { @@ -149,7 +149,7 @@ public class PartCable extends AEBasePart implements IPartCable AEApi.instance().parts().partCableCovered.stack( AEColor.Transparent, 1 ) ); } - public Icon getSmartTexture(AEColor c) + public IIcon getSmartTexture(AEColor c) { switch (c) { @@ -214,7 +214,7 @@ public class PartCable extends AEBasePart implements IPartCable } @Override - public void writeToStream(DataOutputStream data) throws IOException + public void writeToStream(ByteBuf data) throws IOException { int cs = 0; int sideOut = 0; @@ -273,7 +273,7 @@ public class PartCable extends AEBasePart implements IPartCable } @Override - public boolean readFromStream(DataInputStream data) throws IOException + public boolean readFromStream(ByteBuf data) throws IOException { int cs = data.readByte(); int sideOut = data.readInt(); @@ -371,7 +371,7 @@ public class PartCable extends AEBasePart implements IPartCable @SideOnly(Side.CLIENT) public void rendereGlassConection(int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer, ForgeDirection of) { - TileEntity te = this.tile.worldObj.getBlockTileEntity( x + of.offsetX, y + of.offsetY, z + of.offsetZ ); + TileEntity te = this.tile.getWorldObj().getTileEntity( x + of.offsetX, y + of.offsetY, z + of.offsetZ ); IPartHost ccph = te instanceof IPartHost ? (IPartHost) te : null; IGridHost gh = te instanceof IGridHost ? (IGridHost) te : null; @@ -479,7 +479,7 @@ public class PartCable extends AEBasePart implements IPartCable @SideOnly(Side.CLIENT) public void renderCoveredConection(int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer, int channels, ForgeDirection of) { - TileEntity te = this.tile.worldObj.getBlockTileEntity( x + of.offsetX, y + of.offsetY, z + of.offsetZ ); + TileEntity te = this.tile.getWorldObj().getTileEntity( x + of.offsetX, y + of.offsetY, z + of.offsetZ ); IPartHost ccph = te instanceof IPartHost ? (IPartHost) te : null; IGridHost ghh = te instanceof IGridHost ? (IGridHost) te : null; boolean isSmart = false; @@ -555,8 +555,8 @@ public class PartCable extends AEBasePart implements IPartCable if ( isSmart ) { setSmartConnectionRotations( of, renderer ); - Icon defa = new TaughtIcon( getChannelTex( channels, false ).getIcon(), -0.2f ); - Icon defb = new TaughtIcon( getChannelTex( channels, true ).getIcon(), -0.2f ); + IIcon defa = new TaughtIcon( getChannelTex( channels, false ).getIcon(), -0.2f ); + IIcon defb = new TaughtIcon( getChannelTex( channels, true ).getIcon(), -0.2f ); if ( of == ForgeDirection.EAST || of == ForgeDirection.WEST ) { @@ -581,7 +581,7 @@ public class PartCable extends AEBasePart implements IPartCable @SideOnly(Side.CLIENT) public void renderSmartConection(int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer, int channels, ForgeDirection of) { - TileEntity te = this.tile.worldObj.getBlockTileEntity( x + of.offsetX, y + of.offsetY, z + of.offsetZ ); + TileEntity te = this.tile.getWorldObj().getTileEntity( x + of.offsetX, y + of.offsetY, z + of.offsetZ ); IPartHost ccph = te instanceof IPartHost ? (IPartHost) te : null; IGridHost ghh = te instanceof IGridHost ? (IGridHost) te : null; boolean isGlass = false; @@ -623,8 +623,8 @@ public class PartCable extends AEBasePart implements IPartCable if ( true ) { setSmartConnectionRotations( of, renderer ); - Icon defa = new TaughtIcon( getChannelTex( channels, false ).getIcon(), -0.2f ); - Icon defb = new TaughtIcon( getChannelTex( channels, true ).getIcon(), -0.2f ); + IIcon defa = new TaughtIcon( getChannelTex( channels, false ).getIcon(), -0.2f ); + IIcon defb = new TaughtIcon( getChannelTex( channels, true ).getIcon(), -0.2f ); if ( of == ForgeDirection.EAST || of == ForgeDirection.WEST ) { @@ -684,8 +684,8 @@ public class PartCable extends AEBasePart implements IPartCable { setSmartConnectionRotations( of, renderer ); - Icon defa = new TaughtIcon( getChannelTex( channels, false ).getIcon(), -0.2f ); - Icon defb = new TaughtIcon( getChannelTex( channels, true ).getIcon(), -0.2f ); + IIcon defa = new TaughtIcon( getChannelTex( channels, false ).getIcon(), -0.2f ); + IIcon defb = new TaughtIcon( getChannelTex( channels, true ).getIcon(), -0.2f ); Tessellator.instance.setBrightness( 15 << 20 | 15 << 5 ); Tessellator.instance.setColorOpaque_I( myColor.mediumVariant ); @@ -768,7 +768,7 @@ public class PartCable extends AEBasePart implements IPartCable } else if ( connections.contains( dir ) ) { - TileEntity te = this.tile.worldObj.getBlockTileEntity( x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ ); + TileEntity te = this.tile.getWorldObj().getTileEntity( x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ ); IPartHost ccph = te instanceof IPartHost ? (IPartHost) te : null; IGridHost gh = te instanceof IGridHost ? (IGridHost) te : null; if ( ccph == null && gh != null && gh.getCableConnectionType( dir ) != AECableType.GLASS ) @@ -842,7 +842,7 @@ public class PartCable extends AEBasePart implements IPartCable } else { - Icon def = getTexture( getCableColor() ); + IIcon def = getTexture( getCableColor() ); rh.setTexture( def ); for (ForgeDirection of : connections) diff --git a/parts/networking/PartCableCovered.java b/parts/networking/PartCableCovered.java index a0949f6f..ddc8461b 100644 --- a/parts/networking/PartCableCovered.java +++ b/parts/networking/PartCableCovered.java @@ -4,8 +4,8 @@ import java.util.EnumSet; import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.item.ItemStack; -import net.minecraft.util.Icon; -import net.minecraftforge.common.ForgeDirection; +import net.minecraft.util.IIcon; +import net.minecraftforge.common.util.ForgeDirection; import org.lwjgl.opengl.GL11; @@ -45,7 +45,7 @@ public class PartCableCovered extends PartCable } @Override - public Icon getTexture(AEColor c) + public IIcon getTexture(AEColor c) { return getCoveredTexture( c ); } @@ -175,8 +175,8 @@ public class PartCableCovered extends PartCable } else { - Icon def = getTexture( getCableColor() ); - Icon off = new OffsetIcon( def, 0, -12 ); + IIcon def = getTexture( getCableColor() ); + IIcon off = new OffsetIcon( def, 0, -12 ); for (ForgeDirection of : connections) { switch (of) diff --git a/parts/networking/PartCableSmart.java b/parts/networking/PartCableSmart.java index 1344cb74..5a7702da 100644 --- a/parts/networking/PartCableSmart.java +++ b/parts/networking/PartCableSmart.java @@ -5,8 +5,8 @@ import java.util.EnumSet; import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.client.renderer.Tessellator; import net.minecraft.item.ItemStack; -import net.minecraft.util.Icon; -import net.minecraftforge.common.ForgeDirection; +import net.minecraft.util.IIcon; +import net.minecraftforge.common.util.ForgeDirection; import org.lwjgl.opengl.GL11; @@ -55,7 +55,7 @@ public class PartCableSmart extends PartCable } @Override - public Icon getTexture(AEColor c) + public IIcon getTexture(AEColor c) { return getSmartTexture( c ); } @@ -173,8 +173,8 @@ public class PartCableSmart extends PartCable rh.renderBlock( x, y, z, renderer ); setSmartConnectionRotations( of, renderer ); - Icon defa = new TaughtIcon( getChannelTex( channelsOnSide[of.ordinal()], false ).getIcon(), -0.2f ); - Icon defb = new TaughtIcon( getChannelTex( channelsOnSide[of.ordinal()], true ).getIcon(), -0.2f ); + IIcon defa = new TaughtIcon( getChannelTex( channelsOnSide[of.ordinal()], false ).getIcon(), -0.2f ); + IIcon defb = new TaughtIcon( getChannelTex( channelsOnSide[of.ordinal()], true ).getIcon(), -0.2f ); if ( of == ForgeDirection.EAST || of == ForgeDirection.WEST ) { @@ -221,14 +221,14 @@ public class PartCableSmart extends PartCable } int channels = channelsOnSide[selectedSide.ordinal()]; - Icon def = getTexture( getCableColor() ); - Icon off = new OffsetIcon( def, 0, -12 ); + IIcon def = getTexture( getCableColor() ); + IIcon off = new OffsetIcon( def, 0, -12 ); - Icon defa = new TaughtIcon( getChannelTex( channels, false ).getIcon(), -0.2f ); - Icon offa = new OffsetIcon( defa, 0, -12 ); + IIcon defa = new TaughtIcon( getChannelTex( channels, false ).getIcon(), -0.2f ); + IIcon offa = new OffsetIcon( defa, 0, -12 ); - Icon defb = new TaughtIcon( getChannelTex( channels, true ).getIcon(), -0.2f ); - Icon offb = new OffsetIcon( defb, 0, -12 ); + IIcon defb = new TaughtIcon( getChannelTex( channels, true ).getIcon(), -0.2f ); + IIcon offb = new OffsetIcon( defb, 0, -12 ); switch (selectedSide) { diff --git a/parts/networking/PartDenseCable.java b/parts/networking/PartDenseCable.java index c58469b1..d6897faa 100644 --- a/parts/networking/PartDenseCable.java +++ b/parts/networking/PartDenseCable.java @@ -6,8 +6,8 @@ import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.client.renderer.Tessellator; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.Icon; -import net.minecraftforge.common.ForgeDirection; +import net.minecraft.util.IIcon; +import net.minecraftforge.common.util.ForgeDirection; import org.lwjgl.opengl.GL11; @@ -66,7 +66,7 @@ public class PartDenseCable extends PartCable } @Override - public Icon getTexture(AEColor c) + public IIcon getTexture(AEColor c) { if ( c == AEColor.Transparent ) return AEApi.instance().parts().partCableSmart.stack( AEColor.Transparent, 1 ).getIconIndex(); @@ -172,7 +172,7 @@ public class PartDenseCable extends PartCable private boolean isDense(ForgeDirection of) { - TileEntity te = tile.worldObj.getBlockTileEntity( tile.xCoord + of.offsetX, tile.yCoord + of.offsetY, tile.zCoord + of.offsetZ ); + TileEntity te = tile.getWorldObj().getTileEntity( tile.xCoord + of.offsetX, tile.yCoord + of.offsetY, tile.zCoord + of.offsetZ ); if ( te instanceof IGridHost ) { AECableType t = ((IGridHost) te).getCableConnectionType( of.getOpposite() ); @@ -183,7 +183,7 @@ public class PartDenseCable extends PartCable private boolean isSmart(ForgeDirection of) { - TileEntity te = tile.worldObj.getBlockTileEntity( tile.xCoord + of.offsetX, tile.yCoord + of.offsetY, tile.zCoord + of.offsetZ ); + TileEntity te = tile.getWorldObj().getTileEntity( tile.xCoord + of.offsetX, tile.yCoord + of.offsetY, tile.zCoord + of.offsetZ ); if ( te instanceof IGridHost ) { AECableType t = ((IGridHost) te).getCableConnectionType( of.getOpposite() ); @@ -195,7 +195,7 @@ public class PartDenseCable extends PartCable @SideOnly(Side.CLIENT) public void renderDenseConection(int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer, int channels, ForgeDirection of) { - TileEntity te = this.tile.worldObj.getBlockTileEntity( x + of.offsetX, y + of.offsetY, z + of.offsetZ ); + TileEntity te = this.tile.getWorldObj().getTileEntity( x + of.offsetX, y + of.offsetY, z + of.offsetZ ); IPartHost ccph = te instanceof IPartHost ? (IPartHost) te : null; IGridHost ghh = te instanceof IGridHost ? (IGridHost) te : null; boolean isGlass = false; @@ -210,8 +210,8 @@ public class PartDenseCable extends PartCable * 13 ); break; case WEST: rh.setBounds( 0, 3, 3, 4, 13, 13 ); break; default: return; } rh.renderBlock( x, y, * z, renderer ); * - * if ( true ) { setSmartConnectionRotations( of, renderer ); Icon defa = new TaughtIcon( getChannelTex( - * channels, false ).getIcon(), -0.2f ); Icon defb = new TaughtIcon( getChannelTex( channels, true ).getIcon(), + * if ( true ) { setSmartConnectionRotations( of, renderer ); IIcon defa = new TaughtIcon( getChannelTex( + * channels, false ).getIcon(), -0.2f ); IIcon defb = new TaughtIcon( getChannelTex( channels, true ).getIcon(), * -0.2f ); * * if ( of == ForgeDirection.EAST || of == ForgeDirection.WEST ) { AEBaseBlock blk = (AEBaseBlock) @@ -266,8 +266,8 @@ public class PartDenseCable extends PartCable { setSmartConnectionRotations( of, renderer ); - Icon defa = new TaughtIcon( getChannelTex( channels, false ).getIcon(), -0.2f ); - Icon defb = new TaughtIcon( getChannelTex( channels, true ).getIcon(), -0.2f ); + IIcon defa = new TaughtIcon( getChannelTex( channels, false ).getIcon(), -0.2f ); + IIcon defb = new TaughtIcon( getChannelTex( channels, true ).getIcon(), -0.2f ); Tessellator.instance.setBrightness( 15 << 20 | 15 << 5 ); Tessellator.instance.setColorOpaque_I( myColor.mediumVariant ); @@ -324,14 +324,14 @@ public class PartDenseCable extends PartCable } int channels = channelsOnSide[selectedSide.ordinal()]; - Icon def = getTexture( getCableColor() ); - Icon off = new OffsetIcon( def, 0, -12 ); + IIcon def = getTexture( getCableColor() ); + IIcon off = new OffsetIcon( def, 0, -12 ); - Icon defa = new TaughtIcon( getChannelTex( channels, false ).getIcon(), -0.2f ); - Icon offa = new OffsetIcon( defa, 0, -12 ); + IIcon defa = new TaughtIcon( getChannelTex( channels, false ).getIcon(), -0.2f ); + IIcon offa = new OffsetIcon( defa, 0, -12 ); - Icon defb = new TaughtIcon( getChannelTex( channels, true ).getIcon(), -0.2f ); - Icon offb = new OffsetIcon( defb, 0, -12 ); + IIcon defb = new TaughtIcon( getChannelTex( channels, true ).getIcon(), -0.2f ); + IIcon offb = new OffsetIcon( defb, 0, -12 ); switch (selectedSide) { @@ -412,7 +412,7 @@ public class PartDenseCable extends PartCable rh.setTexture( null ); } - private Icon getDenseTexture(AEColor c) + private IIcon getDenseTexture(AEColor c) { switch (c) { diff --git a/parts/networking/PartQuartzFiber.java b/parts/networking/PartQuartzFiber.java index 4a44ac15..8f3e62e3 100644 --- a/parts/networking/PartQuartzFiber.java +++ b/parts/networking/PartQuartzFiber.java @@ -8,8 +8,8 @@ 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.Icon; -import net.minecraftforge.common.ForgeDirection; +import net.minecraft.util.IIcon; +import net.minecraftforge.common.util.ForgeDirection; import org.lwjgl.opengl.GL11; @@ -97,7 +97,7 @@ public class PartQuartzFiber extends AEBasePart implements IEnergyGridProvider @SideOnly(Side.CLIENT) public void renderStatic(int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer) { - Icon myIcon = is.getIconIndex(); + IIcon myIcon = is.getIconIndex(); rh.setTexture( myIcon ); rh.setBounds( 6, 6, 10, 10, 10, 16 ); rh.renderBlock( x, y, z, renderer ); diff --git a/parts/p2p/PartP2PBCPower.java b/parts/p2p/PartP2PBCPower.java index aab6182e..20b4663a 100644 --- a/parts/p2p/PartP2PBCPower.java +++ b/parts/p2p/PartP2PBCPower.java @@ -1,12 +1,12 @@ package appeng.parts.p2p; -import net.minecraft.block.Block; +import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.Icon; +import net.minecraft.util.IIcon; import net.minecraft.world.World; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.config.PowerUnits; import appeng.api.config.TunnelType; import appeng.api.networking.IGridNode; @@ -130,7 +130,7 @@ public class PartP2PBCPower extends PartP2PTunnel implements IPo private IPowerReceptor getPowerTarget() { - TileEntity te = getWorld().getBlockTileEntity( tile.xCoord + side.offsetX, tile.yCoord + side.offsetY, tile.zCoord + side.offsetZ ); + TileEntity te = getWorld().getTileEntity( tile.xCoord + side.offsetX, tile.yCoord + side.offsetY, tile.zCoord + side.offsetZ ); if ( te != null ) { if ( te instanceof IPowerReceptor ) @@ -154,9 +154,9 @@ public class PartP2PBCPower extends PartP2PTunnel implements IPo } @SideOnly(Side.CLIENT) - public Icon getTypeTexture() + public IIcon getTypeTexture() { - return Block.blockEmerald.getBlockTextureFromSide( 0 ); + return Blocks.emerald_block.getBlockTextureFromSide( 0 ); } @Override @@ -176,7 +176,7 @@ public class PartP2PBCPower extends PartP2PTunnel implements IPo @Override public World getWorld() { - return tile.worldObj; + return tile.getWorldObj(); } } diff --git a/parts/p2p/PartP2PIC2Power.java b/parts/p2p/PartP2PIC2Power.java index 91456ae3..6ab47154 100644 --- a/parts/p2p/PartP2PIC2Power.java +++ b/parts/p2p/PartP2PIC2Power.java @@ -2,12 +2,12 @@ package appeng.parts.p2p; import java.util.LinkedList; -import net.minecraft.block.Block; +import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.Icon; -import net.minecraftforge.common.ForgeDirection; +import net.minecraft.util.IIcon; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.config.TunnelType; import appeng.me.GridAccessException; import appeng.me.cache.helpers.TunnelCollection; @@ -17,7 +17,8 @@ import cpw.mods.fml.common.Optional.InterfaceList; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -@InterfaceList(value = { @Interface(iface = "ic2.api.energy.tile.IEnergySink", modid = "IC2"), @Interface(iface = "ic2.api.energy.tile.IEnergySource", modid = "IC2") }) +@InterfaceList(value = { @Interface(iface = "ic2.api.energy.tile.IEnergySink", modid = "IC2"), + @Interface(iface = "ic2.api.energy.tile.IEnergySource", modid = "IC2") }) public class PartP2PIC2Power extends PartP2PTunnel implements ic2.api.energy.tile.IEnergySink, ic2.api.energy.tile.IEnergySource { @@ -47,9 +48,9 @@ public class PartP2PIC2Power extends PartP2PTunnel implements i } @SideOnly(Side.CLIENT) - public Icon getTypeTexture() + public IIcon getTypeTexture() { - return Block.blockDiamond.getBlockTextureFromSide( 0 ); + return Blocks.diamond_block.getBlockTextureFromSide( 0 ); } @Override diff --git a/parts/p2p/PartP2PItems.java b/parts/p2p/PartP2PItems.java index 6f53a7e4..1e83f3ca 100644 --- a/parts/p2p/PartP2PItems.java +++ b/parts/p2p/PartP2PItems.java @@ -3,15 +3,15 @@ package appeng.parts.p2p; import java.util.LinkedList; import java.util.List; -import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.ISidedInventory; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntityChest; -import net.minecraft.util.Icon; -import net.minecraftforge.common.ForgeDirection; +import net.minecraft.util.IIcon; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.config.TunnelType; import appeng.api.networking.events.MENetworkBootingStatusChange; import appeng.api.networking.events.MENetworkChannelsChanged; @@ -57,7 +57,7 @@ public class PartP2PItems extends PartP2PTunnel implements IPipeCo if ( proxy.isActive() ) { - TileEntity te = tile.worldObj.getBlockTileEntity( tile.xCoord + side.offsetX, tile.yCoord + side.offsetY, tile.zCoord + side.offsetZ ); + TileEntity te = tile.getWorldObj().getTileEntity( tile.xCoord + side.offsetX, tile.yCoord + side.offsetY, tile.zCoord + side.offsetZ ); if ( which.contains( this ) ) return null; @@ -162,7 +162,7 @@ public class PartP2PItems extends PartP2PTunnel implements IPipeCo if ( olderSize != oldSize ) { getHost().PartChanged(); - tile.worldObj.notifyBlocksOfNeighborChange( tile.xCoord, tile.yCoord, tile.zCoord, 0 ); + tile.getWorldObj().notifyBlocksOfNeighborChange( tile.xCoord, tile.yCoord, tile.zCoord, Platform.air ); } } } @@ -178,7 +178,7 @@ public class PartP2PItems extends PartP2PTunnel implements IPipeCo if ( olderSize != oldSize ) { getHost().PartChanged(); - tile.worldObj.notifyBlocksOfNeighborChange( tile.xCoord, tile.yCoord, tile.zCoord, 0 ); + tile.getWorldObj().notifyBlocksOfNeighborChange( tile.xCoord, tile.yCoord, tile.zCoord, Platform.air ); } } } @@ -194,7 +194,7 @@ public class PartP2PItems extends PartP2PTunnel implements IPipeCo if ( olderSize != oldSize ) { getHost().PartChanged(); - tile.worldObj.notifyBlocksOfNeighborChange( tile.xCoord, tile.yCoord, tile.zCoord, 0 ); + tile.getWorldObj().notifyBlocksOfNeighborChange( tile.xCoord, tile.yCoord, tile.zCoord, Platform.air ); } } } @@ -210,7 +210,7 @@ public class PartP2PItems extends PartP2PTunnel implements IPipeCo if ( olderSize != oldSize ) { getHost().PartChanged(); - tile.worldObj.notifyBlocksOfNeighborChange( tile.xCoord, tile.yCoord, tile.zCoord, 0 ); + tile.getWorldObj().notifyBlocksOfNeighborChange( tile.xCoord, tile.yCoord, tile.zCoord, Platform.air ); } } else @@ -222,9 +222,9 @@ public class PartP2PItems extends PartP2PTunnel implements IPipeCo } @SideOnly(Side.CLIENT) - public Icon getTypeTexture() + public IIcon getTypeTexture() { - return Block.hopperBlock.getBlockTextureFromSide( 0 ); + return Blocks.hopper.getBlockTextureFromSide( 0 ); } @Override @@ -258,13 +258,13 @@ public class PartP2PItems extends PartP2PTunnel implements IPipeCo } @Override - public String getInvName() + public String getInventoryName() { return null; } @Override - public boolean isInvNameLocalized() + public boolean hasCustomInventoryName() { return false; } @@ -276,15 +276,13 @@ public class PartP2PItems extends PartP2PTunnel implements IPipeCo } @Override - public void openChest() + public void openInventory() { - } @Override - public void closeChest() + public void closeInventory() { - } @Override @@ -333,7 +331,7 @@ public class PartP2PItems extends PartP2PTunnel implements IPipeCo } @Override - public void onInventoryChanged() + public void markDirty() { // eh? } diff --git a/parts/p2p/PartP2PLiquids.java b/parts/p2p/PartP2PLiquids.java index b4ab914b..6f86e0f7 100644 --- a/parts/p2p/PartP2PLiquids.java +++ b/parts/p2p/PartP2PLiquids.java @@ -4,12 +4,12 @@ import java.util.Iterator; import java.util.LinkedList; import java.util.List; -import net.minecraft.block.Block; +import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.Icon; -import net.minecraftforge.common.ForgeDirection; +import net.minecraft.util.IIcon; +import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidTankInfo; @@ -76,9 +76,9 @@ public class PartP2PLiquids extends PartP2PTunnel implements IFl } @SideOnly(Side.CLIENT) - public Icon getTypeTexture() + public IIcon getTypeTexture() { - return Block.blockLapis.getBlockTextureFromSide( 0 ); + return Blocks.diamond_block.getBlockTextureFromSide( 0 ); } List getOutputs(Fluid input) @@ -128,7 +128,7 @@ public class PartP2PLiquids extends PartP2PTunnel implements IFl if ( cachedTank != null ) return cachedTank; - TileEntity te = tile.worldObj.getBlockTileEntity( tile.xCoord + side.offsetX, tile.yCoord + side.offsetY, tile.zCoord + side.offsetZ ); + TileEntity te = tile.getWorldObj().getTileEntity( tile.xCoord + side.offsetX, tile.yCoord + side.offsetY, tile.zCoord + side.offsetZ ); if ( te instanceof IFluidHandler ) return cachedTank = (IFluidHandler) te; diff --git a/parts/p2p/PartP2PRedstone.java b/parts/p2p/PartP2PRedstone.java index 658a8791..3437e600 100644 --- a/parts/p2p/PartP2PRedstone.java +++ b/parts/p2p/PartP2PRedstone.java @@ -2,9 +2,10 @@ package appeng.parts.p2p; import net.minecraft.block.Block; import net.minecraft.block.BlockRedstoneWire; +import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.Icon; +import net.minecraft.util.IIcon; import net.minecraft.world.World; import appeng.api.config.TunnelType; import appeng.api.networking.events.MENetworkBootingStatusChange; @@ -104,21 +105,21 @@ public class PartP2PRedstone extends PartP2PTunnel public void notifyNeightbors() { - World worldObj = tile.worldObj; + World worldObj = tile.getWorldObj(); int xCoord = tile.xCoord; int yCoord = tile.yCoord; int zCoord = tile.zCoord; - worldObj.notifyBlocksOfNeighborChange( xCoord, yCoord, zCoord, worldObj.getBlockId( xCoord, yCoord, zCoord ) ); + worldObj.notifyBlocksOfNeighborChange( xCoord, yCoord, zCoord, worldObj.getBlock( xCoord, yCoord, zCoord ) ); // and this cause somtimes it can go thought walls. - worldObj.notifyBlocksOfNeighborChange( xCoord - 1, yCoord, zCoord, worldObj.getBlockId( xCoord, yCoord, zCoord ) ); - worldObj.notifyBlocksOfNeighborChange( xCoord, yCoord - 1, zCoord, worldObj.getBlockId( xCoord, yCoord, zCoord ) ); - worldObj.notifyBlocksOfNeighborChange( xCoord, yCoord, zCoord - 1, worldObj.getBlockId( xCoord, yCoord, zCoord ) ); - worldObj.notifyBlocksOfNeighborChange( xCoord, yCoord, zCoord + 1, worldObj.getBlockId( xCoord, yCoord, zCoord ) ); - worldObj.notifyBlocksOfNeighborChange( xCoord, yCoord + 1, zCoord, worldObj.getBlockId( xCoord, yCoord, zCoord ) ); - worldObj.notifyBlocksOfNeighborChange( xCoord + 1, yCoord, zCoord, worldObj.getBlockId( xCoord, yCoord, zCoord ) ); + worldObj.notifyBlocksOfNeighborChange( xCoord - 1, yCoord, zCoord, worldObj.getBlock( xCoord, yCoord, zCoord ) ); + worldObj.notifyBlocksOfNeighborChange( xCoord, yCoord - 1, zCoord, worldObj.getBlock( xCoord, yCoord, zCoord ) ); + worldObj.notifyBlocksOfNeighborChange( xCoord, yCoord, zCoord - 1, worldObj.getBlock( xCoord, yCoord, zCoord ) ); + worldObj.notifyBlocksOfNeighborChange( xCoord, yCoord, zCoord + 1, worldObj.getBlock( xCoord, yCoord, zCoord ) ); + worldObj.notifyBlocksOfNeighborChange( xCoord, yCoord + 1, zCoord, worldObj.getBlock( xCoord, yCoord, zCoord ) ); + worldObj.notifyBlocksOfNeighborChange( xCoord + 1, yCoord, zCoord, worldObj.getBlock( xCoord, yCoord, zCoord ) ); } @Override @@ -136,9 +137,9 @@ public class PartP2PRedstone extends PartP2PTunnel } @SideOnly(Side.CLIENT) - public Icon getTypeTexture() + public IIcon getTypeTexture() { - return Block.blockRedstone.getBlockTextureFromSide( 0 ); + return Blocks.redstone_block.getBlockTextureFromSide( 0 ); } public float getPowerDrainPerTick() @@ -155,14 +156,14 @@ public class PartP2PRedstone extends PartP2PTunnel int y = tile.yCoord + side.offsetY; int z = tile.zCoord + side.offsetZ; - Block b = Block.blocksList[tile.worldObj.getBlockId( x, y, z )]; + Block b = tile.getWorldObj().getBlock( x, y, z ); if ( b != null && !output ) { int srcSide = side.ordinal(); if ( b instanceof BlockRedstoneWire ) srcSide = 1; - power = b.isProvidingStrongPower( tile.worldObj, x, y, z, srcSide ); - power = Math.max( power, b.isProvidingWeakPower( tile.worldObj, x, y, z, srcSide ) ); + power = b.isProvidingStrongPower( tile.getWorldObj(), x, y, z, srcSide ); + power = Math.max( power, b.isProvidingWeakPower( tile.getWorldObj(), x, y, z, srcSide ) ); sendToOutput( power ); } else diff --git a/parts/p2p/PartP2PTunnel.java b/parts/p2p/PartP2PTunnel.java index 08f85cdf..326f3153 100644 --- a/parts/p2p/PartP2PTunnel.java +++ b/parts/p2p/PartP2PTunnel.java @@ -6,9 +6,9 @@ import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.Icon; +import net.minecraft.util.IIcon; import net.minecraft.util.Vec3; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.AEApi; import appeng.api.config.PowerUnits; import appeng.api.config.TunnelType; @@ -164,7 +164,7 @@ public class PartP2PTunnel extends PartBasicState } } - tile.worldObj.notifyBlocksOfNeighborChange( tile.xCoord, tile.yCoord, tile.zCoord, 0 ); + tile.getWorldObj().notifyBlocksOfNeighborChange( tile.xCoord, tile.yCoord, tile.zCoord, Platform.air ); return true; } } @@ -276,7 +276,7 @@ public class PartP2PTunnel extends PartBasicState rh.renderInventoryBox( renderer ); } - protected Icon getTypeTexture() + protected IIcon getTypeTexture() { return AEApi.instance().blocks().blockQuartz.block().getIcon( 0, 0 ); } diff --git a/parts/p2p/PartP2PTunnelME.java b/parts/p2p/PartP2PTunnelME.java index ecb55c77..87e7b03b 100644 --- a/parts/p2p/PartP2PTunnelME.java +++ b/parts/p2p/PartP2PTunnelME.java @@ -8,7 +8,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.AEApi; import appeng.api.config.TunnelType; import appeng.api.exceptions.FailedConnection; diff --git a/parts/reporting/PartConversionMonitor.java b/parts/reporting/PartConversionMonitor.java index 499cc11c..5d87ced6 100644 --- a/parts/reporting/PartConversionMonitor.java +++ b/parts/reporting/PartConversionMonitor.java @@ -7,7 +7,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.Vec3; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.networking.energy.IEnergySource; import appeng.api.networking.security.PlayerSource; import appeng.api.storage.IMEMonitor; diff --git a/parts/reporting/PartDarkMonitor.java b/parts/reporting/PartDarkMonitor.java index 879dfe30..f478e016 100644 --- a/parts/reporting/PartDarkMonitor.java +++ b/parts/reporting/PartDarkMonitor.java @@ -3,7 +3,7 @@ package appeng.parts.reporting; import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.client.renderer.Tessellator; import net.minecraft.item.ItemStack; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.parts.IPartRenderHelper; import appeng.client.texture.CableBusTextures; import cpw.mods.fml.relauncher.Side; diff --git a/parts/reporting/PartMonitor.java b/parts/reporting/PartMonitor.java index ee81041f..9eb2d677 100644 --- a/parts/reporting/PartMonitor.java +++ b/parts/reporting/PartMonitor.java @@ -1,7 +1,7 @@ package appeng.parts.reporting; -import java.io.DataInputStream; -import java.io.DataOutputStream; +import io.netty.buffer.ByteBuf; + import java.io.IOException; import net.minecraft.client.renderer.RenderBlocks; @@ -9,7 +9,7 @@ import net.minecraft.client.renderer.Tessellator; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.Vec3; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.implementations.parts.IPartMonitor; import appeng.api.networking.GridFlags; import appeng.api.networking.events.MENetworkBootingStatusChange; @@ -54,7 +54,7 @@ public class PartMonitor extends AEBasePart implements IPartMonitor } @Override - public void writeToStream(DataOutputStream data) throws IOException + public void writeToStream(ByteBuf data) throws IOException { super.writeToStream( data ); clientFlags = 0; @@ -79,7 +79,7 @@ public class PartMonitor extends AEBasePart implements IPartMonitor } @Override - public boolean readFromStream(DataInputStream data) throws IOException + public boolean readFromStream(ByteBuf data) throws IOException { super.readFromStream( data ); int oldFlags = clientFlags; diff --git a/parts/reporting/PartSemiDarkMonitor.java b/parts/reporting/PartSemiDarkMonitor.java index ccd00ccb..01394275 100644 --- a/parts/reporting/PartSemiDarkMonitor.java +++ b/parts/reporting/PartSemiDarkMonitor.java @@ -3,7 +3,7 @@ package appeng.parts.reporting; import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.client.renderer.Tessellator; import net.minecraft.item.ItemStack; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.parts.IPartRenderHelper; import appeng.client.texture.CableBusTextures; import cpw.mods.fml.relauncher.Side; diff --git a/parts/reporting/PartStorageMonitor.java b/parts/reporting/PartStorageMonitor.java index d2f50169..757442c0 100644 --- a/parts/reporting/PartStorageMonitor.java +++ b/parts/reporting/PartStorageMonitor.java @@ -2,9 +2,8 @@ package appeng.parts.reporting; import static net.minecraftforge.client.IItemRenderer.ItemRenderType.ENTITY; import static net.minecraftforge.client.IItemRenderer.ItemRendererHelper.BLOCK_3D; +import io.netty.buffer.ByteBuf; -import java.io.DataInputStream; -import java.io.DataOutputStream; import java.io.IOException; import net.minecraft.block.Block; @@ -25,7 +24,7 @@ import net.minecraft.util.MathHelper; import net.minecraft.util.Vec3; import net.minecraftforge.client.IItemRenderer; import net.minecraftforge.client.MinecraftForgeClient; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL12; @@ -79,7 +78,7 @@ public class PartStorageMonitor extends PartMonitor implements IPartStorageMonit if ( configuredItem != null ) configuredItem.writeToNBT( myItem ); - data.setCompoundTag( "configuredItem", myItem ); + data.setTag( "configuredItem", myItem ); } @Override @@ -95,7 +94,7 @@ public class PartStorageMonitor extends PartMonitor implements IPartStorageMonit } @Override - public void writeToStream(DataOutputStream data) throws IOException + public void writeToStream(ByteBuf data) throws IOException { super.writeToStream( data ); @@ -106,7 +105,7 @@ public class PartStorageMonitor extends PartMonitor implements IPartStorageMonit } @Override - public boolean readFromStream(DataInputStream data) throws IOException + public boolean readFromStream(ByteBuf data) throws IOException { boolean stuff = super.readFromStream( data ); @@ -134,7 +133,7 @@ public class PartStorageMonitor extends PartMonitor implements IPartStorageMonit if ( Platform.isWrench( player, eq, te.xCoord, te.yCoord, te.zCoord ) ) { isLocked = !isLocked; - player.sendChatToPlayer( (isLocked ? PlayerMessages.isNowLocked : PlayerMessages.isNowUnlocked).get() ); + player.addChatMessage( (isLocked ? PlayerMessages.isNowLocked : PlayerMessages.isNowUnlocked).get() ); } else if ( !isLocked ) { @@ -176,7 +175,7 @@ public class PartStorageMonitor extends PartMonitor implements IPartStorageMonit public void renderDynamic(double x, double y, double z, IPartRenderHelper rh, RenderBlocks renderer) { Tessellator tess = Tessellator.instance; - if ( tess.isDrawing ) + if ( Platform.isDrawing( tess ) ) return; if ( (clientFlags & (POWERED_FLAG | CHANNEL_FLAG)) != (POWERED_FLAG | CHANNEL_FLAG) ) @@ -240,9 +239,8 @@ public class PartStorageMonitor extends PartMonitor implements IPartStorageMonit GL11.glScalef( 1.0f, -1.0f, 0.005f ); // GL11.glScalef( 1.0f , -1.0f, 1.0f ); - int k = sis.itemID; - Block block = (k < Block.blocksList.length ? Block.blocksList[k] : null); - if ( (sis.getItemSpriteNumber() == 0 && block != null && RenderBlocks.renderItemIn3d( Block.blocksList[k].getRenderType() )) ) + Block block = Block.getBlockFromItem( sis.getItem() ); + if ( (sis.getItemSpriteNumber() == 0 && block != null && RenderBlocks.renderItemIn3d( block.getRenderType() )) ) { GL11.glRotatef( 25.0f, 1.0f, 0.0f, 0.0f ); GL11.glRotatef( 15.0f, 0.0f, 1.0f, 0.0f ); @@ -300,7 +298,7 @@ public class PartStorageMonitor extends PartMonitor implements IPartStorageMonit { if ( itemstack != null ) { - EntityItem entityitem = new EntityItem( par1EntityItemFrame.worldObj, 0.0D, 0.0D, 0.0D, itemstack ); + EntityItem entityitem = new EntityItem( par1EntityItemFrame.getWorldObj(), 0.0D, 0.0D, 0.0D, itemstack ); entityitem.getEntityItem().stackSize = 1; // set all this stuff and then do shit? meh? diff --git a/parts/reporting/PartTerminal.java b/parts/reporting/PartTerminal.java index 64ae7259..439af3c7 100644 --- a/parts/reporting/PartTerminal.java +++ b/parts/reporting/PartTerminal.java @@ -44,9 +44,9 @@ public class PartTerminal extends PartMonitor implements IStorageMonitorable else { if ( proxy.isPowered() ) - player.sendChatToPlayer( PlayerMessages.CommunicationError.get() ); + player.addChatMessage( PlayerMessages.CommunicationError.get() ); else - player.sendChatToPlayer( PlayerMessages.MachineNotPowered.get() ); + player.addChatMessage( PlayerMessages.MachineNotPowered.get() ); } return true; diff --git a/recipes/AEShapedQuartzRecipe.java b/recipes/AEShapedQuartzRecipe.java index 14d545f7..88a501c1 100644 --- a/recipes/AEShapedQuartzRecipe.java +++ b/recipes/AEShapedQuartzRecipe.java @@ -4,6 +4,7 @@ import java.util.ArrayList; import java.util.HashMap; import net.minecraft.block.Block; +import net.minecraft.init.Items; import net.minecraft.inventory.InventoryCrafting; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -59,7 +60,8 @@ public class AEShapedQuartzRecipe implements IRecipe if ( recipe[idx + 1] instanceof Object[] ) { recipe = (Object[]) recipe[idx + 1]; - } else + } + else { idx = 1; } @@ -76,7 +78,8 @@ public class AEShapedQuartzRecipe implements IRecipe } height = parts.length; - } else + } + else { while (recipe[idx] instanceof String) { @@ -108,13 +111,16 @@ public class AEShapedQuartzRecipe implements IRecipe if ( in instanceof ItemStack ) { itemMap.put( chr, ((ItemStack) in).copy() ); - } else if ( in instanceof Item ) + } + else if ( in instanceof Item ) { itemMap.put( chr, new ItemStack( (Item) in ) ); - } else if ( in instanceof Block ) + } + else if ( in instanceof Block ) { itemMap.put( chr, new ItemStack( (Block) in, 1, OreDictionary.WILDCARD_VALUE ) ); - } else if ( in instanceof String ) + } + else if ( in instanceof String ) { ArrayList is = OreDictionary.getOres( (String) in ); ArrayList copy = new ArrayList(); @@ -126,15 +132,17 @@ public class AEShapedQuartzRecipe implements IRecipe { copy.add( AEApi.instance().materials().materialCertusQuartzDust.stack( 1 ) ); copy.add( AEApi.instance().materials().materialNetherQuartzDust.stack( 1 ) ); - } else + } + else { copy.add( AEApi.instance().materials().materialCertusQuartzCrystal.stack( 1 ) ); - copy.add( new ItemStack( Item.netherQuartz ) ); + copy.add( new ItemStack( Items.quartz ) ); } } itemMap.put( chr, copy ); - } else + } + else { String ret = "Invalid shaped ore recipe: "; for (Object tmp : recipe) @@ -209,7 +217,8 @@ public class AEShapedQuartzRecipe implements IRecipe if ( mirror ) { target = input[width - subX - 1 + subY * width]; - } else + } + else { target = input[subX + subY * width]; } @@ -223,7 +232,8 @@ public class AEShapedQuartzRecipe implements IRecipe { return false; } - } else if ( target instanceof ArrayList ) + } + else if ( target instanceof ArrayList ) { boolean matched = false; @@ -236,7 +246,8 @@ public class AEShapedQuartzRecipe implements IRecipe { return false; } - } else if ( target == null && slot != null ) + } + else if ( target == null && slot != null ) { return false; } @@ -252,8 +263,8 @@ public class AEShapedQuartzRecipe implements IRecipe { return false; } - return (target.itemID == input.itemID && (target.getItemDamage() == OreDictionary.WILDCARD_VALUE || target - .getItemDamage() == input.getItemDamage())); + return (target.getItem() == input.getItem() && (target.getItemDamage() == OreDictionary.WILDCARD_VALUE || target.getItemDamage() == input + .getItemDamage())); } public AEShapedQuartzRecipe setMirrored(boolean mirror) @@ -263,9 +274,8 @@ public class AEShapedQuartzRecipe implements IRecipe } /** - * Returns the input for this recipe, any mod accessing this value should - * never manipulate the values in this array as it will effect the recipe - * itself. + * Returns the input for this recipe, any mod accessing this value should never manipulate the values in this array + * as it will effect the recipe itself. * * @return The recipes input vales. */ diff --git a/recipes/ores/OreDictionaryHandler.java b/recipes/ores/OreDictionaryHandler.java index 98a90950..3c2c82a1 100644 --- a/recipes/ores/OreDictionaryHandler.java +++ b/recipes/ores/OreDictionaryHandler.java @@ -4,8 +4,8 @@ import java.util.ArrayList; import java.util.List; import net.minecraft.item.ItemStack; -import net.minecraftforge.event.ForgeSubscribe; import net.minecraftforge.oredict.OreDictionary; +import cpw.mods.fml.common.eventhandler.SubscribeEvent; public class OreDictionaryHandler { @@ -25,7 +25,7 @@ public class OreDictionaryHandler return true; } - @ForgeSubscribe + @SubscribeEvent public void onOreDictionaryRegister(OreDictionary.OreRegisterEvent event) { if ( shouldCare( event.Name ) ) diff --git a/server/ServerHelper.java b/server/ServerHelper.java index 6b54c210..d93de284 100644 --- a/server/ServerHelper.java +++ b/server/ServerHelper.java @@ -6,11 +6,12 @@ import java.util.Random; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.network.packet.Packet; import net.minecraft.server.MinecraftServer; import net.minecraft.world.World; import appeng.block.AEBaseBlock; import appeng.core.CommonHelper; +import appeng.core.sync.AppEngPacket; +import appeng.core.sync.network.NetworkHandler; import appeng.util.Platform; import cpw.mods.fml.common.FMLCommonHandler; @@ -32,7 +33,7 @@ public class ServerHelper extends CommonHelper } @Override - public void sendToAllNearExcept(EntityPlayer p, double x, double y, double z, double dist, World w, Packet packet) + public void sendToAllNearExcept(EntityPlayer p, double x, double y, double z, double dist, World w, AppEngPacket packet) { if ( Platform.isClient() ) return; @@ -49,7 +50,7 @@ public class ServerHelper extends CommonHelper if ( dX * dX + dY * dY + dZ * dZ < dist * dist ) { - entityplayermp.playerNetServerHandler.sendPacketToPlayer( packet ); + NetworkHandler.instance.sendTo( packet, entityplayermp ); } } } diff --git a/services/VersionChecker.java b/services/VersionChecker.java index c7c3e3fa..a20c9c48 100644 --- a/services/VersionChecker.java +++ b/services/VersionChecker.java @@ -8,7 +8,6 @@ import java.util.Date; import java.util.regex.Matcher; import java.util.regex.Pattern; -import net.minecraft.crash.CallableMinecraftVersion; import appeng.core.AELog; import appeng.core.Configuration; @@ -44,10 +43,11 @@ public class VersionChecker implements Runnable { URL url = new URL( "http://ae-mod.info/releases/?latest" ); - URLConnection yc = url.openConnection(); - yc.setRequestProperty( "User-Agent", "AE2/" + Configuration.VERSION + " (Channel:" + Configuration.CHANNEL + ",Minecraft:" - + ((new CallableMinecraftVersion( null )).minecraftVersion()) + ")" ); + String MCVersion = cpw.mods.fml.common.Loader.instance().getMCVersionString(); + URLConnection yc = url.openConnection(); + yc.setRequestProperty( "User-Agent", "AE2/" + Configuration.VERSION + " (Channel:" + Configuration.CHANNEL + "," + MCVersion.replace( " ", ":" ) + + ")" ); BufferedReader in = new BufferedReader( new InputStreamReader( yc.getInputStream() ) ); String Version = ""; diff --git a/spatial/CachedPlane.java b/spatial/CachedPlane.java index da509155..bb0c9c2d 100644 --- a/spatial/CachedPlane.java +++ b/spatial/CachedPlane.java @@ -7,22 +7,19 @@ import java.util.List; import java.util.Map.Entry; import net.minecraft.block.Block; -import net.minecraft.network.packet.Packet51MapChunk; -import net.minecraft.server.management.PlayerInstance; -import net.minecraft.server.management.PlayerManager; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.ChunkPosition; import net.minecraft.world.NextTickListEntry; import net.minecraft.world.World; -import net.minecraft.world.WorldServer; import net.minecraft.world.chunk.Chunk; import net.minecraft.world.chunk.storage.ExtendedBlockStorage; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.AEApi; import appeng.api.movable.IMovableHandler; import appeng.api.movable.IMovableRegistry; import appeng.api.util.WorldCoord; import appeng.core.AELog; +import appeng.util.Platform; public class CachedPlane { @@ -33,7 +30,7 @@ public class CachedPlane private final int x; private final int z; private final Chunk c; - private final int ch[] = { 0, 0, 0 }; + private final Object ch[] = { 0, 0, 0 }; private List skipThese = null; private ExtendedBlockStorage[] storage; @@ -54,18 +51,19 @@ public class CachedPlane } } - public void setBlockIDWithMetadata(int y, int[] blk) + public void setBlockIDWithMetadata(int y, Object[] blk) { ExtendedBlockStorage extendedblockstorage = storage[y >> 4]; - extendedblockstorage.setExtBlockID( x, y & 15, z, blk[0] ); - extendedblockstorage.setExtBlockMetadata( x, y & 15, z, blk[1] ); - extendedblockstorage.setExtBlocklightValue( x, y & 15, z, blk[2] ); + extendedblockstorage.func_150818_a( x, y & 15, z, (Block) blk[0] ); + // extendedblockstorage.setExtBlockID( x, y & 15, z, blk[0] ); + extendedblockstorage.setExtBlockMetadata( x, y & 15, z, (Integer) blk[1] ); + extendedblockstorage.setExtBlocklightValue( x, y & 15, z, (Integer) blk[2] ); } - public int[] getDetails(int y) + public Object[] getDetails(int y) { ExtendedBlockStorage extendedblockstorage = storage[y >> 4]; - ch[0] = extendedblockstorage.getExtBlockID( x, y & 15, z ); + ch[0] = extendedblockstorage.getBlockByExtId( x, y & 15, z ); ch[1] = extendedblockstorage.getExtBlockMetadata( x, y & 15, z ); ch[2] = extendedblockstorage.getExtBlocklightValue( x, y & 15, z ); return ch; @@ -172,15 +170,15 @@ public class CachedPlane } else { - int[] details = myColumns[te.xCoord - minx][te.zCoord - minz].getDetails( te.yCoord ); - Block blk = Block.blocksList[details[0]]; + Object[] details = myColumns[te.xCoord - minx][te.zCoord - minz].getDetails( te.yCoord ); + Block blk = (Block) details[0]; // don't skip air, juset let the code replace it... - if ( blk != null && blk.isAirBlock( c.worldObj, te.xCoord, te.yCoord, te.zCoord ) - && blk.isBlockReplaceable( c.worldObj, te.xCoord, te.yCoord, te.zCoord ) ) + if ( blk != null && blk.isAir( c.worldObj, te.xCoord, te.yCoord, te.zCoord ) + && blk.isReplaceable( c.worldObj, te.xCoord, te.yCoord, te.zCoord ) ) { - c.worldObj.setBlock( te.xCoord, te.yCoord, te.zCoord, 0 ); - c.worldObj.notifyBlocksOfNeighborChange( te.xCoord, te.yCoord, te.zCoord, 0 ); + c.worldObj.setBlock( te.xCoord, te.yCoord, te.zCoord, Platform.air ); + c.worldObj.notifyBlocksOfNeighborChange( te.xCoord, te.yCoord, te.zCoord, Platform.air ); } else myColumns[te.xCoord - minx][te.zCoord - minz].setSkip( te.yCoord ); @@ -200,9 +198,10 @@ public class CachedPlane for (Object o : list) { NextTickListEntry ntle = (NextTickListEntry) o; - if ( ntle.xCoord >= minx && ntle.xCoord <= maxx && ntle.yCoord >= miny && ntle.yCoord <= maxy && ntle.zCoord >= minz && ntle.zCoord <= maxz ) + if ( ntle.xCoord >= minx && ntle.xCoord <= maxx && ntle.yCoord >= miny && ntle.yCoord <= maxy && ntle.zCoord >= minz + && ntle.zCoord <= maxz ) { - NextTickListEntry newEntry = new NextTickListEntry( ntle.xCoord, ntle.yCoord, ntle.zCoord, ntle.blockID ); + NextTickListEntry newEntry = new NextTickListEntry( ntle.xCoord, ntle.yCoord, ntle.zCoord, ntle.func_151351_a() ); newEntry.scheduledTime = ntle.scheduledTime - k; ticks.add( newEntry ); } @@ -254,8 +253,8 @@ public class CachedPlane if ( a.dontSkip( src_y ) && b.dontSkip( dst_y ) ) { - int[] aD = a.getDetails( src_y ); - int[] bD = b.getDetails( dst_y ); + Object[] aD = a.getDetails( src_y ); + Object[] bD = b.getDetails( dst_y ); a.setBlockIDWithMetadata( src_y, bD ); b.setBlockIDWithMetadata( dst_y, aD ); @@ -313,7 +312,7 @@ public class CachedPlane private void addTick(int x, int y, int z, NextTickListEntry ntle) { - wrld.scheduleBlockUpdate( x + x_offset, y + y_offset, z + z_offset, ntle.blockID, (int) ntle.scheduledTime ); + wrld.scheduleBlockUpdate( x + x_offset, y + y_offset, z + z_offset, ntle.func_151351_a(), (int) ntle.scheduledTime ); } private void addTile(int x, int y, int z, TileEntity te, CachedPlane alernateDest, IMovableRegistry mr) @@ -335,12 +334,13 @@ public class CachedPlane AELog.error( e ); // attempt recovery... - te.worldObj = wrld; + te.setWorldObj( wrld ); te.xCoord = x; te.yCoord = y; te.zCoord = z; - c.c.setChunkBlockTileEntity( c.x, y + y, c.z, te ); + c.c.func_150812_a( c.x, y + y, c.z, te ); + // c.c.setChunkTileEntity( c.x, y + y, c.z, te ); if ( c.c.isChunkLoaded ) { @@ -384,14 +384,18 @@ public class CachedPlane for (int x = 0; x < cx_size; x++) for (int z = 0; z < cz_size; z++) { - Chunk c = myChunks[x][z]; - WorldServer ws = (WorldServer) c.worldObj; - PlayerManager pm = ws.getPlayerManager(); - PlayerInstance playerinstance = pm.getOrCreateChunkWatcher( c.xPosition, c.zPosition, false ); + // TODO: Fix? - if ( playerinstance != null ) - playerinstance.sendToAllPlayersWatchingChunk( new Packet51MapChunk( c, false, verticalBits ) ); + /* + * Chunk c = myChunks[x][z]; + * + * WorldServer ws = (WorldServer) c.worldObj; PlayerManager pm = ws.getPlayerManager(); PlayerInstance + * playerinstance = pm.getOrCreateChunkWatcher( c.xPosition, c.zPosition, false ); + * + * if ( playerinstance != null ) playerinstance.sendToAllPlayersWatchingChunk( new Packet51MapChunk( c, + * false, verticalBits ) ); + */ } } diff --git a/spatial/DefaultSpatialHandler.java b/spatial/DefaultSpatialHandler.java index b7ec5bb7..2650b5b2 100644 --- a/spatial/DefaultSpatialHandler.java +++ b/spatial/DefaultSpatialHandler.java @@ -12,13 +12,14 @@ public class DefaultSpatialHandler implements IMovableHandler public void moveTile(TileEntity te, World w, int x, int y, int z) { - te.worldObj = w; + te.setWorldObj( w ); te.xCoord = x; te.yCoord = y; te.zCoord = z; Chunk c = w.getChunkFromBlockCoords( x, z ); - c.setChunkBlockTileEntity( x & 0xF, y, z & 0xF, te ); + c.func_150812_a( x & 0xF, y, z & 0xF, te ); + // c.setChunkBlockTileEntity( x & 0xF, y, z & 0xF, te ); if ( c.isChunkLoaded ) { diff --git a/spatial/StorageChunkProvider.java b/spatial/StorageChunkProvider.java index c9a5b367..a1e84ec6 100644 --- a/spatial/StorageChunkProvider.java +++ b/spatial/StorageChunkProvider.java @@ -4,7 +4,6 @@ import java.util.ArrayList; import java.util.List; import net.minecraft.entity.EnumCreatureType; -import net.minecraft.world.ChunkPosition; import net.minecraft.world.World; import net.minecraft.world.chunk.Chunk; import net.minecraft.world.chunk.IChunkProvider; @@ -29,10 +28,7 @@ public class StorageChunkProvider extends ChunkProviderGenerate implements IChun @Override public Chunk provideChunk(int x, int z) { - - byte[] data = new byte[32768]; - - Chunk chunk = new Chunk( w, data, x, z ); + Chunk chunk = new Chunk( w, x, z ); if ( !chunk.isTerrainPopulated ) { @@ -55,10 +51,4 @@ public class StorageChunkProvider extends ChunkProviderGenerate implements IChun return new ArrayList(); } - @Override - public ChunkPosition findClosestStructure(World par1World, String par2Str, int par3, int par4, int par5) - { - return null; - } - } diff --git a/spatial/StorageHelper.java b/spatial/StorageHelper.java index b1240e29..c38f0169 100644 --- a/spatial/StorageHelper.java +++ b/spatial/StorageHelper.java @@ -15,6 +15,7 @@ import net.minecraft.world.WorldServer; import appeng.api.AEApi; import appeng.api.util.WorldCoord; import appeng.block.solids.BlockMatrixFrame; +import appeng.util.Platform; public class StorageHelper { @@ -40,9 +41,8 @@ public class StorageHelper @Override public void visit(int x, int y, int z) { - int blk = dst.getBlockId( x, y, z ); - if ( blk > 0 ) - Block.blocksList[blk].onNeighborBlockChange( dst, x, y, z, 0 ); + Block blk = dst.getBlock( x, y, z ); + blk.onNeighborBlockChange( dst, x, y, z, Platform.air ); } }; @@ -50,9 +50,10 @@ public class StorageHelper { World dst; - int blkID, Meta; + Block blkID; + int Meta; - public WrapInMatrixFrame(int blockID, int metaData, World dst2) { + public WrapInMatrixFrame(Block blockID, int metaData, World dst2) { dst = dst2; blkID = blockID; Meta = metaData; @@ -178,7 +179,8 @@ public class StorageHelper oldWorld.getChunkFromChunkCoords( entX, entZ ).isModified = true; } - oldWorld.onEntityRemoved( entity ); + // TODO: Fix? + // oldWorld.onEntityRemoved( entity ); if ( player == null ) // Are we NOT working with a player? { @@ -215,7 +217,8 @@ public class StorageHelper if ( player != null ) { - WorldServer.class.cast( newWorld ).getChunkProvider().loadChunk( MathHelper.floor_double( entity.posX ) >> 4, MathHelper.floor_double( entity.posZ ) >> 4 ); + WorldServer.class.cast( newWorld ).getChunkProvider() + .loadChunk( MathHelper.floor_double( entity.posX ) >> 4, MathHelper.floor_double( entity.posZ ) >> 4 ); } return entity; @@ -252,7 +255,7 @@ public class StorageHelper { BlockMatrixFrame blkMF = (BlockMatrixFrame) AEApi.instance().blocks().blockMatrixFrame.block(); - transverseEdges( i - 1, j - 1, k - 1, i + scaleX + 1, j + scaleY + 1, k + scaleZ + 1, new WrapInMatrixFrame( blkMF.blockID, 0, dst ) ); + transverseEdges( i - 1, j - 1, k - 1, i + scaleX + 1, j + scaleY + 1, k + scaleZ + 1, new WrapInMatrixFrame( blkMF, 0, dst ) ); AxisAlignedBB srcBox = AxisAlignedBB.getBoundingBox( x, y, z, x + scaleX + 1, y + scaleY + 1, z + scaleZ + 1 ); @@ -278,10 +281,10 @@ public class StorageHelper } for (WorldCoord wc : cDst.updates) - cDst.wrld.notifyBlockOfNeighborChange( wc.x, wc.y, wc.z, 0 ); + cDst.wrld.notifyBlockOfNeighborChange( wc.x, wc.y, wc.z, Platform.air ); for (WorldCoord wc : cSrc.updates) - cSrc.wrld.notifyBlockOfNeighborChange( wc.x, wc.y, wc.z, 0 ); + cSrc.wrld.notifyBlockOfNeighborChange( wc.x, wc.y, wc.z, Platform.air ); transverseEdges( x - 1, y - 1, z - 1, x + scaleX + 1, y + scaleY + 1, z + scaleZ + 1, new triggerUpdates( src ) ); transverseEdges( i - 1, j - 1, k - 1, i + scaleX + 1, j + scaleY + 1, k + scaleZ + 1, new triggerUpdates( dst ) ); @@ -290,9 +293,8 @@ public class StorageHelper transverseEdges( i, j, k, i + scaleX, j + scaleY, k + scaleZ, new triggerUpdates( dst ) ); /* - * IChunkProvider cp = dest.getChunkProvider(); if ( cp instanceof - * ChunkProviderServer ) { ChunkProviderServer srv = - * (ChunkProviderServer) cp; srv.unloadAllChunks(); } + * IChunkProvider cp = dest.getChunkProvider(); if ( cp instanceof ChunkProviderServer ) { ChunkProviderServer + * srv = (ChunkProviderServer) cp; srv.unloadAllChunks(); } * * cp.unloadQueuedChunks(); */ diff --git a/spatial/StorageWorldProvider.java b/spatial/StorageWorldProvider.java index 7b0184a6..03198c09 100644 --- a/spatial/StorageWorldProvider.java +++ b/spatial/StorageWorldProvider.java @@ -33,7 +33,7 @@ public class StorageWorldProvider extends WorldProvider @Override protected void registerWorldChunkManager() { - super.worldChunkMgr = new WorldChunkManagerHell( Registration.instance.storageBiome, 1, 1 ); + super.worldChunkMgr = new WorldChunkManagerHell( Registration.instance.storageBiome, 0.0F ); } @Override diff --git a/tile/AEBaseInvTile.java b/tile/AEBaseInvTile.java index e3efde00..aa2da4bf 100644 --- a/tile/AEBaseInvTile.java +++ b/tile/AEBaseInvTile.java @@ -39,9 +39,9 @@ public abstract class AEBaseInvTile extends AEBaseTile implements ISidedInventor ItemStack is = getStackInSlot( x ); if ( is != null ) is.writeToNBT( item ); - opt.setCompoundTag( "item" + x, item ); + opt.setTag( "item" + x, item ); } - data.setCompoundTag( "inv", opt ); + data.setTag( "inv", opt ); } } ); @@ -78,17 +78,27 @@ public abstract class AEBaseInvTile extends AEBaseTile implements ISidedInventor } @Override - public String getInvName() + public String getInventoryName() { return getClass().getSimpleName(); } @Override - public boolean isInvNameLocalized() + public boolean hasCustomInventoryName() { return false; } + @Override + public void openInventory() + { + } + + @Override + public void closeInventory() + { + } + @Override public int getInventoryStackLimit() { @@ -98,20 +108,10 @@ public abstract class AEBaseInvTile extends AEBaseTile implements ISidedInventor @Override public boolean isUseableByPlayer(EntityPlayer p) { - return this.worldObj.getBlockTileEntity( this.xCoord, this.yCoord, this.zCoord ) != this ? false : p.getDistanceSq( (double) this.xCoord + 0.5D, + return this.worldObj.getTileEntity( this.xCoord, this.yCoord, this.zCoord ) != this ? false : p.getDistanceSq( (double) this.xCoord + 0.5D, (double) this.yCoord + 0.5D, (double) this.zCoord + 0.5D ) <= 32.0D; } - @Override - public void openChest() - { - } - - @Override - public void closeChest() - { - } - @Override public boolean isItemValidForSlot(int i, ItemStack itemstack) { diff --git a/tile/AEBaseTile.java b/tile/AEBaseTile.java index 498d93fc..63a6f697 100644 --- a/tile/AEBaseTile.java +++ b/tile/AEBaseTile.java @@ -1,9 +1,8 @@ package appeng.tile; -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.DataInputStream; -import java.io.DataOutputStream; +import io.netty.buffer.ByteBuf; +import io.netty.buffer.Unpooled; + import java.util.ArrayList; import java.util.EnumMap; import java.util.EnumSet; @@ -15,17 +14,18 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.network.INetworkManager; -import net.minecraft.network.packet.Packet; -import net.minecraft.network.packet.Packet132TileEntityData; +import net.minecraft.network.NetworkManager; +import net.minecraft.network.Packet; +import net.minecraft.network.play.server.S35PacketUpdateTileEntity; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.util.ICommonTile; import appeng.api.util.IOrientable; import appeng.core.AELog; import appeng.tile.events.AETileEventHandler; import appeng.tile.events.TileEventType; +import appeng.util.Platform; import appeng.util.SettingsFrom; public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile @@ -138,7 +138,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile } } - final public void writeToStream(DataOutputStream data) + final public void writeToStream(ByteBuf data) { try { @@ -157,7 +157,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile } } - final public boolean readfromStream(DataInputStream data) + final public boolean readfromStream(ByteBuf data) { boolean output = false; @@ -194,8 +194,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile } /** - * By default all blocks can have orientation, this handles saving, and - * loading, as well as synchronization. + * By default all blocks can have orientation, this handles saving, and loading, as well as synchronization. * * @return */ @@ -223,7 +222,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile forward = inForward; up = inUp; markForUpdate(); - worldObj.notifyBlocksOfNeighborChange( xCoord, yCoord, zCoord, 0 ); + worldObj.notifyBlocksOfNeighborChange( xCoord, yCoord, zCoord, Platform.air ); } public void onPlacement(ItemStack stack, EntityPlayer player, int side) @@ -239,13 +238,12 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile { NBTTagCompound data = new NBTTagCompound(); - ByteArrayOutputStream bytes = new ByteArrayOutputStream(); - DataOutputStream stream = new DataOutputStream( bytes ); + ByteBuf stream = Unpooled.buffer(); try { writeToStream( stream ); - if ( bytes.size() == 0 ) + if ( stream.readableBytes() == 0 ) return null; } catch (Throwable t) @@ -253,16 +251,17 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile AELog.error( t ); } - data.setByteArray( "X", bytes.toByteArray() ); - return new Packet132TileEntityData( xCoord, yCoord, zCoord, 64, data ); + data.setByteArray( "X", stream.array() ); + return new S35PacketUpdateTileEntity( xCoord, yCoord, zCoord, 64, data ); } @Override - public void onDataPacket(INetworkManager net, Packet132TileEntityData pkt) + public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) { - if ( pkt.actionType == 64 ) + // / pkt.actionType + if ( pkt.func_148853_f() == 64 ) { - DataInputStream stream = new DataInputStream( new ByteArrayInputStream( pkt.data.getByteArray( "X" ) ) ); + ByteBuf stream = Unpooled.copiedBuffer( pkt.func_148857_g().getByteArray( "X" ) ); if ( readfromStream( stream ) ) markForUpdate(); } @@ -280,8 +279,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile } /** - * returns the contents of the tile entity, into the world, defaults to - * dropping everything in the inventory. + * returns the contents of the tile entity, into the world, defaults to dropping everything in the inventory. * * @param w * @param x @@ -316,8 +314,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile } /** - * depending on the from, diffrent settings will be accepted, don't call - * this with null + * depending on the from, diffrent settings will be accepted, don't call this with null * * @param from * @param compound @@ -340,13 +337,14 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile public void securityBreak() { - worldObj.destroyBlock( xCoord, yCoord, zCoord, true ); + worldObj.func_147480_a( xCoord, yCoord, zCoord, true ); // worldObj.destroyBlock( xCoord, yCoord, zCoord, true + // ); dropItems = false; } public void saveChanges() { - super.onInventoryChanged(); + super.markDirty(); } public boolean requiresTESR() diff --git a/tile/events/AETileEventHandler.java b/tile/events/AETileEventHandler.java index 83f29365..d5de8bd3 100644 --- a/tile/events/AETileEventHandler.java +++ b/tile/events/AETileEventHandler.java @@ -1,7 +1,7 @@ package appeng.tile.events; -import java.io.DataInputStream; -import java.io.DataOutputStream; +import io.netty.buffer.ByteBuf; + import java.io.IOException; import java.util.EnumSet; @@ -41,7 +41,7 @@ public abstract class AETileEventHandler } // NETWORK - public void writeToStream(DataOutputStream data) throws IOException + public void writeToStream(ByteBuf data) throws IOException { } @@ -54,7 +54,7 @@ public abstract class AETileEventHandler * @throws IOException */ @SideOnly(Side.CLIENT) - public boolean readFromStream(DataInputStream data) throws IOException + public boolean readFromStream(ByteBuf data) throws IOException { return false; } diff --git a/tile/grid/AENetworkInvTile.java b/tile/grid/AENetworkInvTile.java index 42c68bb5..4fa4e22d 100644 --- a/tile/grid/AENetworkInvTile.java +++ b/tile/grid/AENetworkInvTile.java @@ -1,7 +1,7 @@ package appeng.tile.grid; import net.minecraft.nbt.NBTTagCompound; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.networking.IGridNode; import appeng.api.networking.security.IActionHost; import appeng.me.helpers.AENetworkProxy; diff --git a/tile/grid/AENetworkPowerTile.java b/tile/grid/AENetworkPowerTile.java index 4b3ce21a..4275d937 100644 --- a/tile/grid/AENetworkPowerTile.java +++ b/tile/grid/AENetworkPowerTile.java @@ -1,7 +1,7 @@ package appeng.tile.grid; import net.minecraft.nbt.NBTTagCompound; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.networking.IGridNode; import appeng.api.networking.security.IActionHost; import appeng.api.util.AECableType; diff --git a/tile/grid/AENetworkTile.java b/tile/grid/AENetworkTile.java index 25e4ca83..14307c0e 100644 --- a/tile/grid/AENetworkTile.java +++ b/tile/grid/AENetworkTile.java @@ -1,7 +1,7 @@ package appeng.tile.grid; import net.minecraft.nbt.NBTTagCompound; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.networking.IGridNode; import appeng.api.networking.security.IActionHost; import appeng.api.util.AECableType; diff --git a/tile/grindstone/TileCrank.java b/tile/grindstone/TileCrank.java index 22800dc6..5b96b834 100644 --- a/tile/grindstone/TileCrank.java +++ b/tile/grindstone/TileCrank.java @@ -1,5 +1,7 @@ package appeng.tile.grindstone; +import io.netty.buffer.ByteBuf; + import java.util.Arrays; import java.util.List; @@ -7,7 +9,7 @@ import net.minecraft.entity.Entity; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; import net.minecraft.world.World; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.implementations.tiles.ICrankable; import appeng.helpers.ICustomCollision; import appeng.tile.AEBaseTile; @@ -50,14 +52,14 @@ public class TileCrank extends AEBaseTile implements ICustomCollision } @Override - public boolean readFromStream(java.io.DataInputStream data) throws java.io.IOException + public boolean readFromStream(ByteBuf data) throws java.io.IOException { rotation = data.readInt(); return false; } @Override - public void writeToStream(java.io.DataOutputStream data) throws java.io.IOException + public void writeToStream(ByteBuf data) throws java.io.IOException { data.writeInt( rotation ); } @@ -71,7 +73,7 @@ public class TileCrank extends AEBaseTile implements ICustomCollision return null; ForgeDirection grinder = getUp().getOpposite(); - TileEntity te = worldObj.getBlockTileEntity( xCoord + grinder.offsetX, yCoord + grinder.offsetY, zCoord + grinder.offsetZ ); + TileEntity te = worldObj.getTileEntity( xCoord + grinder.offsetX, yCoord + grinder.offsetY, zCoord + grinder.offsetZ ); if ( te instanceof ICrankable ) return (ICrankable) te; return null; @@ -81,7 +83,7 @@ public class TileCrank extends AEBaseTile implements ICustomCollision public void setOrientation(ForgeDirection inForward, ForgeDirection inUp) { super.setOrientation( inForward, inUp ); - getBlockType().onNeighborBlockChange( worldObj, xCoord, yCoord, zCoord, 0 ); + getBlockType().onNeighborBlockChange( worldObj, xCoord, yCoord, zCoord, Platform.air ); } public void power() @@ -104,7 +106,10 @@ public class TileCrank extends AEBaseTile implements ICustomCollision { hits++; if ( hits > 10 ) - worldObj.destroyBlock( xCoord, yCoord, zCoord, false ); + { + worldObj.func_147480_a( xCoord, yCoord, zCoord, false ); + // worldObj.destroyBlock( xCoord, yCoord, zCoord, false ); + } } } } diff --git a/tile/grindstone/TileGrinder.java b/tile/grindstone/TileGrinder.java index 765e1b77..0a26b7de 100644 --- a/tile/grindstone/TileGrinder.java +++ b/tile/grindstone/TileGrinder.java @@ -5,7 +5,7 @@ import java.util.List; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.AEApi; import appeng.api.config.Actionable; import appeng.api.features.IGrinderEntry; @@ -35,7 +35,7 @@ public class TileGrinder extends AEBaseInvTile implements ICrankable public void setOrientation(ForgeDirection inForward, ForgeDirection inUp) { super.setOrientation( inForward, inUp ); - getBlockType().onNeighborBlockChange( worldObj, xCoord, yCoord, zCoord, 0 ); + getBlockType().onNeighborBlockChange( worldObj, xCoord, yCoord, zCoord, Platform.air ); } private void addItem(InventoryAdaptor sia, ItemStack output) diff --git a/tile/inventory/AppEngInternalAEInventory.java b/tile/inventory/AppEngInternalAEInventory.java index 42a3da61..337025e0 100644 --- a/tile/inventory/AppEngInternalAEInventory.java +++ b/tile/inventory/AppEngInternalAEInventory.java @@ -126,11 +126,11 @@ public class AppEngInternalAEInventory implements IInventory, Iterable te.onChangeInventory( this, slot, InvOperation.decrStackSize, ns, null ); } - onInventoryChanged(); + markDirty(); return ns; } @@ -125,25 +125,25 @@ public class AppEngInternalInventory implements IInventory, Iterable te.onChangeInventory( this, slot, InvOperation.setInventorySlotContents, removed, added ); - onInventoryChanged(); + markDirty(); } } @Override - public void onInventoryChanged() + public void markDirty() { if ( te != null && eventsEnabled() ) { - te.onChangeInventory( this, -1, InvOperation.onInventoryChanged, null, null ); + te.onChangeInventory( this, -1, InvOperation.markDirty, null, null ); } } // for guis... - public void onInventoryChanged(int slotIndex) + public void markDirty(int slotIndex) { if ( te != null && eventsEnabled() ) { - te.onChangeInventory( this, slotIndex, InvOperation.onInventoryChanged, null, null ); + te.onChangeInventory( this, slotIndex, InvOperation.markDirty, null, null ); } } @@ -160,12 +160,12 @@ public class AppEngInternalInventory implements IInventory, Iterable } @Override - public void openChest() + public void closeInventory() { } @Override - public void closeChest() + public void openInventory() { } @@ -182,7 +182,7 @@ public class AppEngInternalInventory implements IInventory, Iterable inv[x].writeToNBT( c ); } - target.setCompoundTag( "#" + x, c ); + target.setTag( "#" + x, c ); } catch (Exception err) { @@ -213,7 +213,7 @@ public class AppEngInternalInventory implements IInventory, Iterable { NBTTagCompound c = new NBTTagCompound(); writeToNBT( c ); - data.setCompoundTag( name, c ); + data.setTag( name, c ); } public void readFromNBT(NBTTagCompound data, String name) @@ -230,13 +230,13 @@ public class AppEngInternalInventory implements IInventory, Iterable } @Override - public String getInvName() + public String getInventoryName() { return "appeng-internal"; } @Override - public boolean isInvNameLocalized() + public boolean hasCustomInventoryName() { return false; } diff --git a/tile/inventory/AppEngNullInventory.java b/tile/inventory/AppEngNullInventory.java index 1606cbcb..8a4e539e 100644 --- a/tile/inventory/AppEngNullInventory.java +++ b/tile/inventory/AppEngNullInventory.java @@ -36,7 +36,7 @@ public class AppEngNullInventory implements IInventory } @Override - public void onInventoryChanged() + public void markDirty() { } @@ -54,12 +54,12 @@ public class AppEngNullInventory implements IInventory } @Override - public void openChest() + public void openInventory() { } @Override - public void closeChest() + public void closeInventory() { } @@ -74,13 +74,13 @@ public class AppEngNullInventory implements IInventory } @Override - public String getInvName() + public String getInventoryName() { return "appeng-internal"; } @Override - public boolean isInvNameLocalized() + public boolean hasCustomInventoryName() { return false; } diff --git a/tile/inventory/InvOperation.java b/tile/inventory/InvOperation.java index 731a0fea..1b827e13 100644 --- a/tile/inventory/InvOperation.java +++ b/tile/inventory/InvOperation.java @@ -2,6 +2,6 @@ package appeng.tile.inventory; public enum InvOperation { - decrStackSize, setInventorySlotContents, onInventoryChanged + decrStackSize, setInventorySlotContents, markDirty } diff --git a/tile/misc/TileCellWorkbench.java b/tile/misc/TileCellWorkbench.java index 9ddc2641..43f384bb 100644 --- a/tile/misc/TileCellWorkbench.java +++ b/tile/misc/TileCellWorkbench.java @@ -146,7 +146,7 @@ public class TileCellWorkbench extends AEBaseTile implements IUpgradeableHost, I { for (int x = 0; x < config.getSizeInventory(); x++) c.setInventorySlotContents( x, config.getStackInSlot( x ) ); - c.onInventoryChanged(); + c.markDirty(); } } @@ -160,7 +160,7 @@ public class TileCellWorkbench extends AEBaseTile implements IUpgradeableHost, I { for (int x = 0; x < config.getSizeInventory(); x++) c.setInventorySlotContents( x, config.getStackInSlot( x ) ); - c.onInventoryChanged(); + c.markDirty(); } } } diff --git a/tile/misc/TileCharger.java b/tile/misc/TileCharger.java index bfcb7d37..509496cb 100644 --- a/tile/misc/TileCharger.java +++ b/tile/misc/TileCharger.java @@ -1,7 +1,7 @@ package appeng.tile.misc; -import java.io.DataInputStream; -import java.io.DataOutputStream; +import io.netty.buffer.ByteBuf; + import java.io.IOException; import java.util.ArrayList; import java.util.EnumSet; @@ -10,7 +10,7 @@ import java.util.List; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.AEApi; import appeng.api.config.Actionable; import appeng.api.config.PowerMultiplier; @@ -54,7 +54,7 @@ public class TileCharger extends AENetworkPowerTile implements ICrankable } @Override - public boolean readFromStream(DataInputStream data) throws IOException + public boolean readFromStream(ByteBuf data) throws IOException { try { @@ -70,7 +70,7 @@ public class TileCharger extends AENetworkPowerTile implements ICrankable } @Override - public void writeToStream(DataOutputStream data) throws IOException + public void writeToStream(ByteBuf data) throws IOException { AEItemStack is = AEItemStack.create( getStackInSlot( 0 ) ); if ( is != null ) diff --git a/tile/misc/TileCondenser.java b/tile/misc/TileCondenser.java index b461f5af..bc3fe7a4 100644 --- a/tile/misc/TileCondenser.java +++ b/tile/misc/TileCondenser.java @@ -3,7 +3,7 @@ package appeng.tile.misc; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidTankInfo; diff --git a/tile/misc/TileInscriber.java b/tile/misc/TileInscriber.java index 4dc073b4..bcc7705c 100644 --- a/tile/misc/TileInscriber.java +++ b/tile/misc/TileInscriber.java @@ -1,14 +1,14 @@ package appeng.tile.misc; -import java.io.DataInputStream; -import java.io.DataOutputStream; +import io.netty.buffer.ByteBuf; + import java.io.IOException; import java.util.EnumSet; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.util.AECableType; import appeng.tile.events.AETileEventHandler; import appeng.tile.events.TileEventType; @@ -37,14 +37,14 @@ public class TileInscriber extends AENetworkPowerTile } @Override - public boolean readFromStream(DataInputStream data) throws IOException + public boolean readFromStream(ByteBuf data) throws IOException { return false; } @Override - public void writeToStream(DataOutputStream data) throws IOException + public void writeToStream(ByteBuf data) throws IOException { } diff --git a/tile/misc/TileInterface.java b/tile/misc/TileInterface.java index 32966f25..3ce924b5 100644 --- a/tile/misc/TileInterface.java +++ b/tile/misc/TileInterface.java @@ -4,7 +4,7 @@ import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.implementations.tiles.ISegmentedInventory; import appeng.api.implementations.tiles.ITileStorageMonitorable; import appeng.api.networking.IGridNode; @@ -125,9 +125,9 @@ public class TileInterface extends AENetworkInvTile implements IGridTickable, IS } @Override - public void onInventoryChanged() + public void markDirty() { - duality.onInventoryChanged(); + duality.markDirty(); } @Override diff --git a/tile/misc/TileNetworkEmitter.java b/tile/misc/TileNetworkEmitter.java index 89f27c40..bd3de372 100644 --- a/tile/misc/TileNetworkEmitter.java +++ b/tile/misc/TileNetworkEmitter.java @@ -3,7 +3,7 @@ package appeng.tile.misc; import java.util.EnumSet; import net.minecraft.entity.player.EntityPlayer; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.tile.grid.AENetworkTile; public class TileNetworkEmitter extends AENetworkTile diff --git a/tile/misc/TileQuartzCrystalizer.java b/tile/misc/TileQuartzCrystalizer.java index c295463f..0074cb13 100644 --- a/tile/misc/TileQuartzCrystalizer.java +++ b/tile/misc/TileQuartzCrystalizer.java @@ -5,7 +5,7 @@ import java.util.EnumSet; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.util.AECableType; import appeng.tile.grid.AENetworkPowerTile; import appeng.tile.inventory.AppEngInternalInventory; diff --git a/tile/misc/TileSecurity.java b/tile/misc/TileSecurity.java index 63b18906..552e74d4 100644 --- a/tile/misc/TileSecurity.java +++ b/tile/misc/TileSecurity.java @@ -1,7 +1,7 @@ package appeng.tile.misc; -import java.io.DataInputStream; -import java.io.DataOutputStream; +import io.netty.buffer.ByteBuf; + import java.io.IOException; import java.util.ArrayList; import java.util.EnumSet; @@ -10,10 +10,11 @@ import java.util.HashMap; import net.minecraft.inventory.IInventory; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTBase; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.World; -import net.minecraftforge.common.ForgeDirection; import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.AEApi; import appeng.api.config.SecurityPermissions; import appeng.api.events.LocatableEventAnnounce; @@ -115,7 +116,7 @@ public class TileSecurity extends AENetworkTile implements IStorageMonitorable, } @Override - public boolean readFromStream(DataInputStream data) throws IOException + public boolean readFromStream(ByteBuf data) throws IOException { boolean wasActive = isActive; isActive = data.readBoolean(); @@ -124,7 +125,7 @@ public class TileSecurity extends AENetworkTile implements IStorageMonitorable, } @Override - public void writeToStream(DataOutputStream data) throws IOException + public void writeToStream(ByteBuf data) throws IOException { data.writeBoolean( gridProxy.isActive() ); } @@ -142,10 +143,10 @@ public class TileSecurity extends AENetworkTile implements IStorageMonitorable, { NBTTagCompound it = new NBTTagCompound(); ais.getItemStack().writeToNBT( it ); - storedItems.setCompoundTag( "" + (offset++), it ); + storedItems.setTag( "" + (offset++), it ); } - data.setCompoundTag( "storedItems", storedItems ); + data.setTag( "storedItems", storedItems ); } @Override @@ -155,8 +156,9 @@ public class TileSecurity extends AENetworkTile implements IStorageMonitorable, configSlot.readFromNBT( data, "config" ); NBTTagCompound storedItems = data.getCompoundTag( "storedItems" ); - for (Object obj : storedItems.getTags()) + for (Object key : storedItems.func_150296_c()) { + NBTBase obj = storedItems.getTag( (String) key ); if ( obj instanceof NBTTagCompound ) { inventory.storedItems.add( AEItemStack.create( ItemStack.loadItemStackFromNBT( (NBTTagCompound) obj ) ) ); diff --git a/tile/misc/TileVibrationChamber.java b/tile/misc/TileVibrationChamber.java index 377fb5fa..603a4d38 100644 --- a/tile/misc/TileVibrationChamber.java +++ b/tile/misc/TileVibrationChamber.java @@ -1,14 +1,14 @@ package appeng.tile.misc; -import java.io.DataInputStream; -import java.io.DataOutputStream; +import io.netty.buffer.ByteBuf; + import java.io.IOException; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntityFurnace; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.config.Actionable; import appeng.api.networking.GridFlags; import appeng.api.networking.IGridNode; @@ -54,7 +54,7 @@ public class TileVibrationChamber extends AENetworkInvTile implements IGridTicka } @Override - public boolean readFromStream(DataInputStream data) throws IOException + public boolean readFromStream(ByteBuf data) throws IOException { boolean wasOn = isOn; isOn = data.readBoolean(); @@ -62,7 +62,7 @@ public class TileVibrationChamber extends AENetworkInvTile implements IGridTicka } @Override - public void writeToStream(DataOutputStream data) throws IOException + public void writeToStream(ByteBuf data) throws IOException { data.writeBoolean( burnTime > 0 ); } diff --git a/tile/networking/TileCableBus.java b/tile/networking/TileCableBus.java index 05c886f4..3e3b1809 100644 --- a/tile/networking/TileCableBus.java +++ b/tile/networking/TileCableBus.java @@ -1,7 +1,7 @@ package appeng.tile.networking; -import java.io.DataInputStream; -import java.io.DataOutputStream; +import io.netty.buffer.ByteBuf; + import java.io.IOException; import java.util.ArrayList; import java.util.EnumSet; @@ -15,7 +15,7 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.Vec3; import net.minecraft.world.World; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import powercrystals.minefactoryreloaded.api.rednet.RedNetConnectionType; import appeng.api.networking.IGridNode; import appeng.api.parts.IFacadeContainer; @@ -59,7 +59,7 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl } @Override - public boolean readFromStream(DataInputStream data) throws IOException + public boolean readFromStream(ByteBuf data) throws IOException { boolean ret = cb.readFromStream( data ); @@ -67,14 +67,15 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl if ( newLV != oldLV ) { oldLV = newLV; - worldObj.updateAllLightTypes( xCoord, yCoord, zCoord ); + worldObj.func_147451_t( xCoord, yCoord, zCoord ); + // worldObj.updateAllLightTypes( xCoord, yCoord, zCoord ); } return ret; } @Override - public void writeToStream(DataOutputStream data) throws IOException + public void writeToStream(ByteBuf data) throws IOException { cb.writeToStream( data ); } @@ -87,8 +88,11 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl super.onReady(); if ( cb.isEmpty() ) { - if ( worldObj.getBlockTileEntity( xCoord, yCoord, zCoord ) == this ) - worldObj.destroyBlock( xCoord, yCoord, zCoord, true ); + if ( worldObj.getTileEntity( xCoord, yCoord, zCoord ) == this ) + { + worldObj.func_147480_a( xCoord, yCoord, zCoord, true ); + // worldObj.destroyBlock( xCoord, yCoord, zCoord, true ); + } } else cb.addToWorld(); @@ -226,7 +230,8 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl if ( newLV != oldLV ) { oldLV = newLV; - worldObj.updateAllLightTypes( xCoord, yCoord, zCoord ); + worldObj.func_147451_t( xCoord, yCoord, zCoord ); + // worldObj.updateAllLightTypes( xCoord, yCoord, zCoord ); } super.markForUpdate(); @@ -247,7 +252,7 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl @Override public void markForSave() { - onInventoryChanged(); + markDirty(); } @Override diff --git a/tile/networking/TileController.java b/tile/networking/TileController.java index 2408930e..f76eab85 100644 --- a/tile/networking/TileController.java +++ b/tile/networking/TileController.java @@ -4,7 +4,7 @@ import java.util.EnumSet; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.config.Actionable; import appeng.api.networking.GridFlags; import appeng.api.networking.energy.IAEPowerStorage; @@ -103,12 +103,12 @@ public class TileController extends AENetworkPowerTile implements IAEPowerStorag public void onNeighborChange(boolean force) { - boolean xx = worldObj.getBlockTileEntity( xCoord - 1, yCoord, zCoord ) instanceof TileController - && worldObj.getBlockTileEntity( xCoord + 1, yCoord, zCoord ) instanceof TileController; - boolean yy = worldObj.getBlockTileEntity( xCoord, yCoord - 1, zCoord ) instanceof TileController - && worldObj.getBlockTileEntity( xCoord, yCoord + 1, zCoord ) instanceof TileController; - boolean zz = worldObj.getBlockTileEntity( xCoord, yCoord, zCoord - 1 ) instanceof TileController - && worldObj.getBlockTileEntity( xCoord, yCoord, zCoord + 1 ) instanceof TileController; + boolean xx = worldObj.getTileEntity( xCoord - 1, yCoord, zCoord ) instanceof TileController + && worldObj.getTileEntity( xCoord + 1, yCoord, zCoord ) instanceof TileController; + boolean yy = worldObj.getTileEntity( xCoord, yCoord - 1, zCoord ) instanceof TileController + && worldObj.getTileEntity( xCoord, yCoord + 1, zCoord ) instanceof TileController; + boolean zz = worldObj.getTileEntity( xCoord, yCoord, zCoord - 1 ) instanceof TileController + && worldObj.getTileEntity( xCoord, yCoord, zCoord + 1 ) instanceof TileController; // int meta = world.getBlockMetadata( xCoord, yCoord, zCoord ); // boolean hasPower = meta > 0; diff --git a/tile/networking/TileCreativeEnergyCell.java b/tile/networking/TileCreativeEnergyCell.java index a06f01c4..3ec16af4 100644 --- a/tile/networking/TileCreativeEnergyCell.java +++ b/tile/networking/TileCreativeEnergyCell.java @@ -1,6 +1,6 @@ package appeng.tile.networking; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.config.AccessRestriction; import appeng.api.config.Actionable; import appeng.api.config.PowerMultiplier; diff --git a/tile/networking/TileEnergyAcceptor.java b/tile/networking/TileEnergyAcceptor.java index 1684cc4a..116a2da7 100644 --- a/tile/networking/TileEnergyAcceptor.java +++ b/tile/networking/TileEnergyAcceptor.java @@ -2,7 +2,7 @@ package appeng.tile.networking; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.config.Actionable; import appeng.api.config.PowerMultiplier; import appeng.api.networking.energy.IEnergyGrid; diff --git a/tile/networking/TileEnergyCell.java b/tile/networking/TileEnergyCell.java index 2b349b7d..961bbd37 100644 --- a/tile/networking/TileEnergyCell.java +++ b/tile/networking/TileEnergyCell.java @@ -1,7 +1,7 @@ package appeng.tile.networking; import net.minecraft.nbt.NBTTagCompound; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.config.AccessRestriction; import appeng.api.config.Actionable; import appeng.api.config.PowerMultiplier; diff --git a/tile/networking/TileWireless.java b/tile/networking/TileWireless.java index 76586adb..6ee0b652 100644 --- a/tile/networking/TileWireless.java +++ b/tile/networking/TileWireless.java @@ -1,13 +1,13 @@ package appeng.tile.networking; -import java.io.DataInputStream; -import java.io.DataOutputStream; +import io.netty.buffer.ByteBuf; + import java.io.IOException; import java.util.EnumSet; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.networking.GridFlags; import appeng.api.networking.events.MENetworkChannelsChanged; import appeng.api.networking.events.MENetworkEventSubscribe; @@ -66,7 +66,7 @@ public class TileWireless extends AENetworkInvTile } @Override - public boolean readFromStream(DataInputStream data) throws IOException + public boolean readFromStream(ByteBuf data) throws IOException { boolean eh = super.readFromStream( data ); @@ -77,7 +77,7 @@ public class TileWireless extends AENetworkInvTile } @Override - public void writeToStream(DataOutputStream data) throws IOException + public void writeToStream(ByteBuf data) throws IOException { clientFlags = 0; @@ -125,7 +125,7 @@ public class TileWireless extends AENetworkInvTile } @Override - public void onInventoryChanged() + public void markDirty() { updatePower(); } diff --git a/tile/powersink/AERootPoweredTile.java b/tile/powersink/AERootPoweredTile.java index d26505f7..28386230 100644 --- a/tile/powersink/AERootPoweredTile.java +++ b/tile/powersink/AERootPoweredTile.java @@ -3,7 +3,7 @@ package appeng.tile.powersink; import java.util.EnumSet; import net.minecraft.nbt.NBTTagCompound; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.config.AccessRestriction; import appeng.api.config.Actionable; import appeng.api.config.PowerMultiplier; diff --git a/tile/powersink/BuildCraft.java b/tile/powersink/BuildCraft.java index b17e851d..5daff700 100644 --- a/tile/powersink/BuildCraft.java +++ b/tile/powersink/BuildCraft.java @@ -1,11 +1,11 @@ package appeng.tile.powersink; import net.minecraft.world.World; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.config.PowerUnits; import appeng.core.AppEng; import appeng.integration.abstraction.IMJ; -import appeng.integration.modules.helpers.BaseBCperdition; +import appeng.integration.abstraction.helpers.BaseBCperdition; import appeng.util.Platform; import buildcraft.api.power.IPowerReceptor; import buildcraft.api.power.PowerHandler; diff --git a/tile/powersink/IC2.java b/tile/powersink/IC2.java index 8ae9e9a2..a1cce02d 100644 --- a/tile/powersink/IC2.java +++ b/tile/powersink/IC2.java @@ -5,7 +5,7 @@ import ic2.api.energy.tile.IEnergySink; import java.util.EnumSet; import net.minecraft.tileentity.TileEntity; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.config.PowerUnits; import appeng.core.AppEng; import appeng.integration.abstraction.IIC2; diff --git a/tile/powersink/RotaryCraft.java b/tile/powersink/RotaryCraft.java index 04e4fc77..29f15cec 100644 --- a/tile/powersink/RotaryCraft.java +++ b/tile/powersink/RotaryCraft.java @@ -1,6 +1,6 @@ package appeng.tile.powersink; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import Reika.RotaryCraft.API.ShaftPowerReceiver; import appeng.api.config.PowerUnits; import appeng.tile.events.AETileEventHandler; diff --git a/tile/powersink/ThermalExpansion.java b/tile/powersink/ThermalExpansion.java index 4d63e11c..4271734e 100644 --- a/tile/powersink/ThermalExpansion.java +++ b/tile/powersink/ThermalExpansion.java @@ -1,6 +1,6 @@ package appeng.tile.powersink; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.config.PowerUnits; import cofh.api.energy.IEnergyHandler; import cpw.mods.fml.common.Optional.Interface; diff --git a/tile/powersink/UniversalElectricity.java b/tile/powersink/UniversalElectricity.java index a17efbe2..b96f7b60 100644 --- a/tile/powersink/UniversalElectricity.java +++ b/tile/powersink/UniversalElectricity.java @@ -1,7 +1,7 @@ package appeng.tile.powersink; /* -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import universalelectricity.core.block.IElectrical; import universalelectricity.core.electricity.ElectricityPack; import appeng.api.config.PowerUnits; diff --git a/tile/qnb/TileQuantumBridge.java b/tile/qnb/TileQuantumBridge.java index 2096600e..599c5e81 100644 --- a/tile/qnb/TileQuantumBridge.java +++ b/tile/qnb/TileQuantumBridge.java @@ -1,7 +1,7 @@ package appeng.tile.qnb; -import java.io.DataInputStream; -import java.io.DataOutputStream; +import io.netty.buffer.ByteBuf; + import java.io.IOException; import java.util.EnumSet; @@ -9,7 +9,7 @@ import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.AEApi; import appeng.api.networking.GridFlags; import appeng.api.networking.events.MENetworkEventSubscribe; @@ -72,7 +72,7 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock } @Override - public void writeToStream(DataOutputStream data) throws IOException + public void writeToStream(ByteBuf data) throws IOException { int out = xdex; @@ -86,7 +86,7 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock } @Override - public boolean readFromStream(DataInputStream data) throws IOException + public boolean readFromStream(ByteBuf data) throws IOException { int oldValue = xdex; xdex = data.readByte(); @@ -233,7 +233,7 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock for (ForgeDirection d : ForgeDirection.VALID_DIRECTIONS) { - TileEntity te = worldObj.getBlockTileEntity( xCoord + d.offsetX, yCoord + d.offsetY, zCoord + d.offsetZ ); + TileEntity te = worldObj.getTileEntity( xCoord + d.offsetX, yCoord + d.offsetY, zCoord + d.offsetZ ); if ( te instanceof TileQuantumBridge ) set.add( d ); } diff --git a/tile/spatial/TileSpatialIOPort.java b/tile/spatial/TileSpatialIOPort.java index 45e0e0ba..3f4157a9 100644 --- a/tile/spatial/TileSpatialIOPort.java +++ b/tile/spatial/TileSpatialIOPort.java @@ -2,7 +2,7 @@ package appeng.tile.spatial; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.util.AECableType; import appeng.api.util.DimensionalCoord; import appeng.tile.grid.AENetworkInvTile; diff --git a/tile/spatial/TileSpatialPylon.java b/tile/spatial/TileSpatialPylon.java index 9f4789dd..eb39b644 100644 --- a/tile/spatial/TileSpatialPylon.java +++ b/tile/spatial/TileSpatialPylon.java @@ -1,11 +1,11 @@ package appeng.tile.spatial; -import java.io.DataInputStream; -import java.io.DataOutputStream; +import io.netty.buffer.ByteBuf; + import java.io.IOException; import java.util.EnumSet; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.networking.GridFlags; import appeng.api.networking.events.MENetworkChannelsChanged; import appeng.api.networking.events.MENetworkEventSubscribe; @@ -61,7 +61,7 @@ public class TileSpatialPylon extends AENetworkTile implements IAEMultiBlock } @Override - public boolean readFromStream(DataInputStream data) throws IOException + public boolean readFromStream(ByteBuf data) throws IOException { int old = displayBits; displayBits = data.readByte(); @@ -69,7 +69,7 @@ public class TileSpatialPylon extends AENetworkTile implements IAEMultiBlock } @Override - public void writeToStream(DataOutputStream data) throws IOException + public void writeToStream(ByteBuf data) throws IOException { data.writeByte( displayBits ); } @@ -98,7 +98,8 @@ public class TileSpatialPylon extends AENetworkTile implements IAEMultiBlock if ( hasLight != didHaveLight ) { didHaveLight = hasLight; - worldObj.updateAllLightTypes( xCoord, yCoord, zCoord ); + worldObj.func_147451_t( xCoord, yCoord, zCoord ); + // worldObj.updateAllLightTypes( xCoord, yCoord, zCoord ); } } diff --git a/tile/storage/TileChest.java b/tile/storage/TileChest.java index a0f654c0..d3fcde5d 100644 --- a/tile/storage/TileChest.java +++ b/tile/storage/TileChest.java @@ -1,16 +1,17 @@ package appeng.tile.storage; -import java.io.DataInputStream; -import java.io.DataOutputStream; +import io.netty.buffer.ByteBuf; + import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import net.minecraft.inventory.IInventory; +import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidTankInfo; @@ -158,7 +159,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan } @Override - public void writeToStream(DataOutputStream data) throws IOException + public void writeToStream(ByteBuf data) throws IOException { if ( worldObj.getTotalWorldTime() - lastStateChange > 8 ) state = 0; @@ -182,12 +183,12 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan } else { - data.writeInt( (is.getItemDamage() << Platform.DEF_OFFSET) | is.itemID ); + data.writeInt( (is.getItemDamage() << Platform.DEF_OFFSET) | Item.getIdFromItem( is.getItem() ) ); } } @Override - public boolean readFromStream(DataInputStream data) throws IOException + public boolean readFromStream(ByteBuf data) throws IOException { int oldState = state; ItemStack oldType = storageType; @@ -199,7 +200,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan if ( item == 0 ) storageType = null; else - storageType = new ItemStack( item & 0xffff, 1, item >> Platform.DEF_OFFSET ); + storageType = new ItemStack( Item.getItemById( item & 0xffff ), 1, item >> Platform.DEF_OFFSET ); lastStateChange = worldObj.getTotalWorldTime(); @@ -402,7 +403,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan // update the neighbors if ( worldObj != null ) { - worldObj.notifyBlocksOfNeighborChange( xCoord, yCoord, zCoord, 0 ); + worldObj.notifyBlocksOfNeighborChange( xCoord, yCoord, zCoord, Platform.air ); markForUpdate(); } } diff --git a/tile/storage/TileDrive.java b/tile/storage/TileDrive.java index 17bfb028..ef66213a 100644 --- a/tile/storage/TileDrive.java +++ b/tile/storage/TileDrive.java @@ -1,7 +1,7 @@ package appeng.tile.storage; -import java.io.DataInputStream; -import java.io.DataOutputStream; +import io.netty.buffer.ByteBuf; + import java.io.IOException; import java.util.ArrayList; import java.util.LinkedList; @@ -10,7 +10,7 @@ import java.util.List; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.AEApi; import appeng.api.implementations.tiles.IChestOrDrive; import appeng.api.networking.GridFlags; @@ -94,7 +94,7 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior } @Override - public void writeToStream(DataOutputStream data) throws IOException + public void writeToStream(ByteBuf data) throws IOException { if ( worldObj.getTotalWorldTime() - lastStateChange > 8 ) state = 0; @@ -113,7 +113,7 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior } @Override - public boolean readFromStream(DataInputStream data) throws IOException + public boolean readFromStream(ByteBuf data) throws IOException { int oldState = state; state = data.readInt(); @@ -340,7 +340,7 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior public void setPriority(int newValue) { priority = newValue; - onInventoryChanged(); + markDirty(); isCached = false; // recalculate the storage cell. updateState(); diff --git a/tile/storage/TileIOPort.java b/tile/storage/TileIOPort.java index 5785d4e5..a33fcaae 100644 --- a/tile/storage/TileIOPort.java +++ b/tile/storage/TileIOPort.java @@ -3,7 +3,7 @@ package appeng.tile.storage; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.AEApi; import appeng.api.config.Actionable; import appeng.api.config.FullnessMode; diff --git a/util/InWorldToolOperationResult.java b/util/InWorldToolOperationResult.java index 9f0c7599..0f67edbc 100644 --- a/util/InWorldToolOperationResult.java +++ b/util/InWorldToolOperationResult.java @@ -21,15 +21,12 @@ public class InWorldToolOperationResult { if ( b == null ) { - if ( Block.blocksList.length > l.itemID ) - { - Block bl = Block.blocksList[l.itemID]; + Block bl = Block.getBlockFromItem( l.getItem() ); - if ( bl.blockID > 0 ) - { - b = l; - continue; - } + if ( bl != null ) + { + b = l; + continue; } } diff --git a/util/InventoryAdaptor.java b/util/InventoryAdaptor.java index 7a4cbedc..8b3c496b 100644 --- a/util/InventoryAdaptor.java +++ b/util/InventoryAdaptor.java @@ -7,9 +7,8 @@ import net.minecraft.inventory.IInventory; import net.minecraft.inventory.ISidedInventory; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntityChest; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.config.FuzzyMode; -import appeng.integration.modules.BS; import appeng.util.inv.AdaptorIInventory; import appeng.util.inv.AdaptorISpecialInventory; import appeng.util.inv.AdaptorList; @@ -18,7 +17,6 @@ import appeng.util.inv.IInventoryDestination; import appeng.util.inv.ItemSlot; import appeng.util.inv.WrapperMCISidedInventory; import buildcraft.api.inventory.ISpecialInventory; -import cpw.mods.fml.common.network.Player; public abstract class InventoryAdaptor implements Iterable { @@ -46,18 +44,17 @@ public abstract class InventoryAdaptor implements Iterable if ( te == null ) return null; - if ( te instanceof Player ) + if ( te instanceof EntityPlayer ) { return new AdaptorIInventory( new AdaptorPlayerInventory( ((EntityPlayer) te).inventory ) ); } else if ( te instanceof ArrayList ) { return new AdaptorList( (ArrayList) te ); - } - else if ( BS.instance != null && BS.instance.isStorageCrate( te ) ) - { - return BS.instance.getAdaptor( te, d ); - } + }/* + * else if ( BS.instance != null && BS.instance.isStorageCrate( te ) ) { return BS.instance.getAdaptor( te, d ); + * } + */ else if ( te instanceof TileEntityChest ) { return new AdaptorIInventory( (IInventory) Platform.GetChestInv( te ) ); diff --git a/util/ItemSorters.java b/util/ItemSorters.java index 4a953cbc..0c3852ce 100644 --- a/util/ItemSorters.java +++ b/util/ItemSorters.java @@ -39,37 +39,6 @@ public class ItemSorters } }; - public static Comparator ConfigBased_SortByID = new Comparator() { - - @Override - public int compare(IAEItemStack o1, IAEItemStack o2) - { - if ( Direction == SortDir.ASCENDING ) - { - int comp = compareInt( o1.getItem().itemID, o2.getItem().itemID ); - if ( comp == 0 ) - comp = compareInt( o1.getItemDamage(), o2.getItemDamage() ); - return comp; - } - - int comp = -compareInt( o1.getItem().itemID, o2.getItem().itemID ); - if ( comp == 0 ) - comp = -compareInt( o1.getItemDamage(), o2.getItemDamage() ); - return comp; - } - }; - - public static Comparator ConfigBased_SortByMod = new Comparator() { - - @Override - public int compare(IAEItemStack o1, IAEItemStack o2) - { - if ( Direction == SortDir.ASCENDING ) - return Platform.getMod( o1.getItemStack() ).compareTo( Platform.getMod( o2.getItemStack() ) ); - return Platform.getMod( o2.getItemStack() ).compareTo( Platform.getMod( o1.getItemStack() ) ); - } - }; - public static Comparator ConfigBased_SortBySize = new Comparator() { @Override diff --git a/util/Platform.java b/util/Platform.java index 676e0221..87d76b00 100644 --- a/util/Platform.java +++ b/util/Platform.java @@ -4,19 +4,20 @@ import java.lang.reflect.Field; import java.util.ArrayList; import java.util.Collection; import java.util.EnumSet; -import java.util.HashMap; import java.util.Iterator; import java.util.List; -import java.util.Map; import java.util.Random; +import java.util.Set; import java.util.WeakHashMap; import net.minecraft.block.Block; import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.Tessellator; import net.minecraft.entity.Entity; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.init.Blocks; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.ISidedInventory; import net.minecraft.inventory.InventoryCrafting; @@ -43,8 +44,9 @@ import net.minecraft.util.StatCollector; import net.minecraft.util.Vec3; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import net.minecraftforge.common.FakePlayer; -import net.minecraftforge.common.ForgeDirection; +import net.minecraft.world.WorldServer; +import net.minecraftforge.common.util.FakePlayerFactory; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.AEApi; import appeng.api.config.AccessRestriction; import appeng.api.config.Actionable; @@ -69,6 +71,7 @@ import appeng.api.storage.data.IAEStack; import appeng.api.storage.data.IAETagCompound; import appeng.api.storage.data.IItemList; import appeng.api.util.AEItemDefinition; +import appeng.core.AELog; import appeng.core.AppEng; import appeng.core.sync.GuiBridge; import appeng.me.GridNode; @@ -78,19 +81,19 @@ import appeng.util.item.AESharedNBT; import appeng.util.item.ItemList; import buildcraft.api.tools.IToolWrench; -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.ImmutableTable; +import com.mojang.authlib.GameProfile; import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.ModContainer; -import cpw.mods.fml.common.registry.GameData; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; public class Platform { + public static Block air = Blocks.air; + public static final int DEF_OFFSET = 16; /* @@ -108,107 +111,6 @@ public class Platform return rdnSrc.nextFloat(); } - private static HashMap modIDToName; - private static HashMap itemTomodID; - private static HashMap itemNames; - - public static String getBlockName(Block id) - { - populateModInfo(); - - String out = itemNames.get( id.blockID ); - - if ( out == null ) - return "Unknown"; - - return out; - } - - public static String getItemName(Item id) - { - populateModInfo(); - - String out = itemNames.get( id.itemID ); - - if ( out == null ) - return "Unknown"; - - return out; - } - - public static String getMod(String modID) - { - String out = modIDToName.get( modID ); - - if ( out == null ) - { - out = modID; - } - - return out; - } - - public static String getMod(ItemStack is) - { - populateModInfo(); - - String out = itemTomodID.get( is.itemID ); - - if ( out == null ) - return "Unknown"; - - return out; - } - - private static void populateModInfo() - { - if ( itemTomodID == null ) - { - itemTomodID = new HashMap(); - itemNames = new HashMap(); - ImmutableTable modObjectTable; - - for (Field f : Block.class.getDeclaredFields()) - { - try - { - Object o = f.get( Block.class ); - if ( o instanceof Block ) - { - itemNames.put( ((Block) o).blockID, f.getName() ); - itemTomodID.put( ((Block) o).blockID, "minecraft" ); - } - } - catch (Throwable t) - { - } - } - - try - { - Field f = GameData.class.getDeclaredField( "modObjectTable" ); - f.setAccessible( true ); - modObjectTable = (ImmutableTable) f.get( GameData.class ); - f.setAccessible( false ); - - ImmutableMap> fish = modObjectTable.rowMap(); - for (String MODID : fish.keySet()) - { - Map g = fish.get( MODID ); - for (String key : g.keySet()) - { - itemNames.put( g.get( key ), key ); - itemTomodID.put( g.get( key ), MODID ); - } - } - } - catch (Throwable t) - { - } - } - - } - public static ForgeDirection crossProduct(ForgeDirection forward, ForgeDirection up) { int west_x = forward.offsetY * up.offsetZ - forward.offsetZ * up.offsetY; @@ -332,7 +234,7 @@ public class Platform if ( tile == null ) p.openGui( AppEng.instance, type.ordinal() << 3, p.getEntityWorld(), x, y, z ); else - p.openGui( AppEng.instance, type.ordinal() << 3 | (side.ordinal()), tile.worldObj, x, y, z ); + p.openGui( AppEng.instance, type.ordinal() << 3 | (side.ordinal()), tile.getWorldObj(), x, y, z ); } } @@ -348,12 +250,7 @@ public class Platform { try { - int bid = w.getBlockId( x, y, z ); - if ( bid <= 0 ) - return true; - if ( Block.blocksList[bid] == null ) - return true; - return Block.blocksList[bid].isAirBlock( w, x, y, z ); + return w.getBlock( x, y, z ).isAir( w, x, y, z ); } catch (Throwable e) { @@ -362,9 +259,8 @@ public class Platform } /* - * Lots of sillyness to try and account for weird tag related junk, - * basically requires that two tags have at least something in their tags - * before it wasts its time comparing them. + * Lots of sillyness to try and account for weird tag related junk, basically requires that two tags have at least + * something in their tags before it wasts its time comparing them. */ public static boolean sameStackStags(ItemStack a, ItemStack b) { @@ -397,11 +293,9 @@ public class Platform } /* - * recursive test for NBT Equality, this was faster then trying to compare / - * generate hashes, its also more reliable then the vanilla version which - * likes to fail when NBT Compound data changes order, it is pretty - * expensive performance wise, so try an use shared tag compounds as long as - * the system remains in AE. + * recursive test for NBT Equality, this was faster then trying to compare / generate hashes, its also more reliable + * then the vanilla version which likes to fail when NBT Compound data changes order, it is pretty expensive + * performance wise, so try an use shared tag compounds as long as the system remains in AE. */ public static boolean NBTEqualityTest(NBTBase A, NBTBase B) { @@ -415,17 +309,18 @@ public class Platform NBTTagCompound ctA = (NBTTagCompound) A; NBTTagCompound ctB = (NBTTagCompound) B; - Collection cA = ctA.getTags(); - Collection cB = ctB.getTags(); + Set cA = ctA.func_150296_c(); + Set cB = ctB.func_150296_c(); if ( cA.size() != cB.size() ) return false; - Iterator i = cA.iterator(); + Iterator i = cA.iterator(); while (i.hasNext()) { - NBTBase tag = i.next(); - NBTBase aTag = ctB.getTag( tag.getName() ); + String name = i.next(); + NBTBase tag = ctA.getTag( name ); + NBTBase aTag = ctB.getTag( name ); if ( aTag == null ) return false; @@ -443,15 +338,14 @@ public class Platform if ( lA.tagCount() != lB.tagCount() ) return false; + List tag = tagList( lA ); + List aTag = tagList( lB ); for (int x = 0; x < lA.tagCount(); x++) { - NBTBase tag = lA.tagAt( x ); - NBTBase aTag = lB.tagAt( x ); - - if ( aTag == null ) + if ( aTag.get( x ) == null ) return false; - if ( !NBTEqualityTest( tag, aTag ) ) + if ( !NBTEqualityTest( tag.get( x ), aTag.get( x ) ) ) return false; } @@ -459,22 +353,23 @@ public class Platform } case 1: // ( A instanceof NBTTagByte ) - return ((NBTTagByte) A).data == ((NBTTagByte) B).data; + return ((NBTTagByte) A).func_150287_d() == ((NBTTagByte) B).func_150287_d(); case 4: // else if ( A instanceof NBTTagLong ) - return ((NBTTagLong) A).data == ((NBTTagLong) B).data; + return ((NBTTagLong) A).func_150291_c() == ((NBTTagLong) B).func_150291_c(); case 8: // else if ( A instanceof NBTTagString ) - return ((NBTTagString) A).data == ((NBTTagString) B).data || ((NBTTagString) A).data.equals( ((NBTTagString) B).data ); + return ((NBTTagString) A).func_150285_a_() == ((NBTTagString) B).func_150285_a_() + || ((NBTTagString) A).func_150285_a_().equals( ((NBTTagString) B).func_150285_a_() ); case 6: // else if ( A instanceof NBTTagDouble ) - return ((NBTTagDouble) A).data == ((NBTTagDouble) B).data; + return ((NBTTagDouble) A).func_150286_g() == ((NBTTagDouble) B).func_150286_g(); case 5: // else if ( A instanceof NBTTagFloat ) - return ((NBTTagFloat) A).data == ((NBTTagFloat) B).data; + return ((NBTTagFloat) A).func_150288_h() == ((NBTTagFloat) B).func_150288_h(); case 3: // else if ( A instanceof NBTTagInt ) - return ((NBTTagInt) A).data == ((NBTTagInt) B).data; + return ((NBTTagInt) A).func_150287_d() == ((NBTTagInt) B).func_150287_d(); default: return A.equals( B ); @@ -484,9 +379,38 @@ public class Platform return false; } + private static Field tagList; + + private static List tagList(NBTTagList lB) + { + if ( tagList == null ) + { + try + { + tagList = lB.getClass().getDeclaredField( "tagList" ); + } + catch (Throwable t) + { + AELog.error( t ); + } + } + + try + { + tagList.setAccessible( true ); + return (List) tagList.get( lB ); + } + catch (Throwable t) + { + AELog.error( t ); + } + + return new ArrayList(); + } + /* - * Orderless hash on NBT Data, used to work thought huge piles fast, but - * ignroes the order just in case MC decided to change it... WHICH IS BAD... + * Orderless hash on NBT Data, used to work thought huge piles fast, but ignroes the order just in case MC decided + * to change it... WHICH IS BAD... */ public static int NBTOrderlessHash(NBTBase A) { @@ -499,13 +423,13 @@ public class Platform case 10: { NBTTagCompound ctA = (NBTTagCompound) A; - Collection cA = ctA.getTags(); + Set cA = ctA.func_150296_c(); - Iterator i = cA.iterator(); + Iterator i = cA.iterator(); while (i.hasNext()) { - NBTBase tag = i.next(); - hash += NBTOrderlessHash( ctA.getTag( tag.getName() ) ); + String name = i.next(); + hash += NBTOrderlessHash( ctA.getTag( name ) ); } return hash; @@ -516,31 +440,32 @@ public class Platform NBTTagList lA = (NBTTagList) A; hash += 9 * lA.tagCount(); + List l = tagList( lA ); for (int x = 0; x < lA.tagCount(); x++) { - hash += NBTOrderlessHash( lA.tagAt( x ) ); + hash += NBTOrderlessHash( l.get( x ) ); } return hash; } case 1: // ( A instanceof NBTTagByte ) - return hash + ((NBTTagByte) A).data; + return hash + ((NBTTagByte) A).func_150290_f(); case 4: // else if ( A instanceof NBTTagLong ) - return hash + (int) ((NBTTagLong) A).data; + return hash + (int) ((NBTTagLong) A).func_150291_c(); case 8: // else if ( A instanceof NBTTagString ) - return hash + ((NBTTagString) A).data.hashCode(); + return hash + ((NBTTagString) A).func_150285_a_().hashCode(); case 6: // else if ( A instanceof NBTTagDouble ) - return hash + (int) ((NBTTagDouble) A).data; + return hash + (int) ((NBTTagDouble) A).func_150286_g(); case 5: // else if ( A instanceof NBTTagFloat ) - return hash + (int) ((NBTTagFloat) A).data; + return hash + (int) ((NBTTagFloat) A).func_150288_h(); case 3: // else if ( A instanceof NBTTagInt ) - return hash + ((NBTTagInt) A).data; + return hash + ((NBTTagInt) A).func_150287_d(); default: return hash; @@ -548,8 +473,7 @@ public class Platform } /* - * The usual version of this returns an ItemStack, this version returns the - * recipe. + * The usual version of this returns an ItemStack, this version returns the recipe. */ public static IRecipe findMatchingRecipe(InventoryCrafting par1InventoryCrafting, World par2World) { @@ -572,14 +496,11 @@ public class Platform public static ItemStack[] getBlockDrops(World w, int x, int y, int z) { List out = new ArrayList(); - int bid = w.getBlockId( x, y, z ); + Block which = w.getBlock( x, y, z ); - if ( Block.blocksList.length > bid ) + if ( which != null ) { - Block which = Block.blocksList[bid]; - if ( which == null ) - return new ItemStack[0]; - out = which.getBlockDropped( w, x, y, z, w.getBlockMetadata( x, y, z ), 0 ); + out = which.getDrops( w, x, y, z, w.getBlockMetadata( x, y, z ), 0 ); } if ( out == null ) @@ -634,8 +555,7 @@ public class Platform } /* - * Creates / or loads previous NBT Data on items, used for editing items - * owned by AE. + * Creates / or loads previous NBT Data on items, used for editing items owned by AE. */ public static NBTTagCompound openNbtData(ItemStack i) { @@ -650,8 +570,7 @@ public class Platform } /* - * Generates Item entiies in the world similar to how items are generally - * droped. + * Generates Item entiies in the world similar to how items are generally droped. */ public static void spawnDrops(World w, int x, int y, int z, List drops) { @@ -675,27 +594,26 @@ public class Platform } /* - * Utility function to get the full inventory for a Double Chest in the - * World. + * Utility function to get the full inventory for a Double Chest in the World. */ public static IInventory GetChestInv(Object te) { TileEntityChest teA = (TileEntityChest) te; TileEntity teB = null; - int myBlockID = teA.worldObj.getBlockId( teA.xCoord, teA.yCoord, teA.zCoord ); + Block myBlockID = teA.getWorldObj().getBlock( teA.xCoord, teA.yCoord, teA.zCoord ); - if ( teA.worldObj.getBlockId( teA.xCoord + 1, teA.yCoord, teA.zCoord ) == myBlockID ) + if ( teA.getWorldObj().getBlock( teA.xCoord + 1, teA.yCoord, teA.zCoord ) == myBlockID ) { - teB = teA.worldObj.getBlockTileEntity( teA.xCoord + 1, teA.yCoord, teA.zCoord ); + teB = teA.getWorldObj().getTileEntity( teA.xCoord + 1, teA.yCoord, teA.zCoord ); if ( !(teB instanceof TileEntityChest) ) teB = null; } if ( teB == null ) { - if ( teA.worldObj.getBlockId( teA.xCoord - 1, teA.yCoord, teA.zCoord ) == myBlockID ) + if ( teA.getWorldObj().getBlock( teA.xCoord - 1, teA.yCoord, teA.zCoord ) == myBlockID ) { - teB = teA.worldObj.getBlockTileEntity( teA.xCoord - 1, teA.yCoord, teA.zCoord ); + teB = teA.getWorldObj().getTileEntity( teA.xCoord - 1, teA.yCoord, teA.zCoord ); if ( !(teB instanceof TileEntityChest) ) teB = null; else @@ -709,9 +627,9 @@ public class Platform if ( teB == null ) { - if ( teA.worldObj.getBlockId( teA.xCoord, teA.yCoord, teA.zCoord + 1 ) == myBlockID ) + if ( teA.getWorldObj().getBlock( teA.xCoord, teA.yCoord, teA.zCoord + 1 ) == myBlockID ) { - teB = teA.worldObj.getBlockTileEntity( teA.xCoord, teA.yCoord, teA.zCoord + 1 ); + teB = teA.getWorldObj().getTileEntity( teA.xCoord, teA.yCoord, teA.zCoord + 1 ); if ( !(teB instanceof TileEntityChest) ) teB = null; } @@ -719,9 +637,9 @@ public class Platform if ( teB == null ) { - if ( teA.worldObj.getBlockId( teA.xCoord, teA.yCoord, teA.zCoord - 1 ) == myBlockID ) + if ( teA.getWorldObj().getBlock( teA.xCoord, teA.yCoord, teA.zCoord - 1 ) == myBlockID ) { - teB = teA.worldObj.getBlockTileEntity( teA.xCoord, teA.yCoord, teA.zCoord - 1 ); + teB = teA.getWorldObj().getTileEntity( teA.xCoord, teA.yCoord, teA.zCoord - 1 ); if ( !(teB instanceof TileEntityChest) ) teB = null; else @@ -888,14 +806,15 @@ public class Platform } private static WeakHashMap fakePlayers = new WeakHashMap(); + private static GameProfile myProfile = new GameProfile( "[appeng]", "AE2" ); - public static EntityPlayer getPlayer(World w) + public static EntityPlayer getPlayer(WorldServer w) { EntityPlayer wrp = fakePlayers.get( w ); if ( wrp != null ) return wrp; - EntityPlayer p = new FakePlayer( w, "[AppEng]" ); + EntityPlayer p = FakePlayerFactory.get( w, myProfile ); fakePlayers.put( w, p ); return p; } @@ -956,8 +875,7 @@ public class Platform public static boolean blockAtLocationIs(IBlockAccess w, int x, int y, int z, AEItemDefinition def) { - int blk = w.getBlockId( x, y, z ); - return def.block() == Block.blocksList[blk]; + return def.block() == w.getBlock( x, y, z ); } public static ForgeDirection rotateAround(ForgeDirection forward, ForgeDirection axis) @@ -1073,7 +991,7 @@ public class Platform public static boolean isSameItemType(ItemStack ol, ItemStack op) { - if ( ol != null && op != null && ol.itemID == op.itemID ) + if ( ol != null && op != null && ol.getItem() == op.getItem() ) { if ( ol.isItemStackDamageable() ) return true; @@ -1115,13 +1033,12 @@ public class Platform } /* - * if ( a.itemID != 0 && b.itemID != 0 && a.isItemStackDamageable() && ! - * a.getHasSubtypes() && a.itemID == b.itemID ) { return - * (a.getItemDamage() > 0) == (b.getItemDamage() > 0); } + * if ( a.itemID != 0 && b.itemID != 0 && a.isItemStackDamageable() && ! a.getHasSubtypes() && a.itemID == + * b.itemID ) { return (a.getItemDamage() > 0) == (b.getItemDamage() > 0); } */ // test damageable items.. - if ( a.itemID != 0 && b.itemID != 0 && a.getItem().isDamageable() && a.itemID == b.itemID ) + if ( a.getItem() != null && b.getItem() != null && a.getItem().isDamageable() && a.getItem() == b.getItem() ) { try { @@ -1162,21 +1079,17 @@ public class Platform } /* - * // test ore dictionary.. int OreID = getOreID( a ); if ( OreID != -1 - * ) return OreID == getOreID( b ); + * // test ore dictionary.. int OreID = getOreID( a ); if ( OreID != -1 ) return OreID == getOreID( b ); * - * if ( Mode != FuzzyMode.IGNORE_ALL ) { if ( a.hasTagCompound() && - * !isShared( a.getTagCompound() ) ) { a = Platform.getSharedItemStack( - * AEItemStack.create( a ) ); } + * if ( Mode != FuzzyMode.IGNORE_ALL ) { if ( a.hasTagCompound() && !isShared( a.getTagCompound() ) ) { a = + * Platform.getSharedItemStack( AEItemStack.create( a ) ); } * - * if ( b.hasTagCompound() && !isShared( b.getTagCompound() ) ) { b = - * Platform.getSharedItemStack( AEItemStack.create( b ) ); } + * if ( b.hasTagCompound() && !isShared( b.getTagCompound() ) ) { b = Platform.getSharedItemStack( + * AEItemStack.create( b ) ); } * - * // test regular items with damage values and what not... if ( - * isShared( a.getTagCompound() ) && isShared( b.getTagCompound() ) && - * a.itemID == b.itemID ) { return ((AppEngSharedNBTTagCompound) - * a.getTagCompound()).compareFuzzyWithRegistry( - * (AppEngSharedNBTTagCompound) b.getTagCompound() ); } } + * // test regular items with damage values and what not... if ( isShared( a.getTagCompound() ) && isShared( + * b.getTagCompound() ) && a.itemID == b.itemID ) { return ((AppEngSharedNBTTagCompound) + * a.getTagCompound()).compareFuzzyWithRegistry( (AppEngSharedNBTTagCompound) b.getTagCompound() ); } } */ return a.isItemEqual( b ); @@ -1233,7 +1146,8 @@ public class Platform AxisAlignedBB bb = AxisAlignedBB .getAABBPool() .getAABB( Math.min( vec3.xCoord, vec31.xCoord ), Math.min( vec3.yCoord, vec31.yCoord ), Math.min( vec3.zCoord, vec31.zCoord ), - Math.max( vec3.xCoord, vec31.xCoord ), Math.max( vec3.yCoord, vec31.yCoord ), Math.max( vec3.zCoord, vec31.zCoord ) ).expand( 16, 16, 16 ); + Math.max( vec3.xCoord, vec31.xCoord ), Math.max( vec3.yCoord, vec31.yCoord ), Math.max( vec3.zCoord, vec31.zCoord ) ) + .expand( 16, 16, 16 ); Entity entity = null; double Closeest = 9999999.0D; @@ -1279,7 +1193,7 @@ public class Platform if ( hitBlocks ) { Srec = w.getWorldVec3Pool().getVecFromPool( d0, d1, d2 ); - pos = w.rayTraceBlocks_do_do( vec3, vec31, true, false ); + pos = w.rayTraceBlocks( vec3, vec31, true ); } if ( entity != null && pos != null && pos.hitVec.squareDistanceTo( Srec ) > Closeest ) @@ -1301,7 +1215,8 @@ public class Platform return 0; } - public static StackType poweredExtraction(IEnergySource energy, IMEInventory cell, StackType request, BaseActionSource src) + public static StackType poweredExtraction(IEnergySource energy, IMEInventory cell, StackType request, + BaseActionSource src) { StackType possible = cell.extractItems( (StackType) request.copy(), Actionable.SIMULATE, src ); @@ -1410,7 +1325,8 @@ public class Platform } } - static public > void postListChanges(IItemList before, IItemList after, IMEMonitorHandlerReciever meMonitorPassthu, BaseActionSource source) + static public > void postListChanges(IItemList before, IItemList after, IMEMonitorHandlerReciever meMonitorPassthu, + BaseActionSource source) { for (T is : before) is.setStackSize( -is.getStackSize() ); @@ -1442,8 +1358,8 @@ public class Platform targ.checkForAdjacentChests(); if ( targ.adjacentChestZNeg != null ) hash ^= targ.adjacentChestZNeg.hashCode(); - else if ( targ.adjacentChestZPosition != null ) - hash ^= targ.adjacentChestZPosition.hashCode(); + else if ( targ.adjacentChestZPos != null ) + hash ^= targ.adjacentChestZPos.hashCode(); else if ( targ.adjacentChestXPos != null ) hash ^= targ.adjacentChestXPos.hashCode(); else if ( targ.adjacentChestXNeg != null ) @@ -1516,4 +1432,9 @@ public class Platform return !gs.hasPermission( playerID, SecurityPermissions.BUILD ); } + + public static boolean isDrawing(Tessellator tess) + { + return false; + } } diff --git a/util/inv/AdaptorBCPipe.java b/util/inv/AdaptorBCPipe.java index a0f4604d..a7ec5af3 100644 --- a/util/inv/AdaptorBCPipe.java +++ b/util/inv/AdaptorBCPipe.java @@ -4,27 +4,33 @@ import java.util.Iterator; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.config.FuzzyMode; -import appeng.integration.modules.BC; +import appeng.core.AppEng; +import appeng.integration.abstraction.IBC; import appeng.util.InventoryAdaptor; import appeng.util.iterators.NullIterator; public class AdaptorBCPipe extends InventoryAdaptor { - private TileEntity i; - private ForgeDirection d; + final private IBC bc; + final private TileEntity i; + final private ForgeDirection d; public AdaptorBCPipe(TileEntity s, ForgeDirection dd) { - if ( BC.instance != null ) + bc = (IBC) AppEng.instance.getIntegration( "BC" ); + if ( bc != null ) { - if ( BC.instance.isPipe( s, dd ) ) + if ( bc.isPipe( s, dd ) ) { i = s; d = dd; + return; } } + i = null; + d = null; } @Override @@ -61,7 +67,7 @@ public class AdaptorBCPipe extends InventoryAdaptor if ( A.stackSize == 0 ) return null; - if ( BC.instance.addItemsToPipe( i, A, d ) ) + if ( bc.addItemsToPipe( i, A, d ) ) return null; return A; } diff --git a/util/inv/AdaptorIInventory.java b/util/inv/AdaptorIInventory.java index 2b3d3824..fc77067f 100644 --- a/util/inv/AdaptorIInventory.java +++ b/util/inv/AdaptorIInventory.java @@ -71,7 +71,7 @@ public class AdaptorIInventory extends InventoryAdaptor if ( rv != null ) { - // i.onInventoryChanged(); + // i.markDirty(); return rv; } } @@ -151,7 +151,7 @@ public class AdaptorIInventory extends InventoryAdaptor } // if ( rv != null ) - // i.onInventoryChanged(); + // i.markDirty(); return rv; } @@ -226,7 +226,7 @@ public class AdaptorIInventory extends InventoryAdaptor if ( left.stackSize <= 0 ) { - // i.onInventoryChanged(); + // i.markDirty(); return null; } } @@ -247,7 +247,7 @@ public class AdaptorIInventory extends InventoryAdaptor left.stackSize -= used; if ( left.stackSize <= 0 ) { - // i.onInventoryChanged(); + // i.markDirty(); return null; } } @@ -258,7 +258,7 @@ public class AdaptorIInventory extends InventoryAdaptor } // if ( left.stackSize != A.stackSize ) - // i.onInventoryChanged(); + // i.markDirty(); return left; } diff --git a/util/inv/AdaptorISpecialInventory.java b/util/inv/AdaptorISpecialInventory.java index d89a3c00..994b0485 100644 --- a/util/inv/AdaptorISpecialInventory.java +++ b/util/inv/AdaptorISpecialInventory.java @@ -4,7 +4,7 @@ import java.util.Iterator; import net.minecraft.inventory.ISidedInventory; import net.minecraft.item.ItemStack; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.config.FuzzyMode; import appeng.util.InventoryAdaptor; import buildcraft.api.inventory.ISpecialInventory; diff --git a/util/inv/AdaptorPlayerInventory.java b/util/inv/AdaptorPlayerInventory.java index c68c9f11..2dfdcf68 100644 --- a/util/inv/AdaptorPlayerInventory.java +++ b/util/inv/AdaptorPlayerInventory.java @@ -49,9 +49,9 @@ public class AdaptorPlayerInventory implements IInventory } @Override - public String getInvName() + public String getInventoryName() { - return src.getInvName(); + return src.getInventoryName(); } @Override @@ -61,9 +61,9 @@ public class AdaptorPlayerInventory implements IInventory } @Override - public void onInventoryChanged() + public void markDirty() { - src.onInventoryChanged(); + src.markDirty(); } @Override @@ -73,19 +73,19 @@ public class AdaptorPlayerInventory implements IInventory } @Override - public void openChest() + public void openInventory() { - src.openChest(); + src.openInventory(); } @Override - public void closeChest() + public void closeInventory() { - src.closeChest(); + src.closeInventory(); } @Override - public boolean isInvNameLocalized() + public boolean hasCustomInventoryName() { return false; } diff --git a/util/inv/WrapperBCPipe.java b/util/inv/WrapperBCPipe.java index 4815c352..b6b481cf 100644 --- a/util/inv/WrapperBCPipe.java +++ b/util/inv/WrapperBCPipe.java @@ -4,16 +4,19 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraftforge.common.ForgeDirection; -import appeng.integration.modules.BC; +import net.minecraftforge.common.util.ForgeDirection; +import appeng.core.AppEng; +import appeng.integration.abstraction.IBC; public class WrapperBCPipe implements IInventory { - TileEntity ad; - ForgeDirection dir; + final private IBC bc; + final private TileEntity ad; + final private ForgeDirection dir; public WrapperBCPipe(TileEntity te, ForgeDirection d) { + bc = (IBC) AppEng.instance.getIntegration( "BC" ); ad = te; dir = d; } @@ -45,21 +48,33 @@ public class WrapperBCPipe implements IInventory @Override public void setInventorySlotContents(int i, ItemStack itemstack) { - BC.instance.addItemsToPipe( ad, itemstack, dir ); + bc.addItemsToPipe( ad, itemstack, dir ); } @Override - public String getInvName() + public String getInventoryName() { - return null; + return "BC Pipe Wrapper"; } @Override - public boolean isInvNameLocalized() + public boolean hasCustomInventoryName() { return false; } + @Override + public void closeInventory() + { + + } + + @Override + public void openInventory() + { + + } + @Override public int getInventoryStackLimit() { @@ -67,7 +82,7 @@ public class WrapperBCPipe implements IInventory } @Override - public void onInventoryChanged() + public void markDirty() { } @@ -78,22 +93,10 @@ public class WrapperBCPipe implements IInventory return false; } - @Override - public void openChest() - { - - } - - @Override - public void closeChest() - { - - } - @Override public boolean isItemValidForSlot(int i, ItemStack itemstack) { - return BC.instance.canAddItemsToPipe( ad, itemstack, dir ); + return bc.canAddItemsToPipe( ad, itemstack, dir ); } } diff --git a/util/inv/WrapperChainedInventory.java b/util/inv/WrapperChainedInventory.java index 3613eb7a..a1e71c4f 100644 --- a/util/inv/WrapperChainedInventory.java +++ b/util/inv/WrapperChainedInventory.java @@ -138,7 +138,7 @@ public class WrapperChainedInventory implements IInventory } @Override - public String getInvName() + public String getInventoryName() { return "ChainedInv"; } @@ -155,11 +155,11 @@ public class WrapperChainedInventory implements IInventory } @Override - public void onInventoryChanged() + public void markDirty() { for (IInventory i : l) { - i.onInventoryChanged(); + i.markDirty(); } } @@ -170,17 +170,17 @@ public class WrapperChainedInventory implements IInventory } @Override - public void openChest() + public void openInventory() { } @Override - public void closeChest() + public void closeInventory() { } @Override - public boolean isInvNameLocalized() + public boolean hasCustomInventoryName() { return false; } diff --git a/util/inv/WrapperInvSlot.java b/util/inv/WrapperInvSlot.java index 16b6ac34..788f6e7c 100644 --- a/util/inv/WrapperInvSlot.java +++ b/util/inv/WrapperInvSlot.java @@ -50,15 +50,15 @@ public class WrapperInvSlot implements IInventory } @Override - public String getInvName() + public String getInventoryName() { - return inv.getInvName(); + return inv.getInventoryName(); } @Override - public boolean isInvNameLocalized() + public boolean hasCustomInventoryName() { - return inv.isInvNameLocalized(); + return inv.hasCustomInventoryName(); } @Override @@ -68,9 +68,9 @@ public class WrapperInvSlot implements IInventory } @Override - public void onInventoryChanged() + public void markDirty() { - inv.onInventoryChanged(); + inv.markDirty(); } @Override @@ -80,15 +80,15 @@ public class WrapperInvSlot implements IInventory } @Override - public void openChest() + public void openInventory() { - inv.openChest(); + inv.openInventory(); } @Override - public void closeChest() + public void closeInventory() { - inv.closeChest(); + inv.closeInventory(); } @Override diff --git a/util/inv/WrapperInventoryRange.java b/util/inv/WrapperInventoryRange.java index da2abd29..bd030558 100644 --- a/util/inv/WrapperInventoryRange.java +++ b/util/inv/WrapperInventoryRange.java @@ -75,9 +75,9 @@ public class WrapperInventoryRange implements IInventory } @Override - public String getInvName() + public String getInventoryName() { - return src.getInvName(); + return src.getInventoryName(); } @Override @@ -87,9 +87,9 @@ public class WrapperInventoryRange implements IInventory } @Override - public void onInventoryChanged() + public void markDirty() { - src.onInventoryChanged(); + src.markDirty(); } @Override @@ -99,19 +99,19 @@ public class WrapperInventoryRange implements IInventory } @Override - public void openChest() + public void openInventory() { - src.openChest(); + src.openInventory(); } @Override - public void closeChest() + public void closeInventory() { - src.closeChest(); + src.closeInventory(); } @Override - public boolean isInvNameLocalized() + public boolean hasCustomInventoryName() { return false; } diff --git a/util/inv/WrapperMCISidedInventory.java b/util/inv/WrapperMCISidedInventory.java index 49124eb1..07836bbe 100644 --- a/util/inv/WrapperMCISidedInventory.java +++ b/util/inv/WrapperMCISidedInventory.java @@ -3,7 +3,7 @@ package appeng.util.inv; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.ISidedInventory; import net.minecraft.item.ItemStack; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; public class WrapperMCISidedInventory extends WrapperInventoryRange implements IInventory, IInventoryWrapper { diff --git a/util/inv/WrapperTEPipe.java b/util/inv/WrapperTEPipe.java index dde41f8b..f953dd7d 100644 --- a/util/inv/WrapperTEPipe.java +++ b/util/inv/WrapperTEPipe.java @@ -4,8 +4,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraftforge.common.ForgeDirection; -import appeng.integration.modules.TE; +import net.minecraftforge.common.util.ForgeDirection; public class WrapperTEPipe implements IInventory { @@ -45,17 +44,17 @@ public class WrapperTEPipe implements IInventory @Override public void setInventorySlotContents(int i, ItemStack itemstack) { - TE.instance.addItemsToPipe( ad, itemstack, dir ); + // ITE.addItemsToPipe( ad, itemstack, dir ); } @Override - public String getInvName() + public String getInventoryName() { return null; } @Override - public boolean isInvNameLocalized() + public boolean hasCustomInventoryName() { return false; } @@ -67,7 +66,7 @@ public class WrapperTEPipe implements IInventory } @Override - public void onInventoryChanged() + public void markDirty() { } @@ -79,13 +78,13 @@ public class WrapperTEPipe implements IInventory } @Override - public void openChest() + public void openInventory() { } @Override - public void closeChest() + public void closeInventory() { } diff --git a/util/item/AEFluidStack.java b/util/item/AEFluidStack.java index 7399c0b1..f511f6e9 100644 --- a/util/item/AEFluidStack.java +++ b/util/item/AEFluidStack.java @@ -1,18 +1,15 @@ package appeng.util.item; +import io.netty.buffer.ByteBuf; + import java.io.ByteArrayOutputStream; import java.io.DataInput; -import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.IOException; import net.minecraft.item.ItemStack; import net.minecraft.nbt.CompressedStreamTools; -import net.minecraft.nbt.NBTBase; -import net.minecraft.nbt.NBTTagByte; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagLong; -import net.minecraft.nbt.NBTTagString; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidStack; import appeng.api.config.FuzzyMode; @@ -143,45 +140,39 @@ public final class AEFluidStack extends AEStack implements IAEFlu public void writeToNBT(NBTTagCompound i) { /* - * Ugly Yes, but it saves a lot in the memory department. + * Mojang Fucked this over ; GC Optimization - Ugly Yes, but it saves a lot in the memory department. */ - NBTBase FluidName = i.getTag( "FluidName" ); - NBTBase Count = i.getTag( "Count" ); - // NBTBase Priority = i.getTag( "Priority" ); - NBTBase Cnt = i.getTag( "Cnt" ); - NBTBase Req = i.getTag( "Req" ); - NBTBase Craft = i.getTag( "Craft" ); + /* + * NBTBase FluidName = i.getTag( "FluidName" ); NBTBase Count = i.getTag( "Count" ); NBTBase Cnt = i.getTag( + * "Cnt" ); NBTBase Req = i.getTag( "Req" ); NBTBase Craft = i.getTag( "Craft" ); + */ - if ( FluidName != null && FluidName instanceof NBTTagString ) - ((NBTTagString) FluidName).data = (String) this.fluid.getName(); - else - i.setString( "FluidName", (String) this.fluid.getName() ); + /* + * if ( FluidName != null && FluidName instanceof NBTTagString ) ((NBTTagString) FluidName).data = (String) + * this.fluid.getName(); else + */ + i.setString( "FluidName", (String) this.fluid.getName() ); - // if ( Priority != null && Priority instanceof NBTTagInt ) - // ((NBTTagInt) Priority).data = this.priority; - // else - // i.setInteger( "Priority", this.priority ); + /* + * if ( Count != null && Count instanceof NBTTagByte ) ((NBTTagByte) Count).data = (byte) 0; else + */ + i.setByte( "Count", (byte) 0 ); - if ( Count != null && Count instanceof NBTTagByte ) - ((NBTTagByte) Count).data = (byte) 0; - else - i.setByte( "Count", (byte) 0 ); + /* + * if ( Cnt != null && Cnt instanceof NBTTagLong ) ((NBTTagLong) Cnt).data = this.stackSize; else + */ + i.setLong( "Cnt", this.stackSize ); - if ( Cnt != null && Cnt instanceof NBTTagLong ) - ((NBTTagLong) Cnt).data = this.stackSize; - else - i.setLong( "Cnt", this.stackSize ); + /* + * if ( Req != null && Req instanceof NBTTagLong ) ((NBTTagLong) Req).data = this.stackSize; else + */ + i.setLong( "Req", this.getCountRequestable() ); - if ( Req != null && Req instanceof NBTTagLong ) - ((NBTTagLong) Req).data = this.stackSize; - else - i.setLong( "Req", this.getCountRequestable() ); - - if ( Craft != null && Craft instanceof NBTTagByte ) - ((NBTTagByte) Craft).data = (byte) (this.isCraftable() ? 1 : 0); - else - i.setBoolean( "Craft", this.isCraftable() ); + /* + * if ( Craft != null && Craft instanceof NBTTagByte ) ((NBTTagByte) Craft).data = (byte) (this.isCraftable() ? + * 1 : 0); else + */i.setBoolean( "Craft", this.isCraftable() ); if ( tagCompound != null ) i.setTag( "tag", (NBTTagCompound) tagCompound ); @@ -223,15 +214,15 @@ public final class AEFluidStack extends AEStack implements IAEFlu } @Override - void writeIdentity(DataOutputStream i) throws IOException + void writeIdentity(ByteBuf i) throws IOException { byte[] name = fluid.getName().getBytes( "UTF-8" ); i.writeByte( (byte) name.length ); - i.write( name ); + i.writeBytes( name ); } @Override - void readNBT(DataOutputStream i) throws IOException + void readNBT(ByteBuf i) throws IOException { if ( hasTagCompound() ) { @@ -244,11 +235,11 @@ public final class AEFluidStack extends AEStack implements IAEFlu int size = tagBytes.length; i.writeInt( size ); - i.write( tagBytes ); + i.writeBytes( tagBytes ); } } - public static IAEFluidStack loadFluidStackFromPacket(DataInputStream data) throws IOException + public static IAEFluidStack loadFluidStackFromPacket(ByteBuf data) throws IOException { byte mask = data.readByte(); // byte PriorityType = (byte) (mask & 0x03); @@ -262,7 +253,7 @@ public final class AEFluidStack extends AEStack implements IAEFlu byte len2 = data.readByte(); byte name[] = new byte[len2]; - data.read( name, 0, len2 ); + data.readBytes( name, 0, len2 ); d.setString( "FluidName", new String( name, "UTF-8" ) ); d.setByte( "Count", (byte) 0 ); @@ -272,10 +263,10 @@ public final class AEFluidStack extends AEStack implements IAEFlu int len = data.readInt(); byte[] bd = new byte[len]; - data.readFully( bd ); + data.readBytes( bd ); DataInput di = ByteStreams.newDataInput( bd ); - d.setCompoundTag( "tag", CompressedStreamTools.read( di ) ); + d.setTag( "tag", CompressedStreamTools.read( di ) ); } // long priority = getPacketValue( PriorityType, data ); diff --git a/util/item/AEItemDef.java b/util/item/AEItemDef.java index c1c71982..0635a06e 100644 --- a/util/item/AEItemDef.java +++ b/util/item/AEItemDef.java @@ -2,6 +2,7 @@ package appeng.util.item; import java.util.List; +import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTBase; @@ -16,6 +17,7 @@ public class AEItemDef public int def; + private int itemID; public Item item; public int damageValue; @@ -42,6 +44,7 @@ public class AEItemDef t.maxDamage = maxDamage; t.tagCompound = tagCompound; t.isOre = isOre; + t.itemID = itemID; return t; } @@ -54,7 +57,7 @@ public class AEItemDef public int getDamageValueHack(ItemStack is) { - return Item.blazeRod.getDamage( is ); + return Items.blaze_rod.getDamage( is ); } public boolean isItem(ItemStack otherStack) @@ -77,7 +80,7 @@ public class AEItemDef public void reHash() { - def = item.itemID << Platform.DEF_OFFSET | damageValue; + def = itemID << Platform.DEF_OFFSET | damageValue; myHash = def ^ (tagCompound == null ? 0 : System.identityHashCode( tagCompound )); } } diff --git a/util/item/AEItemStack.java b/util/item/AEItemStack.java index 4b85bcff..654c66cf 100644 --- a/util/item/AEItemStack.java +++ b/util/item/AEItemStack.java @@ -1,8 +1,9 @@ package appeng.util.item; +import io.netty.buffer.ByteBuf; + import java.io.ByteArrayOutputStream; import java.io.DataInput; -import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.IOException; import java.util.List; @@ -10,11 +11,7 @@ import java.util.List; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.CompressedStreamTools; -import net.minecraft.nbt.NBTBase; -import net.minecraft.nbt.NBTTagByte; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagLong; -import net.minecraft.nbt.NBTTagShort; import appeng.api.config.FuzzyMode; import appeng.api.storage.StorageChannel; import appeng.api.storage.data.IAEItemStack; @@ -157,51 +154,45 @@ public final class AEItemStack extends AEStack implements IAEItemS public void writeToNBT(NBTTagCompound i) { /* - * Ugly Yes, but it saves a lot in the memory department. + * Mojang Fucked this over ; GC Optimization - Ugly Yes, but it saves a lot in the memory department. */ - NBTBase id = i.getTag( "id" ); - NBTBase Count = i.getTag( "Count" ); - // NBTBase Priority = i.getTag( "Priority" ); - NBTBase Cnt = i.getTag( "Cnt" ); - NBTBase Req = i.getTag( "Req" ); - NBTBase Craft = i.getTag( "Craft" ); - NBTBase Damage = i.getTag( "Damage" ); + /* + * NBTBase id = i.getTag( "id" ); NBTBase Count = i.getTag( "Count" ); NBTBase Cnt = i.getTag( "Cnt" ); NBTBase + * Req = i.getTag( "Req" ); NBTBase Craft = i.getTag( "Craft" ); NBTBase Damage = i.getTag( "Damage" ); + */ - if ( id != null && id instanceof NBTTagShort ) - ((NBTTagShort) id).data = (short) this.def.item.itemID; - else - i.setShort( "id", (short) this.def.item.itemID ); + /* + * if ( id != null && id instanceof NBTTagShort ) ((NBTTagShort) id).data = (short) this.def.item.itemID; else + */ + i.setShort( "id", (short) Item.itemRegistry.getIDForObject( this.def.item ) ); - // if ( Priority != null && Priority instanceof NBTTagInt ) - // ((NBTTagInt) Priority).data = this.priority; - // else - // i.setInteger( "Priority", this.priority ); + /* + * if ( Count != null && Count instanceof NBTTagByte ) ((NBTTagByte) Count).data = (byte) 0; else + */ + i.setByte( "Count", (byte) 0 ); - if ( Count != null && Count instanceof NBTTagByte ) - ((NBTTagByte) Count).data = (byte) 0; - else - i.setByte( "Count", (byte) 0 ); + /* + * if ( Cnt != null && Cnt instanceof NBTTagLong ) ((NBTTagLong) Cnt).data = this.stackSize; else + */ + i.setLong( "Cnt", this.stackSize ); - if ( Cnt != null && Cnt instanceof NBTTagLong ) - ((NBTTagLong) Cnt).data = this.stackSize; - else - i.setLong( "Cnt", this.stackSize ); + /* + * if ( Req != null && Req instanceof NBTTagLong ) ((NBTTagLong) Req).data = this.stackSize; else + */ + i.setLong( "Req", this.getCountRequestable() ); - if ( Req != null && Req instanceof NBTTagLong ) - ((NBTTagLong) Req).data = this.stackSize; - else - i.setLong( "Req", this.getCountRequestable() ); + /* + * if ( Craft != null && Craft instanceof NBTTagByte ) ((NBTTagByte) Craft).data = (byte) (this.isCraftable() ? + * 1 : 0); else + */ + i.setBoolean( "Craft", this.isCraftable() ); - if ( Craft != null && Craft instanceof NBTTagByte ) - ((NBTTagByte) Craft).data = (byte) (this.isCraftable() ? 1 : 0); - else - i.setBoolean( "Craft", this.isCraftable() ); - - if ( Damage != null && Damage instanceof NBTTagShort ) - ((NBTTagShort) Damage).data = (short) this.def.damageValue; - else - i.setShort( "Damage", (short) this.def.damageValue ); + /* + * if ( Damage != null && Damage instanceof NBTTagShort ) ((NBTTagShort) Damage).data = (short) + * this.def.damageValue; else + */ + i.setShort( "Damage", (short) this.def.damageValue ); if ( def.tagCompound != null ) i.setTag( "tag", (NBTTagCompound) def.tagCompound ); @@ -238,7 +229,7 @@ public final class AEItemStack extends AEStack implements IAEItemS @Override public int compareTo(AEItemStack b) { - int id = def.item.itemID - b.def.item.itemID; + int id = def.item.hashCode() - b.def.item.hashCode(); int dv = def.damageValue - b.def.damageValue; int dspv = def.dspDamage - b.def.dspDamage; @@ -279,14 +270,14 @@ public final class AEItemStack extends AEStack implements IAEItemS } @Override - void writeIdentity(DataOutputStream i) throws IOException + void writeIdentity(ByteBuf i) throws IOException { - i.writeShort( def.item.itemID ); + i.writeShort( Item.itemRegistry.getIDForObject( def.item ) ); i.writeShort( getItemDamage() ); } @Override - void readNBT(DataOutputStream i) throws IOException + void readNBT(ByteBuf i) throws IOException { if ( hasTagCompound() ) { @@ -299,11 +290,11 @@ public final class AEItemStack extends AEStack implements IAEItemS int size = tagBytes.length; i.writeInt( size ); - i.write( tagBytes ); + i.writeBytes( tagBytes ); } } - public static IAEItemStack loadItemStackFromPacket(DataInputStream data) throws IOException + public static IAEItemStack loadItemStackFromPacket(ByteBuf data) throws IOException { byte mask = data.readByte(); // byte PriorityType = (byte) (mask & 0x03); @@ -324,10 +315,10 @@ public final class AEItemStack extends AEStack implements IAEItemS int len = data.readInt(); byte[] bd = new byte[len]; - data.readFully( bd ); + data.readBytes( bd ); DataInput di = ByteStreams.newDataInput( bd ); - d.setCompoundTag( "tag", CompressedStreamTools.read( di ) ); + d.setTag( "tag", CompressedStreamTools.read( di ) ); } // long priority = getPacketValue( PriorityType, data ); diff --git a/util/item/AESharedNBT.java b/util/item/AESharedNBT.java index e9c7a87d..2a5fedfc 100644 --- a/util/item/AESharedNBT.java +++ b/util/item/AESharedNBT.java @@ -4,8 +4,8 @@ import java.lang.ref.WeakReference; import java.util.Iterator; import java.util.WeakHashMap; +import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTBase; import net.minecraft.nbt.NBTTagCompound; import appeng.api.AEApi; import appeng.api.features.IItemComparison; @@ -18,7 +18,8 @@ import appeng.util.Platform; public class AESharedNBT extends NBTTagCompound implements IAETagCompound { - private int itemid, meta, hash; + private Item itemid; + private int meta, hash; public SharedSearchObject sso; private IItemComparison comp; @@ -33,8 +34,8 @@ public class AESharedNBT extends NBTTagCompound implements IAETagCompound return comp; } - private AESharedNBT(int itemID, int damageValue, String name) { - super( name ); + private AESharedNBT(Item itemID, int damageValue) { + super(); itemid = itemID; meta = damageValue; } @@ -45,16 +46,17 @@ public class AESharedNBT extends NBTTagCompound implements IAETagCompound return (NBTTagCompound) copy(); } - public static AESharedNBT createFromCompound(int itemID, int damageValue, NBTTagCompound c) + public static AESharedNBT createFromCompound(Item itemID, int damageValue, NBTTagCompound c) { - AESharedNBT x = new AESharedNBT( itemID, damageValue, c.getName() ); + AESharedNBT x = new AESharedNBT( itemID, damageValue ); - Iterator var2 = c.getTags().iterator(); + // c.getTags() + Iterator var2 = c.func_150296_c().iterator(); while (var2.hasNext()) { - NBTBase tag = (NBTBase) var2.next(); - x.setTag( tag.getName(), (NBTBase) tag.copy() ); + String name = (String) var2.next(); + x.setTag( name, c.getTag( name ).copy() ); } x.hash = Platform.NBTOrderlessHash( c ); @@ -74,7 +76,7 @@ public class AESharedNBT extends NBTTagCompound implements IAETagCompound return super.equals( par1Obj ); } - public boolean matches(int itemid2, int meta2, int orderlessHash) + public boolean matches(Item itemid2, int meta2, int orderlessHash) { return itemid2 == itemid && meta == meta2 && hash == orderlessHash; } @@ -139,9 +141,9 @@ public class AESharedNBT extends NBTTagCompound implements IAETagCompound if ( tagCompound.hasNoTags() ) return null; - int itemid = s.itemID; + Item itemid = s.getItem(); int meta = -1; - if ( s.itemID != 0 && s.isItemStackDamageable() && s.getHasSubtypes() ) + if ( s.getItem() != null && s.isItemStackDamageable() && s.getHasSubtypes() ) meta = s.getItemDamage(); if ( isShared( tagCompound ) ) diff --git a/util/item/AEStack.java b/util/item/AEStack.java index 1872bce7..a40002e7 100644 --- a/util/item/AEStack.java +++ b/util/item/AEStack.java @@ -1,7 +1,7 @@ package appeng.util.item; -import java.io.DataInputStream; -import java.io.DataOutputStream; +import io.netty.buffer.ByteBuf; + import java.io.IOException; import appeng.api.storage.data.IAEStack; @@ -92,7 +92,7 @@ public abstract class AEStack implements IAEStack implements IAEStack implements IAEStack