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
@@ -208,7 +208,7 @@ public class BlockCableBus extends AEBaseTileBlock implements IAEFacade
@Override
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 );
if( tile != null )
@@ -19,11 +19,10 @@
package appeng.block.storage;
import java.util.Collections;
import java.util.List;
import javax.annotation.Nullable;
import appeng.api.util.AEPartLocation;
import appeng.core.sync.GuiBridge;
import net.minecraft.block.BlockRenderType;
import net.minecraft.block.BlockState;
import net.minecraft.entity.player.PlayerEntity;
@@ -80,7 +79,7 @@ public class BlockSkyChest extends AEBaseTileBlock<TileSkyChest>
{
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;
@@ -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;
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.IAEItemStack;
import appeng.client.gui.widgets.GuiCustomSlot;
@@ -73,17 +29,8 @@ import appeng.client.me.SlotDisconnected;
import appeng.client.me.SlotME;
import appeng.client.render.StackSizeRenderer;
import appeng.container.AEBaseContainer;
import appeng.container.slot.AppEngCraftingSlot;
import appeng.container.slot.AppEngSlot;
import appeng.container.slot.*;
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.AppEng;
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.container.slots.IMEFluidSlot;
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>
@@ -108,9 +89,8 @@ public abstract class AEBaseGui extends ContainerScreen<AEBaseContainer>
private Slot bl_clicked;
protected final List<GuiCustomSlot> guiSlots = new ArrayList<>();
public AEBaseGui( final Container container )
{
super( container );
public AEBaseGui(AEBaseContainer container, PlayerInventory playerInventory, ITextComponent title) {
super(container, playerInventory, title);
}
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 );
}
protected int getQty( final GuiButton btn )
protected int getQty( final Button btn )
{
try
{
final DecimalFormat df = new DecimalFormat( "+#;-#" );
return df.parse( btn.displayString ).intValue();
return df.parse( btn.getMessage() ).intValue();
}
catch( final ParseException e )
{
@@ -134,9 +114,9 @@ public abstract class AEBaseGui extends ContainerScreen<AEBaseContainer>
}
@Override
public void initGui()
public void init()
{
super.initGui();
super.init();
final List<Slot> slots = this.getInventorySlots();
final Iterator<Slot> i = slots.iterator();
@@ -156,32 +136,32 @@ public abstract class AEBaseGui extends ContainerScreen<AEBaseContainer>
private List<Slot> getInventorySlots()
{
return this.inventorySlots.inventorySlots;
return this.container.inventorySlots;
}
@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.drawScreen( mouseX, mouseY, partialTicks );
super.renderBackground();
super.render( mouseX, mouseY, partialTicks );
GlStateManager.pushMatrix();
GlStateManager.translate( this.guiLeft, this.guiTop, 0.0F );
GlStateManager.enableDepth();
RenderSystem.pushMatrix();
RenderSystem.translatef( this.guiLeft, this.guiTop, 0.0F );
RenderSystem.enableDepthTest();
for( final GuiCustomSlot c : this.guiSlots )
{
this.drawGuiSlot( c, mouseX, mouseY, partialTicks );
}
GlStateManager.disableDepth();
RenderSystem.disableDepthTest();
for( final GuiCustomSlot c : this.guiSlots )
{
this.drawTooltip( c, mouseX - this.guiLeft, mouseY - this.guiTop );
}
GlStateManager.popMatrix();
RenderSystem.popMatrix();
this.renderHoveredToolTip( mouseX, mouseY );
for( final Object c : this.buttonList )
for( final Object c : this.buttons )
{
if( c instanceof ITooltip )
{
@@ -201,13 +181,13 @@ public abstract class AEBaseGui extends ContainerScreen<AEBaseContainer>
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();
GlStateManager.colorMask( true, true, true, false );
this.drawGradientRect( left, top, right, bottom, -2130706433, -2130706433 );
GlStateManager.colorMask( true, true, true, true );
GlStateManager.enableLighting();
RenderSystem.disableLighting();
RenderSystem.colorMask( true, true, true, false );
this.fillGradient( left, top, right, bottom, -2130706433, -2130706433 );
RenderSystem.colorMask( true, true, true, true );
RenderSystem.enableLighting();
}
}
}
@@ -260,7 +240,7 @@ public abstract class AEBaseGui extends ContainerScreen<AEBaseContainer>
lines.set( i, TextFormatting.GRAY + lines.get( i ) );
}
this.drawHoveringText( lines, x, y, this.fontRenderer );
this.renderTooltip( lines, x, y, this.font );
}
@Override
@@ -268,7 +248,7 @@ public abstract class AEBaseGui extends ContainerScreen<AEBaseContainer>
{
final int ox = this.guiLeft; // (width - xSize) / 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 )
{
@@ -285,7 +265,7 @@ public abstract class AEBaseGui extends ContainerScreen<AEBaseContainer>
{
final int ox = this.guiLeft; // (width - xSize) / 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 );
final List<Slot> slots = this.getInventorySlots();
@@ -299,18 +279,20 @@ public abstract class AEBaseGui extends ContainerScreen<AEBaseContainer>
final AppEngSlot aeSlot = (AppEngSlot) slot;
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,
0 /* FIXME: Check, this used this.zLevel before */);
}
else
{
GlStateManager.color( 1.0F, 1.0F, 1.0F, 0.4F );
GlStateManager.enableBlend();
this.drawTexturedModalRect( ox + aeSlot.xPos - 1, oy + aeSlot.yPos - 1, optionalSlot.getSourceX() - 1, optionalSlot.getSourceY() - 1,
RenderSystem.color4f( 1.0F, 1.0F, 1.0F, 0.4F );
RenderSystem.enableBlend();
GuiUtils.drawTexturedModalRect( ox + aeSlot.xPos - 1, oy + aeSlot.yPos - 1, optionalSlot.getSourceX() - 1, optionalSlot.getSourceY() - 1,
18,
18 );
GlStateManager.color( 1.0F, 1.0F, 1.0F, 1.0F );
18,
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
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();
if( btn == 1 )
{
for( final Object o : this.buttonList )
for( final Object o : this.buttons )
{
final GuiButton guibutton = (GuiButton) o;
if( guibutton.mousePressed( this.mc, xCoord, yCoord ) )
final Widget widget = (Widget) o;
if( widget.isMouseOver( xCoord, yCoord ) )
{
super.mouseClicked( xCoord, yCoord, 0 );
return;
return super.mouseClicked( xCoord, yCoord, 0 );
}
}
}
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 )
{
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
protected void mouseClickMove( final int x, final int y, final int c, final long d )
{
final Slot slot = this.getSlot( x, y );
final ItemStack itemstack = this.mc.player.inventory.getItemStack();
public boolean mouseDragged(double mouseX, double mouseY, int mouseButton, double dragX, double dragY) {
final Slot slot = this.getSlot( (int) mouseX, (int) mouseY );
final ItemStack itemstack = this.minecraft.player.inventory.getItemStack();
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() )
@@ -375,14 +357,16 @@ public abstract class AEBaseGui extends ContainerScreen<AEBaseContainer>
{
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 );
}
}
return true;
}
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
{
NetworkHandler.instance().sendToServer( ( (SlotPatternTerm) slot ).getRequest( isShiftKeyDown() ) );
NetworkHandler.instance().sendToServer( ( (SlotPatternTerm) slot ).getRequest( hasShiftDown() ) );
}
catch( final IOException e )
{
@@ -431,7 +415,7 @@ public abstract class AEBaseGui extends ContainerScreen<AEBaseContainer>
}
InventoryAction action = null;
if( isShiftKeyDown() )
if( hasShiftDown() )
{
action = InventoryAction.CRAFT_SHIFT;
}
@@ -447,7 +431,7 @@ public abstract class AEBaseGui extends ContainerScreen<AEBaseContainer>
return;
}
if( Keyboard.isKeyDown( Keyboard.KEY_SPACE ) )
if( InputMappings.isKeyDown(Minecraft.getInstance().getMainWindow().getHandle(), GLFW.GLFW_KEY_SPACE) )
{
if( this.enableSpaceClicking() )
{
@@ -464,7 +448,7 @@ public abstract class AEBaseGui extends ContainerScreen<AEBaseContainer>
slotNum = slot.slotNumber;
}
( (AEBaseContainer) this.inventorySlots ).setTargetStack( stack );
( (AEBaseContainer) this.container ).setTargetStack( stack );
final PacketInventoryAction p = new PacketInventoryAction( InventoryAction.MOVE_REGION, slotNum, 0 );
NetworkHandler.instance().sendToServer( p );
return;
@@ -486,7 +470,7 @@ public abstract class AEBaseGui extends ContainerScreen<AEBaseContainer>
case CLONE: // creative dupe:
if( player.capabilities.isCreativeMode )
if( player.abilities.isCreativeMode )
{
action = InventoryAction.CREATIVE_DUPLICATE;
}
@@ -536,7 +520,7 @@ public abstract class AEBaseGui extends ContainerScreen<AEBaseContainer>
{
action = InventoryAction.AUTO_CRAFT;
}
else if( player.capabilities.isCreativeMode )
else if( player.abilities.isCreativeMode )
{
final IAEItemStack slotItem = ( (SlotME) slot ).getAEStack();
if( slotItem != null )
@@ -552,7 +536,7 @@ public abstract class AEBaseGui extends ContainerScreen<AEBaseContainer>
if( action != null )
{
( (AEBaseContainer) this.inventorySlots ).setTargetStack( stack );
( (AEBaseContainer) this.container ).setTargetStack( stack );
final PacketInventoryAction p = new PacketInventoryAction( action, this.getInventorySlots().size(), 0 );
NetworkHandler.instance().sendToServer( p );
}
@@ -560,7 +544,7 @@ public abstract class AEBaseGui extends ContainerScreen<AEBaseContainer>
return;
}
if( !this.disableShiftClick && isShiftKeyDown() && mouseButton == 0 )
if( !this.disableShiftClick && hasShiftDown() && mouseButton == 0 )
{
this.disableShiftClick = true;
@@ -586,7 +570,7 @@ public abstract class AEBaseGui extends ContainerScreen<AEBaseContainer>
for( final Slot inventorySlot : slots )
{
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 ) )
{
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 );
}
@Override
protected boolean checkHotbarKeys( final int keyCode )
protected boolean func_195363_d(int keyCode, int scanCode) {
return checkHotbarKeys(InputMappings.getInputByCode(keyCode, scanCode));
}
protected boolean checkHotbarKeys( final InputMappings.Input input )
{
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 )
{
if( keyCode == this.mc.gameSettings.keyBindsHotbar[j].getKeyCode() )
if( this.minecraft.gameSettings.keyBindsHotbar[j].isActiveAndMatches(input) )
{
final List<Slot> slots = this.getInventorySlots();
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;
}
@@ -633,7 +620,7 @@ public abstract class AEBaseGui extends ContainerScreen<AEBaseContainer>
{
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 ) );
return true;
@@ -648,9 +635,9 @@ public abstract class AEBaseGui extends ContainerScreen<AEBaseContainer>
}
@Override
public void onGuiClosed()
public void removed()
{
super.onGuiClosed();
super.removed();
}
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 );
@Override
public void handleMouseInput() throws IOException
{
super.handleMouseInput();
final int i = Mouse.getEventDWheel();
if( i != 0 && isShiftKeyDown() )
public boolean mouseScrolled(double x, double y, double wheelDelta) {
if( wheelDelta != 0 && hasShiftDown() )
{
final int x = Mouse.getEventX() * this.width / this.mc.displayWidth;
final int y = this.height - Mouse.getEventY() * this.height / this.mc.displayHeight - 1;
this.mouseWheelEvent( x, y, i / Math.abs( i ) );
this.mouseWheelEvent( x, y, wheelDelta / Math.abs( wheelDelta ) );
return true;
}
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 )
{
final IAEItemStack item = ( (SlotME) slot ).getAEStack();
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 int times = Math.abs( wheel );
final int times = (int) Math.abs( wheel );
final int inventorySize = this.getInventorySlots().size();
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 )
{
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 )
{
this.zLevel = 100.0F;
this.itemRender.zLevel = 100.0F;
this.itemRenderer.zLevel = 100.0F;
RenderHelper.enableGUIStandardItemLighting();
GlStateManager.enableDepth();
this.itemRender.renderItemAndEffectIntoGUI( is, x, y );
GlStateManager.disableDepth();
// FIXME: Check if this is actually required, vanilla doesnt have it anymore
// FIXME RenderHelper.enableGUIStandardItemLighting();
RenderSystem.enableDepthTest();
this.itemRenderer.renderItemAndEffectIntoGUI( is, x, y );
RenderSystem.disableDepthTest();
this.itemRender.zLevel = 0.0F;
this.zLevel = 0.0F;
this.itemRenderer.zLevel = 0.0F;
}
protected String getGuiDisplayName( final String in )
@@ -741,16 +724,16 @@ public abstract class AEBaseGui extends ContainerScreen<AEBaseContainer>
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;
}
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
{
this.zLevel = 100.0F;
this.itemRender.zLevel = 100.0F;
// FIXME Probably not required this.zLevel = 100.0F;
this.itemRenderer.zLevel = 100.0F;
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;
this.itemRender.zLevel = 0.0F;
// FIXME Probably not required this.zLevel = 0.0F;
this.itemRenderer.zLevel = 0.0F;
// Annoying but easier than trying to splice into render item
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 )
@@ -795,28 +778,30 @@ public abstract class AEBaseGui extends ContainerScreen<AEBaseContainer>
if( fs != null && this.isPowered() )
{
GlStateManager.disableLighting();
GlStateManager.disableBlend();
RenderSystem.disableLighting();
RenderSystem.disableBlend();
final Fluid fluid = fs.getFluid();
Minecraft.getInstance().getTextureManager().bindTexture( TextureMap.LOCATION_BLOCKS_TEXTURE );
final TextureAtlasSprite sprite = Minecraft.getInstance().getTextureMapBlocks().getAtlasSprite( fluid.getStill().toString() );
FluidAttributes fluidAttributes = fluid.getAttributes();
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
// Convert int color to RGB
float red = ( fluid.getColor() >> 16 & 255 ) / 255.0F;
float green = ( fluid.getColor() >> 8 & 255 ) / 255.0F;
float blue = ( fluid.getColor() & 255 ) / 255.0F;
GlStateManager.color( red, green, blue );
float red = ( fluidAttributes.getColor() >> 16 & 255 ) / 255.0F;
float green = ( fluidAttributes.getColor() >> 8 & 255 ) / 255.0F;
float blue = ( fluidAttributes.getColor() & 255 ) / 255.0F;
RenderSystem.color3f( red, green, blue );
this.drawTexturedModalRect( s.xPos, s.yPos, sprite, 16, 16 );
GlStateManager.enableLighting();
GlStateManager.enableBlend();
blit(s.xPos, s.yPos, 0 /* FIXME: Validate this was previous the controls zindex */, 16, 16, sprite);
RenderSystem.enableLighting();
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() )
{
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;
@@ -838,11 +823,11 @@ public abstract class AEBaseGui extends ContainerScreen<AEBaseContainer>
final int uv_y = (int) Math.floor( aes.getIcon() / 16 );
final int uv_x = aes.getIcon() - uv_y * 16;
GlStateManager.enableBlend();
GlStateManager.disableLighting();
GlStateManager.enableTexture2D();
GlStateManager.blendFunc( GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA );
GlStateManager.color( 1.0f, 1.0f, 1.0f, 1.0f );
RenderSystem.enableBlend();
RenderSystem.disableLighting();
RenderSystem.enableTexture();
RenderSystem.blendFunc( GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA );
RenderSystem.color4f( 1.0f, 1.0f, 1.0f, 1.0f );
final float par1 = aes.xPos;
final float par2 = aes.yPos;
final float par3 = uv_x * 16;
@@ -856,23 +841,24 @@ public abstract class AEBaseGui extends ContainerScreen<AEBaseContainer>
final float f1 = 0.00390625F;
final float f = 0.00390625F;
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 )
.color( 1.0f, 1.0f, 1.0f,
aes.getOpacityOfIcon() )
.endVertex();
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 )
.color( 1.0f, 1.0f, 1.0f,
aes.getOpacityOfIcon() )
.endVertex();
vb.pos( par1 + par5, par2 + 0, this.zLevel )
vb.pos( par1 + par5, par2 + 0, zLevel )
.tex( ( par3 + par5 ) * f, ( par4 + 0 ) * f1 )
.color( 1.0f, 1.0f, 1.0f,
aes.getOpacityOfIcon() )
.endVertex();
vb.pos( par1 + 0, par2 + 0, this.zLevel )
vb.pos( par1 + 0, par2 + 0, zLevel )
.tex( ( par3 + 0 ) * f, ( par4 + 0 ) * f1 )
.color( 1.0f, 1.0f, 1.0f,
aes.getOpacityOfIcon() )
@@ -896,7 +882,7 @@ public abstract class AEBaseGui extends ContainerScreen<AEBaseContainer>
{
try
{
isValid = ( (SlotRestrictedInput) s ).isValid( is, this.mc.world );
isValid = ( (SlotRestrictedInput) s ).isValid( is, this.minecraft.world );
}
catch( final Exception err )
{
@@ -908,15 +894,16 @@ public abstract class AEBaseGui extends ContainerScreen<AEBaseContainer>
if( ( (AppEngSlot) s ).getIsValid() == hasCalculatedValidness.Invalid )
{
this.zLevel = 100.0F;
this.itemRender.zLevel = 100.0F;
// FIXME: Test this, the fill function used below does not support setting Z
// FIXME this.zLevel = 100.0F;
this.itemRenderer.zLevel = 100.0F;
GlStateManager.disableLighting();
drawRect( s.xPos, s.yPos, 16 + s.xPos, 16 + s.yPos, 0x66ff6666 );
GlStateManager.enableLighting();
RenderSystem.disableLighting();
fill( s.xPos, s.yPos, 16 + s.xPos, 16 + s.yPos, 0x66ff6666 );
RenderSystem.enableLighting();
this.zLevel = 0.0F;
this.itemRender.zLevel = 0.0F;
// FIXME this.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 )
{
final ResourceLocation loc = new ResourceLocation( AppEng.MOD_ID, "textures/" + file );
this.mc.getTextureManager().bindTexture( loc );
this.minecraft.getTextureManager().bindTexture( loc );
}
protected GuiScrollbar getScrollBar()
@@ -83,7 +83,7 @@ public abstract class AEBaseMEGui extends AEBaseGui
currentToolTip.add( format );
}
this.drawHoveringText( currentToolTip, x, y, this.fontRenderer );
this.drawHoveringText( currentToolTip, x, y, this.font );
return;
}
@@ -95,7 +95,7 @@ public abstract class AEBaseMEGui extends AEBaseGui
currentToolTip.add( TextFormatting.GRAY + format );
this.drawHoveringText( currentToolTip, x, y, this.fontRenderer );
this.drawHoveringText( currentToolTip, x, y, this.font );
return;
}
@@ -69,10 +69,10 @@ public class GuiCellWorkbench extends GuiUpgradeable
.getLocal() );
this.fuzzyMode = new GuiImgButton( this.guiLeft - 18, this.guiTop + 68, Settings.FUZZY_MODE, FuzzyMode.IGNORE_ALL );
this.buttonList.add( this.fuzzyMode );
this.buttonList.add( this.partition );
this.buttonList.add( this.clear );
this.buttonList.add( this.copyMode );
this.addButton( this.fuzzyMode );
this.addButton( this.partition );
this.addButton( this.clear );
this.addButton( this.copyMode );
}
@Override
@@ -57,18 +57,18 @@ public class GuiChest extends AEBaseGui
}
@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
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.fontRenderer.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
this.font.drawString( this.getGuiDisplayName( GuiText.Chest.getLocal() ), 8, 6, 4210752 );
this.font.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
}
@Override
@@ -66,24 +66,24 @@ public class GuiCondenser extends AEBaseGui
}
@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
.getLocal() );
this.mode = new GuiImgButton( 128 + this.guiLeft, 52 + this.guiTop, Settings.CONDENSER_OUTPUT, this.cvc.getOutput() );
this.buttonList.add( this.pb );
this.buttonList.add( this.mode );
this.addButton( this.pb );
this.addButton( this.mode );
}
@Override
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.fontRenderer.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
this.font.drawString( this.getGuiDisplayName( GuiText.Condenser.getLocal() ), 8, 6, 4210752 );
this.font.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
this.mode.set( this.cvc.getOutput() );
this.mode.setFillVar( String.valueOf( this.cvc.getOutput().requiredPower ) );
@@ -25,7 +25,6 @@ import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.item.ItemStack;
import appeng.api.AEApi;
import appeng.api.definitions.IDefinitions;
import appeng.api.definitions.IParts;
import appeng.api.storage.ITerminalHost;
@@ -72,26 +71,26 @@ public class GuiCraftAmount extends AEBaseGui
}
@Override
public void initGui()
public void init()
{
super.initGui();
super.init();
final int a = AEConfig.instance().craftItemsByStackAmounts( 0 );
final int b = AEConfig.instance().craftItemsByStackAmounts( 1 );
final int c = AEConfig.instance().craftItemsByStackAmounts( 2 );
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.buttonList.add( 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.buttonList.add( this.plus1000 = new GuiButton( 0, this.guiLeft + 120, this.guiTop + 26, 38, 20, "+" + d ) );
this.addButton( this.plus1 = new GuiButton( 0, this.guiLeft + 20, this.guiTop + 26, 22, 20, "+" + a ) );
this.addButton( this.plus10 = new GuiButton( 0, this.guiLeft + 48, this.guiTop + 26, 28, 20, "+" + b ) );
this.addButton( this.plus100 = new GuiButton( 0, this.guiLeft + 82, this.guiTop + 26, 32, 20, "+" + c ) );
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.buttonList.add( 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.buttonList.add( this.minus1000 = new GuiButton( 0, this.guiLeft + 120, this.guiTop + 75, 38, 20, "-" + d ) );
this.addButton( this.minus1 = new GuiButton( 0, this.guiLeft + 20, this.guiTop + 75, 22, 20, "-" + a ) );
this.addButton( this.minus10 = new GuiButton( 0, this.guiLeft + 48, this.guiTop + 75, 28, 20, "-" + b ) );
this.addButton( this.minus100 = new GuiButton( 0, this.guiLeft + 82, this.guiTop + 75, 32, 20, "-" + c ) );
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;
final Object target = ( (AEBaseContainer) this.inventorySlots ).getTarget();
@@ -125,10 +124,10 @@ public class GuiCraftAmount extends AEBaseGui
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.setMaxStringLength( 16 );
this.amountToCraft.setTextColor( 0xFFFFFF );
@@ -140,13 +139,13 @@ public class GuiCraftAmount extends AEBaseGui
@Override
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
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.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize );
@@ -230,7 +229,7 @@ public class GuiCraftAmount extends AEBaseGui
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 )
@@ -34,7 +34,6 @@ import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.item.ItemStack;
import appeng.api.AEApi;
import appeng.api.storage.ITerminalHost;
import appeng.api.storage.channels.IItemStorageChannel;
import appeng.api.storage.data.IAEItemStack;
@@ -112,29 +111,29 @@ public class GuiCraftConfirm extends AEBaseGui
}
@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.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
.getLocal() + ": " + GuiText.Automatic );
this.selectCPU.enabled = false;
this.buttonList.add( this.selectCPU );
this.addButton( this.selectCPU );
if( this.OriginalGui != null )
{
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
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();
@@ -172,7 +171,7 @@ public class GuiCraftConfirm extends AEBaseGui
}
}
super.drawScreen( mouseX, mouseY, btn );
super.render( mouseX, mouseY, btn );
}
private void updateCPUButtonText()
@@ -210,7 +209,7 @@ public class GuiCraftConfirm extends AEBaseGui
final long BytesUsed = this.ccc.getUsedBytes();
final String byteUsed = NumberFormat.getInstance().format( BytesUsed );
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;
@@ -224,8 +223,8 @@ public class GuiCraftConfirm extends AEBaseGui
.getLocal() + ": " + this.ccc.getCpuCoProcessors() ) : GuiText.Bytes.getLocal() + ": N/A : " + GuiText.CoProcessors.getLocal() + ": N/A";
}
final int offset = ( 219 - this.fontRenderer.getStringWidth( dsp ) ) / 2;
this.fontRenderer.drawString( dsp, offset, 165, 4210752 );
final int offset = ( 219 - this.font.getStringWidth( dsp ) ) / 2;
this.font.drawString( dsp, offset, 165, 4210752 );
final int sectionLength = 67;
@@ -286,8 +285,8 @@ public class GuiCraftConfirm extends AEBaseGui
}
str = GuiText.FromStorage.getLocal() + ": " + str;
final int w = 4 + this.fontRenderer.getStringWidth( str );
this.fontRenderer.drawString( str, (int) ( ( x * ( 1 + sectionLength ) + xo + sectionLength - 19 - ( w * 0.5 ) ) * 2 ),
final int w = 4 + this.font.getStringWidth( str );
this.font.drawString( str, (int) ( ( x * ( 1 + sectionLength ) + xo + sectionLength - 19 - ( w * 0.5 ) ) * 2 ),
( y * offY + yo + 6 - negY + downY ) * 2, 4210752 );
if( this.tooltip == z - viewStart )
@@ -312,8 +311,8 @@ public class GuiCraftConfirm extends AEBaseGui
}
str = GuiText.Missing.getLocal() + ": " + str;
final int w = 4 + this.fontRenderer.getStringWidth( str );
this.fontRenderer.drawString( str, (int) ( ( x * ( 1 + sectionLength ) + xo + sectionLength - 19 - ( w * 0.5 ) ) * 2 ),
final int w = 4 + this.font.getStringWidth( str );
this.font.drawString( str, (int) ( ( x * ( 1 + sectionLength ) + xo + sectionLength - 19 - ( w * 0.5 ) ) * 2 ),
( y * offY + yo + 6 - negY + downY ) * 2, 4210752 );
if( this.tooltip == z - viewStart )
@@ -338,8 +337,8 @@ public class GuiCraftConfirm extends AEBaseGui
}
str = GuiText.ToCraft.getLocal() + ": " + str;
final int w = 4 + this.fontRenderer.getStringWidth( str );
this.fontRenderer.drawString( str, (int) ( ( x * ( 1 + sectionLength ) + xo + sectionLength - 19 - ( w * 0.5 ) ) * 2 ),
final int w = 4 + this.font.getStringWidth( str );
this.font.drawString( str, (int) ( ( x * ( 1 + sectionLength ) + xo + sectionLength - 19 - ( w * 0.5 ) ) * 2 ),
( y * offY + yo + 6 - negY + downY ) * 2, 4210752 );
if( this.tooltip == z - viewStart )
@@ -373,7 +372,7 @@ public class GuiCraftConfirm extends AEBaseGui
{
final int startX = x * ( 1 + sectionLength ) + xo;
final int startY = posY - 4;
drawRect( startX, startY, startX + sectionLength, startY + offY, 0x1AFF0000 );
fill( startX, startY, startX + sectionLength, startY + offY, 0x1AFF0000 );
}
x++;
@@ -34,7 +34,6 @@ import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.item.ItemStack;
import appeng.api.AEApi;
import appeng.api.config.SortDir;
import appeng.api.config.SortOrder;
import appeng.api.config.ViewItems;
@@ -135,13 +134,13 @@ public class GuiCraftingCPU extends AEBaseGui implements ISortSource
}
@Override
public void initGui()
public void init()
{
super.initGui();
super.init();
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
.getLocal() );
this.buttonList.add( this.cancel );
this.addButton( this.cancel );
}
private void setScrollBar()
@@ -153,7 +152,7 @@ public class GuiCraftingCPU extends AEBaseGui implements ISortSource
}
@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();
@@ -188,7 +187,7 @@ public class GuiCraftingCPU extends AEBaseGui implements ISortSource
}
}
super.drawScreen( mouseX, mouseY, btn );
super.render( mouseX, mouseY, btn );
}
@Override
@@ -203,7 +202,7 @@ public class GuiCraftingCPU extends AEBaseGui implements ISortSource
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 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 startX = ( x * ( 1 + SECTION_LENGTH ) + ITEMSTACK_LEFT_OFFSET ) * 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;
@@ -263,8 +262,8 @@ public class GuiCraftingCPU extends AEBaseGui implements ISortSource
if( stored != null && stored.getStackSize() > 0 )
{
final String str = GuiText.Stored.getLocal() + ": " + converter.toWideReadableForm( stored.getStackSize() );
final int w = 4 + this.fontRenderer.getStringWidth( str );
this.fontRenderer.drawString( str, (int) ( ( x * ( 1 + SECTION_LENGTH ) + ITEMSTACK_LEFT_OFFSET + SECTION_LENGTH - 19 - ( w * 0.5 ) ) * 2 ),
final int w = 4 + this.font.getStringWidth( str );
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 );
if( this.tooltip == z - viewStart )
@@ -278,9 +277,9 @@ public class GuiCraftingCPU extends AEBaseGui implements ISortSource
if( activeStack != null && activeStack.getStackSize() > 0 )
{
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 );
if( this.tooltip == z - viewStart )
@@ -294,9 +293,9 @@ public class GuiCraftingCPU extends AEBaseGui implements ISortSource
if( pendingStack != null && pendingStack.getStackSize() > 0 )
{
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 );
if( this.tooltip == z - viewStart )
@@ -31,7 +31,6 @@ import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.item.ItemStack;
import appeng.api.AEApi;
import appeng.api.definitions.IDefinitions;
import appeng.api.definitions.IParts;
import appeng.api.storage.ITerminalHost;
@@ -123,28 +122,28 @@ public class GuiCraftingStatus extends GuiCraftingCPU
}
@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
.getLocal() + ": " + GuiText.NoCraftingCPUs );
// selectCPU.enabled = false;
this.buttonList.add( this.selectCPU );
this.addButton( this.selectCPU );
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.setHideEdge( 13 );
}
}
@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();
super.drawScreen( mouseX, mouseY, btn );
super.render( mouseX, mouseY, btn );
}
private void updateCPUButtonText()
@@ -73,10 +73,10 @@ public class GuiCraftingTerm extends GuiMEMonitorable
}
@Override
public void initGui()
public void init()
{
super.initGui();
this.buttonList.add( this.clearBtn = new GuiImgButton( this.guiLeft + 92, this.guiTop + this.ySize - 156, Settings.ACTIONS, ActionItems.STASH ) );
super.init();
this.addButton( this.clearBtn = new GuiImgButton( this.guiLeft + 92, this.guiTop + this.ySize - 156, Settings.ACTIONS, ActionItems.STASH ) );
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 )
{
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
@@ -57,18 +57,18 @@ public class GuiDrive extends AEBaseGui
}
@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
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.fontRenderer.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
this.font.drawString( this.getGuiDisplayName( GuiText.Drive.getLocal() ), 8, 6, 4210752 );
this.font.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
}
@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.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.buttonList.add( this.fuzzyMode );
this.addButton( this.placeMode );
this.addButton( this.fuzzyMode );
}
@Override
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.fontRenderer.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
this.font.drawString( this.getGuiDisplayName( GuiText.FormationPlane.getLocal() ), 8, 6, 4210752 );
this.font.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
if( this.fuzzyMode != null )
{
@@ -39,8 +39,8 @@ public class GuiGrinder extends AEBaseGui
@Override
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.fontRenderer.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
this.font.drawString( this.getGuiDisplayName( GuiText.GrindStone.getLocal() ), 8, 6, 4210752 );
this.font.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
}
@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.operationMode = new GuiImgButton( this.guiLeft + 80, this.guiTop + 17, Settings.OPERATION_MODE, OperationMode.EMPTY );
this.buttonList.add( this.operationMode );
this.buttonList.add( this.redstoneMode );
this.buttonList.add( this.fullMode );
this.addButton( this.operationMode );
this.addButton( this.redstoneMode );
this.addButton( this.fullMode );
}
@Override
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.fontRenderer.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
this.font.drawString( this.getGuiDisplayName( GuiText.IOPort.getLocal() ), 8, 6, 4210752 );
this.font.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
if( this.redstoneMode != null )
{
@@ -50,12 +50,12 @@ public class GuiInscriber extends AEBaseGui
}
@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.buttonList.add( this.pb );
this.addButton( this.pb );
}
@Override
@@ -63,8 +63,8 @@ public class GuiInscriber extends AEBaseGui
{
this.pb.setFullMsg( this.cvc.getCurrentProgress() * 100 / this.cvc.getMaxProgress() + "%" );
this.fontRenderer.drawString( this.getGuiDisplayName( GuiText.Inscriber.getLocal() ), 8, 6, 4210752 );
this.fontRenderer.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
this.font.drawString( this.getGuiDisplayName( GuiText.Inscriber.getLocal() ), 8, 6, 4210752 );
this.font.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
}
@Override
@@ -57,14 +57,14 @@ public class GuiInterface extends GuiUpgradeable
protected void addButtons()
{
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.buttonList.add( this.BlockMode );
this.addButton( this.BlockMode );
this.interfaceMode = new GuiToggleButton( this.guiLeft - 18, this.guiTop + 26, 84, 85, GuiText.InterfaceTerminal
.getLocal(), GuiText.InterfaceTerminalHint.getLocal() );
this.buttonList.add( this.interfaceMode );
this.addButton( this.interfaceMode );
}
@Override
@@ -80,13 +80,13 @@ public class GuiInterface extends GuiUpgradeable
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.fontRenderer.drawString( GuiText.StoredItems.getLocal(), 8, 6 + 60 + 7, 4210752 );
this.fontRenderer.drawString( GuiText.Patterns.getLocal(), 8, 6 + 73 + 7, 4210752 );
this.font.drawString( GuiText.Config.getLocal(), 8, 6 + 11 + 7, 4210752 );
this.font.drawString( GuiText.StoredItems.getLocal(), 8, 6 + 60 + 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
@@ -36,9 +36,8 @@ import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
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.client.gui.AEBaseGui;
import appeng.client.gui.widgets.GuiScrollbar;
@@ -80,15 +79,15 @@ public class GuiInterfaceTerminal extends AEBaseGui
}
@Override
public void initGui()
public void init()
{
super.initGui();
super.init();
this.getScrollBar().setLeft( 175 );
this.getScrollBar().setHeight( 106 );
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.setMaxStringLength( 25 );
this.searchField.setTextColor( 0xFFFFFF );
@@ -99,8 +98,8 @@ public class GuiInterfaceTerminal extends AEBaseGui
@Override
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.fontRenderer.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
this.font.drawString( this.getGuiDisplayName( GuiText.InterfaceTerminal.getLocal() ), 8, 6, 4210752 );
this.font.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
final int ex = this.getScrollBar().getCurrentScroll();
@@ -134,12 +133,12 @@ public class GuiInterfaceTerminal extends AEBaseGui
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 );
}
this.fontRenderer.drawString( name, 10, 6 + offset, 4210752 );
this.font.drawString( name, 10, 6 + offset, 4210752 );
}
offset += 18;
}
@@ -175,7 +174,7 @@ public class GuiInterfaceTerminal extends AEBaseGui
{
final ClientDCInternalInv inv = (ClientDCInternalInv) lineObj;
GlStateManager.color( 1, 1, 1, 1 );
RenderSystem.color4f( 1, 1, 1, 1 );
final int width = inv.getInventory().getSlots() * 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
// NBTTagList inTag = encodedValue.getTagList( "in", 10 );
final NBTTagList outTag = encodedValue.getTagList( "out", 10 );
// ListNBT inTag = encodedValue.getTagList( "in", 10 );
final ListNBT outTag = encodedValue.getTagList( "out", 10 );
for( int i = 0; i < outTag.tagCount(); i++ )
{
@@ -67,11 +67,11 @@ public class GuiLevelEmitter extends GuiUpgradeable
}
@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.setMaxStringLength( 16 );
this.level.setTextColor( 0xFFFFFF );
@@ -93,20 +93,20 @@ public class GuiLevelEmitter extends GuiUpgradeable
final int c = AEConfig.instance().levelByStackAmounts( 2 );
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.buttonList.add( 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.buttonList.add( this.plus1000 = new GuiButton( 0, this.guiLeft + 120, this.guiTop + 17, 38, 20, "+" + d ) );
this.addButton( this.plus1 = new GuiButton( 0, this.guiLeft + 20, this.guiTop + 17, 22, 20, "+" + a ) );
this.addButton( this.plus10 = new GuiButton( 0, this.guiLeft + 48, this.guiTop + 17, 28, 20, "+" + b ) );
this.addButton( this.plus100 = new GuiButton( 0, this.guiLeft + 82, this.guiTop + 17, 32, 20, "+" + c ) );
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.buttonList.add( 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.buttonList.add( this.minus1000 = new GuiButton( 0, this.guiLeft + 120, this.guiTop + 59, 38, 20, "-" + d ) );
this.addButton( this.minus1 = new GuiButton( 0, this.guiLeft + 20, this.guiTop + 59, 22, 20, "-" + a ) );
this.addButton( this.minus10 = new GuiButton( 0, this.guiLeft + 48, this.guiTop + 59, 28, 20, "-" + b ) );
this.addButton( this.minus100 = new GuiButton( 0, this.guiLeft + 82, this.guiTop + 59, 32, 20, "-" + c ) );
this.addButton( this.minus1000 = new GuiButton( 0, this.guiLeft + 120, this.guiTop + 59, 38, 20, "-" + d ) );
this.buttonList.add( this.levelMode );
this.buttonList.add( this.redstoneMode );
this.buttonList.add( this.fuzzyMode );
this.buttonList.add( this.craftingMode );
this.addButton( this.levelMode );
this.addButton( this.redstoneMode );
this.addButton( this.fuzzyMode );
this.addButton( this.craftingMode );
}
@Override
@@ -45,19 +45,19 @@ public class GuiMAC extends GuiUpgradeable
}
@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.buttonList.add( this.pb );
this.addButton( this.pb );
}
@Override
protected void addButtons()
{
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
@@ -219,12 +219,12 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
private void reinitalize()
{
this.buttonList.clear();
this.initGui();
this.buttons.clear();
this.init();
}
@Override
public void initGui()
public void init()
{
Keyboard.enableRepeatEvents( true );
@@ -266,7 +266,7 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
this.xSize = this.standardSize;
}
super.initGui();
super.init();
// full size : 204
// extra slots : 72
// slot 18
@@ -292,11 +292,11 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
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 ) ) );
offset += 20;
this.buttonList.add(
this.addButton(
this.searchBoxSettings = new GuiImgButton( this.guiLeft - 18, offset, Settings.SEARCH_MODE, AEConfig.instance()
.getConfigManager()
.getSetting(
@@ -306,12 +306,12 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
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()
.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.setMaxStringLength( 25 );
this.searchField.setTextColor( 0xFFFFFF );
@@ -320,7 +320,7 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
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 ) );
this.craftingStatusBtn.setHideEdge( 13 );
}
@@ -379,8 +379,8 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
@Override
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.fontRenderer.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
this.font.drawString( this.getGuiDisplayName( this.myName.getLocal() ), 8, 6, 4210752 );
this.font.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
this.currentMouseX = mouseX;
this.currentMouseY = mouseY;
@@ -403,9 +403,9 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
}
@Override
public void onGuiClosed()
public void removed()
{
super.onGuiClosed();
super.removed();
Keyboard.enableRepeatEvents( false );
memoryText = this.searchField.getText();
}
@@ -84,16 +84,16 @@ public class GuiNetworkStatus extends AEBaseGui implements ISortSource
}
@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.buttonList.add( this.units );
this.addButton( this.units );
}
@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;
@@ -126,7 +126,7 @@ public class GuiNetworkStatus extends AEBaseGui implements ISortSource
}
}
super.drawScreen( mouseX, mouseY, btn );
super.render( mouseX, mouseY, btn );
}
@Override
@@ -134,14 +134,14 @@ public class GuiNetworkStatus extends AEBaseGui implements ISortSource
{
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.fontRenderer.drawString( GuiText.MaxPower.getLocal() + ": " + Platform.formatPowerLong( ns.getMaxPower(), false ), 13, 26, 4210752 );
this.font.drawString( GuiText.StoredPower.getLocal() + ": " + Platform.formatPowerLong( ns.getCurrentPower(), false ), 13, 16, 4210752 );
this.font.drawString( GuiText.MaxPower.getLocal() + ": " + Platform.formatPowerLong( ns.getMaxPower(), false ), 13, 26, 4210752 );
this.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 );
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;
@@ -170,8 +170,8 @@ public class GuiNetworkStatus extends AEBaseGui implements ISortSource
str = Long.toString( refStack.getStackSize() / 1000 ) + 'k';
}
final int w = this.fontRenderer.getStringWidth( str );
this.fontRenderer.drawString( str, (int) ( ( x * sectionLength + xo + sectionLength - 19 - ( w * 0.5 ) ) * 2 ), ( y * 18 + yo + 6 ) * 2,
final int w = this.font.getStringWidth( str );
this.font.drawString( str, (int) ( ( x * sectionLength + xo + sectionLength - 19 - ( w * 0.5 ) ) * 2 ), ( y * 18 + yo + 6 ) * 2,
4210752 );
GlStateManager.popMatrix();
@@ -257,8 +257,8 @@ public class GuiNetworkStatus extends AEBaseGui implements ISortSource
if( myStack != null )
{
ITooltipFlag.TooltipFlags tooltipFlag = this.mc.gameSettings.advancedItemTooltips ? ITooltipFlag.TooltipFlags.ADVANCED : ITooltipFlag.TooltipFlags.NORMAL;
List<String> currentToolTip = stack.getTooltip( this.mc.player, tooltipFlag );
ITooltipFlag.TooltipFlags tooltipFlag = this.minecraft.gameSettings.advancedItemTooltips ? ITooltipFlag.TooltipFlags.ADVANCED : ITooltipFlag.TooltipFlags.NORMAL;
List<String> currentToolTip = stack.getTooltip( this.minecraft.player, tooltipFlag );
while( currentToolTip.size() > 1 )
{
@@ -64,14 +64,14 @@ public class GuiNetworkTool extends AEBaseGui
}
@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
.getLocal() );
this.buttonList.add( this.tFacades );
this.addButton( this.tFacades );
}
@Override
@@ -82,8 +82,8 @@ public class GuiNetworkTool extends AEBaseGui
this.tFacades.setState( ( (ContainerNetworkTool) this.inventorySlots ).isFacadeMode() );
}
this.fontRenderer.drawString( this.getGuiDisplayName( GuiText.NetworkTool.getLocal() ), 8, 6, 4210752 );
this.fontRenderer.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
this.font.drawString( this.getGuiDisplayName( GuiText.NetworkTool.getLocal() ), 8, 6, 4210752 );
this.font.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
}
@Override
@@ -107,32 +107,32 @@ public class GuiPatternTerm extends GuiMEMonitorable
}
@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
.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
.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.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.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.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.buttonList.add( this.encodeBtn );
this.addButton( this.encodeBtn );
}
@Override
@@ -163,7 +163,7 @@ public class GuiPatternTerm extends GuiMEMonitorable
}
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
@@ -62,24 +62,24 @@ public class GuiPriority extends AEBaseGui
}
@Override
public void initGui()
public void init()
{
super.initGui();
super.init();
final int a = AEConfig.instance().priorityByStacksAmounts( 0 );
final int b = AEConfig.instance().priorityByStacksAmounts( 1 );
final int c = AEConfig.instance().priorityByStacksAmounts( 2 );
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.buttonList.add( 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.buttonList.add( this.plus1000 = new GuiButton( 0, this.guiLeft + 120, this.guiTop + 32, 38, 20, "+" + d ) );
this.addButton( this.plus1 = new GuiButton( 0, this.guiLeft + 20, this.guiTop + 32, 22, 20, "+" + a ) );
this.addButton( this.plus10 = new GuiButton( 0, this.guiLeft + 48, this.guiTop + 32, 28, 20, "+" + b ) );
this.addButton( this.plus100 = new GuiButton( 0, this.guiLeft + 82, this.guiTop + 32, 32, 20, "+" + c ) );
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.buttonList.add( 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.buttonList.add( this.minus1000 = new GuiButton( 0, this.guiLeft + 120, this.guiTop + 69, 38, 20, "-" + d ) );
this.addButton( this.minus1 = new GuiButton( 0, this.guiLeft + 20, this.guiTop + 69, 22, 20, "-" + a ) );
this.addButton( this.minus10 = new GuiButton( 0, this.guiLeft + 48, this.guiTop + 69, 28, 20, "-" + b ) );
this.addButton( this.minus100 = new GuiButton( 0, this.guiLeft + 82, this.guiTop + 69, 32, 20, "-" + c ) );
this.addButton( this.minus1000 = new GuiButton( 0, this.guiLeft + 120, this.guiTop + 69, 38, 20, "-" + d ) );
final ContainerPriority con = ( (ContainerPriority) this.inventorySlots );
final ItemStack myIcon = con.getPriorityHost().getItemStackRepresentation();
@@ -87,10 +87,10 @@ public class GuiPriority extends AEBaseGui
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.setMaxStringLength( 16 );
this.priority.setTextColor( 0xFFFFFF );
@@ -102,7 +102,7 @@ public class GuiPriority extends AEBaseGui
@Override
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
@@ -39,8 +39,8 @@ public class GuiQNB extends AEBaseGui
@Override
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.fontRenderer.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
this.font.drawString( this.getGuiDisplayName( GuiText.QuantumLinkChamber.getLocal() ), 8, 6, 4210752 );
this.font.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
}
@Override
@@ -45,11 +45,11 @@ public class GuiQuartzKnife extends AEBaseGui
}
@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.setMaxStringLength( 32 );
this.name.setTextColor( 0xFFFFFF );
@@ -60,8 +60,8 @@ public class GuiQuartzKnife extends AEBaseGui
@Override
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.fontRenderer.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
this.font.drawString( this.getGuiDisplayName( GuiText.QuartzCuttingKnife.getLocal() ), 8, 6, 4210752 );
this.font.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
}
@Override
@@ -96,24 +96,24 @@ public class GuiSecurityStation extends GuiMEMonitorable
}
@Override
public void initGui()
public void init()
{
super.initGui();
super.init();
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() ) );
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() ) );
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() ) );
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() ) );
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() ) );
}
@@ -121,7 +121,7 @@ public class GuiSecurityStation extends GuiMEMonitorable
public void drawFG( final int offsetX, final int offsetY, final int mouseX, final int 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
@@ -40,8 +40,8 @@ public class GuiSkyChest extends AEBaseGui
@Override
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.fontRenderer.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 2, 4210752 );
this.font.drawString( this.getGuiDisplayName( GuiText.SkyChest.getLocal() ), 8, 8, 4210752 );
this.font.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 2, 4210752 );
}
@Override
@@ -64,35 +64,35 @@ public class GuiSpatialIOPort extends AEBaseGui
}
@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.buttonList.add( this.units );
this.addButton( this.units );
}
@Override
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 );
this.fontRenderer.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.MaxPower.getLocal() + ": " + Platform.formatPowerLong( this.container.getMaxPower(), false ), 13, 31, 4210752 );
this.font.drawString( GuiText.RequiredPower.getLocal() + ": " + Platform.formatPowerLong( this.container.getRequiredPower(), false ), 13, 73,
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.fontRenderer.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96, 4210752 );
this.font.drawString( this.getGuiDisplayName( GuiText.SpatialIOPort.getLocal() ), 8, 6, 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 )
{
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
{
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.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.buttonList.add( this.fuzzyMode );
this.buttonList.add( this.rwMode );
this.buttonList.add( this.partition );
this.buttonList.add( this.clear );
this.addButton( this.storageFilter );
this.addButton( this.fuzzyMode );
this.addButton( this.rwMode );
this.addButton( this.partition );
this.addButton( this.clear );
}
@Override
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.fontRenderer.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
this.font.drawString( this.getGuiDisplayName( GuiText.StorageBus.getLocal() ), 8, 6, 4210752 );
this.font.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
if( this.fuzzyMode != null )
{
@@ -75,9 +75,9 @@ public class GuiUpgradeable extends AEBaseGui
}
@Override
public void initGui()
public void init()
{
super.initGui();
super.init();
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.schedulingMode = new GuiImgButton( this.guiLeft - 18, this.guiTop + 68, Settings.SCHEDULING_MODE, SchedulingMode.DEFAULT );
this.buttonList.add( this.craftMode );
this.buttonList.add( this.redstoneMode );
this.buttonList.add( this.fuzzyMode );
this.buttonList.add( this.schedulingMode );
this.addButton( this.craftMode );
this.addButton( this.redstoneMode );
this.addButton( this.fuzzyMode );
this.addButton( this.schedulingMode );
}
@Override
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.fontRenderer.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
this.font.drawString( this.getGuiDisplayName( this.getName().getLocal() ), 8, 6, 4210752 );
this.font.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
if( this.redstoneMode != null )
{
@@ -44,19 +44,19 @@ public class GuiVibrationChamber extends AEBaseGui
}
@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.buttonList.add( this.pb );
this.addButton( this.pb );
}
@Override
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.fontRenderer.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
this.font.drawString( this.getGuiDisplayName( GuiText.VibrationChamber.getLocal() ), 8, 6, 4210752 );
this.font.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
this.pb.setFullMsg( TileVibrationChamber.POWER_PER_TICK * this.cvc.getCurrentProgress() / TileVibrationChamber.DILATION_SCALING + " AE/t" );
@@ -64,7 +64,7 @@ public class GuiVibrationChamber extends AEBaseGui
{
final int i1 = this.cvc.getRemainingBurnTime() * 12 / 100;
this.bindTexture( "guis/vibchamber.png" );
GlStateManager.color( 1, 1, 1 );
RenderSystem.color4f( 1, 1, 1 );
final int l = -15;
final int k = 25;
this.drawTexturedModalRect( k + 56, l + 36 + 12 - i1, 176, 12 - i1, 14, i1 + 2 );
@@ -62,19 +62,19 @@ public class GuiWireless extends AEBaseGui
}
@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.buttonList.add( this.units );
this.addButton( this.units );
}
@Override
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.fontRenderer.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
this.font.drawString( this.getGuiDisplayName( GuiText.Wireless.getLocal() ), 8, 6, 4210752 );
this.font.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
final ContainerWireless cw = (ContainerWireless) this.inventorySlots;
@@ -83,10 +83,10 @@ public class GuiWireless extends AEBaseGui
final String firstMessage = GuiText.Range.getLocal() + ": " + ( cw.getRange() / 10.0 ) + " m";
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 );
this.fontRenderer.drawString( firstMessage, cOffset, 20, 4210752 );
this.fontRenderer.drawString( secondMessage, cOffset, 20 + 12, 4210752 );
this.font.drawString( firstMessage, cOffset, 20, 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.gui.Gui;
import net.minecraft.client.gui.AbstractGui;
import net.minecraft.entity.player.PlayerEntity;
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 y;
@@ -210,11 +210,11 @@ public class GuiImgButton extends Button implements ITooltip
if( this.enabled )
{
GlStateManager.color( 1.0f, 1.0f, 1.0f, 1.0f );
RenderSystem.color4f( 1.0f, 1.0f, 1.0f, 1.0f );
}
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" ) );
@@ -233,11 +233,11 @@ public class GuiImgButton extends Button implements ITooltip
{
if( this.enabled )
{
GlStateManager.color( 1.0f, 1.0f, 1.0f, 1.0f );
RenderSystem.color4f( 1.0f, 1.0f, 1.0f, 1.0f );
}
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" ) );
@@ -251,7 +251,7 @@ public class GuiImgButton extends Button implements ITooltip
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()
@@ -19,9 +19,10 @@
package appeng.client.gui.widgets;
import net.minecraft.client.renderer.GlStateManager;
import com.mojang.blaze3d.systems.RenderSystem;
import appeng.client.gui.AEBaseGui;
import net.minecraftforge.fml.client.gui.GuiUtils;
public class GuiScrollbar implements IScrollSource
@@ -40,16 +41,16 @@ public class GuiScrollbar implements IScrollSource
public void draw( final AEBaseGui g )
{
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 )
{
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
{
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;
}
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 )
{
@@ -138,7 +139,7 @@ public class GuiScrollbar implements IScrollSource
{
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.currentScroll + 1 ) >> 1;
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 );
this.currentScroll += delta * this.pageSize;
@@ -75,7 +75,7 @@ public class GuiTabButton extends Button implements ITooltip
{
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" ) );
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.itemRenderer.zLevel = 100.0F;
GlStateManager.enableDepth();
RenderSystem.enableDepthTest();
RenderHelper.enableGUIStandardItemLighting();
this.itemRenderer.renderItemAndEffectIntoGUI( this.myItem, offsetX + this.x + 3, this.y + 3 );
GlStateManager.disableDepth();
RenderSystem.disableDepthTest();
this.itemRenderer.zLevel = 0.0F;
this.zLevel = 0.0F;
@@ -64,7 +64,7 @@ public class GuiToggleButton extends Button implements ITooltip
{
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" ) );
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() )
{
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 );
}
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 );
}
super.drawTextBox();
@@ -172,7 +172,7 @@ public class MEGuiTextField extends TextFieldWidget
float green = ( this.selectionColor & 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.enableColorLogic();
GlStateManager.colorLogicOp( GlStateManager.LogicOp.OR_REVERSE );
@@ -183,7 +183,7 @@ public class MEGuiTextField extends TextFieldWidget
bufferbuilder.pos( startX, startY, 0.0D ).endVertex();
tessellator.draw();
GlStateManager.disableColorLogic();
GlStateManager.enableTexture2D();
RenderSystem.enableTexture();
}
}
+2 -2
View File
@@ -26,6 +26,7 @@ import java.util.regex.Pattern;
import javax.annotation.Nonnull;
import appeng.core.Api;
import net.minecraft.item.ItemStack;
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.ISortSource;
import appeng.core.AEConfig;
import appeng.integration.Integrations;
import appeng.items.storage.ItemViewCell;
import appeng.util.ItemSorters;
import appeng.util.Platform;
@@ -232,7 +232,7 @@ public class ItemRepo
private void updateJEI( String filter )
{
Integrations.jei().setSearchText( filter );
// FIXME Integrations.jei().setSearchText( filter );
}
public int size()
@@ -24,7 +24,6 @@ import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import appeng.container.slot.AppEngSlot;
import appeng.items.misc.ItemEncodedPattern;
import appeng.util.Platform;
@@ -63,15 +62,15 @@ public class SlotDisconnected extends AppEngSlot
if( Platform.isClient() )
{
final ItemStack is = super.getStack();
if( !is.isEmpty() && is.getItem() instanceof ItemEncodedPattern )
{
final ItemEncodedPattern iep = (ItemEncodedPattern) is.getItem();
final ItemStack out = iep.getOutput( is );
if( !out.isEmpty() )
{
return out;
}
}
// FIXME if( !is.isEmpty() && is.getItem() instanceof ItemEncodedPattern )
// FIXME {
// FIXME final ItemEncodedPattern iep = (ItemEncodedPattern) is.getItem();
// FIXME final ItemStack out = iep.getOutput( is );
// FIXME if( !out.isEmpty() )
// FIXME {
// FIXME return out;
// FIXME }
// FIXME }
}
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.vertex.VertexFormat;
import net.minecraft.entity.LivingEntity;
import net.minecraft.fluid.Fluids;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Direction;
import net.minecraft.util.ResourceLocation;
@@ -101,7 +102,7 @@ public class DummyFluidDispatcherBakedModel extends DelegateBakedModel
FluidStack fluidStack = itemFacade.getFluidStack( stack );
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 ) );
@@ -73,9 +73,9 @@ public class SpatialSkyRender extends IRenderHandler
GlStateManager.disableFog();
GlStateManager.disableAlpha();
GlStateManager.disableBlend();
RenderSystem.disableBlend();
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 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();
tessellator.draw();
GlStateManager.enableTexture2D();
RenderSystem.enableTexture();
GlStateManager.popMatrix();
}
@@ -127,24 +127,24 @@ public class SpatialSkyRender extends IRenderHandler
{
GlStateManager.disableFog();
GlStateManager.disableAlpha();
GlStateManager.enableBlend();
RenderSystem.enableBlend();
GlStateManager.disableTexture2D();
GlStateManager.depthMask( false );
OpenGlHelper.glBlendFunc( GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0 );
RenderHelper.disableStandardItemLighting();
GlStateManager.color( fade, fade, fade, 1.0f );
RenderSystem.color4f( fade, fade, fade, 1.0f );
GlStateManager.callList( this.dspList );
}
GlStateManager.depthMask( true );
GlStateManager.enableBlend();
RenderSystem.enableBlend();
GlStateManager.enableAlpha();
GlStateManager.enableTexture2D();
RenderSystem.enableTexture();
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()
@@ -56,36 +56,36 @@ public class StackSizeRenderer
{
final String craftLabelText = AEConfig.instance().useTerminalUseLargeFont() ? GuiText.LargeFontCraft.getLocal() : GuiText.SmallFontCraft
.getLocal();
GlStateManager.disableLighting();
GlStateManager.disableDepth();
GlStateManager.disableBlend();
RenderSystem.disableLighting();
RenderSystem.disableDepthTest();
RenderSystem.disableBlend();
GlStateManager.pushMatrix();
GlStateManager.scale( scaleFactor, scaleFactor, scaleFactor );
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 );
fontRenderer.drawStringWithShadow( craftLabelText, X, Y, 16777215 );
GlStateManager.popMatrix();
GlStateManager.enableLighting();
GlStateManager.enableDepth();
GlStateManager.enableBlend();
RenderSystem.enableLighting();
RenderSystem.enableDepthTest();
RenderSystem.enableBlend();
}
if( aeStack.getStackSize() > 0 )
{
final String stackSize = this.getToBeRenderedStackSize( aeStack.getStackSize() );
GlStateManager.disableLighting();
GlStateManager.disableDepth();
GlStateManager.disableBlend();
RenderSystem.disableLighting();
RenderSystem.disableDepthTest();
RenderSystem.disableBlend();
GlStateManager.pushMatrix();
GlStateManager.scale( scaleFactor, scaleFactor, scaleFactor );
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 );
fontRenderer.drawStringWithShadow( stackSize, X, Y, 16777215 );
GlStateManager.popMatrix();
GlStateManager.enableLighting();
GlStateManager.enableDepth();
GlStateManager.enableBlend();
RenderSystem.enableLighting();
RenderSystem.enableDepthTest();
RenderSystem.enableBlend();
}
fontRenderer.setUnicodeFlag( unicodeFlag );
@@ -145,7 +145,7 @@ class ItemEncodedPatternBakedModel implements IBakedModel
// Now retroactively handle the isGui3d call, for which we always return false below
if( selectedModel.isGui3d() != ItemEncodedPatternBakedModel.this.baseModel.isGui3d() )
{
GlStateManager.enableLighting();
RenderSystem.enableLighting();
}
if( selectedModel instanceof IBakedModel )
@@ -54,8 +54,8 @@ public class CrankTESR extends TileEntityRenderer<TileCrank>
Tessellator tessellator = Tessellator.getInstance();
this.bindTexture( TextureMap.LOCATION_BLOCKS_TEXTURE );
RenderHelper.disableStandardItemLighting();
GlStateManager.blendFunc( GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA );
GlStateManager.enableBlend();
RenderSystem.blendFunc( GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA );
RenderSystem.enableBlend();
GlStateManager.disableCull();
if( Minecraft.isAmbientOcclusionEnabled() )
@@ -50,8 +50,8 @@ public final class InscriberTESR extends TileEntityRenderer<TileInscriber>
FacingToRotation.get( tile.getForward(), tile.getUp() ).glRotateCurrentMat();
GlStateManager.translate( -0.5F, -0.5F, -0.5F );
GlStateManager.color( 1.0F, 1.0F, 1.0F, 1.0F );
GlStateManager.disableLighting();
RenderSystem.color4f( 1.0F, 1.0F, 1.0F, 1.0F );
RenderSystem.disableLighting();
GlStateManager.disableRescaleNormal();
// render sides of stamps
@@ -128,7 +128,7 @@ public final class InscriberTESR extends TileEntityRenderer<TileInscriber>
Tessellator.getInstance().draw();
// 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();
@@ -169,7 +169,7 @@ public final class InscriberTESR extends TileEntityRenderer<TileInscriber>
}
GlStateManager.popMatrix();
GlStateManager.enableLighting();
RenderSystem.enableLighting();
GlStateManager.enableRescaleNormal();
}
@@ -960,7 +960,7 @@ public abstract class AEBaseContainer extends Container
break;
case CREATIVE_DUPLICATE:
if( player.capabilities.isCreativeMode && slotItem != null )
if( player.abilities.isCreativeMode && slotItem != null )
{
final ItemStack is = slotItem.createItemStack();
is.setCount( is.getMaxStackSize() );
@@ -297,7 +297,7 @@ public final class ContainerInterfaceTerminal extends AEBaseContainer
break;
case CREATIVE_DUPLICATE:
if( player.capabilities.isCreativeMode && !hasItemInHand )
if( player.abilities.isCreativeMode && !hasItemInHand )
{
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.nbt.NBTBase;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.nbt.ListNBT;
import net.minecraft.world.World;
import net.minecraftforge.items.IItemHandler;
import net.minecraftforge.items.wrapper.PlayerInvWrapper;
@@ -248,8 +248,8 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
// encode the slot.
final CompoundNBT encodedValue = new CompoundNBT();
final NBTTagList tagIn = new NBTTagList();
final NBTTagList tagOut = new NBTTagList();
final ListNBT tagIn = new ListNBT();
final ListNBT tagOut = new ListNBT();
for( final ItemStack i : in )
{
+4
View File
@@ -28,6 +28,7 @@ import appeng.core.features.AEFeature;
import appeng.server.ServerHelper;
import net.minecraft.block.Block;
import net.minecraft.entity.EntityType;
import net.minecraft.inventory.container.ContainerType;
import net.minecraft.item.Item;
import net.minecraft.particles.ParticleType;
import net.minecraft.stats.StatType;
@@ -121,6 +122,9 @@ public final class AppEng
private void clientSetup(FMLClientSetupEvent event) {
final ApiDefinitions definitions = Api.INSTANCE.definitions();
definitions.getRegistry().getBootstrapComponents( IClientSetupComponent.class ).forEachRemaining(IClientSetupComponent::setup);
}
// @Nonnull
@@ -25,7 +25,6 @@ import appeng.api.definitions.ITileDefinition;
import appeng.block.misc.BlockQuartzFixture;
import appeng.block.spatial.BlockMatrixFrame;
import appeng.block.storage.BlockSkyChest;
import appeng.block.storage.SkyChestRenderingCustomizer;
import appeng.bootstrap.*;
import appeng.bootstrap.definitions.TileEntityDefinition;
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 ) )
.features( AEFeature.SKY_STONE, AEFeature.SKY_STONE_CHESTS )
.tileEntity( skyChestTile )
// .rendering( new SkyChestRenderingCustomizer( BlockSkyChest.SkyChestType.STONE ) )
.build();
this.smoothSkyStoneChest = registry.block( "smooth_sky_stone_chest", () -> new BlockSkyChest( BlockSkyChest.SkyChestType.BLOCK, skyStoneChestProps ) )
.features( AEFeature.SKY_STONE, AEFeature.SKY_STONE_CHESTS )
.tileEntity( skyChestTile )
// .rendering( new SkyChestRenderingCustomizer( BlockSkyChest.SkyChestType.BLOCK ) )
.build();
// 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.util.math.BlockPos;
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.config.SecurityPermissions;
@@ -125,7 +123,7 @@ import appeng.tile.storage.TileSkyChest;
import appeng.util.Platform;
public enum GuiBridge implements IGuiHandler
public enum GuiBridge
{
GUI_Handler(),
@@ -33,7 +33,7 @@ import net.minecraft.inventory.Container;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompressedStreamTools;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.nbt.ListNBT;
import net.minecraft.network.PacketBuffer;
import net.minecraftforge.items.IItemHandler;
@@ -73,7 +73,7 @@ public class PacketJEIRecipe extends AppEngPacket
this.recipe = new ItemStack[9][];
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 )
{
this.recipe[x] = new ItemStack[list.tagCount()];
@@ -25,13 +25,11 @@ import java.util.UUID;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import com.electronwill.nightconfig.core.file.CommentedFileConfig;
import com.google.common.base.Preconditions;
import com.mojang.authlib.GameProfile;
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;
@@ -51,38 +49,37 @@ final class PlayerData implements IWorldPlayerData, IOnWorldStartable, IOnWorldS
private static final String LAST_PLAYER_KEY = "lastPlayer";
private static final int LAST_PLAYER_DEFAULT = 0;
private final Configuration config;
private final IWorldPlayerMapping playerMapping;
private final CommentedFileConfig config;
// FIXME private final IWorldPlayerMapping playerMapping;
private int lastPlayerID;
public PlayerData( @Nonnull final Configuration configFile )
public PlayerData( @Nonnull final CommentedFileConfig configFile )
{
Preconditions.checkNotNull( configFile );
this.config = configFile;
final ConfigCategory playerList = this.config.getCategory( "players" );
this.playerMapping = new PlayerMapping( playerList );
// FIXME this.playerMapping = new PlayerMapping( config, "players." );
}
@Nullable
@Override
public PlayerEntity getPlayerFromID( final int playerID )
{
final Optional<UUID> maybe = this.playerMapping.get( playerID );
if( maybe.isPresent() )
{
final UUID uuid = maybe.get();
for( final PlayerEntity player : AppEng.proxy.getPlayers() )
{
if( player.getUniqueID().equals( uuid ) )
{
return player;
}
}
}
// FIXME final Optional<UUID> maybe = this.playerMapping.get( playerID );
// FIXME
// FIXME if( maybe.isPresent() )
// FIXME {
// FIXME final UUID uuid = maybe.get();
// FIXME for( final PlayerEntity player : AppEng.proxy.getPlayers() )
// FIXME {
// FIXME if( player.getUniqueID().equals( uuid ) )
// FIXME {
// FIXME return player;
// FIXME }
// FIXME }
// FIXME }
return null;
}
@@ -90,42 +87,44 @@ final class PlayerData implements IWorldPlayerData, IOnWorldStartable, IOnWorldS
@Override
public int getPlayerID( @Nonnull final GameProfile profile )
{
Preconditions.checkNotNull( profile );
Preconditions.checkNotNull( this.config.getCategory( "players" ) );
Preconditions.checkState( profile.isComplete() );
final ConfigCategory players = this.config.getCategory( "players" );
final String uuid = profile.getId().toString();
final Property maybePlayerID = players.get( uuid );
if( maybePlayerID != null && maybePlayerID.isIntValue() )
{
return maybePlayerID.getInt();
}
else
{
final int newPlayerID = this.nextPlayer();
final Property newPlayer = new Property( uuid, String.valueOf( newPlayerID ), Property.Type.INTEGER );
players.put( uuid, newPlayer );
this.playerMapping.put( newPlayerID, profile.getId() ); // add to reverse map
this.config.save();
return newPlayerID;
}
return -1;
// FIXME Preconditions.checkNotNull( profile );
// FIXME Preconditions.checkNotNull( this.config.getCategory( "players" ) );
// FIXME Preconditions.checkState( profile.isComplete() );
// FIXME
// FIXME final ConfigCategory players = this.config.getCategory( "players" );
// FIXME final String uuid = profile.getId().toString();
// FIXME final Property maybePlayerID = players.get( uuid );
// FIXME
// FIXME if( maybePlayerID != null && maybePlayerID.isIntValue() )
// FIXME {
// FIXME return maybePlayerID.getInt();
// FIXME }
// FIXME else
// FIXME {
// FIXME final int newPlayerID = this.nextPlayer();
// FIXME final Property newPlayer = new Property( uuid, String.valueOf( newPlayerID ), Property.Type.INTEGER );
// FIXME players.put( uuid, newPlayer );
// FIXME this.playerMapping.put( newPlayerID, profile.getId() ); // add to reverse map
// FIXME this.config.save();
// FIXME
// FIXME return newPlayerID;
// FIXME }
}
private int nextPlayer()
{
final int r = this.lastPlayerID;
this.lastPlayerID++;
this.config.get( LAST_PLAYER_CATEGORY, LAST_PLAYER_KEY, this.lastPlayerID ).set( this.lastPlayerID );
return r;
// FIXME final int r = this.lastPlayerID;
// FIXME this.lastPlayerID++;
// FIXME this.config.get( LAST_PLAYER_CATEGORY, LAST_PLAYER_KEY, this.lastPlayerID ).set( this.lastPlayerID );
// FIXME return r;
return 0;
}
@Override
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();
}
@@ -25,10 +25,9 @@ import java.util.UUID;
import javax.annotation.Nonnull;
import com.electronwill.nightconfig.core.Config;
import com.google.common.base.Preconditions;
import net.minecraftforge.common.config.ConfigCategory;
/**
* Wrapper class for the player mappings.
@@ -44,9 +43,9 @@ final class PlayerMapping implements IWorldPlayerMapping
*/
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();
}
@@ -23,11 +23,9 @@ import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import net.minecraftforge.common.config.ConfigCategory;
import net.minecraftforge.common.config.Property;
import com.electronwill.nightconfig.core.Config;
import appeng.core.AELog;
import appeng.util.UUIDMatcher;
/**
@@ -38,7 +36,7 @@ class PlayerMappingsInitializer
/**
* Internal immutable mapping
*/
private final Map<Integer, UUID> playerMappings;
// FIXME private final Map<Integer, UUID> playerMappings;
/**
* 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
*/
PlayerMappingsInitializer( final ConfigCategory playerList )
PlayerMappingsInitializer(final Config config, String prefix )
{
// Matcher for UUIDs
final UUIDMatcher matcher = new UUIDMatcher();
// Initial capacity for mappings
final int capacity = playerList.size();
// Mappings for the IDs is a regular HashMap
this.playerMappings = new HashMap<>( capacity );
// Iterates through every pair of UUID to ID
for( final Map.Entry<String, Property> entry : playerList.getValues().entrySet() )
{
final String maybeUUID = entry.getKey();
final int id = entry.getValue().getInt();
if( matcher.isUUID( maybeUUID ) )
{
final UUID uuidString = UUID.fromString( maybeUUID );
this.playerMappings.put( id, uuidString );
}
else
{
AELog.warn(
"The configuration for players contained an outdated entry instead an expected UUID " + maybeUUID + " for the player " + id + ". Please clean this up." );
}
}
// FIXME // Matcher for UUIDs
// FIXME final UUIDMatcher matcher = new UUIDMatcher();
// FIXME
// FIXME // Initial capacity for mappings
// FIXME final int capacity = playerList.size();
// FIXME
// FIXME // Mappings for the IDs is a regular HashMap
// FIXME this.playerMappings = new HashMap<>( capacity );
// FIXME
// FIXME // Iterates through every pair of UUID to ID
// FIXME for( final Map.Entry<String, Property> entry : playerList.getValues().entrySet() )
// FIXME {
// FIXME final String maybeUUID = entry.getKey();
// FIXME final int id = entry.getValue().getInt();
// FIXME
// FIXME if( matcher.isUUID( maybeUUID ) )
// FIXME {
// FIXME final UUID uuidString = UUID.fromString( maybeUUID );
// FIXME
// FIXME this.playerMappings.put( id, uuidString );
// FIXME }
// FIXME else
// FIXME {
// FIXME AELog.warn(
// 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 net.minecraft.nbt.CompoundNBT;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.nbt.ListNBT;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
@@ -33,6 +33,10 @@ import net.minecraftforge.common.util.INBTSerializable;
import appeng.api.storage.ISpatialDimension;
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>
@@ -118,35 +122,36 @@ public class SpatialDimensionManager implements ISpatialDimension, ICapabilitySe
return null;
}
@SuppressWarnings("unchecked")
@Nonnull
@Override
public boolean hasCapability( Capability<?> capability, Direction facing )
{
return capability == Capabilities.SPATIAL_DIMENSION;
public <T> LazyOptional<T> getCapability(@Nonnull Capability<T> cap) {
if( cap == Capabilities.SPATIAL_DIMENSION )
{
return LazyOptional.of(() -> (T) this);
}
return LazyOptional.empty();
}
@Nonnull
@Override
public <T> T getCapability( Capability<T> capability, Direction facing )
{
if( capability == Capabilities.SPATIAL_DIMENSION )
{
return (T) this;
}
return null;
public <T> LazyOptional<T> getCapability(@Nonnull Capability<T> cap, @Nullable Direction side) {
return getCapability(cap);
}
@Override
public CompoundNBT serializeNBT()
{
final CompoundNBT ret = new CompoundNBT();
final NBTTagList list = new NBTTagList();
final ListNBT list = new ListNBT();
for( Map.Entry<Integer, StorageCellData> entry : this.spatialData.entrySet() )
{
final CompoundNBT nbt = entry.getValue().serializeNBT();
nbt.setInteger( NBT_SPATIAL_ID_KEY, entry.getKey() );
list.appendTag( nbt );
nbt.putInt( NBT_SPATIAL_ID_KEY, entry.getKey() );
list.add( nbt );
}
ret.setTag( NBT_SPATIAL_DATA_KEY, list );
ret.put( NBT_SPATIAL_DATA_KEY, list );
return ret;
}
@@ -155,14 +160,14 @@ public class SpatialDimensionManager implements ISpatialDimension, ICapabilitySe
{
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();
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 int id = entry.getInteger( NBT_SPATIAL_ID_KEY );
final int id = entry.getInt( NBT_SPATIAL_ID_KEY );
data.deserializeNBT( entry );
this.spatialData.put( id, data );
}
@@ -228,18 +233,18 @@ public class SpatialDimensionManager implements ISpatialDimension, ICapabilitySe
public CompoundNBT serializeNBT()
{
CompoundNBT nbt = new CompoundNBT();
nbt.setInteger( NBT_DIM_X_KEY, this.contentDimension.getX() );
nbt.setInteger( NBT_DIM_Y_KEY, this.contentDimension.getY() );
nbt.setInteger( NBT_DIM_Z_KEY, this.contentDimension.getZ() );
nbt.setInteger( NBT_OWNER_KEY, this.owner );
nbt.putInt( NBT_DIM_X_KEY, this.contentDimension.getX() );
nbt.putInt( NBT_DIM_Y_KEY, this.contentDimension.getY() );
nbt.putInt( NBT_DIM_Z_KEY, this.contentDimension.getZ() );
nbt.putInt( NBT_OWNER_KEY, this.owner );
return nbt;
}
@Override
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.owner = nbt.getInteger( NBT_OWNER_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.getInt( NBT_OWNER_KEY );
}
}
}
@@ -34,6 +34,7 @@ import net.minecraft.nbt.CompoundNBT;
import net.minecraft.nbt.CompressedStreamTools;
import appeng.core.AELog;
import net.minecraft.world.dimension.Dimension;
/**
@@ -57,25 +58,29 @@ final class SpawnData implements IWorldSpawnData
}
@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 )
{
final CompoundNBT data = this.loadSpawnData( dim, chunkX, chunkZ );
final CompoundNBT data = this.loadSpawnData( dimId, chunkX, chunkZ );
// edit.
data.putBoolean(chunkX + "," + chunkZ, true);
this.writeSpawnData( dim, chunkX, chunkZ, data );
this.writeSpawnData( dimId, chunkX, chunkZ, data );
}
}
@Override
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 )
{
final CompoundNBT data = this.loadSpawnData( dim, chunkX, chunkZ );
final CompoundNBT data = this.loadSpawnData( dimId, chunkX, chunkZ );
return data.getBoolean( chunkX + "," + chunkZ );
}
}
@@ -83,23 +88,25 @@ final class SpawnData implements IWorldSpawnData
@Override
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 )
{
final CompoundNBT data = this.loadSpawnData( dim, chunkX, chunkZ );
final CompoundNBT data = this.loadSpawnData( dimId, chunkX, chunkZ );
// edit.
final int size = data.getInteger( "num" );
data.setTag( String.valueOf( size ), newData );
data.setInteger( "num", size + 1 );
final int size = data.getInt( "num" );
data.put( String.valueOf( size ), newData );
data.putInt( "num", size + 1 );
this.writeSpawnData( dim, chunkX, chunkZ, data );
this.writeSpawnData( dimId, chunkX, chunkZ, data );
return true;
}
}
@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<>();
@@ -112,15 +119,16 @@ final class SpawnData implements IWorldSpawnData
final int cx = x + ( chunkX >> 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 )
{
// edit.
final int size = data.getInteger( "num" );
final int size = data.getInt( "num" );
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.Nullable;
import com.electronwill.nightconfig.core.CommentedConfig;
import com.electronwill.nightconfig.core.file.CommentedFileConfig;
import com.google.common.base.Preconditions;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.common.config.Property;
import appeng.core.AELog;
import appeng.me.GridStorage;
import appeng.me.GridStorageSearch;
@@ -50,11 +49,11 @@ final class StorageData implements IWorldGridStorageData, IOnWorldStartable, IOn
private static final String GRID_STORAGE_CATEGORY = "gridstorage";
private final Map<GridStorageSearch, WeakReference<GridStorageSearch>> loadedStorage = new WeakHashMap<>( 10 );
private final Configuration config;
private final CommentedFileConfig config;
private long lastGridStorage;
public StorageData( @Nonnull final Configuration settingsFile )
public StorageData( @Nonnull final CommentedFileConfig settingsFile )
{
Preconditions.checkNotNull( settingsFile );
@@ -72,20 +71,21 @@ final class StorageData implements IWorldGridStorageData, IOnWorldStartable, IOn
@Override
public GridStorage getGridStorage( final long storageID )
{
final GridStorageSearch gss = new GridStorageSearch( storageID );
final WeakReference<GridStorageSearch> result = this.loadedStorage.get( gss );
if( result == null || result.get() == null )
{
final String id = String.valueOf( storageID );
final String data = this.config.get( "gridstorage", id, "" ).getString();
final GridStorage thisStorage = new GridStorage( data, storageID, gss );
gss.setGridStorage( new WeakReference<>( thisStorage ) );
this.loadedStorage.put( gss, new WeakReference<>( gss ) );
return thisStorage;
}
return result.get().getGridStorage().get();
return null;
// FIXME final GridStorageSearch gss = new GridStorageSearch( storageID );
// FIXME final WeakReference<GridStorageSearch> result = this.loadedStorage.get( gss );
// FIXME
// FIXME if( result == null || result.get() == null )
// FIXME {
// FIXME final String id = String.valueOf( storageID );
// FIXME final String data = this.config.get( "gridstorage", id, "" ).getString();
// FIXME final GridStorage thisStorage = new GridStorage( data, storageID, gss );
// FIXME gss.setGridStorage( new WeakReference<>( thisStorage ) );
// FIXME this.loadedStorage.put( gss, new WeakReference<>( gss ) );
// FIXME return thisStorage;
// FIXME }
// FIXME
// FIXME return result.get().getGridStorage().get();
}
/**
@@ -107,59 +107,61 @@ final class StorageData implements IWorldGridStorageData, IOnWorldStartable, IOn
@Override
public long nextGridStorage()
{
final long r = this.lastGridStorage;
this.lastGridStorage++;
this.config.get( "Counters", "lastGridStorage", this.lastGridStorage ).set( Long.toString( this.lastGridStorage ) );
return r;
// FIXME final long r = this.lastGridStorage;
// FIXME this.lastGridStorage++;
// FIXME this.config.get( "Counters", "lastGridStorage", this.lastGridStorage ).set( Long.toString( this.lastGridStorage ) );
// FIXME return r;
return 0;
}
@Override
public void destroyGridStorage( final long id )
{
final String stringID = String.valueOf( id );
this.config.getCategory( "gridstorage" ).remove( stringID );
// FIXME final String stringID = String.valueOf( id );
// FIXME this.config.getCategory( "gridstorage" ).remove( stringID );
}
@Override
public int getNextOrderedValue( final String name )
{
final Property p = this.config.get( "orderedValues", name, 0 );
final int myValue = p.getInt();
p.set( myValue + 1 );
return myValue;
// FIXME final Property p = this.config.get( "orderedValues", name, 0 );
// FIXME final int myValue = p.getInt();
// FIXME p.set( myValue + 1 );
// FIXME return myValue;
return 0;
}
@Override
public void onWorldStart()
{
final String lastString = this.config.get( LAST_GRID_STORAGE_CATEGORY, LAST_GRID_STORAGE_KEY, LAST_GRID_STORAGE_DEFAULT ).getString();
try
{
this.lastGridStorage = Long.parseLong( lastString );
}
catch( final NumberFormatException err )
{
AELog.warn( "The config contained a value which was not represented as a Long: %s", lastString );
this.lastGridStorage = 0;
}
// FIXME final String lastString = this.config.get( LAST_GRID_STORAGE_CATEGORY, LAST_GRID_STORAGE_KEY, LAST_GRID_STORAGE_DEFAULT ).getString();
// FIXME
// FIXME try
// FIXME {
// FIXME this.lastGridStorage = Long.parseLong( lastString );
// FIXME }
// FIXME catch( final NumberFormatException err )
// FIXME {
// FIXME AELog.warn( "The config contained a value which was not represented as a Long: %s", lastString );
// FIXME
// FIXME this.lastGridStorage = 0;
// FIXME }
}
@Override
public void onWorldStop()
{
// populate new data
for( final GridStorageSearch gs : this.loadedStorage.keySet() )
{
final GridStorage thisStorage = gs.getGridStorage().get();
if( thisStorage != null && thisStorage.getGrid() != null && !thisStorage.getGrid().isEmpty() )
{
final String value = thisStorage.getValue();
this.config.get( GRID_STORAGE_CATEGORY, String.valueOf( thisStorage.getID() ), value ).set( value );
}
}
this.config.save();
// FIXME // populate new data
// FIXME for( final GridStorageSearch gs : this.loadedStorage.keySet() )
// FIXME {
// FIXME final GridStorage thisStorage = gs.getGridStorage().get();
// FIXME if( thisStorage != null && thisStorage.getGrid() != null && !thisStorage.getGrid().isEmpty() )
// FIXME {
// FIXME final String value = thisStorage.getValue();
// FIXME this.config.get( GRID_STORAGE_CATEGORY, String.valueOf( thisStorage.getID() ), value ).set( value );
// FIXME }
// FIXME }
// FIXME
// FIXME this.config.save();
}
}
@@ -19,6 +19,7 @@
package appeng.core.worlddata;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.util.List;
import java.util.concurrent.ThreadFactory;
@@ -26,12 +27,17 @@ import java.util.concurrent.ThreadFactory;
import javax.annotation.Nonnull;
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.collect.Lists;
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.config.Configuration;
import appeng.core.AEConfig;
import appeng.services.CompassService;
@@ -71,7 +77,7 @@ public final class WorldData implements IWorldData
private final File spawnDirectory;
private final File compassDirectory;
// FIXME private final Configuration sharedConfig;
private final CommentedFileConfig sharedConfig;
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 );
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 StorageData storageData = new StorageData( this.sharedConfig );
@@ -124,10 +131,15 @@ public final class WorldData implements IWorldData
*/
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 )
{
worldDirectory = server.getActiveAnvilConverter().getSaveLoader( server.getFolderName(), false ).getWorldDirectory();
worldDirectory = server.getActiveAnvilConverter().getSaveLoader( server.getFolderName(), server ).getWorldDirectory();
}
final WorldData newInstance = new WorldData( worldDirectory );
@@ -33,9 +33,9 @@ public class GuiFluidFormationPlane extends GuiUpgradeable
}
@Override
public void initGui()
public void init()
{
super.initGui();
super.init();
final int xo = 8;
final int yo = 23 + 6;
@@ -63,7 +63,7 @@ public class GuiFluidFormationPlane extends GuiUpgradeable
@Override
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
@@ -47,9 +47,9 @@ public class GuiFluidIO extends GuiUpgradeable
}
@Override
public void initGui()
public void init()
{
super.initGui();
super.init();
final ContainerFluidIO container = (ContainerFluidIO) this.inventorySlots;
final IAEFluidTank inv = this.bus.getConfig();
@@ -53,9 +53,9 @@ public class GuiFluidInterface extends GuiUpgradeable
}
@Override
public void initGui()
public void init()
{
super.initGui();
super.init();
final IAEFluidTank configFluids = this.host.getDualityFluidInterface().getConfig();
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
.getGuiTop() + 53, 16, 68 );
this.buttonList.add( guiTank );
this.addButton( guiTank );
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.buttonList.add( this.priority );
this.addButton( this.priority );
}
@Override
@@ -80,10 +80,10 @@ public class GuiFluidInterface extends GuiUpgradeable
@Override
public void drawFG( int offsetX, int offsetY, int mouseX, int mouseY )
{
this.fontRenderer.drawString( this.getGuiDisplayName( GuiText.FluidInterface.getLocal() ), 8, 6, 4210752 );
this.fontRenderer.drawString( GuiText.Config.getLocal(), 35, 6 + 11 + 7, 4210752 );
this.fontRenderer.drawString( GuiText.StoredFluids.getLocal(), 35, 6 + 112 + 7, 4210752 );
this.fontRenderer.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
this.font.drawString( this.getGuiDisplayName( GuiText.FluidInterface.getLocal() ), 8, 6, 4210752 );
this.font.drawString( GuiText.Config.getLocal(), 35, 6 + 11 + 7, 4210752 );
this.font.drawString( GuiText.StoredFluids.getLocal(), 35, 6 + 112 + 7, 4210752 );
this.font.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
}
@Override
@@ -43,11 +43,11 @@ public class GuiFluidLevelEmitter extends GuiUpgradeable
}
@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.setMaxStringLength( 16 );
this.level.setTextColor( 0xFFFFFF );
@@ -70,17 +70,17 @@ public class GuiFluidLevelEmitter extends GuiUpgradeable
final int c = AEConfig.instance().levelByMillyBuckets( 2 );
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.buttonList.add( 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.buttonList.add( this.plus1000 = new GuiButton( 0, this.guiLeft + 120, this.guiTop + 17, 38, 20, "+" + d ) );
this.addButton( this.plus1 = new GuiButton( 0, this.guiLeft + 20, this.guiTop + 17, 22, 20, "+" + a ) );
this.addButton( this.plus10 = new GuiButton( 0, this.guiLeft + 48, this.guiTop + 17, 28, 20, "+" + b ) );
this.addButton( this.plus100 = new GuiButton( 0, this.guiLeft + 82, this.guiTop + 17, 32, 20, "+" + c ) );
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.buttonList.add( 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.buttonList.add( this.minus1000 = new GuiButton( 0, this.guiLeft + 120, this.guiTop + 59, 38, 20, "-" + d ) );
this.addButton( this.minus1 = new GuiButton( 0, this.guiLeft + 20, this.guiTop + 59, 22, 20, "-" + a ) );
this.addButton( this.minus10 = new GuiButton( 0, this.guiLeft + 48, this.guiTop + 59, 28, 20, "-" + b ) );
this.addButton( this.minus100 = new GuiButton( 0, this.guiLeft + 82, this.guiTop + 59, 32, 20, "-" + c ) );
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
@@ -70,9 +70,9 @@ public class GuiFluidStorageBus extends GuiUpgradeable
}
@Override
public void initGui()
public void init()
{
super.initGui();
super.init();
final int xo = 8;
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.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.buttonList.add( this.fuzzyMode );
this.buttonList.add( this.rwMode );
this.buttonList.add( this.partition );
this.buttonList.add( this.clear );
this.addButton( this.storageFilter );
this.addButton( this.fuzzyMode );
this.addButton( this.rwMode );
this.addButton( this.partition );
this.addButton( this.clear );
}
@Override
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.fontRenderer.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
this.font.drawString( this.getGuiDisplayName( this.getName().getLocal() ), 8, 6, 4210752 );
this.font.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
if( this.fuzzyMode != null )
{
@@ -100,13 +100,13 @@ public class GuiFluidTerminal extends AEBaseMEGui implements ISortSource, IConfi
}
@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.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.setMaxStringLength( 25 );
this.searchField.setTextColor( 0xFFFFFF );
@@ -115,10 +115,10 @@ public class GuiFluidTerminal extends AEBaseMEGui implements ISortSource, IConfi
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;
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 ) ) );
for( int y = 0; y < this.rows; y++ )
@@ -136,8 +136,8 @@ public class GuiFluidTerminal extends AEBaseMEGui implements ISortSource, IConfi
@Override
public void drawFG( int offsetX, int offsetY, int mouseX, int mouseY )
{
this.fontRenderer.drawString( this.getGuiDisplayName( "Fluid Terminal" ), 8, 6, 4210752 );
this.fontRenderer.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
this.font.drawString( this.getGuiDisplayName( "Fluid Terminal" ), 8, 6, 4210752 );
this.font.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
}
@Override
@@ -41,8 +41,8 @@ public class GuiFluidSlot extends GuiCustomSlot
final IAEFluidStack fs = this.getFluidStack();
if( fs != null )
{
GlStateManager.disableLighting();
GlStateManager.disableBlend();
RenderSystem.disableLighting();
RenderSystem.disableBlend();
final Fluid fluid = fs.getFluid();
mc.getTextureManager().bindTexture( TextureMap.LOCATION_BLOCKS_TEXTURE );
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 green = ( fluid.getColor() >> 8 & 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() );
}
@@ -51,10 +51,10 @@ public class GuiFluidTank extends GuiButton implements ITooltip
{
if( this.visible )
{
GlStateManager.disableBlend();
GlStateManager.disableLighting();
RenderSystem.disableBlend();
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 );
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 green = ( fluid.getFluid().getColor() >> 8 & 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() );
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
public void drawBackground( int guileft, int guitop )
{
GlStateManager.enableBlend();
RenderSystem.enableBlend();
if( this.isSlotEnabled() )
{
GlStateManager.color( 1.0F, 1.0F, 1.0F, 1.0F );
RenderSystem.color4f( 1.0F, 1.0F, 1.0F, 1.0F );
}
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.getHeight() + 2 );
@@ -63,18 +63,18 @@ public class FluidStackSizeRenderer
{
final String stackSize = this.getToBeRenderedStackSize( aeStack.getStackSize() );
GlStateManager.disableLighting();
GlStateManager.disableDepth();
GlStateManager.disableBlend();
RenderSystem.disableLighting();
RenderSystem.disableDepthTest();
RenderSystem.disableBlend();
GlStateManager.pushMatrix();
GlStateManager.scale( scaleFactor, scaleFactor, scaleFactor );
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 );
fontRenderer.drawStringWithShadow( stackSize, X, Y, 16777215 );
GlStateManager.popMatrix();
GlStateManager.enableLighting();
GlStateManager.enableDepth();
GlStateManager.enableBlend();
RenderSystem.enableLighting();
RenderSystem.enableDepthTest();
RenderSystem.enableBlend();
}
fontRenderer.setUnicodeFlag( unicodeFlag );
@@ -75,7 +75,7 @@ import appeng.util.Platform;
public class DualityFluidInterface implements IGridTickable, IStorageMonitorable, IAEFluidInventory, IUpgradeableHost, IConfigManagerHost
{
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 AENetworkProxy gridProxy;
@@ -57,7 +57,7 @@ public class FluidCellConfig extends CellConfig
return stack;
}
fluid.amount = Fluid.BUCKET_VOLUME;
fluid.amount = FluidAttributes.BUCKET_VOLUME;
ItemStack is = Api.INSTANCE.definitions().items().dummyFluidItem().maybeStack( 1 ).get();
FluidDummyItem item = (FluidDummyItem) is.getItem();
item.setFluidStack( is, fluid );
@@ -77,7 +77,7 @@ public class FluidCellConfig extends CellConfig
return;
}
fluid.amount = Fluid.BUCKET_VOLUME;
fluid.amount = FluidAttributes.BUCKET_VOLUME;
ItemStack is = Api.INSTANCE.definitions().items().dummyFluidItem().maybeStack( 1 ).get();
FluidDummyItem item = (FluidDummyItem) is.getItem();
item.setFluidStack( is, fluid );
@@ -96,7 +96,7 @@ public class FluidCellConfig extends CellConfig
{
return false;
}
fluid.amount = Fluid.BUCKET_VOLUME;
fluid.amount = FluidAttributes.BUCKET_VOLUME;
ItemStack is = Api.INSTANCE.definitions().items().dummyFluidItem().maybeStack( 1 ).get();
FluidDummyItem item = (FluidDummyItem) is.getItem();
item.setFluidStack( is, fluid );
@@ -19,12 +19,12 @@
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.nbt.CompoundNBT;
import net.minecraft.util.NonNullList;
import net.minecraft.fluid.Fluid;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidAttributes;
import net.minecraftforge.fluids.FluidStack;
import appeng.items.AEBaseItem;
@@ -39,16 +39,19 @@ import appeng.items.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 );
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 )
@@ -65,19 +68,18 @@ public class FluidDummyItem extends AEBaseItem
{
if( fs == null )
{
is.setTagCompound( null );
is.setTag( null );
}
else
{
CompoundNBT tag = new CompoundNBT();
fs.writeToNBT( tag );
is.setTagCompound( tag );
is.setTag( tag );
}
}
@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
}
}
@@ -107,7 +107,7 @@ public class PartFluidFormationPlane extends PartAbstractFormationPlane<IAEFluid
@Override
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
return input;
@@ -124,16 +124,16 @@ public class PartFluidFormationPlane extends PartAbstractFormationPlane<IAEFluid
if( type == Actionable.MODULATE )
{
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 ) )
{
return input;
}
}
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;
}
this.blocked = true;
@@ -6,25 +6,25 @@ import java.util.Objects;
import net.minecraft.nbt.CompoundNBT;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.capability.IFluidTankProperties;
import appeng.api.storage.data.IAEFluidStack;
import appeng.core.AELog;
import appeng.util.Platform;
import javax.annotation.Nonnull;
public class AEFluidInventory implements IAEFluidTank
{
private final IAEFluidStack[] fluids;
private final IAEFluidInventory handler;
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.handler = handler;
this.capacity = capcity;
this.capacity = capacity;
}
public AEFluidInventory( final IAEFluidInventory handler, final int slots )
@@ -87,34 +87,47 @@ public class AEFluidInventory implements IAEFluidTank
}
@Override
public IFluidTankProperties[] getTankProperties()
{
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 getTanks() {
return this.fluids.length;
}
public int fill( final int slot, final FluidStack resource, final boolean doFill )
{
if( resource == null || resource.amount <= 0 )
@Nonnull
@Override
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;
}
// Find a suitable slot
int slot = indexOfFluid(resource);
if (slot == -1) {
slot = indexOfEmptySlot();
if (slot == -1) {
return 0;
}
}
final IAEFluidStack fluid = this.fluids[slot];
if( fluid != null && !fluid.equals( resource ) )
{
return 0;
}
int amountToStore = this.capacity;
if( fluid != null )
@@ -122,9 +135,9 @@ public class AEFluidInventory implements IAEFluidTank
amountToStore -= fluid.getStackSize();
}
amountToStore = Math.min( amountToStore, resource.amount );
amountToStore = Math.min( amountToStore, resource.getAmount() );
if( doFill )
if( action == FluidAction.EXECUTE )
{
if( fluid == null )
{
@@ -140,6 +153,100 @@ public class AEFluidInventory implements IAEFluidTank
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 )
{
final IAEFluidStack fluid = this.fluids[slot];
@@ -147,7 +254,7 @@ public class AEFluidInventory implements IAEFluidTank
{
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 )
@@ -177,111 +284,11 @@ public class AEFluidInventory implements IAEFluidTank
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 )
{
final CompoundNBT c = new CompoundNBT();
this.writeToNBT( c );
data.setTag( name, c );
data.put( name, c );
}
private void writeToNBT( final CompoundNBT target )
@@ -297,7 +304,7 @@ public class AEFluidInventory implements IAEFluidTank
this.fluids[x].writeToNBT( c );
}
target.setTag( "#" + x, c );
target.put( "#" + x, c );
}
catch( final Exception ignored )
{
@@ -307,8 +314,8 @@ public class AEFluidInventory implements IAEFluidTank
public void readFromNBT( final CompoundNBT data, final String name )
{
final CompoundNBT c = data.getCompoundTag( name );
if( c != null )
final CompoundNBT c = data.getCompound( name );
if( !c.isEmpty() )
{
this.readFromNBT( c );
}
@@ -320,9 +327,9 @@ public class AEFluidInventory implements IAEFluidTank
{
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 );
}
@@ -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.DataOutputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import javax.annotation.Nonnull;
@@ -36,7 +37,6 @@ import net.minecraft.nbt.CompressedStreamTools;
import net.minecraft.network.PacketBuffer;
import net.minecraftforge.fluids.FluidStack;
import appeng.api.AEApi;
import appeng.api.config.FuzzyMode;
import appeng.api.storage.IStorageChannel;
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];
buffer.readBytes( name, 0, len2 );
d.setString( "FluidName", new String( name, "UTF-8" ) );
d.setByte( "Count", (byte) 0 );
d.putString( "FluidName", new String( name, "UTF-8" ) );
d.putByte( "Count", (byte) 0 );
if( hasTagCompound )
{
@@ -145,7 +145,7 @@ public final class AEFluidStack extends AEStack<IAEFluidStack> implements IAEFlu
buffer.readBytes( 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 );
@@ -181,19 +181,19 @@ public final class AEFluidStack extends AEStack<IAEFluidStack> implements IAEFlu
@Override
public void writeToNBT( final CompoundNBT data )
{
data.setString( "FluidName", this.fluid.getName() );
data.setByte( "Count", (byte) 0 );
data.setLong( "Cnt", this.getStackSize() );
data.setLong( "Req", this.getCountRequestable() );
data.setBoolean( "Craft", this.isCraftable() );
data.putString( "FluidName", this.fluid.getRegistryName().toString() );
data.putByte( "Count", (byte) 0 );
data.putLong( "Cnt", this.getStackSize() );
data.putLong( "Req", this.getCountRequestable() );
data.putBoolean( "Craft", this.isCraftable() );
if( this.hasTagCompound() )
{
data.setTag( "Tag", this.tagCompound );
data.put( "Tag", this.tagCompound );
}
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 )
{
return this.fluid.getName().compareTo( other.fluid.getName() );
return this.fluid.getRegistryName().compareTo( other.fluid.getRegistryName() );
}
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 )
{
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;
}
@@ -281,7 +281,7 @@ public final class AEFluidStack extends AEStack<IAEFluidStack> implements IAEFlu
@Override
public String toString()
{
return this.getStackSize() + "x" + this.getFluidStack().getFluid().getName() + " " + this.tagCompound;
return this.getStackSize() + "x" + this.getFluidStack().getFluid().getRegistryName() + " " + this.tagCompound;
}
@Override
@@ -334,7 +334,7 @@ public final class AEFluidStack extends AEStack<IAEFluidStack> implements IAEFlu
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.writeBytes( name );
if( this.hasTagCompound() )
@@ -19,11 +19,9 @@
package appeng.fluids.util;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.fluids.FluidTank;
import appeng.api.storage.data.IAEFluidStack;
import appeng.util.Platform;
import net.minecraftforge.fluids.capability.templates.FluidTank;
public class AEFluidTank extends FluidTank implements IAEFluidTank
@@ -34,10 +32,10 @@ public class AEFluidTank extends FluidTank implements IAEFluidTank
{
super( capacity );
this.host = host;
if( host instanceof TileEntity )
{
this.setTileEntity( (TileEntity) host );
}
// FIXME if( host instanceof TileEntity )
// FIXME {
// FIXME this.setTileEntity( (TileEntity) host );
// FIXME }
}
@Override
@@ -19,18 +19,23 @@
package appeng.items.misc;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
import net.minecraft.util.NonNullList;
import appeng.api.util.AEColor;
import appeng.core.localization.GuiText;
import appeng.items.AEBaseItem;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TranslationTextComponent;
public class ItemPaintBall extends AEBaseItem
{
private static final ITextComponent LUMEN_PREFIX = new TranslationTextComponent(GuiText.Lumen.getTranslationKey())
.appendText(" ");
private static final int DAMAGE_THRESHOLD = 20;
public ItemPaintBall()
@@ -39,14 +44,21 @@ public class ItemPaintBall extends AEBaseItem
}
@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 )
@@ -66,8 +78,8 @@ public class ItemPaintBall extends AEBaseItem
}
@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() )
{
if( c != AEColor.TRANSPARENT )
@@ -41,6 +41,7 @@ import net.minecraft.util.NonNullList;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.registry.Registry;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.world.World;
import net.minecraftforge.common.property.IExtendedBlockState;
import net.minecraftforge.registries.ForgeRegistries;
@@ -76,14 +77,13 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
}
@Override
public String getItemStackDisplayName( final ItemStack is )
{
public ITextComponent getDisplayName(ItemStack is) {
try
{
final ItemStack in = this.getTextureItem( is );
if( !in.isEmpty() )
{
return super.getItemStackDisplayName( is ) + " - " + in.getDisplayName();
return super.getDisplayName( is ).shallowCopy().appendText(" - ").appendSibling(in.getDisplayName());
}
}
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
@@ -19,10 +19,11 @@
package appeng.items.storage;
import appeng.core.Api;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.items.IItemHandler;
import appeng.api.AEApi;
import appeng.api.config.FuzzyMode;
import appeng.api.config.Upgrades;
import appeng.api.implementations.items.IUpgradeModule;
@@ -42,9 +43,10 @@ import appeng.util.prioritylist.PrecisePriorityList;
public class ItemViewCell extends AEBaseItem implements ICellWorkbenchItem
{
public ItemViewCell()
{
this.setMaxStackSize( 1 );
super(new Item.Properties().maxStackSize(1));
}
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.oredict.OreDictionary;
import appeng.api.AEApi;
import appeng.api.config.Actionable;
import appeng.api.config.FuzzyMode;
import appeng.api.implementations.items.IItemGroup;
@@ -203,7 +202,7 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
if( selected != null && Platform.isClient() )
{
extra = Platform.gui_localize( selected.unlocalizedName );
extra = Platform.gui_localize( selected.translationKey);
}
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.MENetworkPostCacheConstruction;
import appeng.api.util.IReadOnlyCollection;
import appeng.core.Api;
import appeng.core.worlddata.WorldData;
import appeng.hooks.TickHandler;
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();
}
void setGrid( final Grid grid )
void setGrid( final IGrid grid )
{
this.internalGrid = new WeakReference<>( grid );
}
@@ -32,7 +32,7 @@ import com.google.common.collect.ImmutableList;
import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.nbt.ListNBT;
import net.minecraft.world.World;
import net.minecraft.world.WorldServer;
import net.minecraftforge.fml.common.FMLCommonHandler;
@@ -1156,7 +1156,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
data.setTag( "link", link );
}
final NBTTagList list = new NBTTagList();
final ListNBT list = new ListNBT();
for( final Entry<ICraftingPatternDetails, TaskProgress> e : this.tasks.entrySet() )
{
final CompoundNBT item = this.writeItem( AEItemStack.fromItemStack( e.getKey().getPattern() ) );
@@ -1184,9 +1184,9 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
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 )
{
@@ -1215,7 +1215,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
public void readFromNBT( final CompoundNBT data )
{
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 );
}
@@ -1230,7 +1230,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
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++ )
{
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 )
{
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();
@@ -22,6 +22,8 @@ package appeng.me.helpers;
import java.util.Collections;
import java.util.EnumSet;
import appeng.core.Api;
import appeng.core.worlddata.WorldData;
import com.mojang.authlib.GameProfile;
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.DimensionalCoord;
import appeng.api.util.IOrientable;
import appeng.core.worlddata.WorldData;
import appeng.hooks.TickHandler;
import appeng.me.GridAccessException;
import appeng.me.cache.P2PCache;
import appeng.parts.networking.PartCable;
import appeng.tile.AEBaseTile;
import appeng.util.Platform;
@@ -105,7 +103,8 @@ public class AENetworkProxy implements IGridBlock
{
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;
}
public P2PCache getP2P() throws GridAccessException
{
final IGrid grid = this.getGrid();
if( grid == null )
{
throw new GridAccessException();
}
final P2PCache pg = grid.getCache( P2PCache.class );
if( pg == null )
{
throw new GridAccessException();
}
return pg;
}
// FIXME public P2PCache getP2P() throws GridAccessException
// FIXME {
// FIXME final IGrid grid = this.getGrid();
// FIXME if( grid == null )
// FIXME {
// FIXME throw new GridAccessException();
// FIXME }
// FIXME
// FIXME final P2PCache pg = grid.getCache( P2PCache.class );
// FIXME
// FIXME if( pg == null )
// FIXME {
// FIXME throw new GridAccessException();
// FIXME }
// FIXME
// FIXME return pg;
// FIXME }
public ISecurityGrid getSecurity() throws GridAccessException
{
@@ -328,10 +327,10 @@ public class AENetworkProxy implements IGridBlock
@Override
public void onGridNotification( final GridNotification notification )
{
if( this.gp instanceof PartCable )
{
( (PartCable) this.gp ).markForUpdate();
}
// FIXME if( this.gp instanceof PartCable )
// FIXME {
// FIXME ( (PartCable) this.gp ).markForUpdate();
// FIXME }
}
@Override
@@ -38,8 +38,8 @@ import net.minecraft.block.Block;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IWorld;
import net.minecraft.world.World;
import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.chunk.IChunk;
import net.minecraft.world.server.ServerWorld;
import net.minecraftforge.event.world.WorldEvent;
import appeng.api.AEApi;
@@ -189,7 +189,9 @@ public final class CompassService
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 );
}
@@ -492,11 +492,6 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
return null;
}
public boolean requiresTESR()
{
return false;
}
public void setName( final String 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 ) );
}
@Override
public boolean requiresTESR()
{
return this.dspPlay != null;
}
@Override
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 );
}
@Override
public boolean requiresTESR()
{
return true;
}
/**
* 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() ) );
}
@Override
public boolean requiresTESR()
{
return true;
}
@Override
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
@@ -227,12 +227,6 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
}
}
@Override
public boolean requiresTESR()
{
return true;
}
@Override
public IItemHandler getInternalInventory()
{
@@ -25,12 +25,6 @@ import appeng.tile.AEBaseTile;
public class TileSkyCompass extends AEBaseTile
{
@Override
public boolean requiresTESR()
{
return true;
}
@Override
public boolean hasFastRenderer()
{
@@ -231,12 +231,6 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl
}
}
@Override
public boolean requiresTESR()
{
return this.getCableBus().isRequiresDynamicRender();
}
@Override
public IFacadeContainer getFacadeContainer()
{
@@ -837,7 +837,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, ITerminal
private class FluidHandler implements IFluidHandler
{
private final IFluidTankProperties[] TANK_PROPS = new IFluidTankProperties[] { new FluidTankProperties( null, Fluid.BUCKET_VOLUME ) };
private final IFluidTankProperties[] TANK_PROPS = new IFluidTankProperties[] { new FluidTankProperties( null, FluidAttributes.BUCKET_VOLUME ) };
@Override
public int fill( final FluidStack resource, final boolean doFill )
@@ -33,6 +33,7 @@ import net.minecraft.tileentity.ITickableTileEntity;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.SoundEvents;
import net.minecraft.util.math.MathHelper;
import net.minecraftforge.items.IItemHandler;
import appeng.tile.AEBaseInvTile;
@@ -43,6 +44,7 @@ public class TileSkyChest extends AEBaseInvTile implements ITickableTileEntity,
{
private final AppEngInternalInventory inv = new AppEngInternalInventory( this, 9 * 4 );
// server
private int numPlayersUsing;
// client..
@@ -76,12 +78,6 @@ public class TileSkyChest extends AEBaseInvTile implements ITickableTileEntity,
return c; // TESR yo!
}
@Override
public boolean requiresTESR()
{
return true;
}
@Override
public boolean canRenderBreaking()
{
@@ -147,17 +143,9 @@ public class TileSkyChest extends AEBaseInvTile implements ITickableTileEntity,
@Override
public void tick()
{
int i = this.pos.getX();
int j = this.pos.getY();
int k = this.pos.getZ();
this.prevLidAngle = this.lidAngle;
float f1 = 0.1F;
if( this.numPlayersUsing == 0 && this.lidAngle > 0.0F || this.numPlayersUsing > 0 && this.lidAngle < 1.0F )
{
float f2 = this.lidAngle;
if( this.numPlayersUsing > 0 )
{
this.lidAngle += 0.1F;
@@ -167,17 +155,7 @@ public class TileSkyChest extends AEBaseInvTile implements ITickableTileEntity,
this.lidAngle -= 0.1F;
}
if( this.lidAngle > 1.0F )
{
this.lidAngle = 1.0F;
}
float f3 = 0.5F;
if( this.lidAngle < 0.0F )
{
this.lidAngle = 0.0F;
}
this.lidAngle = MathHelper.clamp(this.lidAngle, 0, 1);
}
}
@@ -187,26 +165,6 @@ public class TileSkyChest extends AEBaseInvTile implements ITickableTileEntity,
}
public float getLidAngle()
{
return this.lidAngle;
}
public void setLidAngle( final float lidAngle )
{
this.lidAngle = lidAngle;
}
public float getPrevLidAngle()
{
return this.prevLidAngle;
}
public void setPrevLidAngle( float prevLidAngle )
{
this.prevLidAngle = prevLidAngle;
}
public int getPlayerOpen()
{
return this.numPlayersUsing;

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