diff --git a/src/main/java/techreborn/client/gui/GuiAESU.java b/src/main/java/techreborn/client/gui/GuiAESU.java index 7843ae7d0..f6cbd18dc 100644 --- a/src/main/java/techreborn/client/gui/GuiAESU.java +++ b/src/main/java/techreborn/client/gui/GuiAESU.java @@ -24,8 +24,6 @@ package techreborn.client.gui; -import java.io.IOException; - import net.minecraft.client.gui.GuiButton; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.entity.player.EntityPlayer; @@ -35,6 +33,8 @@ import techreborn.client.gui.widget.GuiButtonUpDown; import techreborn.packets.PacketAesu; import techreborn.tiles.storage.TileAdjustableSU; +import java.io.IOException; + public class GuiAESU extends GuiBase { TileAdjustableSU tile; @@ -43,7 +43,7 @@ public class GuiAESU extends GuiBase { super(player, aesu, aesu.createContainer(player)); this.tile = aesu; } - + @Override protected void drawGuiContainerBackgroundLayer(final float f, final int mouseX, final int mouseY) { super.drawGuiContainerBackgroundLayer(f, mouseX, mouseY); @@ -60,13 +60,15 @@ public class GuiAESU extends GuiBase { protected void drawGuiContainerForegroundLayer(final int mouseX, final int mouseY) { super.drawGuiContainerForegroundLayer(mouseX, mouseY); final Layer layer = Layer.FOREGROUND; - - GlStateManager.pushMatrix(); - GlStateManager.scale(0.6, 0.6, 1); - this.drawCentredString(PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) this.tile.getEnergy()) + "/" + + if(!GuiBase.showSlotConfig){ + GlStateManager.pushMatrix(); + GlStateManager.scale(0.6, 0.6, 1); + this.drawCentredString(PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) this.tile.getEnergy()) + "/" + PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) this.tile.getMaxPower()) + " " + PowerSystem.getDisplayPower().abbreviation, 35, 0, 58, layer); - GlStateManager.popMatrix(); + GlStateManager.popMatrix(); + } this.builder.drawMultiEnergyBar(this, 81, 28, (int) this.tile.getEnergy(), (int) this.tile.getMaxPower(), mouseX, mouseY, 0, layer); diff --git a/src/main/java/techreborn/client/gui/GuiBase.java b/src/main/java/techreborn/client/gui/GuiBase.java index 72f5b4d26..116c18126 100644 --- a/src/main/java/techreborn/client/gui/GuiBase.java +++ b/src/main/java/techreborn/client/gui/GuiBase.java @@ -51,10 +51,13 @@ public class GuiBase extends GuiContainer { public BuiltContainer container; public static boolean showSlotConfig = false; + private boolean upgrades; + public GuiBase(EntityPlayer player, TileEntity tile, BuiltContainer container) { super(container); this.tile = tile; this.container = container; + showSlotConfig = false; } protected void drawSlot(int x, int y, Layer layer) { @@ -125,9 +128,10 @@ public class GuiBase extends GuiContainer { IUpgradeable upgradeable = (IUpgradeable) tile; if (upgradeable.canBeUpgraded()) { builder.drawUpgrades(this, upgradeable, guiLeft, guiTop); + upgrades = true; } } - builder.drawSlotTab(this, guiLeft, guiTop, mouseX, mouseY); + builder.drawSlotTab(this, guiLeft, guiTop, mouseX, mouseY, upgrades); } @@ -210,7 +214,11 @@ public class GuiBase extends GuiContainer { @Override protected void mouseReleased(int mouseX, int mouseY, int state) { - if(isPointInRegion(-26, 84, 30, 30, mouseX, mouseY)){ + int offset = 0; + if(!upgrades){ + offset = 80; + } + if(isPointInRegion(-26, 84 - offset, 30, 30, mouseX, mouseY)){ showSlotConfig = !showSlotConfig; if(!showSlotConfig){ GuiSlotConfiguration.reset(); diff --git a/src/main/java/techreborn/client/gui/GuiBatbox.java b/src/main/java/techreborn/client/gui/GuiBatbox.java index b9bad4662..242e6d078 100644 --- a/src/main/java/techreborn/client/gui/GuiBatbox.java +++ b/src/main/java/techreborn/client/gui/GuiBatbox.java @@ -52,10 +52,12 @@ public class GuiBatbox extends GuiBase { super.drawGuiContainerForegroundLayer(mouseX, mouseY); final Layer layer = Layer.FOREGROUND; - GlStateManager.pushMatrix(); - GlStateManager.scale(0.6, 0.6, 5); - this.drawCentredString(PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) this.tile.getEnergy()) + "/" + PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) this.tile.getMaxPower()) + " " + PowerSystem.getDisplayPower().abbreviation, 35, 0, 58, layer); - GlStateManager.popMatrix(); + if(!GuiBase.showSlotConfig){ + GlStateManager.pushMatrix(); + GlStateManager.scale(0.6, 0.6, 5); + this.drawCentredString(PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) this.tile.getEnergy()) + "/" + PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) this.tile.getMaxPower()) + " " + PowerSystem.getDisplayPower().abbreviation, 35, 0, 58, layer); + GlStateManager.popMatrix(); + } this.builder.drawMultiEnergyBar(this, 81, 28, (int) this.tile.getEnergy(), (int) this.tile.getMaxPower(), mouseX, mouseY, 0, layer); } diff --git a/src/main/java/techreborn/client/gui/GuiMFE.java b/src/main/java/techreborn/client/gui/GuiMFE.java index 7eb654747..f8cde42b9 100644 --- a/src/main/java/techreborn/client/gui/GuiMFE.java +++ b/src/main/java/techreborn/client/gui/GuiMFE.java @@ -53,10 +53,12 @@ public class GuiMFE extends GuiBase { super.drawGuiContainerForegroundLayer(mouseX, mouseY); final Layer layer = Layer.FOREGROUND; - GlStateManager.pushMatrix(); - GlStateManager.scale(0.6, 0.6, 1); - this.drawCentredString(PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) this.mfe.getEnergy()) + "/" + PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) this.mfe.getMaxPower()) + " " + PowerSystem.getDisplayPower().abbreviation, 35, 0, 58, layer); - GlStateManager.popMatrix(); + if(!GuiBase.showSlotConfig){ + GlStateManager.pushMatrix(); + GlStateManager.scale(0.6, 0.6, 1); + this.drawCentredString(PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) this.mfe.getEnergy()) + "/" + PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) this.mfe.getMaxPower()) + " " + PowerSystem.getDisplayPower().abbreviation, 35, 0, 58, layer); + GlStateManager.popMatrix(); + } this.builder.drawMultiEnergyBar(this, 81, 28, (int) this.mfe.getEnergy(), (int) this.mfe.getMaxPower(), mouseX, mouseY, 0, layer); } diff --git a/src/main/java/techreborn/client/gui/TRBuilder.java b/src/main/java/techreborn/client/gui/TRBuilder.java index 1f44a18ad..55b6d1447 100644 --- a/src/main/java/techreborn/client/gui/TRBuilder.java +++ b/src/main/java/techreborn/client/gui/TRBuilder.java @@ -62,6 +62,9 @@ public class TRBuilder extends GuiBuilder { } public void drawMultiEnergyBar(GuiBase gui, int x, int y, int energyStored, int maxEnergyStored, int mouseX, int mouseY, int buttonID, GuiBase.Layer layer) { + if(GuiBase.showSlotConfig){ + return; + } if (layer == GuiBase.Layer.BACKGROUND) { x += gui.getGuiLeft(); y += gui.getGuiTop(); @@ -243,6 +246,9 @@ public class TRBuilder extends GuiBuilder { } public void drawUpDownButtons(GuiBase gui, int x, int y, GuiBase.Layer layer){ + if(GuiBase.showSlotConfig){ + return; + } if (layer == GuiBase.Layer.BACKGROUND) { x += gui.getGuiLeft(); y += gui.getGuiTop(); @@ -255,6 +261,9 @@ public class TRBuilder extends GuiBuilder { } public void drawEnergyOutput(GuiBase gui, int right, int top, int maxOutput, GuiBase.Layer layer){ + if(GuiBase.showSlotConfig){ + return; + } String text = PowerSystem.getLocaliszedPowerFormattedNoSuffix(maxOutput) + " " + PowerSystem.getDisplayPower().abbreviation + "/t"; int width = gui.mc.fontRenderer.getStringWidth(text); @@ -269,6 +278,9 @@ public class TRBuilder extends GuiBuilder { } public void drawBigBlueBar(GuiBase gui, int x, int y, int value, int max, int mouseX, int mouseY, String suffix, GuiBase.Layer layer) { + if(GuiBase.showSlotConfig){ + return; + } if (layer == GuiBase.Layer.BACKGROUND) { x += gui.getGuiLeft(); y += gui.getGuiTop(); @@ -301,6 +313,9 @@ public class TRBuilder extends GuiBuilder { } public void drawBigHeatBar(GuiBase gui, int x, int y, int value, int max, GuiBase.Layer layer) { + if(GuiBase.showSlotConfig){ + return; + } if (layer == GuiBase.Layer.BACKGROUND) { x += gui.getGuiLeft(); y += gui.getGuiTop(); @@ -386,11 +401,15 @@ public class TRBuilder extends GuiBuilder { gui.drawTexturedModalRect(posX - 27, posY + 4, 126, 151, 30, 87); } - public void drawSlotTab(GuiScreen gui, int posX, int posY, int mouseX, int mouseY){ + public void drawSlotTab(GuiScreen gui, int posX, int posY, int mouseX, int mouseY, boolean upgrades){ + int offset = 0; + if(!upgrades){ + offset = 80; + } Minecraft.getMinecraft().getTextureManager().bindTexture(GUI_SHEET); - gui.drawTexturedModalRect(posX - 26, posY + 84, 157, 148, 30, 30); - renderItemStack(new ItemStack(ModItems.WRENCH), posX - 19, posY + 92); - if (isInRect(posX - 19, posY + 92, 12, 12, mouseX, mouseY)) { + gui.drawTexturedModalRect(posX - 26, posY + 84 - offset, 157, 148, 30, 30); + renderItemStack(new ItemStack(ModItems.WRENCH), posX - 19, posY + 92 - offset); + if (isInRect(posX - 19, posY + 92 - offset, 12, 12, mouseX, mouseY)) { List list = new ArrayList<>(); list.add("Configure slots"); net.minecraftforge.fml.client.config.GuiUtils.drawHoveringText(list, mouseX, mouseY, gui.width, gui.height, -1, gui.mc.fontRenderer); diff --git a/src/main/java/techreborn/client/gui/slot/elements/SlotConfigPopupElement.java b/src/main/java/techreborn/client/gui/slot/elements/SlotConfigPopupElement.java index 519d1d474..d62b9eb65 100644 --- a/src/main/java/techreborn/client/gui/slot/elements/SlotConfigPopupElement.java +++ b/src/main/java/techreborn/client/gui/slot/elements/SlotConfigPopupElement.java @@ -5,14 +5,12 @@ import net.minecraft.client.renderer.BlockRendererDispatcher; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.block.model.IBakedModel; import net.minecraft.client.renderer.texture.TextureMap; -import net.minecraft.init.Blocks; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraftforge.fml.client.FMLClientHandler; import reborncore.RebornCore; import reborncore.client.gui.GuiUtil; -import reborncore.common.blocks.BlockMachineBase; import reborncore.common.network.NetworkManager; import reborncore.common.network.packet.PacketIOSave; import reborncore.common.network.packet.PacketSlotSave; @@ -44,9 +42,9 @@ public class SlotConfigPopupElement extends ElementBase { IBlockAccess blockAccess = machine.getWorld(); BlockPos pos = machine.getPos(); IBlockState state = blockAccess.getBlockState(pos); - IBlockState actualState = Blocks.DIRT.getDefaultState().getActualState(blockAccess, pos); + IBlockState actualState = state.getBlock().getDefaultState().getActualState(blockAccess, pos); BlockRendererDispatcher dispatcher = FMLClientHandler.instance().getClient().getBlockRendererDispatcher(); - IBakedModel model = dispatcher.getBlockModelShapes().getModelForState(state.withProperty(BlockMachineBase.FACING, EnumFacing.NORTH)); + IBakedModel model = dispatcher.getBlockModelShapes().getModelForState(state.getBlock().getDefaultState()); FMLClientHandler.instance().getClient().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); drawState(gui, blockAccess, model, actualState, pos, dispatcher, 4, 23); //left drawState(gui, blockAccess, model, actualState, pos, dispatcher, 23, -12, -90F, 1F, 0F, 0F); //top