diff --git a/patches/server/0004-Leaves-Server-Config-And-Command.patch b/patches/server/0004-Leaves-Server-Config-And-Command.patch index e72071c9..2513f40e 100644 --- a/patches/server/0004-Leaves-Server-Config-And-Command.patch +++ b/patches/server/0004-Leaves-Server-Config-And-Command.patch @@ -128,10 +128,10 @@ index e1c99d941c7bb954bf3ac83d5002dbf58fd833b0..4760b943da08771a42fcb22eba4d586d .withRequiredArg() diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java new file mode 100644 -index 0000000000000000000000000000000000000000..1486bf1c37cbacb6643379cbd555f8a9e8bc54ba +index 0000000000000000000000000000000000000000..785e2aa78a4d1288549a0304952c2bdb1c3ec358 --- /dev/null +++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java -@@ -0,0 +1,968 @@ +@@ -0,0 +1,979 @@ +package top.leavesmc.leaves; + +import com.destroystokyo.paper.util.SneakyThrow; @@ -158,7 +158,7 @@ index 0000000000000000000000000000000000000000..1486bf1c37cbacb6643379cbd555f8a9 +public final class LeavesConfig { + + public static final String CONFIG_HEADER = "Configuration file for Leaves."; -+ public static final int CURRENT_CONFIG_VERSION = 3; ++ public static final int CURRENT_CONFIG_VERSION = 4; + + private static final Object[] EMPTY = new Object[0]; + @@ -258,6 +258,12 @@ index 0000000000000000000000000000000000000000..1486bf1c37cbacb6643379cbd555f8a9 + config.set("settings.modify.player-can-edit-sign", null); + config.set("settings.performance.skip-clone-loot-parameters", null); + } ++ ++ case 3 -> { ++ boolean carpetAlternative = config.getBoolean("settings.protocol.carpet-alternative-block-placement", false); ++ alternativeBlockPlacement = carpetAlternative ? "CARPET" : "NONE"; ++ config.set("settings.protocol.carpet-alternative-block-placement", null); ++ } + } + } + } @@ -557,9 +563,14 @@ index 0000000000000000000000000000000000000000..1486bf1c37cbacb6643379cbd555f8a9 + jadeProtocol = getBoolean("settings.protocol.jade-protocol", jadeProtocol); + } + -+ public static boolean carpetAlternativeBlockPlacement = false; -+ private static void carpetAlternativeBlockPlacement() { -+ carpetAlternativeBlockPlacement = getBoolean("settings.protocol.carpet-alternative-block-placement", carpetAlternativeBlockPlacement); ++ public static String alternativeBlockPlacement = "NONE"; ++ private static final List alternativeBlockPlacementType = List.of("NONE", "CARPET", "CARPET_FIX", "LITEMATICA"); ++ private static void alternativeBlockPlacement() { ++ alternativeBlockPlacement = getString("settings.protocol.alternative-block-placement", alternativeBlockPlacement); ++ if (!alternativeBlockPlacementType.contains(alternativeBlockPlacement)) { ++ alternativeBlockPlacement = "NONE"; ++ LeavesLogger.LOGGER.severe("alternative-block-placement value error, reset to NONE"); ++ } + } + + public static boolean playerOperationLimiter = false; @@ -665,7 +676,7 @@ index 0000000000000000000000000000000000000000..1486bf1c37cbacb6643379cbd555f8a9 + public static boolean disableDistanceCheckForUseItem = false; + private static void disableDistanceCheckForUseItem() { + disableDistanceCheckForUseItem = getBoolean("settings.modify.disable-distance-check-for-use-item", disableDistanceCheckForUseItem); -+ if (carpetAlternativeBlockPlacement) { ++ if (!alternativeBlockPlacement.equals("NONE")) { + disableDistanceCheckForUseItem = true; + } + } diff --git a/patches/server/0019-Multithreaded-Tracker.patch b/patches/server/0019-Multithreaded-Tracker.patch index f5faf9ea..b9a65bf8 100644 --- a/patches/server/0019-Multithreaded-Tracker.patch +++ b/patches/server/0019-Multithreaded-Tracker.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Multithreaded Tracker This patch is Powered by Pufferfish(https://github.com/pufferfish-gg/Pufferfish) diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java -index 5b8ef14e023059466f95b7ee7c2420bababdd0e2..181b74206ec8baeff6820ca8c27d1245d3f3d335 100644 +index b43c8921f63c4c8d87ceb05da2f1a64392f0ee03..3f1716583d7cd36174a28d40c19248531963c960 100644 --- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java +++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java -@@ -250,7 +250,7 @@ public final class LeavesConfig { +@@ -256,7 +256,7 @@ public final class LeavesConfig { dontSendUselessEntityPackets = getBoolean("settings.performance.dont-send-useless-entity-packets", dontSendUselessEntityPackets); } diff --git a/patches/server/0037-Async-Pathfinding.patch b/patches/server/0037-Async-Pathfinding.patch index f3e87285..127e13ad 100644 --- a/patches/server/0037-Async-Pathfinding.patch +++ b/patches/server/0037-Async-Pathfinding.patch @@ -7,10 +7,10 @@ This patch is Powered by Pufferfish(https://github.com/pufferfish-gg/Pufferfish) But Pufferfish patch was ported downstream from the Petal fork diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java -index 181b74206ec8baeff6820ca8c27d1245d3f3d335..475b3b5bcc8828c6ba2a4a6d7b2476548e13efcc 100644 +index 3f1716583d7cd36174a28d40c19248531963c960..4a7557e450560bb7e8785370cd6abaaff32fa07f 100644 --- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java +++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java -@@ -351,7 +351,7 @@ public final class LeavesConfig { +@@ -357,7 +357,7 @@ public final class LeavesConfig { // only config now public static boolean asyncPathfinding = false; private static boolean asyncPathfindingLock = false; diff --git a/patches/server/0048-Alternative-block-placement-Protocol.patch b/patches/server/0048-Alternative-block-placement-Protocol.patch new file mode 100644 index 00000000..f8bb2101 --- /dev/null +++ b/patches/server/0048-Alternative-block-placement-Protocol.patch @@ -0,0 +1,504 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: violetc <58360096+s-yh-china@users.noreply.github.com> +Date: Thu, 8 Dec 2022 19:40:00 +0800 +Subject: [PATCH] Alternative block placement Protocol + +This patch is Powered by +carpet-extra(https://github.com/gnembon/carpet-extra) +MasaGadget(https://github.com/plusls/MasaGadget) +litematica(https://github.com/maruohon/litematica) + +diff --git a/src/main/java/net/minecraft/world/item/BlockItem.java b/src/main/java/net/minecraft/world/item/BlockItem.java +index ebee8de2ed831755b6fd154f6cc77ac993839bb9..6227a4733683ed9a9fa300ab010ce84a17d3b1c2 100644 +--- a/src/main/java/net/minecraft/world/item/BlockItem.java ++++ b/src/main/java/net/minecraft/world/item/BlockItem.java +@@ -158,7 +158,7 @@ public class BlockItem extends Item { + + @Nullable + protected BlockState getPlacementState(BlockPlaceContext context) { +- BlockState iblockdata = this.getBlock().getStateForPlacement(context); ++ BlockState iblockdata = this.getBlock().getRealStateForPlacement(context); // Leaves - alternativeBlockPlacement + + return iblockdata != null && this.canPlace(context, iblockdata) ? iblockdata : null; + } +diff --git a/src/main/java/net/minecraft/world/item/StandingAndWallBlockItem.java b/src/main/java/net/minecraft/world/item/StandingAndWallBlockItem.java +index 39b8b3675ac58409e05fac07e07c8016c5280d81..0399aa4a3637bfe8d5817c7fc114fc7d18dc5116 100644 +--- a/src/main/java/net/minecraft/world/item/StandingAndWallBlockItem.java ++++ b/src/main/java/net/minecraft/world/item/StandingAndWallBlockItem.java +@@ -34,7 +34,7 @@ public class StandingAndWallBlockItem extends BlockItem { + @Nullable + @Override + protected BlockState getPlacementState(BlockPlaceContext context) { +- BlockState iblockdata = this.wallBlock.getStateForPlacement(context); ++ BlockState iblockdata = this.wallBlock.getRealStateForPlacement(context); // Leaves - alternativeBlockPlacement + BlockState iblockdata1 = null; + Level world = context.getLevel(); + BlockPos blockposition = context.getClickedPos(); +@@ -45,7 +45,7 @@ public class StandingAndWallBlockItem extends BlockItem { + Direction enumdirection = aenumdirection[j]; + + if (enumdirection != this.attachmentDirection.getOpposite()) { +- BlockState iblockdata2 = enumdirection == this.attachmentDirection ? this.getBlock().getStateForPlacement(context) : iblockdata; ++ BlockState iblockdata2 = enumdirection == this.attachmentDirection ? this.getBlock().getRealStateForPlacement(context) : iblockdata; // Leaves - carpetAlternativeBlockPlacement + + if (iblockdata2 != null && this.canPlace(world, iblockdata2, blockposition)) { + iblockdata1 = iblockdata2; +diff --git a/src/main/java/net/minecraft/world/level/block/Block.java b/src/main/java/net/minecraft/world/level/block/Block.java +index 72cece40c531372954ab07b2fa99ed50dc3ff3cc..d13e665a1f2fa4b671894a8c708e8e7ff94af07f 100644 +--- a/src/main/java/net/minecraft/world/level/block/Block.java ++++ b/src/main/java/net/minecraft/world/level/block/Block.java +@@ -411,6 +411,33 @@ public class Block extends BlockBehaviour implements ItemLike { + + public void stepOn(Level world, BlockPos pos, BlockState state, Entity entity) {} + ++ // Leaves start - alternativeBlockPlacement ++ @Nullable ++ public BlockState getRealStateForPlacement(BlockPlaceContext ctx) { ++ BlockState vanillaState = getStateForPlacement(ctx); ++ switch (top.leavesmc.leaves.LeavesConfig.alternativeBlockPlacement) { ++ case "CARPET" -> { ++ BlockState tryState = top.leavesmc.leaves.protocol.CarpetAlternativeBlockPlacement.alternativeBlockPlacement(this, ctx); ++ if (tryState != null) { ++ return tryState; ++ } ++ } ++ case "CARPET_FIX" -> { ++ BlockState tryState = top.leavesmc.leaves.protocol.CarpetAlternativeBlockPlacement.alternativeBlockPlacementFix(this, ctx); ++ if (tryState != null) { ++ return tryState; ++ } ++ } ++ case "LITEMATICA" -> { ++ if (vanillaState != null) { ++ return top.leavesmc.leaves.protocol.LitematicaEasyPlaceProtocol.applyPlacementProtocol(vanillaState, ctx); ++ } ++ } ++ } ++ return vanillaState; ++ } ++ // Leaves end - alternativeBlockPlacement ++ + @Nullable + public BlockState getStateForPlacement(BlockPlaceContext ctx) { + return this.defaultBlockState(); +diff --git a/src/main/java/top/leavesmc/leaves/protocol/CarpetAlternativeBlockPlacement.java b/src/main/java/top/leavesmc/leaves/protocol/CarpetAlternativeBlockPlacement.java +new file mode 100644 +index 0000000000000000000000000000000000000000..dff01bc7495620fecb23d658c4dbd17f96a5819a +--- /dev/null ++++ b/src/main/java/top/leavesmc/leaves/protocol/CarpetAlternativeBlockPlacement.java +@@ -0,0 +1,161 @@ ++package top.leavesmc.leaves.protocol; ++ ++import net.minecraft.core.BlockPos; ++import net.minecraft.core.Direction; ++import net.minecraft.util.Mth; ++import net.minecraft.world.entity.player.Player; ++import net.minecraft.world.item.context.BlockPlaceContext; ++import net.minecraft.world.level.Level; ++import net.minecraft.world.level.block.BedBlock; ++import net.minecraft.world.level.block.Block; ++import net.minecraft.world.level.block.ComparatorBlock; ++import net.minecraft.world.level.block.DirectionalBlock; ++import net.minecraft.world.level.block.DispenserBlock; ++import net.minecraft.world.level.block.GlazedTerracottaBlock; ++import net.minecraft.world.level.block.ObserverBlock; ++import net.minecraft.world.level.block.RepeaterBlock; ++import net.minecraft.world.level.block.StairBlock; ++import net.minecraft.world.level.block.TrapDoorBlock; ++import net.minecraft.world.level.block.piston.PistonBaseBlock; ++import net.minecraft.world.level.block.state.BlockState; ++import net.minecraft.world.level.block.state.properties.BlockStateProperties; ++import net.minecraft.world.level.block.state.properties.ComparatorMode; ++import net.minecraft.world.level.block.state.properties.DirectionProperty; ++import net.minecraft.world.level.block.state.properties.Half; ++import net.minecraft.world.level.block.state.properties.Property; ++import net.minecraft.world.level.block.state.properties.SlabType; ++import net.minecraft.world.phys.Vec3; ++import org.jetbrains.annotations.NotNull; ++ ++import javax.annotation.Nullable; ++import java.util.Objects; ++ ++public class CarpetAlternativeBlockPlacement { ++ ++ @Nullable ++ public static BlockState alternativeBlockPlacement(@NotNull Block block, @NotNull BlockPlaceContext context) { ++ Vec3 hitPos = context.getClickLocation(); ++ BlockPos blockPos = context.getClickedPos(); ++ double relativeHitX = hitPos.x - blockPos.getX(); ++ BlockState state = block.getStateForPlacement(context); ++ ++ if (relativeHitX < 2 || state == null) { ++ return null; ++ } ++ ++ DirectionProperty directionProp = getFirstDirectionProperty(state); ++ int protocolValue = ((int) relativeHitX - 2) / 2; ++ ++ if (directionProp != null) { ++ Direction origFacing = state.getValue(directionProp); ++ Direction facing = origFacing; ++ int facingIndex = protocolValue & 0xF; ++ ++ if (facingIndex == 6) { ++ facing = facing.getOpposite(); ++ } else if (facingIndex <= 5) { ++ facing = Direction.from3DDataValue(facingIndex); ++ } ++ ++ if (!directionProp.getPossibleValues().contains(facing)) { ++ facing = context.getPlayer().getDirection().getOpposite(); ++ } ++ ++ if (facing != origFacing && directionProp.getPossibleValues().contains(facing)) { ++ if (state.getBlock() instanceof BedBlock) { ++ BlockPos headPos = blockPos.relative(facing); ++ ++ if (!context.getLevel().getBlockState(headPos).canBeReplaced(context)) { ++ return null; ++ } ++ } ++ ++ state = state.setValue(directionProp, facing); ++ } ++ } else if (state.hasProperty(BlockStateProperties.AXIS)) { ++ Direction.Axis axis = Direction.Axis.VALUES[protocolValue % 3]; ++ state = state.setValue(BlockStateProperties.AXIS, axis); ++ } ++ ++ protocolValue &= 0xFFFFFFF0; ++ ++ if (protocolValue >= 16) { ++ if (block instanceof RepeaterBlock) { ++ Integer delay = (protocolValue / 16); ++ ++ if (RepeaterBlock.DELAY.getPossibleValues().contains(delay)) { ++ state = state.setValue(RepeaterBlock.DELAY, delay); ++ } ++ } else if (protocolValue == 16) { ++ if (block instanceof ComparatorBlock) { ++ state = state.setValue(ComparatorBlock.MODE, ComparatorMode.SUBTRACT); ++ } else if (state.hasProperty(BlockStateProperties.HALF) && state.getValue(BlockStateProperties.HALF) == Half.BOTTOM) { ++ state = state.setValue(BlockStateProperties.HALF, Half.TOP); ++ } else if (state.hasProperty(BlockStateProperties.SLAB_TYPE) && state.getValue(BlockStateProperties.SLAB_TYPE) == SlabType.BOTTOM) { ++ state = state.setValue(BlockStateProperties.SLAB_TYPE, SlabType.TOP); ++ } ++ } ++ } ++ ++ return state; ++ } ++ ++ public static BlockState alternativeBlockPlacementFix(Block block, BlockPlaceContext context) { ++ Direction facing; ++ Vec3 vec3d = context.getClickLocation(); ++ BlockPos pos = context.getClickedPos(); ++ double hitX = vec3d.x - pos.getX(); ++ if (hitX < 2) { ++ return null; ++ } ++ int code = (int) (hitX - 2) / 2; ++ Player placer = Objects.requireNonNull(context.getPlayer()); ++ Level world = context.getLevel(); ++ ++ if (block instanceof GlazedTerracottaBlock) { ++ facing = Direction.from3DDataValue(code); ++ if (facing == Direction.UP || facing == Direction.DOWN) { ++ facing = placer.getDirection().getOpposite(); ++ } ++ return block.defaultBlockState().setValue(GlazedTerracottaBlock.FACING, facing); ++ } else if (block instanceof ObserverBlock) { ++ return block.defaultBlockState().setValue(ObserverBlock.FACING, Direction.from3DDataValue(code)).setValue(ObserverBlock.POWERED, true); ++ } else if (block instanceof RepeaterBlock) { ++ facing = Direction.from3DDataValue(code % 16); ++ if (facing == Direction.UP || facing == Direction.DOWN) { ++ facing = placer.getDirection().getOpposite(); ++ } ++ return block.defaultBlockState().setValue(RepeaterBlock.FACING, facing).setValue(RepeaterBlock.DELAY, Mth.clamp(code / 16, 1, 4)).setValue(RepeaterBlock.LOCKED, Boolean.FALSE); ++ } else if (block instanceof TrapDoorBlock) { ++ facing = Direction.from3DDataValue(code % 16); ++ if (facing == Direction.UP || facing == Direction.DOWN) { ++ facing = placer.getDirection().getOpposite(); ++ } ++ return block.defaultBlockState().setValue(TrapDoorBlock.FACING, facing).setValue(TrapDoorBlock.OPEN, Boolean.FALSE).setValue(TrapDoorBlock.HALF, (code >= 16) ? Half.TOP : Half.BOTTOM).setValue(TrapDoorBlock.OPEN, world.hasNeighborSignal(pos)); ++ } else if (block instanceof ComparatorBlock) { ++ facing = Direction.from3DDataValue(code % 16); ++ if ((facing == Direction.UP) || (facing == Direction.DOWN)) { ++ facing = placer.getDirection().getOpposite(); ++ } ++ ComparatorMode m = (hitX >= 16) ? ComparatorMode.SUBTRACT : ComparatorMode.COMPARE; ++ return block.defaultBlockState().setValue(ComparatorBlock.FACING, facing).setValue(ComparatorBlock.POWERED, Boolean.FALSE).setValue(ComparatorBlock.MODE, m); ++ } else if (block instanceof DispenserBlock) { ++ return block.defaultBlockState().setValue(DispenserBlock.FACING, Direction.from3DDataValue(code)).setValue(DispenserBlock.TRIGGERED, Boolean.FALSE); ++ } else if (block instanceof PistonBaseBlock) { ++ return block.defaultBlockState().setValue(DirectionalBlock.FACING, Direction.from3DDataValue(code)).setValue(PistonBaseBlock.EXTENDED, Boolean.FALSE); ++ } else if (block instanceof StairBlock) { ++ return Objects.requireNonNull(block.getStateForPlacement(context)).setValue(StairBlock.FACING, Direction.from3DDataValue(code % 16)).setValue(StairBlock.HALF, (hitX >= 16) ? Half.TOP : Half.BOTTOM); ++ } ++ return null; ++ } ++ ++ @Nullable ++ public static DirectionProperty getFirstDirectionProperty(@NotNull BlockState state) { ++ for (Property prop : state.getProperties()) { ++ if (prop instanceof DirectionProperty) { ++ return (DirectionProperty) prop; ++ } ++ } ++ return null; ++ } ++} +diff --git a/src/main/java/top/leavesmc/leaves/protocol/LitematicaEasyPlaceProtocol.java b/src/main/java/top/leavesmc/leaves/protocol/LitematicaEasyPlaceProtocol.java +new file mode 100644 +index 0000000000000000000000000000000000000000..8463318fcad637c409679707b2adf0648ba5a173 +--- /dev/null ++++ b/src/main/java/top/leavesmc/leaves/protocol/LitematicaEasyPlaceProtocol.java +@@ -0,0 +1,214 @@ ++package top.leavesmc.leaves.protocol; ++ ++import com.google.common.collect.ImmutableSet; ++import net.minecraft.core.BlockPos; ++import net.minecraft.core.Direction; ++import net.minecraft.world.InteractionHand; ++import net.minecraft.world.entity.LivingEntity; ++import net.minecraft.world.item.context.BlockPlaceContext; ++import net.minecraft.world.level.Level; ++import net.minecraft.world.level.block.BedBlock; ++import net.minecraft.world.level.block.state.BlockState; ++import net.minecraft.world.level.block.state.properties.BlockStateProperties; ++import net.minecraft.world.level.block.state.properties.DirectionProperty; ++import net.minecraft.world.level.block.state.properties.Property; ++import net.minecraft.world.level.block.state.properties.SlabType; ++import net.minecraft.world.phys.Vec3; ++import top.leavesmc.leaves.LeavesLogger; ++import top.leavesmc.leaves.util.MathUtils; ++ ++import javax.annotation.Nullable; ++import java.util.ArrayList; ++import java.util.Comparator; ++import java.util.List; ++ ++public class LitematicaEasyPlaceProtocol { ++ ++ public static final ImmutableSet> WHITELISTED_PROPERTIES = ImmutableSet.of( ++ // BooleanProperty: ++ // INVERTED - DaylightDetector ++ // OPEN - Barrel, Door, FenceGate, Trapdoor ++ // PERSISTENT - Leaves ++ BlockStateProperties.INVERTED, ++ BlockStateProperties.OPEN, ++ BlockStateProperties.PERSISTENT, ++ // EnumProperty: ++ // AXIS - Pillar ++ // BLOCK_HALF - Stairs, Trapdoor ++ // CHEST_TYPE - Chest ++ // COMPARATOR_MODE - Comparator ++ // DOOR_HINGE - Door ++ // SLAB_TYPE - Slab - PARTIAL ONLY: TOP and BOTTOM, not DOUBLE ++ // STAIR_SHAPE - Stairs (needed to get the correct state, otherwise the player facing would be a factor) ++ // WALL_MOUNT_LOCATION - Button, Grindstone, Lever ++ BlockStateProperties.AXIS, ++ BlockStateProperties.HALF, ++ BlockStateProperties.CHEST_TYPE, ++ BlockStateProperties.MODE_COMPARATOR, ++ BlockStateProperties.DOOR_HINGE, ++ BlockStateProperties.SLAB_TYPE, ++ BlockStateProperties.STAIRS_SHAPE, ++ BlockStateProperties.ATTACH_FACE, ++ // IntProperty: ++ // BITES - Cake ++ // DELAY - Repeater ++ // NOTE - NoteBlock ++ // ROTATION - Banner, Sign, Skull ++ BlockStateProperties.BITES, ++ BlockStateProperties.DELAY, ++ BlockStateProperties.NOTE, ++ BlockStateProperties.ROTATION_16 ++ ); ++ ++ public static > BlockState applyPlacementProtocol(BlockState state, BlockPlaceContext context) { ++ return applyPlacementProtocolV3(state, UseContext.from(context, context.getHand())); ++ } ++ ++ private static > BlockState applyPlacementProtocolV3(BlockState state, UseContext context) { ++ int protocolValue = (int) (context.getHitVec().x - (double) context.getPos().getX()) - 2; ++ if (protocolValue < 0) { ++ return state; ++ } ++ ++ @Nullable DirectionProperty property = getFirstDirectionProperty(state); ++ ++ if (property != null && property != BlockStateProperties.VERTICAL_DIRECTION) { ++ state = applyDirectionProperty(state, context, property, protocolValue); ++ ++ if (state == null) { ++ return null; ++ } ++ ++ protocolValue >>>= 3; ++ } ++ ++ protocolValue >>>= 1; ++ ++ List> propList = new ArrayList<>(state.getBlock().getStateDefinition().getProperties()); ++ propList.sort(Comparator.comparing(Property::getName)); ++ ++ try { ++ for (Property p : propList) { ++ if (!(p instanceof DirectionProperty) && WHITELISTED_PROPERTIES.contains(p)) { ++ @SuppressWarnings("unchecked") Property prop = (Property) p; ++ List list = new ArrayList<>(prop.getPossibleValues()); ++ list.sort(Comparable::compareTo); ++ ++ int requiredBits = MathUtils.floorLog2(MathUtils.smallestEncompassingPowerOfTwo(list.size())); ++ int bitMask = ~(0xFFFFFFFF << requiredBits); ++ int valueIndex = protocolValue & bitMask; ++ ++ if (valueIndex >= 0 && valueIndex < list.size()) { ++ T value = list.get(valueIndex); ++ ++ if (!state.getValue(prop).equals(value) && value != SlabType.DOUBLE) { ++ state = state.setValue(prop, value); ++ } ++ ++ protocolValue >>>= requiredBits; ++ } ++ } ++ } ++ } catch (Exception e) { ++ LeavesLogger.LOGGER.warning("Exception trying to apply placement protocol value"); ++ } ++ ++ return state; ++ } ++ ++ private static BlockState applyDirectionProperty(BlockState state, UseContext context, DirectionProperty property, int protocolValue) { ++ Direction facingOrig = state.getValue(property); ++ Direction facing = facingOrig; ++ int decodedFacingIndex = (protocolValue & 0xF) >> 1; ++ ++ if (decodedFacingIndex == 6) { ++ facing = facing.getOpposite(); ++ } else if (decodedFacingIndex >= 0 && decodedFacingIndex <= 5) { ++ facing = Direction.from3DDataValue(decodedFacingIndex); ++ ++ if (!property.getPossibleValues().contains(facing)) { ++ facing = context.getEntity().getDirection().getOpposite(); ++ } ++ } ++ ++ if (facing != facingOrig && property.getPossibleValues().contains(facing)) { ++ if (state.getBlock() instanceof BedBlock) { ++ BlockPos headPos = context.pos.relative(facing); ++ BlockPlaceContext ctx = context.getItemPlacementContext(); ++ ++ if (ctx == null || !context.getWorld().getBlockState(headPos).canBeReplaced(ctx)) { ++ return null; ++ } ++ } ++ ++ state = state.setValue(property, facing); ++ } ++ ++ return state; ++ } ++ ++ private static DirectionProperty getFirstDirectionProperty(BlockState state) { ++ for (Property prop : state.getProperties()) { ++ if (prop instanceof DirectionProperty) { ++ return (DirectionProperty) prop; ++ } ++ } ++ return null; ++ } ++ ++ public static class UseContext { ++ ++ private final Level world; ++ private final BlockPos pos; ++ private final Direction side; ++ private final Vec3 hitVec; ++ private final LivingEntity entity; ++ private final InteractionHand hand; ++ @Nullable ++ private final BlockPlaceContext itemPlacementContext; ++ ++ private UseContext(Level world, BlockPos pos, Direction side, Vec3 hitVec, LivingEntity entity, InteractionHand hand, @Nullable BlockPlaceContext itemPlacementContext) { ++ this.world = world; ++ this.pos = pos; ++ this.side = side; ++ this.hitVec = hitVec; ++ this.entity = entity; ++ this.hand = hand; ++ this.itemPlacementContext = itemPlacementContext; ++ } ++ ++ public static UseContext from(BlockPlaceContext ctx, InteractionHand hand) { ++ Vec3 pos = ctx.getClickLocation(); ++ return new UseContext(ctx.getLevel(), ctx.getClickedPos(), ctx.getClickedFace(), new Vec3(pos.x, pos.y, pos.z), ctx.getPlayer(), hand, ctx); ++ } ++ ++ public Level getWorld() { ++ return this.world; ++ } ++ ++ public BlockPos getPos() { ++ return this.pos; ++ } ++ ++ public Direction getSide() { ++ return this.side; ++ } ++ ++ public Vec3 getHitVec() { ++ return this.hitVec; ++ } ++ ++ public LivingEntity getEntity() { ++ return this.entity; ++ } ++ ++ public InteractionHand getHand() { ++ return this.hand; ++ } ++ ++ @Nullable ++ public BlockPlaceContext getItemPlacementContext() { ++ return this.itemPlacementContext; ++ } ++ } ++} +diff --git a/src/main/java/top/leavesmc/leaves/util/MathUtils.java b/src/main/java/top/leavesmc/leaves/util/MathUtils.java +index 349cd0c0d2d9dc2c9c745ef3469e548a798931ba..0f57d18ee124da23d42abe8cee55a50f4d244615 100644 +--- a/src/main/java/top/leavesmc/leaves/util/MathUtils.java ++++ b/src/main/java/top/leavesmc/leaves/util/MathUtils.java +@@ -75,4 +75,29 @@ public class MathUtils { + + return vector; + } ++ ++ private static final int[] MULTIPLY_DE_BRUIJN_BIT_POSITION = new int[]{0, 1, 28, 2, 29, 14, 24, 3, 30, 22, 20, 15, 25, 17, 4, 8, 31, 27, 13, 23, 21, 19, 16, 7, 26, 12, 18, 6, 11, 5, 10, 9}; ++ ++ public static int floorLog2(int value) { ++ return ceilLog2(value) - (isPowerOfTwo(value) ? 0 : 1); ++ } ++ ++ public static int ceilLog2(int value) { ++ value = isPowerOfTwo(value) ? value : smallestEncompassingPowerOfTwo(value); ++ return MULTIPLY_DE_BRUIJN_BIT_POSITION[(int)((long)value * 125613361L >> 27) & 31]; ++ } ++ ++ public static boolean isPowerOfTwo(int value) { ++ return value != 0 && (value & value - 1) == 0; ++ } ++ ++ public static int smallestEncompassingPowerOfTwo(int value) { ++ int i = value - 1; ++ i |= i >> 1; ++ i |= i >> 2; ++ i |= i >> 4; ++ i |= i >> 8; ++ i |= i >> 16; ++ return i + 1; ++ } + } diff --git a/patches/server/0048-Carpet-alternative-block-placement-Protocol.patch b/patches/server/0048-Carpet-alternative-block-placement-Protocol.patch deleted file mode 100644 index a0a90acc..00000000 --- a/patches/server/0048-Carpet-alternative-block-placement-Protocol.patch +++ /dev/null @@ -1,173 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: violetc <58360096+s-yh-china@users.noreply.github.com> -Date: Thu, 8 Dec 2022 19:40:00 +0800 -Subject: [PATCH] Carpet alternative block placement Protocol - -This patch is Powered by carpet-extra(https://github.com/gnembon/carpet-extra) - -diff --git a/src/main/java/net/minecraft/world/item/BlockItem.java b/src/main/java/net/minecraft/world/item/BlockItem.java -index ebee8de2ed831755b6fd154f6cc77ac993839bb9..1015b3c5f6969709bb8ebfbd66eb9cede444385c 100644 ---- a/src/main/java/net/minecraft/world/item/BlockItem.java -+++ b/src/main/java/net/minecraft/world/item/BlockItem.java -@@ -158,7 +158,7 @@ public class BlockItem extends Item { - - @Nullable - protected BlockState getPlacementState(BlockPlaceContext context) { -- BlockState iblockdata = this.getBlock().getStateForPlacement(context); -+ BlockState iblockdata = this.getBlock().getRealStateForPlacement(context); // Leaves - carpetAlternativeBlockPlacement - - return iblockdata != null && this.canPlace(context, iblockdata) ? iblockdata : null; - } -diff --git a/src/main/java/net/minecraft/world/item/StandingAndWallBlockItem.java b/src/main/java/net/minecraft/world/item/StandingAndWallBlockItem.java -index 39b8b3675ac58409e05fac07e07c8016c5280d81..928b1ece5b094dee8a5e37bfd3afd626cb1bd03a 100644 ---- a/src/main/java/net/minecraft/world/item/StandingAndWallBlockItem.java -+++ b/src/main/java/net/minecraft/world/item/StandingAndWallBlockItem.java -@@ -34,7 +34,7 @@ public class StandingAndWallBlockItem extends BlockItem { - @Nullable - @Override - protected BlockState getPlacementState(BlockPlaceContext context) { -- BlockState iblockdata = this.wallBlock.getStateForPlacement(context); -+ BlockState iblockdata = this.wallBlock.getRealStateForPlacement(context); // Leaves - carpetAlternativeBlockPlacement - BlockState iblockdata1 = null; - Level world = context.getLevel(); - BlockPos blockposition = context.getClickedPos(); -@@ -45,7 +45,7 @@ public class StandingAndWallBlockItem extends BlockItem { - Direction enumdirection = aenumdirection[j]; - - if (enumdirection != this.attachmentDirection.getOpposite()) { -- BlockState iblockdata2 = enumdirection == this.attachmentDirection ? this.getBlock().getStateForPlacement(context) : iblockdata; -+ BlockState iblockdata2 = enumdirection == this.attachmentDirection ? this.getBlock().getRealStateForPlacement(context) : iblockdata; // Leaves - carpetAlternativeBlockPlacement - - if (iblockdata2 != null && this.canPlace(world, iblockdata2, blockposition)) { - iblockdata1 = iblockdata2; -diff --git a/src/main/java/net/minecraft/world/level/block/Block.java b/src/main/java/net/minecraft/world/level/block/Block.java -index 9522e646529f3d849471931b4b3c0d133e7fcfc5..5cf87860455ca05363685c192dc34a273edc2469 100644 ---- a/src/main/java/net/minecraft/world/level/block/Block.java -+++ b/src/main/java/net/minecraft/world/level/block/Block.java -@@ -411,6 +411,19 @@ public class Block extends BlockBehaviour implements ItemLike { - - public void stepOn(Level world, BlockPos pos, BlockState state, Entity entity) {} - -+ // Leaves start - carpetAlternativeBlockPlacement -+ @Nullable -+ public BlockState getRealStateForPlacement(BlockPlaceContext ctx) { -+ if (top.leavesmc.leaves.LeavesConfig.carpetAlternativeBlockPlacement) { -+ BlockState tryState = top.leavesmc.leaves.protocol.CarpetAlternativeBlockPlacement.alternativeBlockPlacement(this, ctx); -+ if (tryState != null) { -+ return tryState; -+ } -+ } -+ return getStateForPlacement(ctx); -+ } -+ // Leaves end - carpetAlternativeBlockPlacement -+ - @Nullable - public BlockState getStateForPlacement(BlockPlaceContext ctx) { - return this.defaultBlockState(); -diff --git a/src/main/java/top/leavesmc/leaves/protocol/CarpetAlternativeBlockPlacement.java b/src/main/java/top/leavesmc/leaves/protocol/CarpetAlternativeBlockPlacement.java -new file mode 100644 -index 0000000000000000000000000000000000000000..848c380ed3d9755bab680b1e244a6024110bc383 ---- /dev/null -+++ b/src/main/java/top/leavesmc/leaves/protocol/CarpetAlternativeBlockPlacement.java -@@ -0,0 +1,101 @@ -+package top.leavesmc.leaves.protocol; -+ -+import net.minecraft.core.BlockPos; -+import net.minecraft.core.Direction; -+import net.minecraft.world.item.context.BlockPlaceContext; -+import net.minecraft.world.level.block.BedBlock; -+import net.minecraft.world.level.block.Block; -+import net.minecraft.world.level.block.ComparatorBlock; -+import net.minecraft.world.level.block.RepeaterBlock; -+import net.minecraft.world.level.block.state.BlockState; -+import net.minecraft.world.level.block.state.properties.BlockStateProperties; -+import net.minecraft.world.level.block.state.properties.ComparatorMode; -+import net.minecraft.world.level.block.state.properties.DirectionProperty; -+import net.minecraft.world.level.block.state.properties.Half; -+import net.minecraft.world.level.block.state.properties.Property; -+import net.minecraft.world.level.block.state.properties.SlabType; -+import net.minecraft.world.phys.Vec3; -+import org.jetbrains.annotations.NotNull; -+ -+import javax.annotation.Nullable; -+ -+public class CarpetAlternativeBlockPlacement { -+ -+ @Nullable -+ public static BlockState alternativeBlockPlacement(@NotNull Block block, @NotNull BlockPlaceContext context) { -+ Vec3 hitPos = context.getClickLocation(); -+ BlockPos blockPos = context.getClickedPos(); -+ double relativeHitX = hitPos.x - blockPos.getX(); -+ BlockState state = block.getStateForPlacement(context); -+ -+ if (relativeHitX < 2 || state == null) { -+ return null; -+ } -+ -+ DirectionProperty directionProp = getFirstDirectionProperty(state); -+ int protocolValue = ((int) relativeHitX - 2) / 2; -+ -+ if (directionProp != null) { -+ Direction origFacing = state.getValue(directionProp); -+ Direction facing = origFacing; -+ int facingIndex = protocolValue & 0xF; -+ -+ if (facingIndex == 6) { -+ facing = facing.getOpposite(); -+ } else if (facingIndex <= 5) { -+ facing = Direction.from3DDataValue(facingIndex); -+ } -+ -+ if (!directionProp.getPossibleValues().contains(facing)) { -+ facing = context.getPlayer().getDirection().getOpposite(); -+ } -+ -+ if (facing != origFacing && directionProp.getPossibleValues().contains(facing)) { -+ if (state.getBlock() instanceof BedBlock) { -+ BlockPos headPos = blockPos.relative(facing); -+ -+ if (!context.getLevel().getBlockState(headPos).canBeReplaced(context)) { -+ return null; -+ } -+ } -+ -+ state = state.setValue(directionProp, facing); -+ } -+ } else if (state.hasProperty(BlockStateProperties.AXIS)) { -+ Direction.Axis axis = Direction.Axis.VALUES[protocolValue % 3]; -+ state = state.setValue(BlockStateProperties.AXIS, axis); -+ } -+ -+ protocolValue &= 0xFFFFFFF0; -+ -+ if (protocolValue >= 16) { -+ if (block instanceof RepeaterBlock) { -+ Integer delay = (protocolValue / 16); -+ -+ if (RepeaterBlock.DELAY.getPossibleValues().contains(delay)) { -+ state = state.setValue(RepeaterBlock.DELAY, delay); -+ } -+ } else if (protocolValue == 16) { -+ if (block instanceof ComparatorBlock) { -+ state = state.setValue(ComparatorBlock.MODE, ComparatorMode.SUBTRACT); -+ } else if (state.hasProperty(BlockStateProperties.HALF) && state.getValue(BlockStateProperties.HALF) == Half.BOTTOM) { -+ state = state.setValue(BlockStateProperties.HALF, Half.TOP); -+ } else if (state.hasProperty(BlockStateProperties.SLAB_TYPE) && state.getValue(BlockStateProperties.SLAB_TYPE) == SlabType.BOTTOM) { -+ state = state.setValue(BlockStateProperties.SLAB_TYPE, SlabType.TOP); -+ } -+ } -+ } -+ -+ return state; -+ } -+ -+ @Nullable -+ public static DirectionProperty getFirstDirectionProperty(@NotNull BlockState state) { -+ for (Property prop : state.getProperties()) { -+ if (prop instanceof DirectionProperty) { -+ return (DirectionProperty) prop; -+ } -+ } -+ return null; -+ } -+} diff --git a/patches/server/0053-MC-Technical-Survival-Mode.patch b/patches/server/0053-MC-Technical-Survival-Mode.patch index 21998d32..61e62ebf 100644 --- a/patches/server/0053-MC-Technical-Survival-Mode.patch +++ b/patches/server/0053-MC-Technical-Survival-Mode.patch @@ -109,7 +109,7 @@ index b0f23ebceb2f492b21eb95ee9496621f46c975c7..79f8e34032cde65a7d2a1f21bc32e0c2 entity.spawnReason == org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.CHUNK_GEN)) { continue; diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java -index 475b3b5bcc8828c6ba2a4a6d7b2476548e13efcc..627cd56c9ce8fc5db22b284ccff1e1c67ef291ff 100644 +index 4a7557e450560bb7e8785370cd6abaaff32fa07f..0a3fca80e5e105c0ab8455d2e4372352658a8852 100644 --- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java +++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java @@ -2,6 +2,7 @@ package top.leavesmc.leaves; @@ -120,7 +120,7 @@ index 475b3b5bcc8828c6ba2a4a6d7b2476548e13efcc..627cd56c9ce8fc5db22b284ccff1e1c6 import net.minecraft.server.MinecraftServer; import org.bukkit.Bukkit; import org.bukkit.command.Command; -@@ -471,6 +472,14 @@ public final class LeavesConfig { +@@ -482,6 +483,14 @@ public final class LeavesConfig { public static void doMcTechnicalMode() { if (mcTechnicalMode) { diff --git a/patches/server/0057-Leaves-Extra-Yggdrasil-Service.patch b/patches/server/0057-Leaves-Extra-Yggdrasil-Service.patch index ee12c4b7..e28b57fc 100644 --- a/patches/server/0057-Leaves-Extra-Yggdrasil-Service.patch +++ b/patches/server/0057-Leaves-Extra-Yggdrasil-Service.patch @@ -44,7 +44,7 @@ index 46eacd000b622b9dba746fe38e4bf2a0abfe061c..3b42b63d0fefb4a978b372facd0a03b6 public final Thread serverThread; private long nextTickTime; diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java -index 627cd56c9ce8fc5db22b284ccff1e1c67ef291ff..35b0a18e6e01e3d836b816ee020738a78805b1b8 100644 +index 0a3fca80e5e105c0ab8455d2e4372352658a8852..bb986b1c558999b6227b32c42133c0a942c89d77 100644 --- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java +++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java @@ -11,6 +11,7 @@ import org.bukkit.configuration.file.YamlConfiguration; @@ -55,7 +55,7 @@ index 627cd56c9ce8fc5db22b284ccff1e1c67ef291ff..35b0a18e6e01e3d836b816ee020738a7 import top.leavesmc.leaves.util.MathUtils; import java.io.File; -@@ -508,6 +509,9 @@ public final class LeavesConfig { +@@ -519,6 +520,9 @@ public final class LeavesConfig { extraYggdrasilLoginProtect = getBoolean("settings.misc.extra-yggdrasil-service.login-protect", extraYggdrasilLoginProtect); extraYggdrasilServiceList = getList("settings.misc.extra-yggdrasil-service.urls", extraYggdrasilServiceList); if (extraYggdrasilService) { diff --git a/patches/server/0061-Syncmatica-Protocol.patch b/patches/server/0061-Syncmatica-Protocol.patch index f8ebc148..a81211bc 100644 --- a/patches/server/0061-Syncmatica-Protocol.patch +++ b/patches/server/0061-Syncmatica-Protocol.patch @@ -54,7 +54,7 @@ index 3d77af234f5035b391717679f1e93d8965dc7a13..30ed248d933ef31af041ccbf60f57cdb ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t dispatch custom payload", ex); this.disconnect("Invalid custom payload!", org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_PAYLOAD); diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java -index 35b0a18e6e01e3d836b816ee020738a78805b1b8..22b9c5d88ec56c35e148f0a73a544089828930f3 100644 +index bb986b1c558999b6227b32c42133c0a942c89d77..9bc87cc3c88b28b344acd8a7838f9f7b5402c7d4 100644 --- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java +++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java @@ -12,6 +12,7 @@ import top.leavesmc.leaves.command.LeavesCommand; @@ -65,7 +65,7 @@ index 35b0a18e6e01e3d836b816ee020738a78805b1b8..22b9c5d88ec56c35e148f0a73a544089 import top.leavesmc.leaves.util.MathUtils; import java.io.File; -@@ -546,6 +547,7 @@ public final class LeavesConfig { +@@ -557,6 +558,7 @@ public final class LeavesConfig { syncmaticaQuota = getBoolean("settings.protocol.syncmatica.quota", syncmaticaQuota); syncmaticaQuotaLimit = getInt("settings.protocol.syncmatica.quota-limit", syncmaticaQuotaLimit); if (syncmaticaProtocol) { diff --git a/patches/server/0071-Creative-fly-no-clip.patch b/patches/server/0071-Creative-fly-no-clip.patch index d8190b64..0ad0a28c 100644 --- a/patches/server/0071-Creative-fly-no-clip.patch +++ b/patches/server/0071-Creative-fly-no-clip.patch @@ -85,10 +85,10 @@ index d9baa85962236c42219cf09d4f3129be93ff069c..c1bd06fbc2c5683888f7264c35c25feb public boolean isSpawning() { diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java -index 9586d8ee8d23c36407ee92bea63fcedc55d9bfe6..1df77ca5b0b768ddf716024e6fb9669f128e9b3d 100644 +index 86dc8db59ec6096cb492daeb6713d56fac932a3e..fb82ac89df39cb9ea8f72321d6ce08df7a5a5d70 100644 --- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java +++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java -@@ -592,6 +592,7 @@ public final class LeavesConfig { +@@ -603,6 +603,7 @@ public final class LeavesConfig { } public static void registerCarpetRules() { diff --git a/patches/server/0096-Cache-BlockStatePairKey-hash.patch b/patches/server/0096-Cache-BlockStatePairKey-hash.patch index efb2a1ef..058318ce 100644 --- a/patches/server/0096-Cache-BlockStatePairKey-hash.patch +++ b/patches/server/0096-Cache-BlockStatePairKey-hash.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Cache BlockStatePairKey hash This patch is Powered by Gale(https://github.com/GaleMC/Gale) diff --git a/src/main/java/net/minecraft/world/level/block/Block.java b/src/main/java/net/minecraft/world/level/block/Block.java -index 4dc1cd1b1355ca401cc5094d8e3cdbcd980befb5..96b9d47aa3720491424c35c9e73fc996bfc8cd20 100644 +index d13e665a1f2fa4b671894a8c708e8e7ff94af07f..98eb6061da8ac8617b54d489ff41b4808dafe839 100644 --- a/src/main/java/net/minecraft/world/level/block/Block.java +++ b/src/main/java/net/minecraft/world/level/block/Block.java -@@ -609,11 +609,18 @@ public class Block extends BlockBehaviour implements ItemLike { +@@ -623,11 +623,18 @@ public class Block extends BlockBehaviour implements ItemLike { private final BlockState first; private final BlockState second; private final Direction direction; @@ -28,7 +28,7 @@ index 4dc1cd1b1355ca401cc5094d8e3cdbcd980befb5..96b9d47aa3720491424c35c9e73fc996 } public boolean equals(Object object) { -@@ -629,11 +636,17 @@ public class Block extends BlockBehaviour implements ItemLike { +@@ -643,11 +650,17 @@ public class Block extends BlockBehaviour implements ItemLike { } public int hashCode() { diff --git a/patches/server/0112-Avoid-anvil-too-expensive.patch b/patches/server/0112-Avoid-anvil-too-expensive.patch index 90eaeeba..852ffa54 100644 --- a/patches/server/0112-Avoid-anvil-too-expensive.patch +++ b/patches/server/0112-Avoid-anvil-too-expensive.patch @@ -18,10 +18,10 @@ index e0c3a4ba27e21c3692e601acd0af60873bcbb84c..b9fcf49ed88c62265d9aa8926c1228b9 } diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java -index 7b4ddea1242fd4a07e909462f1ad2c8353732aee..1ff7df01bd36a01a7bdf616b8a3298f826172138 100644 +index 7e35a9edd75b6ff1ec9de51e95a70db47a0196bc..b8a033332e783caa78ac851ab2b77a645e0c7c36 100644 --- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java +++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java -@@ -598,6 +598,7 @@ public final class LeavesConfig { +@@ -609,6 +609,7 @@ public final class LeavesConfig { public static void registerCarpetRules() { CarpetRules.register(CarpetRule.of("carpet", "creativeNoClip", creativeNoClip)); diff --git a/patches/server/0117-Add-Leaves-Auto-Update.patch b/patches/server/0117-Add-Leaves-Auto-Update.patch index 65b4dbc5..98771b7e 100644 --- a/patches/server/0117-Add-Leaves-Auto-Update.patch +++ b/patches/server/0117-Add-Leaves-Auto-Update.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add Leaves Auto Update diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java -index 1ff7df01bd36a01a7bdf616b8a3298f826172138..22965fc431996187639395385a298c4ea889d456 100644 +index b8a033332e783caa78ac851ab2b77a645e0c7c36..3be1719469a492fe7457dbb109973b12bef71660 100644 --- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java +++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java @@ -14,6 +14,7 @@ import top.leavesmc.leaves.bot.agent.Actions; @@ -16,7 +16,7 @@ index 1ff7df01bd36a01a7bdf616b8a3298f826172138..22965fc431996187639395385a298c4e import top.leavesmc.leaves.util.MathUtils; import top.leavesmc.leaves.protocol.CarpetServerProtocol.CarpetRule; import top.leavesmc.leaves.protocol.CarpetServerProtocol.CarpetRules; -@@ -818,6 +819,7 @@ public final class LeavesConfig { +@@ -829,6 +830,7 @@ public final class LeavesConfig { private static void autoUpdate() { autoUpdate = getBoolean("settings.misc.auto-update.enable", autoUpdate); autoUpdateTime = getList("settings.misc.auto-update.time", autoUpdateTime);