1
0
Fork 0

improve container gui

This commit is contained in:
Sen 2025-09-08 00:41:22 +02:00
parent 10abaef2b4
commit 1fa3d76aed
Signed by: sen
GPG key ID: 3AC50A6F47D1B722
10 changed files with 17 additions and 8 deletions

View file

@ -38,6 +38,7 @@ import common.packet.CPacketAction;
import common.packet.CPacketCheat;
import common.util.ExtMath;
import common.util.Util;
import common.vars.Vars;
import common.util.Color;
import common.util.Equipment;
@ -793,7 +794,7 @@ public abstract class GuiContainer extends Gui
}
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()));
this.inventoryLabel.setText((Vars.itemWeight && 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

@ -11,7 +11,7 @@ public class EntityCameraHolder extends EntityNPC {
}
public int getInventoryCapacity() {
return 1;
return 0;
}
public boolean hasArmorSlot(Equipment slot) {

View file

@ -10,7 +10,7 @@ public class EntityDwarf extends EntityNPC {
}
public int getInventoryCapacity() {
return 30;
return 800;
}
// public boolean isAggressive() {

View file

@ -14,7 +14,7 @@ public class EntityFireDemon extends EntityFlyingNPC {
}
public int getInventoryCapacity() {
return 48;
return 2800;
}
// public boolean isAggressive() {

View file

@ -10,7 +10,7 @@ public class EntityGoblin extends EntityNPC {
}
public int getInventoryCapacity() {
return 24;
return 600;
}
public boolean isAggressive(Class<? extends EntityNPC> clazz) {

View file

@ -2758,7 +2758,7 @@ public abstract class EntityNPC extends EntityLiving implements IInventory
}
public int getInventoryCapacity() {
return 36;
return 1200;
}
public int getInventoryWeight() {

View file

@ -88,7 +88,7 @@ public class EntityPrimarch extends EntityMobNPC {
}
public int getInventoryCapacity() {
return 48;
return 2500;
}
// public boolean isAggressive() {

View file

@ -44,7 +44,7 @@ public class EntitySlime extends EntityNPC
}
public int getInventoryCapacity() {
return 12;
return 1000;
}
public boolean hasArmorSlot(Equipment slot) {

View file

@ -191,6 +191,8 @@ public abstract class Vars {
public static boolean skullDrop = true;
@Var(name = "deviceExplosions")
public static boolean deviceExplosions = true;
@Var(name = "itemWeight")
public static boolean itemWeight = true;
@Var(name = "keepInventory")
public static boolean keepInventory = false;

View file

@ -957,6 +957,12 @@ public class Player extends User implements Executor, IPlayer
this.entity.openContainer.clearStacks();
this.entity.openContainer.detectAndSendChanges();
if(Vars.itemWeight) {
int weight = this.entity.getInventoryWeight();
int capacity = this.entity.getInventoryCapacity();
if(weight > capacity)
this.entity.addEffect(new StatusEffect(Effect.SLOWNESS, 100, Math.min(5, (int)((float)(weight - capacity) / (float)capacity * 10.0f))));
}
// if(!this.worldObj.client)
if (/* !this.worldObj.client && */ !this.entity.openContainer.canInteractWith(this.entity))