fix some guis
This commit is contained in:
parent
8d6957d6e1
commit
24e249913d
16 changed files with 449 additions and 1306 deletions
|
@ -4,47 +4,31 @@ import common.inventory.ContainerBrewingStand;
|
|||
import common.inventory.IInventory;
|
||||
import common.inventory.InventoryPlayer;
|
||||
|
||||
public class GuiBrewing extends GuiContainer {
|
||||
private final InventoryPlayer playerInventory;
|
||||
private final IInventory tileBrewingStand;
|
||||
|
||||
public class GuiBrewing extends GuiContainer
|
||||
{
|
||||
// private static final String brewingStandGuiTextures = "textures/gui/brewing_stand.png";
|
||||
public GuiBrewing(InventoryPlayer player, IInventory inc) {
|
||||
super(new ContainerBrewingStand(player, inc));
|
||||
this.playerInventory = player;
|
||||
this.tileBrewingStand = inc;
|
||||
}
|
||||
|
||||
/** The player inventory bound to this GUI. */
|
||||
private final InventoryPlayer playerInventory;
|
||||
private IInventory tileBrewingStand;
|
||||
public void draw() {
|
||||
super.draw();
|
||||
int k = this.tileBrewingStand.getField(0);
|
||||
|
||||
public GuiBrewing(InventoryPlayer playerInv, IInventory p_i45506_2_)
|
||||
{
|
||||
super(new ContainerBrewingStand(playerInv, p_i45506_2_));
|
||||
this.playerInventory = playerInv;
|
||||
this.tileBrewingStand = p_i45506_2_;
|
||||
}
|
||||
if(k > 0) {
|
||||
int l = (int)(28.0F * (1.0F - (float)k / 400.0F));
|
||||
|
||||
/**
|
||||
* Draw the foreground layer for the GuiContainer (everything in front of the items). Args : mouseX, mouseY
|
||||
*/
|
||||
public void drawGuiContainerForegroundLayer()
|
||||
{
|
||||
String s = this.tileBrewingStand.getCommandName();
|
||||
this.drawString(s, 8, 6);
|
||||
this.drawString(this.playerInventory.getCommandName(), 8, this.ySize - 96 + 2);
|
||||
}
|
||||
if(l > 0) {
|
||||
this.rect(97, 16, 9, l, 0xffff20);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Args : renderPartialTicks, mouseX, mouseY
|
||||
*/
|
||||
public void drawGuiContainerBackgroundLayer()
|
||||
{
|
||||
int k = this.tileBrewingStand.getField(0);
|
||||
|
||||
if (k > 0)
|
||||
{
|
||||
int l = (int)(28.0F * (1.0F - (float)k / 400.0F));
|
||||
|
||||
if (l > 0)
|
||||
{
|
||||
this.rect(97, 16, 9, l, 0xffff20);
|
||||
}
|
||||
}
|
||||
}
|
||||
public void addElements() {
|
||||
this.label(this.tileBrewingStand.getCommandName(), 8, 6);
|
||||
this.label(this.playerInventory.getCommandName(), 8, this.ySize - 96 + 2);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,50 +4,23 @@ import client.Client;
|
|||
import common.inventory.ContainerChest;
|
||||
import common.inventory.IInventory;
|
||||
|
||||
public class GuiChest extends GuiContainer {
|
||||
private final IInventory upperChestInventory;
|
||||
private final IInventory lowerChestInventory;
|
||||
private final int inventoryRows;
|
||||
|
||||
public class GuiChest extends GuiContainer
|
||||
{
|
||||
// /** The ResourceLocation containing the chest GUI texture. */
|
||||
// private static final String CHEST_GUI_TEXTURE = "textures/gui/generic_54.png";
|
||||
private IInventory upperChestInventory;
|
||||
private IInventory lowerChestInventory;
|
||||
public GuiChest(IInventory upperInv, IInventory lowerInv) {
|
||||
super(new ContainerChest(upperInv, lowerInv, Client.CLIENT.player));
|
||||
this.upperChestInventory = upperInv;
|
||||
this.lowerChestInventory = lowerInv;
|
||||
int i = 222;
|
||||
int j = i - 108;
|
||||
this.inventoryRows = lowerInv.getSizeInventory() / 9;
|
||||
this.ySize = j + this.inventoryRows * 18;
|
||||
}
|
||||
|
||||
/**
|
||||
* window height is calculated with these values; the more rows, the heigher
|
||||
*/
|
||||
private int inventoryRows;
|
||||
|
||||
public GuiChest(IInventory upperInv, IInventory lowerInv)
|
||||
{
|
||||
super(new ContainerChest(upperInv, lowerInv, Client.CLIENT.player));
|
||||
this.upperChestInventory = upperInv;
|
||||
this.lowerChestInventory = lowerInv;
|
||||
// this.allowUserInput = false;
|
||||
int i = 222;
|
||||
int j = i - 108;
|
||||
this.inventoryRows = lowerInv.getSizeInventory() / 9;
|
||||
this.ySize = j + this.inventoryRows * 18;
|
||||
}
|
||||
|
||||
/**
|
||||
* Draw the foreground layer for the GuiContainer (everything in front of the items). Args : mouseX, mouseY
|
||||
*/
|
||||
public void drawGuiContainerForegroundLayer()
|
||||
{
|
||||
this.drawString(this.lowerChestInventory.getCommandName(), 8, 6);
|
||||
this.drawString(this.upperChestInventory.getCommandName(), 8, this.ySize - 96 + 2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Args : renderPartialTicks, mouseX, mouseY
|
||||
*/
|
||||
// protected void drawGuiContainerBackgroundLayer(int mouseX, int mouseY)
|
||||
// {
|
||||
// GlState.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
// this.gm.getTextureManager().bindTexture(CHEST_GUI_TEXTURE);
|
||||
// int i = (this.width - this.xSize) / 2;
|
||||
// int j = (this.height - this.ySize) / 2;
|
||||
//// this.rect(i, j, 0, 0, this.xSize, this.inventoryRows * 18 + 17);
|
||||
//// this.rect(i, j + this.inventoryRows * 18 + 17, 0, 126, this.xSize, 96);
|
||||
// }
|
||||
public void addElements() {
|
||||
this.label(this.lowerChestInventory.getCommandName(), 8, 6);
|
||||
this.label(this.upperChestInventory.getCommandName(), 8, this.ySize - 96 + 2);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,7 +9,8 @@ import org.lwjgl.opengl.GL13;
|
|||
|
||||
import client.gui.Font;
|
||||
import client.gui.Gui;
|
||||
import client.gui.element.Element;
|
||||
import client.gui.element.ActButton;
|
||||
import client.gui.element.ButtonCallback;
|
||||
import client.gui.element.Field;
|
||||
import client.gui.element.InventoryButton;
|
||||
import client.gui.element.Label;
|
||||
|
@ -18,6 +19,7 @@ import client.renderer.Drawing;
|
|||
import client.renderer.GlState;
|
||||
import client.renderer.ItemRenderer;
|
||||
import client.renderer.entity.RenderItem;
|
||||
import client.window.Bind;
|
||||
import client.window.Button;
|
||||
import common.collect.Lists;
|
||||
import common.collect.Sets;
|
||||
|
@ -90,14 +92,10 @@ public abstract class GuiContainer extends Gui
|
|||
private Field cheatSearch;
|
||||
private String cheatLast;
|
||||
|
||||
public void drawString(String text, int x, int y) {
|
||||
public Label label(String text, int x, int y) {
|
||||
x = x * 2 + this.container_x;
|
||||
y = y * 2 + this.container_y;
|
||||
Drawing.drawText(text, x, y, 0xffffffff);
|
||||
}
|
||||
|
||||
public int getStringWidth(String text) {
|
||||
return Drawing.getSize(text).xpos / 2;
|
||||
return this.add(new Label(x, y, 300, 0, text, true));
|
||||
}
|
||||
|
||||
public void rect(int x, int y, int width, int height, int color) {
|
||||
|
@ -108,10 +106,14 @@ public abstract class GuiContainer extends Gui
|
|||
Drawing.drawGradient(this.container_x + x * 2, this.container_y + y * 2, width * 2, height * 2, 0xff000000 | top, 0xff000000 | bottom, 0xff000000 | topleft, 0xff000000 | btmright);
|
||||
}
|
||||
|
||||
public InventoryButton button(int x, int y, int w, int h) {
|
||||
public InventoryButton slot(int x, int y, int w, int h) {
|
||||
return this.add(new InventoryButton(this.container_x + x * 2, this.container_y + y * 2, w * 2, h * 2));
|
||||
}
|
||||
|
||||
public ActButton button(int x, int y, int w, int h, ButtonCallback callback, String text) {
|
||||
return this.add(new ActButton(this.container_x + x * 2, this.container_y + y * 2, w * 2, h * 2, callback, text));
|
||||
}
|
||||
|
||||
public void mouse(Button btn, int x, int y, boolean ctrl, boolean shift) {
|
||||
super.mouse(btn, x, y, ctrl, shift);
|
||||
this.mouseClicked((x - this.container_x) / 2, (y - this.container_y) / 2, btn.ordinal()); //TODO: enum
|
||||
|
@ -128,9 +130,9 @@ public abstract class GuiContainer extends Gui
|
|||
this.mouseDragged((x - this.container_x) / 2, (y - this.container_y) / 2);
|
||||
}
|
||||
|
||||
public GuiContainer(Container inventorySlotsIn)
|
||||
public GuiContainer(Container container)
|
||||
{
|
||||
this.inventorySlots = inventorySlotsIn;
|
||||
this.inventorySlots = container;
|
||||
this.ignoreMouseUp = true;
|
||||
}
|
||||
|
||||
|
@ -142,6 +144,7 @@ public abstract class GuiContainer extends Gui
|
|||
this.container_y = (height - (this.container_h = (this.ySize * 2))) / 2;
|
||||
this.initGui();
|
||||
this.addButtons();
|
||||
this.addElements();
|
||||
}
|
||||
|
||||
public void hover(String text, int x, int y) {
|
||||
|
@ -169,7 +172,7 @@ public abstract class GuiContainer extends Gui
|
|||
if(this.inventorySlots != null) {
|
||||
for (int i1 = 0; i1 < this.inventorySlots.inventorySlots.size(); ++i1) {
|
||||
Slot slot = (Slot)this.inventorySlots.inventorySlots.get(i1);
|
||||
this.button(slot.xDisplayPosition - 1, slot.yDisplayPosition - 1, 18, 18);
|
||||
this.slot(slot.xDisplayPosition - 1, slot.yDisplayPosition - 1, 18, 18);
|
||||
}
|
||||
}
|
||||
if(this.gm.itemCheat) {
|
||||
|
@ -184,6 +187,8 @@ public abstract class GuiContainer extends Gui
|
|||
}
|
||||
}
|
||||
|
||||
public abstract void addElements();
|
||||
|
||||
protected void drawSlots(int mouseX, int mouseY) {
|
||||
for (int i1 = 0; i1 < this.inventorySlots.inventorySlots.size(); ++i1)
|
||||
{
|
||||
|
@ -246,9 +251,6 @@ public abstract class GuiContainer extends Gui
|
|||
this.tooltip = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Draws the screen and all the components in it. Args : mouseX, mouseY, renderPartialTicks
|
||||
*/
|
||||
public void drawScreen(int mouseX, int mouseY)
|
||||
{
|
||||
if(this.gm == null)
|
||||
|
@ -278,18 +280,11 @@ public abstract class GuiContainer extends Gui
|
|||
this.currentScroll = ExtMath.clampf(this.currentScroll, 0.0F, 1.0F);
|
||||
}
|
||||
}
|
||||
// this.drawGradientRect(0, 0, this.width, this.height, -1072689136, -804253680);
|
||||
// int i = this.guiLeft;
|
||||
// int j = this.guiTop;
|
||||
// this.drawGuiContainerBackgroundLayer(mouseX, mouseY);
|
||||
GlState.disableRescaleNormal();
|
||||
ItemRenderer.disableStandardItemLighting();
|
||||
GlState.disableLighting();
|
||||
GlState.disableDepth();
|
||||
// super.drawScreen(mouseX, mouseY, partialTicks);
|
||||
ItemRenderer.enableGUIStandardItemLighting();
|
||||
// SKC.glPushMatrix();
|
||||
// SKC.glTranslatef((float)i, (float)j, 0.0F);
|
||||
GlState.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
GlState.enableRescaleNormal();
|
||||
this.theSlot = null;
|
||||
|
@ -301,7 +296,6 @@ public abstract class GuiContainer extends Gui
|
|||
this.drawSlots(mouseX, mouseY);
|
||||
|
||||
ItemRenderer.disableStandardItemLighting();
|
||||
// this.drawGuiContainerForegroundLayer(mouseX, mouseY);
|
||||
ItemRenderer.enableGUIStandardItemLighting();
|
||||
InventoryPlayer inventoryplayer = this.gm.player.inventory;
|
||||
ItemStack itemstack = inventoryplayer.getItemStack();
|
||||
|
@ -331,8 +325,6 @@ public abstract class GuiContainer extends Gui
|
|||
this.drawItemStack(itemstack, mouseX - j2, mouseY - k2, s);
|
||||
}
|
||||
|
||||
// SKC.glPopMatrix();
|
||||
|
||||
if (inventoryplayer.getItemStack() == null && this.cheatStack == null && this.theSlot != null && this.theSlot.getHasStack())
|
||||
{
|
||||
ItemStack itemstack1 = this.theSlot.getStack();
|
||||
|
@ -357,17 +349,12 @@ public abstract class GuiContainer extends Gui
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Render an ItemStack. Args : stack, x, y, format
|
||||
*/
|
||||
private void drawItemStack(ItemStack stack, int x, int y, String altText)
|
||||
{
|
||||
GL11.glTranslatef(0.0F, 0.0F, 32.0F);
|
||||
// this.zLevel = 200.0F;
|
||||
this.itemRender.zLevel = 200.0F;
|
||||
this.itemRender.renderItemAndEffectIntoGUI(stack, x, y);
|
||||
this.drawnOverlays.add(new Overlay(stack, x, y, altText));
|
||||
// this.zLevel = 0.0F;
|
||||
this.itemRender.zLevel = 0.0F;
|
||||
}
|
||||
|
||||
|
@ -383,16 +370,6 @@ public abstract class GuiContainer extends Gui
|
|||
this.hover(sb.toString(), x, y);
|
||||
}
|
||||
|
||||
/**
|
||||
* Draw the foreground layer for the GuiContainer (everything in front of the items). Args : mouseX, mouseY
|
||||
*/
|
||||
public void drawGuiContainerForegroundLayer()
|
||||
{
|
||||
}
|
||||
|
||||
public void drawGuiContainerBackgroundLayer() {
|
||||
}
|
||||
|
||||
public void draw() {
|
||||
super.draw();
|
||||
if(this.gm.itemCheat) {
|
||||
|
@ -405,20 +382,20 @@ public abstract class GuiContainer extends Gui
|
|||
}
|
||||
Drawing.drawRect(this.cheatX + 18 * (selectedTab.getIndex() % this.cheatWidth), this.cheatY + this.cheatHeight * 18 + 4 + 20 * (selectedTab.getIndex() / this.cheatWidth) - 2, 18, 2, 0xffffffff);
|
||||
}
|
||||
this.drawGuiContainerBackgroundLayer();
|
||||
this.drawGuiContainerForegroundLayer();
|
||||
if(Bind.isWindowActive())
|
||||
super.drawOverlay();
|
||||
}
|
||||
|
||||
public void drawOverlay() {
|
||||
}
|
||||
|
||||
public void drawPost() {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float)((this.gm.fb_x - this.xSize * 2) / 2), (float)((this.gm.fb_y - this.ySize * 2) / 2), 0.0f);
|
||||
// int k1 = SKC.getMouseX();
|
||||
// int l1 = this.gm.fb_y - SKC.getMouseY() - 1;
|
||||
GL11.glScalef(2.0f, 2.0f, 2.0f);
|
||||
this.drawScreen((this.gm.mouse_x - this.container_x) / 2, (this.gm.mouse_y - this.container_y) / 2);
|
||||
GL11.glPopMatrix();
|
||||
ItemRenderer.disableStandardItemLighting();
|
||||
// GlState.color(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
}
|
||||
|
||||
private void drawSlot(Slot slotIn)
|
||||
|
@ -462,36 +439,13 @@ public abstract class GuiContainer extends Gui
|
|||
}
|
||||
}
|
||||
|
||||
// this.zLevel = 100.0F;
|
||||
this.itemRender.zLevel = 100.0F;
|
||||
|
||||
// if (itemstack == null)
|
||||
// {
|
||||
// String s1 = slotIn.getSlotTexture();
|
||||
//
|
||||
// if (s1 != null)
|
||||
// {
|
||||
// TextureAtlasSprite sprite = this.gm.getTextureMapBlocks().getAtlasSprite(s1);
|
||||
// GlState.disableLighting();
|
||||
// this.gm.getTextureManager().bindTexture(TextureMap.locationBlocksTexture);
|
||||
// this.rectuv(i, j, 16, 16, sprite.getMinU(), sprite.getMinV(), sprite.getMaxU(), sprite.getMaxV());
|
||||
// GlState.enableLighting();
|
||||
// flag1 = true;
|
||||
// }
|
||||
// }
|
||||
|
||||
// if (flag)
|
||||
// {
|
||||
// drawRect(i, j, i + 16, j + 16, -2130706433);
|
||||
// SKC.highlight(i, j, 16, 16);
|
||||
// }
|
||||
|
||||
GlState.enableDepth();
|
||||
this.itemRender.renderItemAndEffectIntoGUI(itemstack, i, j);
|
||||
this.drawnOverlays.add(new Overlay(itemstack, i, j, s));
|
||||
|
||||
this.itemRender.zLevel = 0.0F;
|
||||
// this.zLevel = 0.0F;
|
||||
}
|
||||
|
||||
private void updateDragSplitting()
|
||||
|
@ -523,9 +477,6 @@ public abstract class GuiContainer extends Gui
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the slot at the given coordinates or null if there is none.
|
||||
*/
|
||||
private Slot getSlotAtPosition(int x, int y)
|
||||
{
|
||||
for (int i = 0; i < this.inventorySlots.inventorySlots.size(); ++i)
|
||||
|
@ -541,9 +492,6 @@ public abstract class GuiContainer extends Gui
|
|||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the mouse is clicked. Args : mouseX, mouseY, clickedButton
|
||||
*/
|
||||
public void mouseClicked(int mouseX, int mouseY, int mouseButton)
|
||||
{
|
||||
if(this.gm == null)
|
||||
|
@ -570,17 +518,13 @@ public abstract class GuiContainer extends Gui
|
|||
}
|
||||
}
|
||||
}
|
||||
// super.mouseClicked(mouseX, mouseY, mouseButton);
|
||||
// boolean flag = mouseButton == this.gm.bindTertiary.getKeyCode() + 100;
|
||||
Slot slot = this.getSlotAtPosition(mouseX, mouseY);
|
||||
long i = System.currentTimeMillis();
|
||||
this.doubleClick = this.lastClickSlot == slot && i - this.lastClickTime < 250L && this.lastClickButton == mouseButton;
|
||||
this.ignoreMouseUp = false;
|
||||
|
||||
if (mouseButton == 0 || mouseButton == 1) // || flag)
|
||||
if (mouseButton == 0 || mouseButton == 1)
|
||||
{
|
||||
// int j = this.guiLeft;
|
||||
// int k = this.guiTop;
|
||||
boolean flag1 = mouseX < 0 || mouseY < 0 || mouseX >= this.xSize || mouseY >= this.ySize;
|
||||
int l = -1;
|
||||
|
||||
|
@ -594,38 +538,12 @@ public abstract class GuiContainer extends Gui
|
|||
l = -999;
|
||||
}
|
||||
|
||||
// if (this.gm.touchscreen && flag1 && this.gm.thePlayer.inventory.getItemStack() == null)
|
||||
// {
|
||||
// this.gm.displayGuiScreen((GuiScreen)null);
|
||||
// return;
|
||||
// }
|
||||
|
||||
if (l != -1)
|
||||
{
|
||||
// if (this.gm.touchscreen)
|
||||
// {
|
||||
// if (slot != null && slot.getHasStack())
|
||||
// {
|
||||
// this.clickedSlot = slot;
|
||||
// this.draggedStack = null;
|
||||
// this.isRightMouseClick = mouseButton == 1;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// this.clickedSlot = null;
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
if (!this.dragSplitting)
|
||||
{
|
||||
if (this.gm.player.inventory.getItemStack() == null)
|
||||
{
|
||||
// if (mouseButton == this.gm.bindTertiary.getKeyCode() + 100)
|
||||
// {
|
||||
// this.handleMouseClick(slot, l, mouseButton, 3);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
boolean flag2 = l != -999 && this.gm.shift();
|
||||
int i1 = 0;
|
||||
|
||||
|
@ -640,7 +558,6 @@ public abstract class GuiContainer extends Gui
|
|||
}
|
||||
|
||||
this.handleMouseClick(slot, l, mouseButton, i1);
|
||||
// }
|
||||
|
||||
this.ignoreMouseUp = true;
|
||||
}
|
||||
|
@ -658,10 +575,6 @@ public abstract class GuiContainer extends Gui
|
|||
{
|
||||
this.dragSplittingLimit = 1;
|
||||
}
|
||||
// else if (mouseButton == this.gm.bindTertiary.getKeyCode() + 100)
|
||||
// {
|
||||
// this.dragSplittingLimit = 2;
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -672,10 +585,6 @@ public abstract class GuiContainer extends Gui
|
|||
this.lastClickButton = mouseButton;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a mouse button is pressed and the mouse is moved around. Parameters are : mouseX, mouseY,
|
||||
* lastButtonClicked & timeSinceMouseClick.
|
||||
*/
|
||||
public void mouseDragged(int mouseX, int mouseY)
|
||||
{
|
||||
if(this.gm == null || this.cheatStack != null)
|
||||
|
@ -683,41 +592,6 @@ public abstract class GuiContainer extends Gui
|
|||
Slot slot = this.getSlotAtPosition(mouseX, mouseY);
|
||||
ItemStack itemstack = this.gm.player.inventory.getItemStack();
|
||||
|
||||
// if (this.clickedSlot != null && this.gm.touchscreen)
|
||||
// {
|
||||
// if (clickedMouseButton == 0 || clickedMouseButton == 1)
|
||||
// {
|
||||
// if (this.draggedStack == null)
|
||||
// {
|
||||
// if (slot != this.clickedSlot && this.clickedSlot.getStack() != null)
|
||||
// {
|
||||
// this.draggedStack = this.clickedSlot.getStack().copy();
|
||||
// }
|
||||
// }
|
||||
// else if (this.draggedStack.stackSize > 1 && slot != null && Container.canAddItemToSlot(slot, this.draggedStack, false))
|
||||
// {
|
||||
// long i = this.gm.getSystemTime();
|
||||
//
|
||||
// if (this.currentDragTargetSlot == slot)
|
||||
// {
|
||||
// if (i - this.dragItemDropDelay > 500L)
|
||||
// {
|
||||
// this.handleMouseClick(this.clickedSlot, this.clickedSlot.slotNumber, 0, 0);
|
||||
// this.handleMouseClick(slot, slot.slotNumber, 1, 0);
|
||||
// this.handleMouseClick(this.clickedSlot, this.clickedSlot.slotNumber, 0, 0);
|
||||
// this.dragItemDropDelay = i + 750L;
|
||||
// --this.draggedStack.stackSize;
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// this.currentDragTargetSlot = slot;
|
||||
// this.dragItemDropDelay = i;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
if (this.dragSplitting && slot != null && itemstack != null && itemstack.size > this.dragSplittingSlots.size() && Container.canAddItemToSlot(slot, itemstack, true) && slot.isItemValid(itemstack) && this.inventorySlots.canDragIntoSlot(slot))
|
||||
{
|
||||
this.dragSplittingSlots.add(slot);
|
||||
|
@ -725,16 +599,11 @@ public abstract class GuiContainer extends Gui
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a mouse button is released. Args : mouseX, mouseY, releaseButton
|
||||
*/
|
||||
public void mouseReleased(int mouseX, int mouseY, int state)
|
||||
{
|
||||
if(this.gm == null || this.cheatStack != null)
|
||||
return;
|
||||
Slot slot = this.getSlotAtPosition(mouseX, mouseY);
|
||||
// int i = this.guiLeft;
|
||||
// int j = this.guiTop;
|
||||
boolean flag = mouseX < 0 || mouseY < 0 || mouseX >= this.xSize || mouseY >= this.ySize;
|
||||
int k = -1;
|
||||
|
||||
|
@ -787,50 +656,6 @@ public abstract class GuiContainer extends Gui
|
|||
return;
|
||||
}
|
||||
|
||||
// if (this.clickedSlot != null && this.gm.touchscreen)
|
||||
// {
|
||||
// if (state == 0 || state == 1)
|
||||
// {
|
||||
// if (this.draggedStack == null && slot != this.clickedSlot)
|
||||
// {
|
||||
// this.draggedStack = this.clickedSlot.getStack();
|
||||
// }
|
||||
//
|
||||
// boolean flag2 = Container.canAddItemToSlot(slot, this.draggedStack, false);
|
||||
//
|
||||
// if (k != -1 && this.draggedStack != null && flag2)
|
||||
// {
|
||||
// this.handleMouseClick(this.clickedSlot, this.clickedSlot.slotNumber, state, 0);
|
||||
// this.handleMouseClick(slot, k, 0, 0);
|
||||
//
|
||||
// if (this.gm.thePlayer.inventory.getItemStack() != null)
|
||||
// {
|
||||
// this.handleMouseClick(this.clickedSlot, this.clickedSlot.slotNumber, state, 0);
|
||||
// this.touchUpX = mouseX - i;
|
||||
// this.touchUpY = mouseY - j;
|
||||
// this.returningStackDestSlot = this.clickedSlot;
|
||||
// this.returningStack = this.draggedStack;
|
||||
// this.returningStackTime = this.gm.getSystemTime();
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// this.returningStack = null;
|
||||
// }
|
||||
// }
|
||||
// else if (this.draggedStack != null)
|
||||
// {
|
||||
// this.touchUpX = mouseX - i;
|
||||
// this.touchUpY = mouseY - j;
|
||||
// this.returningStackDestSlot = this.clickedSlot;
|
||||
// this.returningStack = this.draggedStack;
|
||||
// this.returningStackTime = this.gm.getSystemTime();
|
||||
// }
|
||||
//
|
||||
// this.draggedStack = null;
|
||||
// this.clickedSlot = null;
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
if (this.dragSplitting && !this.dragSplittingSlots.isEmpty())
|
||||
{
|
||||
this.handleMouseClick((Slot)null, -999, Container.getDragCode(0, this.dragSplittingLimit), 5);
|
||||
|
@ -844,12 +669,6 @@ public abstract class GuiContainer extends Gui
|
|||
}
|
||||
else if (this.gm.player.inventory.getItemStack() != null)
|
||||
{
|
||||
// if (state == this.gm.bindTertiary.getKeyCode() + 100)
|
||||
// {
|
||||
// this.handleMouseClick(slot, k, state, 3);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
boolean flag1 = k != -999 && this.gm.shift();
|
||||
|
||||
if (flag1)
|
||||
|
@ -858,7 +677,6 @@ public abstract class GuiContainer extends Gui
|
|||
}
|
||||
|
||||
this.handleMouseClick(slot, k, state, flag1 ? 1 : 0);
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -870,30 +688,16 @@ public abstract class GuiContainer extends Gui
|
|||
this.dragSplitting = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns if the passed mouse position is over the specified slot. Args : slot, mouseX, mouseY
|
||||
*/
|
||||
private boolean isMouseOverSlot(Slot slotIn, int mouseX, int mouseY)
|
||||
{
|
||||
return this.isPointInRegion(slotIn.xDisplayPosition, slotIn.yDisplayPosition, 16, 16, mouseX, mouseY);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test if the 2D point is in a rectangle (relative to the GUI). Args : rectX, rectY, rectWidth, rectHeight, pointX,
|
||||
* pointY
|
||||
*/
|
||||
protected boolean isPointInRegion(int left, int top, int right, int bottom, int pointX, int pointY)
|
||||
{
|
||||
// int i = this.guiLeft;
|
||||
// int j = this.guiTop;
|
||||
// pointX = pointX - i;
|
||||
// pointY = pointY - j;
|
||||
return pointX >= left - 1 && pointX < left + right + 1 && pointY >= top - 1 && pointY < top + bottom + 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the mouse is clicked over a slot or outside the gui.
|
||||
*/
|
||||
protected void handleMouseClick(Slot slotIn, int slotId, int clickedButton, int clickType)
|
||||
{
|
||||
if (slotIn != null)
|
||||
|
@ -907,58 +711,18 @@ public abstract class GuiContainer extends Gui
|
|||
public void dropItem() {
|
||||
if (this.gm != null && this.gm.player != null && this.theSlot != null && this.theSlot.getHasStack())
|
||||
{
|
||||
// if (keyCode == this.gm.bindTertiary.getKeyCode())
|
||||
// {
|
||||
// this.handleMouseClick(this.theSlot, this.theSlot.slotNumber, 0, 3);
|
||||
// }
|
||||
// else
|
||||
// if (keyCode == this.gm.keyBindDrop.getKeyCode())
|
||||
// {
|
||||
this.handleMouseClick(this.theSlot, this.theSlot.slotNumber, this.gm.ctrl() ? 1 : 0, 4);
|
||||
// }
|
||||
this.handleMouseClick(this.theSlot, this.theSlot.slotNumber, this.gm.ctrl() ? 1 : 0, 4);
|
||||
}
|
||||
}
|
||||
|
||||
// /**
|
||||
// * Fired when a key is typed (except F11 which toggles full screen). This is the equivalent of
|
||||
// * KeyListener.keyTyped(KeyEvent e). Args : character (character on the key), keyCode (lwjgl Keyboard key code)
|
||||
// */
|
||||
// protected void keyTyped(char typedChar, int keyCode)
|
||||
// {
|
||||
//// if (keyCode == 1 || keyCode == this.gm.keyBindInventory.getKeyCode())
|
||||
//// {
|
||||
//// this.gm.thePlayer.closeScreen();
|
||||
//// }
|
||||
//
|
||||
// this.checkHotbarKeys(keyCode);
|
||||
//
|
||||
//
|
||||
// }
|
||||
|
||||
/**
|
||||
* This function is what controls the hotbar shortcut check when you press a number key when hovering a stack. Args
|
||||
* : keyCode, Returns true if a Hotbar key is pressed, else false
|
||||
*/
|
||||
public void useHotbar(int slot)
|
||||
{
|
||||
if (!this.clickSide(this.gm.mouse_x, this.gm.mouse_y, slot, this.gm.shift(), this.gm.ctrl()) && this.gm != null && this.gm.player != null && this.gm.player.inventory.getItemStack() == null && this.cheatStack == null && this.theSlot != null)
|
||||
{
|
||||
// for (int i = 0; i < 9; ++i)
|
||||
// {
|
||||
// if (keyCode == this.gm.keyBindsHotbar[i].getKeyCode())
|
||||
// {
|
||||
this.handleMouseClick(this.theSlot, this.theSlot.slotNumber, slot, 2);
|
||||
// return true;
|
||||
// }
|
||||
// }
|
||||
this.handleMouseClick(this.theSlot, this.theSlot.slotNumber, slot, 2);
|
||||
}
|
||||
|
||||
// return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the screen is unloaded. Used to disable keyboard repeat events
|
||||
*/
|
||||
public void onGuiClosed()
|
||||
{
|
||||
if (this.gm != null && this.gm.player != null)
|
||||
|
@ -967,21 +731,8 @@ public abstract class GuiContainer extends Gui
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if this GUI should pause the game when it is displayed in single-player
|
||||
*/
|
||||
// public boolean doesGuiPauseGame()
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
|
||||
/**
|
||||
* Called from the main game loop to update the screen.
|
||||
*/
|
||||
public void updateScreen()
|
||||
{
|
||||
// super.updateScreen();
|
||||
|
||||
if (this.gm != null && this.gm.player != null && (!this.gm.player.isEntityAlive() || this.gm.player.dead))
|
||||
{
|
||||
this.gm.displayGuiScreen(null);
|
||||
|
@ -1009,12 +760,6 @@ public abstract class GuiContainer extends Gui
|
|||
{
|
||||
s = TextColor.RED + ItemStack.formatAmount(stack.size);
|
||||
}
|
||||
// this.drawString(s, , );
|
||||
// Vec2i size = Drawing.txt_size(0, 0, 0, 0, 65536, 65536, s);
|
||||
// int x = - size.xpos; // this.getStringWidth(s);
|
||||
// int y = ;
|
||||
// x = x * 2 + this.container_x;
|
||||
// y = y * 2 + this.container_y;
|
||||
Drawing.drawTextRight(s, xPosition + 32, yPosition + 33 - Font.YGLYPH, 0xffffffff);
|
||||
}
|
||||
|
||||
|
@ -1031,7 +776,6 @@ public abstract class GuiContainer extends Gui
|
|||
|
||||
private static void draw(int x, int y, int width, int height, int red, int green, int blue)
|
||||
{
|
||||
// Drawing.gfx_draw_rect_color(this.container_x + x * 2, this.container_y + y * 2, width * 2, height * 2, 0xff000000 | (red << 16) | (green << 8) | blue);
|
||||
Drawing.drawRect(x, y, width, height, 0xff000000 | (red << 16) | (green << 8) | blue);
|
||||
}
|
||||
|
||||
|
|
|
@ -9,14 +9,14 @@ import common.world.World;
|
|||
public class GuiCrafting extends GuiContainer {
|
||||
private final BlockWorkbench type;
|
||||
|
||||
public GuiCrafting(InventoryPlayer playerInv, World worldIn, BlockWorkbench type) {
|
||||
super(new ContainerWorkbench(playerInv, worldIn, BlockPos.ORIGIN, type));
|
||||
public GuiCrafting(InventoryPlayer playerInv, World world, BlockWorkbench type) {
|
||||
super(new ContainerWorkbench(playerInv, world, BlockPos.ORIGIN, type));
|
||||
this.type = type;
|
||||
this.ySize = 112 + 18 * this.type.getSize();
|
||||
}
|
||||
|
||||
public void drawGuiContainerForegroundLayer() {
|
||||
this.drawString("Handwerk (" + this.type.getDisplay() + ")", 26, 6);
|
||||
this.drawString("Inventar", 8, this.ySize - 96 + 2);
|
||||
public void addElements() {
|
||||
this.label("Handwerk (" + this.type.getDisplay() + ")", 26, 6);
|
||||
this.label("Inventar", 8, this.ySize - 96 + 2);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,43 +4,18 @@ import common.inventory.ContainerDispenser;
|
|||
import common.inventory.IInventory;
|
||||
import common.inventory.InventoryPlayer;
|
||||
|
||||
public class GuiDispenser extends GuiContainer {
|
||||
private final InventoryPlayer playerInventory;
|
||||
private final IInventory dispenserInventory;
|
||||
|
||||
public class GuiDispenser extends GuiContainer
|
||||
{
|
||||
// private static final String dispenserGuiTextures = "textures/gui/dispenser.png";
|
||||
public GuiDispenser(InventoryPlayer playerInv, IInventory dispenserInv) {
|
||||
super(new ContainerDispenser(playerInv, dispenserInv));
|
||||
this.playerInventory = playerInv;
|
||||
this.dispenserInventory = dispenserInv;
|
||||
}
|
||||
|
||||
/** The player inventory bound to this GUI. */
|
||||
private final InventoryPlayer playerInventory;
|
||||
|
||||
/** The inventory contained within the corresponding Dispenser. */
|
||||
public IInventory dispenserInventory;
|
||||
|
||||
public GuiDispenser(InventoryPlayer playerInv, IInventory dispenserInv)
|
||||
{
|
||||
super(new ContainerDispenser(playerInv, dispenserInv));
|
||||
this.playerInventory = playerInv;
|
||||
this.dispenserInventory = dispenserInv;
|
||||
}
|
||||
|
||||
/**
|
||||
* Draw the foreground layer for the GuiContainer (everything in front of the items). Args : mouseX, mouseY
|
||||
*/
|
||||
public void drawGuiContainerForegroundLayer()
|
||||
{
|
||||
String s = this.dispenserInventory.getCommandName();
|
||||
this.drawString(s, 8, 6);
|
||||
this.drawString(this.playerInventory.getCommandName(), 8, this.ySize - 96 + 2);
|
||||
}
|
||||
|
||||
// /**
|
||||
// * Args : renderPartialTicks, mouseX, mouseY
|
||||
// */
|
||||
// protected void drawGuiContainerBackgroundLayer(int mouseX, int mouseY)
|
||||
// {
|
||||
// GlState.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
// this.gm.getTextureManager().bindTexture(dispenserGuiTextures);
|
||||
// int i = (this.width - this.xSize) / 2;
|
||||
// int j = (this.height - this.ySize) / 2;
|
||||
//// this.rect(i, j, 0, 0, this.xSize, this.ySize);
|
||||
// }
|
||||
public void addElements() {
|
||||
this.label(this.dispenserInventory.getCommandName(), 8, 6);
|
||||
this.label(this.playerInventory.getCommandName(), 8, this.ySize - 96 + 2);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
package client.gui.container;
|
||||
|
||||
import client.gui.element.ActButton;
|
||||
import client.gui.element.ButtonCallback;
|
||||
import client.gui.element.Label;
|
||||
import client.gui.element.PressType;
|
||||
import common.color.TextColor;
|
||||
import common.enchantment.Enchantment;
|
||||
import common.inventory.ContainerEnchantment;
|
||||
|
@ -8,278 +12,131 @@ import common.rng.Random;
|
|||
import common.util.Pair;
|
||||
import common.world.World;
|
||||
|
||||
public class GuiEnchant extends GuiContainer
|
||||
{
|
||||
/** The ResourceLocation containing the Enchantment GUI texture location */
|
||||
// private static final String ENCHANTMENT_TABLE_GUI_TEXTURE = "textures/gui/enchanting_table.png";
|
||||
private static final String[] NAMES = "the elder scrolls klaatu berata niktu xyzzy bless curse light darkness fire air earth water hot dry cold wet ignite snuff embiggen twist shorten stretch fiddle destroy imbue galvanize enchant free limited range of towards inside sphere cube self other ball mental physical grow shrink demon elemental spirit animal creature beast humanoid undead fresh stale ".split(" ");
|
||||
public class GuiEnchant extends GuiContainer implements ButtonCallback {
|
||||
private static final String[] NAMES =
|
||||
"the elder scrolls klaatu berata niktu xyzzy bless curse light darkness fire air earth water hot dry cold wet ignite snuff embiggen twist shorten stretch fiddle destroy imbue galvanize enchant free limited range of towards inside sphere cube self other ball mental physical grow shrink demon elemental spirit animal creature beast humanoid undead fresh stale "
|
||||
.split(" ");
|
||||
|
||||
/** The player inventory currently bound to this GuiEnchantment instance. */
|
||||
private final InventoryPlayer playerInventory;
|
||||
private final Random nameRand = new Random();
|
||||
private final Random random = new Random();
|
||||
private final ContainerEnchantment container;
|
||||
private final String title;
|
||||
private final InventoryPlayer playerInventory;
|
||||
private final Random nameRand = new Random();
|
||||
private final Random random = new Random();
|
||||
private final ContainerEnchantment container;
|
||||
private final String title;
|
||||
private final ActButton[] buttons = new ActButton[3];
|
||||
private final Label[] labels = new Label[3];
|
||||
private final Label[] mana = new Label[3];
|
||||
|
||||
// public int field_147073_u;
|
||||
// public float field_147071_v;
|
||||
// public float field_147069_w;
|
||||
// public float field_147082_x;
|
||||
// public float field_147081_y;
|
||||
// public float field_147080_z;
|
||||
// public float field_147076_A;
|
||||
// ItemStack field_147077_B;
|
||||
public GuiEnchant(InventoryPlayer inv, World world, String title) {
|
||||
super(new ContainerEnchantment(inv, world));
|
||||
this.playerInventory = inv;
|
||||
this.container = (ContainerEnchantment)this.inventorySlots;
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public GuiEnchant(InventoryPlayer inventory, World worldIn, String title)
|
||||
{
|
||||
super(new ContainerEnchantment(inventory, worldIn));
|
||||
this.playerInventory = inventory;
|
||||
this.container = (ContainerEnchantment)this.inventorySlots;
|
||||
this.title = title;
|
||||
}
|
||||
public void updateScreen() {
|
||||
super.updateScreen();
|
||||
this.nameRand.setSeed((long)this.container.seed);
|
||||
|
||||
/**
|
||||
* Draw the foreground layer for the GuiContainer (everything in front of the items). Args : mouseX, mouseY
|
||||
*/
|
||||
public void drawGuiContainerForegroundLayer()
|
||||
{
|
||||
this.drawString(this.title, 12, 5);
|
||||
this.drawString(this.playerInventory.getCommandName(), 8, this.ySize - 96 + 2);
|
||||
}
|
||||
for(int l = 0; l < 3; ++l) {
|
||||
String name = this.getRandomName();
|
||||
int mana = this.container.mana[l];
|
||||
|
||||
// /**
|
||||
// * Called from the main game loop to update the screen.
|
||||
// */
|
||||
// public void updateScreen()
|
||||
// {
|
||||
// super.updateScreen();
|
||||
// this.updateAnimation();
|
||||
// }
|
||||
if(mana == 0) {
|
||||
this.buttons[l].enabled = false;
|
||||
this.labels[l].setText("");
|
||||
this.mana[l].setText("");
|
||||
}
|
||||
else {
|
||||
if(this.gm.player.getManaPoints() < mana) {
|
||||
this.buttons[l].enabled = false;
|
||||
this.labels[l].setText(TextColor.DGRAY + name);
|
||||
this.mana[l].setText(TextColor.DRED + "Mana-Level " + mana);
|
||||
}
|
||||
else {
|
||||
this.buttons[l].enabled = true;
|
||||
this.labels[l].setText(TextColor.GREEN + name);
|
||||
this.mana[l].setText(TextColor.DGREEN + "Mana-Level " + mana + TextColor.GRAY + ", " + TextColor.YELLOW + "-" + (l + 1) + " Mana");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the mouse is clicked. Args : mouseX, mouseY, clickedButton
|
||||
*/
|
||||
public void mouseClicked(int mouseX, int mouseY, int mouseButton)
|
||||
{
|
||||
super.mouseClicked(mouseX, mouseY, mouseButton);
|
||||
// int i = (this.width - this.xSize) / 2;
|
||||
// int j = (this.height - this.ySize) / 2;
|
||||
public void addElements() {
|
||||
this.label(this.title, 12, 5);
|
||||
this.label(this.playerInventory.getCommandName(), 8, this.ySize - 96 + 2);
|
||||
for(int l = 0; l < 3; ++l) {
|
||||
int i1 = 60;
|
||||
int j1 = i1 + 2;
|
||||
this.labels[l] = this.label("", j1, 16 + 19 * l);
|
||||
this.mana[l] = this.label("", j1, 16 + 19 * l + 7);
|
||||
}
|
||||
}
|
||||
|
||||
for (int k = 0; k < 3; ++k)
|
||||
{
|
||||
int l = mouseX - 60;
|
||||
int i1 = mouseY - (14 + 19 * k);
|
||||
public void use(ActButton btn, PressType type) {
|
||||
for(int k = 0; k < 3; ++k) {
|
||||
if(btn == this.buttons[k] && this.container.enchantItem(this.gm.player, k))
|
||||
this.gm.controller.sendEnchantPacket(this.container.windowId, k);
|
||||
}
|
||||
}
|
||||
|
||||
if (l >= 0 && i1 >= 0 && l < 108 && i1 < 19 && this.container.enchantItem(this.gm.player, k))
|
||||
{
|
||||
this.gm.controller.sendEnchantPacket(this.container.windowId, k);
|
||||
}
|
||||
}
|
||||
}
|
||||
public void addButtons() {
|
||||
super.addButtons();
|
||||
for(int l = 0; l < 3; ++l) {
|
||||
this.buttons[l] = this.button(60, 14 + 19 * l, 108, 19, this, "");
|
||||
}
|
||||
}
|
||||
|
||||
public void addButtons() {
|
||||
super.addButtons();
|
||||
this.button(60, 14 + 19 * 0, 108, 19);
|
||||
this.button(60, 14 + 19 * 1, 108, 19);
|
||||
this.button(60, 14 + 19 * 2, 108, 19);
|
||||
}
|
||||
public void drawScreen(int mouseX, int mouseY) {
|
||||
super.drawScreen(mouseX, mouseY);
|
||||
|
||||
/**
|
||||
* Args : renderPartialTicks, mouseX, mouseY
|
||||
*/
|
||||
public void drawGuiContainerBackgroundLayer()
|
||||
{
|
||||
this.nameRand.setSeed((long)this.container.seed);
|
||||
for(int j = 0; j < 3; ++j) {
|
||||
int k = this.container.mana[j];
|
||||
Pair<Enchantment, Integer> l = this.container.ench[j];
|
||||
int i1 = j + 1;
|
||||
|
||||
for (int l = 0; l < 3; ++l)
|
||||
{
|
||||
int i1 = 60;
|
||||
int j1 = i1 + 20;
|
||||
String s = this.getRandomName();
|
||||
int l1 = this.container.mana[l];
|
||||
if(this.isPointInRegion(60, 14 + 19 * j, 108, 17, mouseX, mouseY) && k > 0 && l != null) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
if (l1 == 0)
|
||||
{
|
||||
this.rect(i1, 14 + 19 * l, 108, 19, 0x404040);
|
||||
}
|
||||
else
|
||||
{
|
||||
String s1 = "" + l1;
|
||||
int i2 = 6839882;
|
||||
String s = l.first().getFormattedName(l.second());
|
||||
sb.append(TextColor.WHITE + s + " . . . ?");
|
||||
|
||||
if (/* (k < l + 1 || */ this.gm.player.getManaPoints() < l1) // && !this.gm.thePlayer.creative)
|
||||
{
|
||||
this.rect(i1, 14 + 19 * l, 108, 19, 0x400000);
|
||||
this.rect(i1 + 1, 15 + 19 * l, 16, 16, 0x200000);
|
||||
this.drawString(s, j1, 16 + 19 * l); // , /*k1,*/ (i2 & 16711422) >> 1);
|
||||
i2 = 4226832;
|
||||
}
|
||||
else
|
||||
{
|
||||
// int j2 = SKC.getMouseX() - this.guiLeft - 60;
|
||||
// int k2 = SKC.getMouseY() - this.guiTop - (14 + 19 * l);
|
||||
if(this.gm.player.getManaPoints() < k) {
|
||||
sb.append((sb.length() != 0 ? "\n" : "") + TextColor.RED + String.format("%d Mana erforderlich", this.container.mana[j]));
|
||||
}
|
||||
else {
|
||||
String s1 = "";
|
||||
|
||||
// if (j2 >= 0 && k2 >= 0 && j2 < 108 && k2 < 19)
|
||||
// {
|
||||
// this.rect(i1, 14 + 19 * l, 108, 19, 0x20ff20);
|
||||
// i2 = 16777088;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
this.rect(i1, 14 + 19 * l, 108, 19, 0x20ff20);
|
||||
// }
|
||||
if(i1 == 1) {
|
||||
s1 = "1 Manapunkt";
|
||||
}
|
||||
else {
|
||||
s1 = String.format("%d Manapunkte", i1);
|
||||
}
|
||||
|
||||
this.rect(i1 + 1, 15 + 19 * l, 16, 16, 0x008000);
|
||||
this.drawString(s, j1, 16 + 19 * l);
|
||||
i2 = 8453920;
|
||||
}
|
||||
sb.append((sb.length() != 0 ? "\n" : "") + TextColor.LGRAY.toString() + "" + s1);
|
||||
}
|
||||
|
||||
this.drawString(s1, j1 + 86 - this.getStringWidth(s1), 16 + 19 * l + 7);
|
||||
}
|
||||
}
|
||||
}
|
||||
this.hover(sb.toString(), mouseX, mouseY);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Draws the screen and all the components in it. Args : mouseX, mouseY, renderPartialTicks
|
||||
*/
|
||||
public void drawScreen(int mouseX, int mouseY)
|
||||
{
|
||||
super.drawScreen(mouseX, mouseY);
|
||||
// boolean flag = this.gm.thePlayer.creative;
|
||||
// int i = this.container.getLapisAmount();
|
||||
private String getRandomName() {
|
||||
int i = this.nameRand.zrange(2) + 3;
|
||||
String s = "";
|
||||
|
||||
for (int j = 0; j < 3; ++j)
|
||||
{
|
||||
int k = this.container.mana[j];
|
||||
Pair<Enchantment, Integer> l = this.container.ench[j];
|
||||
int i1 = j + 1;
|
||||
for(int j = 0; j < i; ++j) {
|
||||
if(j > 0) {
|
||||
s = s + " ";
|
||||
}
|
||||
|
||||
if (this.isPointInRegion(60, 14 + 19 * j, 108, 17, mouseX, mouseY) && k > 0 && l != null)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
String name = NAMES[this.nameRand.zrange(NAMES.length)];
|
||||
for(int z = 0; z < name.length(); z++) {
|
||||
s += (char)(name.charAt(z) - 0x61 + 0x80);
|
||||
}
|
||||
}
|
||||
|
||||
String s = l.first().getFormattedName(l.second());
|
||||
sb.append(TextColor.WHITE + s + " . . . ?");
|
||||
|
||||
// if (!flag)
|
||||
// {
|
||||
// if (l >= 0 && sb.length() != 0)
|
||||
// {
|
||||
// sb.append("\n");
|
||||
// }
|
||||
|
||||
if (this.gm.player.getManaPoints() < k)
|
||||
{
|
||||
sb.append((sb.length() != 0 ? "\n" : "") + TextColor.RED + String.format("%d Mana erforderlich", this.container.mana[j]));
|
||||
}
|
||||
else
|
||||
{
|
||||
String s1 = "";
|
||||
|
||||
// if (i1 == 1)
|
||||
// {
|
||||
// s1 = I18n.format("container.enchant.lapis.one");
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// s1 = I18n.format("container.enchant.lapis.many", i1);
|
||||
// }
|
||||
//
|
||||
// if (i >= i1)
|
||||
// {
|
||||
// list.add(ChatFormat.GRAY.toString() + "" + s1);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// list.add(ChatFormat.RED.toString() + "" + s1);
|
||||
// }
|
||||
|
||||
if (i1 == 1)
|
||||
{
|
||||
s1 = "1 Manapunkt";
|
||||
}
|
||||
else
|
||||
{
|
||||
s1 = String.format("%d Manapunkte", i1);
|
||||
}
|
||||
|
||||
sb.append((sb.length() != 0 ? "\n" : "") + TextColor.LGRAY.toString() + "" + s1);
|
||||
}
|
||||
// }
|
||||
|
||||
this.hover(sb.toString(), mouseX, mouseY);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private String getRandomName()
|
||||
{
|
||||
int i = this.nameRand.zrange(2) + 3;
|
||||
String s = "";
|
||||
|
||||
for (int j = 0; j < i; ++j)
|
||||
{
|
||||
if (j > 0)
|
||||
{
|
||||
s = s + " ";
|
||||
}
|
||||
|
||||
String name = NAMES[this.nameRand.zrange(NAMES.length)];
|
||||
for(int z = 0; z < name.length(); z++) {
|
||||
s += (char)(name.charAt(z) - 0x61 + 0x80);
|
||||
}
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
// private void updateAnimation()
|
||||
// {
|
||||
// ItemStack itemstack = this.inventorySlots.getSlot(0).getStack();
|
||||
//
|
||||
// if (!ItemStack.areItemStacksEqual(itemstack, this.field_147077_B))
|
||||
// {
|
||||
// this.field_147077_B = itemstack;
|
||||
//
|
||||
// while (true)
|
||||
// {
|
||||
// this.field_147082_x += (float)(this.random.zrange(4) - this.random.zrange(4));
|
||||
//
|
||||
// if (this.field_147071_v > this.field_147082_x + 1.0F || this.field_147071_v < this.field_147082_x - 1.0F)
|
||||
// {
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// ++this.field_147073_u;
|
||||
// this.field_147069_w = this.field_147071_v;
|
||||
// this.field_147076_A = this.field_147080_z;
|
||||
// boolean flag = false;
|
||||
//
|
||||
// for (int i = 0; i < 3; ++i)
|
||||
// {
|
||||
// if (this.container.enchantLevels[i] != 0)
|
||||
// {
|
||||
// flag = true;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if (flag)
|
||||
// {
|
||||
// this.field_147080_z += 0.2F;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// this.field_147080_z -= 0.2F;
|
||||
// }
|
||||
//
|
||||
// this.field_147080_z = ExtMath.clampf(this.field_147080_z, 0.0F, 1.0F);
|
||||
// float f1 = (this.field_147082_x - this.field_147071_v) * 0.4F;
|
||||
// float f = 0.2F;
|
||||
// f1 = ExtMath.clampf(f1, -f, f);
|
||||
// this.field_147081_y += (f1 - this.field_147081_y) * 0.9F;
|
||||
// this.field_147071_v += this.field_147081_y;
|
||||
// }
|
||||
return s;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,56 +5,18 @@ import common.entity.Entity;
|
|||
import common.inventory.ContainerEntityInventory;
|
||||
import common.inventory.IInventory;
|
||||
|
||||
public class GuiEntity extends GuiContainer {
|
||||
private final IInventory playerInventory;
|
||||
private final IInventory entityInventory;
|
||||
|
||||
public class GuiEntity extends GuiContainer
|
||||
{
|
||||
private IInventory playerInventory;
|
||||
private IInventory entityInventory;
|
||||
public GuiEntity(IInventory playerInv, IInventory entityInv, Entity entity) {
|
||||
super(new ContainerEntityInventory(playerInv, entityInv, entity, Client.CLIENT.player));
|
||||
this.playerInventory = playerInv;
|
||||
this.entityInventory = entityInv;
|
||||
}
|
||||
|
||||
public GuiEntity(IInventory playerInv, IInventory entityInv, Entity entity)
|
||||
{
|
||||
super(new ContainerEntityInventory(playerInv, entityInv, entity, Client.CLIENT.player));
|
||||
this.playerInventory = playerInv;
|
||||
this.entityInventory = entityInv;
|
||||
}
|
||||
|
||||
public void drawGuiContainerForegroundLayer()
|
||||
{
|
||||
this.drawString(this.entityInventory.getCommandName(), 8, 6);
|
||||
this.drawString(this.playerInventory.getCommandName(), 8, this.ySize - 96 + 2);
|
||||
}
|
||||
|
||||
// /**
|
||||
// * Args : renderPartialTicks, mouseX, mouseY
|
||||
// */
|
||||
// protected void drawGuiContainerBackgroundLayer(int mouseX, int mouseY)
|
||||
// {
|
||||
// GlState.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
// this.gm.getTextureManager().bindTexture(horseGuiTextures);
|
||||
// int i = (this.width - this.xSize) / 2;
|
||||
// int j = (this.height - this.ySize) / 2;
|
||||
//// this.rect(i, j, 0, 0, this.xSize, this.ySize);
|
||||
//
|
||||
//// if (this.horseEntity.isChested())
|
||||
//// {
|
||||
//// this.rect(i + 79, j + 17, 0, this.ySize, 90, 54);
|
||||
//// }
|
||||
//
|
||||
//// if (this.horseEntity.canWearArmor())
|
||||
//// {
|
||||
//// this.rect(i + 7, j + 35, 0, this.ySize + 54, 18, 18);
|
||||
//// }
|
||||
//
|
||||
//// GuiInventory.drawEntityOnScreen(i + 51, j + 60, 17, (float)(i + 51) - this.mousePosx, (float)(j + 75 - 50) - this.mousePosY, this.horseEntity);
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * Draws the screen and all the components in it. Args : mouseX, mouseY, renderPartialTicks
|
||||
// */
|
||||
// public void drawScreen(int mouseX, int mouseY)
|
||||
// {
|
||||
// this.mousePosx = (float)mouseX;
|
||||
// this.mousePosY = (float)mouseY;
|
||||
// super.drawScreen(mouseX, mouseY);
|
||||
// }
|
||||
public void addElements() {
|
||||
this.label(this.entityInventory.getCommandName(), 8, 6);
|
||||
this.label(this.playerInventory.getCommandName(), 8, this.ySize - 96 + 2);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,67 +5,44 @@ import common.inventory.IInventory;
|
|||
import common.inventory.InventoryPlayer;
|
||||
import common.tileentity.TileEntityFurnace;
|
||||
|
||||
public class GuiFurnace extends GuiContainer {
|
||||
private final InventoryPlayer playerInventory;
|
||||
private final IInventory tileFurnace;
|
||||
|
||||
public class GuiFurnace extends GuiContainer
|
||||
{
|
||||
// private static final String furnaceGuiTextures = "textures/gui/furnace.png";
|
||||
public GuiFurnace(InventoryPlayer playerInv, IInventory furnaceInv) {
|
||||
super(new ContainerFurnace(playerInv, furnaceInv));
|
||||
this.playerInventory = playerInv;
|
||||
this.tileFurnace = furnaceInv;
|
||||
}
|
||||
|
||||
/** The player inventory bound to this GUI. */
|
||||
private final InventoryPlayer playerInventory;
|
||||
private IInventory tileFurnace;
|
||||
public void draw() {
|
||||
super.draw();
|
||||
this.rect(58, 36, 12, 14, 0x202020);
|
||||
if(TileEntityFurnace.isBurning(this.tileFurnace)) {
|
||||
int k = this.getBurnLeftScaled(13);
|
||||
k = Math.min(k, 13);
|
||||
this.rect(58, 36 + 13 - k, 12, k + 1, 0xff7f00);
|
||||
}
|
||||
|
||||
public GuiFurnace(InventoryPlayer playerInv, IInventory furnaceInv)
|
||||
{
|
||||
super(new ContainerFurnace(playerInv, furnaceInv));
|
||||
this.playerInventory = playerInv;
|
||||
this.tileFurnace = furnaceInv;
|
||||
}
|
||||
int l = this.getCookProgressScaled(24);
|
||||
this.rect(79, 39, 24, 8, 0x606060);
|
||||
if(l > 0)
|
||||
this.rect(79, 39, l + 1, 8, 0xffaf00);
|
||||
}
|
||||
|
||||
/**
|
||||
* Draw the foreground layer for the GuiContainer (everything in front of the items). Args : mouseX, mouseY
|
||||
*/
|
||||
public void drawGuiContainerForegroundLayer()
|
||||
{
|
||||
String s = this.tileFurnace.getCommandName();
|
||||
this.drawString(s, 8, 6);
|
||||
this.drawString(this.playerInventory.getCommandName(), 8, this.ySize - 96 + 2);
|
||||
}
|
||||
public void addElements() {
|
||||
this.label(this.tileFurnace.getCommandName(), 8, 6);
|
||||
this.label(this.playerInventory.getCommandName(), 8, this.ySize - 96 + 2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Args : renderPartialTicks, mouseX, mouseY
|
||||
*/
|
||||
public void drawGuiContainerBackgroundLayer()
|
||||
{
|
||||
this.rect(58, 36, 12, 14, 0x202020);
|
||||
if (TileEntityFurnace.isBurning(this.tileFurnace))
|
||||
{
|
||||
int k = this.getBurnLeftScaled(13);
|
||||
k = Math.min(k, 13);
|
||||
this.rect(58, 36 + 13 - k, 12, k + 1, 0xff7f00);
|
||||
}
|
||||
private int getCookProgressScaled(int pixels) {
|
||||
int i = this.tileFurnace.getField(2);
|
||||
int j = this.tileFurnace.getField(3);
|
||||
return j != 0 && i != 0 ? i * pixels / j : 0;
|
||||
}
|
||||
|
||||
int l = this.getCookProgressScaled(24);
|
||||
this.rect(79, 39, 24, 8, 0x606060);
|
||||
if(l > 0)
|
||||
this.rect(79, 39, l + 1, 8, 0xffaf00);
|
||||
}
|
||||
|
||||
private int getCookProgressScaled(int pixels)
|
||||
{
|
||||
int i = this.tileFurnace.getField(2);
|
||||
int j = this.tileFurnace.getField(3);
|
||||
return j != 0 && i != 0 ? i * pixels / j : 0;
|
||||
}
|
||||
|
||||
private int getBurnLeftScaled(int pixels)
|
||||
{
|
||||
int i = this.tileFurnace.getField(1);
|
||||
|
||||
if (i == 0)
|
||||
{
|
||||
i = 200;
|
||||
}
|
||||
|
||||
return this.tileFurnace.getField(0) * pixels / i;
|
||||
}
|
||||
private int getBurnLeftScaled(int pixels) {
|
||||
int i = this.tileFurnace.getField(1);
|
||||
return this.tileFurnace.getField(0) * pixels / (i == 0 ? 200 : i);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,45 +5,19 @@ import common.inventory.ContainerHopper;
|
|||
import common.inventory.IInventory;
|
||||
import common.inventory.InventoryPlayer;
|
||||
|
||||
public class GuiHopper extends GuiContainer {
|
||||
private final IInventory playerInventory;
|
||||
private final IInventory hopperInventory;
|
||||
|
||||
public class GuiHopper extends GuiContainer
|
||||
{
|
||||
// /** The ResourceLocation containing the gui texture for the hopper */
|
||||
// private static final String HOPPER_GUI_TEXTURE = "textures/gui/hopper.png";
|
||||
public GuiHopper(InventoryPlayer playerInv, IInventory hopperInv) {
|
||||
super(new ContainerHopper(playerInv, hopperInv, Client.CLIENT.player));
|
||||
this.playerInventory = playerInv;
|
||||
this.hopperInventory = hopperInv;
|
||||
this.ySize = 133;
|
||||
}
|
||||
|
||||
/** The player inventory currently bound to this GUI instance */
|
||||
private IInventory playerInventory;
|
||||
|
||||
/** The hopper inventory bound to this GUI instance */
|
||||
private IInventory hopperInventory;
|
||||
|
||||
public GuiHopper(InventoryPlayer playerInv, IInventory hopperInv)
|
||||
{
|
||||
super(new ContainerHopper(playerInv, hopperInv, Client.CLIENT.player));
|
||||
this.playerInventory = playerInv;
|
||||
this.hopperInventory = hopperInv;
|
||||
// this.allowUserInput = false;
|
||||
this.ySize = 133;
|
||||
}
|
||||
|
||||
/**
|
||||
* Draw the foreground layer for the GuiContainer (everything in front of the items). Args : mouseX, mouseY
|
||||
*/
|
||||
public void drawGuiContainerForegroundLayer()
|
||||
{
|
||||
this.drawString(this.hopperInventory.getCommandName(), 8, 6);
|
||||
this.drawString(this.playerInventory.getCommandName(), 8, this.ySize - 96 + 2);
|
||||
}
|
||||
|
||||
// /**
|
||||
// * Args : renderPartialTicks, mouseX, mouseY
|
||||
// */
|
||||
// protected void drawGuiContainerBackgroundLayer(int mouseX, int mouseY)
|
||||
// {
|
||||
// GlState.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
// this.gm.getTextureManager().bindTexture(HOPPER_GUI_TEXTURE);
|
||||
// int i = (this.width - this.xSize) / 2;
|
||||
// int j = (this.height - this.ySize) / 2;
|
||||
//// this.rect(i, j, 0, 0, this.xSize, this.ySize);
|
||||
// }
|
||||
public void addElements() {
|
||||
this.label(this.hopperInventory.getCommandName(), 8, 6);
|
||||
this.label(this.playerInventory.getCommandName(), 8, this.ySize - 96 + 2);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,57 +2,12 @@ package client.gui.container;
|
|||
|
||||
import common.entity.npc.EntityNPC;
|
||||
|
||||
public class GuiInventory extends GuiContainer
|
||||
{
|
||||
// private final GuiCheat cheat;
|
||||
// private float oldMouseX;
|
||||
// private float oldMouseY;
|
||||
public class GuiInventory extends GuiContainer {
|
||||
public GuiInventory(EntityNPC player) {
|
||||
super(player.inventoryContainer);
|
||||
}
|
||||
|
||||
public GuiInventory(EntityNPC player)
|
||||
{
|
||||
super(player.inventoryContainer);
|
||||
// this.allowUserInput = true;
|
||||
// this.cheat = cheat;
|
||||
}
|
||||
|
||||
// public void updateScreen()
|
||||
// {
|
||||
// this.updateActivePotionEffects();
|
||||
// }
|
||||
|
||||
// public void initGui()
|
||||
// {
|
||||
//// this.buttonList.clear();
|
||||
// super.initGui();
|
||||
// if(this.cheat != null)
|
||||
// this.buttonList.add(new Button(1, this.guiLeft + this.xSize - 16, this.guiTop + 4, 12, 12, "X"));
|
||||
// }
|
||||
|
||||
public void drawGuiContainerForegroundLayer()
|
||||
{
|
||||
this.drawString("Handwerk", 86, 16);
|
||||
}
|
||||
|
||||
// public void drawScreen(int mouseX, int mouseY, float partialTicks)
|
||||
// {
|
||||
// super.drawScreen(mouseX, mouseY, partialTicks);
|
||||
// this.oldMouseX = (float)mouseX;
|
||||
// this.oldMouseY = (float)mouseY;
|
||||
// }
|
||||
|
||||
// protected void drawGuiContainerBackgroundLayer(int mouseX, int mouseY)
|
||||
// {
|
||||
// GlState.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
// this.gm.getTextureManager().bindTexture(inventoryBackground);
|
||||
// int i = this.guiLeft;
|
||||
// int j = this.guiTop;
|
||||
//// this.rect(i, j, 0, 0, this.xSize, this.ySize);
|
||||
//// drawEntityOnScreen(i + 51, j + 75, 30, (float)(i + 51) - this.oldMouseX, (float)(j + 75 - 50) - this.oldMouseY, this.gm.thePlayer);
|
||||
// }
|
||||
|
||||
// public void actionPerformed(int button)
|
||||
// {
|
||||
// if(button == 1 && this.cheat != null && this.gm.thePlayer.inventory.getItemStack() == null)
|
||||
// this.gm.displayGuiScreen(this.cheat);
|
||||
// }
|
||||
public void addElements() {
|
||||
this.label("Handwerk", 86, 16);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,9 @@ package client.gui.container;
|
|||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import client.gui.element.ActButton;
|
||||
import client.gui.element.ButtonCallback;
|
||||
import client.gui.element.PressType;
|
||||
import client.renderer.GlState;
|
||||
import client.renderer.ItemRenderer;
|
||||
import common.inventory.ContainerMerchant;
|
||||
|
@ -12,276 +15,128 @@ import common.village.MerchantRecipe;
|
|||
import common.village.MerchantRecipeList;
|
||||
import common.world.World;
|
||||
|
||||
public class GuiMerchant extends GuiContainer
|
||||
{
|
||||
// private static final String MERCHANT_GUI_TEXTURE = "textures/gui/trading.png";
|
||||
public class GuiMerchant extends GuiContainer implements ButtonCallback {
|
||||
private final String merchantName;
|
||||
|
||||
private int selectedMerchantRecipe;
|
||||
private String chatComponent;
|
||||
private int recipe;
|
||||
private ActButton prevBtn;
|
||||
private ActButton nextBtn;
|
||||
|
||||
public GuiMerchant(InventoryPlayer inv, String name, World worldIn)
|
||||
{
|
||||
super(new ContainerMerchant(inv, null, worldIn));
|
||||
this.chatComponent = name != null ? name : "NSC";
|
||||
}
|
||||
public GuiMerchant(InventoryPlayer inv, String name, World world) {
|
||||
super(new ContainerMerchant(inv, null, world));
|
||||
this.merchantName = name != null ? name : "NSC";
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the
|
||||
* window resizes, the buttonList is cleared beforehand.
|
||||
*/
|
||||
// public void initGui()
|
||||
// {
|
||||
// super.initGui();
|
||||
// }
|
||||
public void addButtons() {
|
||||
super.addButtons();
|
||||
this.nextBtn = this.button(120 + 27, 24, 12, 16, this, ">");
|
||||
this.prevBtn = this.button(36 - 19, 24, 12, 16, this, "<");
|
||||
this.slot(36 - 1, 24 - 1, 18, 18);
|
||||
this.slot(62 - 1, 24 - 1, 18, 18);
|
||||
this.slot(120 - 1, 24 - 1, 18, 18);
|
||||
this.nextBtn.enabled = false;
|
||||
this.prevBtn.enabled = false;
|
||||
}
|
||||
|
||||
public void addButtons() {
|
||||
super.addButtons();
|
||||
this.button(120 + 27, 24, 12, 16);
|
||||
this.button(36 - 19, 24, 12, 16);
|
||||
this.button(36 - 1, 24 - 1, 18, 18);
|
||||
this.button(62 - 1, 24 - 1, 18, 18);
|
||||
this.button(120 - 1, 24 - 1, 18, 18);
|
||||
}
|
||||
public void addElements() {
|
||||
this.label(this.merchantName, 8, 6);
|
||||
this.label("Inventar", 8, this.ySize - 96 + 2);
|
||||
}
|
||||
|
||||
public void mouseClicked(int mouseX, int mouseY, int mouseButton)
|
||||
{
|
||||
if (mouseButton == 0)
|
||||
{
|
||||
// int i = (this.width - this.xSize) / 2;
|
||||
// int j = (this.height - this.ySize) / 2;
|
||||
if(mouseX >= 147 && mouseX < 147 + 12 && mouseY >= 24 && mouseY < 24 + 16) {
|
||||
this.switchTrade(true);
|
||||
return;
|
||||
}
|
||||
else if(mouseX >= 17 && mouseX < 17 + 12 && mouseY >= 24 && mouseY < 24 + 16) {
|
||||
this.switchTrade(false);
|
||||
return;
|
||||
}
|
||||
// this.buttonList.add(new Button(1, i + 120 + 27, j + 24 - 1, 12, 19, ">"));
|
||||
// this.buttonList.add(new Button(2, i + 36 - 19, j + 24 - 1, 12, 19, "<"));
|
||||
public void drawOverlays() {
|
||||
super.drawOverlays();
|
||||
MerchantRecipeList merchantrecipelist = this.getRecipes();
|
||||
if(merchantrecipelist != null && !merchantrecipelist.isEmpty()) {
|
||||
int k = this.recipe;
|
||||
MerchantRecipe merchantrecipe = (MerchantRecipe)merchantrecipelist.get(k);
|
||||
ItemStack itemstack = merchantrecipe.first();
|
||||
ItemStack itemstack1 = merchantrecipe.second();
|
||||
ItemStack itemstack2 = merchantrecipe.result();
|
||||
this.renderItemOverlayIntoGUI(itemstack, 36, 24, null);
|
||||
if(itemstack1 != null)
|
||||
this.renderItemOverlayIntoGUI(itemstack1, 62, 24, null);
|
||||
this.renderItemOverlayIntoGUI(itemstack2, 120, 24, null);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
public void use(ActButton btn, PressType type) {
|
||||
boolean flag = false;
|
||||
MerchantRecipeList list = this.getRecipes();
|
||||
list = list != null && list.size() == 0 ? null : list;
|
||||
|
||||
super.mouseClicked(mouseX, mouseY, mouseButton);
|
||||
}
|
||||
if(btn == this.nextBtn) {
|
||||
if(list != null && this.recipe < list.size() - 1) {
|
||||
++this.recipe;
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
else if(btn == this.prevBtn) {
|
||||
if(list != null && this.recipe > 0) {
|
||||
--this.recipe;
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Draw the foreground layer for the GuiContainer (everything in front of the items). Args : mouseX, mouseY
|
||||
*/
|
||||
public void drawGuiContainerForegroundLayer()
|
||||
{
|
||||
String s = this.chatComponent;
|
||||
this.drawString(s, 8, 6);
|
||||
this.drawString("Inventar", 8, this.ySize - 96 + 2);
|
||||
}
|
||||
if(flag) {
|
||||
this.prevBtn.enabled = list != null && list.size() > 1 && this.recipe > 0;
|
||||
this.nextBtn.enabled = list != null && list.size() > 1 && this.recipe < list.size() - 1;
|
||||
((ContainerMerchant)this.inventorySlots).setCurrentRecipeIndex(this.recipe);
|
||||
this.gm.getNetHandler().addToSendQueue(new CPacketAction(CPacketAction.Action.SELECT_TRADE, this.recipe));
|
||||
}
|
||||
}
|
||||
|
||||
public void drawOverlays() {
|
||||
super.drawOverlays();
|
||||
MerchantRecipeList merchantrecipelist = this.getRecipes();
|
||||
if (merchantrecipelist != null && !merchantrecipelist.isEmpty()) {
|
||||
int k = this.selectedMerchantRecipe;
|
||||
MerchantRecipe merchantrecipe = (MerchantRecipe)merchantrecipelist.get(k);
|
||||
ItemStack itemstack = merchantrecipe.first();
|
||||
ItemStack itemstack1 = merchantrecipe.second();
|
||||
ItemStack itemstack2 = merchantrecipe.result();
|
||||
this.renderItemOverlayIntoGUI(itemstack, 36, 24, null);
|
||||
if(itemstack1 != null)
|
||||
this.renderItemOverlayIntoGUI(itemstack1, 62, 24, null);
|
||||
this.renderItemOverlayIntoGUI(itemstack2, 120, 24, null);
|
||||
}
|
||||
}
|
||||
public void drawScreen(int mouseX, int mouseY) {
|
||||
super.drawScreen(mouseX, mouseY);
|
||||
MerchantRecipeList merchantrecipelist = this.getRecipes();
|
||||
|
||||
/**
|
||||
* Called by the controls from the buttonList when activated. (Mouse pressed for buttons)
|
||||
*/
|
||||
public void switchTrade(boolean forward)
|
||||
{
|
||||
boolean flag = false;
|
||||
if(merchantrecipelist != null && !merchantrecipelist.isEmpty()) {
|
||||
int k = this.recipe;
|
||||
MerchantRecipe merchantrecipe = (MerchantRecipe)merchantrecipelist.get(k);
|
||||
ItemStack itemstack = merchantrecipe.first();
|
||||
ItemStack itemstack1 = merchantrecipe.second();
|
||||
ItemStack itemstack2 = merchantrecipe.result();
|
||||
GL11.glPushMatrix();
|
||||
ItemRenderer.enableGUIStandardItemLighting();
|
||||
GlState.disableLighting();
|
||||
GlState.enableRescaleNormal();
|
||||
GlState.enableColorMaterial();
|
||||
GlState.enableLighting();
|
||||
this.itemRender.zLevel = 100.0F;
|
||||
this.itemRender.renderItemAndEffectIntoGUI(itemstack, 36, 24);
|
||||
|
||||
if (forward)
|
||||
{
|
||||
++this.selectedMerchantRecipe;
|
||||
MerchantRecipeList merchantrecipelist = this.getRecipes();
|
||||
if(itemstack1 != null) {
|
||||
this.itemRender.renderItemAndEffectIntoGUI(itemstack1, 62, 24);
|
||||
}
|
||||
|
||||
if (merchantrecipelist != null && this.selectedMerchantRecipe >= merchantrecipelist.size())
|
||||
{
|
||||
this.selectedMerchantRecipe = merchantrecipelist.size() - 1;
|
||||
}
|
||||
this.itemRender.renderItemAndEffectIntoGUI(itemstack2, 120, 24);
|
||||
this.itemRender.zLevel = 0.0F;
|
||||
GlState.disableLighting();
|
||||
|
||||
flag = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
--this.selectedMerchantRecipe;
|
||||
if(this.isPointInRegion(36, 24, 16, 16, mouseX, mouseY) && itemstack != null) {
|
||||
this.renderToolTip(itemstack, mouseX, mouseY);
|
||||
}
|
||||
else if(itemstack1 != null && this.isPointInRegion(62, 24, 16, 16, mouseX, mouseY) && itemstack1 != null) {
|
||||
this.renderToolTip(itemstack1, mouseX, mouseY);
|
||||
}
|
||||
else if(itemstack2 != null && this.isPointInRegion(120, 24, 16, 16, mouseX, mouseY) && itemstack2 != null) {
|
||||
this.renderToolTip(itemstack2, mouseX, mouseY);
|
||||
}
|
||||
|
||||
if (this.selectedMerchantRecipe < 0)
|
||||
{
|
||||
this.selectedMerchantRecipe = 0;
|
||||
}
|
||||
GL11.glPopMatrix();
|
||||
GlState.enableLighting();
|
||||
GlState.enableDepth();
|
||||
ItemRenderer.enableStandardItemLighting();
|
||||
}
|
||||
}
|
||||
|
||||
flag = true;
|
||||
}
|
||||
public void setRecipes(MerchantRecipeList recipes) {
|
||||
((ContainerMerchant)this.inventorySlots).getMerchantInventory().setRecipes(recipes);
|
||||
this.recipe = 0;
|
||||
this.prevBtn.enabled = false;
|
||||
this.nextBtn.enabled = recipes != null && recipes.size() > 1;
|
||||
}
|
||||
|
||||
if (flag)
|
||||
{
|
||||
((ContainerMerchant)this.inventorySlots).setCurrentRecipeIndex(this.selectedMerchantRecipe);
|
||||
// PacketBuffer packetbuffer = new PacketBuffer(Unpooled.buffer());
|
||||
// packetbuffer.writeInt(this.selectedMerchantRecipe);
|
||||
this.gm.getNetHandler().addToSendQueue(new CPacketAction(CPacketAction.Action.SELECT_TRADE,
|
||||
this.selectedMerchantRecipe));
|
||||
}
|
||||
}
|
||||
|
||||
// /**
|
||||
// * Args : renderPartialTicks, mouseX, mouseY
|
||||
// */
|
||||
// protected void drawGuiContainerBackgroundLayer(int mouseX, int mouseY)
|
||||
// {
|
||||
// GlState.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
// this.gm.getTextureManager().bindTexture(MERCHANT_GUI_TEXTURE);
|
||||
// int i = (this.width - this.xSize) / 2;
|
||||
// int j = (this.height - this.ySize) / 2;
|
||||
//// this.rect(i, j, 0, 0, this.xSize, this.ySize);
|
||||
//// MerchantRecipeList merchantrecipelist = this.merchant.getRecipes(this.gm.thePlayer);
|
||||
//
|
||||
//// if (merchantrecipelist != null && !merchantrecipelist.isEmpty())
|
||||
//// {
|
||||
//// int k = this.selectedMerchantRecipe;
|
||||
////
|
||||
//// if (k < 0 || k >= merchantrecipelist.size())
|
||||
//// {
|
||||
//// return;
|
||||
//// }
|
||||
//
|
||||
//// MerchantRecipe merchantrecipe = (MerchantRecipe)merchantrecipelist.get(k);
|
||||
//
|
||||
//// if (merchantrecipe.isRecipeDisabled())
|
||||
//// {
|
||||
//// this.gm.getTextureManager().bindTexture(MERCHANT_GUI_TEXTURE);
|
||||
//// GlState.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
//// GlState.disableLighting();
|
||||
//// this.rect(this.guiLeft + 83, this.guiTop + 21, 212, 0, 28, 21);
|
||||
//// this.rect(this.guiLeft + 83, this.guiTop + 51, 212, 0, 28, 21);
|
||||
//// }
|
||||
//// }
|
||||
// }
|
||||
|
||||
/**
|
||||
* Draws the screen and all the components in it. Args : mouseX, mouseY, renderPartialTicks
|
||||
*/
|
||||
public void drawScreen(int mouseX, int mouseY)
|
||||
{
|
||||
super.drawScreen(mouseX, mouseY);
|
||||
MerchantRecipeList merchantrecipelist = this.getRecipes();
|
||||
|
||||
if (merchantrecipelist != null && !merchantrecipelist.isEmpty())
|
||||
{
|
||||
// int i = (this.width - this.xSize) / 2;
|
||||
// int j = (this.height - this.ySize) / 2;
|
||||
int k = this.selectedMerchantRecipe;
|
||||
MerchantRecipe merchantrecipe = (MerchantRecipe)merchantrecipelist.get(k);
|
||||
ItemStack itemstack = merchantrecipe.first();
|
||||
ItemStack itemstack1 = merchantrecipe.second();
|
||||
ItemStack itemstack2 = merchantrecipe.result();
|
||||
GL11.glPushMatrix();
|
||||
ItemRenderer.enableGUIStandardItemLighting();
|
||||
GlState.disableLighting();
|
||||
GlState.enableRescaleNormal();
|
||||
GlState.enableColorMaterial();
|
||||
GlState.enableLighting();
|
||||
this.itemRender.zLevel = 100.0F;
|
||||
this.itemRender.renderItemAndEffectIntoGUI(itemstack, 36, 24);
|
||||
// this.itemRender.renderItemOverlays(itemstack, 36, 24);
|
||||
|
||||
if (itemstack1 != null)
|
||||
{
|
||||
this.itemRender.renderItemAndEffectIntoGUI(itemstack1, 62, 24);
|
||||
// this.itemRender.renderItemOverlays(itemstack1, 62, 24);
|
||||
}
|
||||
|
||||
this.itemRender.renderItemAndEffectIntoGUI(itemstack2, 120, 24);
|
||||
// this.itemRender.renderItemOverlays(itemstack2, 120, 24);
|
||||
this.itemRender.zLevel = 0.0F;
|
||||
GlState.disableLighting();
|
||||
|
||||
if (this.isPointInRegion(36, 24, 16, 16, mouseX, mouseY) && itemstack != null)
|
||||
{
|
||||
this.renderToolTip(itemstack, mouseX, mouseY);
|
||||
}
|
||||
else if (itemstack1 != null && this.isPointInRegion(62, 24, 16, 16, mouseX, mouseY) && itemstack1 != null)
|
||||
{
|
||||
this.renderToolTip(itemstack1, mouseX, mouseY);
|
||||
}
|
||||
else if (itemstack2 != null && this.isPointInRegion(120, 24, 16, 16, mouseX, mouseY) && itemstack2 != null)
|
||||
{
|
||||
this.renderToolTip(itemstack2, mouseX, mouseY);
|
||||
}
|
||||
// else if (merchantrecipe.isRecipeDisabled() && (this.isPointInRegion(83, 21, 28, 21, mouseX, mouseY) || this.isPointInRegion(83, 51, 28, 21, mouseX, mouseY)))
|
||||
// {
|
||||
// this.drawCreativeTabHoveringText(I18n.format("merchant.deprecated"), mouseX, mouseY);
|
||||
// }
|
||||
|
||||
GL11.glPopMatrix();
|
||||
GlState.enableLighting();
|
||||
GlState.enableDepth();
|
||||
ItemRenderer.enableStandardItemLighting();
|
||||
// int i = (this.width - this.xSize) / 2;
|
||||
// int j = (this.height - this.ySize) / 2;
|
||||
// if(mouseX >= i + 147 && mouseX < i + 147 + 12 && mouseY >= j + 23 && mouseX < j + 23 + 19) {
|
||||
// SKC.highlight(i + 147, j + 23, 12, 19);
|
||||
// }
|
||||
// else if(mouseX >= i + 17 && mouseX < i + 17 + 12 && mouseY >= j + 23 && mouseX < j + 23 + 19) {
|
||||
// SKC.highlight(i + 17, j + 23, 12, 19);
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
public void setRecipes(MerchantRecipeList recipes)
|
||||
{
|
||||
((ContainerMerchant)this.inventorySlots).getMerchantInventory().setRecipes(recipes);
|
||||
}
|
||||
|
||||
private MerchantRecipeList getRecipes()
|
||||
{
|
||||
return ((ContainerMerchant)this.inventorySlots).getMerchantInventory().getRecipes();
|
||||
}
|
||||
|
||||
// static class MerchantButton extends Button
|
||||
// {
|
||||
// private final boolean next;
|
||||
//
|
||||
// public MerchantButton(int buttonID, int x, int y, boolean isNext)
|
||||
// {
|
||||
// super(buttonID, x, y, 12, 19, "");
|
||||
// this.next = isNext;
|
||||
// }
|
||||
//
|
||||
// public void drawButton(Game gm, int mouseX, int mouseY)
|
||||
// {
|
||||
// if (this.visible)
|
||||
// {
|
||||
// gm.getTextureManager().bindTexture(GuiMerchant.MERCHANT_GUI_TEXTURE);
|
||||
// GlState.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
// boolean flag = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height;
|
||||
// int i = 0;
|
||||
// int j = 176;
|
||||
//
|
||||
// if (!this.enabled)
|
||||
// {
|
||||
// j += this.width * 2;
|
||||
// }
|
||||
// else if (flag)
|
||||
// {
|
||||
// j += this.width;
|
||||
// }
|
||||
//
|
||||
// if (!this.next)
|
||||
// {
|
||||
// i += this.height;
|
||||
// }
|
||||
//
|
||||
// this.rect(this.xPosition, this.yPosition, j, i, this.width, this.height);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
private MerchantRecipeList getRecipes() {
|
||||
return ((ContainerMerchant)this.inventorySlots).getMerchantInventory().getRecipes();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,8 @@ 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;
|
||||
|
@ -11,120 +13,48 @@ import common.inventory.InventoryPlayer;
|
|||
import common.item.ItemStack;
|
||||
import common.world.World;
|
||||
|
||||
public class GuiRepair extends GuiContainer implements ICrafting
|
||||
{
|
||||
// private static final String anvilResource = "textures/gui/anvil.png";
|
||||
|
||||
private ContainerRepair anvil;
|
||||
public class GuiRepair extends GuiContainer implements ICrafting {
|
||||
private ContainerRepair anvil;
|
||||
private Label info;
|
||||
// private TextField nameField;
|
||||
private InventoryPlayer playerInventory;
|
||||
private InventoryPlayer playerInventory;
|
||||
|
||||
public GuiRepair(InventoryPlayer inventoryIn, World worldIn)
|
||||
{
|
||||
super(new ContainerRepair(inventoryIn, worldIn, Client.CLIENT.player));
|
||||
this.playerInventory = inventoryIn;
|
||||
this.anvil = (ContainerRepair)this.inventorySlots;
|
||||
}
|
||||
public GuiRepair(InventoryPlayer inv, World world) {
|
||||
super(new ContainerRepair(inv, world, Client.CLIENT.player));
|
||||
this.playerInventory = inv;
|
||||
this.anvil = (ContainerRepair)this.inventorySlots;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the
|
||||
* window resizes, the buttonList is cleared beforehand.
|
||||
*/
|
||||
public void initGui()
|
||||
{
|
||||
super.initGui();
|
||||
// Keyboard.enableRepeatEvents(true);
|
||||
// int i = (this.width - this.xSize) / 2;
|
||||
// int j = (this.height - this.ySize) / 2;
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
// this.nameField = new TextField(i + 62, j + 24, 103, 12);
|
||||
// this.nameField.setTextColor(-1);
|
||||
// this.nameField.setDisabledTextColour(-1);
|
||||
// this.nameField.setEnableBackgroundDrawing(false);
|
||||
// this.nameField.setMaxStringLength(30);
|
||||
this.inventorySlots.removeCraftingFromCrafters(this);
|
||||
this.inventorySlots.onCraftGuiOpened(this);
|
||||
}
|
||||
this.inventorySlots.removeCraftingFromCrafters(this);
|
||||
this.inventorySlots.onCraftGuiOpened(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the screen is unloaded. Used to disable keyboard repeat events
|
||||
*/
|
||||
public void onGuiClosed()
|
||||
{
|
||||
super.onGuiClosed();
|
||||
// Keyboard.enableRepeatEvents(false);
|
||||
this.inventorySlots.removeCraftingFromCrafters(this);
|
||||
}
|
||||
public void onGuiClosed() {
|
||||
super.onGuiClosed();
|
||||
this.inventorySlots.removeCraftingFromCrafters(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Draw the foreground layer for the GuiContainer (everything in front of the items). Args : mouseX, mouseY
|
||||
*/
|
||||
public void drawGuiContainerForegroundLayer()
|
||||
{
|
||||
// GlState.disableLighting();
|
||||
// GlState.disableBlend();
|
||||
this.drawString("Amboss", 60, 6);
|
||||
public void updateScreen() {
|
||||
super.updateScreen();
|
||||
if(this.anvil.maximumCost >= 40)
|
||||
this.info.setText(TextColor.DRED + "Zu teuer!");
|
||||
else if(this.anvil.maximumCost <= 0 || !this.anvil.getSlot(2).getHasStack())
|
||||
this.info.setText("");
|
||||
else if(!this.anvil.getSlot(2).canTakeStack(this.playerInventory.player))
|
||||
this.info.setText(TextColor.RED + "Manakosten: " + this.anvil.maximumCost);
|
||||
else
|
||||
this.info.setText(TextColor.GREEN + "Manakosten: " + this.anvil.maximumCost);
|
||||
}
|
||||
|
||||
if (this.anvil.maximumCost > 0)
|
||||
{
|
||||
int i = 8453920;
|
||||
boolean flag = true;
|
||||
String s = String.format("Manakosten: %d", this.anvil.maximumCost);
|
||||
public void addElements() {
|
||||
this.label("Amboss", 60, 6);
|
||||
this.info = this.label("", 60, 67);
|
||||
}
|
||||
|
||||
if (this.anvil.maximumCost >= 40) // && !this.gm.thePlayer.creative)
|
||||
{
|
||||
s = "Zu teuer!";
|
||||
i = 16736352;
|
||||
}
|
||||
else if (!this.anvil.getSlot(2).getHasStack())
|
||||
{
|
||||
flag = false;
|
||||
}
|
||||
else if (!this.anvil.getSlot(2).canTakeStack(this.playerInventory.player))
|
||||
{
|
||||
i = 16736352;
|
||||
}
|
||||
|
||||
if (flag)
|
||||
{
|
||||
int j = -16777216 | (i & 16579836) >> 2 | i & -16777216;
|
||||
int k = this.xSize - 8 - this.getStringWidth(s);
|
||||
int l = 67;
|
||||
|
||||
// if (FontRenderer.getUnicodeFlag())
|
||||
// {
|
||||
// drawRect(k - 3, l - 2, this.xSize - 7, l + 10, -16777216);
|
||||
// drawRect(k - 2, l - 1, this.xSize - 8, l + 9, -12895429);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
this.drawString(s, k, l + 1);
|
||||
this.drawString(s, k + 1, l);
|
||||
this.drawString(s, k + 1, l + 1);
|
||||
// }
|
||||
|
||||
this.drawString(s, k, l);
|
||||
}
|
||||
}
|
||||
|
||||
// GlState.enableLighting();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when a key is typed (except F11 which toggles full screen). This is the equivalent of
|
||||
* KeyListener.keyTyped(KeyEvent e). Args : character (character on the key), keyCode (lwjgl Keyboard key code)
|
||||
*/
|
||||
// protected void keyTyped(char typedChar, int keyCode)
|
||||
// {
|
||||
// if (this.nameField.textboxKeyTyped(typedChar, keyCode))
|
||||
//// {
|
||||
// this.renameItem();
|
||||
//// }
|
||||
//// else
|
||||
//// {
|
||||
//// super.keyTyped(typedChar, keyCode);
|
||||
//// }
|
||||
// }
|
||||
//
|
||||
// private void renameItem()
|
||||
// {
|
||||
// String s = this.nameField.getText();
|
||||
|
@ -137,60 +67,13 @@ public class GuiRepair extends GuiContainer implements ICrafting
|
|||
//
|
||||
// this.anvil.updateItemName(s);
|
||||
// this.gm.thePlayer.sendQueue.addToSendQueue(new CPacketMessage(CPacketMessage.Type.ITEM, s));
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Called when the mouse is clicked. Args : mouseX, mouseY, clickedButton
|
||||
// */
|
||||
// protected void mouseClicked(int mouseX, int mouseY, int mouseButton)
|
||||
// {
|
||||
// super.mouseClicked(mouseX, mouseY, mouseButton);
|
||||
// this.nameField.mouseClicked(mouseX, mouseY, mouseButton);
|
||||
// }
|
||||
|
||||
/**
|
||||
* Draws the screen and all the components in it. Args : mouseX, mouseY, renderPartialTicks
|
||||
*/
|
||||
// public void drawScreen(int mouseX, int mouseY, float partialTicks)
|
||||
// {
|
||||
// super.drawScreen(mouseX, mouseY, partialTicks);
|
||||
// GlState.disableLighting();
|
||||
// GlState.disableBlend();
|
||||
// this.nameField.drawTextBox();
|
||||
// }
|
||||
public void updateCraftingInventory(Container containerToSend, List<ItemStack> itemsList) {
|
||||
this.sendSlotContents(containerToSend, 0, containerToSend.getSlot(0).getStack());
|
||||
}
|
||||
|
||||
// /**
|
||||
// * Args : renderPartialTicks, mouseX, mouseY
|
||||
// */
|
||||
// protected void drawGuiContainerBackgroundLayer(int mouseX, int mouseY)
|
||||
// {
|
||||
// GlState.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
// this.gm.getTextureManager().bindTexture(anvilResource);
|
||||
// int i = (this.width - this.xSize) / 2;
|
||||
// int j = (this.height - this.ySize) / 2;
|
||||
//// this.rect(i, j, 0, 0, this.xSize, this.ySize);
|
||||
//// this.rect(i + 59, j + 20, 0, this.ySize + (this.anvil.getSlot(0).getHasStack() ? 0 : 16), 110, 16);
|
||||
//
|
||||
//// if ((this.anvil.getSlot(0).getHasStack() || this.anvil.getSlot(1).getHasStack()) && !this.anvil.getSlot(2).getHasStack())
|
||||
//// {
|
||||
//// this.rect(i + 99, j + 45, this.xSize, 0, 28, 21);
|
||||
//// }
|
||||
// }
|
||||
|
||||
/**
|
||||
* update the crafting window inventory with the items in the list
|
||||
*/
|
||||
public void updateCraftingInventory(Container containerToSend, List<ItemStack> itemsList)
|
||||
{
|
||||
this.sendSlotContents(containerToSend, 0, containerToSend.getSlot(0).getStack());
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends the contents of an inventory slot to the client-side Container. This doesn't have to match the actual
|
||||
* contents of that slot. Args: Container, slot number, slot contents
|
||||
*/
|
||||
public void sendSlotContents(Container containerToSend, int slotInd, ItemStack stack)
|
||||
{
|
||||
public void sendSlotContents(Container containerToSend, int slotInd, ItemStack stack) {
|
||||
// if (slotInd == 0)
|
||||
// {
|
||||
// this.nameField.setText(stack == null ? "" : stack.getDisplayName());
|
||||
|
@ -201,18 +84,11 @@ public class GuiRepair extends GuiContainer implements ICrafting
|
|||
// this.renameItem();
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends two ints to the client-side Container. Used for furnace burning time, smelting progress, brewing progress,
|
||||
* and enchanting level. Normally the first int identifies which variable to update, and the second contains the new
|
||||
* value. Both are truncated to shorts in non-local SMP.
|
||||
*/
|
||||
public void sendProgressBarUpdate(Container containerIn, int varToUpdate, int newValue)
|
||||
{
|
||||
}
|
||||
public void sendProgressBarUpdate(Container containerIn, int varToUpdate, int newValue) {
|
||||
}
|
||||
|
||||
public void sendAllWindowProperties(Container p_175173_1_, IInventory p_175173_2_)
|
||||
{
|
||||
}
|
||||
public void sendAllWindowProperties(Container p_175173_1_, IInventory p_175173_2_) {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,32 +1,40 @@
|
|||
package client.gui.container;
|
||||
|
||||
import client.Client;
|
||||
import client.gui.element.Label;
|
||||
import common.inventory.ContainerTile;
|
||||
import common.inventory.IInventory;
|
||||
import common.inventory.InventoryPlayer;
|
||||
import common.tileentity.TileEntityDevice;
|
||||
|
||||
public class GuiTile extends GuiContainer {
|
||||
private final IInventory playerInv;
|
||||
private final IInventory tileInv;
|
||||
private final TileEntityDevice tile;
|
||||
|
||||
public class GuiTile extends GuiContainer
|
||||
{
|
||||
private final IInventory playerInv;
|
||||
private final IInventory tileInv;
|
||||
private final TileEntityDevice tile;
|
||||
private Label header;
|
||||
private Label temp;
|
||||
private Label desc;
|
||||
|
||||
public GuiTile(InventoryPlayer player, IInventory inv, TileEntityDevice tile)
|
||||
{
|
||||
super(new ContainerTile(player, tile, inv, Client.CLIENT.player));
|
||||
this.playerInv = player;
|
||||
this.tileInv = tile;
|
||||
this.ySize = 153;
|
||||
this.tile = tile;
|
||||
}
|
||||
public GuiTile(InventoryPlayer player, IInventory inv, TileEntityDevice tile) {
|
||||
super(new ContainerTile(player, tile, inv, Client.CLIENT.player));
|
||||
this.playerInv = player;
|
||||
this.tileInv = tile;
|
||||
this.ySize = 153;
|
||||
this.tile = tile;
|
||||
}
|
||||
|
||||
public void drawGuiContainerForegroundLayer()
|
||||
{
|
||||
this.drawString(this.tile.getStatus().color + this.tileInv.getCommandName() + " - " + this.tile.getStatus().name, 8, 6);
|
||||
this.drawString(this.playerInv.getCommandName(), 8, this.ySize - 96 + 2);
|
||||
this.drawString(String.format("Temperatur: %d °", this.tile.getTemperature()), 8, 18);
|
||||
this.drawString(this.tile.formatDisplay((ContainerTile)this.inventorySlots), 8, 28);
|
||||
}
|
||||
public void updateScreen() {
|
||||
super.updateScreen();
|
||||
this.header.setText(this.tile.getStatus().color + this.tileInv.getCommandName() + " - " + this.tile.getStatus().name);
|
||||
this.temp.setText(String.format("Temperatur: %d °", this.tile.getTemperature()));
|
||||
this.desc.setText(this.tile.formatDisplay((ContainerTile)this.inventorySlots));
|
||||
}
|
||||
|
||||
public void addElements() {
|
||||
this.header = this.label("", 8, 6);
|
||||
this.label(this.playerInv.getCommandName(), 8, this.ySize - 96 + 2);
|
||||
this.temp = this.label("", 8, 18);
|
||||
this.desc = this.label("", 8, 28);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,6 @@ import common.block.tech.BlockAnvil;
|
|||
import common.enchantment.Enchantment;
|
||||
import common.enchantment.EnchantmentHelper;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.init.Blocks;
|
||||
import common.init.Items;
|
||||
import common.item.ItemStack;
|
||||
import common.util.BlockPos;
|
||||
|
@ -421,7 +420,7 @@ public class ContainerRepair extends Container
|
|||
|
||||
public boolean canInteractWith(EntityNPC playerIn)
|
||||
{
|
||||
return this.theWorld.getState(this.selfPosition).getBlock() != Blocks.anvil ? false : playerIn.getDistanceSq((double)this.selfPosition.getX() + 0.5D, (double)this.selfPosition.getY() + 0.5D, (double)this.selfPosition.getZ() + 0.5D) <= 64.0D;
|
||||
return !(this.theWorld.getState(this.selfPosition).getBlock() instanceof BlockAnvil) ? false : playerIn.getDistanceSq((double)this.selfPosition.getX() + 0.5D, (double)this.selfPosition.getY() + 0.5D, (double)this.selfPosition.getZ() + 0.5D) <= 64.0D;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -14,6 +14,7 @@ import common.block.artificial.BlockStairs;
|
|||
import common.block.foliage.LeavesType;
|
||||
import common.block.liquid.BlockLiquid;
|
||||
import common.block.natural.BlockSnow;
|
||||
import common.block.tech.BlockAnvil;
|
||||
import common.block.tech.BlockHopper;
|
||||
import common.collect.Lists;
|
||||
import common.collect.Sets;
|
||||
|
@ -1811,7 +1812,7 @@ public abstract class World implements IWorldAccess {
|
|||
Block block = this.getState(pos).getBlock();
|
||||
BoundingBox axisalignedbb = p_175716_3_ ? null : blockIn.getCollisionBoundingBox(this, pos, blockIn.getState());
|
||||
return axisalignedbb != null && !this.checkNoEntityCollision(axisalignedbb, entityIn) ? false
|
||||
: (block.getMaterial() == Material.SMALL && blockIn == Blocks.anvil ? true
|
||||
: (block.getMaterial() == Material.SMALL && blockIn instanceof BlockAnvil ? true
|
||||
: block.getMaterial().isReplaceable() && blockIn.canReplace(this, pos, side, itemStackIn));
|
||||
}
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ import common.block.artificial.BlockDoor;
|
|||
import common.block.artificial.BlockFlowerPot;
|
||||
import common.block.foliage.BlockDoublePlant;
|
||||
import common.block.foliage.BlockFlower;
|
||||
import common.block.tech.BlockAnvil;
|
||||
import common.color.DyeColor;
|
||||
import common.init.BlockRegistry;
|
||||
import common.init.Blocks;
|
||||
|
@ -94,7 +95,9 @@ public abstract class ReorderRegistry {
|
|||
PLACE_LAST.add(Blocks.carrot);
|
||||
PLACE_LAST.add(Blocks.potato);
|
||||
PLACE_LAST.add(Blocks.wooden_button);
|
||||
PLACE_LAST.add(Blocks.anvil); // becomes relevant with asynchronous placement
|
||||
for(BlockAnvil block : BlockAnvil.ANVILS) {
|
||||
PLACE_LAST.add(block); // becomes relevant with asynchronous placement
|
||||
}
|
||||
PLACE_LAST.add(Blocks.light_weighted_pressure_plate);
|
||||
PLACE_LAST.add(Blocks.heavy_weighted_pressure_plate);
|
||||
PLACE_LAST.add(Blocks.comparator);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue