fixes, starting to replace redstone
This commit is contained in:
parent
92b7214c69
commit
13b6a4e280
34 changed files with 109 additions and 209 deletions
|
@ -241,6 +241,12 @@ public class Client implements IThreadListener {
|
|||
}
|
||||
}
|
||||
|
||||
public static class ItemRedrawFunction implements BoolFunction {
|
||||
public void apply(BoolVar cv, boolean value) {
|
||||
Client.CLIENT.rescale();
|
||||
}
|
||||
}
|
||||
|
||||
public static class LevelFunction implements EnumFunction<LogLevel> {
|
||||
public void apply(EnumVar cv, LogLevel value) {
|
||||
Log.setLevel(value);
|
||||
|
@ -440,9 +446,11 @@ public class Client implements IThreadListener {
|
|||
private int savedX = 0x80000000;
|
||||
@Variable(name = "win_pos_y", category = CVarCategory.WINDOW, min = -65536, max = 65536, display = "Fenster Y-Position")
|
||||
private int savedY = 0x80000000;
|
||||
|
||||
|
||||
@Variable(name = "gui_scale", category = CVarCategory.GUI, min = 1, max = 5, display = "Skalierung", unit = "x", callback = RedrawFunction.class)
|
||||
private int scaleVar = 2;
|
||||
@Variable(name = "gui_scale_items", category = CVarCategory.GUI, display = "Gegenstände vergrößern", callback = ItemRedrawFunction.class)
|
||||
public boolean scaleItems = true;
|
||||
@Variable(name = "phy_sensitivity", category = CVarCategory.INPUT, min = 0.01f, max = 10.0f, display = "Mausempfindlichkeit", precision = 2, unit = "%")
|
||||
private float sensitivity = 1.0f;
|
||||
@Variable(name = "gui_dclick_delay", category = CVarCategory.INPUT, min = 150, max = 750, display = "Doppelklick bei", unit = "ms")
|
||||
|
@ -1101,7 +1109,7 @@ public class Client implements IThreadListener {
|
|||
ItemStack itemstack = this.player.inventory.mainInventory[index];
|
||||
if(itemstack != null) {
|
||||
GuiContainer.renderItemOverlay(itemstack,
|
||||
this.fbX / 2 - 180 + 4 + 1 + index * 40, this.fbY - 40 + 1, null, index == this.player.inventory.currentItem ? this.controller.getUseCooldown() : 0, this.controller.getUseCooldownMax());
|
||||
this.fbX / 2 - 180 + 4 + 1 + index * 40, this.fbY - 40 + 1, null, index == this.player.inventory.currentItem ? this.controller.getUseCooldown() : 0, this.controller.getUseCooldownMax(), 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ import java.util.Map.Entry;
|
|||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL13;
|
||||
|
||||
import client.Client;
|
||||
import client.gui.Font;
|
||||
import client.gui.Gui;
|
||||
import client.gui.element.ActButton;
|
||||
|
@ -84,6 +85,7 @@ public abstract class GuiContainer extends Gui
|
|||
protected int container_y;
|
||||
protected int container_w;
|
||||
protected int container_h;
|
||||
protected int container_scale;
|
||||
|
||||
private int hover_x;
|
||||
private int hover_y;
|
||||
|
@ -192,41 +194,41 @@ public abstract class GuiContainer extends Gui
|
|||
}
|
||||
|
||||
public Label label(String text, int x, int y) {
|
||||
x = x * 2 + this.container_x;
|
||||
y = y * 2 + this.container_y;
|
||||
x = x * this.container_scale + this.container_x;
|
||||
y = y * this.container_scale + this.container_y;
|
||||
return this.add(new Label(x, y, 300, 0, text, true));
|
||||
}
|
||||
|
||||
public void rect(int x, int y, int width, int height, int color) {
|
||||
Drawing.drawRect(this.container_x + x * 2, this.container_y + y * 2, width * 2, height * 2, 0xff000000 | 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);
|
||||
}
|
||||
|
||||
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 * 2, this.container_y + y * 2, width * 2, height * 2, 0xff000000 | top, 0xff000000 | bottom, 0xff000000 | topleft, 0xff000000 | 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);
|
||||
}
|
||||
|
||||
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));
|
||||
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));
|
||||
}
|
||||
|
||||
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));
|
||||
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));
|
||||
}
|
||||
|
||||
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
|
||||
this.mouseClicked((x - this.container_x) / this.container_scale, (y - this.container_y) / this.container_scale, btn.ordinal()); //TODO: enum
|
||||
}
|
||||
|
||||
public void mouserel(Button btn, int x, int y) {
|
||||
super.mouserel(btn, x, y);
|
||||
this.mouseReleased((x - this.container_x) / 2, (y - this.container_y) / 2, btn.ordinal()); //TODO: enum
|
||||
this.mouseReleased((x - this.container_x) / this.container_scale, (y - this.container_y) / this.container_scale, btn.ordinal()); //TODO: enum
|
||||
}
|
||||
|
||||
public void drag(int x, int y) {
|
||||
super.drag(x, y);
|
||||
if(Button.MOUSE_LEFT.isDown() || Button.MOUSE_RIGHT.isDown() || Button.MOUSE_MIDDLE.isDown())
|
||||
this.mouseDragged((x - this.container_x) / 2, (y - this.container_y) / 2);
|
||||
this.mouseDragged((x - this.container_x) / this.container_scale, (y - this.container_y) / this.container_scale);
|
||||
}
|
||||
|
||||
public GuiContainer(Container container)
|
||||
|
@ -239,8 +241,9 @@ public abstract class GuiContainer extends Gui
|
|||
this.itemRender = this.gm.getRenderItem();
|
||||
this.tooltip = null;
|
||||
this.cheatStack = null;
|
||||
this.container_x = (width - (this.container_w = (this.xSize * 2))) / 2;
|
||||
this.container_y = (height - (this.container_h = (this.ySize * 2))) / 2;
|
||||
this.container_scale = this.gm.scaleItems && this.xSize * 2 <= Client.MIN_WIDTH && this.ySize * 2 <= Client.MIN_HEIGHT ? 2 : 1;
|
||||
this.container_x = (width - (this.container_w = (this.xSize * this.container_scale))) / 2;
|
||||
this.container_y = (height - (this.container_h = (this.ySize * this.container_scale))) / 2;
|
||||
this.initGui();
|
||||
this.addButtons();
|
||||
this.addElements();
|
||||
|
@ -248,8 +251,8 @@ public abstract class GuiContainer extends Gui
|
|||
|
||||
public void hover(String text, int x, int y) {
|
||||
this.tooltip = text;
|
||||
this.hover_x = x * 2 + this.container_x + 16;
|
||||
this.hover_y = y * 2 + this.container_y + 16;
|
||||
this.hover_x = x * this.container_scale + this.container_x + 16;
|
||||
this.hover_y = y * this.container_scale + this.container_y + 16;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
|
@ -302,8 +305,9 @@ public abstract class GuiContainer extends Gui
|
|||
|
||||
if(this.gm.itemCheat) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(-(float)((this.gm.fbX - this.xSize * 2) / 2) * 0.5f, -(float)((this.gm.fbY - this.ySize * 2) / 2) * 0.5f, 0.0f);
|
||||
GL11.glScalef(0.5f, 0.5f, 0.5f);
|
||||
GL11.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);
|
||||
if(this.container_scale != 1)
|
||||
GL11.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 j = (int)((double)(this.currentScroll * (float)i) + 0.5D);
|
||||
|
||||
|
@ -496,9 +500,10 @@ public abstract class GuiContainer extends Gui
|
|||
|
||||
public void drawPost() {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float)((this.gm.fbX - this.xSize * 2) / 2), (float)((this.gm.fbY - this.ySize * 2) / 2), 0.0f);
|
||||
GL11.glScalef(2.0f, 2.0f, 2.0f);
|
||||
this.drawScreen((this.gm.mouseX - this.container_x) / 2, (this.gm.mouseY - this.container_y) / 2);
|
||||
GL11.glTranslatef((float)((this.gm.fbX - this.xSize * this.container_scale) / 2), (float)((this.gm.fbY - this.ySize * this.container_scale) / 2), 0.0f);
|
||||
if(this.container_scale != 1)
|
||||
GL11.glScalef((float)this.container_scale, (float)this.container_scale, (float)this.container_scale);
|
||||
this.drawScreen((this.gm.mouseX - this.container_x) / this.container_scale, (this.gm.mouseY - this.container_y) / this.container_scale);
|
||||
GL11.glPopMatrix();
|
||||
ItemRenderer.disableStandardItemLighting();
|
||||
}
|
||||
|
@ -862,10 +867,10 @@ public abstract class GuiContainer extends Gui
|
|||
|
||||
public void renderItemOverlayIntoGUI(ItemStack stack, int xPosition, int yPosition, String text)
|
||||
{
|
||||
renderItemOverlay(stack, this.container_x + xPosition * 2, this.container_y + yPosition * 2, text, 0, 0);
|
||||
renderItemOverlay(stack, this.container_x + xPosition * this.container_scale, this.container_y + yPosition * this.container_scale, text, 0, 0, this.container_scale);
|
||||
}
|
||||
|
||||
public static void renderItemOverlay(ItemStack stack, int xPosition, int yPosition, String text, int bar2, int bar2max)
|
||||
public static void renderItemOverlay(ItemStack stack, int xPosition, int yPosition, String text, int bar2, int bar2max, int scale)
|
||||
{
|
||||
if (stack != null)
|
||||
{
|
||||
|
@ -877,25 +882,25 @@ public abstract class GuiContainer extends Gui
|
|||
{
|
||||
s = TextColor.RED + formatAmount(stack.getSize());
|
||||
}
|
||||
Drawing.drawTextRight(s, xPosition + 32, yPosition + 33 - Font.YGLYPH, 0xffffffff);
|
||||
Drawing.drawTextRight(s, xPosition + scale * 16, yPosition + scale * 16 + 1 - Font.YGLYPH, 0xffffffff);
|
||||
}
|
||||
|
||||
if (stack.isItemDamaged())
|
||||
{
|
||||
int j = (int)Math.round(28.0D - (double)stack.getItemDamage() * 28.0D / (double)stack.getMaxDamage());
|
||||
int j = (int)Math.round(14.0D * (double)scale - (double)stack.getItemDamage() * (14.0D * (double)scale) / (double)stack.getMaxDamage());
|
||||
int i = (int)Math.round(255.0D - (double)stack.getItemDamage() * 255.0D / (double)stack.getMaxDamage());
|
||||
draw(xPosition + 2, yPosition + 26, 28, 4, 0, 0, 0);
|
||||
draw(xPosition + 2, yPosition + 26, 26, 2, (255 - i) / 4, 64, 0);
|
||||
draw(xPosition + 2, yPosition + 26, j, 2, 255 - i, i, 0);
|
||||
draw(xPosition + scale, yPosition + 13 * scale, 14 * scale, scale * 2, 0, 0, 0);
|
||||
draw(xPosition + scale, yPosition + 13 * scale, 13 * scale, scale, (255 - i) / 4, 64, 0);
|
||||
draw(xPosition + scale, yPosition + 13 * scale, j, scale, 255 - i, i, 0);
|
||||
}
|
||||
|
||||
if (bar2 > 0)
|
||||
{
|
||||
int j = (int)Math.round(28.0D - (double)bar2 * 28.0D / (double)bar2max);
|
||||
int j = (int)Math.round(14.0D * (double)scale - (double)bar2 * (14.0D * (double)scale) / (double)bar2max);
|
||||
int i = (int)Math.round(255.0D - (double)bar2 * 255.0D / (double)bar2max);
|
||||
draw(xPosition + 2, yPosition + 4, 28, 4, 0, 0, 0);
|
||||
draw(xPosition + 2, yPosition + 4, 26, 2, (255 - i) / 8, (255 - i) / 16, i / 4);
|
||||
draw(xPosition + 2 + 28 - j, yPosition + 4, j, 2, (255 - i) / 2, (255 - i) / 4, i);
|
||||
draw(xPosition + scale, yPosition + scale * 2, 14 * scale, scale * 2, 0, 0, 0);
|
||||
draw(xPosition + scale, yPosition + scale * 2, 13 * scale, scale, (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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -76,6 +76,7 @@ public class GuiStyle extends GuiOptions {
|
|||
|
||||
this.addSelector("gui_scale", 0, 3 * 34 + 20, 240, 0);
|
||||
this.addSelector("gui_font", 242, 3 * 34 + 20, 240, 0);
|
||||
this.addSelector("gui_scale_items", 0, 3 * 34 + 40, 240, 0);
|
||||
super.init(width, height);
|
||||
}
|
||||
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 395 B |
Binary file not shown.
Before Width: | Height: | Size: 356 B |
Binary file not shown.
Before Width: | Height: | Size: 395 B |
Loading…
Add table
Add a link
Reference in a new issue