Work on GUIs (specifically to get SkyChest GUI)

This commit is contained in:
Sebastian Hartte
2020-06-02 02:14:09 +02:00
parent 271e8889a1
commit 9f63859769
109 changed files with 1133 additions and 1301 deletions
+29
View File
@@ -162,6 +162,35 @@ sourceSets {
include 'appeng/server/ServerHelper.java' include 'appeng/server/ServerHelper.java'
include 'appeng/core/CommonHelper.java' include 'appeng/core/CommonHelper.java'
include 'appeng/helpers/IMouseWheelItem.java' include 'appeng/helpers/IMouseWheelItem.java'
include 'appeng/client/gui/AEBaseGui.java'
include 'appeng/client/gui/widgets/ITooltip.java'
include 'appeng/client/gui/widgets/GuiCustomSlot.java'
include 'appeng/client/gui/widgets/IScrollSource.java'
include 'appeng/client/gui/widgets/GuiScrollbar.java'
include 'appeng/client/me/**'
include 'appeng/client/gui/widgets/ISortSource.java'
include 'appeng/items/storage/ItemViewCell.java'
include 'appeng/util/ItemSorters.java'
include 'appeng/util/prioritylist/**'
include 'appeng/fluids/util/**'
include 'appeng/fluids/container/slots/IMEFluidSlot.java'
include 'appeng/fluids/items/FluidDummyItem.java'
include 'appeng/items/contents/**'
include 'appeng/container/interfaces/IInventorySlotAware.java'
include 'appeng/me/helpers/**'
include 'appeng/me/cluster/*'
include 'appeng/util/iterators/*'
include 'appeng/util/inv/**'
include 'appeng/util/InventoryAdaptor.java'
include 'appeng/tile/inventory/AppEngInternalAEInventory.java'
include 'appeng/core/worlddata/**'
include 'appeng/services/compass/**'
include 'appeng/services/CompassService*'
include 'appeng/parts/automation/StackUpgradeInventory*'
include 'appeng/parts/automation/UpgradeInventory*'
include 'appeng/me/GridStorage*'
include 'appeng/capabilities/*'
include 'appeng/container/slot/AppEngSlot*'
} }
compileClasspath += sourceSets.api.output compileClasspath += sourceSets.api.output
runtimeClasspath += sourceSets.api.output runtimeClasspath += sourceSets.api.output
@@ -106,6 +106,8 @@ public interface IItems
IItemDefinition crystalSeed(); IItemDefinition crystalSeed();
IItemDefinition dummyFluidItem();
// rv1 // rv1
IItemDefinition encodedPattern(); IItemDefinition encodedPattern();
+4 -4
View File
@@ -104,7 +104,7 @@ public enum AEColor
/** /**
* Unlocalized name for color. * Unlocalized name for color.
*/ */
public final String unlocalizedName; public final String translationKey;
/** /**
* Darkest Variant of the color, nearly black; as a RGB HEX Integer * Darkest Variant of the color, nearly black; as a RGB HEX Integer
@@ -126,9 +126,9 @@ public enum AEColor
*/ */
public final DyeColor dye; public final DyeColor dye;
AEColor( final String unlocalizedName, final DyeColor dye, final int blackHex, final int medHex, final int whiteHex ) AEColor(final String translationKey, final DyeColor dye, final int blackHex, final int medHex, final int whiteHex )
{ {
this.unlocalizedName = unlocalizedName; this.translationKey = translationKey;
this.blackVariant = blackHex; this.blackVariant = blackHex;
this.mediumVariant = medHex; this.mediumVariant = medHex;
this.whiteVariant = whiteHex; this.whiteVariant = whiteHex;
@@ -176,7 +176,7 @@ public enum AEColor
@Override @Override
public String toString() public String toString()
{ {
return this.unlocalizedName; return this.translationKey;
} }
} }
@@ -208,7 +208,7 @@ public class BlockCableBus extends AEBaseTileBlock implements IAEFacade
@Override @Override
public boolean removedByPlayer( final BlockState state, final World world, final BlockPos pos, final PlayerEntity player, final boolean willHarvest ) public boolean removedByPlayer( final BlockState state, final World world, final BlockPos pos, final PlayerEntity player, final boolean willHarvest )
{ {
if( player.capabilities.isCreativeMode ) if( player.abilities.isCreativeMode )
{ {
final AEBaseTile tile = this.getTileEntity( world, pos ); final AEBaseTile tile = this.getTileEntity( world, pos );
if( tile != null ) if( tile != null )
@@ -19,11 +19,10 @@
package appeng.block.storage; package appeng.block.storage;
import java.util.Collections;
import java.util.List;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import appeng.api.util.AEPartLocation;
import appeng.core.sync.GuiBridge;
import net.minecraft.block.BlockRenderType; import net.minecraft.block.BlockRenderType;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
@@ -80,7 +79,7 @@ public class BlockSkyChest extends AEBaseTileBlock<TileSkyChest>
{ {
if( Platform.isServer() ) if( Platform.isServer() )
{ {
// FIXME Platform.openGUI( player, this.getTileEntity( w, pos ), AEPartLocation.fromFacing(hit.getFace()), GuiBridge.GUI_SKYCHEST ); Platform.openGUI( player, this.getTileEntity( w, pos ), AEPartLocation.fromFacing(hit.getFace()), GuiBridge.GUI_SKYCHEST );
} }
return ActionResultType.SUCCESS; return ActionResultType.SUCCESS;
@@ -1,66 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.block.storage;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import appeng.bootstrap.BlockRenderingCustomizer;
import appeng.bootstrap.IBlockRendering;
import appeng.bootstrap.IItemRendering;
import appeng.client.render.tesr.SkyChestTESR;
public class SkyChestRenderingCustomizer extends BlockRenderingCustomizer
{
private final BlockSkyChest.SkyChestType type;
public SkyChestRenderingCustomizer( BlockSkyChest.SkyChestType type )
{
this.type = type;
}
@OnlyIn( Dist.CLIENT )
@Override
public void customize( IBlockRendering rendering, IItemRendering itemRendering )
{
// Register a custom non-tesr item model
// FIXME: This should not be required anymore!
// FIXME String modelName = this.getModelFromType();
// FIXME ModelResourceLocation model = new ModelResourceLocation( "appliedenergistics2:" + modelName, "inventory" );
// FIXME itemRendering.model( model ).variants( model );
}
private String getModelFromType()
{
final String modelName;
switch( this.type )
{
default:
case STONE:
modelName = "sky_stone_chest";
break;
case BLOCK:
modelName = "smooth_sky_stone_chest";
break;
}
return modelName;
}
}
+173 -186
View File
@@ -19,50 +19,6 @@
package appeng.client.gui; package appeng.client.gui;
import java.io.IOException;
import java.text.DecimalFormat;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import com.google.common.base.Joiner;
import com.google.common.base.Stopwatch;
import com.google.common.collect.Lists;
import net.minecraft.client.gui.screen.inventory.ContainerScreen;
import net.minecraft.client.gui.widget.button.Button;
import net.minecraft.client.renderer.texture.AtlasTexture;
import net.minecraft.inventory.container.ClickType;
import net.minecraft.inventory.container.Slot;
import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.inventory.GuiContainer;
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.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.inventory.ClickType;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.TextFormatting;
import net.minecraftforge.fluids.Fluid;
import appeng.api.storage.data.IAEFluidStack; import appeng.api.storage.data.IAEFluidStack;
import appeng.api.storage.data.IAEItemStack; import appeng.api.storage.data.IAEItemStack;
import appeng.client.gui.widgets.GuiCustomSlot; import appeng.client.gui.widgets.GuiCustomSlot;
@@ -73,17 +29,8 @@ import appeng.client.me.SlotDisconnected;
import appeng.client.me.SlotME; import appeng.client.me.SlotME;
import appeng.client.render.StackSizeRenderer; import appeng.client.render.StackSizeRenderer;
import appeng.container.AEBaseContainer; import appeng.container.AEBaseContainer;
import appeng.container.slot.AppEngCraftingSlot; import appeng.container.slot.*;
import appeng.container.slot.AppEngSlot;
import appeng.container.slot.AppEngSlot.hasCalculatedValidness; import appeng.container.slot.AppEngSlot.hasCalculatedValidness;
import appeng.container.slot.IOptionalSlot;
import appeng.container.slot.SlotCraftingTerm;
import appeng.container.slot.SlotDisabled;
import appeng.container.slot.SlotFake;
import appeng.container.slot.SlotInaccessible;
import appeng.container.slot.SlotOutput;
import appeng.container.slot.SlotPatternTerm;
import appeng.container.slot.SlotRestrictedInput;
import appeng.core.AELog; import appeng.core.AELog;
import appeng.core.AppEng; import appeng.core.AppEng;
import appeng.core.sync.network.NetworkHandler; import appeng.core.sync.network.NetworkHandler;
@@ -92,6 +39,40 @@ import appeng.core.sync.packets.PacketSwapSlots;
import appeng.fluids.client.render.FluidStackSizeRenderer; import appeng.fluids.client.render.FluidStackSizeRenderer;
import appeng.fluids.container.slots.IMEFluidSlot; import appeng.fluids.container.slots.IMEFluidSlot;
import appeng.helpers.InventoryAction; import appeng.helpers.InventoryAction;
import com.google.common.base.Joiner;
import com.google.common.base.Stopwatch;
import com.google.common.collect.Lists;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.screen.inventory.ContainerScreen;
import net.minecraft.client.gui.widget.Widget;
import net.minecraft.client.gui.widget.button.Button;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.texture.AtlasTexture;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.client.util.InputMappings;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.fluid.Fluid;
import net.minecraft.inventory.container.ClickType;
import net.minecraft.inventory.container.Container;
import net.minecraft.inventory.container.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextFormatting;
import net.minecraftforge.fluids.FluidAttributes;
import net.minecraftforge.fml.client.gui.GuiUtils;
import org.lwjgl.glfw.GLFW;
import org.lwjgl.opengl.GL11;
import java.io.IOException;
import java.text.DecimalFormat;
import java.text.ParseException;
import java.util.*;
import java.util.concurrent.TimeUnit;
public abstract class AEBaseGui extends ContainerScreen<AEBaseContainer> public abstract class AEBaseGui extends ContainerScreen<AEBaseContainer>
@@ -108,9 +89,8 @@ public abstract class AEBaseGui extends ContainerScreen<AEBaseContainer>
private Slot bl_clicked; private Slot bl_clicked;
protected final List<GuiCustomSlot> guiSlots = new ArrayList<>(); protected final List<GuiCustomSlot> guiSlots = new ArrayList<>();
public AEBaseGui( final Container container ) public AEBaseGui(AEBaseContainer container, PlayerInventory playerInventory, ITextComponent title) {
{ super(container, playerInventory, title);
super( container );
} }
protected static String join( final Collection<String> toolTip, final String delimiter ) protected static String join( final Collection<String> toolTip, final String delimiter )
@@ -120,12 +100,12 @@ public abstract class AEBaseGui extends ContainerScreen<AEBaseContainer>
return joiner.join( toolTip ); return joiner.join( toolTip );
} }
protected int getQty( final GuiButton btn ) protected int getQty( final Button btn )
{ {
try try
{ {
final DecimalFormat df = new DecimalFormat( "+#;-#" ); final DecimalFormat df = new DecimalFormat( "+#;-#" );
return df.parse( btn.displayString ).intValue(); return df.parse( btn.getMessage() ).intValue();
} }
catch( final ParseException e ) catch( final ParseException e )
{ {
@@ -134,9 +114,9 @@ public abstract class AEBaseGui extends ContainerScreen<AEBaseContainer>
} }
@Override @Override
public void initGui() public void init()
{ {
super.initGui(); super.init();
final List<Slot> slots = this.getInventorySlots(); final List<Slot> slots = this.getInventorySlots();
final Iterator<Slot> i = slots.iterator(); final Iterator<Slot> i = slots.iterator();
@@ -156,32 +136,32 @@ public abstract class AEBaseGui extends ContainerScreen<AEBaseContainer>
private List<Slot> getInventorySlots() private List<Slot> getInventorySlots()
{ {
return this.inventorySlots.inventorySlots; return this.container.inventorySlots;
} }
@Override @Override
public void drawScreen( final int mouseX, final int mouseY, final float partialTicks ) public void render(final int mouseX, final int mouseY, final float partialTicks )
{ {
super.drawDefaultBackground(); super.renderBackground();
super.drawScreen( mouseX, mouseY, partialTicks ); super.render( mouseX, mouseY, partialTicks );
GlStateManager.pushMatrix(); RenderSystem.pushMatrix();
GlStateManager.translate( this.guiLeft, this.guiTop, 0.0F ); RenderSystem.translatef( this.guiLeft, this.guiTop, 0.0F );
GlStateManager.enableDepth(); RenderSystem.enableDepthTest();
for( final GuiCustomSlot c : this.guiSlots ) for( final GuiCustomSlot c : this.guiSlots )
{ {
this.drawGuiSlot( c, mouseX, mouseY, partialTicks ); this.drawGuiSlot( c, mouseX, mouseY, partialTicks );
} }
GlStateManager.disableDepth(); RenderSystem.disableDepthTest();
for( final GuiCustomSlot c : this.guiSlots ) for( final GuiCustomSlot c : this.guiSlots )
{ {
this.drawTooltip( c, mouseX - this.guiLeft, mouseY - this.guiTop ); this.drawTooltip( c, mouseX - this.guiLeft, mouseY - this.guiTop );
} }
GlStateManager.popMatrix(); RenderSystem.popMatrix();
this.renderHoveredToolTip( mouseX, mouseY ); this.renderHoveredToolTip( mouseX, mouseY );
for( final Object c : this.buttonList ) for( final Object c : this.buttons )
{ {
if( c instanceof ITooltip ) if( c instanceof ITooltip )
{ {
@@ -201,13 +181,13 @@ public abstract class AEBaseGui extends ContainerScreen<AEBaseContainer>
slot.drawContent( this.minecraft, mouseX, mouseY, partialTicks ); slot.drawContent( this.minecraft, mouseX, mouseY, partialTicks );
if( this.isPointInRegion( left, top, slot.getWidth(), slot.getHeight(), mouseX, mouseY ) && slot.canClick( this.mc.player ) ) if( this.isPointInRegion( left, top, slot.getWidth(), slot.getHeight(), mouseX, mouseY ) && slot.canClick( this.minecraft.player ) )
{ {
GlStateManager.disableLighting(); RenderSystem.disableLighting();
GlStateManager.colorMask( true, true, true, false ); RenderSystem.colorMask( true, true, true, false );
this.drawGradientRect( left, top, right, bottom, -2130706433, -2130706433 ); this.fillGradient( left, top, right, bottom, -2130706433, -2130706433 );
GlStateManager.colorMask( true, true, true, true ); RenderSystem.colorMask( true, true, true, true );
GlStateManager.enableLighting(); RenderSystem.enableLighting();
} }
} }
} }
@@ -260,7 +240,7 @@ public abstract class AEBaseGui extends ContainerScreen<AEBaseContainer>
lines.set( i, TextFormatting.GRAY + lines.get( i ) ); lines.set( i, TextFormatting.GRAY + lines.get( i ) );
} }
this.drawHoveringText( lines, x, y, this.fontRenderer ); this.renderTooltip( lines, x, y, this.font );
} }
@Override @Override
@@ -268,7 +248,7 @@ public abstract class AEBaseGui extends ContainerScreen<AEBaseContainer>
{ {
final int ox = this.guiLeft; // (width - xSize) / 2; final int ox = this.guiLeft; // (width - xSize) / 2;
final int oy = this.guiTop; // (height - ySize) / 2; final int oy = this.guiTop; // (height - ySize) / 2;
GlStateManager.color( 1.0F, 1.0F, 1.0F, 1.0F ); RenderSystem.color4f( 1.0F, 1.0F, 1.0F, 1.0F );
if( this.getScrollBar() != null ) if( this.getScrollBar() != null )
{ {
@@ -285,7 +265,7 @@ public abstract class AEBaseGui extends ContainerScreen<AEBaseContainer>
{ {
final int ox = this.guiLeft; // (width - xSize) / 2; final int ox = this.guiLeft; // (width - xSize) / 2;
final int oy = this.guiTop; // (height - ySize) / 2; final int oy = this.guiTop; // (height - ySize) / 2;
GlStateManager.color( 1.0F, 1.0F, 1.0F, 1.0F ); RenderSystem.color4f( 1.0F, 1.0F, 1.0F, 1.0F );
this.drawBG( ox, oy, x, y ); this.drawBG( ox, oy, x, y );
final List<Slot> slots = this.getInventorySlots(); final List<Slot> slots = this.getInventorySlots();
@@ -299,18 +279,20 @@ public abstract class AEBaseGui extends ContainerScreen<AEBaseContainer>
final AppEngSlot aeSlot = (AppEngSlot) slot; final AppEngSlot aeSlot = (AppEngSlot) slot;
if( aeSlot.isSlotEnabled() ) if( aeSlot.isSlotEnabled() )
{ {
this.drawTexturedModalRect( ox + aeSlot.xPos - 1, oy + aeSlot.yPos - 1, optionalSlot.getSourceX() - 1, optionalSlot.getSourceY() - 1, GuiUtils.drawTexturedModalRect( ox + aeSlot.xPos - 1, oy + aeSlot.yPos - 1, optionalSlot.getSourceX() - 1, optionalSlot.getSourceY() - 1,
18, 18,
18 ); 18,
0 /* FIXME: Check, this used this.zLevel before */);
} }
else else
{ {
GlStateManager.color( 1.0F, 1.0F, 1.0F, 0.4F ); RenderSystem.color4f( 1.0F, 1.0F, 1.0F, 0.4F );
GlStateManager.enableBlend(); RenderSystem.enableBlend();
this.drawTexturedModalRect( ox + aeSlot.xPos - 1, oy + aeSlot.yPos - 1, optionalSlot.getSourceX() - 1, optionalSlot.getSourceY() - 1, GuiUtils.drawTexturedModalRect( ox + aeSlot.xPos - 1, oy + aeSlot.yPos - 1, optionalSlot.getSourceX() - 1, optionalSlot.getSourceY() - 1,
18, 18,
18 ); 18,
GlStateManager.color( 1.0F, 1.0F, 1.0F, 1.0F ); 0 /* FIXME: Check, this used this.zLevel before */);
RenderSystem.color4f( 1.0F, 1.0F, 1.0F, 1.0F );
} }
} }
} }
@@ -324,48 +306,48 @@ public abstract class AEBaseGui extends ContainerScreen<AEBaseContainer>
} }
@Override @Override
protected void mouseClicked( final int xCoord, final int yCoord, final int btn ) throws IOException public boolean mouseClicked( final double xCoord, final double yCoord, final int btn )
{ {
this.drag_click.clear(); this.drag_click.clear();
if( btn == 1 ) if( btn == 1 )
{ {
for( final Object o : this.buttonList ) for( final Object o : this.buttons )
{ {
final GuiButton guibutton = (GuiButton) o; final Widget widget = (Widget) o;
if( guibutton.mousePressed( this.mc, xCoord, yCoord ) ) if( widget.isMouseOver( xCoord, yCoord ) )
{ {
super.mouseClicked( xCoord, yCoord, 0 ); return super.mouseClicked( xCoord, yCoord, 0 );
return;
} }
} }
} }
for( GuiCustomSlot slot : this.guiSlots ) for( GuiCustomSlot slot : this.guiSlots )
{ {
if( this.isPointInRegion( slot.xPos(), slot.yPos(), slot.getWidth(), slot.getHeight(), xCoord, yCoord ) && slot.canClick( this.mc.player ) ) if( this.isPointInRegion( slot.xPos(), slot.yPos(), slot.getWidth(), slot.getHeight(), xCoord, yCoord ) && slot.canClick( this.minecraft.player ) )
{ {
slot.slotClicked( this.mc.player.inventory.getItemStack(), btn ); slot.slotClicked( this.minecraft.player.inventory.getItemStack(), btn );
} }
} }
if( this.getScrollBar() != null ) if( this.getScrollBar() != null )
{ {
this.getScrollBar().click( this, xCoord - this.guiLeft, yCoord - this.guiTop ); this.getScrollBar().click(xCoord - this.guiLeft, yCoord - this.guiTop );
} }
super.mouseClicked( xCoord, yCoord, btn ); return super.mouseClicked( xCoord, yCoord, btn );
} }
@Override @Override
protected void mouseClickMove( final int x, final int y, final int c, final long d ) public boolean mouseDragged(double mouseX, double mouseY, int mouseButton, double dragX, double dragY) {
{
final Slot slot = this.getSlot( x, y ); final Slot slot = this.getSlot( (int) mouseX, (int) mouseY );
final ItemStack itemstack = this.mc.player.inventory.getItemStack(); final ItemStack itemstack = this.minecraft.player.inventory.getItemStack();
if( this.getScrollBar() != null ) if( this.getScrollBar() != null )
{ {
this.getScrollBar().click( this, x - this.guiLeft, y - this.guiTop ); // FIXME: Coordinate system of mouseX/mouseY is unclear
this.getScrollBar().click((int) mouseX - this.guiLeft, (int) mouseY - this.guiTop );
} }
if( slot instanceof SlotFake && !itemstack.isEmpty() ) if( slot instanceof SlotFake && !itemstack.isEmpty() )
@@ -375,14 +357,16 @@ public abstract class AEBaseGui extends ContainerScreen<AEBaseContainer>
{ {
for( final Slot dr : this.drag_click ) for( final Slot dr : this.drag_click )
{ {
final PacketInventoryAction p = new PacketInventoryAction( c == 0 ? InventoryAction.PICKUP_OR_SET_DOWN : InventoryAction.PLACE_SINGLE, dr.slotNumber, 0 ); final PacketInventoryAction p = new PacketInventoryAction( mouseButton == 0 ? InventoryAction.PICKUP_OR_SET_DOWN : InventoryAction.PLACE_SINGLE, dr.slotNumber, 0 );
NetworkHandler.instance().sendToServer( p ); NetworkHandler.instance().sendToServer( p );
} }
} }
return true;
} }
else else
{ {
super.mouseClickMove( x, y, c, d ); return super.mouseDragged( mouseX, mouseY, mouseButton, dragX, dragY );
} }
} }
@@ -416,7 +400,7 @@ public abstract class AEBaseGui extends ContainerScreen<AEBaseContainer>
try try
{ {
NetworkHandler.instance().sendToServer( ( (SlotPatternTerm) slot ).getRequest( isShiftKeyDown() ) ); NetworkHandler.instance().sendToServer( ( (SlotPatternTerm) slot ).getRequest( hasShiftDown() ) );
} }
catch( final IOException e ) catch( final IOException e )
{ {
@@ -431,7 +415,7 @@ public abstract class AEBaseGui extends ContainerScreen<AEBaseContainer>
} }
InventoryAction action = null; InventoryAction action = null;
if( isShiftKeyDown() ) if( hasShiftDown() )
{ {
action = InventoryAction.CRAFT_SHIFT; action = InventoryAction.CRAFT_SHIFT;
} }
@@ -447,7 +431,7 @@ public abstract class AEBaseGui extends ContainerScreen<AEBaseContainer>
return; return;
} }
if( Keyboard.isKeyDown( Keyboard.KEY_SPACE ) ) if( InputMappings.isKeyDown(Minecraft.getInstance().getMainWindow().getHandle(), GLFW.GLFW_KEY_SPACE) )
{ {
if( this.enableSpaceClicking() ) if( this.enableSpaceClicking() )
{ {
@@ -464,7 +448,7 @@ public abstract class AEBaseGui extends ContainerScreen<AEBaseContainer>
slotNum = slot.slotNumber; slotNum = slot.slotNumber;
} }
( (AEBaseContainer) this.inventorySlots ).setTargetStack( stack ); ( (AEBaseContainer) this.container ).setTargetStack( stack );
final PacketInventoryAction p = new PacketInventoryAction( InventoryAction.MOVE_REGION, slotNum, 0 ); final PacketInventoryAction p = new PacketInventoryAction( InventoryAction.MOVE_REGION, slotNum, 0 );
NetworkHandler.instance().sendToServer( p ); NetworkHandler.instance().sendToServer( p );
return; return;
@@ -486,7 +470,7 @@ public abstract class AEBaseGui extends ContainerScreen<AEBaseContainer>
case CLONE: // creative dupe: case CLONE: // creative dupe:
if( player.capabilities.isCreativeMode ) if( player.abilities.isCreativeMode )
{ {
action = InventoryAction.CREATIVE_DUPLICATE; action = InventoryAction.CREATIVE_DUPLICATE;
} }
@@ -536,7 +520,7 @@ public abstract class AEBaseGui extends ContainerScreen<AEBaseContainer>
{ {
action = InventoryAction.AUTO_CRAFT; action = InventoryAction.AUTO_CRAFT;
} }
else if( player.capabilities.isCreativeMode ) else if( player.abilities.isCreativeMode )
{ {
final IAEItemStack slotItem = ( (SlotME) slot ).getAEStack(); final IAEItemStack slotItem = ( (SlotME) slot ).getAEStack();
if( slotItem != null ) if( slotItem != null )
@@ -552,7 +536,7 @@ public abstract class AEBaseGui extends ContainerScreen<AEBaseContainer>
if( action != null ) if( action != null )
{ {
( (AEBaseContainer) this.inventorySlots ).setTargetStack( stack ); ( (AEBaseContainer) this.container ).setTargetStack( stack );
final PacketInventoryAction p = new PacketInventoryAction( action, this.getInventorySlots().size(), 0 ); final PacketInventoryAction p = new PacketInventoryAction( action, this.getInventorySlots().size(), 0 );
NetworkHandler.instance().sendToServer( p ); NetworkHandler.instance().sendToServer( p );
} }
@@ -560,7 +544,7 @@ public abstract class AEBaseGui extends ContainerScreen<AEBaseContainer>
return; return;
} }
if( !this.disableShiftClick && isShiftKeyDown() && mouseButton == 0 ) if( !this.disableShiftClick && hasShiftDown() && mouseButton == 0 )
{ {
this.disableShiftClick = true; this.disableShiftClick = true;
@@ -586,7 +570,7 @@ public abstract class AEBaseGui extends ContainerScreen<AEBaseContainer>
for( final Slot inventorySlot : slots ) for( final Slot inventorySlot : slots )
{ {
if( inventorySlot != null && inventorySlot.canTakeStack( if( inventorySlot != null && inventorySlot.canTakeStack(
this.mc.player ) && inventorySlot.getHasStack() && inventorySlot.isSameInventory( slot ) && Container.canAddItemToSlot( this.minecraft.player ) && inventorySlot.getHasStack() && inventorySlot.isSameInventory( slot ) && Container.canAddItemToSlot(
inventorySlot, this.dbl_whichItem, true ) ) inventorySlot, this.dbl_whichItem, true ) )
{ {
this.handleMouseClick( inventorySlot, inventorySlot.slotNumber, 0, ClickType.QUICK_MOVE ); this.handleMouseClick( inventorySlot, inventorySlot.slotNumber, 0, ClickType.QUICK_MOVE );
@@ -601,23 +585,26 @@ public abstract class AEBaseGui extends ContainerScreen<AEBaseContainer>
super.handleMouseClick( slot, slotIdx, mouseButton, clickType ); super.handleMouseClick( slot, slotIdx, mouseButton, clickType );
} }
@Override protected boolean func_195363_d(int keyCode, int scanCode) {
protected boolean checkHotbarKeys( final int keyCode ) return checkHotbarKeys(InputMappings.getInputByCode(keyCode, scanCode));
}
protected boolean checkHotbarKeys( final InputMappings.Input input )
{ {
final Slot theSlot = this.getSlotUnderMouse(); final Slot theSlot = this.getSlotUnderMouse();
if( this.mc.player.inventory.getItemStack().isEmpty() && theSlot != null ) if( this.minecraft.player.inventory.getItemStack().isEmpty() && theSlot != null )
{ {
for( int j = 0; j < 9; ++j ) for( int j = 0; j < 9; ++j )
{ {
if( keyCode == this.mc.gameSettings.keyBindsHotbar[j].getKeyCode() ) if( this.minecraft.gameSettings.keyBindsHotbar[j].isActiveAndMatches(input) )
{ {
final List<Slot> slots = this.getInventorySlots(); final List<Slot> slots = this.getInventorySlots();
for( final Slot s : slots ) for( final Slot s : slots )
{ {
if( s.getSlotIndex() == j && s.inventory == ( (AEBaseContainer) this.inventorySlots ).getPlayerInv() ) if( s.getSlotIndex() == j && s.inventory == ( (AEBaseContainer) this.container ).getPlayerInv() )
{ {
if( !s.canTakeStack( ( (AEBaseContainer) this.inventorySlots ).getPlayerInv().player ) ) if( !s.canTakeStack( ( (AEBaseContainer) this.container ).getPlayerInv().player ) )
{ {
return false; return false;
} }
@@ -633,7 +620,7 @@ public abstract class AEBaseGui extends ContainerScreen<AEBaseContainer>
{ {
for( final Slot s : slots ) for( final Slot s : slots )
{ {
if( s.getSlotIndex() == j && s.inventory == ( (AEBaseContainer) this.inventorySlots ).getPlayerInv() ) if( s.getSlotIndex() == j && s.inventory == ( (AEBaseContainer) this.container ).getPlayerInv() )
{ {
NetworkHandler.instance().sendToServer( new PacketSwapSlots( s.slotNumber, theSlot.slotNumber ) ); NetworkHandler.instance().sendToServer( new PacketSwapSlots( s.slotNumber, theSlot.slotNumber ) );
return true; return true;
@@ -648,9 +635,9 @@ public abstract class AEBaseGui extends ContainerScreen<AEBaseContainer>
} }
@Override @Override
public void onGuiClosed() public void removed()
{ {
super.onGuiClosed(); super.removed();
} }
protected Slot getSlot( final int mouseX, final int mouseY ) protected Slot getSlot( final int mouseX, final int mouseY )
@@ -671,34 +658,31 @@ public abstract class AEBaseGui extends ContainerScreen<AEBaseContainer>
public abstract void drawBG( int offsetX, int offsetY, int mouseX, int mouseY ); public abstract void drawBG( int offsetX, int offsetY, int mouseX, int mouseY );
@Override @Override
public void handleMouseInput() throws IOException public boolean mouseScrolled(double x, double y, double wheelDelta) {
{ if( wheelDelta != 0 && hasShiftDown() )
super.handleMouseInput();
final int i = Mouse.getEventDWheel();
if( i != 0 && isShiftKeyDown() )
{ {
final int x = Mouse.getEventX() * this.width / this.mc.displayWidth; this.mouseWheelEvent( x, y, wheelDelta / Math.abs( wheelDelta ) );
final int y = this.height - Mouse.getEventY() * this.height / this.mc.displayHeight - 1; return true;
this.mouseWheelEvent( x, y, i / Math.abs( i ) );
} }
else if( i != 0 && this.getScrollBar() != null ) else if( wheelDelta != 0 && this.getScrollBar() != null )
{ {
this.getScrollBar().wheel( i ); this.getScrollBar().wheel( wheelDelta );
return true;
} }
return false;
} }
private void mouseWheelEvent( final int x, final int y, final int wheel ) private void mouseWheelEvent( final double x, final double y, final double wheel )
{ {
final Slot slot = this.getSlot( x, y ); final Slot slot = this.getSlot( (int) x, (int) y );
if( slot instanceof SlotME ) if( slot instanceof SlotME )
{ {
final IAEItemStack item = ( (SlotME) slot ).getAEStack(); final IAEItemStack item = ( (SlotME) slot ).getAEStack();
if( item != null ) if( item != null )
{ {
( (AEBaseContainer) this.inventorySlots ).setTargetStack( item ); ( (AEBaseContainer) this.container ).setTargetStack( item );
final InventoryAction direction = wheel > 0 ? InventoryAction.ROLL_DOWN : InventoryAction.ROLL_UP; final InventoryAction direction = wheel > 0 ? InventoryAction.ROLL_DOWN : InventoryAction.ROLL_UP;
final int times = Math.abs( wheel ); final int times = (int) Math.abs( wheel );
final int inventorySize = this.getInventorySlots().size(); final int inventorySize = this.getInventorySlots().size();
for( int h = 0; h < times; h++ ) for( int h = 0; h < times; h++ )
{ {
@@ -717,21 +701,20 @@ public abstract class AEBaseGui extends ContainerScreen<AEBaseContainer>
public void bindTexture( final String base, final String file ) public void bindTexture( final String base, final String file )
{ {
final ResourceLocation loc = new ResourceLocation( base, "textures/" + file ); final ResourceLocation loc = new ResourceLocation( base, "textures/" + file );
this.mc.getTextureManager().bindTexture( loc ); this.minecraft.getTextureManager().bindTexture( loc );
} }
protected void drawItem( final int x, final int y, final ItemStack is ) protected void drawItem( final int x, final int y, final ItemStack is )
{ {
this.zLevel = 100.0F; this.itemRenderer.zLevel = 100.0F;
this.itemRender.zLevel = 100.0F;
RenderHelper.enableGUIStandardItemLighting(); // FIXME: Check if this is actually required, vanilla doesnt have it anymore
GlStateManager.enableDepth(); // FIXME RenderHelper.enableGUIStandardItemLighting();
this.itemRender.renderItemAndEffectIntoGUI( is, x, y ); RenderSystem.enableDepthTest();
GlStateManager.disableDepth(); this.itemRenderer.renderItemAndEffectIntoGUI( is, x, y );
RenderSystem.disableDepthTest();
this.itemRender.zLevel = 0.0F; this.itemRenderer.zLevel = 0.0F;
this.zLevel = 0.0F;
} }
protected String getGuiDisplayName( final String in ) protected String getGuiDisplayName( final String in )
@@ -741,16 +724,16 @@ public abstract class AEBaseGui extends ContainerScreen<AEBaseContainer>
private boolean hasCustomInventoryName() private boolean hasCustomInventoryName()
{ {
if( this.inventorySlots instanceof AEBaseContainer ) if( this.container instanceof AEBaseContainer )
{ {
return ( (AEBaseContainer) this.inventorySlots ).getCustomName() != null; return ( (AEBaseContainer) this.container ).getCustomName() != null;
} }
return false; return false;
} }
private String getInventoryName() private String getInventoryName()
{ {
return ( (AEBaseContainer) this.inventorySlots ).getCustomName(); return ( (AEBaseContainer) this.container ).getCustomName();
} }
/** /**
@@ -764,21 +747,21 @@ public abstract class AEBaseGui extends ContainerScreen<AEBaseContainer>
try try
{ {
this.zLevel = 100.0F; // FIXME Probably not required this.zLevel = 100.0F;
this.itemRender.zLevel = 100.0F; this.itemRenderer.zLevel = 100.0F;
if( !this.isPowered() ) if( !this.isPowered() )
{ {
drawRect( s.xPos, s.yPos, 16 + s.xPos, 16 + s.yPos, 0x66111111 ); fill( s.xPos, s.yPos, 16 + s.xPos, 16 + s.yPos, 0x66111111 );
} }
this.zLevel = 0.0F; // FIXME Probably not required this.zLevel = 0.0F;
this.itemRender.zLevel = 0.0F; this.itemRenderer.zLevel = 0.0F;
// Annoying but easier than trying to splice into render item // Annoying but easier than trying to splice into render item
super.drawSlot( new Size1Slot( (SlotME) s ) ); super.drawSlot( new Size1Slot( (SlotME) s ) );
this.stackSizeRenderer.renderStackSize( this.fontRenderer, ( (SlotME) s ).getAEStack(), s.xPos, s.yPos ); this.stackSizeRenderer.renderStackSize( this.font, ( (SlotME) s ).getAEStack(), s.xPos, s.yPos );
} }
catch( final Exception err ) catch( final Exception err )
@@ -795,28 +778,30 @@ public abstract class AEBaseGui extends ContainerScreen<AEBaseContainer>
if( fs != null && this.isPowered() ) if( fs != null && this.isPowered() )
{ {
GlStateManager.disableLighting(); RenderSystem.disableLighting();
GlStateManager.disableBlend(); RenderSystem.disableBlend();
final Fluid fluid = fs.getFluid(); final Fluid fluid = fs.getFluid();
Minecraft.getInstance().getTextureManager().bindTexture( TextureMap.LOCATION_BLOCKS_TEXTURE ); FluidAttributes fluidAttributes = fluid.getAttributes();
final TextureAtlasSprite sprite = Minecraft.getInstance().getTextureMapBlocks().getAtlasSprite( fluid.getStill().toString() ); minecraft.getTextureManager().bindTexture( AtlasTexture.LOCATION_BLOCKS_TEXTURE );
ResourceLocation fluidStillTexture = fluidAttributes.getStillTexture(fs.getFluidStack());
final TextureAtlasSprite sprite = minecraft.getAtlasSpriteGetter(AtlasTexture.LOCATION_BLOCKS_TEXTURE).apply(fluidStillTexture);
// Set color for dynamic fluids // Set color for dynamic fluids
// Convert int color to RGB // Convert int color to RGB
float red = ( fluid.getColor() >> 16 & 255 ) / 255.0F; float red = ( fluidAttributes.getColor() >> 16 & 255 ) / 255.0F;
float green = ( fluid.getColor() >> 8 & 255 ) / 255.0F; float green = ( fluidAttributes.getColor() >> 8 & 255 ) / 255.0F;
float blue = ( fluid.getColor() & 255 ) / 255.0F; float blue = ( fluidAttributes.getColor() & 255 ) / 255.0F;
GlStateManager.color( red, green, blue ); RenderSystem.color3f( red, green, blue );
this.drawTexturedModalRect( s.xPos, s.yPos, sprite, 16, 16 ); blit(s.xPos, s.yPos, 0 /* FIXME: Validate this was previous the controls zindex */, 16, 16, sprite);
GlStateManager.enableLighting(); RenderSystem.enableLighting();
GlStateManager.enableBlend(); RenderSystem.enableBlend();
this.fluidStackSizeRenderer.renderStackSize( this.fontRenderer, fs, s.xPos, s.yPos ); this.fluidStackSizeRenderer.renderStackSize( this.font, fs, s.xPos, s.yPos );
} }
else if( !this.isPowered() ) else if( !this.isPowered() )
{ {
drawRect( s.xPos, s.yPos, 16 + s.xPos, 16 + s.yPos, 0x66111111 ); fill( s.xPos, s.yPos, 16 + s.xPos, 16 + s.yPos, 0x66111111 );
} }
return; return;
@@ -838,11 +823,11 @@ public abstract class AEBaseGui extends ContainerScreen<AEBaseContainer>
final int uv_y = (int) Math.floor( aes.getIcon() / 16 ); final int uv_y = (int) Math.floor( aes.getIcon() / 16 );
final int uv_x = aes.getIcon() - uv_y * 16; final int uv_x = aes.getIcon() - uv_y * 16;
GlStateManager.enableBlend(); RenderSystem.enableBlend();
GlStateManager.disableLighting(); RenderSystem.disableLighting();
GlStateManager.enableTexture2D(); RenderSystem.enableTexture();
GlStateManager.blendFunc( GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA ); RenderSystem.blendFunc( GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA );
GlStateManager.color( 1.0f, 1.0f, 1.0f, 1.0f ); RenderSystem.color4f( 1.0f, 1.0f, 1.0f, 1.0f );
final float par1 = aes.xPos; final float par1 = aes.xPos;
final float par2 = aes.yPos; final float par2 = aes.yPos;
final float par3 = uv_x * 16; final float par3 = uv_x * 16;
@@ -856,23 +841,24 @@ public abstract class AEBaseGui extends ContainerScreen<AEBaseContainer>
final float f1 = 0.00390625F; final float f1 = 0.00390625F;
final float f = 0.00390625F; final float f = 0.00390625F;
final float par6 = 16; final float par6 = 16;
vb.pos( par1 + 0, par2 + par6, this.zLevel ) int zLevel = 0; // FIXME This was previously a field (see FIXMEs above)
vb.pos( par1 + 0, par2 + par6, zLevel )
.tex( ( par3 + 0 ) * f, ( par4 + par6 ) * f1 ) .tex( ( par3 + 0 ) * f, ( par4 + par6 ) * f1 )
.color( 1.0f, 1.0f, 1.0f, .color( 1.0f, 1.0f, 1.0f,
aes.getOpacityOfIcon() ) aes.getOpacityOfIcon() )
.endVertex(); .endVertex();
final float par5 = 16; final float par5 = 16;
vb.pos( par1 + par5, par2 + par6, this.zLevel ) vb.pos( par1 + par5, par2 + par6, zLevel )
.tex( ( par3 + par5 ) * f, ( par4 + par6 ) * f1 ) .tex( ( par3 + par5 ) * f, ( par4 + par6 ) * f1 )
.color( 1.0f, 1.0f, 1.0f, .color( 1.0f, 1.0f, 1.0f,
aes.getOpacityOfIcon() ) aes.getOpacityOfIcon() )
.endVertex(); .endVertex();
vb.pos( par1 + par5, par2 + 0, this.zLevel ) vb.pos( par1 + par5, par2 + 0, zLevel )
.tex( ( par3 + par5 ) * f, ( par4 + 0 ) * f1 ) .tex( ( par3 + par5 ) * f, ( par4 + 0 ) * f1 )
.color( 1.0f, 1.0f, 1.0f, .color( 1.0f, 1.0f, 1.0f,
aes.getOpacityOfIcon() ) aes.getOpacityOfIcon() )
.endVertex(); .endVertex();
vb.pos( par1 + 0, par2 + 0, this.zLevel ) vb.pos( par1 + 0, par2 + 0, zLevel )
.tex( ( par3 + 0 ) * f, ( par4 + 0 ) * f1 ) .tex( ( par3 + 0 ) * f, ( par4 + 0 ) * f1 )
.color( 1.0f, 1.0f, 1.0f, .color( 1.0f, 1.0f, 1.0f,
aes.getOpacityOfIcon() ) aes.getOpacityOfIcon() )
@@ -896,7 +882,7 @@ public abstract class AEBaseGui extends ContainerScreen<AEBaseContainer>
{ {
try try
{ {
isValid = ( (SlotRestrictedInput) s ).isValid( is, this.mc.world ); isValid = ( (SlotRestrictedInput) s ).isValid( is, this.minecraft.world );
} }
catch( final Exception err ) catch( final Exception err )
{ {
@@ -908,15 +894,16 @@ public abstract class AEBaseGui extends ContainerScreen<AEBaseContainer>
if( ( (AppEngSlot) s ).getIsValid() == hasCalculatedValidness.Invalid ) if( ( (AppEngSlot) s ).getIsValid() == hasCalculatedValidness.Invalid )
{ {
this.zLevel = 100.0F; // FIXME: Test this, the fill function used below does not support setting Z
this.itemRender.zLevel = 100.0F; // FIXME this.zLevel = 100.0F;
this.itemRenderer.zLevel = 100.0F;
GlStateManager.disableLighting(); RenderSystem.disableLighting();
drawRect( s.xPos, s.yPos, 16 + s.xPos, 16 + s.yPos, 0x66ff6666 ); fill( s.xPos, s.yPos, 16 + s.xPos, 16 + s.yPos, 0x66ff6666 );
GlStateManager.enableLighting(); RenderSystem.enableLighting();
this.zLevel = 0.0F; // FIXME this.zLevel = 0.0F;
this.itemRender.zLevel = 0.0F; this.itemRenderer.zLevel = 0.0F;
} }
} }
@@ -949,7 +936,7 @@ public abstract class AEBaseGui extends ContainerScreen<AEBaseContainer>
public void bindTexture( final String file ) public void bindTexture( final String file )
{ {
final ResourceLocation loc = new ResourceLocation( AppEng.MOD_ID, "textures/" + file ); final ResourceLocation loc = new ResourceLocation( AppEng.MOD_ID, "textures/" + file );
this.mc.getTextureManager().bindTexture( loc ); this.minecraft.getTextureManager().bindTexture( loc );
} }
protected GuiScrollbar getScrollBar() protected GuiScrollbar getScrollBar()
@@ -83,7 +83,7 @@ public abstract class AEBaseMEGui extends AEBaseGui
currentToolTip.add( format ); currentToolTip.add( format );
} }
this.drawHoveringText( currentToolTip, x, y, this.fontRenderer ); this.drawHoveringText( currentToolTip, x, y, this.font );
return; return;
} }
@@ -95,7 +95,7 @@ public abstract class AEBaseMEGui extends AEBaseGui
currentToolTip.add( TextFormatting.GRAY + format ); currentToolTip.add( TextFormatting.GRAY + format );
this.drawHoveringText( currentToolTip, x, y, this.fontRenderer ); this.drawHoveringText( currentToolTip, x, y, this.font );
return; return;
} }
@@ -69,10 +69,10 @@ public class GuiCellWorkbench extends GuiUpgradeable
.getLocal() ); .getLocal() );
this.fuzzyMode = new GuiImgButton( this.guiLeft - 18, this.guiTop + 68, Settings.FUZZY_MODE, FuzzyMode.IGNORE_ALL ); this.fuzzyMode = new GuiImgButton( this.guiLeft - 18, this.guiTop + 68, Settings.FUZZY_MODE, FuzzyMode.IGNORE_ALL );
this.buttonList.add( this.fuzzyMode ); this.addButton( this.fuzzyMode );
this.buttonList.add( this.partition ); this.addButton( this.partition );
this.buttonList.add( this.clear ); this.addButton( this.clear );
this.buttonList.add( this.copyMode ); this.addButton( this.copyMode );
} }
@Override @Override
@@ -57,18 +57,18 @@ public class GuiChest extends AEBaseGui
} }
@Override @Override
public void initGui() public void init()
{ {
super.initGui(); super.init();
this.buttonList.add( this.priority = new GuiTabButton( this.guiLeft + 154, this.guiTop, 2 + 4 * 16, GuiText.Priority.getLocal(), this.itemRender ) ); this.addButton( this.priority = new GuiTabButton( this.guiLeft + 154, this.guiTop, 2 + 4 * 16, GuiText.Priority.getLocal(), this.itemRender ) );
} }
@Override @Override
public void drawFG( final int offsetX, final int offsetY, final int mouseX, final int mouseY ) public void drawFG( final int offsetX, final int offsetY, final int mouseX, final int mouseY )
{ {
this.fontRenderer.drawString( this.getGuiDisplayName( GuiText.Chest.getLocal() ), 8, 6, 4210752 ); this.font.drawString( this.getGuiDisplayName( GuiText.Chest.getLocal() ), 8, 6, 4210752 );
this.fontRenderer.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 ); this.font.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
} }
@Override @Override
@@ -66,24 +66,24 @@ public class GuiCondenser extends AEBaseGui
} }
@Override @Override
public void initGui() public void init()
{ {
super.initGui(); 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.cvc, "guis/condenser.png", 120 + this.guiLeft, 25 + this.guiTop, 178, 25, 6, 18, Direction.VERTICAL, GuiText.StoredEnergy
.getLocal() ); .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.cvc.getOutput() );
this.buttonList.add( this.pb ); this.addButton( this.pb );
this.buttonList.add( this.mode ); this.addButton( this.mode );
} }
@Override @Override
public void drawFG( final int offsetX, final int offsetY, final int mouseX, final int mouseY ) public void drawFG( final int offsetX, final int offsetY, final int mouseX, final int mouseY )
{ {
this.fontRenderer.drawString( this.getGuiDisplayName( GuiText.Condenser.getLocal() ), 8, 6, 4210752 ); this.font.drawString( this.getGuiDisplayName( GuiText.Condenser.getLocal() ), 8, 6, 4210752 );
this.fontRenderer.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 ); this.font.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
this.mode.set( this.cvc.getOutput() ); this.mode.set( this.cvc.getOutput() );
this.mode.setFillVar( String.valueOf( this.cvc.getOutput().requiredPower ) ); this.mode.setFillVar( String.valueOf( this.cvc.getOutput().requiredPower ) );
@@ -25,7 +25,6 @@ import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.PlayerInventory; import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import appeng.api.AEApi;
import appeng.api.definitions.IDefinitions; import appeng.api.definitions.IDefinitions;
import appeng.api.definitions.IParts; import appeng.api.definitions.IParts;
import appeng.api.storage.ITerminalHost; import appeng.api.storage.ITerminalHost;
@@ -72,26 +71,26 @@ public class GuiCraftAmount extends AEBaseGui
} }
@Override @Override
public void initGui() public void init()
{ {
super.initGui(); super.init();
final int a = AEConfig.instance().craftItemsByStackAmounts( 0 ); final int a = AEConfig.instance().craftItemsByStackAmounts( 0 );
final int b = AEConfig.instance().craftItemsByStackAmounts( 1 ); final int b = AEConfig.instance().craftItemsByStackAmounts( 1 );
final int c = AEConfig.instance().craftItemsByStackAmounts( 2 ); final int c = AEConfig.instance().craftItemsByStackAmounts( 2 );
final int d = AEConfig.instance().craftItemsByStackAmounts( 3 ); final int d = AEConfig.instance().craftItemsByStackAmounts( 3 );
this.buttonList.add( this.plus1 = new GuiButton( 0, this.guiLeft + 20, this.guiTop + 26, 22, 20, "+" + a ) ); this.addButton( this.plus1 = new GuiButton( 0, this.guiLeft + 20, this.guiTop + 26, 22, 20, "+" + a ) );
this.buttonList.add( this.plus10 = new GuiButton( 0, this.guiLeft + 48, this.guiTop + 26, 28, 20, "+" + b ) ); this.addButton( this.plus10 = new GuiButton( 0, this.guiLeft + 48, this.guiTop + 26, 28, 20, "+" + b ) );
this.buttonList.add( this.plus100 = new GuiButton( 0, this.guiLeft + 82, this.guiTop + 26, 32, 20, "+" + c ) ); this.addButton( this.plus100 = new GuiButton( 0, this.guiLeft + 82, this.guiTop + 26, 32, 20, "+" + c ) );
this.buttonList.add( this.plus1000 = new GuiButton( 0, this.guiLeft + 120, this.guiTop + 26, 38, 20, "+" + d ) ); this.addButton( this.plus1000 = new GuiButton( 0, this.guiLeft + 120, this.guiTop + 26, 38, 20, "+" + d ) );
this.buttonList.add( this.minus1 = new GuiButton( 0, this.guiLeft + 20, this.guiTop + 75, 22, 20, "-" + a ) ); this.addButton( this.minus1 = new GuiButton( 0, this.guiLeft + 20, this.guiTop + 75, 22, 20, "-" + a ) );
this.buttonList.add( this.minus10 = new GuiButton( 0, this.guiLeft + 48, this.guiTop + 75, 28, 20, "-" + b ) ); this.addButton( this.minus10 = new GuiButton( 0, this.guiLeft + 48, this.guiTop + 75, 28, 20, "-" + b ) );
this.buttonList.add( this.minus100 = new GuiButton( 0, this.guiLeft + 82, this.guiTop + 75, 32, 20, "-" + c ) ); this.addButton( this.minus100 = new GuiButton( 0, this.guiLeft + 82, this.guiTop + 75, 32, 20, "-" + c ) );
this.buttonList.add( this.minus1000 = new GuiButton( 0, this.guiLeft + 120, this.guiTop + 75, 38, 20, "-" + d ) ); this.addButton( this.minus1000 = new GuiButton( 0, this.guiLeft + 120, this.guiTop + 75, 38, 20, "-" + d ) );
this.buttonList.add( this.next = new GuiButton( 0, this.guiLeft + 128, this.guiTop + 51, 38, 20, GuiText.Next.getLocal() ) ); this.addButton( this.next = new GuiButton( 0, this.guiLeft + 128, this.guiTop + 51, 38, 20, GuiText.Next.getLocal() ) );
ItemStack myIcon = null; ItemStack myIcon = null;
final Object target = ( (AEBaseContainer) this.inventorySlots ).getTarget(); final Object target = ( (AEBaseContainer) this.inventorySlots ).getTarget();
@@ -125,10 +124,10 @@ public class GuiCraftAmount extends AEBaseGui
if( this.originalGui != null && !myIcon.isEmpty() ) if( this.originalGui != null && !myIcon.isEmpty() )
{ {
this.buttonList.add( this.originalGuiBtn = new GuiTabButton( this.guiLeft + 154, this.guiTop, myIcon, myIcon.getDisplayName(), this.itemRender ) ); this.addButton( this.originalGuiBtn = new GuiTabButton( this.guiLeft + 154, this.guiTop, myIcon, myIcon.getDisplayName(), this.itemRender ) );
} }
this.amountToCraft = new GuiNumberBox( this.fontRenderer, this.guiLeft + 62, this.guiTop + 57, 59, this.fontRenderer.FONT_HEIGHT, Integer.class ); this.amountToCraft = new GuiNumberBox( this.font, this.guiLeft + 62, this.guiTop + 57, 59, this.font.FONT_HEIGHT, Integer.class );
this.amountToCraft.setEnableBackgroundDrawing( false ); this.amountToCraft.setEnableBackgroundDrawing( false );
this.amountToCraft.setMaxStringLength( 16 ); this.amountToCraft.setMaxStringLength( 16 );
this.amountToCraft.setTextColor( 0xFFFFFF ); this.amountToCraft.setTextColor( 0xFFFFFF );
@@ -140,13 +139,13 @@ public class GuiCraftAmount extends AEBaseGui
@Override @Override
public void drawFG( final int offsetX, final int offsetY, final int mouseX, final int mouseY ) public void drawFG( final int offsetX, final int offsetY, final int mouseX, final int mouseY )
{ {
this.fontRenderer.drawString( GuiText.SelectAmount.getLocal(), 8, 6, 4210752 ); this.font.drawString( GuiText.SelectAmount.getLocal(), 8, 6, 4210752 );
} }
@Override @Override
public void drawBG( final int offsetX, final int offsetY, final int mouseX, final int mouseY ) public void drawBG( final int offsetX, final int offsetY, final int mouseX, final int mouseY )
{ {
this.next.displayString = isShiftKeyDown() ? GuiText.Start.getLocal() : GuiText.Next.getLocal(); this.next.displayString = hasShiftDown() ? GuiText.Start.getLocal() : GuiText.Next.getLocal();
this.bindTexture( "guis/craft_amt.png" ); this.bindTexture( "guis/craft_amt.png" );
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize ); this.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize );
@@ -230,7 +229,7 @@ public class GuiCraftAmount extends AEBaseGui
if( btn == this.next ) if( btn == this.next )
{ {
NetworkHandler.instance().sendToServer( new PacketCraftRequest( Integer.parseInt( this.amountToCraft.getText() ), isShiftKeyDown() ) ); NetworkHandler.instance().sendToServer( new PacketCraftRequest( Integer.parseInt( this.amountToCraft.getText() ), hasShiftDown() ) );
} }
} }
catch( final NumberFormatException e ) catch( final NumberFormatException e )
@@ -34,7 +34,6 @@ import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.player.PlayerInventory; import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import appeng.api.AEApi;
import appeng.api.storage.ITerminalHost; import appeng.api.storage.ITerminalHost;
import appeng.api.storage.channels.IItemStorageChannel; import appeng.api.storage.channels.IItemStorageChannel;
import appeng.api.storage.data.IAEItemStack; import appeng.api.storage.data.IAEItemStack;
@@ -112,29 +111,29 @@ public class GuiCraftConfirm extends AEBaseGui
} }
@Override @Override
public void initGui() public void init()
{ {
super.initGui(); super.init();
this.start = new GuiButton( 0, this.guiLeft + 162, this.guiTop + this.ySize - 25, 50, 20, GuiText.Start.getLocal() ); this.start = new GuiButton( 0, this.guiLeft + 162, this.guiTop + this.ySize - 25, 50, 20, GuiText.Start.getLocal() );
this.start.enabled = false; this.start.enabled = false;
this.buttonList.add( this.start ); this.addButton( this.start );
this.selectCPU = new GuiButton( 0, this.guiLeft + ( 219 - 180 ) / 2, this.guiTop + this.ySize - 68, 180, 20, GuiText.CraftingCPU this.selectCPU = new GuiButton( 0, this.guiLeft + ( 219 - 180 ) / 2, this.guiTop + this.ySize - 68, 180, 20, GuiText.CraftingCPU
.getLocal() + ": " + GuiText.Automatic ); .getLocal() + ": " + GuiText.Automatic );
this.selectCPU.enabled = false; this.selectCPU.enabled = false;
this.buttonList.add( this.selectCPU ); this.addButton( this.selectCPU );
if( this.OriginalGui != null ) if( this.OriginalGui != null )
{ {
this.cancel = new GuiButton( 0, this.guiLeft + 6, this.guiTop + this.ySize - 25, 50, 20, GuiText.Cancel.getLocal() ); this.cancel = new GuiButton( 0, this.guiLeft + 6, this.guiTop + this.ySize - 25, 50, 20, GuiText.Cancel.getLocal() );
} }
this.buttonList.add( this.cancel ); this.addButton( this.cancel );
} }
@Override @Override
public void drawScreen( final int mouseX, final int mouseY, final float btn ) public void render(final int mouseX, final int mouseY, final float btn )
{ {
this.updateCPUButtonText(); this.updateCPUButtonText();
@@ -172,7 +171,7 @@ public class GuiCraftConfirm extends AEBaseGui
} }
} }
super.drawScreen( mouseX, mouseY, btn ); super.render( mouseX, mouseY, btn );
} }
private void updateCPUButtonText() private void updateCPUButtonText()
@@ -210,7 +209,7 @@ public class GuiCraftConfirm extends AEBaseGui
final long BytesUsed = this.ccc.getUsedBytes(); final long BytesUsed = this.ccc.getUsedBytes();
final String byteUsed = NumberFormat.getInstance().format( BytesUsed ); final String byteUsed = NumberFormat.getInstance().format( BytesUsed );
final String Add = BytesUsed > 0 ? ( byteUsed + ' ' + GuiText.BytesUsed.getLocal() ) : GuiText.CalculatingWait.getLocal(); final String Add = BytesUsed > 0 ? ( byteUsed + ' ' + GuiText.BytesUsed.getLocal() ) : GuiText.CalculatingWait.getLocal();
this.fontRenderer.drawString( GuiText.CraftingPlan.getLocal() + " - " + Add, 8, 7, 4210752 ); this.font.drawString( GuiText.CraftingPlan.getLocal() + " - " + Add, 8, 7, 4210752 );
String dsp = null; String dsp = null;
@@ -224,8 +223,8 @@ public class GuiCraftConfirm extends AEBaseGui
.getLocal() + ": " + this.ccc.getCpuCoProcessors() ) : GuiText.Bytes.getLocal() + ": N/A : " + GuiText.CoProcessors.getLocal() + ": N/A"; .getLocal() + ": " + this.ccc.getCpuCoProcessors() ) : GuiText.Bytes.getLocal() + ": N/A : " + GuiText.CoProcessors.getLocal() + ": N/A";
} }
final int offset = ( 219 - this.fontRenderer.getStringWidth( dsp ) ) / 2; final int offset = ( 219 - this.font.getStringWidth( dsp ) ) / 2;
this.fontRenderer.drawString( dsp, offset, 165, 4210752 ); this.font.drawString( dsp, offset, 165, 4210752 );
final int sectionLength = 67; final int sectionLength = 67;
@@ -286,8 +285,8 @@ public class GuiCraftConfirm extends AEBaseGui
} }
str = GuiText.FromStorage.getLocal() + ": " + str; str = GuiText.FromStorage.getLocal() + ": " + str;
final int w = 4 + this.fontRenderer.getStringWidth( str ); final int w = 4 + this.font.getStringWidth( str );
this.fontRenderer.drawString( str, (int) ( ( x * ( 1 + sectionLength ) + xo + sectionLength - 19 - ( w * 0.5 ) ) * 2 ), this.font.drawString( str, (int) ( ( x * ( 1 + sectionLength ) + xo + sectionLength - 19 - ( w * 0.5 ) ) * 2 ),
( y * offY + yo + 6 - negY + downY ) * 2, 4210752 ); ( y * offY + yo + 6 - negY + downY ) * 2, 4210752 );
if( this.tooltip == z - viewStart ) if( this.tooltip == z - viewStart )
@@ -312,8 +311,8 @@ public class GuiCraftConfirm extends AEBaseGui
} }
str = GuiText.Missing.getLocal() + ": " + str; str = GuiText.Missing.getLocal() + ": " + str;
final int w = 4 + this.fontRenderer.getStringWidth( str ); final int w = 4 + this.font.getStringWidth( str );
this.fontRenderer.drawString( str, (int) ( ( x * ( 1 + sectionLength ) + xo + sectionLength - 19 - ( w * 0.5 ) ) * 2 ), this.font.drawString( str, (int) ( ( x * ( 1 + sectionLength ) + xo + sectionLength - 19 - ( w * 0.5 ) ) * 2 ),
( y * offY + yo + 6 - negY + downY ) * 2, 4210752 ); ( y * offY + yo + 6 - negY + downY ) * 2, 4210752 );
if( this.tooltip == z - viewStart ) if( this.tooltip == z - viewStart )
@@ -338,8 +337,8 @@ public class GuiCraftConfirm extends AEBaseGui
} }
str = GuiText.ToCraft.getLocal() + ": " + str; str = GuiText.ToCraft.getLocal() + ": " + str;
final int w = 4 + this.fontRenderer.getStringWidth( str ); final int w = 4 + this.font.getStringWidth( str );
this.fontRenderer.drawString( str, (int) ( ( x * ( 1 + sectionLength ) + xo + sectionLength - 19 - ( w * 0.5 ) ) * 2 ), this.font.drawString( str, (int) ( ( x * ( 1 + sectionLength ) + xo + sectionLength - 19 - ( w * 0.5 ) ) * 2 ),
( y * offY + yo + 6 - negY + downY ) * 2, 4210752 ); ( y * offY + yo + 6 - negY + downY ) * 2, 4210752 );
if( this.tooltip == z - viewStart ) if( this.tooltip == z - viewStart )
@@ -373,7 +372,7 @@ public class GuiCraftConfirm extends AEBaseGui
{ {
final int startX = x * ( 1 + sectionLength ) + xo; final int startX = x * ( 1 + sectionLength ) + xo;
final int startY = posY - 4; final int startY = posY - 4;
drawRect( startX, startY, startX + sectionLength, startY + offY, 0x1AFF0000 ); fill( startX, startY, startX + sectionLength, startY + offY, 0x1AFF0000 );
} }
x++; x++;
@@ -34,7 +34,6 @@ import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.player.PlayerInventory; import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import appeng.api.AEApi;
import appeng.api.config.SortDir; import appeng.api.config.SortDir;
import appeng.api.config.SortOrder; import appeng.api.config.SortOrder;
import appeng.api.config.ViewItems; import appeng.api.config.ViewItems;
@@ -135,13 +134,13 @@ public class GuiCraftingCPU extends AEBaseGui implements ISortSource
} }
@Override @Override
public void initGui() public void init()
{ {
super.initGui(); super.init();
this.setScrollBar(); this.setScrollBar();
this.cancel = new GuiButton( 0, this.guiLeft + CANCEL_LEFT_OFFSET, this.guiTop + this.ySize - CANCEL_TOP_OFFSET, CANCEL_WIDTH, CANCEL_HEIGHT, GuiText.Cancel this.cancel = new GuiButton( 0, this.guiLeft + CANCEL_LEFT_OFFSET, this.guiTop + this.ySize - CANCEL_TOP_OFFSET, CANCEL_WIDTH, CANCEL_HEIGHT, GuiText.Cancel
.getLocal() ); .getLocal() );
this.buttonList.add( this.cancel ); this.addButton( this.cancel );
} }
private void setScrollBar() private void setScrollBar()
@@ -153,7 +152,7 @@ public class GuiCraftingCPU extends AEBaseGui implements ISortSource
} }
@Override @Override
public void drawScreen( final int mouseX, final int mouseY, final float btn ) public void render(final int mouseX, final int mouseY, final float btn )
{ {
this.cancel.enabled = !this.visual.isEmpty(); this.cancel.enabled = !this.visual.isEmpty();
@@ -188,7 +187,7 @@ public class GuiCraftingCPU extends AEBaseGui implements ISortSource
} }
} }
super.drawScreen( mouseX, mouseY, btn ); super.render( mouseX, mouseY, btn );
} }
@Override @Override
@@ -203,7 +202,7 @@ public class GuiCraftingCPU extends AEBaseGui implements ISortSource
title += " - " + etaTimeText; title += " - " + etaTimeText;
} }
this.fontRenderer.drawString( title, TITLE_LEFT_OFFSET, TITLE_TOP_OFFSET, TEXT_COLOR ); this.font.drawString( title, TITLE_LEFT_OFFSET, TITLE_TOP_OFFSET, TEXT_COLOR );
int x = 0; int x = 0;
int y = 0; int y = 0;
@@ -254,7 +253,7 @@ public class GuiCraftingCPU extends AEBaseGui implements ISortSource
final int bgColor = ( active ? AEColor.GREEN.blackVariant : AEColor.YELLOW.blackVariant ) | BACKGROUND_ALPHA; final int bgColor = ( active ? AEColor.GREEN.blackVariant : AEColor.YELLOW.blackVariant ) | BACKGROUND_ALPHA;
final int startX = ( x * ( 1 + SECTION_LENGTH ) + ITEMSTACK_LEFT_OFFSET ) * 2; final int startX = ( x * ( 1 + SECTION_LENGTH ) + ITEMSTACK_LEFT_OFFSET ) * 2;
final int startY = ( ( y * offY + ITEMSTACK_TOP_OFFSET ) - 3 ) * 2; final int startY = ( ( y * offY + ITEMSTACK_TOP_OFFSET ) - 3 ) * 2;
drawRect( startX, startY, startX + ( SECTION_LENGTH * 2 ), startY + ( offY * 2 ) - 2, bgColor ); fill( startX, startY, startX + ( SECTION_LENGTH * 2 ), startY + ( offY * 2 ) - 2, bgColor );
} }
final int negY = ( ( lines - 1 ) * 5 ) / 2; final int negY = ( ( lines - 1 ) * 5 ) / 2;
@@ -263,8 +262,8 @@ public class GuiCraftingCPU extends AEBaseGui implements ISortSource
if( stored != null && stored.getStackSize() > 0 ) if( stored != null && stored.getStackSize() > 0 )
{ {
final String str = GuiText.Stored.getLocal() + ": " + converter.toWideReadableForm( stored.getStackSize() ); final String str = GuiText.Stored.getLocal() + ": " + converter.toWideReadableForm( stored.getStackSize() );
final int w = 4 + this.fontRenderer.getStringWidth( str ); final int w = 4 + this.font.getStringWidth( str );
this.fontRenderer.drawString( str, (int) ( ( x * ( 1 + SECTION_LENGTH ) + ITEMSTACK_LEFT_OFFSET + SECTION_LENGTH - 19 - ( w * 0.5 ) ) * 2 ), this.font.drawString( str, (int) ( ( x * ( 1 + SECTION_LENGTH ) + ITEMSTACK_LEFT_OFFSET + SECTION_LENGTH - 19 - ( w * 0.5 ) ) * 2 ),
( y * offY + ITEMSTACK_TOP_OFFSET + 6 - negY + downY ) * 2, TEXT_COLOR ); ( y * offY + ITEMSTACK_TOP_OFFSET + 6 - negY + downY ) * 2, TEXT_COLOR );
if( this.tooltip == z - viewStart ) if( this.tooltip == z - viewStart )
@@ -278,9 +277,9 @@ public class GuiCraftingCPU extends AEBaseGui implements ISortSource
if( activeStack != null && activeStack.getStackSize() > 0 ) if( activeStack != null && activeStack.getStackSize() > 0 )
{ {
final String str = GuiText.Crafting.getLocal() + ": " + converter.toWideReadableForm( activeStack.getStackSize() ); final String str = GuiText.Crafting.getLocal() + ": " + converter.toWideReadableForm( activeStack.getStackSize() );
final int w = 4 + this.fontRenderer.getStringWidth( str ); final int w = 4 + this.font.getStringWidth( str );
this.fontRenderer.drawString( str, (int) ( ( x * ( 1 + SECTION_LENGTH ) + ITEMSTACK_LEFT_OFFSET + SECTION_LENGTH - 19 - ( w * 0.5 ) ) * 2 ), this.font.drawString( str, (int) ( ( x * ( 1 + SECTION_LENGTH ) + ITEMSTACK_LEFT_OFFSET + SECTION_LENGTH - 19 - ( w * 0.5 ) ) * 2 ),
( y * offY + ITEMSTACK_TOP_OFFSET + 6 - negY + downY ) * 2, TEXT_COLOR ); ( y * offY + ITEMSTACK_TOP_OFFSET + 6 - negY + downY ) * 2, TEXT_COLOR );
if( this.tooltip == z - viewStart ) if( this.tooltip == z - viewStart )
@@ -294,9 +293,9 @@ public class GuiCraftingCPU extends AEBaseGui implements ISortSource
if( pendingStack != null && pendingStack.getStackSize() > 0 ) if( pendingStack != null && pendingStack.getStackSize() > 0 )
{ {
final String str = GuiText.Scheduled.getLocal() + ": " + converter.toWideReadableForm( pendingStack.getStackSize() ); final String str = GuiText.Scheduled.getLocal() + ": " + converter.toWideReadableForm( pendingStack.getStackSize() );
final int w = 4 + this.fontRenderer.getStringWidth( str ); final int w = 4 + this.font.getStringWidth( str );
this.fontRenderer.drawString( str, (int) ( ( x * ( 1 + SECTION_LENGTH ) + ITEMSTACK_LEFT_OFFSET + SECTION_LENGTH - 19 - ( w * 0.5 ) ) * 2 ), this.font.drawString( str, (int) ( ( x * ( 1 + SECTION_LENGTH ) + ITEMSTACK_LEFT_OFFSET + SECTION_LENGTH - 19 - ( w * 0.5 ) ) * 2 ),
( y * offY + ITEMSTACK_TOP_OFFSET + 6 - negY + downY ) * 2, TEXT_COLOR ); ( y * offY + ITEMSTACK_TOP_OFFSET + 6 - negY + downY ) * 2, TEXT_COLOR );
if( this.tooltip == z - viewStart ) if( this.tooltip == z - viewStart )
@@ -31,7 +31,6 @@ import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.PlayerInventory; import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import appeng.api.AEApi;
import appeng.api.definitions.IDefinitions; import appeng.api.definitions.IDefinitions;
import appeng.api.definitions.IParts; import appeng.api.definitions.IParts;
import appeng.api.storage.ITerminalHost; import appeng.api.storage.ITerminalHost;
@@ -123,28 +122,28 @@ public class GuiCraftingStatus extends GuiCraftingCPU
} }
@Override @Override
public void initGui() public void init()
{ {
super.initGui(); super.init();
this.selectCPU = new GuiButton( 0, this.guiLeft + 8, this.guiTop + this.ySize - 25, 150, 20, GuiText.CraftingCPU this.selectCPU = new GuiButton( 0, this.guiLeft + 8, this.guiTop + this.ySize - 25, 150, 20, GuiText.CraftingCPU
.getLocal() + ": " + GuiText.NoCraftingCPUs ); .getLocal() + ": " + GuiText.NoCraftingCPUs );
// selectCPU.enabled = false; // selectCPU.enabled = false;
this.buttonList.add( this.selectCPU ); this.addButton( this.selectCPU );
if( !this.myIcon.isEmpty() ) if( !this.myIcon.isEmpty() )
{ {
this.buttonList.add( this.addButton(
this.originalGuiBtn = new GuiTabButton( this.guiLeft + 213, this.guiTop - 4, this.myIcon, this.myIcon.getDisplayName(), this.itemRender ) ); this.originalGuiBtn = new GuiTabButton( this.guiLeft + 213, this.guiTop - 4, this.myIcon, this.myIcon.getDisplayName(), this.itemRender ) );
this.originalGuiBtn.setHideEdge( 13 ); this.originalGuiBtn.setHideEdge( 13 );
} }
} }
@Override @Override
public void drawScreen( final int mouseX, final int mouseY, final float btn ) public void render(final int mouseX, final int mouseY, final float btn )
{ {
this.updateCPUButtonText(); this.updateCPUButtonText();
super.drawScreen( mouseX, mouseY, btn ); super.render( mouseX, mouseY, btn );
} }
private void updateCPUButtonText() private void updateCPUButtonText()
@@ -73,10 +73,10 @@ public class GuiCraftingTerm extends GuiMEMonitorable
} }
@Override @Override
public void initGui() public void init()
{ {
super.initGui(); super.init();
this.buttonList.add( this.clearBtn = new GuiImgButton( this.guiLeft + 92, this.guiTop + this.ySize - 156, Settings.ACTIONS, ActionItems.STASH ) ); this.addButton( this.clearBtn = new GuiImgButton( this.guiLeft + 92, this.guiTop + this.ySize - 156, Settings.ACTIONS, ActionItems.STASH ) );
this.clearBtn.setHalfSize( true ); this.clearBtn.setHalfSize( true );
} }
@@ -84,7 +84,7 @@ public class GuiCraftingTerm extends GuiMEMonitorable
public void drawFG( final int offsetX, final int offsetY, final int mouseX, final int mouseY ) public void drawFG( final int offsetX, final int offsetY, final int mouseX, final int mouseY )
{ {
super.drawFG( offsetX, offsetY, mouseX, mouseY ); super.drawFG( offsetX, offsetY, mouseX, mouseY );
this.fontRenderer.drawString( GuiText.CraftingTerminal.getLocal(), 8, this.ySize - 96 + 1 - this.getReservedSpace(), 4210752 ); this.font.drawString( GuiText.CraftingTerminal.getLocal(), 8, this.ySize - 96 + 1 - this.getReservedSpace(), 4210752 );
} }
@Override @Override
@@ -57,18 +57,18 @@ public class GuiDrive extends AEBaseGui
} }
@Override @Override
public void initGui() public void init()
{ {
super.initGui(); super.init();
this.buttonList.add( this.priority = new GuiTabButton( this.guiLeft + 154, this.guiTop, 2 + 4 * 16, GuiText.Priority.getLocal(), this.itemRender ) ); this.addButton( this.priority = new GuiTabButton( this.guiLeft + 154, this.guiTop, 2 + 4 * 16, GuiText.Priority.getLocal(), this.itemRender ) );
} }
@Override @Override
public void drawFG( final int offsetX, final int offsetY, final int mouseX, final int mouseY ) public void drawFG( final int offsetX, final int offsetY, final int mouseX, final int mouseY )
{ {
this.fontRenderer.drawString( this.getGuiDisplayName( GuiText.Drive.getLocal() ), 8, 6, 4210752 ); this.font.drawString( this.getGuiDisplayName( GuiText.Drive.getLocal() ), 8, 6, 4210752 );
this.fontRenderer.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 ); this.font.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
} }
@Override @Override
@@ -58,17 +58,17 @@ public class GuiFormationPlane extends GuiUpgradeable
this.placeMode = new GuiImgButton( this.guiLeft - 18, this.guiTop + 28, Settings.PLACE_BLOCK, YesNo.YES ); this.placeMode = new GuiImgButton( this.guiLeft - 18, this.guiTop + 28, Settings.PLACE_BLOCK, YesNo.YES );
this.fuzzyMode = new GuiImgButton( this.guiLeft - 18, this.guiTop + 48, Settings.FUZZY_MODE, FuzzyMode.IGNORE_ALL ); this.fuzzyMode = new GuiImgButton( this.guiLeft - 18, this.guiTop + 48, Settings.FUZZY_MODE, FuzzyMode.IGNORE_ALL );
this.buttonList.add( this.priority = new GuiTabButton( this.guiLeft + 154, this.guiTop, 2 + 4 * 16, GuiText.Priority.getLocal(), this.itemRender ) ); this.addButton( this.priority = new GuiTabButton( this.guiLeft + 154, this.guiTop, 2 + 4 * 16, GuiText.Priority.getLocal(), this.itemRender ) );
this.buttonList.add( this.placeMode ); this.addButton( this.placeMode );
this.buttonList.add( this.fuzzyMode ); this.addButton( this.fuzzyMode );
} }
@Override @Override
public void drawFG( final int offsetX, final int offsetY, final int mouseX, final int mouseY ) public void drawFG( final int offsetX, final int offsetY, final int mouseX, final int mouseY )
{ {
this.fontRenderer.drawString( this.getGuiDisplayName( GuiText.FormationPlane.getLocal() ), 8, 6, 4210752 ); this.font.drawString( this.getGuiDisplayName( GuiText.FormationPlane.getLocal() ), 8, 6, 4210752 );
this.fontRenderer.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 ); this.font.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
if( this.fuzzyMode != null ) if( this.fuzzyMode != null )
{ {
@@ -39,8 +39,8 @@ public class GuiGrinder extends AEBaseGui
@Override @Override
public void drawFG( final int offsetX, final int offsetY, final int mouseX, final int mouseY ) public void drawFG( final int offsetX, final int offsetY, final int mouseX, final int mouseY )
{ {
this.fontRenderer.drawString( this.getGuiDisplayName( GuiText.GrindStone.getLocal() ), 8, 6, 4210752 ); this.font.drawString( this.getGuiDisplayName( GuiText.GrindStone.getLocal() ), 8, 6, 4210752 );
this.fontRenderer.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 ); this.font.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
} }
@Override @Override
@@ -59,16 +59,16 @@ public class GuiIOPort extends GuiUpgradeable
this.fullMode = new GuiImgButton( this.guiLeft - 18, this.guiTop + 8, Settings.FULLNESS_MODE, FullnessMode.EMPTY ); this.fullMode = new GuiImgButton( this.guiLeft - 18, this.guiTop + 8, Settings.FULLNESS_MODE, FullnessMode.EMPTY );
this.operationMode = new GuiImgButton( this.guiLeft + 80, this.guiTop + 17, Settings.OPERATION_MODE, OperationMode.EMPTY ); this.operationMode = new GuiImgButton( this.guiLeft + 80, this.guiTop + 17, Settings.OPERATION_MODE, OperationMode.EMPTY );
this.buttonList.add( this.operationMode ); this.addButton( this.operationMode );
this.buttonList.add( this.redstoneMode ); this.addButton( this.redstoneMode );
this.buttonList.add( this.fullMode ); this.addButton( this.fullMode );
} }
@Override @Override
public void drawFG( final int offsetX, final int offsetY, final int mouseX, final int mouseY ) public void drawFG( final int offsetX, final int offsetY, final int mouseX, final int mouseY )
{ {
this.fontRenderer.drawString( this.getGuiDisplayName( GuiText.IOPort.getLocal() ), 8, 6, 4210752 ); this.font.drawString( this.getGuiDisplayName( GuiText.IOPort.getLocal() ), 8, 6, 4210752 );
this.fontRenderer.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 ); this.font.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
if( this.redstoneMode != null ) if( this.redstoneMode != null )
{ {
@@ -50,12 +50,12 @@ public class GuiInscriber extends AEBaseGui
} }
@Override @Override
public void initGui() public void init()
{ {
super.initGui(); super.init();
this.pb = new GuiProgressBar( this.cvc, "guis/inscriber.png", 135, 39, 135, 177, 6, 18, Direction.VERTICAL ); this.pb = new GuiProgressBar( this.cvc, "guis/inscriber.png", 135, 39, 135, 177, 6, 18, Direction.VERTICAL );
this.buttonList.add( this.pb ); this.addButton( this.pb );
} }
@Override @Override
@@ -63,8 +63,8 @@ public class GuiInscriber extends AEBaseGui
{ {
this.pb.setFullMsg( this.cvc.getCurrentProgress() * 100 / this.cvc.getMaxProgress() + "%" ); this.pb.setFullMsg( this.cvc.getCurrentProgress() * 100 / this.cvc.getMaxProgress() + "%" );
this.fontRenderer.drawString( this.getGuiDisplayName( GuiText.Inscriber.getLocal() ), 8, 6, 4210752 ); this.font.drawString( this.getGuiDisplayName( GuiText.Inscriber.getLocal() ), 8, 6, 4210752 );
this.fontRenderer.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 ); this.font.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
} }
@Override @Override
@@ -57,14 +57,14 @@ public class GuiInterface extends GuiUpgradeable
protected void addButtons() protected void addButtons()
{ {
this.priority = new GuiTabButton( this.guiLeft + 154, this.guiTop, 2 + 4 * 16, GuiText.Priority.getLocal(), this.itemRender ); this.priority = new GuiTabButton( this.guiLeft + 154, this.guiTop, 2 + 4 * 16, GuiText.Priority.getLocal(), this.itemRender );
this.buttonList.add( this.priority ); this.addButton( this.priority );
this.BlockMode = new GuiImgButton( this.guiLeft - 18, this.guiTop + 8, Settings.BLOCK, YesNo.NO ); this.BlockMode = new GuiImgButton( this.guiLeft - 18, this.guiTop + 8, Settings.BLOCK, YesNo.NO );
this.buttonList.add( this.BlockMode ); this.addButton( this.BlockMode );
this.interfaceMode = new GuiToggleButton( this.guiLeft - 18, this.guiTop + 26, 84, 85, GuiText.InterfaceTerminal this.interfaceMode = new GuiToggleButton( this.guiLeft - 18, this.guiTop + 26, 84, 85, GuiText.InterfaceTerminal
.getLocal(), GuiText.InterfaceTerminalHint.getLocal() ); .getLocal(), GuiText.InterfaceTerminalHint.getLocal() );
this.buttonList.add( this.interfaceMode ); this.addButton( this.interfaceMode );
} }
@Override @Override
@@ -80,13 +80,13 @@ public class GuiInterface extends GuiUpgradeable
this.interfaceMode.setState( ( (ContainerInterface) this.cvb ).getInterfaceTerminalMode() == YesNo.YES ); this.interfaceMode.setState( ( (ContainerInterface) this.cvb ).getInterfaceTerminalMode() == YesNo.YES );
} }
this.fontRenderer.drawString( this.getGuiDisplayName( GuiText.Interface.getLocal() ), 8, 6, 4210752 ); this.font.drawString( this.getGuiDisplayName( GuiText.Interface.getLocal() ), 8, 6, 4210752 );
this.fontRenderer.drawString( GuiText.Config.getLocal(), 8, 6 + 11 + 7, 4210752 ); this.font.drawString( GuiText.Config.getLocal(), 8, 6 + 11 + 7, 4210752 );
this.fontRenderer.drawString( GuiText.StoredItems.getLocal(), 8, 6 + 60 + 7, 4210752 ); this.font.drawString( GuiText.StoredItems.getLocal(), 8, 6 + 60 + 7, 4210752 );
this.fontRenderer.drawString( GuiText.Patterns.getLocal(), 8, 6 + 73 + 7, 4210752 ); this.font.drawString( GuiText.Patterns.getLocal(), 8, 6 + 73 + 7, 4210752 );
this.fontRenderer.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 ); this.font.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
} }
@Override @Override
@@ -36,9 +36,8 @@ import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.Slot; import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.CompoundNBT;
import net.minecraft.nbt.NBTTagList; import net.minecraft.nbt.ListNBT;
import appeng.api.AEApi;
import appeng.api.storage.channels.IItemStorageChannel; import appeng.api.storage.channels.IItemStorageChannel;
import appeng.client.gui.AEBaseGui; import appeng.client.gui.AEBaseGui;
import appeng.client.gui.widgets.GuiScrollbar; import appeng.client.gui.widgets.GuiScrollbar;
@@ -80,15 +79,15 @@ public class GuiInterfaceTerminal extends AEBaseGui
} }
@Override @Override
public void initGui() public void init()
{ {
super.initGui(); super.init();
this.getScrollBar().setLeft( 175 ); this.getScrollBar().setLeft( 175 );
this.getScrollBar().setHeight( 106 ); this.getScrollBar().setHeight( 106 );
this.getScrollBar().setTop( 18 ); this.getScrollBar().setTop( 18 );
this.searchField = new MEGuiTextField( this.fontRenderer, this.guiLeft + Math.max( 104, this.offsetX ), this.guiTop + 4, 65, 12 ); this.searchField = new MEGuiTextField( this.font, this.guiLeft + Math.max( 104, this.offsetX ), this.guiTop + 4, 65, 12 );
this.searchField.setEnableBackgroundDrawing( false ); this.searchField.setEnableBackgroundDrawing( false );
this.searchField.setMaxStringLength( 25 ); this.searchField.setMaxStringLength( 25 );
this.searchField.setTextColor( 0xFFFFFF ); this.searchField.setTextColor( 0xFFFFFF );
@@ -99,8 +98,8 @@ public class GuiInterfaceTerminal extends AEBaseGui
@Override @Override
public void drawFG( final int offsetX, final int offsetY, final int mouseX, final int mouseY ) public void drawFG( final int offsetX, final int offsetY, final int mouseX, final int mouseY )
{ {
this.fontRenderer.drawString( this.getGuiDisplayName( GuiText.InterfaceTerminal.getLocal() ), 8, 6, 4210752 ); this.font.drawString( this.getGuiDisplayName( GuiText.InterfaceTerminal.getLocal() ), 8, 6, 4210752 );
this.fontRenderer.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 ); this.font.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
final int ex = this.getScrollBar().getCurrentScroll(); final int ex = this.getScrollBar().getCurrentScroll();
@@ -134,12 +133,12 @@ public class GuiInterfaceTerminal extends AEBaseGui
name = name + " (" + rows + ')'; name = name + " (" + rows + ')';
} }
while( name.length() > 2 && this.fontRenderer.getStringWidth( name ) > 155 ) while( name.length() > 2 && this.font.getStringWidth( name ) > 155 )
{ {
name = name.substring( 0, name.length() - 1 ); name = name.substring( 0, name.length() - 1 );
} }
this.fontRenderer.drawString( name, 10, 6 + offset, 4210752 ); this.font.drawString( name, 10, 6 + offset, 4210752 );
} }
offset += 18; offset += 18;
} }
@@ -175,7 +174,7 @@ public class GuiInterfaceTerminal extends AEBaseGui
{ {
final ClientDCInternalInv inv = (ClientDCInternalInv) lineObj; final ClientDCInternalInv inv = (ClientDCInternalInv) lineObj;
GlStateManager.color( 1, 1, 1, 1 ); RenderSystem.color4f( 1, 1, 1, 1 );
final int width = inv.getInventory().getSlots() * 18; final int width = inv.getInventory().getSlots() * 18;
this.drawTexturedModalRect( offsetX + 7, offsetY + offset, 7, 139, width, 18 ); this.drawTexturedModalRect( offsetX + 7, offsetY + offset, 7, 139, width, 18 );
} }
@@ -339,8 +338,8 @@ public class GuiInterfaceTerminal extends AEBaseGui
} }
// Potential later use to filter by input // Potential later use to filter by input
// NBTTagList inTag = encodedValue.getTagList( "in", 10 ); // ListNBT inTag = encodedValue.getTagList( "in", 10 );
final NBTTagList outTag = encodedValue.getTagList( "out", 10 ); final ListNBT outTag = encodedValue.getTagList( "out", 10 );
for( int i = 0; i < outTag.tagCount(); i++ ) for( int i = 0; i < outTag.tagCount(); i++ )
{ {
@@ -67,11 +67,11 @@ public class GuiLevelEmitter extends GuiUpgradeable
} }
@Override @Override
public void initGui() public void init()
{ {
super.initGui(); super.init();
this.level = new GuiNumberBox( this.fontRenderer, this.guiLeft + 24, this.guiTop + 43, 79, this.fontRenderer.FONT_HEIGHT, Long.class ); this.level = new GuiNumberBox( this.font, this.guiLeft + 24, this.guiTop + 43, 79, this.font.FONT_HEIGHT, Long.class );
this.level.setEnableBackgroundDrawing( false ); this.level.setEnableBackgroundDrawing( false );
this.level.setMaxStringLength( 16 ); this.level.setMaxStringLength( 16 );
this.level.setTextColor( 0xFFFFFF ); this.level.setTextColor( 0xFFFFFF );
@@ -93,20 +93,20 @@ public class GuiLevelEmitter extends GuiUpgradeable
final int c = AEConfig.instance().levelByStackAmounts( 2 ); final int c = AEConfig.instance().levelByStackAmounts( 2 );
final int d = AEConfig.instance().levelByStackAmounts( 3 ); final int d = AEConfig.instance().levelByStackAmounts( 3 );
this.buttonList.add( this.plus1 = new GuiButton( 0, this.guiLeft + 20, this.guiTop + 17, 22, 20, "+" + a ) ); this.addButton( this.plus1 = new GuiButton( 0, this.guiLeft + 20, this.guiTop + 17, 22, 20, "+" + a ) );
this.buttonList.add( this.plus10 = new GuiButton( 0, this.guiLeft + 48, this.guiTop + 17, 28, 20, "+" + b ) ); this.addButton( this.plus10 = new GuiButton( 0, this.guiLeft + 48, this.guiTop + 17, 28, 20, "+" + b ) );
this.buttonList.add( this.plus100 = new GuiButton( 0, this.guiLeft + 82, this.guiTop + 17, 32, 20, "+" + c ) ); this.addButton( this.plus100 = new GuiButton( 0, this.guiLeft + 82, this.guiTop + 17, 32, 20, "+" + c ) );
this.buttonList.add( this.plus1000 = new GuiButton( 0, this.guiLeft + 120, this.guiTop + 17, 38, 20, "+" + d ) ); this.addButton( this.plus1000 = new GuiButton( 0, this.guiLeft + 120, this.guiTop + 17, 38, 20, "+" + d ) );
this.buttonList.add( this.minus1 = new GuiButton( 0, this.guiLeft + 20, this.guiTop + 59, 22, 20, "-" + a ) ); this.addButton( this.minus1 = new GuiButton( 0, this.guiLeft + 20, this.guiTop + 59, 22, 20, "-" + a ) );
this.buttonList.add( this.minus10 = new GuiButton( 0, this.guiLeft + 48, this.guiTop + 59, 28, 20, "-" + b ) ); this.addButton( this.minus10 = new GuiButton( 0, this.guiLeft + 48, this.guiTop + 59, 28, 20, "-" + b ) );
this.buttonList.add( this.minus100 = new GuiButton( 0, this.guiLeft + 82, this.guiTop + 59, 32, 20, "-" + c ) ); this.addButton( this.minus100 = new GuiButton( 0, this.guiLeft + 82, this.guiTop + 59, 32, 20, "-" + c ) );
this.buttonList.add( this.minus1000 = new GuiButton( 0, this.guiLeft + 120, this.guiTop + 59, 38, 20, "-" + d ) ); this.addButton( this.minus1000 = new GuiButton( 0, this.guiLeft + 120, this.guiTop + 59, 38, 20, "-" + d ) );
this.buttonList.add( this.levelMode ); this.addButton( this.levelMode );
this.buttonList.add( this.redstoneMode ); this.addButton( this.redstoneMode );
this.buttonList.add( this.fuzzyMode ); this.addButton( this.fuzzyMode );
this.buttonList.add( this.craftingMode ); this.addButton( this.craftingMode );
} }
@Override @Override
@@ -45,19 +45,19 @@ public class GuiMAC extends GuiUpgradeable
} }
@Override @Override
public void initGui() public void init()
{ {
super.initGui(); super.init();
this.pb = new GuiProgressBar( this.container, "guis/mac.png", 139, 36, 148, 201, 6, 18, Direction.VERTICAL ); this.pb = new GuiProgressBar( this.container, "guis/mac.png", 139, 36, 148, 201, 6, 18, Direction.VERTICAL );
this.buttonList.add( this.pb ); this.addButton( this.pb );
} }
@Override @Override
protected void addButtons() protected void addButtons()
{ {
this.redstoneMode = new GuiImgButton( this.guiLeft - 18, this.guiTop + 8, Settings.REDSTONE_CONTROLLED, RedstoneMode.IGNORE ); this.redstoneMode = new GuiImgButton( this.guiLeft - 18, this.guiTop + 8, Settings.REDSTONE_CONTROLLED, RedstoneMode.IGNORE );
this.buttonList.add( this.redstoneMode ); this.addButton( this.redstoneMode );
} }
@Override @Override
@@ -219,12 +219,12 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
private void reinitalize() private void reinitalize()
{ {
this.buttonList.clear(); this.buttons.clear();
this.initGui(); this.init();
} }
@Override @Override
public void initGui() public void init()
{ {
Keyboard.enableRepeatEvents( true ); Keyboard.enableRepeatEvents( true );
@@ -266,7 +266,7 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
this.xSize = this.standardSize; this.xSize = this.standardSize;
} }
super.initGui(); super.init();
// full size : 204 // full size : 204
// extra slots : 72 // extra slots : 72
// slot 18 // slot 18
@@ -292,11 +292,11 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
offset += 20; offset += 20;
} }
this.buttonList.add( this.SortDirBox = new GuiImgButton( this.guiLeft - 18, offset, Settings.SORT_DIRECTION, this.configSrc this.addButton( this.SortDirBox = new GuiImgButton( this.guiLeft - 18, offset, Settings.SORT_DIRECTION, this.configSrc
.getSetting( Settings.SORT_DIRECTION ) ) ); .getSetting( Settings.SORT_DIRECTION ) ) );
offset += 20; offset += 20;
this.buttonList.add( this.addButton(
this.searchBoxSettings = new GuiImgButton( this.guiLeft - 18, offset, Settings.SEARCH_MODE, AEConfig.instance() this.searchBoxSettings = new GuiImgButton( this.guiLeft - 18, offset, Settings.SEARCH_MODE, AEConfig.instance()
.getConfigManager() .getConfigManager()
.getSetting( .getSetting(
@@ -306,12 +306,12 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
if( !( this instanceof GuiMEPortableCell ) || this instanceof GuiWirelessTerm ) if( !( this instanceof GuiMEPortableCell ) || this instanceof GuiWirelessTerm )
{ {
this.buttonList.add( this.terminalStyleBox = new GuiImgButton( this.guiLeft - 18, offset, Settings.TERMINAL_STYLE, AEConfig.instance() this.addButton( this.terminalStyleBox = new GuiImgButton( this.guiLeft - 18, offset, Settings.TERMINAL_STYLE, AEConfig.instance()
.getConfigManager() .getConfigManager()
.getSetting( Settings.TERMINAL_STYLE ) ) ); .getSetting( Settings.TERMINAL_STYLE ) ) );
} }
this.searchField = new MEGuiTextField( this.fontRenderer, this.guiLeft + Math.max( 80, this.offsetX ), this.guiTop + 4, 90, 12 ); this.searchField = new MEGuiTextField( this.font, this.guiLeft + Math.max( 80, this.offsetX ), this.guiTop + 4, 90, 12 );
this.searchField.setEnableBackgroundDrawing( false ); this.searchField.setEnableBackgroundDrawing( false );
this.searchField.setMaxStringLength( 25 ); this.searchField.setMaxStringLength( 25 );
this.searchField.setTextColor( 0xFFFFFF ); this.searchField.setTextColor( 0xFFFFFF );
@@ -320,7 +320,7 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
if( this.viewCell || this instanceof GuiWirelessTerm ) if( this.viewCell || this instanceof GuiWirelessTerm )
{ {
this.buttonList.add( this.craftingStatusBtn = new GuiTabButton( this.guiLeft + 170, this.guiTop - 4, 2 + 11 * 16, GuiText.CraftingStatus this.addButton( this.craftingStatusBtn = new GuiTabButton( this.guiLeft + 170, this.guiTop - 4, 2 + 11 * 16, GuiText.CraftingStatus
.getLocal(), this.itemRender ) ); .getLocal(), this.itemRender ) );
this.craftingStatusBtn.setHideEdge( 13 ); this.craftingStatusBtn.setHideEdge( 13 );
} }
@@ -379,8 +379,8 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
@Override @Override
public void drawFG( final int offsetX, final int offsetY, final int mouseX, final int mouseY ) public void drawFG( final int offsetX, final int offsetY, final int mouseX, final int mouseY )
{ {
this.fontRenderer.drawString( this.getGuiDisplayName( this.myName.getLocal() ), 8, 6, 4210752 ); this.font.drawString( this.getGuiDisplayName( this.myName.getLocal() ), 8, 6, 4210752 );
this.fontRenderer.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 ); this.font.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
this.currentMouseX = mouseX; this.currentMouseX = mouseX;
this.currentMouseY = mouseY; this.currentMouseY = mouseY;
@@ -403,9 +403,9 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
} }
@Override @Override
public void onGuiClosed() public void removed()
{ {
super.onGuiClosed(); super.removed();
Keyboard.enableRepeatEvents( false ); Keyboard.enableRepeatEvents( false );
memoryText = this.searchField.getText(); memoryText = this.searchField.getText();
} }
@@ -84,16 +84,16 @@ public class GuiNetworkStatus extends AEBaseGui implements ISortSource
} }
@Override @Override
public void initGui() public void init()
{ {
super.initGui(); super.init();
this.units = new GuiImgButton( this.guiLeft - 18, this.guiTop + 8, Settings.POWER_UNITS, AEConfig.instance().selectedPowerUnit() ); this.units = new GuiImgButton( this.guiLeft - 18, this.guiTop + 8, Settings.POWER_UNITS, AEConfig.instance().selectedPowerUnit() );
this.buttonList.add( this.units ); this.addButton( this.units );
} }
@Override @Override
public void drawScreen( final int mouseX, final int mouseY, final float btn ) public void render(final int mouseX, final int mouseY, final float btn )
{ {
final int gx = ( this.width - this.xSize ) / 2; final int gx = ( this.width - this.xSize ) / 2;
@@ -126,7 +126,7 @@ public class GuiNetworkStatus extends AEBaseGui implements ISortSource
} }
} }
super.drawScreen( mouseX, mouseY, btn ); super.render( mouseX, mouseY, btn );
} }
@Override @Override
@@ -134,14 +134,14 @@ public class GuiNetworkStatus extends AEBaseGui implements ISortSource
{ {
final ContainerNetworkStatus ns = (ContainerNetworkStatus) this.inventorySlots; final ContainerNetworkStatus ns = (ContainerNetworkStatus) this.inventorySlots;
this.fontRenderer.drawString( GuiText.NetworkDetails.getLocal(), 8, 6, 4210752 ); this.font.drawString( GuiText.NetworkDetails.getLocal(), 8, 6, 4210752 );
this.fontRenderer.drawString( GuiText.StoredPower.getLocal() + ": " + Platform.formatPowerLong( ns.getCurrentPower(), false ), 13, 16, 4210752 ); this.font.drawString( GuiText.StoredPower.getLocal() + ": " + Platform.formatPowerLong( ns.getCurrentPower(), false ), 13, 16, 4210752 );
this.fontRenderer.drawString( GuiText.MaxPower.getLocal() + ": " + Platform.formatPowerLong( ns.getMaxPower(), false ), 13, 26, 4210752 ); this.font.drawString( GuiText.MaxPower.getLocal() + ": " + Platform.formatPowerLong( ns.getMaxPower(), false ), 13, 26, 4210752 );
this.fontRenderer.drawString( GuiText.PowerInputRate.getLocal() + ": " + Platform.formatPowerLong( ns.getAverageAddition(), true ), 13, 143 - 10, this.font.drawString( GuiText.PowerInputRate.getLocal() + ": " + Platform.formatPowerLong( ns.getAverageAddition(), true ), 13, 143 - 10,
4210752 ); 4210752 );
this.fontRenderer.drawString( GuiText.PowerUsageRate.getLocal() + ": " + Platform.formatPowerLong( ns.getPowerUsage(), true ), 13, 143 - 20, 4210752 ); this.font.drawString( GuiText.PowerUsageRate.getLocal() + ": " + Platform.formatPowerLong( ns.getPowerUsage(), true ), 13, 143 - 20, 4210752 );
final int sectionLength = 30; final int sectionLength = 30;
@@ -170,8 +170,8 @@ public class GuiNetworkStatus extends AEBaseGui implements ISortSource
str = Long.toString( refStack.getStackSize() / 1000 ) + 'k'; str = Long.toString( refStack.getStackSize() / 1000 ) + 'k';
} }
final int w = this.fontRenderer.getStringWidth( str ); final int w = this.font.getStringWidth( str );
this.fontRenderer.drawString( str, (int) ( ( x * sectionLength + xo + sectionLength - 19 - ( w * 0.5 ) ) * 2 ), ( y * 18 + yo + 6 ) * 2, this.font.drawString( str, (int) ( ( x * sectionLength + xo + sectionLength - 19 - ( w * 0.5 ) ) * 2 ), ( y * 18 + yo + 6 ) * 2,
4210752 ); 4210752 );
GlStateManager.popMatrix(); GlStateManager.popMatrix();
@@ -257,8 +257,8 @@ public class GuiNetworkStatus extends AEBaseGui implements ISortSource
if( myStack != null ) if( myStack != null )
{ {
ITooltipFlag.TooltipFlags tooltipFlag = this.mc.gameSettings.advancedItemTooltips ? ITooltipFlag.TooltipFlags.ADVANCED : ITooltipFlag.TooltipFlags.NORMAL; ITooltipFlag.TooltipFlags tooltipFlag = this.minecraft.gameSettings.advancedItemTooltips ? ITooltipFlag.TooltipFlags.ADVANCED : ITooltipFlag.TooltipFlags.NORMAL;
List<String> currentToolTip = stack.getTooltip( this.mc.player, tooltipFlag ); List<String> currentToolTip = stack.getTooltip( this.minecraft.player, tooltipFlag );
while( currentToolTip.size() > 1 ) while( currentToolTip.size() > 1 )
{ {
@@ -64,14 +64,14 @@ public class GuiNetworkTool extends AEBaseGui
} }
@Override @Override
public void initGui() public void init()
{ {
super.initGui(); super.init();
this.tFacades = new GuiToggleButton( this.guiLeft - 18, this.guiTop + 8, 23, 22, GuiText.TransparentFacades.getLocal(), GuiText.TransparentFacadesHint this.tFacades = new GuiToggleButton( this.guiLeft - 18, this.guiTop + 8, 23, 22, GuiText.TransparentFacades.getLocal(), GuiText.TransparentFacadesHint
.getLocal() ); .getLocal() );
this.buttonList.add( this.tFacades ); this.addButton( this.tFacades );
} }
@Override @Override
@@ -82,8 +82,8 @@ public class GuiNetworkTool extends AEBaseGui
this.tFacades.setState( ( (ContainerNetworkTool) this.inventorySlots ).isFacadeMode() ); this.tFacades.setState( ( (ContainerNetworkTool) this.inventorySlots ).isFacadeMode() );
} }
this.fontRenderer.drawString( this.getGuiDisplayName( GuiText.NetworkTool.getLocal() ), 8, 6, 4210752 ); this.font.drawString( this.getGuiDisplayName( GuiText.NetworkTool.getLocal() ), 8, 6, 4210752 );
this.fontRenderer.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 ); this.font.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
} }
@Override @Override
@@ -107,32 +107,32 @@ public class GuiPatternTerm extends GuiMEMonitorable
} }
@Override @Override
public void initGui() public void init()
{ {
super.initGui(); super.init();
this.tabCraftButton = new GuiTabButton( this.guiLeft + 173, this.guiTop + this.ySize - 177, new ItemStack( Blocks.CRAFTING_TABLE ), GuiText.CraftingPattern this.tabCraftButton = new GuiTabButton( this.guiLeft + 173, this.guiTop + this.ySize - 177, new ItemStack( Blocks.CRAFTING_TABLE ), GuiText.CraftingPattern
.getLocal(), this.itemRender ); .getLocal(), this.itemRender );
this.buttonList.add( this.tabCraftButton ); this.addButton( this.tabCraftButton );
this.tabProcessButton = new GuiTabButton( this.guiLeft + 173, this.guiTop + this.ySize - 177, new ItemStack( Blocks.FURNACE ), GuiText.ProcessingPattern this.tabProcessButton = new GuiTabButton( this.guiLeft + 173, this.guiTop + this.ySize - 177, new ItemStack( Blocks.FURNACE ), GuiText.ProcessingPattern
.getLocal(), this.itemRender ); .getLocal(), this.itemRender );
this.buttonList.add( this.tabProcessButton ); this.addButton( this.tabProcessButton );
this.substitutionsEnabledBtn = new GuiImgButton( this.guiLeft + 84, this.guiTop + this.ySize - 163, Settings.ACTIONS, ItemSubstitution.ENABLED ); this.substitutionsEnabledBtn = new GuiImgButton( this.guiLeft + 84, this.guiTop + this.ySize - 163, Settings.ACTIONS, ItemSubstitution.ENABLED );
this.substitutionsEnabledBtn.setHalfSize( true ); this.substitutionsEnabledBtn.setHalfSize( true );
this.buttonList.add( this.substitutionsEnabledBtn ); this.addButton( this.substitutionsEnabledBtn );
this.substitutionsDisabledBtn = new GuiImgButton( this.guiLeft + 84, this.guiTop + this.ySize - 163, Settings.ACTIONS, ItemSubstitution.DISABLED ); this.substitutionsDisabledBtn = new GuiImgButton( this.guiLeft + 84, this.guiTop + this.ySize - 163, Settings.ACTIONS, ItemSubstitution.DISABLED );
this.substitutionsDisabledBtn.setHalfSize( true ); this.substitutionsDisabledBtn.setHalfSize( true );
this.buttonList.add( this.substitutionsDisabledBtn ); this.addButton( this.substitutionsDisabledBtn );
this.clearBtn = new GuiImgButton( this.guiLeft + 74, this.guiTop + this.ySize - 163, Settings.ACTIONS, ActionItems.CLOSE ); this.clearBtn = new GuiImgButton( this.guiLeft + 74, this.guiTop + this.ySize - 163, Settings.ACTIONS, ActionItems.CLOSE );
this.clearBtn.setHalfSize( true ); this.clearBtn.setHalfSize( true );
this.buttonList.add( this.clearBtn ); this.addButton( this.clearBtn );
this.encodeBtn = new GuiImgButton( this.guiLeft + 147, this.guiTop + this.ySize - 142, Settings.ACTIONS, ActionItems.ENCODE ); this.encodeBtn = new GuiImgButton( this.guiLeft + 147, this.guiTop + this.ySize - 142, Settings.ACTIONS, ActionItems.ENCODE );
this.buttonList.add( this.encodeBtn ); this.addButton( this.encodeBtn );
} }
@Override @Override
@@ -163,7 +163,7 @@ public class GuiPatternTerm extends GuiMEMonitorable
} }
super.drawFG( offsetX, offsetY, mouseX, mouseY ); super.drawFG( offsetX, offsetY, mouseX, mouseY );
this.fontRenderer.drawString( GuiText.PatternTerminal.getLocal(), 8, this.ySize - 96 + 2 - this.getReservedSpace(), 4210752 ); this.font.drawString( GuiText.PatternTerminal.getLocal(), 8, this.ySize - 96 + 2 - this.getReservedSpace(), 4210752 );
} }
@Override @Override
@@ -62,24 +62,24 @@ public class GuiPriority extends AEBaseGui
} }
@Override @Override
public void initGui() public void init()
{ {
super.initGui(); super.init();
final int a = AEConfig.instance().priorityByStacksAmounts( 0 ); final int a = AEConfig.instance().priorityByStacksAmounts( 0 );
final int b = AEConfig.instance().priorityByStacksAmounts( 1 ); final int b = AEConfig.instance().priorityByStacksAmounts( 1 );
final int c = AEConfig.instance().priorityByStacksAmounts( 2 ); final int c = AEConfig.instance().priorityByStacksAmounts( 2 );
final int d = AEConfig.instance().priorityByStacksAmounts( 3 ); final int d = AEConfig.instance().priorityByStacksAmounts( 3 );
this.buttonList.add( this.plus1 = new GuiButton( 0, this.guiLeft + 20, this.guiTop + 32, 22, 20, "+" + a ) ); this.addButton( this.plus1 = new GuiButton( 0, this.guiLeft + 20, this.guiTop + 32, 22, 20, "+" + a ) );
this.buttonList.add( this.plus10 = new GuiButton( 0, this.guiLeft + 48, this.guiTop + 32, 28, 20, "+" + b ) ); this.addButton( this.plus10 = new GuiButton( 0, this.guiLeft + 48, this.guiTop + 32, 28, 20, "+" + b ) );
this.buttonList.add( this.plus100 = new GuiButton( 0, this.guiLeft + 82, this.guiTop + 32, 32, 20, "+" + c ) ); this.addButton( this.plus100 = new GuiButton( 0, this.guiLeft + 82, this.guiTop + 32, 32, 20, "+" + c ) );
this.buttonList.add( this.plus1000 = new GuiButton( 0, this.guiLeft + 120, this.guiTop + 32, 38, 20, "+" + d ) ); this.addButton( this.plus1000 = new GuiButton( 0, this.guiLeft + 120, this.guiTop + 32, 38, 20, "+" + d ) );
this.buttonList.add( this.minus1 = new GuiButton( 0, this.guiLeft + 20, this.guiTop + 69, 22, 20, "-" + a ) ); this.addButton( this.minus1 = new GuiButton( 0, this.guiLeft + 20, this.guiTop + 69, 22, 20, "-" + a ) );
this.buttonList.add( this.minus10 = new GuiButton( 0, this.guiLeft + 48, this.guiTop + 69, 28, 20, "-" + b ) ); this.addButton( this.minus10 = new GuiButton( 0, this.guiLeft + 48, this.guiTop + 69, 28, 20, "-" + b ) );
this.buttonList.add( this.minus100 = new GuiButton( 0, this.guiLeft + 82, this.guiTop + 69, 32, 20, "-" + c ) ); this.addButton( this.minus100 = new GuiButton( 0, this.guiLeft + 82, this.guiTop + 69, 32, 20, "-" + c ) );
this.buttonList.add( this.minus1000 = new GuiButton( 0, this.guiLeft + 120, this.guiTop + 69, 38, 20, "-" + d ) ); this.addButton( this.minus1000 = new GuiButton( 0, this.guiLeft + 120, this.guiTop + 69, 38, 20, "-" + d ) );
final ContainerPriority con = ( (ContainerPriority) this.inventorySlots ); final ContainerPriority con = ( (ContainerPriority) this.inventorySlots );
final ItemStack myIcon = con.getPriorityHost().getItemStackRepresentation(); final ItemStack myIcon = con.getPriorityHost().getItemStackRepresentation();
@@ -87,10 +87,10 @@ public class GuiPriority extends AEBaseGui
if( this.OriginalGui != null && !myIcon.isEmpty() ) if( this.OriginalGui != null && !myIcon.isEmpty() )
{ {
this.buttonList.add( this.originalGuiBtn = new GuiTabButton( this.guiLeft + 154, this.guiTop, myIcon, myIcon.getDisplayName(), this.itemRender ) ); this.addButton( this.originalGuiBtn = new GuiTabButton( this.guiLeft + 154, this.guiTop, myIcon, myIcon.getDisplayName(), this.itemRender ) );
} }
this.priority = new GuiNumberBox( this.fontRenderer, this.guiLeft + 62, this.guiTop + 57, 59, this.fontRenderer.FONT_HEIGHT, Long.class ); this.priority = new GuiNumberBox( this.font, this.guiLeft + 62, this.guiTop + 57, 59, this.font.FONT_HEIGHT, Long.class );
this.priority.setEnableBackgroundDrawing( false ); this.priority.setEnableBackgroundDrawing( false );
this.priority.setMaxStringLength( 16 ); this.priority.setMaxStringLength( 16 );
this.priority.setTextColor( 0xFFFFFF ); this.priority.setTextColor( 0xFFFFFF );
@@ -102,7 +102,7 @@ public class GuiPriority extends AEBaseGui
@Override @Override
public void drawFG( final int offsetX, final int offsetY, final int mouseX, final int mouseY ) public void drawFG( final int offsetX, final int offsetY, final int mouseX, final int mouseY )
{ {
this.fontRenderer.drawString( GuiText.Priority.getLocal(), 8, 6, 4210752 ); this.font.drawString( GuiText.Priority.getLocal(), 8, 6, 4210752 );
} }
@Override @Override
@@ -39,8 +39,8 @@ public class GuiQNB extends AEBaseGui
@Override @Override
public void drawFG( final int offsetX, final int offsetY, final int mouseX, final int mouseY ) public void drawFG( final int offsetX, final int offsetY, final int mouseX, final int mouseY )
{ {
this.fontRenderer.drawString( this.getGuiDisplayName( GuiText.QuantumLinkChamber.getLocal() ), 8, 6, 4210752 ); this.font.drawString( this.getGuiDisplayName( GuiText.QuantumLinkChamber.getLocal() ), 8, 6, 4210752 );
this.fontRenderer.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 ); this.font.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
} }
@Override @Override
@@ -45,11 +45,11 @@ public class GuiQuartzKnife extends AEBaseGui
} }
@Override @Override
public void initGui() public void init()
{ {
super.initGui(); super.init();
this.name = new GuiTextField( 0, this.fontRenderer, this.guiLeft + 24, this.guiTop + 32, 79, this.fontRenderer.FONT_HEIGHT ); this.name = new GuiTextField( 0, this.font, this.guiLeft + 24, this.guiTop + 32, 79, this.font.FONT_HEIGHT );
this.name.setEnableBackgroundDrawing( false ); this.name.setEnableBackgroundDrawing( false );
this.name.setMaxStringLength( 32 ); this.name.setMaxStringLength( 32 );
this.name.setTextColor( 0xFFFFFF ); this.name.setTextColor( 0xFFFFFF );
@@ -60,8 +60,8 @@ public class GuiQuartzKnife extends AEBaseGui
@Override @Override
public void drawFG( final int offsetX, final int offsetY, final int mouseX, final int mouseY ) public void drawFG( final int offsetX, final int offsetY, final int mouseX, final int mouseY )
{ {
this.fontRenderer.drawString( this.getGuiDisplayName( GuiText.QuartzCuttingKnife.getLocal() ), 8, 6, 4210752 ); this.font.drawString( this.getGuiDisplayName( GuiText.QuartzCuttingKnife.getLocal() ), 8, 6, 4210752 );
this.fontRenderer.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 ); this.font.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
} }
@Override @Override
@@ -96,24 +96,24 @@ public class GuiSecurityStation extends GuiMEMonitorable
} }
@Override @Override
public void initGui() public void init()
{ {
super.initGui(); super.init();
final int top = this.guiTop + this.ySize - 116; final int top = this.guiTop + this.ySize - 116;
this.buttonList.add( this.inject = new GuiToggleButton( this.guiLeft + 56, top, 11 * 16, 12 * 16, SecurityPermissions.INJECT this.addButton( this.inject = new GuiToggleButton( this.guiLeft + 56, top, 11 * 16, 12 * 16, SecurityPermissions.INJECT
.getTranslationKey(), SecurityPermissions.INJECT.getUnlocalizedTip() ) ); .getTranslationKey(), SecurityPermissions.INJECT.getUnlocalizedTip() ) );
this.buttonList.add( this.extract = new GuiToggleButton( this.guiLeft + 56 + 18, top, 11 * 16 + 1, 12 * 16 + 1, SecurityPermissions.EXTRACT this.addButton( this.extract = new GuiToggleButton( this.guiLeft + 56 + 18, top, 11 * 16 + 1, 12 * 16 + 1, SecurityPermissions.EXTRACT
.getTranslationKey(), SecurityPermissions.EXTRACT.getUnlocalizedTip() ) ); .getTranslationKey(), SecurityPermissions.EXTRACT.getUnlocalizedTip() ) );
this.buttonList.add( this.craft = new GuiToggleButton( this.guiLeft + 56 + 18 * 2, top, 11 * 16 + 2, 12 * 16 + 2, SecurityPermissions.CRAFT this.addButton( this.craft = new GuiToggleButton( this.guiLeft + 56 + 18 * 2, top, 11 * 16 + 2, 12 * 16 + 2, SecurityPermissions.CRAFT
.getTranslationKey(), SecurityPermissions.CRAFT.getUnlocalizedTip() ) ); .getTranslationKey(), SecurityPermissions.CRAFT.getUnlocalizedTip() ) );
this.buttonList.add( this.build = new GuiToggleButton( this.guiLeft + 56 + 18 * 3, top, 11 * 16 + 3, 12 * 16 + 3, SecurityPermissions.BUILD this.addButton( this.build = new GuiToggleButton( this.guiLeft + 56 + 18 * 3, top, 11 * 16 + 3, 12 * 16 + 3, SecurityPermissions.BUILD
.getTranslationKey(), SecurityPermissions.BUILD.getUnlocalizedTip() ) ); .getTranslationKey(), SecurityPermissions.BUILD.getUnlocalizedTip() ) );
this.buttonList.add( this.security = new GuiToggleButton( this.guiLeft + 56 + 18 * 4, top, 11 * 16 + 4, 12 * 16 + 4, SecurityPermissions.SECURITY this.addButton( this.security = new GuiToggleButton( this.guiLeft + 56 + 18 * 4, top, 11 * 16 + 4, 12 * 16 + 4, SecurityPermissions.SECURITY
.getTranslationKey(), SecurityPermissions.SECURITY.getUnlocalizedTip() ) ); .getTranslationKey(), SecurityPermissions.SECURITY.getUnlocalizedTip() ) );
} }
@@ -121,7 +121,7 @@ public class GuiSecurityStation extends GuiMEMonitorable
public void drawFG( final int offsetX, final int offsetY, final int mouseX, final int mouseY ) public void drawFG( final int offsetX, final int offsetY, final int mouseX, final int mouseY )
{ {
super.drawFG( offsetX, offsetY, mouseX, mouseY ); super.drawFG( offsetX, offsetY, mouseX, mouseY );
this.fontRenderer.drawString( GuiText.SecurityCardEditor.getLocal(), 8, this.ySize - 96 + 1 - this.getReservedSpace(), 4210752 ); this.font.drawString( GuiText.SecurityCardEditor.getLocal(), 8, this.ySize - 96 + 1 - this.getReservedSpace(), 4210752 );
} }
@Override @Override
@@ -40,8 +40,8 @@ public class GuiSkyChest extends AEBaseGui
@Override @Override
public void drawFG( final int offsetX, final int offsetY, final int mouseX, final int mouseY ) public void drawFG( final int offsetX, final int offsetY, final int mouseX, final int mouseY )
{ {
this.fontRenderer.drawString( this.getGuiDisplayName( GuiText.SkyChest.getLocal() ), 8, 8, 4210752 ); this.font.drawString( this.getGuiDisplayName( GuiText.SkyChest.getLocal() ), 8, 8, 4210752 );
this.fontRenderer.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 2, 4210752 ); this.font.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 2, 4210752 );
} }
@Override @Override
@@ -64,35 +64,35 @@ public class GuiSpatialIOPort extends AEBaseGui
} }
@Override @Override
public void initGui() public void init()
{ {
super.initGui(); super.init();
this.units = new GuiImgButton( this.guiLeft - 18, this.guiTop + 8, Settings.POWER_UNITS, AEConfig.instance().selectedPowerUnit() ); this.units = new GuiImgButton( this.guiLeft - 18, this.guiTop + 8, Settings.POWER_UNITS, AEConfig.instance().selectedPowerUnit() );
this.buttonList.add( this.units ); this.addButton( this.units );
} }
@Override @Override
public void drawFG( final int offsetX, final int offsetY, final int mouseX, final int mouseY ) public void drawFG( final int offsetX, final int offsetY, final int mouseX, final int mouseY )
{ {
this.fontRenderer.drawString( GuiText.StoredPower.getLocal() + ": " + Platform.formatPowerLong( this.container.getCurrentPower(), false ), 13, 21, this.font.drawString( GuiText.StoredPower.getLocal() + ": " + Platform.formatPowerLong( this.container.getCurrentPower(), false ), 13, 21,
4210752 ); 4210752 );
this.fontRenderer.drawString( GuiText.MaxPower.getLocal() + ": " + Platform.formatPowerLong( this.container.getMaxPower(), false ), 13, 31, 4210752 ); this.font.drawString( GuiText.MaxPower.getLocal() + ": " + Platform.formatPowerLong( this.container.getMaxPower(), false ), 13, 31, 4210752 );
this.fontRenderer.drawString( GuiText.RequiredPower.getLocal() + ": " + Platform.formatPowerLong( this.container.getRequiredPower(), false ), 13, 73, this.font.drawString( GuiText.RequiredPower.getLocal() + ": " + Platform.formatPowerLong( this.container.getRequiredPower(), false ), 13, 73,
4210752 ); 4210752 );
this.fontRenderer.drawString( GuiText.Efficiency.getLocal() + ": " + ( ( (float) this.container.getEfficency() ) / 100 ) + '%', 13, 83, 4210752 ); this.font.drawString( GuiText.Efficiency.getLocal() + ": " + ( ( (float) this.container.getEfficency() ) / 100 ) + '%', 13, 83, 4210752 );
this.fontRenderer.drawString( this.getGuiDisplayName( GuiText.SpatialIOPort.getLocal() ), 8, 6, 4210752 ); this.font.drawString( this.getGuiDisplayName( GuiText.SpatialIOPort.getLocal() ), 8, 6, 4210752 );
this.fontRenderer.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96, 4210752 ); this.font.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96, 4210752 );
if( this.container.xSize != 0 && this.container.ySize != 0 && this.container.zSize != 0 ) if( this.container.xSize != 0 && this.container.ySize != 0 && this.container.zSize != 0 )
{ {
final String text = GuiText.SCSSize.getLocal() + ": " + this.container.xSize + "x" + this.container.ySize + "x" + this.container.zSize; final String text = GuiText.SCSSize.getLocal() + ": " + this.container.xSize + "x" + this.container.ySize + "x" + this.container.zSize;
this.fontRenderer.drawString( text, 13, 93, 4210752 ); this.font.drawString( text, 13, 93, 4210752 );
} }
else else
{ {
this.fontRenderer.drawString( GuiText.SCSSize.getLocal() + ": " + GuiText.SCSInvalid.getLocal(), 13, 93, 4210752 ); this.font.drawString( GuiText.SCSSize.getLocal() + ": " + GuiText.SCSInvalid.getLocal(), 13, 93, 4210752 );
} }
} }
@@ -68,20 +68,20 @@ public class GuiStorageBus extends GuiUpgradeable
this.storageFilter = new GuiImgButton( this.guiLeft - 18, this.guiTop + 68, Settings.STORAGE_FILTER, StorageFilter.EXTRACTABLE_ONLY ); this.storageFilter = new GuiImgButton( this.guiLeft - 18, this.guiTop + 68, Settings.STORAGE_FILTER, StorageFilter.EXTRACTABLE_ONLY );
this.fuzzyMode = new GuiImgButton( this.guiLeft - 18, this.guiTop + 88, Settings.FUZZY_MODE, FuzzyMode.IGNORE_ALL ); this.fuzzyMode = new GuiImgButton( this.guiLeft - 18, this.guiTop + 88, Settings.FUZZY_MODE, FuzzyMode.IGNORE_ALL );
this.buttonList.add( this.priority = new GuiTabButton( this.guiLeft + 154, this.guiTop, 2 + 4 * 16, GuiText.Priority.getLocal(), this.itemRender ) ); this.addButton( this.priority = new GuiTabButton( this.guiLeft + 154, this.guiTop, 2 + 4 * 16, GuiText.Priority.getLocal(), this.itemRender ) );
this.buttonList.add( this.storageFilter ); this.addButton( this.storageFilter );
this.buttonList.add( this.fuzzyMode ); this.addButton( this.fuzzyMode );
this.buttonList.add( this.rwMode ); this.addButton( this.rwMode );
this.buttonList.add( this.partition ); this.addButton( this.partition );
this.buttonList.add( this.clear ); this.addButton( this.clear );
} }
@Override @Override
public void drawFG( final int offsetX, final int offsetY, final int mouseX, final int mouseY ) public void drawFG( final int offsetX, final int offsetY, final int mouseX, final int mouseY )
{ {
this.fontRenderer.drawString( this.getGuiDisplayName( GuiText.StorageBus.getLocal() ), 8, 6, 4210752 ); this.font.drawString( this.getGuiDisplayName( GuiText.StorageBus.getLocal() ), 8, 6, 4210752 );
this.fontRenderer.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 ); this.font.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
if( this.fuzzyMode != null ) if( this.fuzzyMode != null )
{ {
@@ -75,9 +75,9 @@ public class GuiUpgradeable extends AEBaseGui
} }
@Override @Override
public void initGui() public void init()
{ {
super.initGui(); super.init();
this.addButtons(); this.addButtons();
} }
@@ -88,17 +88,17 @@ public class GuiUpgradeable extends AEBaseGui
this.craftMode = new GuiImgButton( this.guiLeft - 18, this.guiTop + 48, Settings.CRAFT_ONLY, YesNo.NO ); this.craftMode = new GuiImgButton( this.guiLeft - 18, this.guiTop + 48, Settings.CRAFT_ONLY, YesNo.NO );
this.schedulingMode = new GuiImgButton( this.guiLeft - 18, this.guiTop + 68, Settings.SCHEDULING_MODE, SchedulingMode.DEFAULT ); this.schedulingMode = new GuiImgButton( this.guiLeft - 18, this.guiTop + 68, Settings.SCHEDULING_MODE, SchedulingMode.DEFAULT );
this.buttonList.add( this.craftMode ); this.addButton( this.craftMode );
this.buttonList.add( this.redstoneMode ); this.addButton( this.redstoneMode );
this.buttonList.add( this.fuzzyMode ); this.addButton( this.fuzzyMode );
this.buttonList.add( this.schedulingMode ); this.addButton( this.schedulingMode );
} }
@Override @Override
public void drawFG( final int offsetX, final int offsetY, final int mouseX, final int mouseY ) public void drawFG( final int offsetX, final int offsetY, final int mouseX, final int mouseY )
{ {
this.fontRenderer.drawString( this.getGuiDisplayName( this.getName().getLocal() ), 8, 6, 4210752 ); this.font.drawString( this.getGuiDisplayName( this.getName().getLocal() ), 8, 6, 4210752 );
this.fontRenderer.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 ); this.font.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
if( this.redstoneMode != null ) if( this.redstoneMode != null )
{ {
@@ -44,19 +44,19 @@ public class GuiVibrationChamber extends AEBaseGui
} }
@Override @Override
public void initGui() public void init()
{ {
super.initGui(); super.init();
this.pb = new GuiProgressBar( this.cvc, "guis/vibchamber.png", 99, 36, 176, 14, 6, 18, Direction.VERTICAL ); this.pb = new GuiProgressBar( this.cvc, "guis/vibchamber.png", 99, 36, 176, 14, 6, 18, Direction.VERTICAL );
this.buttonList.add( this.pb ); this.addButton( this.pb );
} }
@Override @Override
public void drawFG( final int offsetX, final int offsetY, final int mouseX, final int mouseY ) public void drawFG( final int offsetX, final int offsetY, final int mouseX, final int mouseY )
{ {
this.fontRenderer.drawString( this.getGuiDisplayName( GuiText.VibrationChamber.getLocal() ), 8, 6, 4210752 ); this.font.drawString( this.getGuiDisplayName( GuiText.VibrationChamber.getLocal() ), 8, 6, 4210752 );
this.fontRenderer.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 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.cvc.getCurrentProgress() / TileVibrationChamber.DILATION_SCALING + " AE/t" );
@@ -64,7 +64,7 @@ public class GuiVibrationChamber extends AEBaseGui
{ {
final int i1 = this.cvc.getRemainingBurnTime() * 12 / 100; final int i1 = this.cvc.getRemainingBurnTime() * 12 / 100;
this.bindTexture( "guis/vibchamber.png" ); this.bindTexture( "guis/vibchamber.png" );
GlStateManager.color( 1, 1, 1 ); RenderSystem.color4f( 1, 1, 1 );
final int l = -15; final int l = -15;
final int k = 25; final int k = 25;
this.drawTexturedModalRect( k + 56, l + 36 + 12 - i1, 176, 12 - i1, 14, i1 + 2 ); this.drawTexturedModalRect( k + 56, l + 36 + 12 - i1, 176, 12 - i1, 14, i1 + 2 );
@@ -62,19 +62,19 @@ public class GuiWireless extends AEBaseGui
} }
@Override @Override
public void initGui() public void init()
{ {
super.initGui(); super.init();
this.units = new GuiImgButton( this.guiLeft - 18, this.guiTop + 8, Settings.POWER_UNITS, AEConfig.instance().selectedPowerUnit() ); this.units = new GuiImgButton( this.guiLeft - 18, this.guiTop + 8, Settings.POWER_UNITS, AEConfig.instance().selectedPowerUnit() );
this.buttonList.add( this.units ); this.addButton( this.units );
} }
@Override @Override
public void drawFG( final int offsetX, final int offsetY, final int mouseX, final int mouseY ) public void drawFG( final int offsetX, final int offsetY, final int mouseX, final int mouseY )
{ {
this.fontRenderer.drawString( this.getGuiDisplayName( GuiText.Wireless.getLocal() ), 8, 6, 4210752 ); this.font.drawString( this.getGuiDisplayName( GuiText.Wireless.getLocal() ), 8, 6, 4210752 );
this.fontRenderer.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 ); this.font.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
final ContainerWireless cw = (ContainerWireless) this.inventorySlots; final ContainerWireless cw = (ContainerWireless) this.inventorySlots;
@@ -83,10 +83,10 @@ public class GuiWireless extends AEBaseGui
final String firstMessage = GuiText.Range.getLocal() + ": " + ( cw.getRange() / 10.0 ) + " m"; final String firstMessage = GuiText.Range.getLocal() + ": " + ( cw.getRange() / 10.0 ) + " m";
final String secondMessage = GuiText.PowerUsageRate.getLocal() + ": " + Platform.formatPowerLong( cw.getDrain(), true ); final String secondMessage = GuiText.PowerUsageRate.getLocal() + ": " + Platform.formatPowerLong( cw.getDrain(), true );
final int strWidth = Math.max( this.fontRenderer.getStringWidth( firstMessage ), this.fontRenderer.getStringWidth( secondMessage ) ); final int strWidth = Math.max( this.font.getStringWidth( firstMessage ), this.font.getStringWidth( secondMessage ) );
final int cOffset = ( this.xSize / 2 ) - ( strWidth / 2 ); final int cOffset = ( this.xSize / 2 ) - ( strWidth / 2 );
this.fontRenderer.drawString( firstMessage, cOffset, 20, 4210752 ); this.font.drawString( firstMessage, cOffset, 20, 4210752 );
this.fontRenderer.drawString( secondMessage, cOffset, 20 + 12, 4210752 ); this.font.drawString( secondMessage, cOffset, 20 + 12, 4210752 );
} }
} }
@@ -3,12 +3,12 @@ package appeng.client.gui.widgets;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.AbstractGui;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
public abstract class GuiCustomSlot extends Gui implements ITooltip public abstract class GuiCustomSlot extends AbstractGui implements ITooltip
{ {
private final int x; private final int x;
private final int y; private final int y;
@@ -210,11 +210,11 @@ public class GuiImgButton extends Button implements ITooltip
if( this.enabled ) if( this.enabled )
{ {
GlStateManager.color( 1.0f, 1.0f, 1.0f, 1.0f ); RenderSystem.color4f( 1.0f, 1.0f, 1.0f, 1.0f );
} }
else else
{ {
GlStateManager.color( 0.5f, 0.5f, 0.5f, 1.0f ); RenderSystem.color4f( 0.5f, 0.5f, 0.5f, 1.0f );
} }
par1Minecraft.renderEngine.bindTexture( new ResourceLocation( "appliedenergistics2", "textures/guis/states.png" ) ); par1Minecraft.renderEngine.bindTexture( new ResourceLocation( "appliedenergistics2", "textures/guis/states.png" ) );
@@ -233,11 +233,11 @@ public class GuiImgButton extends Button implements ITooltip
{ {
if( this.enabled ) if( this.enabled )
{ {
GlStateManager.color( 1.0f, 1.0f, 1.0f, 1.0f ); RenderSystem.color4f( 1.0f, 1.0f, 1.0f, 1.0f );
} }
else else
{ {
GlStateManager.color( 0.5f, 0.5f, 0.5f, 1.0f ); RenderSystem.color4f( 0.5f, 0.5f, 0.5f, 1.0f );
} }
par1Minecraft.renderEngine.bindTexture( new ResourceLocation( "appliedenergistics2", "textures/guis/states.png" ) ); par1Minecraft.renderEngine.bindTexture( new ResourceLocation( "appliedenergistics2", "textures/guis/states.png" ) );
@@ -251,7 +251,7 @@ public class GuiImgButton extends Button implements ITooltip
this.mouseDragged( par1Minecraft, par2, par3 ); this.mouseDragged( par1Minecraft, par2, par3 );
} }
} }
GlStateManager.color( 1.0f, 1.0f, 1.0f, 1.0f ); RenderSystem.color4f( 1.0f, 1.0f, 1.0f, 1.0f );
} }
private int getIconIndex() private int getIconIndex()
@@ -19,9 +19,10 @@
package appeng.client.gui.widgets; package appeng.client.gui.widgets;
import net.minecraft.client.renderer.GlStateManager; import com.mojang.blaze3d.systems.RenderSystem;
import appeng.client.gui.AEBaseGui; import appeng.client.gui.AEBaseGui;
import net.minecraftforge.fml.client.gui.GuiUtils;
public class GuiScrollbar implements IScrollSource public class GuiScrollbar implements IScrollSource
@@ -40,16 +41,16 @@ public class GuiScrollbar implements IScrollSource
public void draw( final AEBaseGui g ) public void draw( final AEBaseGui g )
{ {
g.bindTexture( "minecraft", "gui/container/creative_inventory/tabs.png" ); g.bindTexture( "minecraft", "gui/container/creative_inventory/tabs.png" );
GlStateManager.color( 1.0f, 1.0f, 1.0f, 1.0f ); RenderSystem.color4f( 1.0f, 1.0f, 1.0f, 1.0f );
if( this.getRange() == 0 ) if( this.getRange() == 0 )
{ {
g.drawTexturedModalRect( this.displayX, this.displayY, 232 + this.width, 0, this.width, 15 ); GuiUtils.drawTexturedModalRect( this.displayX, this.displayY, 232 + this.width, 0, this.width, 15, 0 /* FIXME: this used the GUI's zIndex before */ );
} }
else else
{ {
final int offset = ( this.currentScroll - this.minScroll ) * ( this.height - 15 ) / this.getRange(); final int offset = ( this.currentScroll - this.minScroll ) * ( this.height - 15 ) / this.getRange();
g.drawTexturedModalRect( this.displayX, offset + this.displayY, 232, 0, this.width, 15 ); GuiUtils.drawTexturedModalRect( this.displayX, offset + this.displayY, 232, 0, this.width, 15, 0 /* FIXME: this used the GUI's zIndex before */ );
} }
} }
@@ -127,7 +128,7 @@ public class GuiScrollbar implements IScrollSource
return this.currentScroll; return this.currentScroll;
} }
public void click( final AEBaseGui aeBaseGui, final int x, final int y ) public void click(final double x, final double y)
{ {
if( this.getRange() == 0 ) if( this.getRange() == 0 )
{ {
@@ -138,7 +139,7 @@ public class GuiScrollbar implements IScrollSource
{ {
if( y > this.displayY && y <= this.displayY + this.height ) if( y > this.displayY && y <= this.displayY + this.height )
{ {
this.currentScroll = ( y - this.displayY ); this.currentScroll = (int) ( y - this.displayY );
this.currentScroll = this.minScroll + ( ( this.currentScroll * 2 * this.getRange() / this.height ) ); this.currentScroll = this.minScroll + ( ( this.currentScroll * 2 * this.getRange() / this.height ) );
this.currentScroll = ( this.currentScroll + 1 ) >> 1; this.currentScroll = ( this.currentScroll + 1 ) >> 1;
this.applyRange(); this.applyRange();
@@ -146,7 +147,7 @@ public class GuiScrollbar implements IScrollSource
} }
} }
public void wheel( int delta ) public void wheel( double delta )
{ {
delta = Math.max( Math.min( -delta, 1 ), -1 ); delta = Math.max( Math.min( -delta, 1 ), -1 );
this.currentScroll += delta * this.pageSize; this.currentScroll += delta * this.pageSize;
@@ -75,7 +75,7 @@ public class GuiTabButton extends Button implements ITooltip
{ {
if( this.visible ) if( this.visible )
{ {
GlStateManager.color( 1.0f, 1.0f, 1.0f, 1.0f ); RenderSystem.color4f( 1.0f, 1.0f, 1.0f, 1.0f );
minecraft.renderEngine.bindTexture( new ResourceLocation( "appliedenergistics2", "textures/guis/states.png" ) ); minecraft.renderEngine.bindTexture( new ResourceLocation( "appliedenergistics2", "textures/guis/states.png" ) );
this.hovered = x >= this.x && y >= this.y && x < this.x + this.width && y < this.y + this.height; this.hovered = x >= this.x && y >= this.y && x < this.x + this.width && y < this.y + this.height;
@@ -100,10 +100,10 @@ public class GuiTabButton extends Button implements ITooltip
this.zLevel = 100.0F; this.zLevel = 100.0F;
this.itemRenderer.zLevel = 100.0F; this.itemRenderer.zLevel = 100.0F;
GlStateManager.enableDepth(); RenderSystem.enableDepthTest();
RenderHelper.enableGUIStandardItemLighting(); RenderHelper.enableGUIStandardItemLighting();
this.itemRenderer.renderItemAndEffectIntoGUI( this.myItem, offsetX + this.x + 3, this.y + 3 ); this.itemRenderer.renderItemAndEffectIntoGUI( this.myItem, offsetX + this.x + 3, this.y + 3 );
GlStateManager.disableDepth(); RenderSystem.disableDepthTest();
this.itemRenderer.zLevel = 0.0F; this.itemRenderer.zLevel = 0.0F;
this.zLevel = 0.0F; this.zLevel = 0.0F;
@@ -64,7 +64,7 @@ public class GuiToggleButton extends Button implements ITooltip
{ {
final int iconIndex = this.getIconIndex(); final int iconIndex = this.getIconIndex();
GlStateManager.color( 1.0f, 1.0f, 1.0f, 1.0f ); RenderSystem.color4f( 1.0f, 1.0f, 1.0f, 1.0f );
par1Minecraft.renderEngine.bindTexture( new ResourceLocation( "appliedenergistics2", "textures/guis/states.png" ) ); par1Minecraft.renderEngine.bindTexture( new ResourceLocation( "appliedenergistics2", "textures/guis/states.png" ) );
this.hovered = par2 >= this.x && par3 >= this.y && par2 < this.x + this.width && par3 < this.y + this.height; this.hovered = par2 >= this.x && par3 >= this.y && par2 < this.x + this.width && par3 < this.y + this.height;
@@ -115,12 +115,12 @@ public class MEGuiTextField extends TextFieldWidget
{ {
if( this.isFocused() ) if( this.isFocused() )
{ {
drawRect( this.x - PADDING + 1, this.y - PADDING + 1, this.x + this.width + this._fontPad + PADDING - 1, this.y + this.height + PADDING - 1, fill( this.x - PADDING + 1, this.y - PADDING + 1, this.x + this.width + this._fontPad + PADDING - 1, this.y + this.height + PADDING - 1,
0xFF606060 ); 0xFF606060 );
} }
else else
{ {
drawRect( this.x - PADDING + 1, this.y - PADDING + 1, this.x + this.width + this._fontPad + PADDING - 1, this.y + this.height + PADDING - 1, fill( this.x - PADDING + 1, this.y - PADDING + 1, this.x + this.width + this._fontPad + PADDING - 1, this.y + this.height + PADDING - 1,
0xFFA8A8A8 ); 0xFFA8A8A8 );
} }
super.drawTextBox(); super.drawTextBox();
@@ -172,7 +172,7 @@ public class MEGuiTextField extends TextFieldWidget
float green = ( this.selectionColor & 255 ) / 255.0F; float green = ( this.selectionColor & 255 ) / 255.0F;
float alpha = ( this.selectionColor >> 24 & 255 ) / 255.0F; float alpha = ( this.selectionColor >> 24 & 255 ) / 255.0F;
GlStateManager.color( red, green, blue, alpha ); RenderSystem.color4f( red, green, blue, alpha );
GlStateManager.disableTexture2D(); GlStateManager.disableTexture2D();
GlStateManager.enableColorLogic(); GlStateManager.enableColorLogic();
GlStateManager.colorLogicOp( GlStateManager.LogicOp.OR_REVERSE ); GlStateManager.colorLogicOp( GlStateManager.LogicOp.OR_REVERSE );
@@ -183,7 +183,7 @@ public class MEGuiTextField extends TextFieldWidget
bufferbuilder.pos( startX, startY, 0.0D ).endVertex(); bufferbuilder.pos( startX, startY, 0.0D ).endVertex();
tessellator.draw(); tessellator.draw();
GlStateManager.disableColorLogic(); GlStateManager.disableColorLogic();
GlStateManager.enableTexture2D(); RenderSystem.enableTexture();
} }
} }
+2 -2
View File
@@ -26,6 +26,7 @@ import java.util.regex.Pattern;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import appeng.core.Api;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import appeng.api.AEApi; import appeng.api.AEApi;
@@ -40,7 +41,6 @@ import appeng.api.storage.data.IItemList;
import appeng.client.gui.widgets.IScrollSource; import appeng.client.gui.widgets.IScrollSource;
import appeng.client.gui.widgets.ISortSource; import appeng.client.gui.widgets.ISortSource;
import appeng.core.AEConfig; import appeng.core.AEConfig;
import appeng.integration.Integrations;
import appeng.items.storage.ItemViewCell; import appeng.items.storage.ItemViewCell;
import appeng.util.ItemSorters; import appeng.util.ItemSorters;
import appeng.util.Platform; import appeng.util.Platform;
@@ -232,7 +232,7 @@ public class ItemRepo
private void updateJEI( String filter ) private void updateJEI( String filter )
{ {
Integrations.jei().setSearchText( filter ); // FIXME Integrations.jei().setSearchText( filter );
} }
public int size() public int size()
@@ -24,7 +24,6 @@ import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import appeng.container.slot.AppEngSlot; import appeng.container.slot.AppEngSlot;
import appeng.items.misc.ItemEncodedPattern;
import appeng.util.Platform; import appeng.util.Platform;
@@ -63,15 +62,15 @@ public class SlotDisconnected extends AppEngSlot
if( Platform.isClient() ) if( Platform.isClient() )
{ {
final ItemStack is = super.getStack(); final ItemStack is = super.getStack();
if( !is.isEmpty() && is.getItem() instanceof ItemEncodedPattern ) // FIXME if( !is.isEmpty() && is.getItem() instanceof ItemEncodedPattern )
{ // FIXME {
final ItemEncodedPattern iep = (ItemEncodedPattern) is.getItem(); // FIXME final ItemEncodedPattern iep = (ItemEncodedPattern) is.getItem();
final ItemStack out = iep.getOutput( is ); // FIXME final ItemStack out = iep.getOutput( is );
if( !out.isEmpty() ) // FIXME if( !out.isEmpty() )
{ // FIXME {
return out; // FIXME return out;
} // FIXME }
} // FIXME }
} }
return super.getStack(); return super.getStack();
} }
@@ -35,6 +35,7 @@ import net.minecraft.client.renderer.block.model.ItemOverrideList;
import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.vertex.VertexFormat; import net.minecraft.client.renderer.vertex.VertexFormat;
import net.minecraft.entity.LivingEntity; import net.minecraft.entity.LivingEntity;
import net.minecraft.fluid.Fluids;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
@@ -101,7 +102,7 @@ public class DummyFluidDispatcherBakedModel extends DelegateBakedModel
FluidStack fluidStack = itemFacade.getFluidStack( stack ); FluidStack fluidStack = itemFacade.getFluidStack( stack );
if( fluidStack == null ) if( fluidStack == null )
{ {
fluidStack = new FluidStack( FluidRegistry.WATER, Fluid.BUCKET_VOLUME ); fluidStack = new FluidStack( Fluids.WATER, FluidAttributes.BUCKET_VOLUME );
} }
TextureAtlasSprite sprite = DummyFluidDispatcherBakedModel.this.bakedTextureGetter.apply( fluidStack.getFluid().getStill( fluidStack ) ); TextureAtlasSprite sprite = DummyFluidDispatcherBakedModel.this.bakedTextureGetter.apply( fluidStack.getFluid().getStill( fluidStack ) );
@@ -73,9 +73,9 @@ public class SpatialSkyRender extends IRenderHandler
GlStateManager.disableFog(); GlStateManager.disableFog();
GlStateManager.disableAlpha(); GlStateManager.disableAlpha();
GlStateManager.disableBlend(); RenderSystem.disableBlend();
GlStateManager.depthMask( false ); GlStateManager.depthMask( false );
GlStateManager.color( 0.0f, 0.0f, 0.0f, 1.0f ); RenderSystem.color4f( 0.0f, 0.0f, 0.0f, 1.0f );
final Tessellator tessellator = Tessellator.getInstance(); final Tessellator tessellator = Tessellator.getInstance();
final BufferBuilder VertexBuffer = tessellator.getBuffer(); final BufferBuilder VertexBuffer = tessellator.getBuffer();
@@ -117,7 +117,7 @@ public class SpatialSkyRender extends IRenderHandler
VertexBuffer.pos( 100.0D, -100.0D, 100.0D ).endVertex(); VertexBuffer.pos( 100.0D, -100.0D, 100.0D ).endVertex();
VertexBuffer.pos( 100.0D, -100.0D, -100.0D ).endVertex(); VertexBuffer.pos( 100.0D, -100.0D, -100.0D ).endVertex();
tessellator.draw(); tessellator.draw();
GlStateManager.enableTexture2D(); RenderSystem.enableTexture();
GlStateManager.popMatrix(); GlStateManager.popMatrix();
} }
@@ -127,24 +127,24 @@ public class SpatialSkyRender extends IRenderHandler
{ {
GlStateManager.disableFog(); GlStateManager.disableFog();
GlStateManager.disableAlpha(); GlStateManager.disableAlpha();
GlStateManager.enableBlend(); RenderSystem.enableBlend();
GlStateManager.disableTexture2D(); GlStateManager.disableTexture2D();
GlStateManager.depthMask( false ); GlStateManager.depthMask( false );
OpenGlHelper.glBlendFunc( GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0 ); OpenGlHelper.glBlendFunc( GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0 );
RenderHelper.disableStandardItemLighting(); RenderHelper.disableStandardItemLighting();
GlStateManager.color( fade, fade, fade, 1.0f ); RenderSystem.color4f( fade, fade, fade, 1.0f );
GlStateManager.callList( this.dspList ); GlStateManager.callList( this.dspList );
} }
GlStateManager.depthMask( true ); GlStateManager.depthMask( true );
GlStateManager.enableBlend(); RenderSystem.enableBlend();
GlStateManager.enableAlpha(); GlStateManager.enableAlpha();
GlStateManager.enableTexture2D(); RenderSystem.enableTexture();
GlStateManager.enableFog(); GlStateManager.enableFog();
GlStateManager.color( 1.0f, 1.0f, 1.0f, 1.0f ); RenderSystem.color4f( 1.0f, 1.0f, 1.0f, 1.0f );
} }
private void renderTwinkles() private void renderTwinkles()
@@ -56,36 +56,36 @@ public class StackSizeRenderer
{ {
final String craftLabelText = AEConfig.instance().useTerminalUseLargeFont() ? GuiText.LargeFontCraft.getLocal() : GuiText.SmallFontCraft final String craftLabelText = AEConfig.instance().useTerminalUseLargeFont() ? GuiText.LargeFontCraft.getLocal() : GuiText.SmallFontCraft
.getLocal(); .getLocal();
GlStateManager.disableLighting(); RenderSystem.disableLighting();
GlStateManager.disableDepth(); RenderSystem.disableDepthTest();
GlStateManager.disableBlend(); RenderSystem.disableBlend();
GlStateManager.pushMatrix(); GlStateManager.pushMatrix();
GlStateManager.scale( scaleFactor, scaleFactor, scaleFactor ); GlStateManager.scale( scaleFactor, scaleFactor, scaleFactor );
final int X = (int) ( ( (float) xPos + offset + 16.0f - fontRenderer.getStringWidth( craftLabelText ) * scaleFactor ) * inverseScaleFactor ); final int X = (int) ( ( (float) xPos + offset + 16.0f - fontRenderer.getStringWidth( craftLabelText ) * scaleFactor ) * inverseScaleFactor );
final int Y = (int) ( ( (float) yPos + offset + 16.0f - 7.0f * scaleFactor ) * inverseScaleFactor ); final int Y = (int) ( ( (float) yPos + offset + 16.0f - 7.0f * scaleFactor ) * inverseScaleFactor );
fontRenderer.drawStringWithShadow( craftLabelText, X, Y, 16777215 ); fontRenderer.drawStringWithShadow( craftLabelText, X, Y, 16777215 );
GlStateManager.popMatrix(); GlStateManager.popMatrix();
GlStateManager.enableLighting(); RenderSystem.enableLighting();
GlStateManager.enableDepth(); RenderSystem.enableDepthTest();
GlStateManager.enableBlend(); RenderSystem.enableBlend();
} }
if( aeStack.getStackSize() > 0 ) if( aeStack.getStackSize() > 0 )
{ {
final String stackSize = this.getToBeRenderedStackSize( aeStack.getStackSize() ); final String stackSize = this.getToBeRenderedStackSize( aeStack.getStackSize() );
GlStateManager.disableLighting(); RenderSystem.disableLighting();
GlStateManager.disableDepth(); RenderSystem.disableDepthTest();
GlStateManager.disableBlend(); RenderSystem.disableBlend();
GlStateManager.pushMatrix(); GlStateManager.pushMatrix();
GlStateManager.scale( scaleFactor, scaleFactor, scaleFactor ); GlStateManager.scale( scaleFactor, scaleFactor, scaleFactor );
final int X = (int) ( ( (float) xPos + offset + 16.0f - fontRenderer.getStringWidth( stackSize ) * scaleFactor ) * inverseScaleFactor ); final int X = (int) ( ( (float) xPos + offset + 16.0f - fontRenderer.getStringWidth( stackSize ) * scaleFactor ) * inverseScaleFactor );
final int Y = (int) ( ( (float) yPos + offset + 16.0f - 7.0f * scaleFactor ) * inverseScaleFactor ); final int Y = (int) ( ( (float) yPos + offset + 16.0f - 7.0f * scaleFactor ) * inverseScaleFactor );
fontRenderer.drawStringWithShadow( stackSize, X, Y, 16777215 ); fontRenderer.drawStringWithShadow( stackSize, X, Y, 16777215 );
GlStateManager.popMatrix(); GlStateManager.popMatrix();
GlStateManager.enableLighting(); RenderSystem.enableLighting();
GlStateManager.enableDepth(); RenderSystem.enableDepthTest();
GlStateManager.enableBlend(); RenderSystem.enableBlend();
} }
fontRenderer.setUnicodeFlag( unicodeFlag ); fontRenderer.setUnicodeFlag( unicodeFlag );
@@ -145,7 +145,7 @@ class ItemEncodedPatternBakedModel implements IBakedModel
// Now retroactively handle the isGui3d call, for which we always return false below // Now retroactively handle the isGui3d call, for which we always return false below
if( selectedModel.isGui3d() != ItemEncodedPatternBakedModel.this.baseModel.isGui3d() ) if( selectedModel.isGui3d() != ItemEncodedPatternBakedModel.this.baseModel.isGui3d() )
{ {
GlStateManager.enableLighting(); RenderSystem.enableLighting();
} }
if( selectedModel instanceof IBakedModel ) if( selectedModel instanceof IBakedModel )
@@ -54,8 +54,8 @@ public class CrankTESR extends TileEntityRenderer<TileCrank>
Tessellator tessellator = Tessellator.getInstance(); Tessellator tessellator = Tessellator.getInstance();
this.bindTexture( TextureMap.LOCATION_BLOCKS_TEXTURE ); this.bindTexture( TextureMap.LOCATION_BLOCKS_TEXTURE );
RenderHelper.disableStandardItemLighting(); RenderHelper.disableStandardItemLighting();
GlStateManager.blendFunc( GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA ); RenderSystem.blendFunc( GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA );
GlStateManager.enableBlend(); RenderSystem.enableBlend();
GlStateManager.disableCull(); GlStateManager.disableCull();
if( Minecraft.isAmbientOcclusionEnabled() ) if( Minecraft.isAmbientOcclusionEnabled() )
@@ -50,8 +50,8 @@ public final class InscriberTESR extends TileEntityRenderer<TileInscriber>
FacingToRotation.get( tile.getForward(), tile.getUp() ).glRotateCurrentMat(); FacingToRotation.get( tile.getForward(), tile.getUp() ).glRotateCurrentMat();
GlStateManager.translate( -0.5F, -0.5F, -0.5F ); GlStateManager.translate( -0.5F, -0.5F, -0.5F );
GlStateManager.color( 1.0F, 1.0F, 1.0F, 1.0F ); RenderSystem.color4f( 1.0F, 1.0F, 1.0F, 1.0F );
GlStateManager.disableLighting(); RenderSystem.disableLighting();
GlStateManager.disableRescaleNormal(); GlStateManager.disableRescaleNormal();
// render sides of stamps // render sides of stamps
@@ -128,7 +128,7 @@ public final class InscriberTESR extends TileEntityRenderer<TileInscriber>
Tessellator.getInstance().draw(); Tessellator.getInstance().draw();
// render items. // render items.
GlStateManager.color( 1.0F, 1.0F, 1.0F, 1.0F ); RenderSystem.color4f( 1.0F, 1.0F, 1.0F, 1.0F );
IItemHandler tileInv = tile.getInternalInventory(); IItemHandler tileInv = tile.getInternalInventory();
@@ -169,7 +169,7 @@ public final class InscriberTESR extends TileEntityRenderer<TileInscriber>
} }
GlStateManager.popMatrix(); GlStateManager.popMatrix();
GlStateManager.enableLighting(); RenderSystem.enableLighting();
GlStateManager.enableRescaleNormal(); GlStateManager.enableRescaleNormal();
} }
@@ -960,7 +960,7 @@ public abstract class AEBaseContainer extends Container
break; break;
case CREATIVE_DUPLICATE: case CREATIVE_DUPLICATE:
if( player.capabilities.isCreativeMode && slotItem != null ) if( player.abilities.isCreativeMode && slotItem != null )
{ {
final ItemStack is = slotItem.createItemStack(); final ItemStack is = slotItem.createItemStack();
is.setCount( is.getMaxStackSize() ); is.setCount( is.getMaxStackSize() );
@@ -297,7 +297,7 @@ public final class ContainerInterfaceTerminal extends AEBaseContainer
break; break;
case CREATIVE_DUPLICATE: case CREATIVE_DUPLICATE:
if( player.capabilities.isCreativeMode && !hasItemInHand ) if( player.abilities.isCreativeMode && !hasItemInHand )
{ {
player.inventory.setItemStack( is.isEmpty() ? ItemStack.EMPTY : is.copy() ); player.inventory.setItemStack( is.isEmpty() ? ItemStack.EMPTY : is.copy() );
} }
@@ -36,7 +36,7 @@ import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.item.crafting.IRecipe; import net.minecraft.item.crafting.IRecipe;
import net.minecraft.nbt.NBTBase; import net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.CompoundNBT;
import net.minecraft.nbt.NBTTagList; import net.minecraft.nbt.ListNBT;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.IItemHandler;
import net.minecraftforge.items.wrapper.PlayerInvWrapper; import net.minecraftforge.items.wrapper.PlayerInvWrapper;
@@ -248,8 +248,8 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
// encode the slot. // encode the slot.
final CompoundNBT encodedValue = new CompoundNBT(); final CompoundNBT encodedValue = new CompoundNBT();
final NBTTagList tagIn = new NBTTagList(); final ListNBT tagIn = new ListNBT();
final NBTTagList tagOut = new NBTTagList(); final ListNBT tagOut = new ListNBT();
for( final ItemStack i : in ) for( final ItemStack i : in )
{ {
+4
View File
@@ -28,6 +28,7 @@ import appeng.core.features.AEFeature;
import appeng.server.ServerHelper; import appeng.server.ServerHelper;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.entity.EntityType; import net.minecraft.entity.EntityType;
import net.minecraft.inventory.container.ContainerType;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.particles.ParticleType; import net.minecraft.particles.ParticleType;
import net.minecraft.stats.StatType; import net.minecraft.stats.StatType;
@@ -121,6 +122,9 @@ public final class AppEng
private void clientSetup(FMLClientSetupEvent event) { private void clientSetup(FMLClientSetupEvent event) {
final ApiDefinitions definitions = Api.INSTANCE.definitions(); final ApiDefinitions definitions = Api.INSTANCE.definitions();
definitions.getRegistry().getBootstrapComponents( IClientSetupComponent.class ).forEachRemaining(IClientSetupComponent::setup); definitions.getRegistry().getBootstrapComponents( IClientSetupComponent.class ).forEachRemaining(IClientSetupComponent::setup);
} }
// @Nonnull // @Nonnull
@@ -25,7 +25,6 @@ import appeng.api.definitions.ITileDefinition;
import appeng.block.misc.BlockQuartzFixture; import appeng.block.misc.BlockQuartzFixture;
import appeng.block.spatial.BlockMatrixFrame; import appeng.block.spatial.BlockMatrixFrame;
import appeng.block.storage.BlockSkyChest; import appeng.block.storage.BlockSkyChest;
import appeng.block.storage.SkyChestRenderingCustomizer;
import appeng.bootstrap.*; import appeng.bootstrap.*;
import appeng.bootstrap.definitions.TileEntityDefinition; import appeng.bootstrap.definitions.TileEntityDefinition;
import appeng.client.render.tesr.SkyChestTESR; import appeng.client.render.tesr.SkyChestTESR;
@@ -215,12 +214,10 @@ public final class ApiBlocks implements IBlocks
this.skyStoneChest = registry.block( "sky_stone_chest", () -> new BlockSkyChest( BlockSkyChest.SkyChestType.STONE, skyStoneChestProps ) ) this.skyStoneChest = registry.block( "sky_stone_chest", () -> new BlockSkyChest( BlockSkyChest.SkyChestType.STONE, skyStoneChestProps ) )
.features( AEFeature.SKY_STONE, AEFeature.SKY_STONE_CHESTS ) .features( AEFeature.SKY_STONE, AEFeature.SKY_STONE_CHESTS )
.tileEntity( skyChestTile ) .tileEntity( skyChestTile )
// .rendering( new SkyChestRenderingCustomizer( BlockSkyChest.SkyChestType.STONE ) )
.build(); .build();
this.smoothSkyStoneChest = registry.block( "smooth_sky_stone_chest", () -> new BlockSkyChest( BlockSkyChest.SkyChestType.BLOCK, skyStoneChestProps ) ) this.smoothSkyStoneChest = registry.block( "smooth_sky_stone_chest", () -> new BlockSkyChest( BlockSkyChest.SkyChestType.BLOCK, skyStoneChestProps ) )
.features( AEFeature.SKY_STONE, AEFeature.SKY_STONE_CHESTS ) .features( AEFeature.SKY_STONE, AEFeature.SKY_STONE_CHESTS )
.tileEntity( skyChestTile ) .tileEntity( skyChestTile )
// .rendering( new SkyChestRenderingCustomizer( BlockSkyChest.SkyChestType.BLOCK ) )
.build(); .build();
// this.skyCompass = registry.block( "sky_compass", BlockSkyCompass::new ) // this.skyCompass = registry.block( "sky_compass", BlockSkyCompass::new )
@@ -27,8 +27,6 @@ import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.fml.common.network.IGuiHandler;
import net.minecraftforge.fml.relauncher.ReflectionHelper;
import appeng.api.AEApi; import appeng.api.AEApi;
import appeng.api.config.SecurityPermissions; import appeng.api.config.SecurityPermissions;
@@ -125,7 +123,7 @@ import appeng.tile.storage.TileSkyChest;
import appeng.util.Platform; import appeng.util.Platform;
public enum GuiBridge implements IGuiHandler public enum GuiBridge
{ {
GUI_Handler(), GUI_Handler(),
@@ -33,7 +33,7 @@ import net.minecraft.inventory.Container;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompressedStreamTools; import net.minecraft.nbt.CompressedStreamTools;
import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.CompoundNBT;
import net.minecraft.nbt.NBTTagList; import net.minecraft.nbt.ListNBT;
import net.minecraft.network.PacketBuffer; import net.minecraft.network.PacketBuffer;
import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.IItemHandler;
@@ -73,7 +73,7 @@ public class PacketJEIRecipe extends AppEngPacket
this.recipe = new ItemStack[9][]; this.recipe = new ItemStack[9][];
for( int x = 0; x < this.recipe.length; x++ ) for( int x = 0; x < this.recipe.length; x++ )
{ {
final NBTTagList list = comp.getTagList( "#" + x, 10 ); final ListNBT list = comp.getTagList( "#" + x, 10 );
if( list.tagCount() > 0 ) if( list.tagCount() > 0 )
{ {
this.recipe[x] = new ItemStack[list.tagCount()]; this.recipe[x] = new ItemStack[list.tagCount()];
@@ -25,13 +25,11 @@ import java.util.UUID;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import com.electronwill.nightconfig.core.file.CommentedFileConfig;
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
import com.mojang.authlib.GameProfile; import com.mojang.authlib.GameProfile;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraftforge.common.config.ConfigCategory;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.common.config.Property;
import appeng.core.AppEng; import appeng.core.AppEng;
@@ -51,38 +49,37 @@ final class PlayerData implements IWorldPlayerData, IOnWorldStartable, IOnWorldS
private static final String LAST_PLAYER_KEY = "lastPlayer"; private static final String LAST_PLAYER_KEY = "lastPlayer";
private static final int LAST_PLAYER_DEFAULT = 0; private static final int LAST_PLAYER_DEFAULT = 0;
private final Configuration config; private final CommentedFileConfig config;
private final IWorldPlayerMapping playerMapping; // FIXME private final IWorldPlayerMapping playerMapping;
private int lastPlayerID; private int lastPlayerID;
public PlayerData( @Nonnull final Configuration configFile ) public PlayerData( @Nonnull final CommentedFileConfig configFile )
{ {
Preconditions.checkNotNull( configFile ); Preconditions.checkNotNull( configFile );
this.config = configFile; this.config = configFile;
final ConfigCategory playerList = this.config.getCategory( "players" ); // FIXME this.playerMapping = new PlayerMapping( config, "players." );
this.playerMapping = new PlayerMapping( playerList );
} }
@Nullable @Nullable
@Override @Override
public PlayerEntity getPlayerFromID( final int playerID ) public PlayerEntity getPlayerFromID( final int playerID )
{ {
final Optional<UUID> maybe = this.playerMapping.get( playerID ); // FIXME final Optional<UUID> maybe = this.playerMapping.get( playerID );
// FIXME
if( maybe.isPresent() ) // FIXME if( maybe.isPresent() )
{ // FIXME {
final UUID uuid = maybe.get(); // FIXME final UUID uuid = maybe.get();
for( final PlayerEntity player : AppEng.proxy.getPlayers() ) // FIXME for( final PlayerEntity player : AppEng.proxy.getPlayers() )
{ // FIXME {
if( player.getUniqueID().equals( uuid ) ) // FIXME if( player.getUniqueID().equals( uuid ) )
{ // FIXME {
return player; // FIXME return player;
} // FIXME }
} // FIXME }
} // FIXME }
return null; return null;
} }
@@ -90,42 +87,44 @@ final class PlayerData implements IWorldPlayerData, IOnWorldStartable, IOnWorldS
@Override @Override
public int getPlayerID( @Nonnull final GameProfile profile ) public int getPlayerID( @Nonnull final GameProfile profile )
{ {
Preconditions.checkNotNull( profile ); return -1;
Preconditions.checkNotNull( this.config.getCategory( "players" ) ); // FIXME Preconditions.checkNotNull( profile );
Preconditions.checkState( profile.isComplete() ); // FIXME Preconditions.checkNotNull( this.config.getCategory( "players" ) );
// FIXME Preconditions.checkState( profile.isComplete() );
final ConfigCategory players = this.config.getCategory( "players" ); // FIXME
final String uuid = profile.getId().toString(); // FIXME final ConfigCategory players = this.config.getCategory( "players" );
final Property maybePlayerID = players.get( uuid ); // FIXME final String uuid = profile.getId().toString();
// FIXME final Property maybePlayerID = players.get( uuid );
if( maybePlayerID != null && maybePlayerID.isIntValue() ) // FIXME
{ // FIXME if( maybePlayerID != null && maybePlayerID.isIntValue() )
return maybePlayerID.getInt(); // FIXME {
} // FIXME return maybePlayerID.getInt();
else // FIXME }
{ // FIXME else
final int newPlayerID = this.nextPlayer(); // FIXME {
final Property newPlayer = new Property( uuid, String.valueOf( newPlayerID ), Property.Type.INTEGER ); // FIXME final int newPlayerID = this.nextPlayer();
players.put( uuid, newPlayer ); // FIXME final Property newPlayer = new Property( uuid, String.valueOf( newPlayerID ), Property.Type.INTEGER );
this.playerMapping.put( newPlayerID, profile.getId() ); // add to reverse map // FIXME players.put( uuid, newPlayer );
this.config.save(); // FIXME this.playerMapping.put( newPlayerID, profile.getId() ); // add to reverse map
// FIXME this.config.save();
return newPlayerID; // FIXME
} // FIXME return newPlayerID;
// FIXME }
} }
private int nextPlayer() private int nextPlayer()
{ {
final int r = this.lastPlayerID; // FIXME final int r = this.lastPlayerID;
this.lastPlayerID++; // FIXME this.lastPlayerID++;
this.config.get( LAST_PLAYER_CATEGORY, LAST_PLAYER_KEY, this.lastPlayerID ).set( this.lastPlayerID ); // FIXME this.config.get( LAST_PLAYER_CATEGORY, LAST_PLAYER_KEY, this.lastPlayerID ).set( this.lastPlayerID );
return r; // FIXME return r;
return 0;
} }
@Override @Override
public void onWorldStart() public void onWorldStart()
{ {
this.lastPlayerID = this.config.get( LAST_PLAYER_CATEGORY, LAST_PLAYER_KEY, LAST_PLAYER_DEFAULT ).getInt( LAST_PLAYER_DEFAULT ); // FIXME this.lastPlayerID = this.config.get( LAST_PLAYER_CATEGORY, LAST_PLAYER_KEY, LAST_PLAYER_DEFAULT ).getInt( LAST_PLAYER_DEFAULT );
this.config.save(); this.config.save();
} }
@@ -25,10 +25,9 @@ import java.util.UUID;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import com.electronwill.nightconfig.core.Config;
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
import net.minecraftforge.common.config.ConfigCategory;
/** /**
* Wrapper class for the player mappings. * Wrapper class for the player mappings.
@@ -44,9 +43,9 @@ final class PlayerMapping implements IWorldPlayerMapping
*/ */
private final Map<Integer, UUID> mappings; private final Map<Integer, UUID> mappings;
public PlayerMapping( final ConfigCategory category ) public PlayerMapping( final Config config, String path )
{ {
final PlayerMappingsInitializer init = new PlayerMappingsInitializer( category ); final PlayerMappingsInitializer init = new PlayerMappingsInitializer( config, path );
this.mappings = init.getPlayerMappings(); this.mappings = init.getPlayerMappings();
} }
@@ -23,11 +23,9 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.UUID; import java.util.UUID;
import net.minecraftforge.common.config.ConfigCategory; import com.electronwill.nightconfig.core.Config;
import net.minecraftforge.common.config.Property;
import appeng.core.AELog; import appeng.core.AELog;
import appeng.util.UUIDMatcher;
/** /**
@@ -38,7 +36,7 @@ class PlayerMappingsInitializer
/** /**
* Internal immutable mapping * Internal immutable mapping
*/ */
private final Map<Integer, UUID> playerMappings; // FIXME private final Map<Integer, UUID> playerMappings;
/** /**
* Creates the initializer for the player mappings. * Creates the initializer for the player mappings.
@@ -50,35 +48,35 @@ class PlayerMappingsInitializer
* *
* @param playerList the category for the player list, generally extracted using the "players" tag * @param playerList the category for the player list, generally extracted using the "players" tag
*/ */
PlayerMappingsInitializer( final ConfigCategory playerList ) PlayerMappingsInitializer(final Config config, String prefix )
{ {
// Matcher for UUIDs // FIXME // Matcher for UUIDs
final UUIDMatcher matcher = new UUIDMatcher(); // FIXME final UUIDMatcher matcher = new UUIDMatcher();
// FIXME
// Initial capacity for mappings // FIXME // Initial capacity for mappings
final int capacity = playerList.size(); // FIXME final int capacity = playerList.size();
// FIXME
// Mappings for the IDs is a regular HashMap // FIXME // Mappings for the IDs is a regular HashMap
this.playerMappings = new HashMap<>( capacity ); // FIXME this.playerMappings = new HashMap<>( capacity );
// FIXME
// Iterates through every pair of UUID to ID // FIXME // Iterates through every pair of UUID to ID
for( final Map.Entry<String, Property> entry : playerList.getValues().entrySet() ) // FIXME for( final Map.Entry<String, Property> entry : playerList.getValues().entrySet() )
{ // FIXME {
final String maybeUUID = entry.getKey(); // FIXME final String maybeUUID = entry.getKey();
final int id = entry.getValue().getInt(); // FIXME final int id = entry.getValue().getInt();
// FIXME
if( matcher.isUUID( maybeUUID ) ) // FIXME if( matcher.isUUID( maybeUUID ) )
{ // FIXME {
final UUID uuidString = UUID.fromString( maybeUUID ); // FIXME final UUID uuidString = UUID.fromString( maybeUUID );
// FIXME
this.playerMappings.put( id, uuidString ); // FIXME this.playerMappings.put( id, uuidString );
} // FIXME }
else // FIXME else
{ // FIXME {
AELog.warn( // FIXME AELog.warn(
"The configuration for players contained an outdated entry instead an expected UUID " + maybeUUID + " for the player " + id + ". Please clean this up." ); // FIXME "The configuration for players contained an outdated entry instead an expected UUID " + maybeUUID + " for the player " + id + ". Please clean this up." );
} // FIXME }
} // FIXME }
} }
/** /**
@@ -23,7 +23,7 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.CompoundNBT;
import net.minecraft.nbt.NBTTagList; import net.minecraft.nbt.ListNBT;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
@@ -33,6 +33,10 @@ import net.minecraftforge.common.util.INBTSerializable;
import appeng.api.storage.ISpatialDimension; import appeng.api.storage.ISpatialDimension;
import appeng.capabilities.Capabilities; import appeng.capabilities.Capabilities;
import net.minecraftforge.common.util.LazyOptional;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
public class SpatialDimensionManager implements ISpatialDimension, ICapabilitySerializable<CompoundNBT> public class SpatialDimensionManager implements ISpatialDimension, ICapabilitySerializable<CompoundNBT>
@@ -118,35 +122,36 @@ public class SpatialDimensionManager implements ISpatialDimension, ICapabilitySe
return null; return null;
} }
@SuppressWarnings("unchecked")
@Nonnull
@Override @Override
public boolean hasCapability( Capability<?> capability, Direction facing ) public <T> LazyOptional<T> getCapability(@Nonnull Capability<T> cap) {
{ if( cap == Capabilities.SPATIAL_DIMENSION )
return capability == Capabilities.SPATIAL_DIMENSION; {
return LazyOptional.of(() -> (T) this);
}
return LazyOptional.empty();
} }
@Nonnull
@Override @Override
public <T> T getCapability( Capability<T> capability, Direction facing ) public <T> LazyOptional<T> getCapability(@Nonnull Capability<T> cap, @Nullable Direction side) {
{ return getCapability(cap);
if( capability == Capabilities.SPATIAL_DIMENSION )
{
return (T) this;
}
return null;
} }
@Override @Override
public CompoundNBT serializeNBT() public CompoundNBT serializeNBT()
{ {
final CompoundNBT ret = new CompoundNBT(); final CompoundNBT ret = new CompoundNBT();
final NBTTagList list = new NBTTagList(); final ListNBT list = new ListNBT();
for( Map.Entry<Integer, StorageCellData> entry : this.spatialData.entrySet() ) for( Map.Entry<Integer, StorageCellData> entry : this.spatialData.entrySet() )
{ {
final CompoundNBT nbt = entry.getValue().serializeNBT(); final CompoundNBT nbt = entry.getValue().serializeNBT();
nbt.setInteger( NBT_SPATIAL_ID_KEY, entry.getKey() ); nbt.putInt( NBT_SPATIAL_ID_KEY, entry.getKey() );
list.appendTag( nbt ); list.add( nbt );
} }
ret.setTag( NBT_SPATIAL_DATA_KEY, list ); ret.put( NBT_SPATIAL_DATA_KEY, list );
return ret; return ret;
} }
@@ -155,14 +160,14 @@ public class SpatialDimensionManager implements ISpatialDimension, ICapabilitySe
{ {
if( nbt.contains(NBT_SPATIAL_DATA_KEY) ) if( nbt.contains(NBT_SPATIAL_DATA_KEY) )
{ {
final NBTTagList list = (NBTTagList) nbt.getTag( NBT_SPATIAL_DATA_KEY ); final ListNBT list = (ListNBT) nbt.get( NBT_SPATIAL_DATA_KEY );
this.spatialData.clear(); this.spatialData.clear();
for( int i = 0; i < list.tagCount(); ++i ) for( int i = 0; i < list.size(); ++i )
{ {
final CompoundNBT entry = list.getCompoundTagAt( i ); final CompoundNBT entry = list.getCompound( i );
final StorageCellData data = new StorageCellData(); final StorageCellData data = new StorageCellData();
final int id = entry.getInteger( NBT_SPATIAL_ID_KEY ); final int id = entry.getInt( NBT_SPATIAL_ID_KEY );
data.deserializeNBT( entry ); data.deserializeNBT( entry );
this.spatialData.put( id, data ); this.spatialData.put( id, data );
} }
@@ -228,18 +233,18 @@ public class SpatialDimensionManager implements ISpatialDimension, ICapabilitySe
public CompoundNBT serializeNBT() public CompoundNBT serializeNBT()
{ {
CompoundNBT nbt = new CompoundNBT(); CompoundNBT nbt = new CompoundNBT();
nbt.setInteger( NBT_DIM_X_KEY, this.contentDimension.getX() ); nbt.putInt( NBT_DIM_X_KEY, this.contentDimension.getX() );
nbt.setInteger( NBT_DIM_Y_KEY, this.contentDimension.getY() ); nbt.putInt( NBT_DIM_Y_KEY, this.contentDimension.getY() );
nbt.setInteger( NBT_DIM_Z_KEY, this.contentDimension.getZ() ); nbt.putInt( NBT_DIM_Z_KEY, this.contentDimension.getZ() );
nbt.setInteger( NBT_OWNER_KEY, this.owner ); nbt.putInt( NBT_OWNER_KEY, this.owner );
return nbt; return nbt;
} }
@Override @Override
public void deserializeNBT( CompoundNBT nbt ) public void deserializeNBT( CompoundNBT nbt )
{ {
this.contentDimension = new BlockPos( nbt.getInteger( NBT_DIM_X_KEY ), nbt.getInteger( NBT_DIM_Y_KEY ), nbt.getInteger( NBT_DIM_Z_KEY ) ); this.contentDimension = new BlockPos( nbt.getInt( NBT_DIM_X_KEY ), nbt.getInt( NBT_DIM_Y_KEY ), nbt.getInt( NBT_DIM_Z_KEY ) );
this.owner = nbt.getInteger( NBT_OWNER_KEY ); this.owner = nbt.getInt( NBT_OWNER_KEY );
} }
} }
} }
@@ -34,6 +34,7 @@ import net.minecraft.nbt.CompoundNBT;
import net.minecraft.nbt.CompressedStreamTools; import net.minecraft.nbt.CompressedStreamTools;
import appeng.core.AELog; import appeng.core.AELog;
import net.minecraft.world.dimension.Dimension;
/** /**
@@ -57,25 +58,29 @@ final class SpawnData implements IWorldSpawnData
} }
@Override @Override
public void setGenerated( final Dimension dim, final int chunkX, final int chunkZ ) public void setGenerated(final Dimension dim, final int chunkX, final int chunkZ )
{ {
int dimId = dim.getType().getId(); // FIXME This is most likely borked, see new string ids
synchronized( SpawnData.class ) synchronized( SpawnData.class )
{ {
final CompoundNBT data = this.loadSpawnData( dim, chunkX, chunkZ ); final CompoundNBT data = this.loadSpawnData( dimId, chunkX, chunkZ );
// edit. // edit.
data.putBoolean(chunkX + "," + chunkZ, true); data.putBoolean(chunkX + "," + chunkZ, true);
this.writeSpawnData( dim, chunkX, chunkZ, data ); this.writeSpawnData( dimId, chunkX, chunkZ, data );
} }
} }
@Override @Override
public boolean hasGenerated( final Dimension dim, final int chunkX, final int chunkZ ) public boolean hasGenerated( final Dimension dim, final int chunkX, final int chunkZ )
{ {
int dimId = dim.getType().getId(); // FIXME This is most likely borked, see new string ids
synchronized( SpawnData.class ) synchronized( SpawnData.class )
{ {
final CompoundNBT data = this.loadSpawnData( dim, chunkX, chunkZ ); final CompoundNBT data = this.loadSpawnData( dimId, chunkX, chunkZ );
return data.getBoolean( chunkX + "," + chunkZ ); return data.getBoolean( chunkX + "," + chunkZ );
} }
} }
@@ -83,23 +88,25 @@ final class SpawnData implements IWorldSpawnData
@Override @Override
public boolean addNearByMeteorites( final Dimension dim, final int chunkX, final int chunkZ, final CompoundNBT newData ) public boolean addNearByMeteorites( final Dimension dim, final int chunkX, final int chunkZ, final CompoundNBT newData )
{ {
int dimId = dim.getType().getId(); // FIXME This is most likely borked, see new string ids
synchronized( SpawnData.class ) synchronized( SpawnData.class )
{ {
final CompoundNBT data = this.loadSpawnData( dim, chunkX, chunkZ ); final CompoundNBT data = this.loadSpawnData( dimId, chunkX, chunkZ );
// edit. // edit.
final int size = data.getInteger( "num" ); final int size = data.getInt( "num" );
data.setTag( String.valueOf( size ), newData ); data.put( String.valueOf( size ), newData );
data.setInteger( "num", size + 1 ); data.putInt( "num", size + 1 );
this.writeSpawnData( dim, chunkX, chunkZ, data ); this.writeSpawnData( dimId, chunkX, chunkZ, data );
return true; return true;
} }
} }
@Override @Override
public Collection<CompoundNBT> getNearByMeteorites( final int Dimension, final int chunkX, final int chunkZ ) public Collection<CompoundNBT> getNearByMeteorites( final Dimension dim, final int chunkX, final int chunkZ )
{ {
final Collection<CompoundNBT> ll = new ArrayList<>(); final Collection<CompoundNBT> ll = new ArrayList<>();
@@ -112,15 +119,16 @@ final class SpawnData implements IWorldSpawnData
final int cx = x + ( chunkX >> 4 ); final int cx = x + ( chunkX >> 4 );
final int cz = z + ( chunkZ >> 4 ); final int cz = z + ( chunkZ >> 4 );
final CompoundNBT data = this.loadSpawnData( dim, cx << 4, cz << 4 ); // FIXME Using the numerical dimension id here is fishy
final CompoundNBT data = this.loadSpawnData( dim.getType().getId(), cx << 4, cz << 4 );
if( data != null ) if( data != null )
{ {
// edit. // edit.
final int size = data.getInteger( "num" ); final int size = data.getInt( "num" );
for( int s = 0; s < size; s++ ) for( int s = 0; s < size; s++ )
{ {
ll.add( data.getCompoundTag( String.valueOf( s ) ) ); ll.add( data.getCompound( String.valueOf( s ) ) );
} }
} }
} }
@@ -26,11 +26,10 @@ import java.util.WeakHashMap;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import com.electronwill.nightconfig.core.CommentedConfig;
import com.electronwill.nightconfig.core.file.CommentedFileConfig;
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.common.config.Property;
import appeng.core.AELog; import appeng.core.AELog;
import appeng.me.GridStorage; import appeng.me.GridStorage;
import appeng.me.GridStorageSearch; import appeng.me.GridStorageSearch;
@@ -50,11 +49,11 @@ final class StorageData implements IWorldGridStorageData, IOnWorldStartable, IOn
private static final String GRID_STORAGE_CATEGORY = "gridstorage"; private static final String GRID_STORAGE_CATEGORY = "gridstorage";
private final Map<GridStorageSearch, WeakReference<GridStorageSearch>> loadedStorage = new WeakHashMap<>( 10 ); private final Map<GridStorageSearch, WeakReference<GridStorageSearch>> loadedStorage = new WeakHashMap<>( 10 );
private final Configuration config; private final CommentedFileConfig config;
private long lastGridStorage; private long lastGridStorage;
public StorageData( @Nonnull final Configuration settingsFile ) public StorageData( @Nonnull final CommentedFileConfig settingsFile )
{ {
Preconditions.checkNotNull( settingsFile ); Preconditions.checkNotNull( settingsFile );
@@ -72,20 +71,21 @@ final class StorageData implements IWorldGridStorageData, IOnWorldStartable, IOn
@Override @Override
public GridStorage getGridStorage( final long storageID ) public GridStorage getGridStorage( final long storageID )
{ {
final GridStorageSearch gss = new GridStorageSearch( storageID ); return null;
final WeakReference<GridStorageSearch> result = this.loadedStorage.get( gss ); // FIXME final GridStorageSearch gss = new GridStorageSearch( storageID );
// FIXME final WeakReference<GridStorageSearch> result = this.loadedStorage.get( gss );
if( result == null || result.get() == null ) // FIXME
{ // FIXME if( result == null || result.get() == null )
final String id = String.valueOf( storageID ); // FIXME {
final String data = this.config.get( "gridstorage", id, "" ).getString(); // FIXME final String id = String.valueOf( storageID );
final GridStorage thisStorage = new GridStorage( data, storageID, gss ); // FIXME final String data = this.config.get( "gridstorage", id, "" ).getString();
gss.setGridStorage( new WeakReference<>( thisStorage ) ); // FIXME final GridStorage thisStorage = new GridStorage( data, storageID, gss );
this.loadedStorage.put( gss, new WeakReference<>( gss ) ); // FIXME gss.setGridStorage( new WeakReference<>( thisStorage ) );
return thisStorage; // FIXME this.loadedStorage.put( gss, new WeakReference<>( gss ) );
} // FIXME return thisStorage;
// FIXME }
return result.get().getGridStorage().get(); // FIXME
// FIXME return result.get().getGridStorage().get();
} }
/** /**
@@ -107,59 +107,61 @@ final class StorageData implements IWorldGridStorageData, IOnWorldStartable, IOn
@Override @Override
public long nextGridStorage() public long nextGridStorage()
{ {
final long r = this.lastGridStorage; // FIXME final long r = this.lastGridStorage;
this.lastGridStorage++; // FIXME this.lastGridStorage++;
this.config.get( "Counters", "lastGridStorage", this.lastGridStorage ).set( Long.toString( this.lastGridStorage ) ); // FIXME this.config.get( "Counters", "lastGridStorage", this.lastGridStorage ).set( Long.toString( this.lastGridStorage ) );
return r; // FIXME return r;
return 0;
} }
@Override @Override
public void destroyGridStorage( final long id ) public void destroyGridStorage( final long id )
{ {
final String stringID = String.valueOf( id ); // FIXME final String stringID = String.valueOf( id );
this.config.getCategory( "gridstorage" ).remove( stringID ); // FIXME this.config.getCategory( "gridstorage" ).remove( stringID );
} }
@Override @Override
public int getNextOrderedValue( final String name ) public int getNextOrderedValue( final String name )
{ {
final Property p = this.config.get( "orderedValues", name, 0 ); // FIXME final Property p = this.config.get( "orderedValues", name, 0 );
final int myValue = p.getInt(); // FIXME final int myValue = p.getInt();
p.set( myValue + 1 ); // FIXME p.set( myValue + 1 );
return myValue; // FIXME return myValue;
return 0;
} }
@Override @Override
public void onWorldStart() public void onWorldStart()
{ {
final String lastString = this.config.get( LAST_GRID_STORAGE_CATEGORY, LAST_GRID_STORAGE_KEY, LAST_GRID_STORAGE_DEFAULT ).getString(); // FIXME final String lastString = this.config.get( LAST_GRID_STORAGE_CATEGORY, LAST_GRID_STORAGE_KEY, LAST_GRID_STORAGE_DEFAULT ).getString();
// FIXME
try // FIXME try
{ // FIXME {
this.lastGridStorage = Long.parseLong( lastString ); // FIXME this.lastGridStorage = Long.parseLong( lastString );
} // FIXME }
catch( final NumberFormatException err ) // FIXME catch( final NumberFormatException err )
{ // FIXME {
AELog.warn( "The config contained a value which was not represented as a Long: %s", lastString ); // FIXME AELog.warn( "The config contained a value which was not represented as a Long: %s", lastString );
// FIXME
this.lastGridStorage = 0; // FIXME this.lastGridStorage = 0;
} // FIXME }
} }
@Override @Override
public void onWorldStop() public void onWorldStop()
{ {
// populate new data // FIXME // populate new data
for( final GridStorageSearch gs : this.loadedStorage.keySet() ) // FIXME for( final GridStorageSearch gs : this.loadedStorage.keySet() )
{ // FIXME {
final GridStorage thisStorage = gs.getGridStorage().get(); // FIXME final GridStorage thisStorage = gs.getGridStorage().get();
if( thisStorage != null && thisStorage.getGrid() != null && !thisStorage.getGrid().isEmpty() ) // FIXME if( thisStorage != null && thisStorage.getGrid() != null && !thisStorage.getGrid().isEmpty() )
{ // FIXME {
final String value = thisStorage.getValue(); // FIXME final String value = thisStorage.getValue();
this.config.get( GRID_STORAGE_CATEGORY, String.valueOf( thisStorage.getID() ), value ).set( value ); // FIXME this.config.get( GRID_STORAGE_CATEGORY, String.valueOf( thisStorage.getID() ), value ).set( value );
} // FIXME }
} // FIXME }
// FIXME
this.config.save(); // FIXME this.config.save();
} }
} }
@@ -19,6 +19,7 @@
package appeng.core.worlddata; package appeng.core.worlddata;
import java.io.ByteArrayInputStream;
import java.io.File; import java.io.File;
import java.util.List; import java.util.List;
import java.util.concurrent.ThreadFactory; import java.util.concurrent.ThreadFactory;
@@ -26,12 +27,17 @@ import java.util.concurrent.ThreadFactory;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import com.electronwill.nightconfig.core.file.CommentedFileConfig;
import com.electronwill.nightconfig.toml.TomlFormat;
import com.electronwill.nightconfig.toml.TomlParser;
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import net.minecraft.server.MinecraftServer; import net.minecraft.server.MinecraftServer;
import net.minecraft.world.dimension.Dimension;
import net.minecraft.world.dimension.DimensionType;
import net.minecraft.world.server.ServerWorld;
import net.minecraftforge.common.DimensionManager; import net.minecraftforge.common.DimensionManager;
import net.minecraftforge.common.config.Configuration;
import appeng.core.AEConfig; import appeng.core.AEConfig;
import appeng.services.CompassService; import appeng.services.CompassService;
@@ -71,7 +77,7 @@ public final class WorldData implements IWorldData
private final File spawnDirectory; private final File spawnDirectory;
private final File compassDirectory; private final File compassDirectory;
// FIXME private final Configuration sharedConfig; private final CommentedFileConfig sharedConfig;
private WorldData( @Nonnull final File worldDirectory ) private WorldData( @Nonnull final File worldDirectory )
{ {
@@ -83,7 +89,8 @@ public final class WorldData implements IWorldData
this.compassDirectory = new File( this.ae2directory, COMPASS_DIR_NAME ); this.compassDirectory = new File( this.ae2directory, COMPASS_DIR_NAME );
final File settingsFile = new File( this.ae2directory, SETTING_FILE_NAME ); final File settingsFile = new File( this.ae2directory, SETTING_FILE_NAME );
this.sharedConfig = new Configuration( settingsFile, AEConfig.VERSION ); this.sharedConfig = CommentedFileConfig.of( settingsFile, TomlFormat.instance() );
this.sharedConfig.load();
final PlayerData playerData = new PlayerData( this.sharedConfig ); final PlayerData playerData = new PlayerData( this.sharedConfig );
final StorageData storageData = new StorageData( this.sharedConfig ); final StorageData storageData = new StorageData( this.sharedConfig );
@@ -124,10 +131,15 @@ public final class WorldData implements IWorldData
*/ */
public static void onServerAboutToStart( MinecraftServer server ) public static void onServerAboutToStart( MinecraftServer server )
{ {
File worldDirectory = DimensionManager.getCurrentSaveRootDirectory(); // FIXME: Possibly replace this with WorldData
File worldDirectory = null;
ServerWorld overworld = DimensionManager.getWorld(server, DimensionType.OVERWORLD, false, false);
if (overworld != null) {
worldDirectory = overworld.getSaveHandler().getWorldDirectory();
}
if( worldDirectory == null ) if( worldDirectory == null )
{ {
worldDirectory = server.getActiveAnvilConverter().getSaveLoader( server.getFolderName(), false ).getWorldDirectory(); worldDirectory = server.getActiveAnvilConverter().getSaveLoader( server.getFolderName(), server ).getWorldDirectory();
} }
final WorldData newInstance = new WorldData( worldDirectory ); final WorldData newInstance = new WorldData( worldDirectory );
@@ -33,9 +33,9 @@ public class GuiFluidFormationPlane extends GuiUpgradeable
} }
@Override @Override
public void initGui() public void init()
{ {
super.initGui(); super.init();
final int xo = 8; final int xo = 8;
final int yo = 23 + 6; final int yo = 23 + 6;
@@ -63,7 +63,7 @@ public class GuiFluidFormationPlane extends GuiUpgradeable
@Override @Override
protected void addButtons() protected void addButtons()
{ {
this.buttonList.add( this.priority = new GuiTabButton( this.guiLeft + 154, this.guiTop, 2 + 4 * 16, GuiText.Priority.getLocal(), this.itemRender ) ); this.addButton( this.priority = new GuiTabButton( this.guiLeft + 154, this.guiTop, 2 + 4 * 16, GuiText.Priority.getLocal(), this.itemRender ) );
} }
@Override @Override
@@ -47,9 +47,9 @@ public class GuiFluidIO extends GuiUpgradeable
} }
@Override @Override
public void initGui() public void init()
{ {
super.initGui(); super.init();
final ContainerFluidIO container = (ContainerFluidIO) this.inventorySlots; final ContainerFluidIO container = (ContainerFluidIO) this.inventorySlots;
final IAEFluidTank inv = this.bus.getConfig(); final IAEFluidTank inv = this.bus.getConfig();
@@ -53,9 +53,9 @@ public class GuiFluidInterface extends GuiUpgradeable
} }
@Override @Override
public void initGui() public void init()
{ {
super.initGui(); super.init();
final IAEFluidTank configFluids = this.host.getDualityFluidInterface().getConfig(); final IAEFluidTank configFluids = this.host.getDualityFluidInterface().getConfig();
final IAEFluidTank fluidTank = this.host.getDualityFluidInterface().getTanks(); final IAEFluidTank fluidTank = this.host.getDualityFluidInterface().getTanks();
@@ -64,12 +64,12 @@ public class GuiFluidInterface extends GuiUpgradeable
{ {
final GuiFluidTank guiTank = new GuiFluidTank( fluidTank, i, DualityFluidInterface.NUMBER_OF_TANKS + i, this.getGuiLeft() + 35 + 18 * i, this final GuiFluidTank guiTank = new GuiFluidTank( fluidTank, i, DualityFluidInterface.NUMBER_OF_TANKS + i, this.getGuiLeft() + 35 + 18 * i, this
.getGuiTop() + 53, 16, 68 ); .getGuiTop() + 53, 16, 68 );
this.buttonList.add( guiTank ); this.addButton( guiTank );
this.guiSlots.add( new GuiFluidSlot( configFluids, i, i, 35 + 18 * i, 35 ) ); this.guiSlots.add( new GuiFluidSlot( configFluids, i, i, 35 + 18 * i, 35 ) );
} }
this.priority = new GuiTabButton( this.getGuiLeft() + 154, this.getGuiTop(), 2 + 4 * 16, GuiText.Priority.getLocal(), this.itemRender ); this.priority = new GuiTabButton( this.getGuiLeft() + 154, this.getGuiTop(), 2 + 4 * 16, GuiText.Priority.getLocal(), this.itemRender );
this.buttonList.add( this.priority ); this.addButton( this.priority );
} }
@Override @Override
@@ -80,10 +80,10 @@ public class GuiFluidInterface extends GuiUpgradeable
@Override @Override
public void drawFG( int offsetX, int offsetY, int mouseX, int mouseY ) public void drawFG( int offsetX, int offsetY, int mouseX, int mouseY )
{ {
this.fontRenderer.drawString( this.getGuiDisplayName( GuiText.FluidInterface.getLocal() ), 8, 6, 4210752 ); this.font.drawString( this.getGuiDisplayName( GuiText.FluidInterface.getLocal() ), 8, 6, 4210752 );
this.fontRenderer.drawString( GuiText.Config.getLocal(), 35, 6 + 11 + 7, 4210752 ); this.font.drawString( GuiText.Config.getLocal(), 35, 6 + 11 + 7, 4210752 );
this.fontRenderer.drawString( GuiText.StoredFluids.getLocal(), 35, 6 + 112 + 7, 4210752 ); this.font.drawString( GuiText.StoredFluids.getLocal(), 35, 6 + 112 + 7, 4210752 );
this.fontRenderer.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 ); this.font.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
} }
@Override @Override
@@ -43,11 +43,11 @@ public class GuiFluidLevelEmitter extends GuiUpgradeable
} }
@Override @Override
public void initGui() public void init()
{ {
super.initGui(); super.init();
this.level = new GuiNumberBox( this.fontRenderer, this.guiLeft + 24, this.guiTop + 43, 79, this.fontRenderer.FONT_HEIGHT, Long.class ); this.level = new GuiNumberBox( this.font, this.guiLeft + 24, this.guiTop + 43, 79, this.font.FONT_HEIGHT, Long.class );
this.level.setEnableBackgroundDrawing( false ); this.level.setEnableBackgroundDrawing( false );
this.level.setMaxStringLength( 16 ); this.level.setMaxStringLength( 16 );
this.level.setTextColor( 0xFFFFFF ); this.level.setTextColor( 0xFFFFFF );
@@ -70,17 +70,17 @@ public class GuiFluidLevelEmitter extends GuiUpgradeable
final int c = AEConfig.instance().levelByMillyBuckets( 2 ); final int c = AEConfig.instance().levelByMillyBuckets( 2 );
final int d = AEConfig.instance().levelByMillyBuckets( 3 ); final int d = AEConfig.instance().levelByMillyBuckets( 3 );
this.buttonList.add( this.plus1 = new GuiButton( 0, this.guiLeft + 20, this.guiTop + 17, 22, 20, "+" + a ) ); this.addButton( this.plus1 = new GuiButton( 0, this.guiLeft + 20, this.guiTop + 17, 22, 20, "+" + a ) );
this.buttonList.add( this.plus10 = new GuiButton( 0, this.guiLeft + 48, this.guiTop + 17, 28, 20, "+" + b ) ); this.addButton( this.plus10 = new GuiButton( 0, this.guiLeft + 48, this.guiTop + 17, 28, 20, "+" + b ) );
this.buttonList.add( this.plus100 = new GuiButton( 0, this.guiLeft + 82, this.guiTop + 17, 32, 20, "+" + c ) ); this.addButton( this.plus100 = new GuiButton( 0, this.guiLeft + 82, this.guiTop + 17, 32, 20, "+" + c ) );
this.buttonList.add( this.plus1000 = new GuiButton( 0, this.guiLeft + 120, this.guiTop + 17, 38, 20, "+" + d ) ); this.addButton( this.plus1000 = new GuiButton( 0, this.guiLeft + 120, this.guiTop + 17, 38, 20, "+" + d ) );
this.buttonList.add( this.minus1 = new GuiButton( 0, this.guiLeft + 20, this.guiTop + 59, 22, 20, "-" + a ) ); this.addButton( this.minus1 = new GuiButton( 0, this.guiLeft + 20, this.guiTop + 59, 22, 20, "-" + a ) );
this.buttonList.add( this.minus10 = new GuiButton( 0, this.guiLeft + 48, this.guiTop + 59, 28, 20, "-" + b ) ); this.addButton( this.minus10 = new GuiButton( 0, this.guiLeft + 48, this.guiTop + 59, 28, 20, "-" + b ) );
this.buttonList.add( this.minus100 = new GuiButton( 0, this.guiLeft + 82, this.guiTop + 59, 32, 20, "-" + c ) ); this.addButton( this.minus100 = new GuiButton( 0, this.guiLeft + 82, this.guiTop + 59, 32, 20, "-" + c ) );
this.buttonList.add( this.minus1000 = new GuiButton( 0, this.guiLeft + 120, this.guiTop + 59, 38, 20, "-" + d ) ); this.addButton( this.minus1000 = new GuiButton( 0, this.guiLeft + 120, this.guiTop + 59, 38, 20, "-" + d ) );
this.buttonList.add( this.redstoneMode ); this.addButton( this.redstoneMode );
} }
@Override @Override
@@ -70,9 +70,9 @@ public class GuiFluidStorageBus extends GuiUpgradeable
} }
@Override @Override
public void initGui() public void init()
{ {
super.initGui(); super.init();
final int xo = 8; final int xo = 8;
final int yo = 23 + 6; final int yo = 23 + 6;
@@ -106,20 +106,20 @@ public class GuiFluidStorageBus extends GuiUpgradeable
this.storageFilter = new GuiImgButton( this.guiLeft - 18, this.guiTop + 68, Settings.STORAGE_FILTER, StorageFilter.EXTRACTABLE_ONLY ); this.storageFilter = new GuiImgButton( this.guiLeft - 18, this.guiTop + 68, Settings.STORAGE_FILTER, StorageFilter.EXTRACTABLE_ONLY );
this.fuzzyMode = new GuiImgButton( this.guiLeft - 18, this.guiTop + 88, Settings.FUZZY_MODE, FuzzyMode.IGNORE_ALL ); this.fuzzyMode = new GuiImgButton( this.guiLeft - 18, this.guiTop + 88, Settings.FUZZY_MODE, FuzzyMode.IGNORE_ALL );
this.buttonList.add( this.priority = new GuiTabButton( this.guiLeft + 154, this.guiTop, 2 + 4 * 16, GuiText.Priority.getLocal(), this.itemRender ) ); this.addButton( this.priority = new GuiTabButton( this.guiLeft + 154, this.guiTop, 2 + 4 * 16, GuiText.Priority.getLocal(), this.itemRender ) );
this.buttonList.add( this.storageFilter ); this.addButton( this.storageFilter );
this.buttonList.add( this.fuzzyMode ); this.addButton( this.fuzzyMode );
this.buttonList.add( this.rwMode ); this.addButton( this.rwMode );
this.buttonList.add( this.partition ); this.addButton( this.partition );
this.buttonList.add( this.clear ); this.addButton( this.clear );
} }
@Override @Override
public void drawFG( final int offsetX, final int offsetY, final int mouseX, final int mouseY ) public void drawFG( final int offsetX, final int offsetY, final int mouseX, final int mouseY )
{ {
this.fontRenderer.drawString( this.getGuiDisplayName( this.getName().getLocal() ), 8, 6, 4210752 ); this.font.drawString( this.getGuiDisplayName( this.getName().getLocal() ), 8, 6, 4210752 );
this.fontRenderer.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 ); this.font.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
if( this.fuzzyMode != null ) if( this.fuzzyMode != null )
{ {
@@ -100,13 +100,13 @@ public class GuiFluidTerminal extends AEBaseMEGui implements ISortSource, IConfi
} }
@Override @Override
public void initGui() public void init()
{ {
this.mc.player.openContainer = this.inventorySlots; this.minecraft.player.openContainer = this.inventorySlots;
this.guiLeft = ( this.width - this.xSize ) / 2; this.guiLeft = ( this.width - this.xSize ) / 2;
this.guiTop = ( this.height - this.ySize ) / 2; this.guiTop = ( this.height - this.ySize ) / 2;
this.searchField = new MEGuiTextField( this.fontRenderer, this.guiLeft + Math.max( 80, this.offsetX ), this.guiTop + 4, 90, 12 ); this.searchField = new MEGuiTextField( this.font, this.guiLeft + Math.max( 80, this.offsetX ), this.guiTop + 4, 90, 12 );
this.searchField.setEnableBackgroundDrawing( false ); this.searchField.setEnableBackgroundDrawing( false );
this.searchField.setMaxStringLength( 25 ); this.searchField.setMaxStringLength( 25 );
this.searchField.setTextColor( 0xFFFFFF ); this.searchField.setTextColor( 0xFFFFFF );
@@ -115,10 +115,10 @@ public class GuiFluidTerminal extends AEBaseMEGui implements ISortSource, IConfi
int offset = this.guiTop; int offset = this.guiTop;
this.buttonList.add( this.sortByBox = new GuiImgButton( this.guiLeft - 18, offset, Settings.SORT_BY, this.configSrc.getSetting( Settings.SORT_BY ) ) ); this.addButton( this.sortByBox = new GuiImgButton( this.guiLeft - 18, offset, Settings.SORT_BY, this.configSrc.getSetting( Settings.SORT_BY ) ) );
offset += 20; offset += 20;
this.buttonList.add( this.sortDirBox = new GuiImgButton( this.guiLeft - 18, offset, Settings.SORT_DIRECTION, this.configSrc this.addButton( this.sortDirBox = new GuiImgButton( this.guiLeft - 18, offset, Settings.SORT_DIRECTION, this.configSrc
.getSetting( Settings.SORT_DIRECTION ) ) ); .getSetting( Settings.SORT_DIRECTION ) ) );
for( int y = 0; y < this.rows; y++ ) for( int y = 0; y < this.rows; y++ )
@@ -136,8 +136,8 @@ public class GuiFluidTerminal extends AEBaseMEGui implements ISortSource, IConfi
@Override @Override
public void drawFG( int offsetX, int offsetY, int mouseX, int mouseY ) public void drawFG( int offsetX, int offsetY, int mouseX, int mouseY )
{ {
this.fontRenderer.drawString( this.getGuiDisplayName( "Fluid Terminal" ), 8, 6, 4210752 ); this.font.drawString( this.getGuiDisplayName( "Fluid Terminal" ), 8, 6, 4210752 );
this.fontRenderer.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 ); this.font.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
} }
@Override @Override
@@ -41,8 +41,8 @@ public class GuiFluidSlot extends GuiCustomSlot
final IAEFluidStack fs = this.getFluidStack(); final IAEFluidStack fs = this.getFluidStack();
if( fs != null ) if( fs != null )
{ {
GlStateManager.disableLighting(); RenderSystem.disableLighting();
GlStateManager.disableBlend(); RenderSystem.disableBlend();
final Fluid fluid = fs.getFluid(); final Fluid fluid = fs.getFluid();
mc.getTextureManager().bindTexture( TextureMap.LOCATION_BLOCKS_TEXTURE ); mc.getTextureManager().bindTexture( TextureMap.LOCATION_BLOCKS_TEXTURE );
final TextureAtlasSprite sprite = mc.getTextureMapBlocks().getAtlasSprite( fluid.getStill().toString() ); final TextureAtlasSprite sprite = mc.getTextureMapBlocks().getAtlasSprite( fluid.getStill().toString() );
@@ -52,7 +52,7 @@ public class GuiFluidSlot extends GuiCustomSlot
final float red = ( fluid.getColor() >> 16 & 255 ) / 255.0F; final float red = ( fluid.getColor() >> 16 & 255 ) / 255.0F;
final float green = ( fluid.getColor() >> 8 & 255 ) / 255.0F; final float green = ( fluid.getColor() >> 8 & 255 ) / 255.0F;
final float blue = ( fluid.getColor() & 255 ) / 255.0F; final float blue = ( fluid.getColor() & 255 ) / 255.0F;
GlStateManager.color( red, green, blue ); RenderSystem.color4f( red, green, blue );
this.drawTexturedModalRect( this.xPos(), this.yPos(), sprite, this.getWidth(), this.getHeight() ); this.drawTexturedModalRect( this.xPos(), this.yPos(), sprite, this.getWidth(), this.getHeight() );
} }
@@ -51,10 +51,10 @@ public class GuiFluidTank extends GuiButton implements ITooltip
{ {
if( this.visible ) if( this.visible )
{ {
GlStateManager.disableBlend(); RenderSystem.disableBlend();
GlStateManager.disableLighting(); RenderSystem.disableLighting();
drawRect( this.x, this.y, this.x + this.width, this.y + this.height, AEColor.GRAY.blackVariant | 0xFF000000 ); fill( this.x, this.y, this.x + this.width, this.y + this.height, AEColor.GRAY.blackVariant | 0xFF000000 );
final IAEFluidStack fluid = this.tank.getFluidInSlot( this.slot ); final IAEFluidStack fluid = this.tank.getFluidInSlot( this.slot );
if( fluid != null && fluid.getStackSize() > 0 ) if( fluid != null && fluid.getStackSize() > 0 )
@@ -64,7 +64,7 @@ public class GuiFluidTank extends GuiButton implements ITooltip
float red = ( fluid.getFluid().getColor() >> 16 & 255 ) / 255.0F; float red = ( fluid.getFluid().getColor() >> 16 & 255 ) / 255.0F;
float green = ( fluid.getFluid().getColor() >> 8 & 255 ) / 255.0F; float green = ( fluid.getFluid().getColor() >> 8 & 255 ) / 255.0F;
float blue = ( fluid.getFluid().getColor() & 255 ) / 255.0F; float blue = ( fluid.getFluid().getColor() & 255 ) / 255.0F;
GlStateManager.color( red, green, blue ); RenderSystem.color4f( red, green, blue );
TextureAtlasSprite sprite = mc.getTextureMapBlocks().getAtlasSprite( fluid.getFluid().getStill().toString() ); TextureAtlasSprite sprite = mc.getTextureMapBlocks().getAtlasSprite( fluid.getFluid().getStill().toString() );
final int scaledHeight = (int) ( this.height * ( (float) fluid.getStackSize() / this.tank.getTankProperties()[this.slot].getCapacity() ) ); final int scaledHeight = (int) ( this.height * ( (float) fluid.getStackSize() / this.tank.getTankProperties()[this.slot].getCapacity() ) );
@@ -48,14 +48,14 @@ public class GuiOptionalFluidSlot extends GuiFluidSlot
@Override @Override
public void drawBackground( int guileft, int guitop ) public void drawBackground( int guileft, int guitop )
{ {
GlStateManager.enableBlend(); RenderSystem.enableBlend();
if( this.isSlotEnabled() ) if( this.isSlotEnabled() )
{ {
GlStateManager.color( 1.0F, 1.0F, 1.0F, 1.0F ); RenderSystem.color4f( 1.0F, 1.0F, 1.0F, 1.0F );
} }
else else
{ {
GlStateManager.color( 1.0F, 1.0F, 1.0F, 0.4F ); RenderSystem.color4f( 1.0F, 1.0F, 1.0F, 0.4F );
} }
this.drawTexturedModalRect( guileft + this.xPos() - 1, guitop + this.yPos() - 1, this.srcX - 1, this.srcY - 1, this.getWidth() + 2, this.drawTexturedModalRect( guileft + this.xPos() - 1, guitop + this.yPos() - 1, this.srcX - 1, this.srcY - 1, this.getWidth() + 2,
this.getHeight() + 2 ); this.getHeight() + 2 );
@@ -63,18 +63,18 @@ public class FluidStackSizeRenderer
{ {
final String stackSize = this.getToBeRenderedStackSize( aeStack.getStackSize() ); final String stackSize = this.getToBeRenderedStackSize( aeStack.getStackSize() );
GlStateManager.disableLighting(); RenderSystem.disableLighting();
GlStateManager.disableDepth(); RenderSystem.disableDepthTest();
GlStateManager.disableBlend(); RenderSystem.disableBlend();
GlStateManager.pushMatrix(); GlStateManager.pushMatrix();
GlStateManager.scale( scaleFactor, scaleFactor, scaleFactor ); GlStateManager.scale( scaleFactor, scaleFactor, scaleFactor );
final int X = (int) ( ( (float) xPos + offset + 16.0f - fontRenderer.getStringWidth( stackSize ) * scaleFactor ) * inverseScaleFactor ); final int X = (int) ( ( (float) xPos + offset + 16.0f - fontRenderer.getStringWidth( stackSize ) * scaleFactor ) * inverseScaleFactor );
final int Y = (int) ( ( (float) yPos + offset + 16.0f - 7.0f * scaleFactor ) * inverseScaleFactor ); final int Y = (int) ( ( (float) yPos + offset + 16.0f - 7.0f * scaleFactor ) * inverseScaleFactor );
fontRenderer.drawStringWithShadow( stackSize, X, Y, 16777215 ); fontRenderer.drawStringWithShadow( stackSize, X, Y, 16777215 );
GlStateManager.popMatrix(); GlStateManager.popMatrix();
GlStateManager.enableLighting(); RenderSystem.enableLighting();
GlStateManager.enableDepth(); RenderSystem.enableDepthTest();
GlStateManager.enableBlend(); RenderSystem.enableBlend();
} }
fontRenderer.setUnicodeFlag( unicodeFlag ); fontRenderer.setUnicodeFlag( unicodeFlag );
@@ -75,7 +75,7 @@ import appeng.util.Platform;
public class DualityFluidInterface implements IGridTickable, IStorageMonitorable, IAEFluidInventory, IUpgradeableHost, IConfigManagerHost public class DualityFluidInterface implements IGridTickable, IStorageMonitorable, IAEFluidInventory, IUpgradeableHost, IConfigManagerHost
{ {
public static final int NUMBER_OF_TANKS = 6; public static final int NUMBER_OF_TANKS = 6;
public static final int TANK_CAPACITY = Fluid.BUCKET_VOLUME * 4; public static final int TANK_CAPACITY = FluidAttributes.BUCKET_VOLUME * 4;
private final ConfigManager cm = new ConfigManager( this ); private final ConfigManager cm = new ConfigManager( this );
private final AENetworkProxy gridProxy; private final AENetworkProxy gridProxy;
@@ -57,7 +57,7 @@ public class FluidCellConfig extends CellConfig
return stack; return stack;
} }
fluid.amount = Fluid.BUCKET_VOLUME; fluid.amount = FluidAttributes.BUCKET_VOLUME;
ItemStack is = Api.INSTANCE.definitions().items().dummyFluidItem().maybeStack( 1 ).get(); ItemStack is = Api.INSTANCE.definitions().items().dummyFluidItem().maybeStack( 1 ).get();
FluidDummyItem item = (FluidDummyItem) is.getItem(); FluidDummyItem item = (FluidDummyItem) is.getItem();
item.setFluidStack( is, fluid ); item.setFluidStack( is, fluid );
@@ -77,7 +77,7 @@ public class FluidCellConfig extends CellConfig
return; return;
} }
fluid.amount = Fluid.BUCKET_VOLUME; fluid.amount = FluidAttributes.BUCKET_VOLUME;
ItemStack is = Api.INSTANCE.definitions().items().dummyFluidItem().maybeStack( 1 ).get(); ItemStack is = Api.INSTANCE.definitions().items().dummyFluidItem().maybeStack( 1 ).get();
FluidDummyItem item = (FluidDummyItem) is.getItem(); FluidDummyItem item = (FluidDummyItem) is.getItem();
item.setFluidStack( is, fluid ); item.setFluidStack( is, fluid );
@@ -96,7 +96,7 @@ public class FluidCellConfig extends CellConfig
{ {
return false; return false;
} }
fluid.amount = Fluid.BUCKET_VOLUME; fluid.amount = FluidAttributes.BUCKET_VOLUME;
ItemStack is = Api.INSTANCE.definitions().items().dummyFluidItem().maybeStack( 1 ).get(); ItemStack is = Api.INSTANCE.definitions().items().dummyFluidItem().maybeStack( 1 ).get();
FluidDummyItem item = (FluidDummyItem) is.getItem(); FluidDummyItem item = (FluidDummyItem) is.getItem();
item.setFluidStack( is, fluid ); item.setFluidStack( is, fluid );
@@ -19,12 +19,12 @@
package appeng.fluids.items; package appeng.fluids.items;
import net.minecraft.creativetab.CreativeTabs; import net.minecraft.fluid.Fluids;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.NonNullList; import net.minecraft.util.NonNullList;
import net.minecraft.fluid.Fluid; import net.minecraftforge.fluids.FluidAttributes;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidStack;
import appeng.items.AEBaseItem; import appeng.items.AEBaseItem;
@@ -39,16 +39,19 @@ import appeng.items.AEBaseItem;
*/ */
public class FluidDummyItem extends AEBaseItem public class FluidDummyItem extends AEBaseItem
{ {
@Override
public String getItemStackDisplayName( ItemStack stack )
{
public FluidDummyItem(Properties properties) {
super(properties);
}
@Override
public String getTranslationKey(ItemStack stack) {
FluidStack fluidStack = this.getFluidStack( stack ); FluidStack fluidStack = this.getFluidStack( stack );
if( fluidStack == null ) if( fluidStack == null )
{ {
fluidStack = new FluidStack( FluidRegistry.WATER, Fluid.BUCKET_VOLUME ); fluidStack = new FluidStack( Fluids.WATER, FluidAttributes.BUCKET_VOLUME );
} }
return fluidStack.getLocalizedName(); return fluidStack.getTranslationKey();
} }
public FluidStack getFluidStack( ItemStack is ) public FluidStack getFluidStack( ItemStack is )
@@ -65,19 +68,18 @@ public class FluidDummyItem extends AEBaseItem
{ {
if( fs == null ) if( fs == null )
{ {
is.setTagCompound( null ); is.setTag( null );
} }
else else
{ {
CompoundNBT tag = new CompoundNBT(); CompoundNBT tag = new CompoundNBT();
fs.writeToNBT( tag ); fs.writeToNBT( tag );
is.setTagCompound( tag ); is.setTag( tag );
} }
} }
@Override @Override
protected void getCheckedSubItems( final CreativeTabs creativeTab, final NonNullList<ItemStack> itemStacks ) public void fillItemGroup(ItemGroup group, NonNullList<ItemStack> items) {
{
// Don't show this item in CreativeTabs // Don't show this item in CreativeTabs
} }
} }
@@ -107,7 +107,7 @@ public class PartFluidFormationPlane extends PartAbstractFormationPlane<IAEFluid
@Override @Override
public IAEFluidStack injectItems( IAEFluidStack input, Actionable type, IActionSource src ) public IAEFluidStack injectItems( IAEFluidStack input, Actionable type, IActionSource src )
{ {
if( this.blocked || input == null || input.getStackSize() < Fluid.BUCKET_VOLUME ) if( this.blocked || input == null || input.getStackSize() < FluidAttributes.BUCKET_VOLUME )
{ {
// need a full bucket // need a full bucket
return input; return input;
@@ -124,16 +124,16 @@ public class PartFluidFormationPlane extends PartAbstractFormationPlane<IAEFluid
if( type == Actionable.MODULATE ) if( type == Actionable.MODULATE )
{ {
final FluidStack fs = input.getFluidStack(); final FluidStack fs = input.getFluidStack();
fs.amount = Fluid.BUCKET_VOLUME; fs.amount = FluidAttributes.BUCKET_VOLUME;
final FluidTank tank = new FluidTank( fs, Fluid.BUCKET_VOLUME ); final FluidTank tank = new FluidTank( fs, FluidAttributes.BUCKET_VOLUME );
if( !FluidUtil.tryPlaceFluid( null, w, pos, tank, fs ) ) if( !FluidUtil.tryPlaceFluid( null, w, pos, tank, fs ) )
{ {
return input; return input;
} }
} }
final IAEFluidStack ret = input.copy(); final IAEFluidStack ret = input.copy();
ret.setStackSize( input.getStackSize() - Fluid.BUCKET_VOLUME ); ret.setStackSize( input.getStackSize() - FluidAttributes.BUCKET_VOLUME );
return ret.getStackSize() == 0 ? null : ret; return ret.getStackSize() == 0 ? null : ret;
} }
this.blocked = true; this.blocked = true;
@@ -6,25 +6,25 @@ import java.util.Objects;
import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.CompoundNBT;
import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.capability.IFluidTankProperties;
import appeng.api.storage.data.IAEFluidStack; import appeng.api.storage.data.IAEFluidStack;
import appeng.core.AELog; import appeng.core.AELog;
import appeng.util.Platform; import appeng.util.Platform;
import javax.annotation.Nonnull;
public class AEFluidInventory implements IAEFluidTank public class AEFluidInventory implements IAEFluidTank
{ {
private final IAEFluidStack[] fluids; private final IAEFluidStack[] fluids;
private final IAEFluidInventory handler; private final IAEFluidInventory handler;
private final int capacity; private final int capacity;
private IFluidTankProperties[] props = null;
public AEFluidInventory( final IAEFluidInventory handler, final int slots, final int capcity ) public AEFluidInventory( final IAEFluidInventory handler, final int slots, final int capacity )
{ {
this.fluids = new IAEFluidStack[slots]; this.fluids = new IAEFluidStack[slots];
this.handler = handler; this.handler = handler;
this.capacity = capcity; this.capacity = capacity;
} }
public AEFluidInventory( final IAEFluidInventory handler, final int slots ) public AEFluidInventory( final IAEFluidInventory handler, final int slots )
@@ -87,34 +87,47 @@ public class AEFluidInventory implements IAEFluidTank
} }
@Override @Override
public IFluidTankProperties[] getTankProperties() public int getTanks() {
{ return this.fluids.length;
if( this.props == null )
{
this.props = new IFluidTankProperties[this.getSlots()];
for( int i = 0; i < this.getSlots(); ++i )
{
this.props[i] = new FluidTankPropertiesWrapper( i );
}
}
return this.props;
} }
public int fill( final int slot, final FluidStack resource, final boolean doFill ) @Nonnull
{ @Override
if( resource == null || resource.amount <= 0 ) public FluidStack getFluidInTank(int tank) {
if (tank < 0 || tank >= fluids.length) {
return FluidStack.EMPTY;
}
return fluids[tank] == null ? FluidStack.EMPTY : fluids[tank].getFluidStack();
}
@Override
public int getTankCapacity(int tank) {
return Math.min( this.capacity, Integer.MAX_VALUE );
}
@Override
public boolean isFluidValid(int tank, @Nonnull FluidStack stack) {
return stack != FluidStack.EMPTY;
}
@Override
public int fill(FluidStack resource, FluidAction action) {
if( resource == null || resource == FluidStack.EMPTY || resource.getAmount() <= 0 )
{ {
return 0; return 0;
} }
// Find a suitable slot
int slot = indexOfFluid(resource);
if (slot == -1) {
slot = indexOfEmptySlot();
if (slot == -1) {
return 0;
}
}
final IAEFluidStack fluid = this.fluids[slot]; final IAEFluidStack fluid = this.fluids[slot];
if( fluid != null && !fluid.equals( resource ) )
{
return 0;
}
int amountToStore = this.capacity; int amountToStore = this.capacity;
if( fluid != null ) if( fluid != null )
@@ -122,9 +135,9 @@ public class AEFluidInventory implements IAEFluidTank
amountToStore -= fluid.getStackSize(); amountToStore -= fluid.getStackSize();
} }
amountToStore = Math.min( amountToStore, resource.amount ); amountToStore = Math.min( amountToStore, resource.getAmount() );
if( doFill ) if( action == FluidAction.EXECUTE )
{ {
if( fluid == null ) if( fluid == null )
{ {
@@ -140,6 +153,100 @@ public class AEFluidInventory implements IAEFluidTank
return amountToStore; return amountToStore;
} }
@Override
public FluidStack drain( final FluidStack fluid, final FluidAction action )
{
if( fluid == null || fluid.getAmount() <= 0 )
{
return null;
}
final FluidStack resource = fluid.copy();
FluidStack totalDrained = null;
for( int slot = 0; slot < this.getSlots(); ++slot )
{
FluidStack drain = this.drain( slot, resource, action == FluidAction.EXECUTE );
if( drain != null )
{
if( totalDrained == null )
{
totalDrained = drain;
}
else
{
totalDrained.setAmount(totalDrained.getAmount() + drain.getAmount());
}
resource.setAmount(resource.getAmount() - drain.getAmount());
if( resource.getAmount() <= 0 )
{
break;
}
}
}
return totalDrained;
}
@Override
public FluidStack drain( final int maxDrain, final FluidAction action )
{
if( maxDrain == 0 )
{
return null;
}
FluidStack totalDrained = null;
int toDrain = maxDrain;
for( int slot = 0; slot < this.getSlots(); ++slot )
{
if( totalDrained == null )
{
totalDrained = this.drain( slot, toDrain, action == FluidAction.EXECUTE );
if( totalDrained != null )
{
toDrain -= totalDrained.getAmount();
}
}
else
{
FluidStack copy = totalDrained.copy();
copy.setAmount(toDrain);
FluidStack drain = this.drain( slot, copy, action == FluidAction.EXECUTE );
if( drain != null )
{
totalDrained.setAmount(totalDrained.getAmount() + drain.getAmount());
toDrain -= drain.getAmount();
}
}
if( toDrain <= 0 )
{
break;
}
}
return totalDrained;
}
private int indexOfFluid(FluidStack resource) {
for (int slot = 0; slot < fluids.length; slot++) {
if (fluids[slot] != null && fluids[slot].getFluidStack().isFluidEqual(resource)) {
return slot;
}
}
return -1;
}
private int indexOfEmptySlot() {
for (int slot = 0; slot < fluids.length; slot++) {
if (fluids[slot] == null) {
return slot;
}
}
return -1;
}
public FluidStack drain( final int slot, final FluidStack resource, final boolean doDrain ) public FluidStack drain( final int slot, final FluidStack resource, final boolean doDrain )
{ {
final IAEFluidStack fluid = this.fluids[slot]; final IAEFluidStack fluid = this.fluids[slot];
@@ -147,7 +254,7 @@ public class AEFluidInventory implements IAEFluidTank
{ {
return null; return null;
} }
return this.drain( slot, resource.amount, doDrain ); return this.drain( slot, resource.getAmount(), doDrain );
} }
public FluidStack drain( final int slot, final int maxDrain, boolean doDrain ) public FluidStack drain( final int slot, final int maxDrain, boolean doDrain )
@@ -177,111 +284,11 @@ public class AEFluidInventory implements IAEFluidTank
return stack; return stack;
} }
@Override
public int fill( final FluidStack fluid, final boolean doFill )
{
if( fluid == null || fluid.amount <= 0 )
{
return 0;
}
final FluidStack insert = fluid.copy();
int totalFillAmount = 0;
for( int slot = 0; slot < this.getSlots(); ++slot )
{
int fillAmount = this.fill( slot, insert, doFill );
totalFillAmount += fillAmount;
insert.amount -= fillAmount;
if( insert.amount <= 0 )
{
break;
}
}
return totalFillAmount;
}
@Override
public FluidStack drain( final FluidStack fluid, final boolean doDrain )
{
if( fluid == null || fluid.amount <= 0 )
{
return null;
}
final FluidStack resource = fluid.copy();
FluidStack totalDrained = null;
for( int slot = 0; slot < this.getSlots(); ++slot )
{
FluidStack drain = this.drain( slot, resource, doDrain );
if( drain != null )
{
if( totalDrained == null )
{
totalDrained = drain;
}
else
{
totalDrained.amount += drain.amount;
}
resource.amount -= drain.amount;
if( resource.amount <= 0 )
{
break;
}
}
}
return totalDrained;
}
@Override
public FluidStack drain( final int maxDrain, final boolean doDrain )
{
if( maxDrain == 0 )
{
return null;
}
FluidStack totalDrained = null;
int toDrain = maxDrain;
for( int slot = 0; slot < this.getSlots(); ++slot )
{
if( totalDrained == null )
{
totalDrained = this.drain( slot, toDrain, doDrain );
if( totalDrained != null )
{
toDrain -= totalDrained.amount;
}
}
else
{
FluidStack copy = totalDrained.copy();
copy.amount = toDrain;
FluidStack drain = this.drain( slot, copy, doDrain );
if( drain != null )
{
totalDrained.amount += drain.amount;
toDrain -= drain.amount;
}
}
if( toDrain <= 0 )
{
break;
}
}
return totalDrained;
}
public void writeToNBT( final CompoundNBT data, final String name ) public void writeToNBT( final CompoundNBT data, final String name )
{ {
final CompoundNBT c = new CompoundNBT(); final CompoundNBT c = new CompoundNBT();
this.writeToNBT( c ); this.writeToNBT( c );
data.setTag( name, c ); data.put( name, c );
} }
private void writeToNBT( final CompoundNBT target ) private void writeToNBT( final CompoundNBT target )
@@ -297,7 +304,7 @@ public class AEFluidInventory implements IAEFluidTank
this.fluids[x].writeToNBT( c ); this.fluids[x].writeToNBT( c );
} }
target.setTag( "#" + x, c ); target.put( "#" + x, c );
} }
catch( final Exception ignored ) catch( final Exception ignored )
{ {
@@ -307,8 +314,8 @@ public class AEFluidInventory implements IAEFluidTank
public void readFromNBT( final CompoundNBT data, final String name ) public void readFromNBT( final CompoundNBT data, final String name )
{ {
final CompoundNBT c = data.getCompoundTag( name ); final CompoundNBT c = data.getCompound( name );
if( c != null ) if( !c.isEmpty() )
{ {
this.readFromNBT( c ); this.readFromNBT( c );
} }
@@ -320,9 +327,9 @@ public class AEFluidInventory implements IAEFluidTank
{ {
try try
{ {
final CompoundNBT c = target.getCompoundTag( "#" + x ); final CompoundNBT c = target.getCompound( "#" + x );
if( c != null ) if( !c.isEmpty() )
{ {
this.fluids[x] = AEFluidStack.fromNBT( c ); this.fluids[x] = AEFluidStack.fromNBT( c );
} }
@@ -334,49 +341,4 @@ public class AEFluidInventory implements IAEFluidTank
} }
} }
private class FluidTankPropertiesWrapper implements IFluidTankProperties
{
private final int slot;
public FluidTankPropertiesWrapper( final int slot )
{
this.slot = slot;
}
@Override
public FluidStack getContents()
{
return AEFluidInventory.this.fluids[this.slot] == null ? null : AEFluidInventory.this.fluids[this.slot].getFluidStack();
}
@Override
public int getCapacity()
{
return Math.min( AEFluidInventory.this.capacity, Integer.MAX_VALUE );
}
@Override
public boolean canFill()
{
return true;
}
@Override
public boolean canDrain()
{
return true;
}
@Override
public boolean canFillFluidType( FluidStack fluidStack )
{
return true;
}
@Override
public boolean canDrainFluidType( FluidStack fluidStack )
{
return fluidStack != null;
}
}
} }
@@ -24,6 +24,7 @@ import java.io.ByteArrayOutputStream;
import java.io.DataInputStream; import java.io.DataInputStream;
import java.io.DataOutputStream; import java.io.DataOutputStream;
import java.io.IOException; import java.io.IOException;
import java.nio.charset.StandardCharsets;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
@@ -36,7 +37,6 @@ import net.minecraft.nbt.CompressedStreamTools;
import net.minecraft.network.PacketBuffer; import net.minecraft.network.PacketBuffer;
import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidStack;
import appeng.api.AEApi;
import appeng.api.config.FuzzyMode; import appeng.api.config.FuzzyMode;
import appeng.api.storage.IStorageChannel; import appeng.api.storage.IStorageChannel;
import appeng.api.storage.channels.IFluidStorageChannel; import appeng.api.storage.channels.IFluidStorageChannel;
@@ -134,8 +134,8 @@ public final class AEFluidStack extends AEStack<IAEFluidStack> implements IAEFlu
final byte[] name = new byte[len2]; final byte[] name = new byte[len2];
buffer.readBytes( name, 0, len2 ); buffer.readBytes( name, 0, len2 );
d.setString( "FluidName", new String( name, "UTF-8" ) ); d.putString( "FluidName", new String( name, "UTF-8" ) );
d.setByte( "Count", (byte) 0 ); d.putByte( "Count", (byte) 0 );
if( hasTagCompound ) if( hasTagCompound )
{ {
@@ -145,7 +145,7 @@ public final class AEFluidStack extends AEStack<IAEFluidStack> implements IAEFlu
buffer.readBytes( bd ); buffer.readBytes( bd );
final DataInputStream di = new DataInputStream( new ByteArrayInputStream( bd ) ); final DataInputStream di = new DataInputStream( new ByteArrayInputStream( bd ) );
d.setTag( "Tag", CompressedStreamTools.read( di ) ); d.put( "Tag", CompressedStreamTools.read( di ) );
} }
final long stackSize = getPacketValue( stackType, buffer ); final long stackSize = getPacketValue( stackType, buffer );
@@ -181,19 +181,19 @@ public final class AEFluidStack extends AEStack<IAEFluidStack> implements IAEFlu
@Override @Override
public void writeToNBT( final CompoundNBT data ) public void writeToNBT( final CompoundNBT data )
{ {
data.setString( "FluidName", this.fluid.getName() ); data.putString( "FluidName", this.fluid.getRegistryName().toString() );
data.setByte( "Count", (byte) 0 ); data.putByte( "Count", (byte) 0 );
data.setLong( "Cnt", this.getStackSize() ); data.putLong( "Cnt", this.getStackSize() );
data.setLong( "Req", this.getCountRequestable() ); data.putLong( "Req", this.getCountRequestable() );
data.setBoolean( "Craft", this.isCraftable() ); data.putBoolean( "Craft", this.isCraftable() );
if( this.hasTagCompound() ) if( this.hasTagCompound() )
{ {
data.setTag( "Tag", this.tagCompound ); data.put( "Tag", this.tagCompound );
} }
else else
{ {
data.removeTag( "Tag" ); data.remove( "Tag" );
} }
} }
@@ -240,7 +240,7 @@ public final class AEFluidStack extends AEStack<IAEFluidStack> implements IAEFlu
{ {
if( this.fluid != other.fluid ) if( this.fluid != other.fluid )
{ {
return this.fluid.getName().compareTo( other.fluid.getName() ); return this.fluid.getRegistryName().compareTo( other.fluid.getRegistryName() );
} }
if( Platform.itemComparisons().isNbtTagEqual( this.tagCompound, other.tagCompound ) ) if( Platform.itemComparisons().isNbtTagEqual( this.tagCompound, other.tagCompound ) )
@@ -273,7 +273,7 @@ public final class AEFluidStack extends AEStack<IAEFluidStack> implements IAEFlu
else if( other instanceof FluidStack ) else if( other instanceof FluidStack )
{ {
final FluidStack is = (FluidStack) other; final FluidStack is = (FluidStack) other;
return is.getFluid() == this.fluid && Platform.itemComparisons().isNbtTagEqual( this.tagCompound, is.tag ); return is.getFluid() == this.fluid && Platform.itemComparisons().isNbtTagEqual( this.tagCompound, is.getTag() );
} }
return false; return false;
} }
@@ -281,7 +281,7 @@ public final class AEFluidStack extends AEStack<IAEFluidStack> implements IAEFlu
@Override @Override
public String toString() public String toString()
{ {
return this.getStackSize() + "x" + this.getFluidStack().getFluid().getName() + " " + this.tagCompound; return this.getStackSize() + "x" + this.getFluidStack().getFluid().getRegistryName() + " " + this.tagCompound;
} }
@Override @Override
@@ -334,7 +334,7 @@ public final class AEFluidStack extends AEStack<IAEFluidStack> implements IAEFlu
private void writeToStream( final PacketBuffer buffer ) throws IOException private void writeToStream( final PacketBuffer buffer ) throws IOException
{ {
final byte[] name = this.fluid.getName().getBytes( "UTF-8" ); final byte[] name = this.fluid.getRegistryName().toString().getBytes(StandardCharsets.UTF_8);
buffer.writeByte( (byte) name.length ); buffer.writeByte( (byte) name.length );
buffer.writeBytes( name ); buffer.writeBytes( name );
if( this.hasTagCompound() ) if( this.hasTagCompound() )
@@ -19,11 +19,9 @@
package appeng.fluids.util; package appeng.fluids.util;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.fluids.FluidTank;
import appeng.api.storage.data.IAEFluidStack; import appeng.api.storage.data.IAEFluidStack;
import appeng.util.Platform; import appeng.util.Platform;
import net.minecraftforge.fluids.capability.templates.FluidTank;
public class AEFluidTank extends FluidTank implements IAEFluidTank public class AEFluidTank extends FluidTank implements IAEFluidTank
@@ -34,10 +32,10 @@ public class AEFluidTank extends FluidTank implements IAEFluidTank
{ {
super( capacity ); super( capacity );
this.host = host; this.host = host;
if( host instanceof TileEntity ) // FIXME if( host instanceof TileEntity )
{ // FIXME {
this.setTileEntity( (TileEntity) host ); // FIXME this.setTileEntity( (TileEntity) host );
} // FIXME }
} }
@Override @Override
@@ -19,18 +19,23 @@
package appeng.items.misc; package appeng.items.misc;
import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.NonNullList; import net.minecraft.util.NonNullList;
import appeng.api.util.AEColor; import appeng.api.util.AEColor;
import appeng.core.localization.GuiText; import appeng.core.localization.GuiText;
import appeng.items.AEBaseItem; import appeng.items.AEBaseItem;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TranslationTextComponent;
public class ItemPaintBall extends AEBaseItem public class ItemPaintBall extends AEBaseItem
{ {
private static final ITextComponent LUMEN_PREFIX = new TranslationTextComponent(GuiText.Lumen.getTranslationKey())
.appendText(" ");
private static final int DAMAGE_THRESHOLD = 20; private static final int DAMAGE_THRESHOLD = 20;
public ItemPaintBall() public ItemPaintBall()
@@ -39,14 +44,21 @@ public class ItemPaintBall extends AEBaseItem
} }
@Override @Override
public String getItemStackDisplayName( final ItemStack is ) public ITextComponent getDisplayName(final ItemStack is )
{ {
return super.getItemStackDisplayName( is ) + " - " + this.getExtraName( is ); // FIXME: in the new system, we should have different items for the colors,
// FIXME: Making this function fully redundant
return super.getDisplayName( is ).shallowCopy().appendText(" - ").appendSibling(this.getExtraName( is ));
} }
private String getExtraName( final ItemStack is ) private ITextComponent getExtraName( final ItemStack is )
{ {
return ( is.getDamage() >= DAMAGE_THRESHOLD ? GuiText.Lumen.getLocal() + ' ' : "" ) + this.getColor( is ); ITextComponent colorText = new TranslationTextComponent(this.getColor(is).translationKey);
if (is.getDamage() >= DAMAGE_THRESHOLD) {
return LUMEN_PREFIX.shallowCopy().appendSibling(colorText);
} else {
return colorText;
}
} }
public AEColor getColor( final ItemStack is ) public AEColor getColor( final ItemStack is )
@@ -66,8 +78,8 @@ public class ItemPaintBall extends AEBaseItem
} }
@Override @Override
protected void getCheckedSubItems( final CreativeTabs creativeTab, final NonNullList<ItemStack> itemStacks ) public void fillItemGroup(ItemGroup group, NonNullList<ItemStack> itemStacks) {
{
for( final AEColor c : AEColor.values() ) for( final AEColor c : AEColor.values() )
{ {
if( c != AEColor.TRANSPARENT ) if( c != AEColor.TRANSPARENT )
@@ -41,6 +41,7 @@ import net.minecraft.util.NonNullList;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.registry.Registry; import net.minecraft.util.registry.Registry;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.property.IExtendedBlockState; import net.minecraftforge.common.property.IExtendedBlockState;
import net.minecraftforge.registries.ForgeRegistries; import net.minecraftforge.registries.ForgeRegistries;
@@ -76,14 +77,13 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
} }
@Override @Override
public String getItemStackDisplayName( final ItemStack is ) public ITextComponent getDisplayName(ItemStack is) {
{
try try
{ {
final ItemStack in = this.getTextureItem( is ); final ItemStack in = this.getTextureItem( is );
if( !in.isEmpty() ) if( !in.isEmpty() )
{ {
return super.getItemStackDisplayName( is ) + " - " + in.getDisplayName(); return super.getDisplayName( is ).shallowCopy().appendText(" - ").appendSibling(in.getDisplayName());
} }
} }
catch( final Throwable ignored ) catch( final Throwable ignored )
@@ -91,7 +91,7 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
} }
return super.getItemStackDisplayName( is ); return super.getDisplayName( is );
} }
@Override @Override
@@ -19,10 +19,11 @@
package appeng.items.storage; package appeng.items.storage;
import appeng.core.Api;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.IItemHandler;
import appeng.api.AEApi;
import appeng.api.config.FuzzyMode; import appeng.api.config.FuzzyMode;
import appeng.api.config.Upgrades; import appeng.api.config.Upgrades;
import appeng.api.implementations.items.IUpgradeModule; import appeng.api.implementations.items.IUpgradeModule;
@@ -42,9 +43,10 @@ import appeng.util.prioritylist.PrecisePriorityList;
public class ItemViewCell extends AEBaseItem implements ICellWorkbenchItem public class ItemViewCell extends AEBaseItem implements ICellWorkbenchItem
{ {
public ItemViewCell() public ItemViewCell()
{ {
this.setMaxStackSize( 1 ); super(new Item.Properties().maxStackSize(1));
} }
public static IPartitionList<IAEItemStack> createFilter( final ItemStack[] list ) public static IPartitionList<IAEItemStack> createFilter( final ItemStack[] list )
@@ -52,7 +52,6 @@ import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.IItemHandler;
import net.minecraftforge.oredict.OreDictionary; import net.minecraftforge.oredict.OreDictionary;
import appeng.api.AEApi;
import appeng.api.config.Actionable; import appeng.api.config.Actionable;
import appeng.api.config.FuzzyMode; import appeng.api.config.FuzzyMode;
import appeng.api.implementations.items.IItemGroup; import appeng.api.implementations.items.IItemGroup;
@@ -203,7 +202,7 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
if( selected != null && Platform.isClient() ) if( selected != null && Platform.isClient() )
{ {
extra = Platform.gui_localize( selected.unlocalizedName ); extra = Platform.gui_localize( selected.translationKey);
} }
return super.getItemStackDisplayName( par1ItemStack ) + " - " + extra; return super.getItemStackDisplayName( par1ItemStack ) + " - " + extra;
+1
View File
@@ -36,6 +36,7 @@ import appeng.api.networking.IMachineSet;
import appeng.api.networking.events.MENetworkEvent; import appeng.api.networking.events.MENetworkEvent;
import appeng.api.networking.events.MENetworkPostCacheConstruction; import appeng.api.networking.events.MENetworkPostCacheConstruction;
import appeng.api.util.IReadOnlyCollection; import appeng.api.util.IReadOnlyCollection;
import appeng.core.Api;
import appeng.core.worlddata.WorldData; import appeng.core.worlddata.WorldData;
import appeng.hooks.TickHandler; import appeng.hooks.TickHandler;
import appeng.util.ReadOnlyCollection; import appeng.util.ReadOnlyCollection;
+1 -1
View File
@@ -121,7 +121,7 @@ public class GridStorage implements IGridStorage
return this.internalGrid == null ? null : this.internalGrid.get(); return this.internalGrid == null ? null : this.internalGrid.get();
} }
void setGrid( final Grid grid ) void setGrid( final IGrid grid )
{ {
this.internalGrid = new WeakReference<>( grid ); this.internalGrid = new WeakReference<>( grid );
} }
@@ -32,7 +32,7 @@ import com.google.common.collect.ImmutableList;
import net.minecraft.inventory.InventoryCrafting; import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.CompoundNBT;
import net.minecraft.nbt.NBTTagList; import net.minecraft.nbt.ListNBT;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.WorldServer; import net.minecraft.world.WorldServer;
import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.common.FMLCommonHandler;
@@ -1156,7 +1156,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
data.setTag( "link", link ); data.setTag( "link", link );
} }
final NBTTagList list = new NBTTagList(); final ListNBT list = new ListNBT();
for( final Entry<ICraftingPatternDetails, TaskProgress> e : this.tasks.entrySet() ) for( final Entry<ICraftingPatternDetails, TaskProgress> e : this.tasks.entrySet() )
{ {
final CompoundNBT item = this.writeItem( AEItemStack.fromItemStack( e.getKey().getPattern() ) ); final CompoundNBT item = this.writeItem( AEItemStack.fromItemStack( e.getKey().getPattern() ) );
@@ -1184,9 +1184,9 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
return out; return out;
} }
private NBTTagList writeList( final IItemList<IAEItemStack> myList ) private ListNBT writeList( final IItemList<IAEItemStack> myList )
{ {
final NBTTagList out = new NBTTagList(); final ListNBT out = new ListNBT();
for( final IAEItemStack ais : myList ) for( final IAEItemStack ais : myList )
{ {
@@ -1215,7 +1215,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
public void readFromNBT( final CompoundNBT data ) public void readFromNBT( final CompoundNBT data )
{ {
this.finalOutput = AEItemStack.fromNBT( (CompoundNBT) data.getTag( "finalOutput" ) ); this.finalOutput = AEItemStack.fromNBT( (CompoundNBT) data.getTag( "finalOutput" ) );
for( final IAEItemStack ais : this.readList( (NBTTagList) data.getTag( "inventory" ) ) ) for( final IAEItemStack ais : this.readList( (ListNBT) data.getTag( "inventory" ) ) )
{ {
this.inventory.injectItems( ais, Actionable.MODULATE, this.machineSrc ); this.inventory.injectItems( ais, Actionable.MODULATE, this.machineSrc );
} }
@@ -1230,7 +1230,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
this.submitLink( this.myLastLink ); this.submitLink( this.myLastLink );
} }
final NBTTagList list = data.getTagList( "tasks", 10 ); final ListNBT list = data.getTagList( "tasks", 10 );
for( int x = 0; x < list.tagCount(); x++ ) for( int x = 0; x < list.tagCount(); x++ )
{ {
final CompoundNBT item = list.getCompoundTagAt( x ); final CompoundNBT item = list.getCompoundTagAt( x );
@@ -1248,7 +1248,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
} }
} }
this.waitingFor = this.readList( (NBTTagList) data.getTag( "waitingFor" ) ); this.waitingFor = this.readList( (ListNBT) data.getTag( "waitingFor" ) );
for( final IAEItemStack is : this.waitingFor ) for( final IAEItemStack is : this.waitingFor )
{ {
this.postCraftingStatusChange( is.copy() ); this.postCraftingStatusChange( is.copy() );
@@ -1280,7 +1280,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
} }
} }
private IItemList<IAEItemStack> readList( final NBTTagList tag ) private IItemList<IAEItemStack> readList( final ListNBT tag )
{ {
final IItemList<IAEItemStack> out = Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ).createList(); final IItemList<IAEItemStack> out = Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ).createList();
@@ -22,6 +22,8 @@ package appeng.me.helpers;
import java.util.Collections; import java.util.Collections;
import java.util.EnumSet; import java.util.EnumSet;
import appeng.core.Api;
import appeng.core.worlddata.WorldData;
import com.mojang.authlib.GameProfile; import com.mojang.authlib.GameProfile;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
@@ -45,11 +47,7 @@ import appeng.api.networking.ticking.ITickManager;
import appeng.api.util.AEColor; import appeng.api.util.AEColor;
import appeng.api.util.DimensionalCoord; import appeng.api.util.DimensionalCoord;
import appeng.api.util.IOrientable; import appeng.api.util.IOrientable;
import appeng.core.worlddata.WorldData;
import appeng.hooks.TickHandler;
import appeng.me.GridAccessException; import appeng.me.GridAccessException;
import appeng.me.cache.P2PCache;
import appeng.parts.networking.PartCable;
import appeng.tile.AEBaseTile; import appeng.tile.AEBaseTile;
import appeng.util.Platform; import appeng.util.Platform;
@@ -105,7 +103,8 @@ public class AENetworkProxy implements IGridBlock
{ {
if( this.gp instanceof AEBaseTile ) if( this.gp instanceof AEBaseTile )
{ {
TickHandler.INSTANCE.addInit( (AEBaseTile) this.gp ); throw new IllegalStateException(); // FIXME just here to remember for sure
// FIXME TickHandler.INSTANCE.addInit( (AEBaseTile) this.gp );
} }
} }
@@ -241,23 +240,23 @@ public class AENetworkProxy implements IGridBlock
return pg; return pg;
} }
public P2PCache getP2P() throws GridAccessException // FIXME public P2PCache getP2P() throws GridAccessException
{ // FIXME {
final IGrid grid = this.getGrid(); // FIXME final IGrid grid = this.getGrid();
if( grid == null ) // FIXME if( grid == null )
{ // FIXME {
throw new GridAccessException(); // FIXME throw new GridAccessException();
} // FIXME }
// FIXME
final P2PCache pg = grid.getCache( P2PCache.class ); // FIXME final P2PCache pg = grid.getCache( P2PCache.class );
// FIXME
if( pg == null ) // FIXME if( pg == null )
{ // FIXME {
throw new GridAccessException(); // FIXME throw new GridAccessException();
} // FIXME }
// FIXME
return pg; // FIXME return pg;
} // FIXME }
public ISecurityGrid getSecurity() throws GridAccessException public ISecurityGrid getSecurity() throws GridAccessException
{ {
@@ -328,10 +327,10 @@ public class AENetworkProxy implements IGridBlock
@Override @Override
public void onGridNotification( final GridNotification notification ) public void onGridNotification( final GridNotification notification )
{ {
if( this.gp instanceof PartCable ) // FIXME if( this.gp instanceof PartCable )
{ // FIXME {
( (PartCable) this.gp ).markForUpdate(); // FIXME ( (PartCable) this.gp ).markForUpdate();
} // FIXME }
} }
@Override @Override
@@ -38,8 +38,8 @@ import net.minecraft.block.Block;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IWorld; import net.minecraft.world.IWorld;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.chunk.IChunk; import net.minecraft.world.chunk.IChunk;
import net.minecraft.world.server.ServerWorld;
import net.minecraftforge.event.world.WorldEvent; import net.minecraftforge.event.world.WorldEvent;
import appeng.api.AEApi; import appeng.api.AEApi;
@@ -189,7 +189,9 @@ public final class CompassService
if( cr == null ) if( cr == null )
{ {
cr = new CompassReader( w.provider.getDimension(), this.worldCompassFolder ); ServerWorld sw = (ServerWorld) w;
// FIXME: using the numeric dimension ID here seems to be a bad idea!
cr = new CompassReader( sw.dimension.getType().getId(), this.worldCompassFolder );
this.worldSet.put( w, cr ); this.worldSet.put( w, cr );
} }
@@ -492,11 +492,6 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
return null; return null;
} }
public boolean requiresTESR()
{
return false;
}
public void setName( final String name ) public void setName( final String name )
{ {
this.customName = name; this.customName = name;
@@ -141,12 +141,6 @@ public class TileCraftingMonitorTile extends TileCraftingTile implements IColora
return this.dspPlay; // AEItemStack.create( new ItemStack( Items.DIAMOND, 64 ) ); return this.dspPlay; // AEItemStack.create( new ItemStack( Items.DIAMOND, 64 ) );
} }
@Override
public boolean requiresTESR()
{
return this.dspPlay != null;
}
@Override @Override
public AEColor getColor() public AEColor getColor()
{ {
@@ -113,12 +113,6 @@ public class TileCrank extends AEBaseTile implements ICustomCollision, ITickable
this.getBlockType().neighborChanged( state, this.world, this.pos, state.getBlock(), this.pos ); this.getBlockType().neighborChanged( state, this.world, this.pos, state.getBlock(), this.pos );
} }
@Override
public boolean requiresTESR()
{
return true;
}
/** /**
* return true if this should count towards stats. * return true if this should count towards stats.
*/ */
@@ -115,12 +115,6 @@ public class TileCharger extends AENetworkPowerTile implements ICrankable, IGrid
this.setPowerSides( EnumSet.of( this.getUp(), this.getUp().getOpposite() ) ); this.setPowerSides( EnumSet.of( this.getUp(), this.getUp().getOpposite() ) );
} }
@Override
public boolean requiresTESR()
{
return true;
}
@Override @Override
public boolean canTurn() public boolean canTurn()
{ {
@@ -296,7 +296,7 @@ public class TileCondenser extends AEBaseInvTile implements IConfigManagerHost,
} }
} }
private static final IFluidTankProperties[] EMPTY = { new FluidTankProperties( null, Fluid.BUCKET_VOLUME, true, false ) }; private static final IFluidTankProperties[] EMPTY = { new FluidTankProperties( null, FluidAttributes.BUCKET_VOLUME, true, false ) };
/** /**
* A fluid handler that exposes a 1 bucket tank that can only be filled, and - when filled - will add power * A fluid handler that exposes a 1 bucket tank that can only be filled, and - when filled - will add power
@@ -227,12 +227,6 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
} }
} }
@Override
public boolean requiresTESR()
{
return true;
}
@Override @Override
public IItemHandler getInternalInventory() public IItemHandler getInternalInventory()
{ {
@@ -25,12 +25,6 @@ import appeng.tile.AEBaseTile;
public class TileSkyCompass extends AEBaseTile public class TileSkyCompass extends AEBaseTile
{ {
@Override
public boolean requiresTESR()
{
return true;
}
@Override @Override
public boolean hasFastRenderer() public boolean hasFastRenderer()
{ {

Some files were not shown because too many files have changed in this diff Show More