1
0
Fork 0

misc fixes

This commit is contained in:
Sen 2025-09-07 12:47:07 +02:00
parent cfcb590574
commit 00ac4146bc
Signed by: sen
GPG key ID: 3AC50A6F47D1B722
8 changed files with 119 additions and 116 deletions

View file

@ -581,7 +581,7 @@ public class Client implements IThreadListener {
@Variable(name = "chunk_build_time", category = CVarCategory.RENDER, min = 1, max = 100, display = "Zeit für Chunk-Bau", unit = "ms")
public int maxBuildTime = 8;
@Variable(name = "chunk_light_updates", category = CVarCategory.RENDER, min = 0, max = 10000, display = "Licht-Updates / Frame")
private int lightUpdates = 150;
private int lightUpdates = 300;
@Variable(name = "chunk_light_range", category = CVarCategory.RENDER, min = 5, max = 512, display = "Radius Licht-Updates")
private int lightRange = 32;
@Variable(name = "draw_fov", category = CVarCategory.RENDER, min = 20.0f, max = 160.0f, display = "Sichtfeld (FOV)", unit = "°", precision = 1)
@ -610,6 +610,8 @@ public class Client implements IThreadListener {
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")
@ -2512,6 +2514,7 @@ public class Client implements IThreadListener {
PerfSection.TICK.enter();
this.doTicks();
PerfSection.UPDATE.enter();
this.update();
PerfSection.RENDER.enter();
this.render();
PerfSection.GUI.enter();
@ -2700,7 +2703,9 @@ public class Client implements IThreadListener {
this.tickFraction = ((double)this.tick_torun) / 1000000.0;
this.tick_ttime += this.tick_ftime;
this.tick_time = this.tickFrame != 0 ? (this.tick_ftime / (long)this.tickFrame) : 0L;
}
private void update() {
if(this.player != null) {
int radius = Math.min(this.renderDistance * 16, this.lightRange);
for(int n = 0; n < this.lightUpdates; n++) {

View file

@ -97,6 +97,7 @@ public abstract class GuiContainer extends Gui
private Label cheatLabel;
private Field cheatSearch;
private String cheatLast;
private Label inventoryLabel;
public static String formatAmount(int amount) {
if(amount < 0)
@ -260,21 +261,22 @@ public abstract class GuiContainer extends Gui
{
this.inventorySlots = container;
this.ignoreMouseUp = true;
this.xSize = (container.getInventoryOffsetX() - 1) * 2 + 18 * 12;
this.ySize = container.getInventoryOffsetY() + 6 + 18 * ((Equipment.INVENTORY_SLOTS + 11) / 12);
this.xSize = (container.getInventoryOffsetX() - 1) * 2 + 18 * Container.INVENTORY_WIDTH;
this.ySize = container.getInventoryOffsetY() + 26 + 18 * ((Equipment.INVENTORY_SLOTS + Container.INVENTORY_WIDTH - 1) / Container.INVENTORY_WIDTH);
}
public void init(int width, int height) {
this.itemRender = this.gm.getRenderItem();
this.tooltip = null;
this.cheatStack = null;
this.container_scale = this.gm.scaleItems && this.xSize * 2 <= Client.MIN_WIDTH && this.ySize * 2 <= Client.MIN_HEIGHT ? 2 : 1;
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.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();
this.label("Inventar", this.inventorySlots.getInventoryOffsetX(), this.inventorySlots.getInventoryOffsetY() - 2);
this.inventoryLabel = this.label("", this.inventorySlots.getInventoryOffsetX() + 18 * Container.INVENTORY_WIDTH - 90, this.inventorySlots.getInventoryOffsetY() - 2);
}
public void hover(String text, int x, int y) {
@ -767,14 +769,18 @@ public abstract class GuiContainer extends Gui
public void updateScreen()
{
if (this.gm != null && this.gm.player != null && (!this.gm.player.isEntityAlive() || this.gm.player.dead))
{
if(this.gm != null && this.gm.player != null && (!this.gm.player.isEntityAlive() || this.gm.player.dead)) {
this.gm.show(null);
return;
}
else if(this.gm.itemCheat && !this.cheatSearch.getText().equals(this.cheatLast)) {
if(this.gm.itemCheat && !this.cheatSearch.getText().equals(this.cheatLast)) {
this.cheatLast = this.cheatSearch.getText();
this.setCurrentTab(selectedTab);
}
if(this.gm != null && this.gm.player != null)
this.inventoryLabel.setText((this.gm.player.getInventoryWeight() > this.gm.player.getInventoryCapacity() ? Color.RED : Color.NEON) + String.format("% 5d / % 5d", this.gm.player.getInventoryWeight(), this.gm.player.getInventoryCapacity()));
}
public void renderItemOverlayIntoGUI(ItemStack stack, int xPosition, int yPosition, String text)

View file

@ -77,6 +77,7 @@ public class GuiStyle extends GuiOptions {
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);
}