diff --git a/client/src/main/java/client/gui/Gui.java b/client/src/main/java/client/gui/Gui.java index cede18d3..c53f8d40 100644 --- a/client/src/main/java/client/gui/Gui.java +++ b/client/src/main/java/client/gui/Gui.java @@ -51,12 +51,6 @@ public abstract class Gui { public void drawPost() { } - -// public void drawGuiContainerForegroundLayer() { -// } -// -// public void drawGuiContainerBackgroundLayer() { -// } public void drawOverlays() { } @@ -196,14 +190,14 @@ public abstract class Gui { } public void draw() { - if(this.selected != null && /* this.selected.r_dirty && */ this.selected instanceof Handle && !this.selected.visible) { + if(this.selected != null && this.selected instanceof Handle && !this.selected.visible) { this.selected = null; } for(Element elem : this.elems) { - if(/* this.selected != e || */ !(elem instanceof Handle)) // || !e.visible) + if(!(elem instanceof Handle)) elem.draw(); } - if(this.selected != null && /* elem.r_dirty && */ this.selected instanceof Handle && this.selected.visible) { + if(this.selected != null && this.selected instanceof Handle && this.selected.visible) { this.selected.draw(); } } @@ -220,100 +214,9 @@ public abstract class Gui { if(elem != null && elem.enabled && elem.visible && elem.canHover()) elem.drawHover(); } - -// public static void drawRect(int left, int top, int right, int bottom, int color) -// { -// if (left < right) -// { -// int i = left; -// left = right; -// right = i; -// } -// -// if (top < bottom) -// { -// int j = top; -// top = bottom; -// bottom = j; -// } -// -// float f3 = (float)(color >> 24 & 255) / 255.0F; -// float f = (float)(color >> 16 & 255) / 255.0F; -// float f1 = (float)(color >> 8 & 255) / 255.0F; -// float f2 = (float)(color & 255) / 255.0F; -// RenderBuffer worldrenderer = Tessellator.getBuffer(); -// GlState.enableBlend(); -// GlState.disableTexture2D(); -// GlState.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO); -// GlState.color(f, f1, f2, f3); -// worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION); -// worldrenderer.pos((double)left, (double)bottom, 0.0D).endVertex(); -// worldrenderer.pos((double)right, (double)bottom, 0.0D).endVertex(); -// worldrenderer.pos((double)right, (double)top, 0.0D).endVertex(); -// worldrenderer.pos((double)left, (double)top, 0.0D).endVertex(); -// Tessellator.draw(); -// GlState.enableTexture2D(); -// GlState.disableBlend(); -// } - -// public static void drawTexturedModalRect(int x, int y, int textureX, int textureY, int width, int height) -// { -// float f = 0.00390625F; -// float f1 = 0.00390625F; -// RenderBuffer worldrenderer = Tessellator.getBuffer(); -// worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX); -// worldrenderer.pos((double)(x + 0), (double)(y + height), 0.0D).tex((double)((float)(textureX + 0) * f), (double)((float)(textureY + height) * f1)).endVertex(); -// worldrenderer.pos((double)(x + width), (double)(y + height), 0.0D).tex((double)((float)(textureX + width) * f), (double)((float)(textureY + height) * f1)).endVertex(); -// worldrenderer.pos((double)(x + width), (double)(y + 0), 0.0D).tex((double)((float)(textureX + width) * f), (double)((float)(textureY + 0) * f1)).endVertex(); -// worldrenderer.pos((double)(x + 0), (double)(y + 0), 0.0D).tex((double)((float)(textureX + 0) * f), (double)((float)(textureY + 0) * f1)).endVertex(); -// Tessellator.draw(); -// } -// -// public static void drawScaledCustomSizeModalRect(int x, int y, float u, float v, int uWidth, int vHeight, int width, int height, float tileWidth, float tileHeight) -// { -// float f = 1.0F / tileWidth; -// float f1 = 1.0F / tileHeight; -// RenderBuffer worldrenderer = Tessellator.getBuffer(); -// worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX); -// worldrenderer.pos((double)x, (double)(y + height), 0.0D).tex((double)(u * f), (double)((v + (float)vHeight) * f1)).endVertex(); -// worldrenderer.pos((double)(x + width), (double)(y + height), 0.0D).tex((double)((u + (float)uWidth) * f), (double)((v + (float)vHeight) * f1)).endVertex(); -// worldrenderer.pos((double)(x + width), (double)y, 0.0D).tex((double)((u + (float)uWidth) * f), (double)(v * f1)).endVertex(); -// worldrenderer.pos((double)x, (double)y, 0.0D).tex((double)(u * f), (double)(v * f1)).endVertex(); -// Tessellator.draw(); -// } -// -// public static void drawGradientRect(int left, int top, int right, int bottom, int startColor, int endColor) -// { -// float f = (float)(startColor >> 24 & 255) / 255.0F; -// float f1 = (float)(startColor >> 16 & 255) / 255.0F; -// float f2 = (float)(startColor >> 8 & 255) / 255.0F; -// float f3 = (float)(startColor & 255) / 255.0F; -// float f4 = (float)(endColor >> 24 & 255) / 255.0F; -// float f5 = (float)(endColor >> 16 & 255) / 255.0F; -// float f6 = (float)(endColor >> 8 & 255) / 255.0F; -// float f7 = (float)(endColor & 255) / 255.0F; -// GlState.disableTexture2D(); -// GlState.enableBlend(); -// GlState.disableAlpha(); -// GlState.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO); -// GlState.shadeModel(GL11.GL_SMOOTH); -// RenderBuffer worldrenderer = Tessellator.getBuffer(); -// worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR); -// worldrenderer.pos((double)right, (double)top, 0.0).color(f1, f2, f3, f).endVertex(); -// worldrenderer.pos((double)left, (double)top, 0.0).color(f1, f2, f3, f).endVertex(); -// worldrenderer.pos((double)left, (double)bottom, 0.0).color(f5, f6, f7, f4).endVertex(); -// worldrenderer.pos((double)right, (double)bottom, 0.0).color(f5, f6, f7, f4).endVertex(); -// Tessellator.draw(); -// GlState.shadeModel(GL11.GL_FLAT); -// GlState.disableBlend(); -// GlState.enableAlpha(); -// GlState.enableTexture2D(); -// } - + public void drawMainBackground() { if(this.gm.world != null && !this.gm.charEditor) { -// Drawing.drawGradient(0, 0, this.fb_x, this.fb_y, this.theWorld == null ? this.style.bg_top : 0x3f202020, -// this.theWorld == null ? this.style.bg_btm : 0x3f000000); Drawing.drawGradient(0, 0, this.gm.fb_x, this.gm.fb_y, 0xc0101010, 0xd0101010); } else { diff --git a/client/src/main/java/client/gui/container/GuiRepair.java b/client/src/main/java/client/gui/container/GuiRepair.java index 0fff6cfc..7349f17c 100755 --- a/client/src/main/java/client/gui/container/GuiRepair.java +++ b/client/src/main/java/client/gui/container/GuiRepair.java @@ -1,43 +1,22 @@ package client.gui.container; -import java.util.List; - -import client.Client; import client.gui.element.Label; import common.color.TextColor; -import common.inventory.Container; import common.inventory.ContainerRepair; -import common.inventory.ICrafting; -import common.inventory.IInventory; import common.inventory.InventoryPlayer; -import common.item.ItemStack; import common.world.World; -public class GuiRepair extends GuiContainer implements ICrafting { +public class GuiRepair extends GuiContainer { private ContainerRepair anvil; private Label info; -// private TextField nameField; private InventoryPlayer playerInventory; public GuiRepair(InventoryPlayer inv, World world) { - super(new ContainerRepair(inv, world, Client.CLIENT.player)); + super(new ContainerRepair(inv, world)); this.playerInventory = inv; this.anvil = (ContainerRepair)this.inventorySlots; } - public void initGui() { - super.initGui(); -// this.nameField = new TextField(i + 62, j + 24, 103, 12); -// this.nameField.setMaxStringLength(30); - this.inventorySlots.removeCraftingFromCrafters(this); - this.inventorySlots.onCraftGuiOpened(this); - } - - public void onGuiClosed() { - super.onGuiClosed(); - this.inventorySlots.removeCraftingFromCrafters(this); - } - public void updateScreen() { super.updateScreen(); if(this.anvil.maximumCost >= 40) @@ -54,41 +33,4 @@ public class GuiRepair extends GuiContainer implements ICrafting { this.label("Amboss", 60, 6); this.info = this.label("", 60, 67); } - -// private void renameItem() -// { -// String s = this.nameField.getText(); -// Slot slot = this.anvil.getSlot(0); -// -// if (slot != null && slot.getHasStack() && !slot.getStack().hasDisplayName() && s.equals(slot.getStack().getDisplayName())) -// { -// s = ""; -// } -// -// this.anvil.updateItemName(s); -// this.gm.thePlayer.sendQueue.addToSendQueue(new CPacketMessage(CPacketMessage.Type.ITEM, s)); -// } - - public void updateCraftingInventory(Container containerToSend, List itemsList) { - this.sendSlotContents(containerToSend, 0, containerToSend.getSlot(0).getStack()); - } - - public void sendSlotContents(Container containerToSend, int slotInd, ItemStack stack) { -// if (slotInd == 0) -// { -// this.nameField.setText(stack == null ? "" : stack.getDisplayName()); -// this.nameField.setEnabled(stack != null); -// -// if (stack != null) -// { -// this.renameItem(); -// } -// } - } - - public void sendProgressBarUpdate(Container containerIn, int varToUpdate, int newValue) { - } - - public void sendAllWindowProperties(Container p_175173_1_, IInventory p_175173_2_) { - } } diff --git a/common/src/main/java/common/block/tech/BlockAnvil.java b/common/src/main/java/common/block/tech/BlockAnvil.java index cb82bd62..4590c9e1 100755 --- a/common/src/main/java/common/block/tech/BlockAnvil.java +++ b/common/src/main/java/common/block/tech/BlockAnvil.java @@ -172,7 +172,7 @@ public class BlockAnvil extends BlockFalling implements Rotatable public Container createContainer(InventoryPlayer playerInventory, EntityNPC playerIn) { - return new ContainerRepair(playerInventory, this.world, this.position, playerIn); + return new ContainerRepair(playerInventory, this.world, this.position); } public String getGuiID() diff --git a/common/src/main/java/common/inventory/ContainerRepair.java b/common/src/main/java/common/inventory/ContainerRepair.java index 42f126c4..e45c8244 100755 --- a/common/src/main/java/common/inventory/ContainerRepair.java +++ b/common/src/main/java/common/inventory/ContainerRepair.java @@ -16,32 +16,19 @@ import common.world.World; public class ContainerRepair extends Container { - /** Here comes out item you merged and/or renamed. */ private IInventory outputSlot; - - /** - * The 2slots where you put your items in that you want to merge and/or rename. - */ private IInventory inputSlots; private World theWorld; private BlockPos selfPosition; - - /** The maximum cost of repairing/renaming in the anvil. */ public int maximumCost; - - /** determined by damage of input item and stackSize of repair materials */ private int materialCost; -// private String repairedItemName; - /** The player that has this container open. */ - private final EntityNPC thePlayer; - - public ContainerRepair(InventoryPlayer playerInventory, World worldIn, EntityNPC player) + public ContainerRepair(InventoryPlayer playerInventory, World worldIn) { - this(playerInventory, worldIn, BlockPos.ORIGIN, player); + this(playerInventory, worldIn, BlockPos.ORIGIN); } - public ContainerRepair(InventoryPlayer playerInventory, final World worldIn, final BlockPos blockPosIn, EntityNPC player) + public ContainerRepair(InventoryPlayer playerInventory, final World worldIn, final BlockPos blockPosIn) { this.outputSlot = new InventoryCraftResult(); this.inputSlots = new InventoryBasic("Repair", true, 2) @@ -54,7 +41,6 @@ public class ContainerRepair extends Container }; this.selfPosition = blockPosIn; this.theWorld = worldIn; - this.thePlayer = player; this.addSlotToContainer(new Slot(this.inputSlots, 0, 27, 47) { public boolean canEditItem() { return false; diff --git a/server/src/main/java/server/command/commands/CommandItem.java b/server/src/main/java/server/command/commands/CommandItem.java index a030848d..e4a8b820 100644 --- a/server/src/main/java/server/command/commands/CommandItem.java +++ b/server/src/main/java/server/command/commands/CommandItem.java @@ -36,7 +36,8 @@ public class CommandItem extends Command { if(items == null) throw new RunException("Gegenstand '%s' existiert nicht", item); ItemStack stack = new ItemStack(items); - stack.readTags(tag); + if(tag != null) + stack.readTags(tag); int done = 0; int given = 0; for(EntityNPC player : players) {