shulker stacks can now be moved in 1.17, fixes #976

This commit is contained in:
gnembon committed 2021-07-05 16:28:59 -03:00
1 parent b39dd6ea49
commit 3affa8d5c8
4 files changed
+29 -1

No files matched your search

+1 -1
View File
@@ -5,7 +5,7 @@ org.gradle.jvmargs=-Xmx1G
# check these on https://fabricmc.net/use # check these on https://fabricmc.net/use
# or better: https://modmuss50.me/fabric.html # or better: https://modmuss50.me/fabric.html
minecraft_version=1.17.1-rc1 minecraft_version=1.17.1-rc1
yarn_mappings=1.17.1-rc1+build.1 yarn_mappings=1.17.1-rc1+build.8
loader_version=0.11.6 loader_version=0.11.6
fabric_version=0.36.0+1.17 fabric_version=0.36.0+1.17
+1
View File
@@ -196,6 +196,7 @@ public class CarpetSettings
category = {SURVIVAL, FEATURE} category = {SURVIVAL, FEATURE}
) )
public static boolean stackableShulkerBoxes = false; public static boolean stackableShulkerBoxes = false;
public static final int SHULKER_STACK_SIZE = 64;
@Rule( desc = "Explosions won't destroy blocks", category = {CREATIVE, TNT} ) @Rule( desc = "Explosions won't destroy blocks", category = {CREATIVE, TNT} )
public static boolean explosionNoBlockDamage = false; 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);
}
}
+1
View File
@@ -136,6 +136,7 @@
"ClientConnectionMixin", "ClientConnectionMixin",
"CauldronBlock_stackableSBoxesMixin", "CauldronBlock_stackableSBoxesMixin",
"AbstractCauldronBlock_stackableSBoxesMixin", "AbstractCauldronBlock_stackableSBoxesMixin",
"Slot_stackableSBoxesMixin",
"ItemEntityMixin", "ItemEntityMixin",
"TntBlockMixin", "TntBlockMixin",
"ExplosionMixin", "ExplosionMixin",