[ci skip] spotlessApply with the new settings

This commit is contained in:
Jason Mitchell committed 2023-01-28 18:04:28 -08:00
1 parent 83698cb73c
commit 84c2239244
561 files changed
+8872 -9300

No files matched your search

@@ -5,21 +5,24 @@ import net.minecraft.client.renderer.Tessellator;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.*;
import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.GL11;
import tconstruct.TConstruct;
import tconstruct.library.TConstructRegistry;
import tconstruct.tools.logic.BattlesignLogic;
import tconstruct.util.network.SignDataPacket;
public class BattlesignGui extends GuiScreen {
private final BattlesignLogic battlesign;
private float bgColR = 1F;
private float bgColG = 1F;
private float bgColB = 1F;
private static final ResourceLocation background = new ResourceLocation("tinker:textures/gui/battlesignText.png");
private final String[] text = {"", "", "", "", ""};
private final String[] text = { "", "", "", "", "" };
int currentLine = 0;
public BattlesignGui(BattlesignLogic logic) {
@@ -72,19 +75,14 @@ public class BattlesignGui extends GuiScreen {
float lum = calcLuminance(bgColR, bgColG, bgColB);
for (int i = 0; i < text.length; i++) {
final EnumChatFormatting chatFormatting = lum >= 35F
? EnumChatFormatting.BLACK
final EnumChatFormatting chatFormatting = lum >= 35F ? EnumChatFormatting.BLACK
: lum >= 31F ? EnumChatFormatting.GRAY : EnumChatFormatting.WHITE;
fontRendererObj.drawString(
chatFormatting
+ (i == currentLine ? "> " : "")
chatFormatting + (i == currentLine ? "> " : "")
+ text[i]
+ (i == currentLine ? " " + EnumChatFormatting.RESET + chatFormatting + "<" : ""),
k
- fontRendererObj.getStringWidth(
(i == currentLine ? "> " : "") + text[i] + (i == currentLine ? " <" : ""))
/ 2
+ 51,
k - fontRendererObj.getStringWidth(
(i == currentLine ? "> " : "") + text[i] + (i == currentLine ? " <" : "")) / 2 + 51,
l + 4 + 10 * i,
0);
}
@@ -97,8 +95,7 @@ public class BattlesignGui extends GuiScreen {
super.keyTyped(c, i);
if (fontRendererObj.getStringWidth(text[currentLine]) < 90 && ChatAllowedCharacters.isAllowedCharacter(c)) {
if (Keyboard.isKeyDown(56)
&& c == 'f'
if (Keyboard.isKeyDown(56) && c == 'f'
&& (text[currentLine].length() == 0
|| text[currentLine].charAt(text[currentLine].length() - 1) != '\u00A7')) {
text[currentLine] += "\u00A7";
@@ -146,12 +143,13 @@ public class BattlesignGui extends GuiScreen {
Keyboard.enableRepeatEvents(false);
TConstruct.packetPipeline.sendToServer(new SignDataPacket(
battlesign.getWorldObj().provider.dimensionId,
battlesign.xCoord,
battlesign.yCoord,
battlesign.zCoord,
text));
TConstruct.packetPipeline.sendToServer(
new SignDataPacket(
battlesign.getWorldObj().provider.dimensionId,
battlesign.xCoord,
battlesign.yCoord,
battlesign.zCoord,
text));
}
private float calcLuminance(float r, float g, float b) {
@@ -1,14 +1,16 @@
package tconstruct.tools.gui;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class ChestSlot extends Slot {
/*
* A Slot, used for adjacent Chest Inventories, that can be disabled.
*/
@@ -24,7 +26,7 @@ public class ChestSlot extends Slot {
@SideOnly(Side.CLIENT)
@Override
public boolean func_111238_b /*isEnabled*/() {
public boolean func_111238_b /* isEnabled */() {
return enabled;
}
@@ -1,12 +1,9 @@
package tconstruct.tools.gui;
import codechicken.nei.VisiblityData;
import codechicken.nei.api.INEIGuiHandler;
import codechicken.nei.api.TaggedInventoryArea;
import cpw.mods.fml.common.Optional;
import java.awt.Rectangle;
import java.util.Collections;
import java.util.List;
import net.minecraft.client.gui.GuiTextField;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.InventoryPlayer;
@@ -17,18 +14,25 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import org.lwjgl.opengl.GL11;
import tconstruct.library.TConstructRegistry;
import tconstruct.library.crafting.PatternBuilder;
import tconstruct.library.modifier.IModifyable;
import tconstruct.library.tools.ToolMaterial;
import tconstruct.library.util.HarvestLevels;
import tconstruct.tools.logic.CraftingStationLogic;
import codechicken.nei.VisiblityData;
import codechicken.nei.api.INEIGuiHandler;
import codechicken.nei.api.TaggedInventoryArea;
import cpw.mods.fml.common.Optional;
@Optional.Interface(iface = "codechicken.nei.api.INEIGuiHandler", modid = "NotEnoughItems")
public class CraftingStationGui extends GuiContainer implements INEIGuiHandler {
/*
* Slider/slots related. Taken & adapted from Tinkers Construct 1.12 under the MIT License
* Slider/slots related. Taken & adapted from Tinkers Construct 1.12 under the MIT License
*/
private static final ResourceLocation gui_inventory = new ResourceLocation("tinker", "textures/gui/generic.png");
@@ -43,8 +47,13 @@ public class CraftingStationGui extends GuiContainer implements INEIGuiHandler {
private static final GuiElementScalable sliderBackground = new GuiElementScalable(43, 8, 12, 30, 64, 64);
private static final GuiElementScalable textBackground = new GuiElementScalable(7 + 18, 7, 18, 10, 64, 64);
private final GuiSliderWidget slider =
new GuiSliderWidget(sliderNormal, sliderHigh, sliderLow, sliderTop, sliderBottom, sliderBackground);
private final GuiSliderWidget slider = new GuiSliderWidget(
sliderNormal,
sliderHigh,
sliderLow,
sliderTop,
sliderBottom,
sliderBackground);
private final GuiBorderWidget border = new GuiBorderWidget();
private int firstSlotId;
@@ -119,15 +128,14 @@ public class CraftingStationGui extends GuiContainer implements INEIGuiHandler {
if (logic.chest != null) {
if (logic.chest.get() instanceof TileEntity) {
TileEntity te = (TileEntity) logic.chest.get();
if (te == null
|| te.getWorldObj().getTileEntity(te.xCoord, te.yCoord, te.zCoord) == null
&& te.getWorldObj().isRemote) {
if (te == null || te.getWorldObj().getTileEntity(te.xCoord, te.yCoord, te.zCoord) == null
&& te.getWorldObj().isRemote) {
mc.thePlayer.closeScreen();
return;
}
}
this.fontRendererObj.drawString(
StatCollector.translateToLocal(logic.chest.get().getInventoryName()), 8, 6, 0x202020);
this.fontRendererObj
.drawString(StatCollector.translateToLocal(logic.chest.get().getInventoryName()), 8, 6, 0x202020);
}
this.fontRendererObj.drawString(
@@ -135,22 +143,22 @@ public class CraftingStationGui extends GuiContainer implements INEIGuiHandler {
craftingTextLeft + 8,
6,
0x202020);
this.fontRendererObj.drawString(
StatCollector.translateToLocal("container.inventory"), craftingTextLeft + 8, 72, 0x202020);
this.fontRendererObj
.drawString(StatCollector.translateToLocal("container.inventory"), craftingTextLeft + 8, 72, 0x202020);
if (logic.tinkerTable) {
if (logic.isStackInSlot(0)) // output slot = modified item
drawToolStats(logic.getStackInSlot(0));
drawToolStats(logic.getStackInSlot(0));
else if (logic.isStackInSlot(5)) { // center slot if no output item
// other slots empty?
if (!logic.isStackInSlot(1)
&& !logic.isStackInSlot(2)
if (!logic.isStackInSlot(1) && !logic.isStackInSlot(2)
&& !logic.isStackInSlot(3)
&& !logic.isStackInSlot(4)
&& !logic.isStackInSlot(6)
&& !logic.isStackInSlot(7)
&& !logic.isStackInSlot(8)
&& !logic.isStackInSlot(9)) drawToolStats(logic.getStackInSlot(5));
&& !logic.isStackInSlot(9))
drawToolStats(logic.getStackInSlot(5));
else drawToolInformation();
} else drawToolInformation();
}
@@ -206,21 +214,18 @@ public class CraftingStationGui extends GuiContainer implements INEIGuiHandler {
16777215);
int attack = materialEnum.attack();
String heart = attack == 2
? StatCollector.translateToLocal("gui.partcrafter8")
String heart = attack == 2 ? StatCollector.translateToLocal("gui.partcrafter8")
: StatCollector.translateToLocal("gui.partcrafter9");
if (attack % 2 == 0)
this.fontRendererObj.drawString(
StatCollector.translateToLocal("gui.partcrafter10") + attack / 2 + heart,
baseX,
baseY + 60,
0xffffff);
else
this.fontRendererObj.drawString(
StatCollector.translateToLocal("gui.partcrafter10") + attack / 2f + heart,
baseX,
baseY + 60,
0xffffff);
if (attack % 2 == 0) this.fontRendererObj.drawString(
StatCollector.translateToLocal("gui.partcrafter10") + attack / 2 + heart,
baseX,
baseY + 60,
0xffffff);
else this.fontRendererObj.drawString(
StatCollector.translateToLocal("gui.partcrafter10") + attack / 2f + heart,
baseX,
baseY + 60,
0xffffff);
}
@Override
@@ -333,8 +338,7 @@ public class CraftingStationGui extends GuiContainer implements INEIGuiHandler {
final int xMod = (slider.isEnabled() ? slider.width : 0) + border.w;
final int yMod = (shouldDrawName() ? textBackground.y : 0) + (border.h * 2);
return mouseX >= (this.chestLeft - xMod)
&& mouseX < (chestLeft + chestWidth + xMod)
return mouseX >= (this.chestLeft - xMod) && mouseX < (chestLeft + chestWidth + xMod)
&& mouseY >= (this.chestTop - yMod)
&& mouseY < (chestTop + chestHeight + yMod);
}
@@ -349,14 +353,13 @@ public class CraftingStationGui extends GuiContainer implements INEIGuiHandler {
}
protected boolean shouldDrawName() {
return this.logic.chest != null
&& this.logic.chest.get().getInventoryName() != null
return this.logic.chest != null && this.logic.chest.get().getInventoryName() != null
&& !this.logic.chest.get().getInventoryName().isEmpty();
}
@Override
public void func_146977_a /*drawSlot*/(Slot slot) {
if (!slot.func_111238_b /*isEnabled*/()) return;
public void func_146977_a /* drawSlot */(Slot slot) {
if (!slot.func_111238_b /* isEnabled */()) return;
super.func_146977_a(slot);
}
@@ -406,8 +409,7 @@ public class CraftingStationGui extends GuiContainer implements INEIGuiHandler {
slider.disable();
}
chestWidth = logic.invColumns * CraftingStationGui.slotElement.w
+ 2 * border.w
chestWidth = logic.invColumns * CraftingStationGui.slotElement.w + 2 * border.w
+ (slider.isEnabled() ? slider.width : 0);
chestLeft = guiLeft - chestWidth;
@@ -415,8 +417,8 @@ public class CraftingStationGui extends GuiContainer implements INEIGuiHandler {
// Leaving out the xSize increase by chestSize and adjusting where it's used, because otherwise it shifts both
// the bookmarks and item panel
// way too far out. If anything (mouseClick, for example) relies on xSize, you'll need to hack it like below.
// xSize += guiLeft - chestLeft;
// way too far out. If anything (mouseClick, for example) relies on xSize, you'll need to hack it like below.
// xSize += guiLeft - chestLeft;
guiLeft = chestLeft;
border.setPosition(chestLeft, chestTop);
@@ -4,10 +4,13 @@ import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.*;
import net.minecraft.world.World;
import org.lwjgl.opengl.GL11;
import tconstruct.tools.logic.FrypanLogic;
public class FrypanGui extends GuiContainer {
public FrypanLogic logic;
public FrypanGui(InventoryPlayer inventoryplayer, FrypanLogic frypan, World world, int x, int y, int z) {
@@ -18,8 +21,8 @@ public class FrypanGui extends GuiContainer {
@Override
protected void drawGuiContainerForegroundLayer(int par1, int par2) {
fontRendererObj.drawString(StatCollector.translateToLocal("crafters.Frypan"), 60, 6, 0x404040);
fontRendererObj.drawString(
StatCollector.translateToLocal("container.inventory"), 8, (ySize - 96) + 2, 0x404040);
fontRendererObj
.drawString(StatCollector.translateToLocal("container.inventory"), 8, (ySize - 96) + 2, 0x404040);
}
private static final ResourceLocation background = new ResourceLocation("tinker", "textures/gui/frypan.png");
@@ -1,18 +1,21 @@
package tconstruct.tools.gui;
import cpw.mods.fml.relauncher.*;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import tconstruct.tools.inventory.FurnaceContainer;
import tconstruct.tools.logic.FurnaceLogic;
import cpw.mods.fml.relauncher.*;
@SideOnly(Side.CLIENT)
public class FurnaceGui extends GuiContainer {
private static final ResourceLocation furnaceGuiTextures =
new ResourceLocation("textures/gui/container/furnace.png");
private static final ResourceLocation furnaceGuiTextures = new ResourceLocation(
"textures/gui/container/furnace.png");
private final FurnaceLogic logic;
public FurnaceGui(InventoryPlayer inventory, FurnaceLogic furnace) {
@@ -21,8 +24,7 @@ public class FurnaceGui extends GuiContainer {
}
/**
* Draw the foreground layer for the GuiContainer (everything in front of
* the items)
* Draw the foreground layer for the GuiContainer (everything in front of the items)
*/
@Override
protected void drawGuiContainerForegroundLayer(int par1, int par2) {
@@ -32,8 +34,7 @@ public class FurnaceGui extends GuiContainer {
}
/**
* Draw the background layer for the GuiContainer (everything behind the
* items)
* Draw the background layer for the GuiContainer (everything behind the items)
*/
@Override
protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) {
@@ -1,22 +1,21 @@
package tconstruct.tools.gui;
/*
* Taken from Tinker's Construct 1.12 under the MIT License
*
* The MIT License (MIT) Copyright (c) 2013-2014 Slime Knights (mDiyo, fuj1n, Sunstrike, progwml6, pillbox, alexbegt)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
* Taken from Tinker's Construct 1.12 under the MIT License The MIT License (MIT) Copyright (c) 2013-2014 Slime Knights
* (mDiyo, fuj1n, Sunstrike, progwml6, pillbox, alexbegt) Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software
* without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute,
* sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions: The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
* AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
public class GuiBorderWidget {
// all elements based on generic gui
public GuiElementDuex cornerTopLeft = new GuiElementDuex(0, 0, 7, 7, 64, 64);
public GuiElementDuex cornerTopRight = new GuiElementDuex(64 - 7, 0, 7, 7, 64, 64);
@@ -3,13 +3,15 @@ package tconstruct.tools.gui;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import tconstruct.library.client.StencilGuiElement;
public class GuiButtonStencil extends GuiButton {
/**
* True for pointing right (next page), false for pointing left (previous
* page).
* True for pointing right (next page), false for pointing left (previous page).
*/
int textureX;
@@ -18,8 +20,8 @@ public class GuiButtonStencil extends GuiButton {
public StencilGuiElement element;
private static ResourceLocation background;
public GuiButtonStencil(
int id, int posX, int posY, int texX, int texY, String domain, String tex, StencilGuiElement e) {
public GuiButtonStencil(int id, int posX, int posY, int texX, int texY, String domain, String tex,
StencilGuiElement e) {
super(id, posX, posY, 18, 18, "");
textureX = texX;
textureY = texY;
@@ -34,15 +36,13 @@ public class GuiButtonStencil extends GuiButton {
@Override
public void drawButton(Minecraft mc, int mouseX, int mouseY) {
if (this.visible) {
boolean var4 = mouseX >= this.xPosition
&& mouseY >= this.yPosition
boolean var4 = mouseX >= this.xPosition && mouseY >= this.yPosition
&& mouseX < this.xPosition + this.width
&& mouseY < this.yPosition + this.height;
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
mc.getTextureManager().bindTexture(background);
this.field_146123_n = mouseX >= this.xPosition
&& mouseY >= this.yPosition
this.field_146123_n = mouseX >= this.xPosition && mouseY >= this.yPosition
&& mouseX < this.xPosition + this.width
&& mouseY < this.yPosition + this.height;
int var5 = this.getHoverState(this.field_146123_n);
@@ -1,17 +1,19 @@
package tconstruct.tools.gui;
import cpw.mods.fml.relauncher.*;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import tconstruct.library.client.ToolGuiElement;
import cpw.mods.fml.relauncher.*;
@SideOnly(Side.CLIENT)
public class GuiButtonTool extends GuiButton {
/**
* True for pointing right (next page), false for pointing left (previous
* page).
* True for pointing right (next page), false for pointing left (previous page).
*/
int textureX;
@@ -37,15 +39,13 @@ public class GuiButtonTool extends GuiButton {
@Override
public void drawButton(Minecraft mc, int mouseX, int mouseY) {
if (this.visible) {
boolean var4 = mouseX >= this.xPosition
&& mouseY >= this.yPosition
boolean var4 = mouseX >= this.xPosition && mouseY >= this.yPosition
&& mouseX < this.xPosition + this.width
&& mouseY < this.yPosition + this.height;
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
mc.getTextureManager().bindTexture(background);
this.field_146123_n = mouseX >= this.xPosition
&& mouseY >= this.yPosition
this.field_146123_n = mouseX >= this.xPosition && mouseY >= this.yPosition
&& mouseX < this.xPosition + this.width
&& mouseY < this.yPosition + this.height;
int var5 = this.getHoverState(this.field_146123_n);
@@ -1,24 +1,23 @@
package tconstruct.tools.gui;
import net.minecraft.client.gui.GuiScreen;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.gui.GuiScreen;
/*
* Taken from Mantle 1.12-1.3.3.49 under the MIT License
*
* The MIT License (MIT) Copyright (c) 2013-2014 Slime Knights (mDiyo, fuj1n, Sunstrike, progwml6, pillbox, alexbegt)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
* Taken from Mantle 1.12-1.3.3.49 under the MIT License The MIT License (MIT) Copyright (c) 2013-2014 Slime Knights
* (mDiyo, fuj1n, Sunstrike, progwml6, pillbox, alexbegt) Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software
* without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute,
* sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions: The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
* AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
@SideOnly(Side.CLIENT)
public class GuiElementDuex {
@@ -1,24 +1,23 @@
package tconstruct.tools.gui;
import net.minecraft.client.gui.GuiScreen;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.gui.GuiScreen;
/*
* Taken from Mantle 1.12-1.3.3.49 under the MIT License
*
* The MIT License (MIT) Copyright (c) 2013-2014 Slime Knights (mDiyo, fuj1n, Sunstrike, progwml6, pillbox, alexbegt)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
* Taken from Mantle 1.12-1.3.3.49 under the MIT License The MIT License (MIT) Copyright (c) 2013-2014 Slime Knights
* (mDiyo, fuj1n, Sunstrike, progwml6, pillbox, alexbegt) Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software
* without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute,
* sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions: The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
* AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
@SideOnly(Side.CLIENT)
public class GuiElementScalable extends GuiElementDuex {
@@ -1,28 +1,28 @@
package tconstruct.tools.gui;
import org.lwjgl.input.Mouse;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import org.lwjgl.input.Mouse;
/*
* Taken from Mantle 1.12-1.3.3.49 under the MIT License
*
* The MIT License (MIT) Copyright (c) 2013-2014 Slime Knights (mDiyo, fuj1n, Sunstrike, progwml6, pillbox, alexbegt)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
* Taken from Mantle 1.12-1.3.3.49 under the MIT License The MIT License (MIT) Copyright (c) 2013-2014 Slime Knights
* (mDiyo, fuj1n, Sunstrike, progwml6, pillbox, alexbegt) Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software
* without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute,
* sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions: The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
* AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
// a vertical slider!
@SideOnly(Side.CLIENT)
public class GuiSliderWidget {
// gui info
public final GuiElementDuex slider;
public final GuiElementDuex sliderHighlighted;
@@ -51,13 +51,8 @@ public class GuiSliderWidget {
private int clickY;
private boolean clickedBar; // if the bar has already been clicked and not released
public GuiSliderWidget(
GuiElementDuex slider,
GuiElementDuex sliderHighlighted,
GuiElementDuex sliderDisabled,
GuiElementDuex slideBarTop,
GuiElementDuex slideBarBottom,
GuiElementScalable slideBar) {
public GuiSliderWidget(GuiElementDuex slider, GuiElementDuex sliderHighlighted, GuiElementDuex sliderDisabled,
GuiElementDuex slideBarTop, GuiElementDuex slideBarBottom, GuiElementScalable slideBar) {
this.slider = slider;
this.sliderHighlighted = sliderHighlighted;
this.sliderDisabled = sliderDisabled;
@@ -1,27 +1,31 @@
package tconstruct.tools.gui;
import codechicken.nei.VisiblityData;
import codechicken.nei.api.INEIGuiHandler;
import codechicken.nei.api.TaggedInventoryArea;
import cpw.mods.fml.common.Optional;
import java.util.Collections;
import java.util.List;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import org.lwjgl.opengl.GL11;
import tconstruct.library.TConstructRegistry;
import tconstruct.library.crafting.PatternBuilder;
import tconstruct.library.tools.ToolMaterial;
import tconstruct.library.util.HarvestLevels;
import tconstruct.tools.inventory.PartCrafterChestContainer;
import tconstruct.tools.logic.PartBuilderLogic;
import codechicken.nei.VisiblityData;
import codechicken.nei.api.INEIGuiHandler;
import codechicken.nei.api.TaggedInventoryArea;
import cpw.mods.fml.common.Optional;
@Optional.Interface(iface = "codechicken.nei.api.INEIGuiHandler", modid = "NotEnoughItems")
public class PartCrafterGui extends GuiContainer implements INEIGuiHandler {
PartBuilderLogic logic;
String title, otherTitle = "";
boolean drawChestPart;
@@ -49,8 +53,8 @@ public class PartCrafterGui extends GuiContainer implements INEIGuiHandler {
private int chestLeft = 0;
private int chestTop = 0;
public PartCrafterGui(
InventoryPlayer inventoryplayer, PartBuilderLogic partlogic, World world, int x, int y, int z) {
public PartCrafterGui(InventoryPlayer inventoryplayer, PartBuilderLogic partlogic, World world, int x, int y,
int z) {
super(partlogic.getGuiContainer(inventoryplayer, world, x, y, z));
logic = partlogic;
drawChestPart = inventorySlots instanceof PartCrafterChestContainer;
@@ -92,8 +96,8 @@ public class PartCrafterGui extends GuiContainer implements INEIGuiHandler {
this.fontRendererObj.drawString(StatCollector.translateToLocal("inventory.PatternChest"), 14, 17, 4210752);
}
this.fontRendererObj.drawString(
StatCollector.translateToLocal("crafters.PartBuilder"), craftingTextLeft + 6, 6, 4210752);
this.fontRendererObj
.drawString(StatCollector.translateToLocal("crafters.PartBuilder"), craftingTextLeft + 6, 6, 4210752);
this.fontRendererObj.drawString(
StatCollector.translateToLocal("container.inventory"),
craftingTextLeft + 8,
@@ -107,7 +111,11 @@ public class PartCrafterGui extends GuiContainer implements INEIGuiHandler {
title = "\u00A7n" + StatCollector.translateToLocal("gui.partcrafter2");
this.drawCenteredString(fontRendererObj, title, descTextLeft + DESC_WIDTH / 2, 8, 16777215);
fontRendererObj.drawSplitString(
StatCollector.translateToLocal("gui.partcrafter3"), descTextLeft + 8, 24, 115, 16777215);
StatCollector.translateToLocal("gui.partcrafter3"),
descTextLeft + 8,
24,
115,
16777215);
}
void drawMaterialInformation() {
@@ -165,21 +173,18 @@ public class PartCrafterGui extends GuiContainer implements INEIGuiHandler {
16777215);
int attack = topEnum.attack();
String heart = attack == 2
? StatCollector.translateToLocal("gui.partcrafter8")
String heart = attack == 2 ? StatCollector.translateToLocal("gui.partcrafter8")
: StatCollector.translateToLocal("gui.partcrafter9");
if (attack % 2 == 0)
this.fontRendererObj.drawString(
StatCollector.translateToLocal("gui.partcrafter10") + attack / 2 + heart,
descTextLeft + 8,
offset + 60,
0xffffff);
else
this.fontRendererObj.drawString(
StatCollector.translateToLocal("gui.partcrafter10") + attack / 2f + heart,
descTextLeft + 8,
offset + 60,
0xffffff);
if (attack % 2 == 0) this.fontRendererObj.drawString(
StatCollector.translateToLocal("gui.partcrafter10") + attack / 2 + heart,
descTextLeft + 8,
offset + 60,
0xffffff);
else this.fontRendererObj.drawString(
StatCollector.translateToLocal("gui.partcrafter10") + attack / 2f + heart,
descTextLeft + 8,
offset + 60,
0xffffff);
}
offset = 90;
@@ -207,29 +212,27 @@ public class PartCrafterGui extends GuiContainer implements INEIGuiHandler {
offset + 49,
16777215);
int attack = bottomEnum.attack();
String heart = attack == 2
? StatCollector.translateToLocal("gui.partcrafter8")
String heart = attack == 2 ? StatCollector.translateToLocal("gui.partcrafter8")
: StatCollector.translateToLocal("gui.partcrafter9");
if (attack % 2 == 0)
this.fontRendererObj.drawString(
StatCollector.translateToLocal("gui.partcrafter10") + attack / 2 + heart,
descTextLeft + 8,
offset + 60,
0xffffff);
else
this.fontRendererObj.drawString(
StatCollector.translateToLocal("gui.partcrafter10") + attack / 2f + heart,
descTextLeft + 8,
offset + 60,
0xffffff);
if (attack % 2 == 0) this.fontRendererObj.drawString(
StatCollector.translateToLocal("gui.partcrafter10") + attack / 2 + heart,
descTextLeft + 8,
offset + 60,
0xffffff);
else this.fontRendererObj.drawString(
StatCollector.translateToLocal("gui.partcrafter10") + attack / 2f + heart,
descTextLeft + 8,
offset + 60,
0xffffff);
}
if (!hasTop && !hasBottom) drawDefaultInformation();
}
private static final ResourceLocation background = new ResourceLocation("tinker", "textures/gui/toolparts.png");
private static final ResourceLocation minichest =
new ResourceLocation("tinker", "textures/gui/patternchestmini.png");
private static final ResourceLocation minichest = new ResourceLocation(
"tinker",
"textures/gui/patternchestmini.png");
private static final ResourceLocation description = new ResourceLocation("tinker", "textures/gui/description.png");
@Override
@@ -4,14 +4,17 @@ import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.*;
import net.minecraft.world.World;
import org.lwjgl.opengl.GL11;
import tconstruct.tools.logic.PatternChestLogic;
public class PatternChestGui extends GuiContainer {
public PatternChestLogic logic;
public PatternChestGui(
InventoryPlayer inventoryplayer, PatternChestLogic holder, World world, int x, int y, int z) {
public PatternChestGui(InventoryPlayer inventoryplayer, PatternChestLogic holder, World world, int x, int y,
int z) {
super(holder.getGuiContainer(inventoryplayer, world, x, y, z));
logic = holder;
xSize = 194;
@@ -21,8 +24,8 @@ public class PatternChestGui extends GuiContainer {
@Override
protected void drawGuiContainerForegroundLayer(int par1, int par2) {
fontRendererObj.drawString(StatCollector.translateToLocal("inventory.PatternChest"), 60, 6, 0x404040);
fontRendererObj.drawString(
StatCollector.translateToLocal("container.inventory"), 17, (ySize - 96) + 2, 0x404040);
fontRendererObj
.drawString(StatCollector.translateToLocal("container.inventory"), 17, (ySize - 96) + 2, 0x404040);
}
private static final ResourceLocation background = new ResourceLocation("tinker", "textures/gui/patternchest.png");
@@ -1,34 +1,38 @@
package tconstruct.tools.gui;
import codechicken.nei.VisiblityData;
import codechicken.nei.api.INEIGuiHandler;
import codechicken.nei.api.TaggedInventoryArea;
import cpw.mods.fml.common.Optional;
import java.util.Collections;
import java.util.List;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.*;
import net.minecraft.world.World;
import org.lwjgl.opengl.GL11;
import tconstruct.TConstruct;
import tconstruct.library.client.*;
import tconstruct.library.crafting.StencilBuilder;
import tconstruct.tools.inventory.PatternShaperContainer;
import tconstruct.tools.logic.StencilTableLogic;
import tconstruct.util.network.PatternTablePacket;
import codechicken.nei.VisiblityData;
import codechicken.nei.api.INEIGuiHandler;
import codechicken.nei.api.TaggedInventoryArea;
import cpw.mods.fml.common.Optional;
@Optional.Interface(iface = "codechicken.nei.api.INEIGuiHandler", modid = "NotEnoughItems")
public class StencilTableGui extends GuiContainer implements INEIGuiHandler {
int[] buttonsLeftRect = new int[] {Integer.MAX_VALUE, Integer.MIN_VALUE};
int[] buttonsRightRect = new int[] {Integer.MIN_VALUE, Integer.MIN_VALUE};
int[] buttonsLeftRect = new int[] { Integer.MAX_VALUE, Integer.MIN_VALUE };
int[] buttonsRightRect = new int[] { Integer.MIN_VALUE, Integer.MIN_VALUE };
StencilTableLogic logic;
int activeButton;
public StencilTableGui(
InventoryPlayer inventoryplayer, StencilTableLogic shaper, World world, int x, int y, int z) {
public StencilTableGui(InventoryPlayer inventoryplayer, StencilTableLogic shaper, World world, int x, int y,
int z) {
super(new PatternShaperContainer(inventoryplayer, shaper));
logic = shaper;
activeButton = 0;
@@ -42,8 +46,8 @@ public class StencilTableGui extends GuiContainer implements INEIGuiHandler {
@Override
protected void drawGuiContainerForegroundLayer(int par1, int par2) {
fontRendererObj.drawString(StatCollector.translateToLocal("crafters.PatternShaper"), 50, 6, 0x404040);
fontRendererObj.drawString(
StatCollector.translateToLocal("container.inventory"), 8, (ySize - 96) + 2, 0x404040);
fontRendererObj
.drawString(StatCollector.translateToLocal("container.inventory"), 8, (ySize - 96) + 2, 0x404040);
}
private static final ResourceLocation background = new ResourceLocation("tinker", "textures/gui/patternshaper.png");
@@ -69,8 +73,8 @@ public class StencilTableGui extends GuiContainer implements INEIGuiHandler {
int cornerY = this.guiTop + 2;
this.buttonList.clear();
this.buttonsLeftRect = new int[] {Integer.MAX_VALUE, Integer.MIN_VALUE};
this.buttonsRightRect = new int[] {Integer.MIN_VALUE, Integer.MIN_VALUE};
this.buttonsLeftRect = new int[] { Integer.MAX_VALUE, Integer.MIN_VALUE };
this.buttonsRightRect = new int[] { Integer.MIN_VALUE, Integer.MIN_VALUE };
int id = 0;
for (int iter = 0; iter < TConstructClientRegistry.stencilButtons.size(); iter++) {
@@ -115,8 +119,8 @@ public class StencilTableGui extends GuiContainer implements INEIGuiHandler {
if (logic.getStackInSlot(1) != null) {
activeButton = StencilBuilder.getId(logic.getStackInSlot(1));
setActiveButton(activeButton);
stack = StencilBuilder.getStencil(
((GuiButtonStencil) this.buttonList.get(activeButton)).element.stencilIndex);
stack = StencilBuilder
.getStencil(((GuiButtonStencil) this.buttonList.get(activeButton)).element.stencilIndex);
} else stack = null;
logic.setSelectedPattern(stack);
@@ -175,16 +179,14 @@ public class StencilTableGui extends GuiContainer implements INEIGuiHandler {
public boolean hideItemPanelSlot(GuiContainer guiContainer, int x, int y, int w, int h) {
// is it in the horizontal column of the right buttons?
if (x > this.guiLeft + this.xSize
&& x < this.buttonsRightRect[0]
if (x > this.guiLeft + this.xSize && x < this.buttonsRightRect[0]
&& y + h > this.guiTop
&& y < this.buttonsRightRect[1]) {
return true;
}
// is it in the horizontal column of the left buttons?
return x + w > this.buttonsLeftRect[0]
&& x < this.guiLeft
return x + w > this.buttonsLeftRect[0] && x < this.guiLeft
&& y + h > this.guiTop
&& y < this.buttonsLeftRect[1];
}
@@ -1,19 +1,21 @@
package tconstruct.tools.gui;
import cpw.mods.fml.relauncher.*;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import tconstruct.library.client.*;
import tconstruct.tools.logic.ToolForgeLogic;
import cpw.mods.fml.relauncher.*;
@SideOnly(Side.CLIENT)
public class ToolForgeGui extends ToolStationGui {
int selectedButton;
public ToolForgeGui(
InventoryPlayer inventoryplayer, ToolForgeLogic stationlogic, World world, int x, int y, int z) {
public ToolForgeGui(InventoryPlayer inventoryplayer, ToolForgeLogic stationlogic, World world, int x, int y,
int z) {
super(inventoryplayer, stationlogic, world, x, y, z);
}
@@ -92,8 +94,8 @@ public class ToolForgeGui extends ToolStationGui {
this.text.setText("");
selectedButton = 0;
setSlotType(0);
iconX = new int[] {0, 1, 2, 13};
iconY = new int[] {13, 13, 13, 13};
iconX = new int[] { 0, 1, 2, 13 };
iconY = new int[] { 13, 13, 13, 13 };
title = "\u00A7n" + StatCollector.translateToLocal("gui.toolforge1");
body = StatCollector.translateToLocal("gui.toolforge2");
}
@@ -102,44 +104,44 @@ public class ToolForgeGui extends ToolStationGui {
void setSlotType(int type) {
switch (type) {
case 0:
slotX = new int[] {56, 38, 38, 14}; // Repair
slotY = new int[] {37, 28, 46, 37};
slotX = new int[] { 56, 38, 38, 14 }; // Repair
slotY = new int[] { 37, 28, 46, 37 };
break;
case 1:
slotX = new int[] {56, 56, 56, 14}; // Three parts
slotY = new int[] {19, 55, 37, 37};
slotX = new int[] { 56, 56, 56, 14 }; // Three parts
slotY = new int[] { 19, 55, 37, 37 };
break;
case 2:
slotX = new int[] {56, 56, 14, 14}; // Two parts
slotY = new int[] {28, 46, 28, 46};
slotX = new int[] { 56, 56, 14, 14 }; // Two parts
slotY = new int[] { 28, 46, 28, 46 };
break;
case 3:
slotX = new int[] {38, 47, 56, 14}; // Double head
slotY = new int[] {28, 46, 28, 37};
slotX = new int[] { 38, 47, 56, 14 }; // Double head
slotY = new int[] { 28, 46, 28, 37 };
break;
case 4:
slotX = new int[] {47, 38, 56, 47}; // Four parts
slotY = new int[] {19, 37, 37, 55};
slotX = new int[] { 47, 38, 56, 47 }; // Four parts
slotY = new int[] { 19, 37, 37, 55 };
break;
case 5:
slotX = new int[] {38, 47, 56, 47}; // Four parts, double head
slotY = new int[] {19, 55, 19, 37};
slotX = new int[] { 38, 47, 56, 47 }; // Four parts, double head
slotY = new int[] { 19, 55, 19, 37 };
break;
case 6:
slotX = new int[] {38, 38, 20, 56}; // Double head
slotY = new int[] {28, 46, 28, 28};
slotX = new int[] { 38, 38, 20, 56 }; // Double head
slotY = new int[] { 28, 46, 28, 28 };
break;
case 7:
slotX = new int[] {56, 56, 56, 14}; // Three parts reverse
slotY = new int[] {19, 37, 55, 37};
slotX = new int[] { 56, 56, 56, 14 }; // Three parts reverse
slotY = new int[] { 19, 37, 55, 37 };
break;
case 8:
slotX = new int[] {20, 38, 56, 38}; // Double head middle
slotY = new int[] {28, 46, 28, 28};
slotX = new int[] { 20, 38, 56, 38 }; // Double head middle
slotY = new int[] { 28, 46, 28, 28 };
break;
case 9:
slotX = new int[] {38, 56, 47, 47}; // Four parts, crossbow.
slotY = new int[] {37, 37, 55, 19};
slotX = new int[] { 38, 56, 47, 47 }; // Four parts, crossbow.
slotY = new int[] { 37, 37, 55, 19 };
break;
}
toolSlots.resetSlots(slotX, slotY);
@@ -1,13 +1,8 @@
package tconstruct.tools.gui;
import codechicken.nei.VisiblityData;
import codechicken.nei.api.INEIGuiHandler;
import codechicken.nei.api.TaggedInventoryArea;
import cpw.mods.fml.common.Optional;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.Collections;
import java.util.List;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiTextField;
import net.minecraft.client.gui.inventory.GuiContainer;
@@ -16,18 +11,27 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.GL11;
import tconstruct.TConstruct;
import tconstruct.library.client.TConstructClientRegistry;
import tconstruct.library.client.ToolGuiElement;
import tconstruct.tools.inventory.ToolStationContainer;
import tconstruct.tools.logic.ToolStationLogic;
import tconstruct.util.network.ToolStationPacket;
import codechicken.nei.VisiblityData;
import codechicken.nei.api.INEIGuiHandler;
import codechicken.nei.api.TaggedInventoryArea;
import cpw.mods.fml.common.Optional;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
@Optional.Interface(iface = "codechicken.nei.api.INEIGuiHandler", modid = "NotEnoughItems")
public class ToolStationGui extends GuiContainer implements INEIGuiHandler {
public ToolStationLogic logic;
public ToolStationContainer toolSlots;
public GuiTextField text;
@@ -37,8 +41,8 @@ public class ToolStationGui extends GuiContainer implements INEIGuiHandler {
public boolean active;
public String title, body = "";
public ToolStationGui(
InventoryPlayer inventoryplayer, ToolStationLogic stationlogic, World world, int x, int y, int z) {
public ToolStationGui(InventoryPlayer inventoryplayer, ToolStationLogic stationlogic, World world, int x, int y,
int z) {
super(stationlogic.getGuiContainer(inventoryplayer, world, x, y, z));
this.logic = stationlogic;
toolSlots = (ToolStationContainer) inventorySlots;
@@ -70,8 +74,8 @@ public class ToolStationGui extends GuiContainer implements INEIGuiHandler {
this.text.setText("");
guiType = 0;
setSlotType(0);
iconX = new int[] {0, 1, 2};
iconY = new int[] {13, 13, 13};
iconX = new int[] { 0, 1, 2 };
iconY = new int[] { 13, 13, 13 };
title = "\u00A7n" + StatCollector.translateToLocal("gui.toolforge1");
body = StatCollector.translateToLocal("gui.toolforge2");
}
@@ -136,24 +140,24 @@ public class ToolStationGui extends GuiContainer implements INEIGuiHandler {
void setSlotType(int type) {
switch (type) {
case 0:
slotX = new int[] {56, 38, 38}; // Repair
slotY = new int[] {37, 28, 46};
slotX = new int[] { 56, 38, 38 }; // Repair
slotY = new int[] { 37, 28, 46 };
break;
case 1:
slotX = new int[] {56, 56, 56}; // Three parts
slotY = new int[] {19, 55, 37};
slotX = new int[] { 56, 56, 56 }; // Three parts
slotY = new int[] { 19, 55, 37 };
break;
case 2:
slotX = new int[] {56, 56, 14}; // Two parts
slotY = new int[] {28, 46, 37};
slotX = new int[] { 56, 56, 14 }; // Two parts
slotY = new int[] { 28, 46, 37 };
break;
case 3:
slotX = new int[] {38, 47, 56}; // Double head
slotY = new int[] {28, 46, 28};
slotX = new int[] { 38, 47, 56 }; // Double head
slotY = new int[] { 28, 46, 28 };
break;
case 7:
slotX = new int[] {56, 56, 56}; // Three parts reverse
slotY = new int[] {19, 37, 55};
slotX = new int[] { 56, 56, 56 }; // Three parts reverse
slotY = new int[] { 19, 37, 55 };
break;
}
toolSlots.resetSlots(slotX, slotY);
@@ -166,14 +170,13 @@ public class ToolStationGui extends GuiContainer implements INEIGuiHandler {
}
/**
* Draw the foreground layer for the GuiContainer (everything in front of
* the items)
* Draw the foreground layer for the GuiContainer (everything in front of the items)
*/
@Override
protected void drawGuiContainerForegroundLayer(int par1, int par2) {
this.fontRendererObj.drawString(StatCollector.translateToLocal(logic.getInvName()), 116, 8, 0x000000);
this.fontRendererObj.drawString(
StatCollector.translateToLocal("container.inventory"), 118, this.ySize - 96 + 2, 0x000000);
this.fontRendererObj
.drawString(StatCollector.translateToLocal("container.inventory"), 118, this.ySize - 96 + 2, 0x000000);
this.fontRendererObj.drawString(toolName + "_", 180, 8, 0xffffff);
if (logic.isStackInSlot(0)) ToolStationGuiHelper.drawToolStats(logic.getStackInSlot(0), 294, 0);
@@ -190,8 +193,7 @@ public class ToolStationGui extends GuiContainer implements INEIGuiHandler {
private static final ResourceLocation description = new ResourceLocation("tinker", "textures/gui/description.png");
/**
* Draw the background layer for the GuiContainer (everything behind the
* items)
* Draw the background layer for the GuiContainer (everything behind the items)
*/
@Override
protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) {
@@ -213,7 +215,12 @@ public class ToolStationGui extends GuiContainer implements INEIGuiHandler {
this.drawTexturedModalRect(cornerX + slotX[i], this.guiTop + slotY[i], 144, 216, 18, 18);
if (!logic.isStackInSlot(i + 1)) {
this.drawTexturedModalRect(
cornerX + slotX[i], this.guiTop + slotY[i], 18 * iconX[i], 18 * iconY[i], 18, 18);
cornerX + slotX[i],
this.guiTop + slotY[i],
18 * iconX[i],
18 * iconY[i],
18,
18);
}
}
@@ -240,19 +247,12 @@ public class ToolStationGui extends GuiContainer implements INEIGuiHandler {
void updateServer(String name) {
/*
* ByteArrayOutputStream bos = new ByteArrayOutputStream(8);
* DataOutputStream outputStream = new DataOutputStream(bos); try {
* outputStream.writeByte(1);
* outputStream.writeInt(logic.getWorld().provider.dimensionId);
* outputStream.writeInt(logic.xCoord);
* outputStream.writeInt(logic.yCoord);
* outputStream.writeInt(logic.zCoord); outputStream.writeUTF(name); }
* catch (Exception ex) { ex.printStackTrace(); }
*
* Packet250CustomPayload packet = new Packet250CustomPayload();
* packet.channel = "TConstruct"; packet.data = bos.toByteArray();
* packet.length = bos.size();
*
* ByteArrayOutputStream bos = new ByteArrayOutputStream(8); DataOutputStream outputStream = new
* DataOutputStream(bos); try { outputStream.writeByte(1);
* outputStream.writeInt(logic.getWorld().provider.dimensionId); outputStream.writeInt(logic.xCoord);
* outputStream.writeInt(logic.yCoord); outputStream.writeInt(logic.zCoord); outputStream.writeUTF(name); }
* catch (Exception ex) { ex.printStackTrace(); } Packet250CustomPayload packet = new Packet250CustomPayload();
* packet.channel = "TConstruct"; packet.data = bos.toByteArray(); packet.length = bos.size();
* PacketDispatcher.sendPacketToServer(packet);
*/
@@ -260,9 +260,8 @@ public class ToolStationGui extends GuiContainer implements INEIGuiHandler {
}
/*
* protected void mouseClicked(int par1, int par2, int par3) {
* super.mouseClicked(par1, par2, par3); text.mouseClicked(par1, par2,
* par3); }
* protected void mouseClicked(int par1, int par2, int par3) { super.mouseClicked(par1, par2, par3);
* text.mouseClicked(par1, par2, par3); }
*/
@Override
@@ -4,6 +4,7 @@ import java.text.DecimalFormat;
import java.util.Arrays;
import java.util.Collection;
import java.util.LinkedList;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.item.Item;
@@ -11,6 +12,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.StatCollector;
import tconstruct.library.accessory.AccessoryCore;
import tconstruct.library.armor.ArmorCore;
import tconstruct.library.modifier.IModifyable;
@@ -22,6 +24,7 @@ import tconstruct.library.weaponry.IAmmo;
import tconstruct.library.weaponry.ProjectileWeapon;
public final class ToolStationGuiHelper {
// non-instantiable
private ToolStationGuiHelper() {}
@@ -40,8 +43,7 @@ public final class ToolStationGuiHelper {
}
public static void drawToolStats(ItemStack stack, int x, int y) {
String name = stack.getItem() instanceof ToolCore
? ((ToolCore) stack.getItem()).getLocalizedToolName()
String name = stack.getItem() instanceof ToolCore ? ((ToolCore) stack.getItem()).getLocalizedToolName()
: stack.getDisplayName();
Item item = stack.getItem();
NBTTagCompound tags = stack.getTagCompound();
@@ -147,8 +149,7 @@ public final class ToolStationGuiHelper {
EnumChatFormatting.getTextWithoutFormattingCodes(tipName),
StatCollector.translateToLocal(locString));
// re-add the X/Y
if (bracket > 0)
tipName += " " + tags.getString(tooltip + tipNum).substring(bracket);
if (bracket > 0) tipName += " " + tags.getString(tooltip + tipNum).substring(bracket);
}
write("- " + tipName);
tipNum++;
@@ -162,13 +163,13 @@ public final class ToolStationGuiHelper {
write(StatCollector.translateToLocal("gui.toolstation14") + df.format(mineSpeed));
if (stoneboundSpeed != 0) {
String bloss = stoneboundSpeed > 0
? StatCollector.translateToLocal("gui.toolstation4")
String bloss = stoneboundSpeed > 0 ? StatCollector.translateToLocal("gui.toolstation4")
: StatCollector.translateToLocal("gui.toolstation5");
write(bloss + df.format(stoneboundSpeed));
}
write(StatCollector.translateToLocal("gui.toolstation15")
+ HarvestLevels.getHarvestLevelName(tags.getInteger("HarvestLevel")));
write(
StatCollector.translateToLocal("gui.toolstation15")
+ HarvestLevels.getHarvestLevelName(tags.getInteger("HarvestLevel")));
}
private static void drawDualHarvestStats(ToolCore tool, NBTTagCompound tags) {
@@ -179,15 +180,16 @@ public final class ToolStationGuiHelper {
write(StatCollector.translateToLocal("gui.toolstation12"));
write("- " + df.format(mineSpeed) + ", " + df.format(mineSpeed2));
if (stoneboundSpeed != 0) {
String bloss = stoneboundSpeed > 0
? StatCollector.translateToLocal("gui.toolstation4")
String bloss = stoneboundSpeed > 0 ? StatCollector.translateToLocal("gui.toolstation4")
: StatCollector.translateToLocal("gui.toolstation5");
write(bloss + df.format(stoneboundSpeed));
}
write(StatCollector.translateToLocal("gui.toolstation13"));
write("- " + HarvestLevels.getHarvestLevelName(tags.getInteger("HarvestLevel")) + ", "
+ HarvestLevels.getHarvestLevelName(tags.getInteger("HarvestLevel2")));
write(
"- " + HarvestLevels.getHarvestLevelName(tags.getInteger("HarvestLevel"))
+ ", "
+ HarvestLevels.getHarvestLevelName(tags.getInteger("HarvestLevel2")));
}
private static void drawWeaponStats(ToolCore tool, NBTTagCompound tags) {
@@ -201,18 +203,15 @@ public final class ToolStationGuiHelper {
if (attack < 1) attack = 1;
String heart = attack == 2
? StatCollector.translateToLocal("gui.partcrafter8")
String heart = attack == 2 ? StatCollector.translateToLocal("gui.partcrafter8")
: StatCollector.translateToLocal("gui.partcrafter9");
if (attack % 2 == 0) write(StatCollector.translateToLocal("gui.toolstation3") + attack / 2 + heart);
else write(StatCollector.translateToLocal("gui.toolstation3") + df.format(attack / 2f) + heart);
if (stoneboundDamage != 0) {
heart = stoneboundDamage == 2
? StatCollector.translateToLocal("gui.partcrafter8")
heart = stoneboundDamage == 2 ? StatCollector.translateToLocal("gui.partcrafter8")
: StatCollector.translateToLocal("gui.partcrafter9");
String bloss = stoneboundDamage > 0
? StatCollector.translateToLocal("gui.toolstation4")
String bloss = stoneboundDamage > 0 ? StatCollector.translateToLocal("gui.toolstation4")
: StatCollector.translateToLocal("gui.toolstation5");
write(bloss + df.format(stoneboundDamage / 2f) + heart);
}
@@ -227,8 +226,7 @@ public final class ToolStationGuiHelper {
int attack = (int) attackf;
String heart = attack == 2
? StatCollector.translateToLocal("gui.partcrafter8")
String heart = attack == 2 ? StatCollector.translateToLocal("gui.partcrafter8")
: StatCollector.translateToLocal("gui.partcrafter9");
if (attack % 2 == 0) write(StatCollector.translateToLocal("gui.toolstation23") + attack / 2 + heart);
else write(StatCollector.translateToLocal("gui.toolstation23") + df.format(attack / 2f) + heart);
@@ -269,8 +267,10 @@ public final class ToolStationGuiHelper {
double protection = armor.getProtection(stack);
double maxProtection = tags.getDouble("MaxDefense");
write(StatCollector.translateToLocal("gui.toolstation20") + df.format(protection) + "/"
+ df.format(maxProtection));
write(
StatCollector.translateToLocal("gui.toolstation20") + df.format(protection)
+ "/"
+ df.format(maxProtection));
}
private static void drawAccessoryStats(AccessoryCore core, NBTTagCompound tags) {
@@ -282,12 +282,14 @@ public final class ToolStationGuiHelper {
}
/**
* Renders the specified text to the screen, center-aligned.
* Copied out of GUI
* Renders the specified text to the screen, center-aligned. Copied out of GUI
*/
public static void drawCenteredString(
FontRenderer p_73732_1_, String p_73732_2_, int p_73732_3_, int p_73732_4_, int p_73732_5_) {
public static void drawCenteredString(FontRenderer p_73732_1_, String p_73732_2_, int p_73732_3_, int p_73732_4_,
int p_73732_5_) {
p_73732_1_.drawStringWithShadow(
p_73732_2_, p_73732_3_ - p_73732_1_.getStringWidth(p_73732_2_) / 2, p_73732_4_, p_73732_5_);
p_73732_2_,
p_73732_3_ - p_73732_1_.getStringWidth(p_73732_2_) / 2,
p_73732_4_,
p_73732_5_);
}
}