1
0
Fork 0

device fixes, prepare for pipes

This commit is contained in:
Sen 2025-08-12 00:45:13 +02:00
parent 08acee12b7
commit 43b097eac3
Signed by: sen
GPG key ID: 3AC50A6F47D1B722
93 changed files with 716 additions and 2628 deletions

View file

@ -1,32 +0,0 @@
package client.gui.container;
import common.init.Blocks;
import common.inventory.ContainerBrewingStand;
import common.inventory.IInventory;
import common.entity.npc.EntityNPC;
public class GuiBrewing extends GuiContainer {
private final EntityNPC playerInv;
private final IInventory brewer;
public GuiBrewing(EntityNPC player, IInventory brewer) {
super(new ContainerBrewingStand(player, brewer));
this.playerInv = player;
this.brewer = brewer;
}
public void draw() {
super.draw();
int progress = this.brewer.getField(0);
if(progress > 0) {
int value = (int)(28.0F * (1.0F - (float)progress / 400.0F));
if(value > 0)
this.rect(97, 16, 9, value, 0xffff20);
}
}
public void addElements() {
this.label(Blocks.brewing_stand.getDisplay(), 8, 16);
this.label("Inventar", 8, this.ySize - 96 + 12);
}
}

View file

@ -1,20 +0,0 @@
package client.gui.container;
import common.block.tech.BlockDispenser;
import common.inventory.ContainerDispenser;
import common.inventory.IInventory;
import common.entity.npc.EntityNPC;
public class GuiDispenser extends GuiContainer {
private final BlockDispenser block;
public GuiDispenser(EntityNPC playerInv, IInventory dispenser, BlockDispenser block) {
super(new ContainerDispenser(playerInv, dispenser));
this.block = block;
}
public void addElements() {
this.label(this.block.getDisplay(), 8, 16);
this.label("Inventar", 8, this.ySize - 96 + 12);
}
}

View file

@ -1,19 +0,0 @@
package client.gui.container;
import client.Client;
import common.init.Blocks;
import common.inventory.ContainerHopper;
import common.inventory.IInventory;
import common.entity.npc.EntityNPC;
public class GuiHopper extends GuiContainer {
public GuiHopper(EntityNPC playerInv, IInventory hopper) {
super(new ContainerHopper(playerInv, hopper, Client.CLIENT.player));
this.ySize = 133;
}
public void addElements() {
this.label(Blocks.hopper.getDisplay(), 8, 16);
this.label("Inventar", 8, this.ySize - 96 + 12);
}
}

View file

@ -7,12 +7,9 @@ import client.gui.Gui;
import client.gui.GuiConsole;
import client.gui.character.GuiChar;
import client.gui.character.GuiCharacters;
import client.gui.container.GuiBrewing;
import client.gui.container.GuiChest;
import client.gui.container.GuiCrafting;
import client.gui.container.GuiDispenser;
import client.gui.container.GuiEnchant;
import client.gui.container.GuiHopper;
import client.gui.container.GuiEntity;
import client.gui.container.GuiDevice;
import client.gui.container.GuiMerchant;
@ -26,7 +23,6 @@ import client.world.ChunkClient;
import common.block.Block;
import common.block.tech.BlockAnvil;
import common.block.tech.BlockChest;
import common.block.tech.BlockDispenser;
import common.block.tech.BlockWorkbench;
import common.dimension.DimType;
import common.dimension.Dimension;
@ -1073,7 +1069,7 @@ public class ClientPlayer implements IClientPlayer
TileEntity tile = this.world.getTileEntity(packet.getTilePos());
if(!(tile instanceof Device dev))
return;
this.gm.show(new GuiDevice(player, new LocalContainer(slots), dev));
this.gm.show(new GuiDevice(player, new InventoryBasic(slots), dev));
}
else if (packet.getEntityId() != -1)
{
@ -1088,34 +1084,22 @@ public class ClientPlayer implements IClientPlayer
else if (block == Blocks.warp_chest)
{
this.gm.show(new GuiChest(player, new InventoryWarpChest(), block));
}
else if (block == Blocks.enchanting_table)
{
this.gm.show(new GuiEnchant(player, player.worldObj));
}
else if (block instanceof BlockAnvil)
{
this.gm.show(new GuiRepair(player, player.worldObj));
}
else if (block instanceof BlockChest)
{
this.gm.show(new GuiChest(player, new InventoryBasic(slots), block));
}
else if (block == Blocks.hopper)
{
this.gm.show(new GuiHopper(player, new InventoryBasic(slots)));
}
else if (block == Blocks.brewing_stand)
{
this.gm.show(new GuiBrewing(player, new LocalContainer(slots)));
}
else if (block instanceof BlockDispenser dispenser)
{
this.gm.show(new GuiDispenser(player, new InventoryBasic(slots), dispenser));
}
else if(block instanceof BlockWorkbench bench) {
this.gm.show(new GuiCrafting(player, player.worldObj, bench));
}
else if (block instanceof BlockAnvil)
{
this.gm.show(new GuiRepair(player, player.worldObj));
}
else if (block == Blocks.enchanting_table)
{
this.gm.show(new GuiEnchant(player, player.worldObj));
}
else {
return;
}

View file

@ -1,27 +0,0 @@
package client.network;
import java.util.Map;
import common.collect.Maps;
import common.inventory.IInventory;
import common.inventory.InventoryBasic;
public class LocalContainer extends InventoryBasic implements IInventory {
private Map<Integer, Integer> fields = Maps.<Integer, Integer>newHashMap();
public LocalContainer(int slotCount) {
super(slotCount);
}
public int getField(int id) {
return this.fields.containsKey(Integer.valueOf(id)) ? ((Integer)this.fields.get(Integer.valueOf(id))).intValue() : 0;
}
public void setField(int id, int value) {
this.fields.put(Integer.valueOf(id), Integer.valueOf(value));
}
public int getFieldCount() {
return this.fields.size();
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 615 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 661 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 564 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 550 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 615 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 661 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 564 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 550 B

View file

Before

Width:  |  Height:  |  Size: 495 B

After

Width:  |  Height:  |  Size: 495 B

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 749 B

View file

Before

Width:  |  Height:  |  Size: 713 B

After

Width:  |  Height:  |  Size: 713 B

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 712 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 615 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 661 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 564 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 550 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 615 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 661 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 564 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 550 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 615 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 661 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 564 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 550 B

View file

Before

Width:  |  Height:  |  Size: 422 B

After

Width:  |  Height:  |  Size: 422 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 531 B

After

Width:  |  Height:  |  Size: 531 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 406 B

After

Width:  |  Height:  |  Size: 406 B

Before After
Before After

Binary file not shown.

After

Width:  |  Height:  |  Size: 615 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 661 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 564 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 550 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 615 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 661 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 564 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 550 B