improve container gui
This commit is contained in:
parent
10abaef2b4
commit
1fa3d76aed
10 changed files with 17 additions and 8 deletions
|
@ -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)
|
||||
|
|
|
@ -11,7 +11,7 @@ public class EntityCameraHolder extends EntityNPC {
|
|||
}
|
||||
|
||||
public int getInventoryCapacity() {
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
public boolean hasArmorSlot(Equipment slot) {
|
||||
|
|
|
@ -10,7 +10,7 @@ public class EntityDwarf extends EntityNPC {
|
|||
}
|
||||
|
||||
public int getInventoryCapacity() {
|
||||
return 30;
|
||||
return 800;
|
||||
}
|
||||
|
||||
// public boolean isAggressive() {
|
||||
|
|
|
@ -14,7 +14,7 @@ public class EntityFireDemon extends EntityFlyingNPC {
|
|||
}
|
||||
|
||||
public int getInventoryCapacity() {
|
||||
return 48;
|
||||
return 2800;
|
||||
}
|
||||
|
||||
// public boolean isAggressive() {
|
||||
|
|
|
@ -10,7 +10,7 @@ public class EntityGoblin extends EntityNPC {
|
|||
}
|
||||
|
||||
public int getInventoryCapacity() {
|
||||
return 24;
|
||||
return 600;
|
||||
}
|
||||
|
||||
public boolean isAggressive(Class<? extends EntityNPC> clazz) {
|
||||
|
|
|
@ -2758,7 +2758,7 @@ public abstract class EntityNPC extends EntityLiving implements IInventory
|
|||
}
|
||||
|
||||
public int getInventoryCapacity() {
|
||||
return 36;
|
||||
return 1200;
|
||||
}
|
||||
|
||||
public int getInventoryWeight() {
|
||||
|
|
|
@ -88,7 +88,7 @@ public class EntityPrimarch extends EntityMobNPC {
|
|||
}
|
||||
|
||||
public int getInventoryCapacity() {
|
||||
return 48;
|
||||
return 2500;
|
||||
}
|
||||
|
||||
// public boolean isAggressive() {
|
||||
|
|
|
@ -44,7 +44,7 @@ public class EntitySlime extends EntityNPC
|
|||
}
|
||||
|
||||
public int getInventoryCapacity() {
|
||||
return 12;
|
||||
return 1000;
|
||||
}
|
||||
|
||||
public boolean hasArmorSlot(Equipment slot) {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue