From 8039a17701fe85aa82030ed0505d16fb6f08420a Mon Sep 17 00:00:00 2001 From: 90 Date: Thu, 11 Jul 2024 23:00:34 +0100 Subject: [PATCH] Reorganise some client classes --- .../monitor/ConversionMonitorBlockEntity.java | 19 +++++++++++-------- .../mixin/{ => client}/ModelManagerMixin.java | 2 +- .../{ => client}/UnlitQuadHooksAccessor.java | 2 +- src/main/resources/fulleng.mixins.json | 2 +- 4 files changed, 14 insertions(+), 11 deletions(-) rename src/main/java/gripe/_90/fulleng/mixin/{ => client}/ModelManagerMixin.java (96%) rename src/main/java/gripe/_90/fulleng/mixin/{ => client}/UnlitQuadHooksAccessor.java (90%) diff --git a/src/main/java/gripe/_90/fulleng/block/entity/monitor/ConversionMonitorBlockEntity.java b/src/main/java/gripe/_90/fulleng/block/entity/monitor/ConversionMonitorBlockEntity.java index 323288c..15befdb 100644 --- a/src/main/java/gripe/_90/fulleng/block/entity/monitor/ConversionMonitorBlockEntity.java +++ b/src/main/java/gripe/_90/fulleng/block/entity/monitor/ConversionMonitorBlockEntity.java @@ -19,7 +19,6 @@ import appeng.util.inv.PlayerInternalInventory; import gripe._90.fulleng.definition.FullEngBlockEntities; -import gripe._90.fulleng.definition.FullEngBlocks; public class ConversionMonitorBlockEntity extends StorageMonitorBlockEntity implements ISubMenuHost { public ConversionMonitorBlockEntity(BlockPos pos, BlockState state) { @@ -28,11 +27,11 @@ public ConversionMonitorBlockEntity(BlockPos pos, BlockState state) { @Override public void onActivated(Player player, InteractionHand hand) { - var eq = player.getItemInHand(hand); + var holding = player.getItemInHand(hand); if (isLocked()) { - insertItem(player, hand, eq.isEmpty()); - } else if (getDisplayed() != null && AEItemKey.matches(getDisplayed(), eq)) { + insertItem(player, hand, holding.isEmpty()); + } else if (getDisplayed() != null && AEItemKey.matches(getDisplayed(), holding)) { insertItem(player, hand, false); } else { super.onActivated(player, hand); @@ -42,7 +41,7 @@ public void onActivated(Player player, InteractionHand hand) { private void insertItem(Player player, InteractionHand hand, boolean allItems) { getMainNode().ifPresent(grid -> { var energy = grid.getEnergyService(); - var cell = grid.getStorageService().getInventory(); + var storage = grid.getStorageService().getInventory(); if (allItems) { if (getDisplayed() instanceof AEItemKey itemKey) { @@ -56,7 +55,11 @@ private void insertItem(Player player, InteractionHand hand, boolean allItems) { if (!canExtract.isEmpty()) { var inserted = StorageHelper.poweredInsert( - energy, cell, itemKey, canExtract.getCount(), new PlayerSource(player, this)); + energy, + storage, + itemKey, + canExtract.getCount(), + new PlayerSource(player, this)); inv.extractItem(x, (int) inserted, false); } } @@ -68,7 +71,7 @@ private void insertItem(Player player, InteractionHand hand, boolean allItems) { if (!input.isEmpty()) { var inserted = StorageHelper.poweredInsert( energy, - cell, + storage, Objects.requireNonNull(AEItemKey.of(input)), input.getCount(), new PlayerSource(player, this)); @@ -121,6 +124,6 @@ public void returnToMainMenu(Player player, ISubMenu subMenu) { @Override public ItemStack getMainMenuIcon() { - return new ItemStack(FullEngBlocks.CONVERSION_MONITOR); + return new ItemStack(getItemFromBlockEntity()); } } diff --git a/src/main/java/gripe/_90/fulleng/mixin/ModelManagerMixin.java b/src/main/java/gripe/_90/fulleng/mixin/client/ModelManagerMixin.java similarity index 96% rename from src/main/java/gripe/_90/fulleng/mixin/ModelManagerMixin.java rename to src/main/java/gripe/_90/fulleng/mixin/client/ModelManagerMixin.java index 93d4217..6192198 100644 --- a/src/main/java/gripe/_90/fulleng/mixin/ModelManagerMixin.java +++ b/src/main/java/gripe/_90/fulleng/mixin/client/ModelManagerMixin.java @@ -1,4 +1,4 @@ -package gripe._90.fulleng.mixin; +package gripe._90.fulleng.mixin.client; import java.util.Map; diff --git a/src/main/java/gripe/_90/fulleng/mixin/UnlitQuadHooksAccessor.java b/src/main/java/gripe/_90/fulleng/mixin/client/UnlitQuadHooksAccessor.java similarity index 90% rename from src/main/java/gripe/_90/fulleng/mixin/UnlitQuadHooksAccessor.java rename to src/main/java/gripe/_90/fulleng/mixin/client/UnlitQuadHooksAccessor.java index e64b483..132827f 100644 --- a/src/main/java/gripe/_90/fulleng/mixin/UnlitQuadHooksAccessor.java +++ b/src/main/java/gripe/_90/fulleng/mixin/client/UnlitQuadHooksAccessor.java @@ -1,4 +1,4 @@ -package gripe._90.fulleng.mixin; +package gripe._90.fulleng.mixin.client; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.gen.Accessor; diff --git a/src/main/resources/fulleng.mixins.json b/src/main/resources/fulleng.mixins.json index 2453dc3..d7af384 100644 --- a/src/main/resources/fulleng.mixins.json +++ b/src/main/resources/fulleng.mixins.json @@ -4,5 +4,5 @@ "package": "gripe._90.fulleng.mixin", "compatibilityLevel": "JAVA_21", "mixins": ["PartLeftClickPacketMixin"], - "client": ["ModelManagerMixin", "UnlitQuadHooksAccessor"] + "client": ["client.ModelManagerMixin", "client.UnlitQuadHooksAccessor"] }