[1.19.x] Fix shulker boxes allowing input of items, that return false for Item#canFitInsideContainerItems, through hoppers. (#8823)

* Make ShulkerBoxBlockEntity#canPlaceItemThroughFace delegate to Item#canFitInsideContainerItems.

* Switch to using Or and add comment.

* Switch Or to And.
This commit is contained in:
Robert Kämpf authored and GitHub committed 2022-07-09 12:44:33 -04:00
1 parent 03202a8ab4
commit 061cd3da53
1 file changed
+15 -6
@@ -1,14 +1,23 @@
--- a/net/minecraft/world/level/block/entity/ShulkerBoxBlockEntity.java
+++ b/net/minecraft/world/level/block/entity/ShulkerBoxBlockEntity.java
@@ -235,6 +_,11 @@
return this.f_59647_ == ShulkerBoxBlockEntity.AnimationStatus.CLOSED;
@@ -211,7 +_,7 @@
}
public boolean m_7155_(int p_59663_, ItemStack p_59664_, @Nullable Direction p_59665_) {
- return !(Block.m_49814_(p_59664_.m_41720_()) instanceof ShulkerBoxBlock);
+ return !(Block.m_49814_(p_59664_.m_41720_()) instanceof ShulkerBoxBlock) && p_59664_.m_41720_().m_142095_(); // FORGE: Make shulker boxes respect Item#canFitInsideContainerItems
}
public boolean m_7157_(int p_59682_, ItemStack p_59683_, Direction p_59684_) {
@@ -233,6 +_,11 @@
public boolean m_59702_() {
return this.f_59647_ == ShulkerBoxBlockEntity.AnimationStatus.CLOSED;
+ }
+
+ @Override
+ protected net.minecraftforge.items.IItemHandler createUnSidedHandler() {
+ return new net.minecraftforge.items.wrapper.SidedInvWrapper(this, Direction.UP);
+ }
+
}
public static enum AnimationStatus {
CLOSED,
OPENING,