Shulker box stack size is now configurable (#1254)
This commit is contained in:
1 parent
3f6ddc43e5
commit
068a42292f
5 files changed
+47
-14
No files matched your search
@@ -23,7 +23,7 @@ public class AbstractCauldronBlock_stackableSBoxesMixin
|
||||
private ActionResult wrapInteractor(CauldronBehavior cauldronBehavior, BlockState blockState, World world, BlockPos blockPos, PlayerEntity playerEntity, Hand hand, ItemStack itemStack)
|
||||
{
|
||||
int count = -1;
|
||||
if (CarpetSettings.stackableShulkerBoxes && itemStack.getItem() instanceof BlockItem && ((BlockItem)itemStack.getItem()).getBlock() instanceof ShulkerBoxBlock)
|
||||
if (CarpetSettings.shulkerBoxStackSize > 1 && itemStack.getItem() instanceof BlockItem && ((BlockItem)itemStack.getItem()).getBlock() instanceof ShulkerBoxBlock)
|
||||
count = itemStack.getCount();
|
||||
ActionResult result = cauldronBehavior.interact(blockState, world, blockPos, playerEntity, hand, itemStack);
|
||||
if (count > 0 && result.isAccepted())
|
||||
|
||||
@@ -50,7 +50,7 @@ public abstract class ItemEntityMixin extends Entity implements ItemEntityInterf
|
||||
@Inject(method="<init>(Lnet/minecraft/world/World;DDDLnet/minecraft/item/ItemStack;)V", at = @At("RETURN"))
|
||||
private void removeEmptyShulkerBoxTags(World worldIn, double x, double y, double z, ItemStack stack, CallbackInfo ci)
|
||||
{
|
||||
if (CarpetSettings.stackableShulkerBoxes
|
||||
if (CarpetSettings.shulkerBoxStackSize > 1
|
||||
&& stack.getItem() instanceof BlockItem
|
||||
&& ((BlockItem)stack.getItem()).getBlock() instanceof ShulkerBoxBlock)
|
||||
{
|
||||
@@ -68,8 +68,8 @@ public abstract class ItemEntityMixin extends Entity implements ItemEntityInterf
|
||||
)
|
||||
)
|
||||
private int getItemStackMaxAmount(ItemStack stack) {
|
||||
if (CarpetSettings.stackableShulkerBoxes && stack.getItem() instanceof BlockItem && ((BlockItem)stack.getItem()).getBlock() instanceof ShulkerBoxBlock)
|
||||
return SHULKERBOX_MAX_STACK_AMOUNT;
|
||||
if (CarpetSettings.shulkerBoxStackSize > 1 && stack.getItem() instanceof BlockItem && ((BlockItem)stack.getItem()).getBlock() instanceof ShulkerBoxBlock)
|
||||
return CarpetSettings.shulkerBoxStackSize;
|
||||
|
||||
return stack.getMaxCount();
|
||||
}
|
||||
@@ -83,7 +83,7 @@ public abstract class ItemEntityMixin extends Entity implements ItemEntityInterf
|
||||
{
|
||||
ItemEntity self = (ItemEntity)(Object)this;
|
||||
ItemStack selfStack = self.getStack();
|
||||
if (!CarpetSettings.stackableShulkerBoxes || !(selfStack.getItem() instanceof BlockItem) || !(((BlockItem)selfStack.getItem()).getBlock() instanceof ShulkerBoxBlock)) {
|
||||
if (CarpetSettings.shulkerBoxStackSize == 1 || !(selfStack.getItem() instanceof BlockItem) || !(((BlockItem)selfStack.getItem()).getBlock() instanceof ShulkerBoxBlock)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -92,9 +92,9 @@ public abstract class ItemEntityMixin extends Entity implements ItemEntityInterf
|
||||
&& !InventoryHelper.shulkerBoxHasItems(selfStack)
|
||||
&& !InventoryHelper.shulkerBoxHasItems(otherStack)
|
||||
&& selfStack.hasNbt() == otherStack.hasNbt()
|
||||
&& selfStack.getCount() + otherStack.getCount() <= SHULKERBOX_MAX_STACK_AMOUNT)
|
||||
&& selfStack.getCount() + otherStack.getCount() <= CarpetSettings.shulkerBoxStackSize)
|
||||
{
|
||||
int amount = Math.min(otherStack.getCount(), SHULKERBOX_MAX_STACK_AMOUNT - selfStack.getCount());
|
||||
int amount = Math.min(otherStack.getCount(), CarpetSettings.shulkerBoxStackSize - selfStack.getCount());
|
||||
|
||||
selfStack.increment(amount);
|
||||
self.setStack(selfStack);
|
||||
|
||||
@@ -20,13 +20,13 @@ public class ScreenHandler_stackableSBoxesMixin
|
||||
))
|
||||
private int getMaxCountForSboxesInScreenHander(Slot slot, ItemStack stack)
|
||||
{
|
||||
if (CarpetSettings.stackableShulkerBoxes &&
|
||||
if (CarpetSettings.shulkerBoxStackSize > 1 &&
|
||||
stack.getItem() instanceof BlockItem &&
|
||||
((BlockItem)stack.getItem()).getBlock() instanceof ShulkerBoxBlock &&
|
||||
!InventoryHelper.shulkerBoxHasItems(stack)
|
||||
)
|
||||
{
|
||||
return CarpetSettings.SHULKER_STACK_SIZE;
|
||||
return CarpetSettings.shulkerBoxStackSize;
|
||||
}
|
||||
return slot.getMaxItemCount(stack);
|
||||
}
|
||||
|
||||
@@ -18,13 +18,13 @@ public class Slot_stackableSBoxesMixin {
|
||||
))
|
||||
private int getMaxCountForSboxesInSlot(Slot slot, ItemStack stack)
|
||||
{
|
||||
if (CarpetSettings.stackableShulkerBoxes &&
|
||||
if (CarpetSettings.shulkerBoxStackSize > 1 &&
|
||||
stack.getItem() instanceof BlockItem &&
|
||||
((BlockItem)stack.getItem()).getBlock() instanceof ShulkerBoxBlock &&
|
||||
!InventoryHelper.shulkerBoxHasItems(stack)
|
||||
)
|
||||
{
|
||||
return CarpetSettings.SHULKER_STACK_SIZE;
|
||||
return CarpetSettings.shulkerBoxStackSize;
|
||||
}
|
||||
return slot.getMaxItemCount(stack);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user