From 2de3a2eceebf600aabdd9c44ecc8b20fdc094599 Mon Sep 17 00:00:00 2001 From: Sebastian Hartte Date: Tue, 2 Jun 2020 22:52:35 +0200 Subject: [PATCH] Grindr, GUI, Container. --- build.gradle | 3 + .../block/crafting/BlockCraftingUnit.java | 2 +- .../appeng/block/grindstone/BlockCrank.java | 98 +++++++-------- .../appeng/block/grindstone/BlockGrinder.java | 6 +- .../appeng/block/misc/BlockInscriber.java | 6 +- .../appeng/block/misc/BlockLightDetector.java | 5 +- .../appeng/block/misc/BlockQuartzFixture.java | 31 ++--- .../appeng/block/misc/BlockSkyCompass.java | 11 +- .../java/appeng/block/misc/BlockTinyTNT.java | 2 +- .../block/networking/BlockCableBus.java | 2 +- .../block/networking/BlockController.java | 2 +- .../java/appeng/block/paint/BlockPaint.java | 2 +- .../appeng/block/qnb/BlockQuantumBase.java | 2 +- .../block/spatial/BlockSpatialIOPort.java | 2 +- .../block/spatial/BlockSpatialPylon.java | 2 +- .../appeng/block/storage/BlockIOPort.java | 2 +- .../java/appeng/client/gui/AEBaseGui.java | 1 - .../java/appeng/client/gui/AEBaseMEGui.java | 10 +- .../gui/implementations/GuiCellWorkbench.java | 59 +++++---- .../client/gui/implementations/GuiChest.java | 11 +- .../gui/implementations/GuiCondenser.java | 21 ++-- .../gui/implementations/GuiCraftAmount.java | 15 +-- .../gui/implementations/GuiCraftConfirm.java | 40 +++---- .../gui/implementations/GuiCraftingCPU.java | 24 ++-- .../implementations/GuiCraftingStatus.java | 22 ++-- .../gui/implementations/GuiCraftingTerm.java | 12 +- .../client/gui/implementations/GuiDrive.java | 11 +- .../implementations/GuiFormationPlane.java | 8 +- .../gui/implementations/GuiGrinder.java | 11 +- .../client/gui/implementations/GuiIOPort.java | 9 +- .../gui/implementations/GuiInscriber.java | 23 ++-- .../gui/implementations/GuiInterface.java | 8 +- .../implementations/GuiInterfaceTerminal.java | 20 ++-- .../gui/implementations/GuiLevelEmitter.java | 10 +- .../client/gui/implementations/GuiMAC.java | 10 +- .../gui/implementations/GuiMEMonitorable.java | 39 +++--- .../implementations/GuiMEPortableCell.java | 13 +- .../gui/implementations/GuiNetworkStatus.java | 21 ++-- .../gui/implementations/GuiNetworkTool.java | 13 +- .../gui/implementations/GuiPatternTerm.java | 11 +- .../gui/implementations/GuiPriority.java | 18 +-- .../client/gui/implementations/GuiQNB.java | 11 +- .../gui/implementations/GuiQuartzKnife.java | 13 +- .../implementations/GuiSecurityStation.java | 20 ++-- .../gui/implementations/GuiSpatialIOPort.java | 13 +- .../gui/implementations/GuiStorageBus.java | 8 +- .../gui/implementations/GuiUpgradeable.java | 27 ++--- .../implementations/GuiVibrationChamber.java | 27 ++--- .../gui/implementations/GuiWireless.java | 19 ++- .../gui/implementations/GuiWirelessTerm.java | 17 +-- .../appeng/client/render/tesr/CrankTESR.java | 113 ++++++++++-------- .../client/render/tesr/InscriberTESR.java | 4 +- .../client/render/tesr/ModularTESR.java | 2 +- .../implementations/ContainerGrinder.java | 34 +++++- src/main/java/appeng/core/Registration.java | 6 + src/main/java/appeng/core/sync/GuiBridge.java | 1 - .../client/gui/widgets/GuiFluidTank.java | 2 +- .../java/appeng/items/parts/ItemFacade.java | 2 +- .../appeng/items/tools/ToolNetworkTool.java | 2 +- .../java/appeng/spatial/StorageHelper.java | 2 +- src/main/java/appeng/tile/AEBaseTile.java | 8 ++ .../appeng/tile/grindstone/TileCrank.java | 44 ++----- .../appeng/tile/grindstone/TileGrinder.java | 7 +- .../appeng/tile/qnb/TileQuantumBridge.java | 1 + src/main/java/appeng/util/Platform.java | 3 +- 65 files changed, 509 insertions(+), 495 deletions(-) diff --git a/build.gradle b/build.gradle index 7e451508e..d9b2f0e93 100644 --- a/build.gradle +++ b/build.gradle @@ -223,6 +223,9 @@ sourceSets { include 'appeng/block/grindstone/**' include 'appeng/tile/grindstone/**' include 'appeng/container/implementations/ContainerGrinder.java' + include 'appeng/client/render/tesr/CrankTESR.java' + include 'appeng/client/render/FacingToRotation.java' + include 'appeng/client/gui/implementations/GuiGrinder.java' } compileClasspath += sourceSets.api.output runtimeClasspath += sourceSets.api.output diff --git a/src/main/java/appeng/block/crafting/BlockCraftingUnit.java b/src/main/java/appeng/block/crafting/BlockCraftingUnit.java index 8f02b476d..63fdc3019 100644 --- a/src/main/java/appeng/block/crafting/BlockCraftingUnit.java +++ b/src/main/java/appeng/block/crafting/BlockCraftingUnit.java @@ -114,7 +114,7 @@ public class BlockCraftingUnit extends AEBaseTileBlock } @Override - public void neighborChanged( final BlockState state, final World worldIn, final BlockPos pos, final Block blockIn, final BlockPos fromPos ) + public void neighborChanged( final BlockState state, final World worldIn, final BlockPos pos, final Block blockIn, final BlockPos fromPos, boolean isMoving ) { final TileCraftingTile cp = this.getTileEntity( worldIn, pos ); if( cp != null ) diff --git a/src/main/java/appeng/block/grindstone/BlockCrank.java b/src/main/java/appeng/block/grindstone/BlockCrank.java index 2e605366f..afaf4af87 100644 --- a/src/main/java/appeng/block/grindstone/BlockCrank.java +++ b/src/main/java/appeng/block/grindstone/BlockCrank.java @@ -19,32 +19,35 @@ package appeng.block.grindstone; -import javax.annotation.Nullable; - -import net.minecraft.block.Block; -import net.minecraft.block.material.Material; -import net.minecraft.block.state.BlockFaceShape; -import net.minecraft.block.BlockState; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.ActionResultType; -import net.minecraft.util.EnumBlockRenderType; -import net.minecraft.util.Direction; -import net.minecraft.util.Hand; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.BlockRayTraceResult; -import net.minecraft.world.IBlockReader; -import net.minecraft.world.IWorldReader; -import net.minecraft.world.World; -import net.minecraftforge.common.util.FakePlayer; - import appeng.api.implementations.tiles.ICrankable; import appeng.block.AEBaseTileBlock; import appeng.core.stats.AeStats; import appeng.tile.AEBaseTile; import appeng.tile.grindstone.TileCrank; +import net.minecraft.block.Block; +import net.minecraft.block.BlockRenderType; +import net.minecraft.block.BlockState; +import net.minecraft.block.Blocks; +import net.minecraft.entity.LivingEntity; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.ActionResultType; +import net.minecraft.util.Direction; +import net.minecraft.util.Hand; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.BlockRayTraceResult; +import net.minecraft.util.math.shapes.ISelectionContext; +import net.minecraft.util.math.shapes.VoxelShape; +import net.minecraft.util.math.shapes.VoxelShapes; +import net.minecraft.world.IBlockReader; +import net.minecraft.world.IWorld; +import net.minecraft.world.IWorldReader; +import net.minecraft.world.World; +import net.minecraftforge.common.util.FakePlayer; + +import javax.annotation.Nullable; public class BlockCrank extends AEBaseTileBlock @@ -63,21 +66,22 @@ public class BlockCrank extends AEBaseTileBlock return ActionResultType.SUCCESS; } - final AEBaseTile tile = this.getTileEntity( w, pos ); - if( tile instanceof TileCrank ) + final TileCrank tile = this.getTileEntity( w, pos ); + if( tile != null ) { - if( ( (TileCrank) tile ).power() ) + if( tile.power() ) { AeStats.TurnedCranks.addToPlayer( player, 1 ); } + return ActionResultType.SUCCESS; } - return ActionResultType.SUCCESS; + return ActionResultType.PASS; } private void dropCrank( final World world, final BlockPos pos ) { - world.destroyBlock( pos, true ); // w.destroyBlock( x, y, z, true ); + world.destroyBlock( pos, true ); world.notifyBlockUpdate( pos, this.getDefaultState(), world.getBlockState( pos ), 3 ); } @@ -102,13 +106,13 @@ public class BlockCrank extends AEBaseTileBlock } @Override - public boolean isValidOrientation( final World w, final BlockPos pos, final Direction forward, final Direction up ) + public boolean isValidOrientation( final IWorld w, final BlockPos pos, final Direction forward, final Direction up ) { final TileEntity te = w.getTileEntity( pos ); return !( te instanceof TileCrank ) || this.isCrankable( w, pos, up.getOpposite() ); } - private Direction findCrankable( final World world, final BlockPos pos ) + private Direction findCrankable( final IBlockReader world, final BlockPos pos ) { for( final Direction dir : Direction.values() ) { @@ -120,7 +124,7 @@ public class BlockCrank extends AEBaseTileBlock return null; } - private boolean isCrankable( final World world, final BlockPos pos, final Direction offset ) + private boolean isCrankable( final IBlockReader world, final BlockPos pos, final Direction offset ) { final BlockPos o = pos.offset( offset ); final TileEntity te = world.getTileEntity( o ); @@ -129,15 +133,13 @@ public class BlockCrank extends AEBaseTileBlock } @Override - public EnumBlockRenderType getRenderType( BlockState state ) + public BlockRenderType getRenderType(BlockState state ) { - return EnumBlockRenderType.ENTITYBLOCK_ANIMATED; + return BlockRenderType.ENTITYBLOCK_ANIMATED; } @Override - public void neighborChanged( BlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos ) - { - + public void neighborChanged(BlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos, boolean isMoving) { final AEBaseTile tile = this.getTileEntity( world, pos ); if( tile != null ) { @@ -158,22 +160,24 @@ public class BlockCrank extends AEBaseTileBlock return this.findCrankable( w, pos ) != null; } - @Override - public boolean isFullCube( BlockState state ) - { - return false; + private Direction getUp(IBlockReader world, BlockPos pos) { + TileCrank crank = getTileEntity(world, pos); + return crank != null ? crank.getUp() : null; } @Override - public boolean canPlaceTorchOnTop( BlockState state, IBlockReader world, BlockPos pos ) - { - return false; - } + public VoxelShape getShape(BlockState state, IBlockReader world, BlockPos pos, ISelectionContext context) { + Direction up = getUp(world, pos); - @Override - public BlockFaceShape getBlockFaceShape( IBlockReader worldIn, BlockState state, BlockPos pos, Direction face ) - { - return BlockFaceShape.UNDEFINED; - } + if (up == null) { + return VoxelShapes.empty(); + } else { + // FIXME: Cache per direction, and build it 'precise', not just from AABB + final double xOff = -0.15 * up.getXOffset(); + final double yOff = -0.15 * up.getYOffset(); + final double zOff = -0.15 * up.getZOffset(); + return VoxelShapes.create(new AxisAlignedBB(xOff + 0.15, yOff + 0.15, zOff + 0.15, xOff + 0.85, yOff + 0.85, zOff + 0.85)); + } + } } diff --git a/src/main/java/appeng/block/grindstone/BlockGrinder.java b/src/main/java/appeng/block/grindstone/BlockGrinder.java index 8c0ff313a..4ede2e0bb 100644 --- a/src/main/java/appeng/block/grindstone/BlockGrinder.java +++ b/src/main/java/appeng/block/grindstone/BlockGrinder.java @@ -20,8 +20,10 @@ package appeng.block.grindstone; import appeng.block.AEBaseTileBlock; +import appeng.container.implementations.ContainerGrinder; import appeng.tile.grindstone.TileGrinder; import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.entity.player.ServerPlayerEntity; import net.minecraft.item.ItemStack; import net.minecraft.util.ActionResultType; import net.minecraft.util.Hand; @@ -45,7 +47,9 @@ public class BlockGrinder extends AEBaseTileBlock final TileGrinder tg = this.getTileEntity( w, pos ); if( tg != null && !p.isCrouching() ) { - // FIXME Platform.openGUI( p, tg, AEPartLocation.fromFacing(hit.getFace()), GuiBridge.GUI_GRINDER ); + if (p instanceof ServerPlayerEntity) { + ContainerGrinder.open((ServerPlayerEntity) p, tg, getNameTextComponent()); + } return ActionResultType.SUCCESS; } return ActionResultType.PASS; diff --git a/src/main/java/appeng/block/misc/BlockInscriber.java b/src/main/java/appeng/block/misc/BlockInscriber.java index 847da862b..ee5fbeae4 100644 --- a/src/main/java/appeng/block/misc/BlockInscriber.java +++ b/src/main/java/appeng/block/misc/BlockInscriber.java @@ -26,7 +26,7 @@ import net.minecraft.block.BlockState; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; import net.minecraft.util.ActionResultType; -import net.minecraft.util.EnumBlockRenderType; +import net.minecraft.util.BlockRenderType; import net.minecraft.util.Hand; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockRayTraceResult; @@ -71,9 +71,9 @@ public class BlockInscriber extends AEBaseTileBlock } @Override - public EnumBlockRenderType getRenderType( BlockState state ) + public BlockRenderType getRenderType( BlockState state ) { - return EnumBlockRenderType.MODEL; + return BlockRenderType.MODEL; } @Override diff --git a/src/main/java/appeng/block/misc/BlockLightDetector.java b/src/main/java/appeng/block/misc/BlockLightDetector.java index 72eeab672..7ed8e5654 100644 --- a/src/main/java/appeng/block/misc/BlockLightDetector.java +++ b/src/main/java/appeng/block/misc/BlockLightDetector.java @@ -35,6 +35,7 @@ import net.minecraft.util.Direction; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockReader; +import net.minecraft.world.IWorld; import net.minecraft.world.IWorldReader; import net.minecraft.world.World; import net.minecraftforge.api.distmarker.Dist; @@ -116,7 +117,7 @@ public class BlockLightDetector extends AEBaseTileBlock implements IOrientableBl } @Override - public boolean isValidOrientation( final World w, final BlockPos pos, final Direction forward, final Direction up ) + public boolean isValidOrientation(final IWorld w, final BlockPos pos, final Direction forward, final Direction up ) { return this.canPlaceAt( w, pos, up.getOpposite() ); } @@ -148,7 +149,7 @@ public class BlockLightDetector extends AEBaseTileBlock implements IOrientableBl } @Override - public void neighborChanged( BlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos ) + public void neighborChanged( BlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos, boolean isMoving ) { final Direction up = this.getOrientable( world, pos ).getUp(); if( !this.canPlaceAt( world, pos, up.getOpposite() ) ) diff --git a/src/main/java/appeng/block/misc/BlockQuartzFixture.java b/src/main/java/appeng/block/misc/BlockQuartzFixture.java index a9b3804ba..75e61279a 100644 --- a/src/main/java/appeng/block/misc/BlockQuartzFixture.java +++ b/src/main/java/appeng/block/misc/BlockQuartzFixture.java @@ -125,11 +125,12 @@ public class BlockQuartzFixture extends AEBaseBlock implements IOrientableBlock return state; } -// FIXME @Override -// FIXME public boolean isValidOrientation( final World w, final BlockPos pos, final Direction forward, final Direction up ) -// FIXME { -// FIXME return this.canPlaceAt( w, pos, up.getOpposite() ); -// FIXME } + @Override + public boolean isValidOrientation( final IWorld w, final BlockPos pos, final Direction forward, final Direction up ) + { + // FIXME: I think this entire method -> not required, but not sure... are quartz fixtures rotateable??? + return this.canPlaceAt( w, pos, up.getOpposite() ); + } private boolean canPlaceAt( final IWorldReader w, final BlockPos pos, final Direction dir ) { @@ -172,16 +173,16 @@ public class BlockQuartzFixture extends AEBaseBlock implements IOrientableBlock } // FIXME: Replaced by the postPlaceupdate stuff above, but check item drops! -// @Override -// public void neighborChanged( BlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos ) -// { -// final Direction up = this.getOrientable( world, pos ).getUp(); -// if( !this.canPlaceAt( world, pos, up.getOpposite() ) ) -// { -// this.dropTorch( world, pos ); -// } -// } -// + @Override + public void neighborChanged( BlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos, boolean isMoving ) + { + final Direction up = this.getOrientable( world, pos ).getUp(); + if( !this.canPlaceAt( world, pos, up.getOpposite() ) ) + { + this.dropTorch( world, pos ); + } + } + private void dropTorch( final World w, final BlockPos pos ) { final BlockState prev = w.getBlockState( pos ); diff --git a/src/main/java/appeng/block/misc/BlockSkyCompass.java b/src/main/java/appeng/block/misc/BlockSkyCompass.java index 8fab788a9..de17fcde5 100644 --- a/src/main/java/appeng/block/misc/BlockSkyCompass.java +++ b/src/main/java/appeng/block/misc/BlockSkyCompass.java @@ -27,10 +27,11 @@ import net.minecraft.block.material.Material; import net.minecraft.block.BlockStateContainer; import net.minecraft.block.BlockState; import net.minecraft.entity.Entity; -import net.minecraft.util.EnumBlockRenderType; +import net.minecraft.util.BlockRenderType; import net.minecraft.util.Direction; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; +import net.minecraft.world.IWorld; import net.minecraft.world.IWorldReader; import net.minecraft.world.World; import net.minecraftforge.common.property.ExtendedBlockState; @@ -63,7 +64,7 @@ public class BlockSkyCompass extends AEBaseTileBlock implements ICustomCollision } @Override - public boolean isValidOrientation( final World w, final BlockPos pos, final Direction forward, final Direction up ) + public boolean isValidOrientation(final IWorld w, final BlockPos pos, final Direction forward, final Direction up ) { final TileSkyCompass sc = this.getTileEntity( w, pos ); if( sc != null ) @@ -79,7 +80,7 @@ public class BlockSkyCompass extends AEBaseTileBlock implements ICustomCollision } @Override - public void neighborChanged( BlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos ) + public void neighborChanged( BlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos, boolean isMoving ) { final TileSkyCompass sc = this.getTileEntity( world, pos ); final Direction forward = sc.getForward(); @@ -178,9 +179,9 @@ public class BlockSkyCompass extends AEBaseTileBlock implements ICustomCollision } @Override - public EnumBlockRenderType getRenderType( BlockState state ) + public BlockRenderType getRenderType( BlockState state ) { - return EnumBlockRenderType.ENTITYBLOCK_ANIMATED; + return BlockRenderType.ENTITYBLOCK_ANIMATED; } @Override diff --git a/src/main/java/appeng/block/misc/BlockTinyTNT.java b/src/main/java/appeng/block/misc/BlockTinyTNT.java index 1a23cf2b2..159b206ec 100644 --- a/src/main/java/appeng/block/misc/BlockTinyTNT.java +++ b/src/main/java/appeng/block/misc/BlockTinyTNT.java @@ -101,7 +101,7 @@ public class BlockTinyTNT extends AEBaseBlock implements ICustomCollision } @Override - public void neighborChanged( BlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos ) + public void neighborChanged( BlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos, boolean isMoving ) { if( world.isBlockIndirectlyGettingPowered( pos ) > 0 ) { diff --git a/src/main/java/appeng/block/networking/BlockCableBus.java b/src/main/java/appeng/block/networking/BlockCableBus.java index 42fbc5628..b79236cb1 100644 --- a/src/main/java/appeng/block/networking/BlockCableBus.java +++ b/src/main/java/appeng/block/networking/BlockCableBus.java @@ -342,7 +342,7 @@ public class BlockCableBus extends AEBaseTileBlock implements IAEFacade } @Override - public void neighborChanged( BlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos ) + public void neighborChanged( BlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos, boolean isMoving ) { if( Platform.isServer() ) { diff --git a/src/main/java/appeng/block/networking/BlockController.java b/src/main/java/appeng/block/networking/BlockController.java index 466b1a601..280bb811d 100644 --- a/src/main/java/appeng/block/networking/BlockController.java +++ b/src/main/java/appeng/block/networking/BlockController.java @@ -173,7 +173,7 @@ public class BlockController extends AEBaseTileBlock } @Override - public void neighborChanged( BlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos ) + public void neighborChanged( BlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos, boolean isMoving ) { final TileController tc = this.getTileEntity( world, pos ); if( tc != null ) diff --git a/src/main/java/appeng/block/paint/BlockPaint.java b/src/main/java/appeng/block/paint/BlockPaint.java index 0f747cdd6..c2c7b10fa 100644 --- a/src/main/java/appeng/block/paint/BlockPaint.java +++ b/src/main/java/appeng/block/paint/BlockPaint.java @@ -112,7 +112,7 @@ public class BlockPaint extends AEBaseTileBlock } @Override - public void neighborChanged( BlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos ) + public void neighborChanged( BlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos, boolean isMoving ) { final TilePaint tp = this.getTileEntity( world, pos ); diff --git a/src/main/java/appeng/block/qnb/BlockQuantumBase.java b/src/main/java/appeng/block/qnb/BlockQuantumBase.java index 6c7c47e0c..1babf2dd4 100644 --- a/src/main/java/appeng/block/qnb/BlockQuantumBase.java +++ b/src/main/java/appeng/block/qnb/BlockQuantumBase.java @@ -101,7 +101,7 @@ public abstract class BlockQuantumBase extends AEBaseTileBlock implements ICusto } @Override - public void neighborChanged( BlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos ) + public void neighborChanged( BlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos, boolean isMoving ) { final TileQuantumBridge bridge = this.getTileEntity( world, pos ); if( bridge != null ) diff --git a/src/main/java/appeng/block/spatial/BlockSpatialIOPort.java b/src/main/java/appeng/block/spatial/BlockSpatialIOPort.java index 39681fd03..afb338828 100644 --- a/src/main/java/appeng/block/spatial/BlockSpatialIOPort.java +++ b/src/main/java/appeng/block/spatial/BlockSpatialIOPort.java @@ -48,7 +48,7 @@ public class BlockSpatialIOPort extends AEBaseTileBlock } @Override - public void neighborChanged( BlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos ) + public void neighborChanged( BlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos, boolean isMoving ) { final TileSpatialIOPort te = this.getTileEntity( world, pos ); if( te != null ) diff --git a/src/main/java/appeng/block/spatial/BlockSpatialPylon.java b/src/main/java/appeng/block/spatial/BlockSpatialPylon.java index 685ee5e5b..06b3c42bf 100644 --- a/src/main/java/appeng/block/spatial/BlockSpatialPylon.java +++ b/src/main/java/appeng/block/spatial/BlockSpatialPylon.java @@ -61,7 +61,7 @@ public class BlockSpatialPylon extends AEBaseTileBlock } @Override - public void neighborChanged( BlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos ) + public void neighborChanged( BlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos, boolean isMoving ) { final TileSpatialPylon tsp = this.getTileEntity( world, pos ); if( tsp != null ) diff --git a/src/main/java/appeng/block/storage/BlockIOPort.java b/src/main/java/appeng/block/storage/BlockIOPort.java index d643161a8..2d008e80f 100644 --- a/src/main/java/appeng/block/storage/BlockIOPort.java +++ b/src/main/java/appeng/block/storage/BlockIOPort.java @@ -48,7 +48,7 @@ public class BlockIOPort extends AEBaseTileBlock } @Override - public void neighborChanged( BlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos ) + public void neighborChanged( BlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos, boolean isMoving ) { final TileIOPort te = this.getTileEntity( world, pos ); if( te != null ) diff --git a/src/main/java/appeng/client/gui/AEBaseGui.java b/src/main/java/appeng/client/gui/AEBaseGui.java index 78fc977c3..f6ff860ac 100644 --- a/src/main/java/appeng/client/gui/AEBaseGui.java +++ b/src/main/java/appeng/client/gui/AEBaseGui.java @@ -75,7 +75,6 @@ import java.util.*; import java.util.concurrent.TimeUnit; -//TODO, pass generic up here for Container public abstract class AEBaseGui extends ContainerScreen { private final List meSlots = new ArrayList<>(); diff --git a/src/main/java/appeng/client/gui/AEBaseMEGui.java b/src/main/java/appeng/client/gui/AEBaseMEGui.java index 99516f781..ef8058b68 100644 --- a/src/main/java/appeng/client/gui/AEBaseMEGui.java +++ b/src/main/java/appeng/client/gui/AEBaseMEGui.java @@ -23,9 +23,12 @@ import java.text.NumberFormat; import java.util.List; import java.util.Locale; +import appeng.container.AEBaseContainer; +import net.minecraft.entity.player.PlayerInventory; import net.minecraft.inventory.container.Container; import net.minecraft.inventory.container.Slot; import net.minecraft.item.ItemStack; +import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.TextFormatting; import appeng.api.storage.data.IAEItemStack; @@ -34,12 +37,11 @@ import appeng.core.AEConfig; import appeng.core.localization.ButtonToolTips; -public abstract class AEBaseMEGui extends AEBaseGui +public abstract class AEBaseMEGui extends AEBaseGui { - public AEBaseMEGui( final Container container ) - { - super( container ); + public AEBaseMEGui(T container, PlayerInventory playerInventory, ITextComponent title) { + super(container, playerInventory, title); } @Override diff --git a/src/main/java/appeng/client/gui/implementations/GuiCellWorkbench.java b/src/main/java/appeng/client/gui/implementations/GuiCellWorkbench.java index 13cdbf202..f81044d39 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiCellWorkbench.java +++ b/src/main/java/appeng/client/gui/implementations/GuiCellWorkbench.java @@ -21,6 +21,9 @@ package appeng.client.gui.implementations; import java.io.IOException; +import appeng.api.implementations.IUpgradeableHost; +import net.minecraft.util.text.ITextComponent; +import net.minecraftforge.fml.client.gui.GuiUtils; import org.lwjgl.input.Mouse; import net.minecraft.client.gui.GuiButton; @@ -44,19 +47,15 @@ import appeng.tile.misc.TileCellWorkbench; import appeng.util.Platform; -public class GuiCellWorkbench extends GuiUpgradeable +public class GuiCellWorkbench extends GuiUpgradeable { - private final ContainerCellWorkbench workbench; - private GuiImgButton clear; private GuiImgButton partition; private GuiToggleButton copyMode; - public GuiCellWorkbench( final PlayerInventory PlayerInventory, final TileCellWorkbench te ) - { - super( new ContainerCellWorkbench( PlayerInventory, te ) ); - this.workbench = (ContainerCellWorkbench) this.inventorySlots; + public GuiCellWorkbench(ContainerCellWorkbench container, PlayerInventory playerInventory, ITextComponent title) { + super(container, playerInventory, title); this.ySize = 251; } @@ -81,63 +80,63 @@ public class GuiCellWorkbench extends GuiUpgradeable this.handleButtonVisibility(); this.bindTexture( this.getBackground() ); - this.drawTexturedModalRect( offsetX, offsetY, 0, 0, 211 - 34, this.ySize ); + GuiUtils.drawTexturedModalRect( offsetX, offsetY, 0, 0, 211 - 34, this.ySize, 0 /* FIXME this.zlevel was used */ ); if( this.drawUpgrades() ) { - if( this.workbench.availableUpgrades() <= 8 ) + if( this.container.availableUpgrades() <= 8 ) { - this.drawTexturedModalRect( offsetX + 177, offsetY, 177, 0, 35, 7 + this.workbench.availableUpgrades() * 18 ); - this.drawTexturedModalRect( offsetX + 177, offsetY + ( 7 + ( this.workbench.availableUpgrades() ) * 18 ), 177, 151, 35, 7 ); + GuiUtils.drawTexturedModalRect( offsetX + 177, offsetY, 177, 0, 35, 7 + this.container.availableUpgrades() * 18, 0 /* FIXME this.zlevel was used */ ); + GuiUtilsGuiUtils.drawTexturedModalRect( offsetX + 177, offsetY + ( 7 + ( this.container.availableUpgrades() ) * 18 ), 177, 151, 35, 7, 0 /* FIXME this.zlevel was used */ ); } - else if( this.workbench.availableUpgrades() <= 16 ) + else if( this.container.availableUpgrades() <= 16 ) { - this.drawTexturedModalRect( offsetX + 177, offsetY, 177, 0, 35, 7 + 8 * 18 ); - this.drawTexturedModalRect( offsetX + 177, offsetY + ( 7 + ( 8 ) * 18 ), 177, 151, 35, 7 ); + GuiUtils.drawTexturedModalRect( offsetX + 177, offsetY, 177, 0, 35, 7 + 8 * 18, 0 /* FIXME this.zlevel was used */ ); + GuiUtils.drawTexturedModalRect( offsetX + 177, offsetY + ( 7 + ( 8 ) * 18 ), 177, 151, 35, 7, 0 /* FIXME this.zlevel was used */ ); - final int dx = this.workbench.availableUpgrades() - 8; - this.drawTexturedModalRect( offsetX + 177 + 27, offsetY, 186, 0, 35 - 8, 7 + dx * 18 ); + final int dx = this.container.availableUpgrades() - 8; + GuiUtils.drawTexturedModalRect( offsetX + 177 + 27, offsetY, 186, 0, 35 - 8, 7 + dx * 18, 0 /* FIXME this.zlevel was used */ ); if( dx == 8 ) { - this.drawTexturedModalRect( offsetX + 177 + 27, offsetY + ( 7 + ( dx ) * 18 ), 186, 151, 35 - 8, 7 ); + GuiUtils.drawTexturedModalRect( offsetX + 177 + 27, offsetY + ( 7 + ( dx ) * 18 ), 186, 151, 35 - 8, 7, 0 /* FIXME this.zlevel was used */ ); } else { - this.drawTexturedModalRect( offsetX + 177 + 27 + 4, offsetY + ( 7 + ( dx ) * 18 ), 186 + 4, 151, 35 - 8, 7 ); + GuiUtils.drawTexturedModalRect( offsetX + 177 + 27 + 4, offsetY + ( 7 + ( dx ) * 18 ), 186 + 4, 151, 35 - 8, 7, 0 /* FIXME this.zlevel was used */ ); } } else { - this.drawTexturedModalRect( offsetX + 177, offsetY, 177, 0, 35, 7 + 8 * 18 ); - this.drawTexturedModalRect( offsetX + 177, offsetY + ( 7 + ( 8 ) * 18 ), 177, 151, 35, 7 ); + GuiUtils.drawTexturedModalRect( offsetX + 177, offsetY, 177, 0, 35, 7 + 8 * 18, 0 /* FIXME this.zlevel was used */ ); + GuiUtils.drawTexturedModalRect( offsetX + 177, offsetY + ( 7 + ( 8 ) * 18 ), 177, 151, 35, 7, 0 /* FIXME this.zlevel was used */ ); - this.drawTexturedModalRect( offsetX + 177 + 27, offsetY, 186, 0, 35 - 8, 7 + 8 * 18 ); - this.drawTexturedModalRect( offsetX + 177 + 27, offsetY + ( 7 + ( 8 ) * 18 ), 186, 151, 35 - 8, 7 ); + GuiUtils.drawTexturedModalRect( offsetX + 177 + 27, offsetY, 186, 0, 35 - 8, 7 + 8 * 18, 0 /* FIXME this.zlevel was used */ ); + GuiUtils.drawTexturedModalRect( offsetX + 177 + 27, offsetY + ( 7 + ( 8 ) * 18 ), 186, 151, 35 - 8, 7, 0 /* FIXME this.zlevel was used */ ); - final int dx = this.workbench.availableUpgrades() - 16; - this.drawTexturedModalRect( offsetX + 177 + 27 + 18, offsetY, 186, 0, 35 - 8, 7 + dx * 18 ); + final int dx = this.container.availableUpgrades() - 16; + GuiUtils.drawTexturedModalRect( offsetX + 177 + 27 + 18, offsetY, 186, 0, 35 - 8, 7 + dx * 18, 0 /* FIXME this.zlevel was used */ ); if( dx == 8 ) { - this.drawTexturedModalRect( offsetX + 177 + 27 + 18, offsetY + ( 7 + ( dx ) * 18 ), 186, 151, 35 - 8, 7 ); + GuiUtils.drawTexturedModalRect( offsetX + 177 + 27 + 18, offsetY + ( 7 + ( dx ) * 18 ), 186, 151, 35 - 8, 7, 0 /* FIXME this.zlevel was used */ ); } else { - this.drawTexturedModalRect( offsetX + 177 + 27 + 18 + 4, offsetY + ( 7 + ( dx ) * 18 ), 186 + 4, 151, 35 - 8, 7 ); + GuiUtils.drawTexturedModalRect( offsetX + 177 + 27 + 18 + 4, offsetY + ( 7 + ( dx ) * 18 ), 186 + 4, 151, 35 - 8, 7, 0 /* FIXME this.zlevel was used */ ); } } } if( this.hasToolbox() ) { - this.drawTexturedModalRect( offsetX + 178, offsetY + this.ySize - 90, 178, 161, 68, 68 ); + GuiUtils.drawTexturedModalRect( offsetX + 178, offsetY + this.ySize - 90, 178, 161, 68, 68, 0 /* FIXME this.zlevel was used */ ); } } @Override protected void handleButtonVisibility() { - this.copyMode.setState( this.workbench.getCopyMode() == CopyMode.CLEAR_ON_REMOVE ); + this.copyMode.setState( this.container.getCopyMode() == CopyMode.CLEAR_ON_REMOVE ); boolean hasFuzzy = false; - final IItemHandler inv = this.workbench.getCellUpgradeInventory(); + final IItemHandler inv = this.container.getCellUpgradeInventory(); for( int x = 0; x < inv.getSlots(); x++ ) { final ItemStack is = inv.getStackInSlot( x ); @@ -161,7 +160,7 @@ public class GuiCellWorkbench extends GuiUpgradeable @Override protected boolean drawUpgrades() { - return this.workbench.availableUpgrades() > 0; + return this.container.availableUpgrades() > 0; } @Override diff --git a/src/main/java/appeng/client/gui/implementations/GuiChest.java b/src/main/java/appeng/client/gui/implementations/GuiChest.java index a4228837a..cd2b44754 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiChest.java +++ b/src/main/java/appeng/client/gui/implementations/GuiChest.java @@ -32,16 +32,17 @@ import appeng.core.sync.GuiBridge; import appeng.core.sync.network.NetworkHandler; import appeng.core.sync.packets.PacketSwitchGuis; import appeng.tile.storage.TileChest; +import net.minecraft.util.text.ITextComponent; +import net.minecraftforge.fml.client.gui.GuiUtils; -public class GuiChest extends AEBaseGui +public class GuiChest extends AEBaseGui { private GuiTabButton priority; - public GuiChest( final PlayerInventory PlayerInventory, final TileChest te ) - { - super( new ContainerChest( PlayerInventory, te ) ); + public GuiChest(ContainerChest container, PlayerInventory playerInventory, ITextComponent title) { + super(container, playerInventory, title); this.ySize = 166; } @@ -75,6 +76,6 @@ public class GuiChest extends AEBaseGui public void drawBG( final int offsetX, final int offsetY, final int mouseX, final int mouseY ) { this.bindTexture( "guis/chest.png" ); - this.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize ); + GuiUtils.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize, 0 /* FIXME this.zlevel was used */ ); } } diff --git a/src/main/java/appeng/client/gui/implementations/GuiCondenser.java b/src/main/java/appeng/client/gui/implementations/GuiCondenser.java index 3378378ee..0720e7076 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiCondenser.java +++ b/src/main/java/appeng/client/gui/implementations/GuiCondenser.java @@ -21,6 +21,8 @@ package appeng.client.gui.implementations; import java.io.IOException; +import net.minecraft.util.text.ITextComponent; +import net.minecraftforge.fml.client.gui.GuiUtils; import org.lwjgl.input.Mouse; import net.minecraft.client.gui.GuiButton; @@ -38,17 +40,14 @@ import appeng.core.sync.packets.PacketConfigButton; import appeng.tile.misc.TileCondenser; -public class GuiCondenser extends AEBaseGui +public class GuiCondenser extends AEBaseGui { - private final ContainerCondenser cvc; private GuiProgressBar pb; private GuiImgButton mode; - public GuiCondenser( final PlayerInventory PlayerInventory, final TileCondenser te ) - { - super( new ContainerCondenser( PlayerInventory, te ) ); - this.cvc = (ContainerCondenser) this.inventorySlots; + public GuiCondenser(ContainerCondenser container, PlayerInventory playerInventory, ITextComponent title) { + super(container, playerInventory, title); this.ySize = 197; } @@ -70,10 +69,10 @@ public class GuiCondenser extends AEBaseGui { super.init(); - this.pb = new GuiProgressBar( this.cvc, "guis/condenser.png", 120 + this.guiLeft, 25 + this.guiTop, 178, 25, 6, 18, Direction.VERTICAL, GuiText.StoredEnergy + this.pb = new GuiProgressBar( this.container, "guis/condenser.png", 120 + this.guiLeft, 25 + this.guiTop, 178, 25, 6, 18, Direction.VERTICAL, GuiText.StoredEnergy .getLocal() ); - this.mode = new GuiImgButton( 128 + this.guiLeft, 52 + this.guiTop, Settings.CONDENSER_OUTPUT, this.cvc.getOutput() ); + this.mode = new GuiImgButton( 128 + this.guiLeft, 52 + this.guiTop, Settings.CONDENSER_OUTPUT, this.container.getOutput() ); this.addButton( this.pb ); this.addButton( this.mode ); @@ -85,8 +84,8 @@ public class GuiCondenser extends AEBaseGui this.font.drawString( this.getGuiDisplayName( GuiText.Condenser.getLocal() ), 8, 6, 4210752 ); this.font.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 ); - this.mode.set( this.cvc.getOutput() ); - this.mode.setFillVar( String.valueOf( this.cvc.getOutput().requiredPower ) ); + this.mode.set( this.container.getOutput() ); + this.mode.setFillVar( String.valueOf( this.container.getOutput().requiredPower ) ); } @Override @@ -94,6 +93,6 @@ public class GuiCondenser extends AEBaseGui { this.bindTexture( "guis/condenser.png" ); - this.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize ); + GuiUtils.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize, 0 /* FIXME this.zlevel was used */ ); } } diff --git a/src/main/java/appeng/client/gui/implementations/GuiCraftAmount.java b/src/main/java/appeng/client/gui/implementations/GuiCraftAmount.java index 29a5a6564..d21bb5ee1 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiCraftAmount.java +++ b/src/main/java/appeng/client/gui/implementations/GuiCraftAmount.java @@ -21,6 +21,7 @@ package appeng.client.gui.implementations; import java.io.IOException; +import appeng.core.Api; import net.minecraft.client.gui.GuiButton; import net.minecraft.entity.player.PlayerInventory; import net.minecraft.item.ItemStack; @@ -44,9 +45,11 @@ import appeng.helpers.WirelessTerminalGuiObject; import appeng.parts.reporting.PartCraftingTerminal; import appeng.parts.reporting.PartPatternTerminal; import appeng.parts.reporting.PartTerminal; +import net.minecraft.util.text.ITextComponent; +import net.minecraftforge.fml.client.gui.GuiUtils; -public class GuiCraftAmount extends AEBaseGui +public class GuiCraftAmount extends AEBaseGui { private GuiNumberBox amountToCraft; private GuiTabButton originalGuiBtn; @@ -64,10 +67,8 @@ public class GuiCraftAmount extends AEBaseGui private GuiBridge originalGui; - @Reflected - public GuiCraftAmount( final PlayerInventory PlayerInventory, final ITerminalHost te ) - { - super( new ContainerCraftAmount( PlayerInventory, te ) ); + public GuiCraftAmount(ContainerCraftAmount container, PlayerInventory playerInventory, ITextComponent title) { + super(container, playerInventory, title); } @Override @@ -93,7 +94,7 @@ public class GuiCraftAmount extends AEBaseGui this.addButton( this.next = new GuiButton( 0, this.guiLeft + 128, this.guiTop + 51, 38, 20, GuiText.Next.getLocal() ) ); ItemStack myIcon = null; - final Object target = ( (AEBaseContainer) this.inventorySlots ).getTarget(); + final Object target = this.container.getTarget(); final IDefinitions definitions = Api.INSTANCE.definitions(); final IParts parts = definitions.parts(); @@ -148,7 +149,7 @@ public class GuiCraftAmount extends AEBaseGui this.next.displayString = hasShiftDown() ? GuiText.Start.getLocal() : GuiText.Next.getLocal(); this.bindTexture( "guis/craft_amt.png" ); - this.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize ); + GuiUtils.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize, 0 /* FIXME this.zlevel was used */ ); try { diff --git a/src/main/java/appeng/client/gui/implementations/GuiCraftConfirm.java b/src/main/java/appeng/client/gui/implementations/GuiCraftConfirm.java index 59d94ccce..44585e557 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiCraftConfirm.java +++ b/src/main/java/appeng/client/gui/implementations/GuiCraftConfirm.java @@ -25,8 +25,12 @@ import java.util.ArrayList; import java.util.Iterator; import java.util.List; +import appeng.core.Api; import com.google.common.base.Joiner; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.text.ITextComponent; +import net.minecraftforge.fml.client.gui.GuiUtils; import org.lwjgl.input.Mouse; import net.minecraft.client.gui.GuiButton; @@ -54,11 +58,9 @@ import appeng.parts.reporting.PartTerminal; import appeng.util.Platform; -public class GuiCraftConfirm extends AEBaseGui +public class GuiCraftConfirm extends AEBaseGui { - private final ContainerCraftConfirm ccc; - private final int rows = 5; private final IItemList storage = Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ).createList(); @@ -73,17 +75,15 @@ public class GuiCraftConfirm extends AEBaseGui private GuiButton selectCPU; private int tooltip = -1; - public GuiCraftConfirm( final PlayerInventory PlayerInventory, final ITerminalHost te ) - { - super( new ContainerCraftConfirm( PlayerInventory, te ) ); + public GuiCraftConfirm(ContainerCraftConfirm container, PlayerInventory playerInventory, ITextComponent title) { + super(container, playerInventory, title); this.xSize = 238; this.ySize = 206; final GuiScrollbar scrollbar = new GuiScrollbar(); this.setScrollBar( scrollbar ); - this.ccc = (ContainerCraftConfirm) this.inventorySlots; - + Object te = container.getTarget(); if( te instanceof WirelessTerminalGuiObject ) { this.OriginalGui = GuiBridge.GUI_WIRELESS_TERM; @@ -107,7 +107,7 @@ public class GuiCraftConfirm extends AEBaseGui boolean isAutoStart() { - return ( (ContainerCraftConfirm) this.inventorySlots ).isAutoStart(); + return ( (ContainerCraftConfirm) this.container ).isAutoStart(); } @Override @@ -137,7 +137,7 @@ public class GuiCraftConfirm extends AEBaseGui { this.updateCPUButtonText(); - this.start.enabled = !( this.ccc.hasNoCPU() || this.isSimulation() ); + this.start.enabled = !( this.container.hasNoCPU() || this.isSimulation() ); this.selectCPU.enabled = !this.isSimulation(); final int gx = ( this.width - this.xSize ) / 2; @@ -177,20 +177,20 @@ public class GuiCraftConfirm extends AEBaseGui private void updateCPUButtonText() { String btnTextText = GuiText.CraftingCPU.getLocal() + ": " + GuiText.Automatic.getLocal(); - if( this.ccc.getSelectedCpu() >= 0 )// && status.selectedCpu < status.cpus.size() ) + if( this.container.getSelectedCpu() >= 0 )// && status.selectedCpu < status.cpus.size() ) { - if( this.ccc.getName().length() > 0 ) + if( this.container.getName().length() > 0 ) { - final String name = this.ccc.getName().substring( 0, Math.min( 20, this.ccc.getName().length() ) ); + final String name = this.container.getName().substring( 0, Math.min( 20, this.container.getName().length() ) ); btnTextText = GuiText.CraftingCPU.getLocal() + ": " + name; } else { - btnTextText = GuiText.CraftingCPU.getLocal() + ": #" + this.ccc.getSelectedCpu(); + btnTextText = GuiText.CraftingCPU.getLocal() + ": #" + this.container.getSelectedCpu(); } } - if( this.ccc.hasNoCPU() ) + if( this.container.hasNoCPU() ) { btnTextText = GuiText.NoCraftingCPUs.getLocal(); } @@ -200,13 +200,13 @@ public class GuiCraftConfirm extends AEBaseGui private boolean isSimulation() { - return ( (ContainerCraftConfirm) this.inventorySlots ).isSimulation(); + return ( (ContainerCraftConfirm) this.container ).isSimulation(); } @Override public void drawFG( final int offsetX, final int offsetY, final int mouseX, final int mouseY ) { - final long BytesUsed = this.ccc.getUsedBytes(); + final long BytesUsed = this.container.getUsedBytes(); final String byteUsed = NumberFormat.getInstance().format( BytesUsed ); final String Add = BytesUsed > 0 ? ( byteUsed + ' ' + GuiText.BytesUsed.getLocal() ) : GuiText.CalculatingWait.getLocal(); this.font.drawString( GuiText.CraftingPlan.getLocal() + " - " + Add, 8, 7, 4210752 ); @@ -219,8 +219,8 @@ public class GuiCraftConfirm extends AEBaseGui } else { - dsp = this.ccc.getCpuAvailableBytes() > 0 ? ( GuiText.Bytes.getLocal() + ": " + this.ccc.getCpuAvailableBytes() + " : " + GuiText.CoProcessors - .getLocal() + ": " + this.ccc.getCpuCoProcessors() ) : GuiText.Bytes.getLocal() + ": N/A : " + GuiText.CoProcessors.getLocal() + ": N/A"; + dsp = this.container.getCpuAvailableBytes() > 0 ? ( GuiText.Bytes.getLocal() + ": " + this.container.getCpuAvailableBytes() + " : " + GuiText.CoProcessors + .getLocal() + ": " + this.container.getCpuCoProcessors() ) : GuiText.Bytes.getLocal() + ": N/A : " + GuiText.CoProcessors.getLocal() + ": N/A"; } final int offset = ( 219 - this.font.getStringWidth( dsp ) ) / 2; @@ -396,7 +396,7 @@ public class GuiCraftConfirm extends AEBaseGui { this.setScrollBar(); this.bindTexture( "guis/craftingreport.png" ); - this.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize ); + GuiUtils.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize, 0 /* FIXME this.zlevel was used */ ); } private void setScrollBar() diff --git a/src/main/java/appeng/client/gui/implementations/GuiCraftingCPU.java b/src/main/java/appeng/client/gui/implementations/GuiCraftingCPU.java index 8373f2e14..871752187 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiCraftingCPU.java +++ b/src/main/java/appeng/client/gui/implementations/GuiCraftingCPU.java @@ -25,8 +25,11 @@ import java.util.Iterator; import java.util.List; import java.util.concurrent.TimeUnit; +import appeng.core.Api; import com.google.common.base.Joiner; +import net.minecraft.util.text.ITextComponent; +import net.minecraftforge.fml.client.gui.GuiUtils; import org.apache.commons.lang3.time.DurationFormatUtils; import net.minecraft.client.gui.GuiButton; @@ -54,7 +57,7 @@ import appeng.util.Platform; import appeng.util.ReadableNumberConverter; -public class GuiCraftingCPU extends AEBaseGui implements ISortSource +public class GuiCraftingCPU extends AEBaseGui implements ISortSource { private static final int GUI_HEIGHT = 184; private static final int GUI_WIDTH = 238; @@ -81,8 +84,6 @@ public class GuiCraftingCPU extends AEBaseGui implements ISortSource private static final int ITEMSTACK_LEFT_OFFSET = 9; private static final int ITEMSTACK_TOP_OFFSET = 22; - private final ContainerCraftingCPU craftingCpu; - private IItemList storage = Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ).createList(); private IItemList active = Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ).createList(); private IItemList pending = Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ).createList(); @@ -91,15 +92,8 @@ public class GuiCraftingCPU extends AEBaseGui implements ISortSource private GuiButton cancel; private int tooltip = -1; - public GuiCraftingCPU( final PlayerInventory PlayerInventory, final Object te ) - { - this( new ContainerCraftingCPU( PlayerInventory, te ) ); - } - - protected GuiCraftingCPU( final ContainerCraftingCPU container ) - { - super( container ); - this.craftingCpu = container; + public GuiCraftingCPU(ContainerCraftingCPU container, PlayerInventory playerInventory, ITextComponent title) { + super(container, playerInventory, title); this.ySize = GUI_HEIGHT; this.xSize = GUI_WIDTH; @@ -195,9 +189,9 @@ public class GuiCraftingCPU extends AEBaseGui implements ISortSource { String title = this.getGuiDisplayName( GuiText.CraftingStatus.getLocal() ); - if( this.craftingCpu.getEstimatedTime() > 0 && !this.visual.isEmpty() ) + if( this.container.getEstimatedTime() > 0 && !this.visual.isEmpty() ) { - final long etaInMilliseconds = TimeUnit.MILLISECONDS.convert( this.craftingCpu.getEstimatedTime(), TimeUnit.NANOSECONDS ); + final long etaInMilliseconds = TimeUnit.MILLISECONDS.convert( this.container.getEstimatedTime(), TimeUnit.NANOSECONDS ); final String etaTimeText = DurationFormatUtils.formatDuration( etaInMilliseconds, GuiText.ETAFormat.getLocal() ); title += " - " + etaTimeText; } @@ -345,7 +339,7 @@ public class GuiCraftingCPU extends AEBaseGui implements ISortSource public void drawBG( final int offsetX, final int offsetY, final int mouseX, final int mouseY ) { this.bindTexture( "guis/craftingcpu.png" ); - this.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize ); + GuiUtils.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize, 0 /* FIXME this.zlevel was used */ ); } public void postUpdate( final List list, final byte ref ) diff --git a/src/main/java/appeng/client/gui/implementations/GuiCraftingStatus.java b/src/main/java/appeng/client/gui/implementations/GuiCraftingStatus.java index d4e7fd3fd..165912d07 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiCraftingStatus.java +++ b/src/main/java/appeng/client/gui/implementations/GuiCraftingStatus.java @@ -25,6 +25,9 @@ package appeng.client.gui.implementations; import java.io.IOException; +import appeng.container.implementations.ContainerCraftingCPU; +import appeng.core.Api; +import net.minecraft.util.text.ITextComponent; import org.lwjgl.input.Mouse; import net.minecraft.client.gui.GuiButton; @@ -51,19 +54,16 @@ import appeng.parts.reporting.PartTerminal; public class GuiCraftingStatus extends GuiCraftingCPU { - private final ContainerCraftingStatus status; private GuiButton selectCPU; private GuiTabButton originalGuiBtn; private GuiBridge originalGui; private ItemStack myIcon = ItemStack.EMPTY; - public GuiCraftingStatus( final PlayerInventory PlayerInventory, final ITerminalHost te ) - { - super( new ContainerCraftingStatus( PlayerInventory, te ) ); + public GuiCraftingStatus(ContainerCraftingCPU container, PlayerInventory playerInventory, ITextComponent title) { + super(container, playerInventory, title); - this.status = (ContainerCraftingStatus) this.inventorySlots; - final Object target = this.status.getTarget(); + final Object target = this.container.getTarget(); final IDefinitions definitions = Api.INSTANCE.definitions(); final IParts parts = definitions.parts(); @@ -150,20 +150,20 @@ public class GuiCraftingStatus extends GuiCraftingCPU { String btnTextText = GuiText.NoCraftingJobs.getLocal(); - if( this.status.selectedCpu >= 0 )// && status.selectedCpu < status.cpus.size() ) + if( this.container.selectedCpu >= 0 )// && status.selectedCpu < status.cpus.size() ) { - if( this.status.myName.length() > 0 ) + if( this.container.myName.length() > 0 ) { - final String name = this.status.myName.substring( 0, Math.min( 20, this.status.myName.length() ) ); + final String name = this.container.myName.substring( 0, Math.min( 20, this.container.myName.length() ) ); btnTextText = GuiText.CPUs.getLocal() + ": " + name; } else { - btnTextText = GuiText.CPUs.getLocal() + ": #" + this.status.selectedCpu; + btnTextText = GuiText.CPUs.getLocal() + ": #" + this.container.selectedCpu; } } - if( this.status.noCPU ) + if( this.container.noCPU ) { btnTextText = GuiText.NoCraftingJobs.getLocal(); } diff --git a/src/main/java/appeng/client/gui/implementations/GuiCraftingTerm.java b/src/main/java/appeng/client/gui/implementations/GuiCraftingTerm.java index bef623341..3a6e528b7 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiCraftingTerm.java +++ b/src/main/java/appeng/client/gui/implementations/GuiCraftingTerm.java @@ -34,16 +34,17 @@ import appeng.core.localization.GuiText; import appeng.core.sync.network.NetworkHandler; import appeng.core.sync.packets.PacketInventoryAction; import appeng.helpers.InventoryAction; +import net.minecraft.inventory.container.Slot; +import net.minecraft.util.text.ITextComponent; -public class GuiCraftingTerm extends GuiMEMonitorable +public class GuiCraftingTerm extends GuiMEMonitorable { private GuiImgButton clearBtn; - public GuiCraftingTerm( final PlayerInventory PlayerInventory, final ITerminalHost te ) - { - super( PlayerInventory, te, new ContainerCraftingTerm( PlayerInventory, te ) ); + public GuiCraftingTerm(ContainerCraftingTerm container, PlayerInventory playerInventory, ITextComponent title) { + super(container, playerInventory, title); this.setReservedSpace( 73 ); } @@ -55,8 +56,7 @@ public class GuiCraftingTerm extends GuiMEMonitorable if( this.clearBtn == btn ) { Slot s = null; - final Container c = this.inventorySlots; - for( final Object j : c.inventorySlots ) + for( final Object j : this.container.inventorySlots ) { if( j instanceof SlotCraftingMatrix ) { diff --git a/src/main/java/appeng/client/gui/implementations/GuiDrive.java b/src/main/java/appeng/client/gui/implementations/GuiDrive.java index e5ffd497d..b08e0c05a 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiDrive.java +++ b/src/main/java/appeng/client/gui/implementations/GuiDrive.java @@ -32,16 +32,17 @@ import appeng.core.sync.GuiBridge; import appeng.core.sync.network.NetworkHandler; import appeng.core.sync.packets.PacketSwitchGuis; import appeng.tile.storage.TileDrive; +import net.minecraft.util.text.ITextComponent; +import net.minecraftforge.fml.client.gui.GuiUtils; -public class GuiDrive extends AEBaseGui +public class GuiDrive extends AEBaseGui { private GuiTabButton priority; - public GuiDrive( final PlayerInventory PlayerInventory, final TileDrive te ) - { - super( new ContainerDrive( PlayerInventory, te ) ); + public GuiDrive(ContainerDrive container, PlayerInventory playerInventory, ITextComponent title) { + super(container, playerInventory, title); this.ySize = 199; } @@ -75,6 +76,6 @@ public class GuiDrive extends AEBaseGui public void drawBG( final int offsetX, final int offsetY, final int mouseX, final int mouseY ) { this.bindTexture( "guis/drive.png" ); - this.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize ); + GuiUtils.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize, 0 /* FIXME this.zlevel was used */ ); } } diff --git a/src/main/java/appeng/client/gui/implementations/GuiFormationPlane.java b/src/main/java/appeng/client/gui/implementations/GuiFormationPlane.java index 448ff938c..ee7c02236 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiFormationPlane.java +++ b/src/main/java/appeng/client/gui/implementations/GuiFormationPlane.java @@ -21,6 +21,7 @@ package appeng.client.gui.implementations; import java.io.IOException; +import net.minecraft.util.text.ITextComponent; import org.lwjgl.input.Mouse; import net.minecraft.client.gui.GuiButton; @@ -40,15 +41,14 @@ import appeng.core.sync.packets.PacketSwitchGuis; import appeng.parts.automation.PartFormationPlane; -public class GuiFormationPlane extends GuiUpgradeable +public class GuiFormationPlane extends GuiUpgradeable { private GuiTabButton priority; private GuiImgButton placeMode; - public GuiFormationPlane( final PlayerInventory PlayerInventory, final PartFormationPlane te ) - { - super( new ContainerFormationPlane( PlayerInventory, te ) ); + public GuiFormationPlane(ContainerFormationPlane container, PlayerInventory playerInventory, ITextComponent title) { + super(container, playerInventory, title); this.ySize = 251; } diff --git a/src/main/java/appeng/client/gui/implementations/GuiGrinder.java b/src/main/java/appeng/client/gui/implementations/GuiGrinder.java index 9d6fcf2e2..ea8a9c2a8 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiGrinder.java +++ b/src/main/java/appeng/client/gui/implementations/GuiGrinder.java @@ -25,14 +25,15 @@ import appeng.client.gui.AEBaseGui; import appeng.container.implementations.ContainerGrinder; import appeng.core.localization.GuiText; import appeng.tile.grindstone.TileGrinder; +import net.minecraft.util.text.ITextComponent; +import net.minecraftforge.fml.client.gui.GuiUtils; -public class GuiGrinder extends AEBaseGui +public class GuiGrinder extends AEBaseGui { - public GuiGrinder( final PlayerInventory PlayerInventory, final TileGrinder te ) - { - super( new ContainerGrinder( PlayerInventory, te ) ); + public GuiGrinder(ContainerGrinder container, PlayerInventory playerInventory, ITextComponent title) { + super(container, playerInventory, title); this.ySize = 176; } @@ -47,6 +48,6 @@ public class GuiGrinder extends AEBaseGui public void drawBG( final int offsetX, final int offsetY, final int mouseX, final int mouseY ) { this.bindTexture( "guis/grinder.png" ); - this.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize ); + GuiUtils.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize, 0 /* FIXME this.zlevel was used */ ); } } diff --git a/src/main/java/appeng/client/gui/implementations/GuiIOPort.java b/src/main/java/appeng/client/gui/implementations/GuiIOPort.java index 3e606a3be..2df2f7722 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiIOPort.java +++ b/src/main/java/appeng/client/gui/implementations/GuiIOPort.java @@ -21,6 +21,8 @@ package appeng.client.gui.implementations; import java.io.IOException; +import appeng.core.Api; +import net.minecraft.util.text.ITextComponent; import org.lwjgl.input.Mouse; import net.minecraft.client.gui.GuiButton; @@ -40,15 +42,14 @@ import appeng.core.sync.packets.PacketConfigButton; import appeng.tile.storage.TileIOPort; -public class GuiIOPort extends GuiUpgradeable +public class GuiIOPort extends GuiUpgradeable { private GuiImgButton fullMode; private GuiImgButton operationMode; - public GuiIOPort( final PlayerInventory PlayerInventory, final TileIOPort te ) - { - super( new ContainerIOPort( PlayerInventory, te ) ); + public GuiIOPort(ContainerIOPort container, PlayerInventory playerInventory, ITextComponent title) { + super(container, playerInventory, title); this.ySize = 166; } diff --git a/src/main/java/appeng/client/gui/implementations/GuiInscriber.java b/src/main/java/appeng/client/gui/implementations/GuiInscriber.java index 86c2705f0..53528fb0a 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiInscriber.java +++ b/src/main/java/appeng/client/gui/implementations/GuiInscriber.java @@ -28,25 +28,24 @@ import appeng.container.implementations.ContainerInscriber; import appeng.container.implementations.ContainerUpgradeable; import appeng.core.localization.GuiText; import appeng.tile.misc.TileInscriber; +import net.minecraft.util.text.ITextComponent; +import net.minecraftforge.fml.client.gui.GuiUtils; -public class GuiInscriber extends AEBaseGui +public class GuiInscriber extends AEBaseGui { - private final ContainerInscriber cvc; private GuiProgressBar pb; - public GuiInscriber( final PlayerInventory PlayerInventory, final TileInscriber te ) - { - super( new ContainerInscriber( PlayerInventory, te ) ); - this.cvc = (ContainerInscriber) this.inventorySlots; + public GuiInscriber(ContainerInscriber container, PlayerInventory playerInventory, ITextComponent title) { + super(container, playerInventory, title); this.ySize = 176; this.xSize = this.hasToolbox() ? 246 : 211; } private boolean hasToolbox() { - return ( (ContainerUpgradeable) this.inventorySlots ).hasToolbox(); + return this.container.hasToolbox(); } @Override @@ -54,14 +53,14 @@ public class GuiInscriber extends AEBaseGui { super.init(); - this.pb = new GuiProgressBar( this.cvc, "guis/inscriber.png", 135, 39, 135, 177, 6, 18, Direction.VERTICAL ); + this.pb = new GuiProgressBar( this.container, "guis/inscriber.png", 135, 39, 135, 177, 6, 18, Direction.VERTICAL ); this.addButton( this.pb ); } @Override public void drawFG( final int offsetX, final int offsetY, final int mouseX, final int mouseY ) { - this.pb.setFullMsg( this.cvc.getCurrentProgress() * 100 / this.cvc.getMaxProgress() + "%" ); + this.pb.setFullMsg( this.container.getCurrentProgress() * 100 / this.container.getMaxProgress() + "%" ); this.font.drawString( this.getGuiDisplayName( GuiText.Inscriber.getLocal() ), 8, 6, 4210752 ); this.font.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 ); @@ -74,15 +73,15 @@ public class GuiInscriber extends AEBaseGui this.pb.x = 135 + this.guiLeft; this.pb.y = 39 + this.guiTop; - this.drawTexturedModalRect( offsetX, offsetY, 0, 0, 211 - 34, this.ySize ); + GuiUtils.drawTexturedModalRect( offsetX, offsetY, 0, 0, 211 - 34, this.ySize, 0 /* FIXME this.zlevel was used */ ); if( this.drawUpgrades() ) { - this.drawTexturedModalRect( offsetX + 177, offsetY, 177, 0, 35, 14 + this.cvc.availableUpgrades() * 18 ); + GuiUtils.drawTexturedModalRect( offsetX + 177, offsetY, 177, 0, 35, 14 + this.container.availableUpgrades() * 18, 0 /* FIXME this.zlevel was used */ ); } if( this.hasToolbox() ) { - this.drawTexturedModalRect( offsetX + 178, offsetY + this.ySize - 90, 178, this.ySize - 90, 68, 68 ); + GuiUtils.drawTexturedModalRect( offsetX + 178, offsetY + this.ySize - 90, 178, this.ySize - 90, 68, 68, 0 /* FIXME this.zlevel was used */ ); } } diff --git a/src/main/java/appeng/client/gui/implementations/GuiInterface.java b/src/main/java/appeng/client/gui/implementations/GuiInterface.java index d32e72973..bf4b81483 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiInterface.java +++ b/src/main/java/appeng/client/gui/implementations/GuiInterface.java @@ -21,6 +21,7 @@ package appeng.client.gui.implementations; import java.io.IOException; +import net.minecraft.util.text.ITextComponent; import org.lwjgl.input.Mouse; import net.minecraft.client.gui.GuiButton; @@ -40,16 +41,15 @@ import appeng.core.sync.packets.PacketSwitchGuis; import appeng.helpers.IInterfaceHost; -public class GuiInterface extends GuiUpgradeable +public class GuiInterface extends GuiUpgradeable { private GuiTabButton priority; private GuiImgButton BlockMode; private GuiToggleButton interfaceMode; - public GuiInterface( final PlayerInventory PlayerInventory, final IInterfaceHost te ) - { - super( new ContainerInterface( PlayerInventory, te ) ); + public GuiInterface(ContainerInterface container, PlayerInventory playerInventory, ITextComponent title) { + super(container, playerInventory, title); this.ySize = 211; } diff --git a/src/main/java/appeng/client/gui/implementations/GuiInterfaceTerminal.java b/src/main/java/appeng/client/gui/implementations/GuiInterfaceTerminal.java index 798373495..f70306308 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiInterfaceTerminal.java +++ b/src/main/java/appeng/client/gui/implementations/GuiInterfaceTerminal.java @@ -31,9 +31,11 @@ import java.util.WeakHashMap; import com.google.common.collect.HashMultimap; +import com.mojang.blaze3d.systems.RenderSystem; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.entity.player.PlayerInventory; import net.minecraft.inventory.Slot; +import net.minecraft.inventory.container.Slot; import net.minecraft.item.ItemStack; import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.ListNBT; @@ -48,9 +50,11 @@ import appeng.container.implementations.ContainerInterfaceTerminal; import appeng.core.localization.GuiText; import appeng.parts.reporting.PartInterfaceTerminal; import appeng.util.Platform; +import net.minecraft.util.text.ITextComponent; +import net.minecraftforge.fml.client.gui.GuiUtils; -public class GuiInterfaceTerminal extends AEBaseGui +public class GuiInterfaceTerminal extends AEBaseGui { private static final int LINES_ON_PAGE = 6; @@ -68,10 +72,8 @@ public class GuiInterfaceTerminal extends AEBaseGui private boolean refreshList = false; private MEGuiTextField searchField; - public GuiInterfaceTerminal( final PlayerInventory PlayerInventory, final PartInterfaceTerminal te ) - { - super( new ContainerInterfaceTerminal( PlayerInventory, te ) ); - + public GuiInterfaceTerminal(ContainerInterfaceTerminal container, PlayerInventory playerInventory, ITextComponent title) { + super(container, playerInventory, title); final GuiScrollbar scrollbar = new GuiScrollbar(); this.setScrollBar( scrollbar ); this.xSize = 195; @@ -103,7 +105,7 @@ public class GuiInterfaceTerminal extends AEBaseGui final int ex = this.getScrollBar().getCurrentScroll(); - final Iterator o = this.inventorySlots.inventorySlots.iterator(); + final Iterator o = this.container.inventorySlots.iterator(); while( o.hasNext() ) { if( o.next() instanceof SlotDisconnected ) @@ -121,7 +123,7 @@ public class GuiInterfaceTerminal extends AEBaseGui final ClientDCInternalInv inv = (ClientDCInternalInv) lineObj; for( int z = 0; z < inv.getInventory().getSlots(); z++ ) { - this.inventorySlots.inventorySlots.add( new SlotDisconnected( inv, z, z * 18 + 8, 1 + offset ) ); + this.container.inventorySlots.add( new SlotDisconnected( inv, z, z * 18 + 8, 1 + offset ) ); } } else if( lineObj instanceof String ) @@ -162,7 +164,7 @@ public class GuiInterfaceTerminal extends AEBaseGui public void drawBG( final int offsetX, final int offsetY, final int mouseX, final int mouseY ) { this.bindTexture( "guis/interfaceterminal.png" ); - this.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize ); + GuiUtils.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize, 0 /* FIXME this.zlevel was used */ ); int offset = 17; final int ex = this.getScrollBar().getCurrentScroll(); @@ -176,7 +178,7 @@ public class GuiInterfaceTerminal extends AEBaseGui RenderSystem.color4f( 1, 1, 1, 1 ); final int width = inv.getInventory().getSlots() * 18; - this.drawTexturedModalRect( offsetX + 7, offsetY + offset, 7, 139, width, 18 ); + GuiUtils.drawTexturedModalRect( offsetX + 7, offsetY + offset, 7, 139, width, 18, 0 /* FIXME this.zlevel was used */ ); } offset += 18; } diff --git a/src/main/java/appeng/client/gui/implementations/GuiLevelEmitter.java b/src/main/java/appeng/client/gui/implementations/GuiLevelEmitter.java index 3fe8dae0e..40100de0d 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiLevelEmitter.java +++ b/src/main/java/appeng/client/gui/implementations/GuiLevelEmitter.java @@ -21,6 +21,7 @@ package appeng.client.gui.implementations; import java.io.IOException; +import net.minecraft.util.text.ITextComponent; import org.lwjgl.input.Mouse; import net.minecraft.client.gui.GuiButton; @@ -44,7 +45,7 @@ import appeng.core.sync.packets.PacketValueConfig; import appeng.parts.automation.PartLevelEmitter; -public class GuiLevelEmitter extends GuiUpgradeable +public class GuiLevelEmitter extends GuiUpgradeable { private GuiNumberBox level; @@ -61,9 +62,8 @@ public class GuiLevelEmitter extends GuiUpgradeable private GuiImgButton levelMode; private GuiImgButton craftingMode; - public GuiLevelEmitter( final PlayerInventory PlayerInventory, final PartLevelEmitter te ) - { - super( new ContainerLevelEmitter( PlayerInventory, te ) ); + public GuiLevelEmitter(ContainerLevelEmitter container, PlayerInventory playerInventory, ITextComponent title) { + super(container, playerInventory, title); } @Override @@ -77,7 +77,7 @@ public class GuiLevelEmitter extends GuiUpgradeable this.level.setTextColor( 0xFFFFFF ); this.level.setVisible( true ); this.level.setFocused2( true ); - ( (ContainerLevelEmitter) this.inventorySlots ).setTextField( this.level ); + container.setTextField( this.level ); } @Override diff --git a/src/main/java/appeng/client/gui/implementations/GuiMAC.java b/src/main/java/appeng/client/gui/implementations/GuiMAC.java index 6fad64fef..91fe312d8 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiMAC.java +++ b/src/main/java/appeng/client/gui/implementations/GuiMAC.java @@ -29,19 +29,17 @@ import appeng.client.gui.widgets.GuiProgressBar.Direction; import appeng.container.implementations.ContainerMAC; import appeng.core.localization.GuiText; import appeng.tile.crafting.TileMolecularAssembler; +import net.minecraft.util.text.ITextComponent; -public class GuiMAC extends GuiUpgradeable +public class GuiMAC extends GuiUpgradeable { - private final ContainerMAC container; private GuiProgressBar pb; - public GuiMAC( final PlayerInventory PlayerInventory, final TileMolecularAssembler te ) - { - super( new ContainerMAC( PlayerInventory, te ) ); + public GuiMAC(ContainerMAC container, PlayerInventory playerInventory, ITextComponent title) { + super(container, playerInventory, title); this.ySize = 197; - this.container = (ContainerMAC) this.inventorySlots; } @Override diff --git a/src/main/java/appeng/client/gui/implementations/GuiMEMonitorable.java b/src/main/java/appeng/client/gui/implementations/GuiMEMonitorable.java index 1ff3bcaf3..d381d9e87 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiMEMonitorable.java +++ b/src/main/java/appeng/client/gui/implementations/GuiMEMonitorable.java @@ -22,6 +22,8 @@ package appeng.client.gui.implementations; import java.io.IOException; import java.util.List; +import net.minecraft.util.text.ITextComponent; +import net.minecraftforge.fml.client.gui.GuiUtils; import org.lwjgl.input.Keyboard; import org.lwjgl.input.Mouse; @@ -69,7 +71,7 @@ import appeng.util.IConfigManagerHost; import appeng.util.Platform; -public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfigManagerHost +public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfigManagerHost { private static int craftingGridOffsetX; @@ -82,7 +84,6 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi private final IConfigManager configSrc; private final boolean viewCell; private final ItemStack[] myCurrentViewCells = new ItemStack[5]; - private final ContainerMEMonitorable monitorableContainer; private GuiTabButton craftingStatusBtn; private MEGuiTextField searchField; private GuiText myName; @@ -101,15 +102,8 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi private int currentMouseX = 0; private int currentMouseY = 0; - public GuiMEMonitorable( final PlayerInventory PlayerInventory, final ITerminalHost te ) - { - this( PlayerInventory, te, new ContainerMEMonitorable( PlayerInventory, te ) ); - } - - public GuiMEMonitorable( final PlayerInventory PlayerInventory, final ITerminalHost te, final ContainerMEMonitorable c ) - { - - super( c ); + public GuiMEMonitorable(T container, PlayerInventory playerInventory, ITextComponent title) { + super(container, playerInventory, title); final GuiScrollbar scrollbar = new GuiScrollbar(); this.setScrollBar( scrollbar ); @@ -118,6 +112,7 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi this.xSize = 185; this.ySize = 204; + Object te = container.getTarget(); if( te instanceof IViewCellStorage ) { this.xSize += 33; @@ -125,8 +120,8 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi this.standardSize = this.xSize; - this.configSrc = ( (IConfigurableObject) this.inventorySlots ).getConfigManager(); - ( this.monitorableContainer = (ContainerMEMonitorable) this.inventorySlots ).setGui( this ); + this.configSrc = ( (IConfigurableObject) this.container ).getConfigManager(); + this.container.setGui( this ); this.viewCell = te instanceof IViewCellStorage; @@ -350,7 +345,7 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi craftingGridOffsetX = Integer.MAX_VALUE; craftingGridOffsetY = Integer.MAX_VALUE; - for( final Object s : this.inventorySlots.inventorySlots ) + for( final Object s : this.container.inventorySlots ) { if( s instanceof AppEngSlot ) { @@ -416,20 +411,20 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi this.bindTexture( this.getBackground() ); final int x_width = 197; - this.drawTexturedModalRect( offsetX, offsetY, 0, 0, x_width, 18 ); + GuiUtils.drawTexturedModalRect( offsetX, offsetY, 0, 0, x_width, 18, 0 /* FIXME this.zlevel was used */ ); if( this.viewCell || ( this instanceof GuiSecurityStation ) ) { - this.drawTexturedModalRect( offsetX + x_width, offsetY, x_width, 0, 46, 128 ); + GuiUtils.drawTexturedModalRect( offsetX + x_width, offsetY, x_width, 0, 46, 128, 0 /* FIXME this.zlevel was used */ ); } for( int x = 0; x < this.rows; x++ ) { - this.drawTexturedModalRect( offsetX, offsetY + 18 + x * 18, 0, 18, x_width, 18 ); + GuiUtils.drawTexturedModalRect( offsetX, offsetY + 18 + x * 18, 0, 18, x_width, 18, 0 /* FIXME this.zlevel was used */ ); } - this.drawTexturedModalRect( offsetX, offsetY + 16 + this.rows * 18 + this.lowerTextureOffset, 0, 106 - 18 - 18, x_width, - 99 + this.reservedSpace - this.lowerTextureOffset ); + GuiUtils.drawTexturedModalRect( offsetX, offsetY + 16 + this.rows * 18 + this.lowerTextureOffset, 0, 106 - 18 - 18, x_width, + 99 + this.reservedSpace - this.lowerTextureOffset, 0 /* FIXME this.zlevel was used */ ); if( this.viewCell ) { @@ -437,10 +432,10 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi for( int i = 0; i < 5; i++ ) { - if( this.myCurrentViewCells[i] != this.monitorableContainer.getCellViewSlot( i ).getStack() ) + if( this.myCurrentViewCells[i] != this.container.getCellViewSlot( i ).getStack() ) { update = true; - this.myCurrentViewCells[i] = this.monitorableContainer.getCellViewSlot( i ).getStack(); + this.myCurrentViewCells[i] = this.container.getCellViewSlot( i ).getStack(); } } @@ -525,7 +520,7 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi @Override public void updateScreen() { - this.repo.setPower( this.monitorableContainer.isPowered() ); + this.repo.setPower( this.container.isPowered() ); super.updateScreen(); } diff --git a/src/main/java/appeng/client/gui/implementations/GuiMEPortableCell.java b/src/main/java/appeng/client/gui/implementations/GuiMEPortableCell.java index c246f9fdb..2e1260cd4 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiMEPortableCell.java +++ b/src/main/java/appeng/client/gui/implementations/GuiMEPortableCell.java @@ -23,19 +23,14 @@ import net.minecraft.entity.player.PlayerInventory; import appeng.api.implementations.guiobjects.IPortableCell; import appeng.container.implementations.ContainerMEPortableCell; +import net.minecraft.util.text.ITextComponent; -public class GuiMEPortableCell extends GuiMEMonitorable +public class GuiMEPortableCell extends GuiMEMonitorable { - public GuiMEPortableCell( final PlayerInventory PlayerInventory, final IPortableCell te ) - { - super( PlayerInventory, te, new ContainerMEPortableCell( PlayerInventory, te ) ); - } - - int defaultGetMaxRows() - { - return super.getMaxRows(); + public GuiMEPortableCell(ContainerMEPortableCell container, PlayerInventory playerInventory, ITextComponent title) { + super(container, playerInventory, title); } @Override diff --git a/src/main/java/appeng/client/gui/implementations/GuiNetworkStatus.java b/src/main/java/appeng/client/gui/implementations/GuiNetworkStatus.java index 3d4c948d5..3e9c70ebc 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiNetworkStatus.java +++ b/src/main/java/appeng/client/gui/implementations/GuiNetworkStatus.java @@ -22,6 +22,8 @@ package appeng.client.gui.implementations; import java.io.IOException; import java.util.List; +import net.minecraft.util.text.ITextComponent; +import net.minecraftforge.fml.client.gui.GuiUtils; import org.lwjgl.input.Mouse; import net.minecraft.client.gui.GuiButton; @@ -49,7 +51,7 @@ import appeng.core.localization.GuiText; import appeng.util.Platform; -public class GuiNetworkStatus extends AEBaseGui implements ISortSource +public class GuiNetworkStatus extends AEBaseGui implements ISortSource { private final ItemRepo repo; @@ -57,9 +59,8 @@ public class GuiNetworkStatus extends AEBaseGui implements ISortSource private GuiImgButton units; private int tooltip = -1; - public GuiNetworkStatus( final PlayerInventory PlayerInventory, final INetworkTool te ) - { - super( new ContainerNetworkStatus( PlayerInventory, te ) ); + public GuiNetworkStatus(ContainerNetworkStatus container, PlayerInventory playerInventory, ITextComponent title) { + super(container, playerInventory, title); final GuiScrollbar scrollbar = new GuiScrollbar(); this.setScrollBar( scrollbar ); @@ -132,16 +133,14 @@ public class GuiNetworkStatus extends AEBaseGui implements ISortSource @Override public void drawFG( final int offsetX, final int offsetY, final int mouseX, final int mouseY ) { - final ContainerNetworkStatus ns = (ContainerNetworkStatus) this.inventorySlots; - this.font.drawString( GuiText.NetworkDetails.getLocal(), 8, 6, 4210752 ); - this.font.drawString( GuiText.StoredPower.getLocal() + ": " + Platform.formatPowerLong( ns.getCurrentPower(), false ), 13, 16, 4210752 ); - this.font.drawString( GuiText.MaxPower.getLocal() + ": " + Platform.formatPowerLong( ns.getMaxPower(), false ), 13, 26, 4210752 ); + this.font.drawString( GuiText.StoredPower.getLocal() + ": " + Platform.formatPowerLong( container.getCurrentPower(), false ), 13, 16, 4210752 ); + this.font.drawString( GuiText.MaxPower.getLocal() + ": " + Platform.formatPowerLong( container.getMaxPower(), false ), 13, 26, 4210752 ); - this.font.drawString( GuiText.PowerInputRate.getLocal() + ": " + Platform.formatPowerLong( ns.getAverageAddition(), true ), 13, 143 - 10, + this.font.drawString( GuiText.PowerInputRate.getLocal() + ": " + Platform.formatPowerLong( container.getAverageAddition(), true ), 13, 143 - 10, 4210752 ); - this.font.drawString( GuiText.PowerUsageRate.getLocal() + ": " + Platform.formatPowerLong( ns.getPowerUsage(), true ), 13, 143 - 20, 4210752 ); + this.font.drawString( GuiText.PowerUsageRate.getLocal() + ": " + Platform.formatPowerLong( container.getPowerUsage(), true ), 13, 143 - 20, 4210752 ); final int sectionLength = 30; @@ -214,7 +213,7 @@ public class GuiNetworkStatus extends AEBaseGui implements ISortSource public void drawBG( final int offsetX, final int offsetY, final int mouseX, final int mouseY ) { this.bindTexture( "guis/networkstatus.png" ); - this.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize ); + GuiUtils.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize, 0 /* FIXME this.zlevel was used */ ); } public void postUpdate( final List list ) diff --git a/src/main/java/appeng/client/gui/implementations/GuiNetworkTool.java b/src/main/java/appeng/client/gui/implementations/GuiNetworkTool.java index 22c5939fd..73362b6ce 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiNetworkTool.java +++ b/src/main/java/appeng/client/gui/implementations/GuiNetworkTool.java @@ -32,16 +32,17 @@ import appeng.core.AELog; import appeng.core.localization.GuiText; import appeng.core.sync.network.NetworkHandler; import appeng.core.sync.packets.PacketValueConfig; +import net.minecraft.util.text.ITextComponent; +import net.minecraftforge.fml.client.gui.GuiUtils; -public class GuiNetworkTool extends AEBaseGui +public class GuiNetworkTool extends AEBaseGui { private GuiToggleButton tFacades; - public GuiNetworkTool( final PlayerInventory PlayerInventory, final INetworkTool te ) - { - super( new ContainerNetworkTool( PlayerInventory, te ) ); + public GuiNetworkTool(ContainerNetworkTool container, PlayerInventory playerInventory, ITextComponent title) { + super(container, playerInventory, title); this.ySize = 166; } @@ -79,7 +80,7 @@ public class GuiNetworkTool extends AEBaseGui { if( this.tFacades != null ) { - this.tFacades.setState( ( (ContainerNetworkTool) this.inventorySlots ).isFacadeMode() ); + this.tFacades.setState( container.isFacadeMode() ); } this.font.drawString( this.getGuiDisplayName( GuiText.NetworkTool.getLocal() ), 8, 6, 4210752 ); @@ -90,6 +91,6 @@ public class GuiNetworkTool extends AEBaseGui public void drawBG( final int offsetX, final int offsetY, final int mouseX, final int mouseY ) { this.bindTexture( "guis/toolbox.png" ); - this.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize ); + GuiUtils.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize, 0 /* FIXME this.zlevel was used */ ); } } diff --git a/src/main/java/appeng/client/gui/implementations/GuiPatternTerm.java b/src/main/java/appeng/client/gui/implementations/GuiPatternTerm.java index cc94f8e03..85cfbf7ff 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiPatternTerm.java +++ b/src/main/java/appeng/client/gui/implementations/GuiPatternTerm.java @@ -38,9 +38,10 @@ import appeng.core.AELog; import appeng.core.localization.GuiText; import appeng.core.sync.network.NetworkHandler; import appeng.core.sync.packets.PacketValueConfig; +import net.minecraft.util.text.ITextComponent; -public class GuiPatternTerm extends GuiMEMonitorable +public class GuiPatternTerm extends GuiMEMonitorable { private static final String BACKGROUND_CRAFTING_MODE = "guis/pattern.png"; @@ -52,8 +53,6 @@ public class GuiPatternTerm extends GuiMEMonitorable private static final String CRAFTMODE_CRFTING = "1"; private static final String CRAFTMODE_PROCESSING = "0"; - private final ContainerPatternTerm container; - private GuiTabButton tabCraftButton; private GuiTabButton tabProcessButton; private GuiImgButton substitutionsEnabledBtn; @@ -61,10 +60,8 @@ public class GuiPatternTerm extends GuiMEMonitorable private GuiImgButton encodeBtn; private GuiImgButton clearBtn; - public GuiPatternTerm( final PlayerInventory PlayerInventory, final ITerminalHost te ) - { - super( PlayerInventory, te, new ContainerPatternTerm( PlayerInventory, te ) ); - this.container = (ContainerPatternTerm) this.inventorySlots; + public GuiPatternTerm(ContainerPatternTerm container, PlayerInventory playerInventory, ITextComponent title) { + super(container, playerInventory, title); this.setReservedSpace( 81 ); } diff --git a/src/main/java/appeng/client/gui/implementations/GuiPriority.java b/src/main/java/appeng/client/gui/implementations/GuiPriority.java index 4d85d354d..e264b34a1 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiPriority.java +++ b/src/main/java/appeng/client/gui/implementations/GuiPriority.java @@ -37,9 +37,11 @@ import appeng.core.sync.network.NetworkHandler; import appeng.core.sync.packets.PacketSwitchGuis; import appeng.core.sync.packets.PacketValueConfig; import appeng.helpers.IPriorityHost; +import net.minecraft.util.text.ITextComponent; +import net.minecraftforge.fml.client.gui.GuiUtils; -public class GuiPriority extends AEBaseGui +public class GuiPriority extends AEBaseGui { private GuiNumberBox priority; @@ -56,9 +58,8 @@ public class GuiPriority extends AEBaseGui private GuiBridge OriginalGui; - public GuiPriority( final PlayerInventory PlayerInventory, final IPriorityHost te ) - { - super( new ContainerPriority( PlayerInventory, te ) ); + public GuiPriority(ContainerPriority container, PlayerInventory playerInventory, ITextComponent title) { + super(container, playerInventory, title); } @Override @@ -81,9 +82,8 @@ public class GuiPriority extends AEBaseGui this.addButton( this.minus100 = new GuiButton( 0, this.guiLeft + 82, this.guiTop + 69, 32, 20, "-" + c ) ); this.addButton( this.minus1000 = new GuiButton( 0, this.guiLeft + 120, this.guiTop + 69, 38, 20, "-" + d ) ); - final ContainerPriority con = ( (ContainerPriority) this.inventorySlots ); - final ItemStack myIcon = con.getPriorityHost().getItemStackRepresentation(); - this.OriginalGui = con.getPriorityHost().getGuiBridge(); + final ItemStack myIcon = container.getPriorityHost().getItemStackRepresentation(); + this.OriginalGui = container.getPriorityHost().getGuiBridge(); if( this.OriginalGui != null && !myIcon.isEmpty() ) { @@ -96,7 +96,7 @@ public class GuiPriority extends AEBaseGui this.priority.setTextColor( 0xFFFFFF ); this.priority.setVisible( true ); this.priority.setFocused2( true ); - ( (ContainerPriority) this.inventorySlots ).setTextField( this.priority ); + container.setTextField( this.priority ); } @Override @@ -109,7 +109,7 @@ public class GuiPriority extends AEBaseGui public void drawBG( final int offsetX, final int offsetY, final int mouseX, final int mouseY ) { this.bindTexture( "guis/priority.png" ); - this.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize ); + GuiUtils.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize, 0 /* FIXME this.zlevel was used */ ); this.priority.drawTextBox(); } diff --git a/src/main/java/appeng/client/gui/implementations/GuiQNB.java b/src/main/java/appeng/client/gui/implementations/GuiQNB.java index e0a435dc3..8b8576946 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiQNB.java +++ b/src/main/java/appeng/client/gui/implementations/GuiQNB.java @@ -25,14 +25,15 @@ import appeng.client.gui.AEBaseGui; import appeng.container.implementations.ContainerQNB; import appeng.core.localization.GuiText; import appeng.tile.qnb.TileQuantumBridge; +import net.minecraft.util.text.ITextComponent; +import net.minecraftforge.fml.client.gui.GuiUtils; -public class GuiQNB extends AEBaseGui +public class GuiQNB extends AEBaseGui { - public GuiQNB( final PlayerInventory PlayerInventory, final TileQuantumBridge te ) - { - super( new ContainerQNB( PlayerInventory, te ) ); + public GuiQNB(ContainerQNB container, PlayerInventory playerInventory, ITextComponent title) { + super(container, playerInventory, title); this.ySize = 166; } @@ -47,6 +48,6 @@ public class GuiQNB extends AEBaseGui public void drawBG( final int offsetX, final int offsetY, final int mouseX, final int mouseY ) { this.bindTexture( "guis/chest.png" ); - this.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize ); + GuiUtils.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize, 0 /* FIXME this.zlevel was used */ ); } } diff --git a/src/main/java/appeng/client/gui/implementations/GuiQuartzKnife.java b/src/main/java/appeng/client/gui/implementations/GuiQuartzKnife.java index 8a012d860..230215123 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiQuartzKnife.java +++ b/src/main/java/appeng/client/gui/implementations/GuiQuartzKnife.java @@ -31,16 +31,17 @@ import appeng.core.localization.GuiText; import appeng.core.sync.network.NetworkHandler; import appeng.core.sync.packets.PacketValueConfig; import appeng.items.contents.QuartzKnifeObj; +import net.minecraft.util.text.ITextComponent; +import net.minecraftforge.fml.client.gui.GuiUtils; -public class GuiQuartzKnife extends AEBaseGui +public class GuiQuartzKnife extends AEBaseGui { private GuiTextField name; - public GuiQuartzKnife( final PlayerInventory PlayerInventory, final QuartzKnifeObj te ) - { - super( new ContainerQuartzKnife( PlayerInventory, te ) ); + public GuiQuartzKnife(ContainerQuartzKnife container, PlayerInventory playerInventory, ITextComponent title) { + super(container, playerInventory, title); this.ySize = 184; } @@ -68,7 +69,7 @@ public class GuiQuartzKnife extends AEBaseGui public void drawBG( final int offsetX, final int offsetY, final int mouseX, final int mouseY ) { this.bindTexture( "guis/quartzknife.png" ); - this.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize ); + GuiUtils.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize, 0 /* FIXME this.zlevel was used */ ); this.name.drawTextBox(); } @@ -80,7 +81,7 @@ public class GuiQuartzKnife extends AEBaseGui try { final String Out = this.name.getText(); - ( (ContainerQuartzKnife) this.inventorySlots ).setName( Out ); + container.setName( Out ); NetworkHandler.instance().sendToServer( new PacketValueConfig( "QuartzKnife.Name", Out ) ); } catch( final IOException e ) diff --git a/src/main/java/appeng/client/gui/implementations/GuiSecurityStation.java b/src/main/java/appeng/client/gui/implementations/GuiSecurityStation.java index 09b7ec88f..32035d942 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiSecurityStation.java +++ b/src/main/java/appeng/client/gui/implementations/GuiSecurityStation.java @@ -32,9 +32,10 @@ import appeng.core.AELog; import appeng.core.localization.GuiText; import appeng.core.sync.network.NetworkHandler; import appeng.core.sync.packets.PacketValueConfig; +import net.minecraft.util.text.ITextComponent; -public class GuiSecurityStation extends GuiMEMonitorable +public class GuiSecurityStation extends GuiMEMonitorable { private GuiToggleButton inject; @@ -43,9 +44,8 @@ public class GuiSecurityStation extends GuiMEMonitorable private GuiToggleButton build; private GuiToggleButton security; - public GuiSecurityStation( final PlayerInventory PlayerInventory, final ITerminalHost te ) - { - super( PlayerInventory, te, new ContainerSecurityStation( PlayerInventory, te ) ); + public GuiSecurityStation(ContainerSecurityStation container, PlayerInventory playerInventory, ITextComponent title) { + super(container, playerInventory, title); this.setCustomSortOrder( false ); this.setReservedSpace( 33 ); @@ -127,13 +127,11 @@ public class GuiSecurityStation extends GuiMEMonitorable @Override protected String getBackground() { - final ContainerSecurityStation cs = (ContainerSecurityStation) this.inventorySlots; - - this.inject.setState( ( cs.getPermissionMode() & ( 1 << SecurityPermissions.INJECT.ordinal() ) ) > 0 ); - this.extract.setState( ( cs.getPermissionMode() & ( 1 << SecurityPermissions.EXTRACT.ordinal() ) ) > 0 ); - this.craft.setState( ( cs.getPermissionMode() & ( 1 << SecurityPermissions.CRAFT.ordinal() ) ) > 0 ); - this.build.setState( ( cs.getPermissionMode() & ( 1 << SecurityPermissions.BUILD.ordinal() ) ) > 0 ); - this.security.setState( ( cs.getPermissionMode() & ( 1 << SecurityPermissions.SECURITY.ordinal() ) ) > 0 ); + this.inject.setState( ( container.getPermissionMode() & ( 1 << SecurityPermissions.INJECT.ordinal() ) ) > 0 ); + this.extract.setState( ( container.getPermissionMode() & ( 1 << SecurityPermissions.EXTRACT.ordinal() ) ) > 0 ); + this.craft.setState( ( container.getPermissionMode() & ( 1 << SecurityPermissions.CRAFT.ordinal() ) ) > 0 ); + this.build.setState( ( container.getPermissionMode() & ( 1 << SecurityPermissions.BUILD.ordinal() ) ) > 0 ); + this.security.setState( ( container.getPermissionMode() & ( 1 << SecurityPermissions.SECURITY.ordinal() ) ) > 0 ); return "guis/security_station.png"; } diff --git a/src/main/java/appeng/client/gui/implementations/GuiSpatialIOPort.java b/src/main/java/appeng/client/gui/implementations/GuiSpatialIOPort.java index 311bbf256..7c5e984b3 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiSpatialIOPort.java +++ b/src/main/java/appeng/client/gui/implementations/GuiSpatialIOPort.java @@ -21,6 +21,8 @@ package appeng.client.gui.implementations; import java.io.IOException; +import net.minecraft.util.text.ITextComponent; +import net.minecraftforge.fml.client.gui.GuiUtils; import org.lwjgl.input.Mouse; import net.minecraft.client.gui.GuiButton; @@ -36,17 +38,14 @@ import appeng.tile.spatial.TileSpatialIOPort; import appeng.util.Platform; -public class GuiSpatialIOPort extends AEBaseGui +public class GuiSpatialIOPort extends AEBaseGui { - private final ContainerSpatialIOPort container; private GuiImgButton units; - public GuiSpatialIOPort( final PlayerInventory PlayerInventory, final TileSpatialIOPort te ) - { - super( new ContainerSpatialIOPort( PlayerInventory, te ) ); + public GuiSpatialIOPort(ContainerSpatialIOPort container, PlayerInventory playerInventory, ITextComponent title) { + super(container, playerInventory, title); this.ySize = 199; - this.container = (ContainerSpatialIOPort) this.inventorySlots; } @Override @@ -101,6 +100,6 @@ public class GuiSpatialIOPort extends AEBaseGui public void drawBG( final int offsetX, final int offsetY, final int mouseX, final int mouseY ) { this.bindTexture( "guis/spatialio.png" ); - this.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize ); + GuiUtils.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize, 0 /* FIXME this.zlevel was used */ ); } } diff --git a/src/main/java/appeng/client/gui/implementations/GuiStorageBus.java b/src/main/java/appeng/client/gui/implementations/GuiStorageBus.java index 255d0ebdc..1d57d92a7 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiStorageBus.java +++ b/src/main/java/appeng/client/gui/implementations/GuiStorageBus.java @@ -21,6 +21,7 @@ package appeng.client.gui.implementations; import java.io.IOException; +import net.minecraft.util.text.ITextComponent; import org.lwjgl.input.Mouse; import net.minecraft.client.gui.GuiButton; @@ -44,7 +45,7 @@ import appeng.core.sync.packets.PacketValueConfig; import appeng.parts.misc.PartStorageBus; -public class GuiStorageBus extends GuiUpgradeable +public class GuiStorageBus extends GuiUpgradeable { private GuiImgButton rwMode; @@ -53,9 +54,8 @@ public class GuiStorageBus extends GuiUpgradeable private GuiImgButton partition; private GuiImgButton clear; - public GuiStorageBus( final PlayerInventory PlayerInventory, final PartStorageBus te ) - { - super( new ContainerStorageBus( PlayerInventory, te ) ); + public GuiStorageBus(ContainerStorageBus container, PlayerInventory playerInventory, ITextComponent title) { + super(container, playerInventory, title); this.ySize = 251; } diff --git a/src/main/java/appeng/client/gui/implementations/GuiUpgradeable.java b/src/main/java/appeng/client/gui/implementations/GuiUpgradeable.java index 4eee523d9..99000c102 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiUpgradeable.java +++ b/src/main/java/appeng/client/gui/implementations/GuiUpgradeable.java @@ -21,9 +21,6 @@ package appeng.client.gui.implementations; import java.io.IOException; -import org.lwjgl.input.Mouse; - -import net.minecraft.client.gui.GuiButton; import net.minecraft.entity.player.PlayerInventory; import appeng.api.config.FuzzyMode; @@ -41,9 +38,11 @@ import appeng.core.sync.network.NetworkHandler; import appeng.core.sync.packets.PacketConfigButton; import appeng.parts.automation.PartExportBus; import appeng.parts.automation.PartImportBus; +import net.minecraft.util.text.ITextComponent; +import net.minecraftforge.fml.client.gui.GuiUtils; -public class GuiUpgradeable extends AEBaseGui +public class GuiUpgradeable extends AEBaseGui { protected final ContainerUpgradeable cvb; @@ -54,17 +53,11 @@ public class GuiUpgradeable extends AEBaseGui protected GuiImgButton craftMode; protected GuiImgButton schedulingMode; - public GuiUpgradeable( final PlayerInventory PlayerInventory, final IUpgradeableHost te ) - { - this( new ContainerUpgradeable( PlayerInventory, te ) ); - } + public GuiUpgradeable(T container, PlayerInventory playerInventory, ITextComponent title) { + super(container, playerInventory, title); + this.cvb = container; - public GuiUpgradeable( final ContainerUpgradeable te ) - { - super( te ); - this.cvb = te; - - this.bc = (IUpgradeableHost) te.getTarget(); + this.bc = (IUpgradeableHost) container.getTarget(); this.xSize = this.hasToolbox() ? 246 : 211; this.ySize = 184; } @@ -127,14 +120,14 @@ public class GuiUpgradeable extends AEBaseGui this.handleButtonVisibility(); this.bindTexture( this.getBackground() ); - this.drawTexturedModalRect( offsetX, offsetY, 0, 0, 211 - 34, this.ySize ); + GuiUtils.drawTexturedModalRect( offsetX, offsetY, 0, 0, 211 - 34, this.ySize, 0 /* FIXME this.zlevel was used */ ); if( this.drawUpgrades() ) { - this.drawTexturedModalRect( offsetX + 177, offsetY, 177, 0, 35, 14 + this.cvb.availableUpgrades() * 18 ); + GuiUtils.drawTexturedModalRect( offsetX + 177, offsetY, 177, 0, 35, 14 + this.cvb.availableUpgrades() * 18, 0 /* FIXME this.zlevel was used */ ); } if( this.hasToolbox() ) { - this.drawTexturedModalRect( offsetX + 178, offsetY + this.ySize - 90, 178, this.ySize - 90, 68, 68 ); + GuiUtils.drawTexturedModalRect( offsetX + 178, offsetY + this.ySize - 90, 178, this.ySize - 90, 68, 68, 0 /* FIXME this.zlevel was used */ ); } } diff --git a/src/main/java/appeng/client/gui/implementations/GuiVibrationChamber.java b/src/main/java/appeng/client/gui/implementations/GuiVibrationChamber.java index efca554d2..a11335547 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiVibrationChamber.java +++ b/src/main/java/appeng/client/gui/implementations/GuiVibrationChamber.java @@ -19,7 +19,7 @@ package appeng.client.gui.implementations; -import net.minecraft.client.renderer.GlStateManager; +import com.mojang.blaze3d.systems.RenderSystem; import net.minecraft.entity.player.PlayerInventory; import appeng.client.gui.AEBaseGui; @@ -28,18 +28,17 @@ import appeng.client.gui.widgets.GuiProgressBar.Direction; import appeng.container.implementations.ContainerVibrationChamber; import appeng.core.localization.GuiText; import appeng.tile.misc.TileVibrationChamber; +import net.minecraft.util.text.ITextComponent; +import net.minecraftforge.fml.client.gui.GuiUtils; -public class GuiVibrationChamber extends AEBaseGui +public class GuiVibrationChamber extends AEBaseGui { - private final ContainerVibrationChamber cvc; private GuiProgressBar pb; - public GuiVibrationChamber( final PlayerInventory PlayerInventory, final TileVibrationChamber te ) - { - super( new ContainerVibrationChamber( PlayerInventory, te ) ); - this.cvc = (ContainerVibrationChamber) this.inventorySlots; + public GuiVibrationChamber(ContainerVibrationChamber container, PlayerInventory playerInventory, ITextComponent title) { + super(container, playerInventory, title); this.ySize = 166; } @@ -48,7 +47,7 @@ public class GuiVibrationChamber extends AEBaseGui { super.init(); - this.pb = new GuiProgressBar( this.cvc, "guis/vibchamber.png", 99, 36, 176, 14, 6, 18, Direction.VERTICAL ); + this.pb = new GuiProgressBar( this.container, "guis/vibchamber.png", 99, 36, 176, 14, 6, 18, Direction.VERTICAL ); this.addButton( this.pb ); } @@ -58,16 +57,16 @@ public class GuiVibrationChamber extends AEBaseGui this.font.drawString( this.getGuiDisplayName( GuiText.VibrationChamber.getLocal() ), 8, 6, 4210752 ); this.font.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 ); - this.pb.setFullMsg( TileVibrationChamber.POWER_PER_TICK * this.cvc.getCurrentProgress() / TileVibrationChamber.DILATION_SCALING + " AE/t" ); + this.pb.setFullMsg( TileVibrationChamber.POWER_PER_TICK * this.container.getCurrentProgress() / TileVibrationChamber.DILATION_SCALING + " AE/t" ); - if( this.cvc.getRemainingBurnTime() > 0 ) + if( this.container.getRemainingBurnTime() > 0 ) { - final int i1 = this.cvc.getRemainingBurnTime() * 12 / 100; + final int i1 = this.container.getRemainingBurnTime() * 12 / 100; this.bindTexture( "guis/vibchamber.png" ); - RenderSystem.color4f( 1, 1, 1 ); + RenderSystem.color3f( 1, 1, 1 ); final int l = -15; final int k = 25; - this.drawTexturedModalRect( k + 56, l + 36 + 12 - i1, 176, 12 - i1, 14, i1 + 2 ); + GuiUtils.drawTexturedModalRect( k + 56, l + 36 + 12 - i1, 176, 12 - i1, 14, i1 + 2, 0 /* FIXME this.zlevel was used */ ); } } @@ -77,6 +76,6 @@ public class GuiVibrationChamber extends AEBaseGui this.bindTexture( "guis/vibchamber.png" ); this.pb.x = 99 + this.guiLeft; this.pb.y = 36 + this.guiTop; - this.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize ); + GuiUtils.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize, 0 /* FIXME this.zlevel was used */ ); } } diff --git a/src/main/java/appeng/client/gui/implementations/GuiWireless.java b/src/main/java/appeng/client/gui/implementations/GuiWireless.java index 0128f3692..6583ddce7 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiWireless.java +++ b/src/main/java/appeng/client/gui/implementations/GuiWireless.java @@ -21,6 +21,8 @@ package appeng.client.gui.implementations; import java.io.IOException; +import net.minecraft.util.text.ITextComponent; +import net.minecraftforge.fml.client.gui.GuiUtils; import org.lwjgl.input.Mouse; import net.minecraft.client.gui.GuiButton; @@ -36,14 +38,13 @@ import appeng.tile.networking.TileWireless; import appeng.util.Platform; -public class GuiWireless extends AEBaseGui +public class GuiWireless extends AEBaseGui { private GuiImgButton units; - public GuiWireless( final PlayerInventory PlayerInventory, final TileWireless te ) - { - super( new ContainerWireless( PlayerInventory, te ) ); + public GuiWireless(ContainerWireless container, PlayerInventory playerInventory, ITextComponent title) { + super(container, playerInventory, title); this.ySize = 166; } @@ -76,12 +77,10 @@ public class GuiWireless extends AEBaseGui this.font.drawString( this.getGuiDisplayName( GuiText.Wireless.getLocal() ), 8, 6, 4210752 ); this.font.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 ); - final ContainerWireless cw = (ContainerWireless) this.inventorySlots; - - if( cw.getRange() > 0 ) + if( container.getRange() > 0 ) { - final String firstMessage = GuiText.Range.getLocal() + ": " + ( cw.getRange() / 10.0 ) + " m"; - final String secondMessage = GuiText.PowerUsageRate.getLocal() + ": " + Platform.formatPowerLong( cw.getDrain(), true ); + final String firstMessage = GuiText.Range.getLocal() + ": " + ( container.getRange() / 10.0 ) + " m"; + final String secondMessage = GuiText.PowerUsageRate.getLocal() + ": " + Platform.formatPowerLong( container.getDrain(), true ); final int strWidth = Math.max( this.font.getStringWidth( firstMessage ), this.font.getStringWidth( secondMessage ) ); final int cOffset = ( this.xSize / 2 ) - ( strWidth / 2 ); @@ -94,6 +93,6 @@ public class GuiWireless extends AEBaseGui public void drawBG( final int offsetX, final int offsetY, final int mouseX, final int mouseY ) { this.bindTexture( "guis/wireless.png" ); - this.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize ); + GuiUtils.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize, 0 /* FIXME this.zlevel was used */ ); } } diff --git a/src/main/java/appeng/client/gui/implementations/GuiWirelessTerm.java b/src/main/java/appeng/client/gui/implementations/GuiWirelessTerm.java index 79d77ca9b..d38ff2b6d 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiWirelessTerm.java +++ b/src/main/java/appeng/client/gui/implementations/GuiWirelessTerm.java @@ -19,22 +19,17 @@ package appeng.client.gui.implementations; +import appeng.container.implementations.ContainerMEPortableCell; import net.minecraft.entity.player.PlayerInventory; -import appeng.api.implementations.guiobjects.IPortableCell; +import net.minecraft.util.text.ITextComponent; - -public class GuiWirelessTerm extends GuiMEPortableCell +// FIXME: Extended from GuiPortableCell before... Why? +public class GuiWirelessTerm extends GuiMEMonitorable { - public GuiWirelessTerm( final PlayerInventory PlayerInventory, final IPortableCell te ) - { - super( PlayerInventory, te ); + public GuiWirelessTerm(ContainerMEPortableCell container, PlayerInventory playerInventory, ITextComponent title) { + super(container, playerInventory, title); } - @Override - int getMaxRows() - { - return this.defaultGetMaxRows(); - } } diff --git a/src/main/java/appeng/client/render/tesr/CrankTESR.java b/src/main/java/appeng/client/render/tesr/CrankTESR.java index 4bd4f7d9f..499b8d2a3 100644 --- a/src/main/java/appeng/client/render/tesr/CrankTESR.java +++ b/src/main/java/appeng/client/render/tesr/CrankTESR.java @@ -19,18 +19,18 @@ package appeng.client.render.tesr; +import com.mojang.blaze3d.matrix.MatrixStack; +import com.mojang.blaze3d.platform.GlStateManager; +import com.mojang.blaze3d.systems.RenderSystem; +import com.mojang.blaze3d.vertex.IVertexBuilder; +import net.minecraft.client.renderer.*; +import net.minecraft.client.renderer.model.IBakedModel; +import net.minecraft.client.renderer.texture.AtlasTexture; import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import org.lwjgl.opengl.GL11; import net.minecraft.block.BlockState; import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.BlockRendererDispatcher; -import net.minecraft.client.renderer.BufferBuilder; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.client.renderer.RenderHelper; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.block.model.IBakedModel; -import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.client.renderer.tileentity.TileEntityRenderer; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraftforge.api.distmarker.Dist; @@ -53,53 +53,68 @@ public class CrankTESR extends TileEntityRenderer } @Override - public void render( TileCrank te, double x, double y, double z, float partialTicks, int destroyStage, float p_render_10_ ) - { - // Most of this is blatantly copied from FastTESR - Tessellator tessellator = Tessellator.getInstance(); - this.bindTexture( TextureMap.LOCATION_BLOCKS_TEXTURE ); - RenderHelper.disableStandardItemLighting(); - RenderSystem.blendFunc( GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA ); - RenderSystem.enableBlend(); - GlStateManager.disableCull(); + public void render(TileCrank te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffers, int combinedLightIn, int combinedOverlayIn) { - if( Minecraft.isAmbientOcclusionEnabled() ) - { - GlStateManager.shadeModel( GL11.GL_SMOOTH ); - } - else - { - GlStateManager.shadeModel( GL11.GL_FLAT ); - } - - BlockState blockState = te.getWorld().getBlockState( te.getPos() ); - - BlockRendererDispatcher dispatcher = Minecraft.getInstance().getBlockRendererDispatcher(); - IBakedModel model = dispatcher.getModelForState( blockState ); - - BufferBuilder buffer = tessellator.getBuffer(); - buffer.begin( GL11.GL_QUADS, DefaultVertexFormats.BLOCK ); - - // The translation ensures the vertex buffer positions are relative to 0,0,0 instead of the block pos - // This makes the translations that follow much easier - buffer.setTranslation( -te.getPos().getX(), -te.getPos().getY(), -te.getPos().getZ() ); - dispatcher.getBlockModelRenderer().renderModel( te.getWorld(), model, blockState, te.getPos(), buffer, false ); - buffer.setTranslation( 0, 0, 0 ); - - GlStateManager.pushMatrix(); - GlStateManager.translate( x, y, z ); // Apply GL transformations relative to the center of the block: 1) TE rotation and 2) crank rotation - GlStateManager.translate( 0.5, 0.5, 0.5 ); - FacingToRotation.get( te.getForward(), te.getUp() ).glRotateCurrentMat(); - GlStateManager.rotate( te.getVisibleRotation(), 0, 1, 0 ); - GlStateManager.translate( -0.5, -0.5, -0.5 ); + ms.push(); + ms.translate( 0.5, 0.5, 0.5 ); + FacingToRotation.get( te.getForward(), te.getUp() ).push(ms); + ms.rotate( new Quaternion(0, te.getVisibleRotation(), 0, true) ); + ms.translate( -0.5, -0.5, -0.5 ); - tessellator.draw(); + BlockState blockState = te.getWorld().getBlockState( te.getPos() ); // FIXME: i think world might be null here + BlockRendererDispatcher dispatcher = Minecraft.getInstance().getBlockRendererDispatcher(); + IBakedModel model = dispatcher.getModelForState( blockState ); + IVertexBuilder buffer = buffers.getBuffer(Atlases.getTranslucentBlockType()); + dispatcher.getBlockModelRenderer().renderModelBrightnessColor(ms.getLast(), buffer, null, model, 1, 1, 1, combinedLightIn, combinedOverlayIn); + ms.pop(); - GlStateManager.popMatrix(); - - RenderHelper.enableStandardItemLighting(); +// // Most of this is blatantly copied from FastTESR +// Tessellator tessellator = Tessellator.getInstance(); +// this.bindTexture( AtlasTexture.LOCATION_BLOCKS_TEXTURE ); +// RenderHelper.disableStandardItemLighting(); +// RenderSystem.blendFunc( GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA ); +// RenderSystem.enableBlend(); +// RenderSystem.disableCull(); +// +// if( Minecraft.isAmbientOcclusionEnabled() ) +// { +// GlStateManager.shadeModel( GL11.GL_SMOOTH ); +// } +// else +// { +// GlStateManager.shadeModel( GL11.GL_FLAT ); +// } +// +// BlockState blockState = te.getWorld().getBlockState( te.getPos() ); +// +// BlockRendererDispatcher dispatcher = Minecraft.getInstance().getBlockRendererDispatcher(); +// IBakedModel model = dispatcher.getModelForState( blockState ); +// +// BufferBuilder buffer = tessellator.getBuffer(); +// buffer.begin( GL11.GL_QUADS, DefaultVertexFormats.BLOCK ); +// +// // The translation ensures the vertex buffer positions are relative to 0,0,0 instead of the block pos +// // This makes the translations that follow much easier +// buffer.setTranslation( -te.getPos().getX(), -te.getPos().getY(), -te.getPos().getZ() ); +// dispatcher.getBlockModelRenderer().renderModel( te.getWorld(), model, blockState, te.getPos(), buffer, false ); +// buffer.setTranslation( 0, 0, 0 ); +// +// matrixStackIn.push(); +// matrixStackIn.translate( x, y, z ); +// +// // Apply GL transformations relative to the center of the block: 1) TE rotation and 2) crank rotation +// matrixStackIn.translate( 0.5, 0.5, 0.5 ); +// FacingToRotation.get( te.getForward(), te.getUp() ).push(matrixStack); +// matrixStackIn.rotate( te.getVisibleRotation(), 0, 1, 0 ); +// matrixStackIn.translate( -0.5, -0.5, -0.5 ); +// +// tessellator.draw(); +// +// matrixStackIn.pop(); +// +// RenderHelper.enableStandardItemLighting(); } } diff --git a/src/main/java/appeng/client/render/tesr/InscriberTESR.java b/src/main/java/appeng/client/render/tesr/InscriberTESR.java index 915d709f9..7ae505a05 100644 --- a/src/main/java/appeng/client/render/tesr/InscriberTESR.java +++ b/src/main/java/appeng/client/render/tesr/InscriberTESR.java @@ -47,7 +47,7 @@ public final class InscriberTESR extends TileEntityRenderer GlStateManager.pushMatrix(); GlStateManager.translate( x, y, z ); GlStateManager.translate( 0.5F, 0.5F, 0.5F ); - FacingToRotation.get( tile.getForward(), tile.getUp() ).glRotateCurrentMat(); + FacingToRotation.get( tile.getForward(), tile.getUp() ).push(matrixStack); GlStateManager.translate( -0.5F, -0.5F, -0.5F ); RenderSystem.color4f( 1.0F, 1.0F, 1.0F, 1.0F ); @@ -57,7 +57,7 @@ public final class InscriberTESR extends TileEntityRenderer // render sides of stamps Minecraft mc = Minecraft.getInstance(); - mc.renderEngine.bindTexture( TextureMap.LOCATION_BLOCKS_TEXTURE ); + mc.renderEngine.bindTexture( AtlasTexture.LOCATION_BLOCKS_TEXTURE ); // << 20 | light << 4; final int br = tile.getWorld().getCombinedLight( tile.getPos(), 0 ); diff --git a/src/main/java/appeng/client/render/tesr/ModularTESR.java b/src/main/java/appeng/client/render/tesr/ModularTESR.java index ef6e696e4..5179360fd 100644 --- a/src/main/java/appeng/client/render/tesr/ModularTESR.java +++ b/src/main/java/appeng/client/render/tesr/ModularTESR.java @@ -51,7 +51,7 @@ public class ModularTESR extends TileEntityRenderer GlStateManager.pushMatrix(); GlStateManager.translate( x, y, z ); GlStateManager.translate( 0.5, 0.5, 0.5 ); - FacingToRotation.get( te.getForward(), te.getUp() ).glRotateCurrentMat(); + FacingToRotation.get( te.getForward(), te.getUp() ).push(matrixStackIn); GlStateManager.translate( -0.5, -0.5, -0.5 ); for( Renderable renderable : this.renderables ) { diff --git a/src/main/java/appeng/container/implementations/ContainerGrinder.java b/src/main/java/appeng/container/implementations/ContainerGrinder.java index 9418aae5a..8df072546 100644 --- a/src/main/java/appeng/container/implementations/ContainerGrinder.java +++ b/src/main/java/appeng/container/implementations/ContainerGrinder.java @@ -20,6 +20,15 @@ package appeng.container.implementations; import net.minecraft.entity.player.PlayerInventory; +import net.minecraft.entity.player.ServerPlayerEntity; +import net.minecraft.inventory.container.ContainerType; +import net.minecraft.inventory.container.INamedContainerProvider; +import net.minecraft.inventory.container.SimpleNamedContainerProvider; +import net.minecraft.network.PacketBuffer; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.text.ITextComponent; +import net.minecraftforge.fml.network.NetworkHooks; import net.minecraftforge.items.IItemHandler; import appeng.container.AEBaseContainer; @@ -28,13 +37,14 @@ import appeng.container.slot.SlotOutput; import appeng.container.slot.SlotRestrictedInput; import appeng.tile.grindstone.TileGrinder; - public class ContainerGrinder extends AEBaseContainer { - public ContainerGrinder( final PlayerInventory ip, final TileGrinder grinder ) + public static ContainerType TYPE; + + public ContainerGrinder(int id, final PlayerInventory ip, final TileGrinder grinder ) { - super( ip, grinder, null ); + super( TYPE, id, ip, grinder, null ); IItemHandler inv = grinder.getInternalInventory(); @@ -50,4 +60,22 @@ public class ContainerGrinder extends AEBaseContainer this.bindPlayerInventory( ip, 0, 176 - /* height of player inventory */82 ); } + + public static ContainerGrinder fromNetwork(int windowId, PlayerInventory inv, PacketBuffer buf) { + BlockPos pos = buf.readBlockPos(); + TileEntity te = inv.player.world.getTileEntity(pos); + if (te instanceof TileGrinder) { + return new ContainerGrinder(windowId, inv, (TileGrinder) te); + } + return null; + } + + public static void open(ServerPlayerEntity player, TileGrinder tile, ITextComponent title) { + BlockPos pos = tile.getPos(); + INamedContainerProvider container = new SimpleNamedContainerProvider( + (wnd, p, pl) -> new ContainerGrinder(wnd, p, tile), title + ); + NetworkHooks.openGui(player, container, pos); + } + } diff --git a/src/main/java/appeng/core/Registration.java b/src/main/java/appeng/core/Registration.java index ae07f4c55..4138c8776 100644 --- a/src/main/java/appeng/core/Registration.java +++ b/src/main/java/appeng/core/Registration.java @@ -21,12 +21,14 @@ package appeng.core; import appeng.bootstrap.IModelRegistry; import appeng.bootstrap.components.*; +import appeng.client.gui.implementations.GuiGrinder; import appeng.client.gui.implementations.GuiSkyChest; import appeng.client.render.effects.ChargedOreFX; import appeng.client.render.effects.LightningFX; import appeng.client.render.effects.VibrantFX; import appeng.client.render.model.GlassModelLoader; import appeng.client.render.tesr.SkyChestTESR; +import appeng.container.implementations.ContainerGrinder; import appeng.container.implementations.ContainerSkyChest; import appeng.core.stats.AeStats; import net.minecraft.block.Block; @@ -241,8 +243,12 @@ final class Registration ContainerSkyChest.TYPE = IForgeContainerType.create(ContainerSkyChest::fromNetwork); registry.register(ContainerSkyChest.TYPE.setRegistryName(AppEng.MOD_ID, "sky_chest")); + ContainerGrinder.TYPE = IForgeContainerType.create(ContainerGrinder::fromNetwork); + registry.register(ContainerGrinder.TYPE.setRegistryName(AppEng.MOD_ID, "grinder")); + DistExecutor.runWhenOn(Dist.CLIENT, () -> () -> { ScreenManager.registerFactory(ContainerSkyChest.TYPE, GuiSkyChest::new); + ScreenManager.registerFactory(ContainerGrinder.TYPE, GuiGrinder::new); }); } diff --git a/src/main/java/appeng/core/sync/GuiBridge.java b/src/main/java/appeng/core/sync/GuiBridge.java index 8d800de4a..46183a340 100644 --- a/src/main/java/appeng/core/sync/GuiBridge.java +++ b/src/main/java/appeng/core/sync/GuiBridge.java @@ -487,7 +487,6 @@ public enum GuiBridge if( this.type.isItem() ) { final ItemStack it = player.inventory.getCurrentItem(); - it.getCapability() if( !it.isEmpty() && it.getItem() instanceof IGuiItem ) { final Object myItem = ( (IGuiItem) it.getItem() ).getGuiObject( it, w, pos ); diff --git a/src/main/java/appeng/fluids/client/gui/widgets/GuiFluidTank.java b/src/main/java/appeng/fluids/client/gui/widgets/GuiFluidTank.java index 874a50b16..5dcefe7e0 100644 --- a/src/main/java/appeng/fluids/client/gui/widgets/GuiFluidTank.java +++ b/src/main/java/appeng/fluids/client/gui/widgets/GuiFluidTank.java @@ -59,7 +59,7 @@ public class GuiFluidTank extends GuiButton implements ITooltip final IAEFluidStack fluid = this.tank.getFluidInSlot( this.slot ); if( fluid != null && fluid.getStackSize() > 0 ) { - mc.getTextureManager().bindTexture( TextureMap.LOCATION_BLOCKS_TEXTURE ); + mc.getTextureManager().bindTexture( AtlasTexture.LOCATION_BLOCKS_TEXTURE ); float red = ( fluid.getFluid().getColor() >> 16 & 255 ) / 255.0F; float green = ( fluid.getFluid().getColor() >> 8 & 255 ) / 255.0F; diff --git a/src/main/java/appeng/items/parts/ItemFacade.java b/src/main/java/appeng/items/parts/ItemFacade.java index 3ae5b7074..e50b94e38 100644 --- a/src/main/java/appeng/items/parts/ItemFacade.java +++ b/src/main/java/appeng/items/parts/ItemFacade.java @@ -36,7 +36,7 @@ import net.minecraft.nbt.CompoundNBT; import net.minecraft.util.ActionResultType; import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.EnumActionResult; -import net.minecraft.util.EnumBlockRenderType; +import net.minecraft.util.BlockRenderType; import net.minecraft.util.Direction; import net.minecraft.util.Hand; import net.minecraft.util.NonNullList; diff --git a/src/main/java/appeng/items/tools/ToolNetworkTool.java b/src/main/java/appeng/items/tools/ToolNetworkTool.java index 5d8ecd412..1324a39cf 100644 --- a/src/main/java/appeng/items/tools/ToolNetworkTool.java +++ b/src/main/java/appeng/items/tools/ToolNetworkTool.java @@ -145,7 +145,7 @@ public class ToolNetworkTool extends AEBaseItem implements IGuiItem, IAEWrench { if( b.rotateBlock( w, pos, side ) ) { - b.neighborChanged( Platform.AIR_BLOCK.getDefaultState(), w, pos, Platform.AIR_BLOCK, null ); + b.neighborChanged( Platform.AIR_BLOCK.getDefaultState(), w, pos, Platform.AIR_BLOCK, null, false ); p.swingArm( hand ); return !w.isRemote; } diff --git a/src/main/java/appeng/spatial/StorageHelper.java b/src/main/java/appeng/spatial/StorageHelper.java index a1b8d99af..46cb06956 100644 --- a/src/main/java/appeng/spatial/StorageHelper.java +++ b/src/main/java/appeng/spatial/StorageHelper.java @@ -232,7 +232,7 @@ public class StorageHelper { final BlockState state = this.dst.getBlockState( pos ); final Block blk = state.getBlock(); - blk.neighborChanged( state, this.dst, pos, blk, pos ); + blk.neighborChanged( state, this.dst, pos, blk, pos, false ); } } diff --git a/src/main/java/appeng/tile/AEBaseTile.java b/src/main/java/appeng/tile/AEBaseTile.java index c62fd4c42..c4a95cfa5 100644 --- a/src/main/java/appeng/tile/AEBaseTile.java +++ b/src/main/java/appeng/tile/AEBaseTile.java @@ -467,6 +467,14 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile, this.disableDrops(); } + /** + * Checks if this tile entity is remote (we are running on the logical client side). + */ + protected boolean isRemote() { + World world = getWorld(); + return world == null || world.isRemote(); + } + public void disableDrops() { DROP_NO_ITEMS.set( new WeakReference<>( this ) ); diff --git a/src/main/java/appeng/tile/grindstone/TileCrank.java b/src/main/java/appeng/tile/grindstone/TileCrank.java index b0fd4973d..6fa075df3 100644 --- a/src/main/java/appeng/tile/grindstone/TileCrank.java +++ b/src/main/java/appeng/tile/grindstone/TileCrank.java @@ -19,34 +19,25 @@ package appeng.tile.grindstone; -import java.io.IOException; -import java.util.Collections; -import java.util.List; - +import appeng.api.implementations.tiles.ICrankable; +import appeng.tile.AEBaseTile; import net.minecraft.block.BlockState; -import net.minecraft.entity.Entity; import net.minecraft.network.PacketBuffer; import net.minecraft.tileentity.ITickableTileEntity; import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntityType; import net.minecraft.util.Direction; -import net.minecraft.util.math.AxisAlignedBB; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; -import appeng.api.implementations.tiles.ICrankable; -import appeng.helpers.ICustomCollision; -import appeng.tile.AEBaseTile; -import appeng.util.Platform; +import java.io.IOException; -public class TileCrank extends AEBaseTile implements ICustomCollision, ITickableTileEntity +public class TileCrank extends AEBaseTile implements ITickableTileEntity { private final int ticksPerRotation = 18; // sided values.. - private float visibleRotation = 0; + private float visibleRotation = 0; // This is in degrees private int charge = 0; private int hits = 0; @@ -61,7 +52,7 @@ public class TileCrank extends AEBaseTile implements ICustomCollision, ITickable { if( this.rotation > 0 ) { - this.setVisibleRotation( this.getVisibleRotation() - 360 / ( this.ticksPerRotation ) ); + this.setVisibleRotation( this.getVisibleRotation() - 360.0f / ( this.ticksPerRotation ) ); this.charge++; if( this.charge >= this.ticksPerRotation ) { @@ -79,7 +70,7 @@ public class TileCrank extends AEBaseTile implements ICustomCollision, ITickable private ICrankable getGrinder() { - if( Platform.isClient() ) + if( isRemote() ) { return null; } @@ -113,7 +104,7 @@ public class TileCrank extends AEBaseTile implements ICustomCollision, ITickable { super.setOrientation( inForward, inUp ); final BlockState state = this.world.getBlockState( this.pos ); - this.getBlockType().neighborChanged( state, this.world, this.pos, state.getBlock(), this.pos ); + state.getBlock().neighborChanged( state, this.world, this.pos, state.getBlock(), this.pos, false ); } /** @@ -121,7 +112,7 @@ public class TileCrank extends AEBaseTile implements ICustomCollision, ITickable */ public boolean power() { - if( Platform.isClient() ) + if( isRemote() ) { return false; } @@ -152,24 +143,7 @@ public class TileCrank extends AEBaseTile implements ICustomCollision, ITickable return false; } - @Override - public Iterable getSelectedBoundingBoxesFromPool( final World w, final BlockPos pos, final Entity thePlayer, final boolean b ) - { - final double xOff = -0.15 * this.getUp().getXOffset(); - final double yOff = -0.15 * this.getUp().getYOffset(); - final double zOff = -0.15 * this.getUp().getZOffset(); - return Collections.singletonList( new AxisAlignedBB( xOff + 0.15, yOff + 0.15, zOff + 0.15, xOff + 0.85, yOff + 0.85, zOff + 0.85 ) ); - } - @Override - public void addCollidingBlockToList( final World w, final BlockPos pos, final AxisAlignedBB bb, final List out, final Entity e ) - { - final double xOff = -0.15 * this.getUp().getXOffset(); - final double yOff = -0.15 * this.getUp().getYOffset(); - final double zOff = -0.15 * this.getUp().getZOffset(); - out.add( new AxisAlignedBB( xOff + 0.15, yOff + 0.15, zOff + 0.15, // ahh - xOff + 0.85, yOff + 0.85, zOff + 0.85 ) ); - } public float getVisibleRotation() { diff --git a/src/main/java/appeng/tile/grindstone/TileGrinder.java b/src/main/java/appeng/tile/grindstone/TileGrinder.java index a1328271a..8f19e0b9c 100644 --- a/src/main/java/appeng/tile/grindstone/TileGrinder.java +++ b/src/main/java/appeng/tile/grindstone/TileGrinder.java @@ -22,6 +22,7 @@ package appeng.tile.grindstone; import java.util.ArrayList; import java.util.List; +import appeng.core.Api; import net.minecraft.block.BlockState; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntityType; @@ -57,7 +58,7 @@ public class TileGrinder extends AEBaseInvTile implements ICrankable { super.setOrientation( inForward, inUp ); final BlockState state = this.world.getBlockState( this.pos ); - this.getBlockType().neighborChanged( state, this.world, this.pos, state.getBlock(), this.pos ); + state.getBlock().neighborChanged( state, this.world, this.pos, state.getBlock(), this.pos, false ); } @Override @@ -81,7 +82,7 @@ public class TileGrinder extends AEBaseInvTile implements ICrankable @Override public boolean canTurn() { - if( Platform.isClient() ) + if( isRemote() ) { return false; } @@ -124,7 +125,7 @@ public class TileGrinder extends AEBaseInvTile implements ICrankable @Override public void applyTurn() { - if( Platform.isClient() ) + if( isRemote() ) { return; } diff --git a/src/main/java/appeng/tile/qnb/TileQuantumBridge.java b/src/main/java/appeng/tile/qnb/TileQuantumBridge.java index 83a57fa4d..3a59da6a2 100644 --- a/src/main/java/appeng/tile/qnb/TileQuantumBridge.java +++ b/src/main/java/appeng/tile/qnb/TileQuantumBridge.java @@ -23,6 +23,7 @@ import java.io.IOException; import java.util.EnumSet; import java.util.Optional; +import appeng.core.Api; import net.minecraft.block.Block; import net.minecraft.item.ItemStack; import net.minecraft.nbt.CompoundNBT; diff --git a/src/main/java/appeng/util/Platform.java b/src/main/java/appeng/util/Platform.java index 38e6b5edf..91fa01e52 100644 --- a/src/main/java/appeng/util/Platform.java +++ b/src/main/java/appeng/util/Platform.java @@ -360,8 +360,7 @@ public class Platform */ public static boolean isClient() { - // FIXME fishy - return CLIENT_INSTALL; + return Thread.currentThread().getThreadGroup() == SidedThreadGroups.CLIENT; } /*