Skip to content

Commit

Permalink
Reorganise some client classes
Browse files Browse the repository at this point in the history
  • Loading branch information
62832 committed Jul 11, 2024
1 parent 3e9b2de commit 8039a17
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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);
Expand All @@ -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) {
Expand All @@ -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);
}
}
Expand All @@ -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));
Expand Down Expand Up @@ -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());
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package gripe._90.fulleng.mixin;
package gripe._90.fulleng.mixin.client;

import java.util.Map;

Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/fulleng.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
"package": "gripe._90.fulleng.mixin",
"compatibilityLevel": "JAVA_21",
"mixins": ["PartLeftClickPacketMixin"],
"client": ["ModelManagerMixin", "UnlitQuadHooksAccessor"]
"client": ["client.ModelManagerMixin", "client.UnlitQuadHooksAccessor"]
}

0 comments on commit 8039a17

Please sign in to comment.