Skip to content

Commit

Permalink
add emcbattery
Browse files Browse the repository at this point in the history
  • Loading branch information
PTOM76 committed Sep 18, 2024
1 parent 64700c4 commit c9f5b49
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ public class EMCBatteryScreen extends CompatInventoryScreen {
public EMCBatteryScreen(ScreenHandler handler, PlayerInventory inventory, Text title) {
super(handler, inventory, title);
this.playerInventory = inventory;
setBackgroundWidth(176);
setBackgroundHeight(184);
setBackgroundWidth(208);
setBackgroundHeight(166);
if (handler instanceof EMCBatteryScreenHandler)
screenHandler = (EMCBatteryScreenHandler) handler;

Expand All @@ -38,7 +38,7 @@ public void initOverride() {

@Override
public CompatIdentifier getCompatTexture() {
return _id("textures/gui/3x3.png");
return _id("textures/gui/emc_battery.png");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.network.PacketByteBuf;
import net.minecraft.screen.ScreenHandlerType;
import net.minecraft.screen.slot.Slot;
import net.minecraft.screen.slot.SlotActionType;
import net.pitan76.itemalchemy.tile.EMCBatteryTile;
Expand All @@ -24,7 +25,7 @@ public class EMCBatteryScreenHandler extends ExtendedScreenHandler {
public long maxEMC = 0;

public EMCBatteryScreenHandler(int syncId, PlayerInventory playerInventory, PacketByteBuf buf) {
this(syncId, playerInventory, null, InventoryUtil.createSimpleInventory(16 + 3));
this(syncId, playerInventory, null, InventoryUtil.createSimpleInventory(2));
NbtCompound data = PacketByteUtil.readNbt(buf);
if (data == null) return;
int x, y, z;
Expand All @@ -42,11 +43,20 @@ public EMCBatteryScreenHandler(int syncId, PlayerInventory playerInventory, Pack
}

public EMCBatteryScreenHandler(int syncId, PlayerInventory playerInventory, @Nullable EMCBatteryTile tile, Inventory inventory) {
super(ScreenHandlers.EMC_BATTERY, syncId);
this(ScreenHandlers.EMC_BATTERY, syncId, playerInventory, tile, inventory);
}

public EMCBatteryScreenHandler(ScreenHandlerType<?> type, int syncId, PlayerInventory playerInventory, @Nullable EMCBatteryTile tile, Inventory inventory) {
super(type, syncId);

this.inventory = inventory;
this.playerInventory = playerInventory;
this.tile = tile;

initSlots();
}

public void initSlots() {
addPlayerMainInventorySlots(playerInventory, 24, 84);
addPlayerHotbarSlots(playerInventory, 24, 142);
addNormalSlot(inventory, 0, 149, 12);
Expand Down
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit c9f5b49

Please sign in to comment.