Skip to content

Commit

Permalink
Fix shulker boxes (#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
MattiDragon committed May 17, 2023
1 parent be31ea2 commit 2c27469
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
3 changes: 2 additions & 1 deletion changelog/1.4.0+1.19.4.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
* Add compacting drawer
* Add option to control whether drawer retain contents when broken
* Add option to control whether drawer retain contents when broken
* Fix shulker box weirdness
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package io.github.mattidragon.extendeddrawers.mixin;

import io.github.mattidragon.extendeddrawers.item.DrawerItem;
import net.minecraft.block.entity.ShulkerBoxBlockEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.Direction;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

@Mixin(ShulkerBoxBlockEntity.class)
public class ShulkerBoxBlockEntityMixin {
@Inject(method = "canInsert", at = @At("HEAD"), cancellable = true)
private void extended_drawers$fixShulkerBoxInsertion(int slot, ItemStack stack, Direction dir, CallbackInfoReturnable<Boolean> cir) {
if (stack.getItem() instanceof DrawerItem item && !item.canBeNested()) {
cir.setReturnValue(false);
}
}
}
3 changes: 2 additions & 1 deletion src/main/resources/extended_drawers.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"DataPackContentsMixin",
"ItemStackMixin",
"RecipeManagerMixin",
"ServerPlayerInteractionManagerMixin"
"ServerPlayerInteractionManagerMixin",
"ShulkerBoxBlockEntityMixin"
],
"client": [
"ClientPlayerInteractionManagerMixin"
Expand Down

0 comments on commit 2c27469

Please sign in to comment.