1
0
Fork 0

improve container gui

This commit is contained in:
Sen 2025-09-07 14:03:54 +02:00
parent d44352c40e
commit 5421552dde
Signed by: sen
GPG key ID: 3AC50A6F47D1B722
23 changed files with 133 additions and 190 deletions

View file

@ -608,12 +608,6 @@ public class Client implements IThreadListener {
@Variable(name = "gui_scale", category = CVarCategory.GUI, min = 1, max = 5, display = "Skalierung", unit = "x", callback = RedrawFunction.class) @Variable(name = "gui_scale", category = CVarCategory.GUI, min = 1, max = 5, display = "Skalierung", unit = "x", callback = RedrawFunction.class)
private int scaleVar = 1; private int scaleVar = 1;
@Variable(name = "gui_scale_items", category = CVarCategory.GUI, display = "Gegenstände vergrößern", callback = ItemRedrawFunction.class)
public boolean scaleItems = true;
@Variable(name = "gui_scale_items_always", category = CVarCategory.GUI, display = "Immer vergrößern", callback = ItemRedrawFunction.class)
public boolean scaleItemsAlways = false;
@Variable(name = "gui_scale_hotbar", category = CVarCategory.GUI, display = "Leiste vergrößern")
public boolean scaleHotbar = true;
@Variable(name = "hud_margin", category = CVarCategory.GUI, min = 0, max = 120, unit = "px", display = "Seitenabstand der HUD") @Variable(name = "hud_margin", category = CVarCategory.GUI, min = 0, max = 120, unit = "px", display = "Seitenabstand der HUD")
private int hudMargin = 4; private int hudMargin = 4;
@Variable(name = "phy_sensitivity", category = CVarCategory.INPUT, min = 0.01f, max = 10.0f, display = "Mausempfindlichkeit", precision = 2, unit = "%") @Variable(name = "phy_sensitivity", category = CVarCategory.INPUT, min = 0.01f, max = 10.0f, display = "Mausempfindlichkeit", precision = 2, unit = "%")
@ -1182,7 +1176,7 @@ public class Client implements IThreadListener {
public void renderHud() { public void renderHud() {
final int selected = this.world != null && this.player != null && this.viewEntity == this.player ? this.player.getSelectedIndex() : -1; final int selected = this.world != null && this.player != null && this.viewEntity == this.player ? this.player.getSelectedIndex() : -1;
final int scale = this.scaleHotbar ? 2 : 1; final int scale = 2;
final int size = this.world != null && this.player != null && this.viewEntity == this.player ? this.player.getHotbarSize() : 1; final int size = this.world != null && this.player != null && this.viewEntity == this.player ? this.player.getHotbarSize() : 1;
int total = 1; int total = 1;
if(this.world != null && this.player != null && this.viewEntity == this.player) { if(this.world != null && this.player != null && this.viewEntity == this.player) {
@ -1224,7 +1218,7 @@ public class Client implements IThreadListener {
continue; continue;
if(selected == n) if(selected == n)
Drawing.drawRect(x - scale * 2, by - scale * 2, 20 * scale, 20 * scale, 0xffffffff); Drawing.drawRect(x - scale * 2, by - scale * 2, 20 * scale, 20 * scale, 0xffffffff);
InventoryButton.drawButton(this, x - scale, by - scale, 18 * scale, 18 * scale, this.scaleHotbar); InventoryButton.drawButton(this, x - scale, by - scale, 18 * scale, 18 * scale);
x += (width >= 20 || selected == n || selected == n + 1 ? 20 : width) * scale; x += (width >= 20 || selected == n || selected == n + 1 ? 20 : width) * scale;
} }
@ -1283,7 +1277,7 @@ public class Client implements IThreadListener {
stats += 1; stats += 1;
} }
x = this.fbX - this.hudMargin - 250; x = this.fbX - this.hudMargin - 250;
y = this.fbY - this.hudMargin - 14 - (this.scaleHotbar ? 24 : 0) - stats * 40; y = this.fbY - this.hudMargin - 14 - 24 - stats * 40;
int hp = entity.getHealth(); int hp = entity.getHealth();
int max = entity.getMaxHealth(); int max = entity.getMaxHealth();
y = this.drawStat(x, y, Color.RED + "Schaden", hp, max, 0xff0000); y = this.drawStat(x, y, Color.RED + "Schaden", hp, max, 0xff0000);
@ -1316,7 +1310,7 @@ public class Client implements IThreadListener {
} }
x = this.hudMargin; x = this.hudMargin;
y = this.fbY - this.hudMargin - 14 - (this.scaleHotbar ? 24 : 0) - (this.player.isRidingHorse() && this.player.getHorseJumpPower() != 0.0f ? 2 : 1) * 40; y = this.fbY - this.hudMargin - 14 - 24 - (this.player.isRidingHorse() && this.player.getHorseJumpPower() != 0.0f ? 2 : 1) * 40;
if(this.player.isRidingHorse() && this.player.getHorseJumpPower() != 0.0f) // { if(this.player.isRidingHorse() && this.player.getHorseJumpPower() != 0.0f) // {
y = this.drawBar(x, y, String.format(Color.NEON + "Sprungkraft: " + Color.CYAN + "%d %%", (int)(this.player.getHorseJumpPower() * 100.0f)), y = this.drawBar(x, y, String.format(Color.NEON + "Sprungkraft: " + Color.CYAN + "%d %%", (int)(this.player.getHorseJumpPower() * 100.0f)),
this.player.getHorseJumpPower(), 0x4040ff); this.player.getHorseJumpPower(), 0x4040ff);
@ -1379,8 +1373,7 @@ public class Client implements IThreadListener {
ItemRenderer.enableGUIStandardItemLighting(); ItemRenderer.enableGUIStandardItemLighting();
GL15.glPushMatrix(); GL15.glPushMatrix();
GL15.glTranslatef(0.0f, (float)by, 0.0f); GL15.glTranslatef(0.0f, (float)by, 0.0f);
if(this.scaleHotbar) GL15.glScalef(2.0f, 2.0f, 2.0f);
GL15.glScalef(2.0f, 2.0f, 2.0f);
int xPos = xoff; int xPos = xoff;
int cnt = 0; int cnt = 0;
@ -1433,7 +1426,7 @@ public class Client implements IThreadListener {
if(itemstack != null && itemstack.getItem().getCategory() == this.itemSelection) { if(itemstack != null && itemstack.getItem().getCategory() == this.itemSelection) {
if(width >= 17 || index == selected) { if(width >= 17 || index == selected) {
GuiContainer.renderItemOverlay(itemstack, GuiContainer.renderItemOverlay(itemstack,
xPos, by, null, index == this.player.getSelectedIndex() ? this.controller.getUseCooldown() : 0, this.controller.getUseCooldownMax(), scale); xPos, by, null, index == this.player.getSelectedIndex() ? this.controller.getUseCooldown() : 0, this.controller.getUseCooldownMax());
} }
xPos += (width >= 20 || selected == index || selected == index + 1 ? 20 : width) * scale; xPos += (width >= 20 || selected == index || selected == index + 1 ? 20 : width) * scale;
} }

View file

@ -14,6 +14,6 @@ public class GuiChest extends GuiContainer {
} }
public void addElements() { public void addElements() {
this.label(this.block.getDisplay(), 8, 16); this.label(this.block.getDisplay(), 16, 32);
} }
} }

View file

@ -8,7 +8,6 @@ import java.util.Map.Entry;
import org.lwjgl.opengl.GL15; import org.lwjgl.opengl.GL15;
import client.Client;
import client.gui.Font; import client.gui.Font;
import client.gui.Gui; import client.gui.Gui;
import client.gui.element.ActButton; import client.gui.element.ActButton;
@ -31,7 +30,6 @@ import common.enchantment.Enchantment;
import common.entity.npc.Attribute; import common.entity.npc.Attribute;
import common.init.ItemRegistry; import common.init.ItemRegistry;
import common.inventory.Container; import common.inventory.Container;
import common.inventory.ContainerChest;
import common.inventory.Slot; import common.inventory.Slot;
import common.item.CheatTab; import common.item.CheatTab;
import common.item.ItemStack; import common.item.ItemStack;
@ -78,9 +76,6 @@ public abstract class GuiContainer extends Gui
protected int container_x; protected int container_x;
protected int container_y; protected int container_y;
protected int container_w;
protected int container_h;
protected int container_scale;
private int hover_x; private int hover_x;
private int hover_y; private int hover_y;
@ -194,43 +189,33 @@ public abstract class GuiContainer extends Gui
return list; return list;
} }
public int getScale() {
return this.container_scale;
}
public ItemStack getHoverItem(Slot slot) { public ItemStack getHoverItem(Slot slot) {
return this.gm.player != null && this.gm.player.getMouseItem() != null ? this.gm.player.getMouseItem() : (this.gm.itemCheat && this.cheatStack != null ? this.cheatStack : (Bind.CRAFT.isDown() return this.gm.player != null && this.gm.player.getMouseItem() != null ? this.gm.player.getMouseItem() : (this.gm.itemCheat && this.cheatStack != null ? this.cheatStack : (Bind.CRAFT.isDown()
&& slot.canCheatItem() && slot.getHasStack() ? this.gm.player.inventoryContainer.getSingleRecipe(slot.getStack()) : null)); && slot.canCheatItem() && slot.getHasStack() ? this.gm.player.inventoryContainer.getSingleRecipe(slot.getStack()) : null));
} }
public Label label(String text, int x, int y) { public Label label(String text, int x, int y) {
x = x * this.container_scale + this.container_x; return this.add(new FontLabel(x + this.container_x, y + this.container_y, 300, Font.LARGE, text, true));
y = y * this.container_scale + this.container_y;
return this.add(new FontLabel(x, y, 300, this.container_scale > 1 ? Font.LARGE : Font.SMALL, text, true));
} }
public DisplayLabel display(String text, int x, int y, int w, int lines) { public DisplayLabel display(String text, int x, int y, int w, int lines) {
x = x * this.container_scale + this.container_x; return this.add(new DisplayLabel(x + this.container_x, y + this.container_y, w, lines, Font.LARGE, text));
y = y * this.container_scale + this.container_y;
return this.add(new DisplayLabel(x, y, w * this.container_scale, lines, this.container_scale > 1 ? Font.LARGE : Font.TINY, text));
} }
public Bar bar(int x, int y, int w, int h) { public Bar bar(int x, int y, int w, int h) {
x = x * this.container_scale + this.container_x; return this.add(new Bar(x + this.container_x, y + this.container_y, w, h, Font.LARGE));
y = y * this.container_scale + this.container_y;
return this.add(new Bar(x, y, w * this.container_scale, h * this.container_scale, this.container_scale > 1 ? Font.LARGE : Font.TINY));
} }
public void rect(int x, int y, int width, int height, int color) { public void rect(int x, int y, int width, int height, int color) {
Drawing.drawRect(this.container_x + x * this.container_scale, this.container_y + y * this.container_scale, width * this.container_scale, height * this.container_scale, 0xff000000 | color); Drawing.drawRect(this.container_x + x, this.container_y + y, width, height, 0xff000000 | color);
} }
public void grad(int x, int y, int width, int height, int top, int bottom, int topleft, int btmright) { public void grad(int x, int y, int width, int height, int top, int bottom, int topleft, int btmright) {
Drawing.drawGradient(this.container_x + x * this.container_scale, this.container_y + y * this.container_scale, width * this.container_scale, height * this.container_scale, 0xff000000 | top, 0xff000000 | bottom, 0xff000000 | topleft, 0xff000000 | btmright); Drawing.drawGradient(this.container_x + x, this.container_y + y, width, height, 0xff000000 | top, 0xff000000 | bottom, 0xff000000 | topleft, 0xff000000 | btmright);
} }
public InventoryButton slot(int x, int y, int w, int h, Slot slot) { public InventoryButton slot(int x, int y, int w, int h, Slot slot) {
return this.add(new InventoryButton(this.container_x + x * this.container_scale, this.container_y + y * this.container_scale, w * this.container_scale, h * this.container_scale, this.container_scale > 1, slot)); return this.add(new InventoryButton(this.container_x + x, this.container_y + y, w, h, slot));
} }
public InventoryButton slot(int x, int y, int w, int h) { public InventoryButton slot(int x, int y, int w, int h) {
@ -238,51 +223,50 @@ public abstract class GuiContainer extends Gui
} }
public ActButton button(int x, int y, int w, int h, ButtonCallback callback, String text) { public ActButton button(int x, int y, int w, int h, ButtonCallback callback, String text) {
return this.add(new ActButton(this.container_x + x * this.container_scale, this.container_y + y * this.container_scale, w * this.container_scale, h * this.container_scale, callback, text)); return this.add(new ActButton(this.container_x + x, this.container_y + y, w, h, callback, text));
} }
public void mouse(Button btn, int x, int y, boolean ctrl, boolean shift) { public void mouse(Button btn, int x, int y, boolean ctrl, boolean shift) {
super.mouse(btn, x, y, ctrl, shift); super.mouse(btn, x, y, ctrl, shift);
this.mouseClicked((x - this.container_x) / this.container_scale, (y - this.container_y) / this.container_scale, btn.ordinal()); //TODO: enum this.mouseClicked(x - this.container_x, y - this.container_y, btn.ordinal()); //TODO: enum
} }
public void mouserel(Button btn, int x, int y) { public void mouserel(Button btn, int x, int y) {
super.mouserel(btn, x, y); super.mouserel(btn, x, y);
this.mouseReleased((x - this.container_x) / this.container_scale, (y - this.container_y) / this.container_scale, btn.ordinal()); //TODO: enum this.mouseReleased(x - this.container_x, y - this.container_y, btn.ordinal()); //TODO: enum
} }
public void drag(int x, int y) { public void drag(int x, int y) {
super.drag(x, y); super.drag(x, y);
if(Button.MOUSE_LEFT.isDown() || Button.MOUSE_RIGHT.isDown() || Button.MOUSE_MIDDLE.isDown()) if(Button.MOUSE_LEFT.isDown() || Button.MOUSE_RIGHT.isDown() || Button.MOUSE_MIDDLE.isDown())
this.mouseDragged((x - this.container_x) / this.container_scale, (y - this.container_y) / this.container_scale); this.mouseDragged(x - this.container_x, y - this.container_y);
} }
public GuiContainer(Container container) public GuiContainer(Container container)
{ {
this.inventorySlots = container; this.inventorySlots = container;
this.ignoreMouseUp = true; this.ignoreMouseUp = true;
this.xSize = (container.getInventoryOffsetX() - 1) * 2 + 18 * Container.INVENTORY_WIDTH; this.xSize = (container.getInventoryOffsetX() - 2) * 2 + 36 * Container.INVENTORY_WIDTH;
this.ySize = container.getInventoryOffsetY() + 26 + 18 * ((Equipment.INVENTORY_SLOTS + Container.INVENTORY_WIDTH - 1) / Container.INVENTORY_WIDTH); this.ySize = container.getInventoryOffsetY() + 52 + 36 * ((Equipment.INVENTORY_SLOTS + Container.INVENTORY_WIDTH - 1) / Container.INVENTORY_WIDTH);
} }
public void init(int width, int height) { public void init(int width, int height) {
this.itemRender = this.gm.getRenderItem(); this.itemRender = this.gm.getRenderItem();
this.tooltip = null; this.tooltip = null;
this.cheatStack = null; this.cheatStack = null;
this.container_scale = this.gm.scaleItems && (this.gm.scaleItemsAlways || (this.xSize * 2 <= Client.MIN_WIDTH && this.ySize * 2 <= Client.MIN_HEIGHT)) ? 2 : 1; this.container_x = (width - this.xSize) / 2;
this.container_x = (width - (this.container_w = (this.xSize * this.container_scale))) / 2; this.container_y = (height - this.ySize) / 2;
this.container_y = (height - (this.container_h = (this.ySize * this.container_scale))) / 2;
this.initGui(); this.initGui();
this.addButtons(); this.addButtons();
this.addElements(); this.addElements();
this.label("Inventar", this.inventorySlots.getInventoryOffsetX(), this.inventorySlots.getInventoryOffsetY() - 2); this.label("Inventar", this.inventorySlots.getInventoryOffsetX(), this.inventorySlots.getInventoryOffsetY() - 4);
this.inventoryLabel = this.label("", this.inventorySlots.getInventoryOffsetX() + 18 * Container.INVENTORY_WIDTH - 90, this.inventorySlots.getInventoryOffsetY() - 2); this.inventoryLabel = this.label("", this.inventorySlots.getInventoryOffsetX() + 36 * Container.INVENTORY_WIDTH - 180, this.inventorySlots.getInventoryOffsetY() - 4);
} }
public void hover(String text, int x, int y) { public void hover(String text, int x, int y) {
this.tooltip = text; this.tooltip = text;
this.hover_x = x * this.container_scale + this.container_x + 16; this.hover_x = x + this.container_x + 16;
this.hover_y = y * this.container_scale + this.container_y + 16; this.hover_y = y + this.container_y + 16;
} }
public String getTitle() { public String getTitle() {
@ -293,10 +277,10 @@ public abstract class GuiContainer extends Gui
{ {
this.gm.player.openContainer = this.inventorySlots; this.gm.player.openContainer = this.inventorySlots;
if(this.gm.itemCheat) { if(this.gm.itemCheat) {
this.cheatX = this.container_x + this.container_w + 4; this.cheatX = this.container_x + this.xSize + 4;
this.cheatY = 16; this.cheatY = 32;
this.cheatWidth = Math.max((this.gm.fbX - this.container_x - this.container_w - 16) / 18, 1); this.cheatWidth = Math.max((this.gm.fbX - this.container_x - this.xSize - 32) / 36, 1);
this.cheatHeight = Math.max((this.gm.fbY - 20 * ((CheatTab.values().length + (this.cheatWidth - 1)) / this.cheatWidth) - 46) / 18, 1); this.cheatHeight = Math.max((this.gm.fbY - 40 * ((CheatTab.values().length + (this.cheatWidth - 1)) / this.cheatWidth) - 92) / 36, 1);
} }
} }
@ -305,16 +289,16 @@ public abstract class GuiContainer extends Gui
for (int i1 = 0; i1 < this.inventorySlots.inventorySlots.size(); ++i1) { for (int i1 = 0; i1 < this.inventorySlots.inventorySlots.size(); ++i1) {
Slot slot = this.inventorySlots.inventorySlots.get(i1); Slot slot = this.inventorySlots.inventorySlots.get(i1);
if(slot.canDraw()) if(slot.canDraw())
this.slot(slot.xDisplayPosition - 1, slot.yDisplayPosition - 1, 18, 18, slot); this.slot(slot.xDisplayPosition - 2, slot.yDisplayPosition - 2, 36, 36, slot);
} }
} }
if(this.gm.itemCheat) { if(this.gm.itemCheat) {
this.cheatLabel = this.add(new FontLabel(this.cheatX, this.cheatY, this.cheatWidth * 18, Font.SMALL, "", true)); this.cheatLabel = this.add(new FontLabel(this.cheatX, this.cheatY, this.cheatWidth * 36, Font.SMALL, "", true));
// this.cheatDesc = this.add(new DisplayLabel(this.cheatX, this.cheatY + this.cheatHeight * 18 + 20 * ((CheatTab.values().length + (this.cheatWidth - 1)) / this.cheatWidth) + 4 + 18, this.cheatWidth * 18, 4, Font.SMALL, "Vorsicht: Schummeln\nwird mit Keule bestraft!!\n(Halte Strg beim Klick\nfür vollen Stapel)")); // this.cheatDesc = this.add(new DisplayLabel(this.cheatX, this.cheatY + this.cheatHeight * 18 + 20 * ((CheatTab.values().length + (this.cheatWidth - 1)) / this.cheatWidth) + 4 + 18, this.cheatWidth * 18, 4, Font.SMALL, "Vorsicht: Schummeln\nwird mit Keule bestraft!!\n(Halte Strg beim Klick\nfür vollen Stapel)"));
this.cheatSearch = this.add(new Field(this.cheatX, this.cheatY + this.cheatHeight * 18 + 20 * ((CheatTab.values().length + (this.cheatWidth - 1)) / this.cheatWidth) + 4, this.cheatWidth * 18 + 10, 0, 128, null, "")); this.cheatSearch = this.add(new Field(this.cheatX, this.cheatY + this.cheatHeight * 36 + 40 * ((CheatTab.values().length + (this.cheatWidth - 1)) / this.cheatWidth) + 8, this.cheatWidth * 36 + 20, 0, 128, null, ""));
this.cheatLast = ""; this.cheatLast = "";
for(CheatTab tab : CheatTab.values()) { for(CheatTab tab : CheatTab.values()) {
this.add(new InventoryButton(this.cheatX + 18 * (tab.getIndex() % this.cheatWidth), this.cheatY + this.cheatHeight * 18 + 4 + 20 * (tab.getIndex() / this.cheatWidth), 18, 18, false, null)); this.add(new InventoryButton(this.cheatX + 36 * (tab.getIndex() % this.cheatWidth), this.cheatY + this.cheatHeight * 36 + 8 + 40 * (tab.getIndex() / this.cheatWidth), 36, 36, null));
} }
this.setCurrentTab(selectedTab); this.setCurrentTab(selectedTab);
} }
@ -335,10 +319,8 @@ public abstract class GuiContainer extends Gui
} }
if(this.gm.itemCheat) { if(this.gm.itemCheat) {
GL15.glPushMatrix(); // GL15.glPushMatrix();
GL15.glTranslatef(-(float)((this.gm.fbX - this.xSize * this.container_scale) / 2) * (1.0f / (float)this.container_scale), -(float)((this.gm.fbY - this.ySize * this.container_scale) / 2) * (1.0f / (float)this.container_scale), 0.0f); // GL15.glTranslatef(-(float)((this.gm.fbX - this.xSize * SCALE) / 2) * (1.0f / (float)SCALE), -(float)((this.gm.fbY - this.ySize * SCALE) / 2) * (1.0f / (float)SCALE), 0.0f);
if(this.container_scale != 1)
GL15.glScalef(1.0f / (float)this.container_scale, 1.0f / (float)this.container_scale, 1.0f / (float)this.container_scale);
int i = (ITEM_LIST.size() + this.cheatWidth - 1) / this.cheatWidth - this.cheatHeight; int i = (ITEM_LIST.size() + this.cheatWidth - 1) / this.cheatWidth - this.cheatHeight;
int j = (int)((double)(this.currentScroll * (float)i) + 0.5D); int j = (int)((double)(this.currentScroll * (float)i) + 0.5D);
@ -357,9 +339,9 @@ public abstract class GuiContainer extends Gui
this.itemRender.zLevel = 100.0F; this.itemRender.zLevel = 100.0F;
GlState.enableDepth(); GlState.enableDepth();
this.itemRender.renderItemAndEffectIntoGUI(ITEM_LIST.get(i1), this.cheatX + 18 * l + 1, this.cheatY + k * 18 + 1); this.itemRender.renderItemAndEffectIntoGUI(ITEM_LIST.get(i1), this.cheatX + 36 * l + 2, this.cheatY + k * 36 + 2);
this.itemRender.zLevel = 0.0F; this.itemRender.zLevel = 0.0F;
if(this.isPointInRegion(this.cheatX + 18 * l + 1, this.cheatY + k * 18 + 1, 16, 16, this.gm.mouseX, this.gm.mouseY)) if(this.isPointInRegion(this.cheatX + 36 * l + 2, this.cheatY + k * 36 + 2, 32, 32, this.gm.mouseX, this.gm.mouseY))
this.renderToolTip(ITEM_LIST.get(i1), mouseX, mouseY); this.renderToolTip(ITEM_LIST.get(i1), mouseX, mouseY);
} }
} }
@ -369,7 +351,7 @@ public abstract class GuiContainer extends Gui
{ {
this.drawTab(tabs); this.drawTab(tabs);
} }
GL15.glPopMatrix(); // GL15.glPopMatrix();
} }
} }
@ -391,10 +373,10 @@ public abstract class GuiContainer extends Gui
return; return;
if(this.gm.itemCheat) { if(this.gm.itemCheat) {
boolean flag = Button.MOUSE_LEFT.isDown(); //TODO: remove? boolean flag = Button.MOUSE_LEFT.isDown(); //TODO: remove?
int x1 = this.cheatX + this.cheatWidth * 18 + 2; int x1 = this.cheatX + this.cheatWidth * 36 + 4;
int y1 = this.cheatY; int y1 = this.cheatY;
int x2 = x1 + 8; int x2 = x1 + 16;
int y2 = y1 + this.cheatHeight * 18; int y2 = y1 + this.cheatHeight * 36;
if (!this.wasClicking && flag && this.gm.mouseX >= x1 && this.gm.mouseY >= y1 && this.gm.mouseX < x2 && this.gm.mouseY < y2) if (!this.wasClicking && flag && this.gm.mouseX >= x1 && this.gm.mouseY >= y1 && this.gm.mouseX < x2 && this.gm.mouseY < y2)
{ {
@ -410,7 +392,7 @@ public abstract class GuiContainer extends Gui
if (this.isScrolling) if (this.isScrolling)
{ {
this.currentScroll = ((float)(this.gm.mouseY - y1) - 7.5F) / ((float)(y2 - y1) - 15.0F); this.currentScroll = ((float)(this.gm.mouseY - y1) - 15.0F) / ((float)(y2 - y1) - 30.0F);
this.currentScroll = ExtMath.clampf(this.currentScroll, 0.0F, 1.0F); this.currentScroll = ExtMath.clampf(this.currentScroll, 0.0F, 1.0F);
} }
} }
@ -439,8 +421,8 @@ public abstract class GuiContainer extends Gui
if (stack != null) if (stack != null)
{ {
int j2 = 8; int j2 = 16;
int k2 = 8; int k2 = 16;
String s = null; String s = null;
if(stack == this.cheatStack) { if(stack == this.cheatStack) {
@ -482,7 +464,7 @@ public abstract class GuiContainer extends Gui
{ {
GL15.glTranslatef(0.0F, 0.0F, 32.0F); GL15.glTranslatef(0.0F, 0.0F, 32.0F);
this.itemRender.zLevel = 200.0F; this.itemRender.zLevel = 200.0F;
this.itemRender.renderItemAndEffectIntoGUI(stack, x, y); this.itemRender.renderItemAndEffectIntoGUI(stack, this.container_x + x, this.container_y + y);
this.drawnOverlays.add(new Overlay(stack, x, y, altText)); this.drawnOverlays.add(new Overlay(stack, x, y, altText));
this.itemRender.zLevel = 0.0F; this.itemRender.zLevel = 0.0F;
} }
@ -503,13 +485,13 @@ public abstract class GuiContainer extends Gui
super.draw(); super.draw();
if(this.gm.itemCheat) { if(this.gm.itemCheat) {
if(this.needsScrollBars()) { if(this.needsScrollBars()) {
int x1 = this.cheatX + this.cheatWidth * 18 + 2; int x1 = this.cheatX + this.cheatWidth * 36 + 4;
int y1 = this.cheatY; int y1 = this.cheatY;
int y2 = y1 + this.cheatHeight * 18; int y2 = y1 + this.cheatHeight * 36;
Drawing.drawRect(x1, y1, 8, this.cheatHeight * 18, 0xff000000); Drawing.drawRect(x1, y1, 16, this.cheatHeight * 36, 0xff000000);
Drawing.drawGradient(x1, y1 + (int)((float)(y2 - y1 - 15) * this.currentScroll), 8, 15, this.gm.style.fill_top, this.gm.style.fill_btm, this.gm.style.brdr_top, this.gm.style.brdr_btm); Drawing.drawGradient(x1, y1 + (int)((float)(y2 - y1 - 30) * this.currentScroll), 16, 30, this.gm.style.fill_top, this.gm.style.fill_btm, this.gm.style.brdr_top, this.gm.style.brdr_btm);
} }
Drawing.drawRect(this.cheatX + 18 * (selectedTab.getIndex() % this.cheatWidth), this.cheatY + this.cheatHeight * 18 + 4 + 20 * (selectedTab.getIndex() / this.cheatWidth) - 2, 18, 2, 0xffffffff); Drawing.drawRect(this.cheatX + 36 * (selectedTab.getIndex() % this.cheatWidth), this.cheatY + this.cheatHeight * 36 + 8 + 40 * (selectedTab.getIndex() / this.cheatWidth) - 4, 36, 4, 0xffffffff);
} }
if(Bind.isWindowActive()) if(Bind.isWindowActive())
super.drawOverlay(); super.drawOverlay();
@ -520,10 +502,9 @@ public abstract class GuiContainer extends Gui
public void drawPost() { public void drawPost() {
GL15.glPushMatrix(); GL15.glPushMatrix();
GL15.glTranslatef((float)((this.gm.fbX - this.xSize * this.container_scale) / 2), (float)((this.gm.fbY - this.ySize * this.container_scale) / 2), 0.0f); // GL15.glTranslatef((float)((this.gm.fbX - this.xSize * SCALE) / 2), (float)((this.gm.fbY - this.ySize * SCALE) / 2), 0.0f);
if(this.container_scale != 1) // GL15.glScalef(2.0f, 2.0f, 2.0f);
GL15.glScalef((float)this.container_scale, (float)this.container_scale, (float)this.container_scale); this.drawScreen(this.gm.mouseX - this.container_x, this.gm.mouseY - this.container_y);
this.drawScreen((this.gm.mouseX - this.container_x) / this.container_scale, (this.gm.mouseY - this.container_y) / this.container_scale);
GL15.glPopMatrix(); GL15.glPopMatrix();
ItemRenderer.disableStandardItemLighting(); ItemRenderer.disableStandardItemLighting();
} }
@ -540,7 +521,7 @@ public abstract class GuiContainer extends Gui
this.itemRender.zLevel = 100.0F; this.itemRender.zLevel = 100.0F;
GlState.enableDepth(); GlState.enableDepth();
this.itemRender.renderItemAndEffectIntoGUI(itemstack, i, j); this.itemRender.renderItemAndEffectIntoGUI(itemstack, this.container_x + i, this.container_y + j);
this.drawnOverlays.add(new Overlay(itemstack, i, j, s)); this.drawnOverlays.add(new Overlay(itemstack, i, j, s));
this.itemRender.zLevel = 0.0F; this.itemRender.zLevel = 0.0F;
@ -594,7 +575,7 @@ public abstract class GuiContainer extends Gui
return; return;
} }
long i = System.currentTimeMillis(); long i = System.currentTimeMillis();
this.doubleClick = this.lastClickSlot == slot && i - this.lastClickTime < 250L && this.lastClickButton == mouseButton; this.doubleClick = this.lastClickSlot == slot && i - this.lastClickTime < (long)this.gm.dclickDelay && this.lastClickButton == mouseButton;
this.ignoreMouseUp = false; this.ignoreMouseUp = false;
if (mouseButton == 0 || mouseButton == 1) if (mouseButton == 0 || mouseButton == 1)
@ -719,7 +700,7 @@ public abstract class GuiContainer extends Gui
private boolean isMouseOverSlot(Slot slotIn, int mouseX, int mouseY) private boolean isMouseOverSlot(Slot slotIn, int mouseX, int mouseY)
{ {
return this.isPointInRegion(slotIn.xDisplayPosition, slotIn.yDisplayPosition, 16, 16, mouseX, mouseY); return this.isPointInRegion(slotIn.xDisplayPosition, slotIn.yDisplayPosition, 32, 32, mouseX, mouseY);
} }
protected boolean isPointInRegion(int left, int top, int right, int bottom, int pointX, int pointY) protected boolean isPointInRegion(int left, int top, int right, int bottom, int pointX, int pointY)
@ -785,10 +766,10 @@ public abstract class GuiContainer extends Gui
public void renderItemOverlayIntoGUI(ItemStack stack, int xPosition, int yPosition, String text) public void renderItemOverlayIntoGUI(ItemStack stack, int xPosition, int yPosition, String text)
{ {
renderItemOverlay(stack, this.container_x + xPosition * this.container_scale, this.container_y + yPosition * this.container_scale, text, 0, 0, this.container_scale); renderItemOverlay(stack, this.container_x + xPosition, this.container_y + yPosition, text, 0, 0);
} }
public static void renderItemOverlay(ItemStack stack, int xPosition, int yPosition, String text, int bar2, int bar2max, int scale) public static void renderItemOverlay(ItemStack stack, int xPosition, int yPosition, String text, int bar2, int bar2max)
{ {
if (stack != null) if (stack != null)
{ {
@ -800,27 +781,27 @@ public abstract class GuiContainer extends Gui
{ {
s = Color.RED + formatAmount(stack.getSize()); s = Color.RED + formatAmount(stack.getSize());
} }
Font.set(scale > 1 ? Font.SMALL : Font.TINY); Font.set(Font.SMALL);
Drawing.drawTextRight(s, xPosition + scale * 16, yPosition + scale * 16 + 1 - Font.HEIGHT, 0xffffffff); Drawing.drawTextRight(s, xPosition + 32, yPosition + 32 + 1 - Font.HEIGHT, 0xffffffff);
Font.unset(); Font.unset();
} }
if (stack.isItemDamaged()) if (stack.isItemDamaged())
{ {
int j = (int)Math.round(14.0D * (double)scale - (double)stack.getItemDamage() * (14.0D * (double)scale) / (double)stack.getMaxDamage()); int j = (int)Math.round(28.0D - (double)stack.getItemDamage() * 28.0D / (double)stack.getMaxDamage());
int i = (int)Math.round(255.0D - (double)stack.getItemDamage() * 255.0D / (double)stack.getMaxDamage()); int i = (int)Math.round(255.0D - (double)stack.getItemDamage() * 255.0D / (double)stack.getMaxDamage());
draw(xPosition + scale, yPosition + 13 * scale, 14 * scale, scale * 2, 0, 0, 0); draw(xPosition + 2, yPosition + 26, 28, 4, 0, 0, 0);
draw(xPosition + scale, yPosition + 13 * scale, 13 * scale, scale, (255 - i) / 4, 64, 0); draw(xPosition + 2, yPosition + 26, 26, 2, (255 - i) / 4, 64, 0);
draw(xPosition + scale, yPosition + 13 * scale, j, scale, 255 - i, i, 0); draw(xPosition + 2, yPosition + 26, j, 2, 255 - i, i, 0);
} }
if (bar2 > 0) if (bar2 > 0)
{ {
int j = (int)Math.round(14.0D * (double)scale - (double)bar2 * (14.0D * (double)scale) / (double)bar2max); int j = (int)Math.round(28.0D - (double)bar2 * 28.0D / (double)bar2max);
int i = (int)Math.round(255.0D - (double)bar2 * 255.0D / (double)bar2max); int i = (int)Math.round(255.0D - (double)bar2 * 255.0D / (double)bar2max);
draw(xPosition + scale, yPosition + scale * 2, 14 * scale, scale * 2, 0, 0, 0); draw(xPosition + 2, yPosition + 4, 28, 4, 0, 0, 0);
draw(xPosition + scale, yPosition + scale * 2, 13 * scale, scale, (255 - i) / 8, (255 - i) / 16, i / 4); draw(xPosition + 2, yPosition + 4, 26, 2, (255 - i) / 8, (255 - i) / 16, i / 4);
draw(xPosition + scale + 14 * scale - j, yPosition + scale * 2, j, scale, (255 - i) / 2, (255 - i) / 4, i); draw(xPosition + 2 + 28 - j, yPosition + 4, j, 2, (255 - i) / 2, (255 - i) / 4, i);
} }
} }
} }
@ -831,19 +812,19 @@ public abstract class GuiContainer extends Gui
} }
public void drawBackground() { public void drawBackground() {
Drawing.drawGradientBorder(this.container_x, this.container_y, this.container_w, this.container_h, Util.mulColor(this.gm.style.fill_top, 0.8f), Util.mulColor(this.gm.style.fill_btm, 0.8f), 0xff000000, Util.mulColor(this.gm.style.brdr_top, 0.8f), Util.mulColor(this.gm.style.brdr_btm, 0.8f)); Drawing.drawGradientBorder(this.container_x, this.container_y, this.xSize, this.ySize, Util.mulColor(this.gm.style.fill_top, 0.8f), Util.mulColor(this.gm.style.fill_btm, 0.8f), 0xff000000, Util.mulColor(this.gm.style.brdr_top, 0.8f), Util.mulColor(this.gm.style.brdr_btm, 0.8f));
} }
protected boolean isInsideTab(CheatTab tab, int x, int y) protected boolean isInsideTab(CheatTab tab, int x, int y)
{ {
return x >= this.cheatX + 18 * (tab.getIndex() % this.cheatWidth) && x < this.cheatX + 18 * (tab.getIndex() % this.cheatWidth) + 18 && return x >= this.cheatX + 36 * (tab.getIndex() % this.cheatWidth) && x < this.cheatX + 36 * (tab.getIndex() % this.cheatWidth) + 36 &&
y >= this.cheatY + this.cheatHeight * 18 + 4 + 20 * (tab.getIndex() / this.cheatWidth) && y < this.cheatY + this.cheatHeight * 18 + 4 + 20 * (tab.getIndex() / this.cheatWidth) + 18; y >= this.cheatY + this.cheatHeight * 36 + 8 + 40 * (tab.getIndex() / this.cheatWidth) && y < this.cheatY + this.cheatHeight * 36 + 8 + 40 * (tab.getIndex() / this.cheatWidth) + 36;
} }
private boolean renderInventoryHoveringText(CheatTab tab, int x, int z) private boolean renderInventoryHoveringText(CheatTab tab, int x, int z)
{ {
if (this.isPointInRegion(this.cheatX + 18 * (tab.getIndex() % this.cheatWidth), this.cheatY + this.cheatHeight * 18 + 4 + 20 * (tab.getIndex() / this.cheatWidth), 18, 18, this.gm.mouseX, this.gm.mouseY)) if (this.isPointInRegion(this.cheatX + 36 * (tab.getIndex() % this.cheatWidth), this.cheatY + this.cheatHeight * 36 + 8 + 40 * (tab.getIndex() / this.cheatWidth), 36, 36, this.gm.mouseX, this.gm.mouseY))
{ {
this.hover(tab.getName(), x, z); this.hover(tab.getName(), x, z);
return true; return true;
@ -859,7 +840,7 @@ public abstract class GuiContainer extends Gui
this.itemRender.zLevel = 100.0F; this.itemRender.zLevel = 100.0F;
ItemStack itemstack = tab.getIcon(); ItemStack itemstack = tab.getIcon();
GlState.enableDepth(); GlState.enableDepth();
this.itemRender.renderItemAndEffectIntoGUI(itemstack, this.cheatX + 18 * (tab.getIndex() % this.cheatWidth) + 1, this.cheatY + this.cheatHeight * 18 + 4 + 20 * (tab.getIndex() / this.cheatWidth) + 1); this.itemRender.renderItemAndEffectIntoGUI(itemstack, this.cheatX + 36 * (tab.getIndex() % this.cheatWidth) + 2, this.cheatY + this.cheatHeight * 36 + 8 + 40 * (tab.getIndex() / this.cheatWidth) + 2);
this.itemRender.zLevel = 0.0F; this.itemRender.zLevel = 0.0F;
} }
@ -900,7 +881,7 @@ public abstract class GuiContainer extends Gui
} }
private boolean clickSide(int mouseX, int mouseY, int slot, boolean instant, boolean full) { private boolean clickSide(int mouseX, int mouseY, int slot, boolean instant, boolean full) {
if(this.gm.itemCheat && this.isPointInRegion(this.cheatX, this.cheatY, 18 * this.cheatWidth, 18 * this.cheatHeight, mouseX, mouseY) && this.gm.player != null && this.gm.player.getMouseItem() == null && this.cheatStack == null) { if(this.gm.itemCheat && this.isPointInRegion(this.cheatX, this.cheatY, 36 * this.cheatWidth, 36 * this.cheatHeight, mouseX, mouseY) && this.gm.player != null && this.gm.player.getMouseItem() == null && this.cheatStack == null) {
int size = (ITEM_LIST.size() + this.cheatWidth - 1) / this.cheatWidth - this.cheatHeight; int size = (ITEM_LIST.size() + this.cheatWidth - 1) / this.cheatWidth - this.cheatHeight;
int off = (int)((double)(this.currentScroll * (float)size) + 0.5D); int off = (int)((double)(this.currentScroll * (float)size) + 0.5D);
@ -909,8 +890,8 @@ public abstract class GuiContainer extends Gui
off = 0; off = 0;
} }
int sx = (mouseX - this.cheatX) / 18; int sx = (mouseX - this.cheatX) / 36;
int sy = (mouseY - this.cheatY) / 18; int sy = (mouseY - this.cheatY) / 36;
int idx = sx + (sy + off) * this.cheatWidth; int idx = sx + (sy + off) * this.cheatWidth;
if(idx >= 0 && idx < ITEM_LIST.size()) { if(idx >= 0 && idx < ITEM_LIST.size()) {

View file

@ -15,6 +15,6 @@ public class GuiCrafting extends GuiContainer {
} }
public void addElements() { public void addElements() {
this.label(this.type.getDisplay(), 8, 16); this.label(this.type.getDisplay(), 16, 32);
} }
} }

View file

@ -47,13 +47,13 @@ public class GuiDevice extends GuiContainer {
} }
public void addElements() { public void addElements() {
this.header = this.label("", 8, 16); this.header = this.label("", 16, 32);
this.desc = this.display("", 8, 18, 160, 4); this.desc = this.display("", 16, 36, 320, 4);
this.progress = this.tile.hasProgress() ? this.bar(7, 70, 162, 9) : null; this.progress = this.tile.hasProgress() ? this.bar(14, 140, 324, 18) : null;
this.temperature = this.tile.hasTemperature() ? this.bar(7, this.progress == null ? 70 : 60, 162, 9) : null; this.temperature = this.tile.hasTemperature() ? this.bar(14, this.progress == null ? 140 : 120, 324, 18) : null;
this.resources = new Bar[this.tile.getNumResources()]; this.resources = new Bar[this.tile.getNumResources()];
for(int z = 0; z < this.resources.length; z++) { for(int z = 0; z < this.resources.length; z++) {
this.resources[z] = this.bar(7, 80 - (this.resources.length + (this.progress == null ? 0 : 1) + (this.temperature == null ? 0 : 1)) * 10 + z * 10, 162, 9); this.resources[z] = this.bar(14, 160 - (this.resources.length + (this.progress == null ? 0 : 1) + (this.temperature == null ? 0 : 1)) * 20 + z * 20, 324, 18);
} }
} }
} }

View file

@ -59,12 +59,12 @@ public class GuiEnchant extends GuiContainer implements ButtonCallback {
} }
public void addElements() { public void addElements() {
this.label(Blocks.enchanting_table.getDisplay(), 8, 16); this.label(Blocks.enchanting_table.getDisplay(), 16, 32);
for(int l = 0; l < 3; ++l) { for(int l = 0; l < 3; ++l) {
int i1 = 60; int i1 = 120;
int j1 = i1 + 2; int j1 = i1 + 4;
this.labels[l] = this.label("", j1, 26 + 19 * l); this.labels[l] = this.label("", j1, 52 + 38 * l);
this.mana[l] = this.label("", j1, 26 + 19 * l + 7); this.mana[l] = this.label("", j1, 52 + 38 * l + 14);
} }
} }
@ -78,7 +78,7 @@ public class GuiEnchant extends GuiContainer implements ButtonCallback {
public void addButtons() { public void addButtons() {
super.addButtons(); super.addButtons();
for(int l = 0; l < 3; ++l) { for(int l = 0; l < 3; ++l) {
this.buttons[l] = this.button(60, 14 + 19 * l, 108, 19, this, ""); this.buttons[l] = this.button(120, 28 + 38 * l, 216, 38, this, "");
} }
} }

View file

@ -14,6 +14,6 @@ public class GuiEntity extends GuiContainer {
} }
public void addElements() { public void addElements() {
this.label(this.title, 8, 16); this.label(this.title, 16, 32);
} }
} }

View file

@ -30,17 +30,17 @@ public class GuiMerchant extends GuiContainer implements ButtonCallback {
public void addButtons() { public void addButtons() {
super.addButtons(); super.addButtons();
this.nextBtn = this.button(120 + 27, 24, 12, 16, this, ">"); this.nextBtn = this.button(240 + 54, 48, 24, 32, this, ">");
this.prevBtn = this.button(36 - 19, 24, 12, 16, this, "<"); this.prevBtn = this.button(72 - 38, 48, 24, 32, this, "<");
this.slot(36 - 1, 24 - 1, 18, 18); this.slot(72 - 2, 48 - 2, 36, 36);
this.slot(62 - 1, 24 - 1, 18, 18); this.slot(124 - 2, 48 - 2, 36, 36);
this.slot(120 - 1, 24 - 1, 18, 18); this.slot(240 - 2, 48 - 2, 36, 36);
this.nextBtn.enabled = false; this.nextBtn.enabled = false;
this.prevBtn.enabled = false; this.prevBtn.enabled = false;
} }
public void addElements() { public void addElements() {
this.label(this.title, 8, 16); this.label(this.title, 16, 32);
} }
public void drawOverlays() { public void drawOverlays() {

View file

@ -30,7 +30,7 @@ public class GuiRepair extends GuiContainer {
} }
public void addElements() { public void addElements() {
this.label("Amboss", 8, 16); this.label("Amboss", 16, 32);
this.info = this.label("", 60, 77); this.info = this.label("", 120, 154);
} }
} }

View file

@ -8,41 +8,33 @@ import common.inventory.Slot;
import common.item.ItemStack; import common.item.ItemStack;
public class InventoryButton extends Element { public class InventoryButton extends Element {
private final boolean bordered;
private final Slot slot; private final Slot slot;
private final String texture; private final String texture;
private final boolean background; private final boolean background;
private final int bgW; private final int bgW;
private final int bgH; private final int bgH;
public InventoryButton(int x, int y, int w, int h, boolean bordered, Slot slot) { public InventoryButton(int x, int y, int w, int h, Slot slot) {
super(x, y, w, h, null); super(x, y, w, h, null);
this.bordered = bordered;
this.texture = slot == null || slot.getTexture() == null || slot.getTexture().isEmpty() ? null : "textures/items/icon_" + slot.getTexture() + ".png"; this.texture = slot == null || slot.getTexture() == null || slot.getTexture().isEmpty() ? null : "textures/items/icon_" + slot.getTexture() + ".png";
this.background = slot == null || slot.getTexture() != null; this.background = slot == null || slot.getTexture() != null;
this.slot = slot; this.slot = slot;
int scale = this.bordered ? 2 : 1; this.bgW = slot == null ? w : slot.getBackgroundWidth() * 36;
this.bgW = slot == null ? w : slot.getBackgroundWidth() * 18 * scale; this.bgH = slot == null ? h : slot.getBackgroundHeight() * 36;
this.bgH = slot == null ? h : slot.getBackgroundHeight() * 18 * scale;
} }
protected void drawBackground() { protected void drawBackground() {
if(this.background) if(this.background)
drawButton(this.gm, this.pos_x, this.pos_y, this.bgW, this.bgH, this.bordered); drawButton(this.gm, this.pos_x, this.pos_y, this.bgW, this.bgH);
if(this.texture != null && !this.slot.getHasStack()) { if(this.texture != null && !this.slot.getHasStack())
int scale = this.bordered ? 2 : 1; Drawing.drawTexturedRect(this.gm, this.texture, 32, 32, this.pos_x + 2, this.pos_y + 2, 0, 0, this.size_x - 4, this.size_y - 4);
Drawing.drawTexturedRect(this.gm, this.texture, 16 * scale, 16 * scale, this.pos_x + scale, this.pos_y + scale, 0, 0, this.size_x - scale * 2, this.size_y - scale * 2);
}
} }
protected void drawForeground(int x1, int y1, int x2, int y2) { protected void drawForeground(int x1, int y1, int x2, int y2) {
} }
public static void drawButton(Client gm, int x, int y, int w, int h, boolean border) { public static void drawButton(Client gm, int x, int y, int w, int h) {
if(border) Drawing.drawGradientBorder(x, y, w, h, gm.style.fill_top, gm.style.fill_btm, 0xff000000, gm.style.brdr_top, gm.style.brdr_btm);
Drawing.drawGradientBorder(x, y, w, h, gm.style.fill_top, gm.style.fill_btm, 0xff000000, gm.style.brdr_top, gm.style.brdr_btm);
else
Drawing.drawGradient(x, y, w, h, gm.style.fill_top, gm.style.fill_btm, gm.style.brdr_top, gm.style.brdr_btm);
} }
public boolean canHover() { public boolean canHover() {
@ -53,8 +45,7 @@ public class InventoryButton extends Element {
} }
public void drawHover() { public void drawHover() {
int scale = this.bordered ? 2 : 1; Drawing.drawRect(this.pos_x + 2, this.pos_y + 2, 32, 32, Gui.HOVER_COLOR);
Drawing.drawRect(this.pos_x + scale, this.pos_y + scale, 16 * scale, 16 * scale, Gui.HOVER_COLOR);
} }
public boolean canClick() { public boolean canClick() {

View file

@ -26,7 +26,6 @@ public class GuiDisplay extends GuiOptions {
this.addSelector("crosshair_color_target", H_SHIFT, y, 0, 0); this.addSelector("crosshair_color_target", H_SHIFT, y, 0, 0);
this.addSelector("hud_margin", 0, y += BASE_SHIFT, 0, 0); this.addSelector("hud_margin", 0, y += BASE_SHIFT, 0, 0);
this.addSelector("gui_scale_hotbar", H_SHIFT, y, 0, 0);
super.init(width, height); super.init(width, height);
} }

View file

@ -76,9 +76,6 @@ public class GuiStyle extends GuiOptions {
this.addSelector("gui_scale", 0, y += BASE_SHIFT, 0, 0); this.addSelector("gui_scale", 0, y += BASE_SHIFT, 0, 0);
this.addSelector("gui_font", H_SHIFT, y, 0, 0); this.addSelector("gui_font", H_SHIFT, y, 0, 0);
this.addSelector("gui_scale_items", 0, y += BASE_SHIFT, 0, 0);
this.addSelector("gui_scale_items_always", H_SHIFT, y, 0, 0);
super.init(width, height); super.init(width, height);
} }

View file

@ -334,20 +334,20 @@ public class RenderItem
private void setupGuiTransform(int xPosition, int yPosition, boolean isGui3d) private void setupGuiTransform(int xPosition, int yPosition, boolean isGui3d)
{ {
GL15.glTranslatef((float)xPosition, (float)yPosition, 100.0F + this.zLevel); GL15.glTranslatef((float)xPosition, (float)yPosition, 100.0F + this.zLevel);
GL15.glTranslatef(8.0F, 8.0F, 0.0F); GL15.glTranslatef(16.0F, 16.0F, 0.0F);
GL15.glScalef(1.0F, 1.0F, -1.0F); GL15.glScalef(1.0F, 1.0F, -1.0F);
GL15.glScalef(0.5F, 0.5F, 0.5F); GL15.glScalef(0.5F, 0.5F, 0.5F);
if (isGui3d) if (isGui3d)
{ {
GL15.glScalef(40.0F, 40.0F, 40.0F); GL15.glScalef(80.0F, 80.0F, 80.0F);
GL15.glRotatef(210.0F, 1.0F, 0.0F, 0.0F); GL15.glRotatef(210.0F, 1.0F, 0.0F, 0.0F);
GL15.glRotatef(-135.0F, 0.0F, 1.0F, 0.0F); GL15.glRotatef(-135.0F, 0.0F, 1.0F, 0.0F);
GlState.enableLighting(); GlState.enableLighting();
} }
else else
{ {
GL15.glScalef(64.0F, 64.0F, 64.0F); GL15.glScalef(128.0F, 128.0F, 128.0F);
GL15.glRotatef(180.0F, 1.0F, 0.0F, 0.0F); GL15.glRotatef(180.0F, 1.0F, 0.0F, 0.0F);
GlState.disableLighting(); GlState.disableLighting();
} }

View file

@ -25,11 +25,11 @@ public abstract class Container
private Set<EntityNPC> playerList = Sets.<EntityNPC>newHashSet(); private Set<EntityNPC> playerList = Sets.<EntityNPC>newHashSet();
public int getInventoryOffsetX() { public int getInventoryOffsetX() {
return 8; return 16;
} }
public int getInventoryOffsetY() { public int getInventoryOffsetY() {
return 84; return 168;
} }
public final int getPlayerInventoryOffset() { public final int getPlayerInventoryOffset() {
@ -41,7 +41,7 @@ public abstract class Container
int y = this.getInventoryOffsetY(); int y = this.getInventoryOffsetY();
for(Equipment slot : Equipment.ARMOR) { for(Equipment slot : Equipment.ARMOR) {
final Equipment type = slot; final Equipment type = slot;
this.addSlotToContainer(new Slot(player, Equipment.INVENTORY_SLOTS + slot.getIndex(), x + slot.getIndex() * 18, y) { this.addSlotToContainer(new Slot(player, Equipment.INVENTORY_SLOTS + slot.getIndex(), x + slot.getIndex() * 36, y) {
public boolean canStackItems() { public boolean canStackItems() {
return false; return false;
} }
@ -62,7 +62,7 @@ public abstract class Container
this.offset = this.inventorySlots.size(); this.offset = this.inventorySlots.size();
List<SlotCommon> list = Lists.newArrayList(); List<SlotCommon> list = Lists.newArrayList();
for(int z = 0; z < Equipment.INVENTORY_SLOTS; ++z) { for(int z = 0; z < Equipment.INVENTORY_SLOTS; ++z) {
this.addSlotToContainer(new SlotCommon(list, player, z, x + (z % INVENTORY_WIDTH) * 18, y + 20 + (z / INVENTORY_WIDTH) * 18)); this.addSlotToContainer(new SlotCommon(list, player, z, x + (z % INVENTORY_WIDTH) * 36, y + 40 + (z / INVENTORY_WIDTH) * 36));
} }
} }

View file

@ -28,7 +28,7 @@ public class ContainerChest extends Container
{ {
for (int k = 0; k < this.width; ++k) for (int k = 0; k < this.width; ++k)
{ {
this.addSlotToContainer(new SlotCommon(list, chest, k + j * this.width, 8 + k * 18, 18 + j * 18)); this.addSlotToContainer(new SlotCommon(list, chest, k + j * this.width, 16 + k * 36, 36 + j * 36));
} }
} }
@ -36,11 +36,11 @@ public class ContainerChest extends Container
} }
public int getInventoryOffsetX() { public int getInventoryOffsetX() {
return 8 + (this.width < INVENTORY_WIDTH ? 0 : (this.width - INVENTORY_WIDTH) * 18 / 2); return super.getInventoryOffsetX() + (this.width < INVENTORY_WIDTH ? 0 : (this.width - INVENTORY_WIDTH) * 36 / 2);
} }
public int getInventoryOffsetY() { public int getInventoryOffsetY() {
return 85 + (this.height - 3) * 18; return 170 + (this.height - 3) * 36;
} }
protected boolean canMergeStacks() { protected boolean canMergeStacks() {

View file

@ -2,7 +2,6 @@ package common.inventory;
import java.util.List; import java.util.List;
import common.collect.Lists;
import common.enchantment.Enchantment; import common.enchantment.Enchantment;
import common.enchantment.EnchantmentHelper; import common.enchantment.EnchantmentHelper;
import common.enchantment.RngEnchantment; import common.enchantment.RngEnchantment;
@ -13,7 +12,6 @@ import common.item.ItemStack;
import common.item.material.ItemEnchantedBook; import common.item.material.ItemEnchantedBook;
import common.network.IPlayer; import common.network.IPlayer;
import common.rng.Random; import common.rng.Random;
import common.util.Equipment;
import common.util.LocalPos; import common.util.LocalPos;
import common.util.Pair; import common.util.Pair;
import common.world.World; import common.world.World;
@ -49,7 +47,7 @@ public class ContainerEnchantment extends Container
this.world = worldIn; this.world = worldIn;
this.position = pos; this.position = pos;
this.seed = playerInv.getEnchSeed(); this.seed = playerInv.getEnchSeed();
this.addSlotToContainer(new Slot(this.table, 0, 25, 47) this.addSlotToContainer(new Slot(this.table, 0, 50, 94)
{ {
public boolean isItemValid(ItemStack stack) public boolean isItemValid(ItemStack stack)
{ {

View file

@ -8,7 +8,6 @@ import common.entity.animal.EntityHorse;
import common.entity.npc.EntityNPC; import common.entity.npc.EntityNPC;
import common.init.Items; import common.init.Items;
import common.item.ItemStack; import common.item.ItemStack;
import common.util.Equipment;
public class ContainerEntityInventory extends Container public class ContainerEntityInventory extends Container
{ {
@ -21,14 +20,14 @@ public class ContainerEntityInventory extends Container
this.entity = entity; this.entity = entity;
if(this.entity instanceof EntityHorse) { if(this.entity instanceof EntityHorse) {
final EntityHorse horse = (EntityHorse)this.entity; final EntityHorse horse = (EntityHorse)this.entity;
this.addSlotToContainer(new Slot(entityInv, 0, 8, 18) this.addSlotToContainer(new Slot(entityInv, 0, 16, 36)
{ {
public boolean isItemValid(ItemStack stack) public boolean isItemValid(ItemStack stack)
{ {
return super.isItemValid(stack) && stack.getItem() == Items.saddle && !this.getHasStack(); return super.isItemValid(stack) && stack.getItem() == Items.saddle && !this.getHasStack();
} }
}); });
this.addSlotToContainer(new Slot(entityInv, 1, 8, 36) this.addSlotToContainer(new Slot(entityInv, 1, 16, 72)
{ {
public boolean isItemValid(ItemStack stack) public boolean isItemValid(ItemStack stack)
{ {
@ -46,7 +45,7 @@ public class ContainerEntityInventory extends Container
{ {
for (int l = 0; l < 5; ++l) for (int l = 0; l < 5; ++l)
{ {
this.addSlotToContainer(new SlotCommon(list, entityInv, 2 + l + k * 5, 80 + l * 18, 18 + k * 18)); this.addSlotToContainer(new SlotCommon(list, entityInv, 2 + l + k * 5, 160 + l * 36, 36 + k * 36));
} }
} }
} }

View file

@ -1,12 +1,8 @@
package common.inventory; package common.inventory;
import java.util.List;
import common.collect.Lists;
import common.entity.npc.EntityNPC; import common.entity.npc.EntityNPC;
import common.item.ItemStack; import common.item.ItemStack;
import common.network.IPlayer; import common.network.IPlayer;
import common.util.Equipment;
import common.village.MerchantRecipe; import common.village.MerchantRecipe;
import common.world.World; import common.world.World;
@ -138,17 +134,17 @@ public class ContainerMerchant extends Container
this.theMerchant = merchant; this.theMerchant = merchant;
this.theWorld = worldIn; this.theWorld = worldIn;
this.merchantInventory = new InventoryMerchant(playerInventory, merchant); this.merchantInventory = new InventoryMerchant(playerInventory, merchant);
this.addSlotToContainer(new Slot(this.merchantInventory, 0, 36, 53) { this.addSlotToContainer(new Slot(this.merchantInventory, 0, 72, 106) {
public boolean canEditItem() { public boolean canEditItem() {
return false; return false;
} }
}); });
this.addSlotToContainer(new Slot(this.merchantInventory, 1, 62, 53) { this.addSlotToContainer(new Slot(this.merchantInventory, 1, 124, 106) {
public boolean canEditItem() { public boolean canEditItem() {
return false; return false;
} }
}); });
this.addSlotToContainer(new SlotMerchantResult(playerInventory, this.merchantInventory, 2, 120, 53)); this.addSlotToContainer(new SlotMerchantResult(playerInventory, this.merchantInventory, 2, 240, 106));
this.addPlayerSlots(playerInventory); this.addPlayerSlots(playerInventory);
} }

View file

@ -11,7 +11,7 @@ public class ContainerPlayer extends Container {
} }
public int getInventoryOffsetY() { public int getInventoryOffsetY() {
return 16; return 32;
} }
public ItemStack getSingleRecipe(ItemStack stack) { public ItemStack getSingleRecipe(ItemStack stack) {

View file

@ -1,18 +1,15 @@
package common.inventory; package common.inventory;
import java.util.Iterator; import java.util.Iterator;
import java.util.List;
import java.util.Map; import java.util.Map;
import common.block.tech.BlockAnvil; import common.block.tech.BlockAnvil;
import common.collect.Lists;
import common.enchantment.Enchantment; import common.enchantment.Enchantment;
import common.enchantment.EnchantmentHelper; import common.enchantment.EnchantmentHelper;
import common.entity.npc.EntityNPC; import common.entity.npc.EntityNPC;
import common.item.ItemStack; import common.item.ItemStack;
import common.item.material.ItemEnchantedBook; import common.item.material.ItemEnchantedBook;
import common.network.IPlayer; import common.network.IPlayer;
import common.util.Equipment;
import common.util.LocalPos; import common.util.LocalPos;
import common.vars.Vars; import common.vars.Vars;
import common.world.State; import common.world.State;
@ -117,17 +114,17 @@ public class ContainerRepair extends Container
}; };
this.selfPosition = blockPosIn; this.selfPosition = blockPosIn;
this.theWorld = worldIn; this.theWorld = worldIn;
this.addSlotToContainer(new Slot(this.inputSlots, 0, 27, 47) { this.addSlotToContainer(new Slot(this.inputSlots, 0, 54, 94) {
public boolean canEditItem() { public boolean canEditItem() {
return false; return false;
} }
}); });
this.addSlotToContainer(new Slot(this.inputSlots, 1, 76, 47) { this.addSlotToContainer(new Slot(this.inputSlots, 1, 152, 94) {
public boolean canEditItem() { public boolean canEditItem() {
return false; return false;
} }
}); });
this.addSlotToContainer(new Slot(this.outputSlot, 2, 134, 47) this.addSlotToContainer(new Slot(this.outputSlot, 2, 268, 94)
{ {
public boolean isItemValid(ItemStack stack) public boolean isItemValid(ItemStack stack)
{ {

View file

@ -1,14 +1,10 @@
package common.inventory; package common.inventory;
import java.util.List;
import common.collect.Lists;
import common.entity.npc.EntityNPC; import common.entity.npc.EntityNPC;
import common.item.ItemStack; import common.item.ItemStack;
import common.network.IPlayer; import common.network.IPlayer;
import common.tileentity.Device; import common.tileentity.Device;
import common.tileentity.Device.Status; import common.tileentity.Device.Status;
import common.util.Equipment;
public class ContainerTile extends Container public class ContainerTile extends Container
{ {
@ -39,7 +35,7 @@ public class ContainerTile extends Container
for (int idx = 0; idx < tileInv.getSizeInventory(); ++idx) for (int idx = 0; idx < tileInv.getSizeInventory(); ++idx)
{ {
final int index = idx; final int index = idx;
this.addSlotToContainer(new Slot(tileInv, idx, 8 + (this.tile.isInput(index) ? input : 8 - output) * 18, 81) { this.addSlotToContainer(new Slot(tileInv, idx, 16 + (this.tile.isInput(index) ? input : 8 - output) * 36, 162) {
public boolean isItemValid(ItemStack stack) public boolean isItemValid(ItemStack stack)
{ {
return ContainerTile.this.tile.isItemValidForSlot(index, stack); return ContainerTile.this.tile.isItemValidForSlot(index, stack);
@ -59,7 +55,7 @@ public class ContainerTile extends Container
} }
public int getInventoryOffsetY() { public int getInventoryOffsetY() {
return 112; return 224;
} }
public boolean canInteractWith(EntityNPC playerIn) public boolean canInteractWith(EntityNPC playerIn)

View file

@ -1,12 +1,8 @@
package common.inventory; package common.inventory;
import java.util.List;
import common.block.tech.BlockWorkbench; import common.block.tech.BlockWorkbench;
import common.collect.Lists;
import common.entity.npc.EntityNPC; import common.entity.npc.EntityNPC;
import common.item.ItemStack; import common.item.ItemStack;
import common.util.Equipment;
import common.util.LocalPos; import common.util.LocalPos;
import common.world.World; import common.world.World;

View file

@ -28,11 +28,11 @@ public class SlotCommon extends Slot {
for(SlotCommon slot : this.list) { for(SlotCommon slot : this.list) {
x1 = Math.min(x1, slot.xDisplayPosition); x1 = Math.min(x1, slot.xDisplayPosition);
y1 = Math.min(y1, slot.yDisplayPosition); y1 = Math.min(y1, slot.yDisplayPosition);
x2 = Math.max(x2, slot.xDisplayPosition + 18); x2 = Math.max(x2, slot.xDisplayPosition + 36);
y2 = Math.max(y2, slot.yDisplayPosition + 18); y2 = Math.max(y2, slot.yDisplayPosition + 36);
} }
this.w = (x2 - x1) / 18; this.w = (x2 - x1) / 36;
this.h = (y2 - y1) / 18; this.h = (y2 - y1) / 36;
} }
public int getBackgroundWidth() { public int getBackgroundWidth() {