Merge branch 'master' into future
# Conflicts: # src/main/java/carpet/mixins/PlayerManager_fakePlayersMixin.java
This commit is contained in:
commit
fc4c721510
6 files changed
+48
-15
No files matched your search
@@ -205,13 +205,46 @@ public class CarpetSettings
|
||||
@Rule( desc = "Players absorb XP instantly, without delay", category = CREATIVE )
|
||||
public static boolean xpNoCooldown = false;
|
||||
|
||||
public static class StackableShulkerBoxValidator extends Validator<String>
|
||||
{
|
||||
@Override
|
||||
public String validate(ServerCommandSource source, ParsedRule<String> currentRule, String newValue, String string)
|
||||
{
|
||||
if (newValue.matches("^[0-9]+$")) {
|
||||
int value = Integer.parseInt(newValue);
|
||||
if (value <= 64 && value >= 2) {
|
||||
shulkerBoxStackSize = value;
|
||||
return newValue;
|
||||
}
|
||||
}
|
||||
if (newValue.equalsIgnoreCase("false")) {
|
||||
shulkerBoxStackSize = 1;
|
||||
return newValue;
|
||||
}
|
||||
if (newValue.equalsIgnoreCase("true")) {
|
||||
shulkerBoxStackSize = 64;
|
||||
return newValue;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description()
|
||||
{
|
||||
return "Value must either be true, false, or a number between 2-64";
|
||||
}
|
||||
}
|
||||
|
||||
@Rule(
|
||||
desc = "Empty shulker boxes can stack to 64 when dropped on the ground",
|
||||
desc = "Empty shulker boxes can stack when thrown on the ground.",
|
||||
extra = ".. or when manipulated inside the inventories",
|
||||
validate = StackableShulkerBoxValidator.class,
|
||||
options = {"false", "true", "16"},
|
||||
strict = false,
|
||||
category = {SURVIVAL, FEATURE}
|
||||
)
|
||||
public static boolean stackableShulkerBoxes = false;
|
||||
public static final int SHULKER_STACK_SIZE = 64;
|
||||
public static String stackableShulkerBoxes = "false";
|
||||
public static int shulkerBoxStackSize = 1;
|
||||
|
||||
@Rule( desc = "Explosions won't destroy blocks", category = {CREATIVE, TNT} )
|
||||
public static boolean explosionNoBlockDamage = false;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -62,7 +62,7 @@ public abstract class PlayerManager_fakePlayersMixin
|
||||
@Inject(method = "createPlayer", at = @At(value = "INVOKE", shift = At.Shift.BEFORE,
|
||||
target = "Ljava/util/Iterator;hasNext()Z"), locals = LocalCapture.CAPTURE_FAILHARD)
|
||||
private void newWhileLoop(GameProfile gameProfile_1, CallbackInfoReturnable<ServerPlayerEntity> cir, UUID uUID_1,
|
||||
List list_1, ServerPlayerEntity player, Iterator var5)
|
||||
List list_1, ServerPlayerEntity serverPlayerEntity, Iterator var5)
|
||||
{
|
||||
while (var5.hasNext())
|
||||
{
|
||||
|
||||
@@ -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