Skip to content

Commit

Permalink
Use non-snapshot holders get DoubleChest block (Fixes #604)
Browse files Browse the repository at this point in the history
  • Loading branch information
Phoenix616 committed Jul 31, 2024
1 parent 69df518 commit 1523e5d
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/main/java/com/Acrobot/ChestShop/Signs/ChestShopSign.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.Acrobot.ChestShop.Signs;

import com.Acrobot.Breeze.Utils.BlockUtil;
import com.Acrobot.Breeze.Utils.ImplementationAdapter;
import com.Acrobot.Breeze.Utils.QuantityUtil;
import com.Acrobot.Breeze.Utils.StringUtil;
import com.Acrobot.ChestShop.Configuration.Properties;
Expand Down Expand Up @@ -121,8 +122,8 @@ public static boolean isShopChest(InventoryHolder holder) {

public static boolean isShopBlock(InventoryHolder holder) {
if (holder instanceof DoubleChest) {
return isShopBlock(((DoubleChest) holder).getLeftSide())
|| isShopBlock(((DoubleChest) holder).getRightSide());
return isShopBlock(ImplementationAdapter.getLeftSide((DoubleChest) holder, false))
|| isShopBlock(ImplementationAdapter.getRightSide((DoubleChest) holder, false));
} else if (holder instanceof BlockState) {
return isShopBlock(((BlockState) holder).getBlock());
}
Expand All @@ -131,8 +132,8 @@ public static boolean isShopBlock(InventoryHolder holder) {

public static Block getShopBlock(InventoryHolder holder) {
if (holder instanceof DoubleChest) {
return Optional.ofNullable(getShopBlock(((DoubleChest) holder).getLeftSide()))
.orElse(getShopBlock(((DoubleChest) holder).getRightSide()));
return Optional.ofNullable(getShopBlock(ImplementationAdapter.getLeftSide((DoubleChest) holder, false)))
.orElse(getShopBlock(ImplementationAdapter.getRightSide((DoubleChest) holder, false)));
} else if (holder instanceof BlockState) {
return ((BlockState) holder).getBlock();
}
Expand Down

0 comments on commit 1523e5d

Please sign in to comment.