shulker stacks can now be moved in 1.17, fixes #976
This commit is contained in:
1 parent
b39dd6ea49
commit
3affa8d5c8
4 files changed
+29
-1
No files matched your search
@@ -196,6 +196,7 @@ public class CarpetSettings
|
||||
category = {SURVIVAL, FEATURE}
|
||||
)
|
||||
public static boolean stackableShulkerBoxes = false;
|
||||
public static final int SHULKER_STACK_SIZE = 64;
|
||||
|
||||
@Rule( desc = "Explosions won't destroy blocks", category = {CREATIVE, TNT} )
|
||||
public static boolean explosionNoBlockDamage = false;
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package carpet.mixins;
|
||||
|
||||
import carpet.CarpetSettings;
|
||||
import net.minecraft.block.ShulkerBoxBlock;
|
||||
import net.minecraft.item.BlockItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.screen.slot.Slot;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
||||
@Mixin(Slot.class)
|
||||
public class Slot_stackableSBoxesMixin {
|
||||
@Redirect(method = "insertStack(Lnet/minecraft/item/ItemStack;I)Lnet/minecraft/item/ItemStack;", at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Lnet/minecraft/screen/slot/Slot;getMaxItemCount(Lnet/minecraft/item/ItemStack;)I"
|
||||
))
|
||||
private int getMaxCountForSboxes(Slot slot, ItemStack stack)
|
||||
{
|
||||
if (CarpetSettings.stackableShulkerBoxes && stack.getItem() instanceof BlockItem && ((BlockItem)stack.getItem()).getBlock() instanceof ShulkerBoxBlock)
|
||||
{
|
||||
return CarpetSettings.SHULKER_STACK_SIZE;
|
||||
}
|
||||
return slot.getMaxItemCount(stack);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user