Grindr, GUI, Container.

This commit is contained in:
Sebastian Hartte
2020-06-02 22:52:35 +02:00
parent cf9ab8a13b
commit 2de3a2ecee
65 changed files with 509 additions and 495 deletions
@@ -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 )
@@ -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<TileCrank>
@@ -63,21 +66,22 @@ public class BlockCrank extends AEBaseTileBlock<TileCrank>
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<TileCrank>
}
@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<TileCrank>
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<TileCrank>
}
@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<TileCrank>
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));
}
}
}
@@ -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<TileGrinder>
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;
@@ -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
@@ -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() ) )
@@ -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 );
@@ -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
@@ -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 )
{
@@ -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() )
{
@@ -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 )
@@ -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 );
@@ -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 )
@@ -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 )
@@ -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 )
@@ -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 )
@@ -75,7 +75,6 @@ import java.util.*;
import java.util.concurrent.TimeUnit;
//TODO, pass generic up here for Container
public abstract class AEBaseGui<T extends AEBaseContainer> extends ContainerScreen<T>
{
private final List<InternalSlotME> meSlots = new ArrayList<>();
@@ -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<T extends AEBaseContainer> extends AEBaseGui<T>
{
public AEBaseMEGui( final Container container )
{
super( container );
public AEBaseMEGui(T container, PlayerInventory playerInventory, ITextComponent title) {
super(container, playerInventory, title);
}
@Override
@@ -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<ContainerCellWorkbench>
{
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
@@ -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<ContainerChest>
{
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 */ );
}
}
@@ -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<ContainerCondenser>
{
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 */ );
}
}
@@ -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<ContainerCraftAmount>
{
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
{
@@ -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<ContainerCraftConfirm>
{
private final ContainerCraftConfirm ccc;
private final int rows = 5;
private final IItemList<IAEItemStack> 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()
@@ -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<ContainerCraftingCPU> 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<IAEItemStack> storage = Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ).createList();
private IItemList<IAEItemStack> active = Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ).createList();
private IItemList<IAEItemStack> 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<IAEItemStack> list, final byte ref )
@@ -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();
}
@@ -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<ContainerCraftingTerm>
{
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 )
{
@@ -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<ContainerDrive>
{
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 */ );
}
}
@@ -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<ContainerFormationPlane>
{
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;
}
@@ -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<ContainerGrinder>
{
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 */ );
}
}
@@ -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<ContainerIOPort>
{
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;
}
@@ -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<ContainerInscriber>
{
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 */ );
}
}
@@ -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<ContainerInterface>
{
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;
}
@@ -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<ContainerInterfaceTerminal>
{
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<Slot> o = this.inventorySlots.inventorySlots.iterator();
final Iterator<Slot> 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;
}
@@ -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<ContainerLevelEmitter>
{
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
@@ -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<ContainerMAC>
{
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
@@ -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<T extends ContainerMEMonitorable> extends AEBaseMEGui<T> 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();
}
@@ -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<ContainerMEPortableCell>
{
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
@@ -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<ContainerNetworkStatus> 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<IAEItemStack> list )
@@ -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<ContainerNetworkTool>
{
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 */ );
}
}
@@ -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<ContainerPatternTerm>
{
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 );
}
@@ -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<ContainerPriority>
{
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();
}
@@ -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<ContainerQNB>
{
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 */ );
}
}
@@ -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<ContainerQuartzKnife>
{
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 )
@@ -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<ContainerSecurityStation>
{
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";
}
@@ -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<ContainerSpatialIOPort>
{
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 */ );
}
}
@@ -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<ContainerStorageBus>
{
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;
}
@@ -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<T extends ContainerUpgradeable> extends AEBaseGui<T>
{
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 */ );
}
}
@@ -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<ContainerVibrationChamber>
{
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 */ );
}
}
@@ -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<ContainerWireless>
{
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 */ );
}
}
@@ -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<ContainerMEPortableCell>
{
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();
}
}
@@ -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<TileCrank>
}
@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();
}
}
@@ -47,7 +47,7 @@ public final class InscriberTESR extends TileEntityRenderer<TileInscriber>
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<TileInscriber>
// 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 );
@@ -51,7 +51,7 @@ public class ModularTESR<T extends AEBaseTile> extends TileEntityRenderer<T>
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 )
{
@@ -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<ContainerGrinder> 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);
}
}
@@ -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);
});
}
@@ -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 );
@@ -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;
@@ -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;
@@ -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;
}
@@ -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 );
}
}
@@ -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 ) );
@@ -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<AxisAlignedBB> 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<AxisAlignedBB> 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()
{
@@ -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;
}
@@ -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;
+1 -2
View File
@@ -360,8 +360,7 @@ public class Platform
*/
public static boolean isClient()
{
// FIXME fishy
return CLIENT_INSTALL;
return Thread.currentThread().getThreadGroup() == SidedThreadGroups.CLIENT;
}
/*