diff --git a/patches/server/0010-Placeholder-of-Fakeplayer-support.patch b/patches/server/0010-Placeholder-of-Fakeplayer-support.patch index e3a9d61d..1655af27 100644 --- a/patches/server/0010-Placeholder-of-Fakeplayer-support.patch +++ b/patches/server/0010-Placeholder-of-Fakeplayer-support.patch @@ -427,7 +427,7 @@ index 0000000000000000000000000000000000000000..ed7e8cc97bb0394695d67e7849ea7337 +} diff --git a/src/main/java/top/leavesmc/leaves/bot/BotInventoryContainer.java b/src/main/java/top/leavesmc/leaves/bot/BotInventoryContainer.java new file mode 100644 -index 0000000000000000000000000000000000000000..b83ad5bf2a338d589eb200d3f3b3153571ba2cad +index 0000000000000000000000000000000000000000..7a57749909c886953d233dc0910effc0c4a3f115 --- /dev/null +++ b/src/main/java/top/leavesmc/leaves/bot/BotInventoryContainer.java @@ -0,0 +1,180 @@ @@ -605,8 +605,8 @@ index 0000000000000000000000000000000000000000..b83ad5bf2a338d589eb200d3f3b31535 + private void createButton() { + for (int i = 0; i < 13; i++) { + ItemStack button = new ItemStack(Items.STRUCTURE_VOID); -+ button.setHoverName(Component.empty()); -+ button.getOrCreateTag().putBoolean("Leaves.Gui.Placeholder", true); ++ // button.setHoverName(Component.empty()); // Leaves - remove bot temporarily ++ // button.getOrCreateTag().putBoolean("Leaves.Gui.Placeholder", true); // Leaves - remove bot temporarily + buttons.set(i, button); + } + } diff --git a/patches/server/0047-MC-Technical-Survival-Mode.patch b/patches/server/0047-MC-Technical-Survival-Mode.patch index e4560112..93e779ff 100644 --- a/patches/server/0047-MC-Technical-Survival-Mode.patch +++ b/patches/server/0047-MC-Technical-Survival-Mode.patch @@ -153,7 +153,7 @@ index 592b330f187fb5eca51d60911bbebbaeaf46ef87..c4aed4ed80ca0ed427c777e81d2cf219 diff --git a/src/main/java/top/leavesmc/leaves/util/McTechnicalModeHelper.java b/src/main/java/top/leavesmc/leaves/util/McTechnicalModeHelper.java new file mode 100644 -index 0000000000000000000000000000000000000000..4822a3806c55126e219364c3f76d0159a6f6453e +index 0000000000000000000000000000000000000000..d9041f1a56a7c04203e3f462206414c7b890df44 --- /dev/null +++ b/src/main/java/top/leavesmc/leaves/util/McTechnicalModeHelper.java @@ -0,0 +1,27 @@ @@ -179,7 +179,7 @@ index 0000000000000000000000000000000000000000..4822a3806c55126e219364c3f76d0159 + GlobalConfiguration.get().packetLimiter.allPackets = new GlobalConfiguration.PacketLimiter.PacketLimit(GlobalConfiguration.get().packetLimiter.allPackets.interval(), + 5000.0, GlobalConfiguration.get().packetLimiter.allPackets.action()); + GlobalConfiguration.get().packetLimiter.overrides = Map.of(); -+ GlobalConfiguration.get().unsupportedSettings.allowGrindstoneOverstacking = true; ++ // GlobalConfiguration.get().unsupportedSettings.allowGrindstoneOverstacking = true; + GlobalConfiguration.get().itemValidation.resolveSelectorsInBooks = true; + GlobalConfiguration.get().scoreboards.saveEmptyScoreboardTeams = true; + } diff --git a/patches/server/0058-No-feather-falling-trample.patch b/patches/server/0058-No-feather-falling-trample.patch index 047307aa..d995ce17 100644 --- a/patches/server/0058-No-feather-falling-trample.patch +++ b/patches/server/0058-No-feather-falling-trample.patch @@ -5,16 +5,24 @@ Subject: [PATCH] No feather falling trample diff --git a/src/main/java/net/minecraft/world/level/block/FarmBlock.java b/src/main/java/net/minecraft/world/level/block/FarmBlock.java -index d59e33e7326489c6d55d316d0130f22235f4c63c..a454b8e6ef9133fbbae168bd4748c90ecd9fea37 100644 +index d59e33e7326489c6d55d316d0130f22235f4c63c..1667d1220e934b74a4a2f26ae27982388062f09b 100644 --- a/src/main/java/net/minecraft/world/level/block/FarmBlock.java +++ b/src/main/java/net/minecraft/world/level/block/FarmBlock.java -@@ -112,6 +112,13 @@ public class FarmBlock extends Block { +@@ -14,6 +14,7 @@ import net.minecraft.world.entity.Entity; + import net.minecraft.world.entity.LivingEntity; + import net.minecraft.world.entity.player.Player; + import net.minecraft.world.item.context.BlockPlaceContext; ++import net.minecraft.world.item.enchantment.Enchantments; + import net.minecraft.world.level.BlockGetter; + import net.minecraft.world.level.GameRules; + import net.minecraft.world.level.Level; +@@ -112,6 +113,13 @@ public class FarmBlock extends Block { public void fallOn(Level world, BlockState state, BlockPos pos, Entity entity, float fallDistance) { super.fallOn(world, state, pos, entity, fallDistance); // CraftBukkit - moved here as game rules / events shouldn't affect fall damage. if (!world.isClientSide && world.random.nextFloat() < fallDistance - 0.5F && entity instanceof LivingEntity && (entity instanceof Player || world.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) && entity.getBbWidth() * entity.getBbWidth() * entity.getBbHeight() > 0.512F) { + // Leaves start - noFeatherFallingTrample + if (top.leavesmc.leaves.LeavesConfig.noFeatherFallingTrample) { -+ if (net.minecraft.world.item.enchantment.EnchantmentHelper.getEnchantmentLevel(net.minecraft.world.item.enchantment.Enchantments.FALL_PROTECTION, (LivingEntity) entity) > 0) { ++ if (net.minecraft.world.item.enchantment.EnchantmentHelper.getEnchantmentLevel(Enchantments.FEATHER_FALLING, (LivingEntity) entity) > 0) { + return; + } + } diff --git a/patches/server/0067-Shave-snow-layers.patch b/patches/server/0067-Shave-snow-layers.patch index cb635e68..814c6bc2 100644 --- a/patches/server/0067-Shave-snow-layers.patch +++ b/patches/server/0067-Shave-snow-layers.patch @@ -5,10 +5,23 @@ Subject: [PATCH] Shave snow layers diff --git a/src/main/java/net/minecraft/world/item/ShovelItem.java b/src/main/java/net/minecraft/world/item/ShovelItem.java -index 24f6a158e4759aac3be8da4cf5e0d40bd295355b..59c6c9b4d574b2c1f6c54a116c4bab43b71da7f8 100644 +index 24f6a158e4759aac3be8da4cf5e0d40bd295355b..8c6773ee217b0a69f47e82d536e1d29f067bc960 100644 --- a/src/main/java/net/minecraft/world/item/ShovelItem.java +++ b/src/main/java/net/minecraft/world/item/ShovelItem.java -@@ -12,10 +12,12 @@ import net.minecraft.world.InteractionResult; +@@ -2,20 +2,25 @@ package net.minecraft.world.item; + + import com.google.common.collect.Maps; + import com.google.common.collect.ImmutableMap.Builder; ++ + import java.util.Map; ++ + import net.minecraft.core.BlockPos; + import net.minecraft.core.Direction; + import net.minecraft.sounds.SoundEvents; + import net.minecraft.sounds.SoundSource; + import net.minecraft.tags.BlockTags; + import net.minecraft.world.InteractionResult; ++import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.context.UseOnContext; @@ -21,7 +34,7 @@ index 24f6a158e4759aac3be8da4cf5e0d40bd295355b..59c6c9b4d574b2c1f6c54a116c4bab43 import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.gameevent.GameEvent; -@@ -44,6 +46,22 @@ public class ShovelItem extends DiggerItem { +@@ -44,6 +49,24 @@ public class ShovelItem extends DiggerItem { return InteractionResult.PASS; } else { Player player = context.getPlayer(); @@ -32,10 +45,12 @@ index 24f6a158e4759aac3be8da4cf5e0d40bd295355b..59c6c9b4d574b2c1f6c54a116c4bab43 + Block.popResource(level, blockPos, new ItemStack(EnchantmentHelper.hasSilkTouch(context.getItemInHand()) ? Items.SNOW : Items.SNOWBALL)); + level.playSound(player, blockPos, SoundEvents.SNOW_BREAK, SoundSource.BLOCKS, 1.0F, 1.0F); + -+ if(player != null) { -+ context.getItemInHand().hurtAndBreak(1, player, (p) -> { -+ p.broadcastBreakEvent(context.getHand()); -+ }); ++ if (player != null) { ++ context.getItemInHand().hurtAndBreak(1, player.getRandom(), player, () -> ++ player.broadcastBreakEvent(switch (context.getHand()) { ++ case MAIN_HAND -> EquipmentSlot.MAINHAND; ++ case OFF_HAND -> EquipmentSlot.OFFHAND; ++ })); + } + + return InteractionResult.SUCCESS; @@ -44,3 +59,19 @@ index 24f6a158e4759aac3be8da4cf5e0d40bd295355b..59c6c9b4d574b2c1f6c54a116c4bab43 BlockState blockState2 = FLATTENABLES.get(blockState.getBlock()); BlockState blockState3 = null; Runnable afterAction = null; // Paper +@@ -52,11 +75,11 @@ public class ShovelItem extends DiggerItem { + blockState3 = blockState2; + } else if (blockState.getBlock() instanceof CampfireBlock && blockState.getValue(CampfireBlock.LIT)) { + afterAction = () -> { // Paper +- if (!level.isClientSide()) { +- level.levelEvent(null, 1009, blockPos, 0); +- } ++ if (!level.isClientSide()) { ++ level.levelEvent(null, 1009, blockPos, 0); ++ } + +- CampfireBlock.dowse(context.getPlayer(), level, blockPos, blockState); ++ CampfireBlock.dowse(context.getPlayer(), level, blockPos, blockState); + }; // Paper + blockState3 = blockState.setValue(CampfireBlock.LIT, Boolean.valueOf(false)); + } diff --git a/patches/server/0074-Container-open-passthrough.patch b/patches/server/0074-Container-open-passthrough.patch index 4ed2bdb4..15c312eb 100644 --- a/patches/server/0074-Container-open-passthrough.patch +++ b/patches/server/0074-Container-open-passthrough.patch @@ -5,16 +5,16 @@ Subject: [PATCH] Container open passthrough diff --git a/src/main/java/net/minecraft/world/level/block/SignBlock.java b/src/main/java/net/minecraft/world/level/block/SignBlock.java -index f7bae8060d993176799ff3ff4653d760a137faba..ec45b1aacc9244d08b7870f63a08a27a71499a79 100644 +index f7bae8060d993176799ff3ff4653d760a137faba..4498755c7b826e4218214a71c70e5fa1898861cf 100644 --- a/src/main/java/net/minecraft/world/level/block/SignBlock.java +++ b/src/main/java/net/minecraft/world/level/block/SignBlock.java -@@ -141,6 +141,25 @@ public abstract class SignBlock extends BaseEntityBlock implements SimpleWaterlo +@@ -141,6 +141,26 @@ public abstract class SignBlock extends BaseEntityBlock implements SimpleWaterlo return InteractionResult.SUCCESS; } else if (flag1) { return InteractionResult.SUCCESS; + // Leaves start - signContainerPassthrough + } else if (top.leavesmc.leaves.LeavesConfig.containerPassthrough) { -+ if (item == net.minecraft.world.item.Items.AIR && player.isShiftKeyDown()) { ++ if (state.isAir() && player.isShiftKeyDown()) { + if (!this.otherPlayerIsEditingSign(player, tileentitysign) && player.mayBuild() && this.hasEditableText(player, tileentitysign, flag1)) { + this.openTextEdit(player, tileentitysign, flag1); + return InteractionResult.SUCCESS; @@ -25,10 +25,11 @@ index f7bae8060d993176799ff3ff4653d760a137faba..ec45b1aacc9244d08b7870f63a08a27a + if (this instanceof WallSignBlock || this instanceof WallHangingSignBlock) { + pos1 = pos.relative(state.getValue(HorizontalDirectionalBlock.FACING).getOpposite()); + } -+ if (world.getBlockEntity(pos1) instanceof net.minecraft.world.level.block.entity.RandomizableContainerBlockEntity) { -+ BlockState state1 = world.getBlockState(pos1); -+ return state1.use(world, player, hand, hit.withPosition(pos1)); -+ } ++ // TODO fix this ++ // if (world.getBlockEntity(pos1) instanceof net.minecraft.world.level.block.entity.RandomizableContainerBlockEntity) { ++ // BlockState state1 = world.getBlockState(pos1); ++ // return state1.use(world, player, hand, hit.withPosition(pos1)); ++ // } + return InteractionResult.PASS; + // Leaves end - signContainerPassthrough } else if (!this.otherPlayerIsEditingSign(player, tileentitysign) && player.mayBuild() && this.hasEditableText(player, tileentitysign, flag)) { diff --git a/patches/server/0108-Wool-Hopper-Counter.patch b/patches/server/0108-Wool-Hopper-Counter.patch index d8aef58c..6a8dec1e 100644 --- a/patches/server/0108-Wool-Hopper-Counter.patch +++ b/patches/server/0108-Wool-Hopper-Counter.patch @@ -18,17 +18,40 @@ index e314f36951e9ac15c57137e24fce8c410373130a..dd232d9e86c5bf03cfb4597d3291a172 @Nullable public ItemStack[] itemStacks; @Nullable +diff --git a/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java b/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java +index a31326e24cb68472c81cd781c5e3041772712862..f0422a70ef79c837405284fd42a74af6c57959de 100644 +--- a/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java ++++ b/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java +@@ -45,7 +45,7 @@ public class RecipeManager extends SimpleJsonResourceReloadListener { + private static final Logger LOGGER = LogUtils.getLogger(); + private final HolderLookup.Provider registries; + public Multimap, RecipeHolder> byType = ImmutableMultimap.of(); +- private Map> byName = ImmutableMap.of(); ++ public Map> byName = ImmutableMap.of(); // Leaves - hopper counter + private boolean hasErrors; + + public RecipeManager(HolderLookup.Provider registryLookup) { diff --git a/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java -index c4aed4ed80ca0ed427c777e81d2cf21956888fad..1668b62910bb18adaeb54ba49119553d69bb2812 100644 +index c4aed4ed80ca0ed427c777e81d2cf21956888fad..f2fde04a6cb56c0c54edd8d48026f200a415d589 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java -@@ -433,6 +433,13 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen +@@ -202,7 +202,7 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen + + final int fullState = getFullState(blockEntity); // Paper - Perf: Optimize Hoppers + if (fullState != HOPPER_EMPTY) { // Paper - Perf: Optimize Hoppers +- flag = HopperBlockEntity.ejectItems(world, pos, blockEntity); ++ flag = HopperBlockEntity.ejectItems(world, pos, blockEntity); // Leaves - hopper counter + } + + if (fullState != HOPPER_IS_FULL || flag) { // Paper - Perf: Optimize Hoppers +@@ -432,7 +432,14 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen + private static final java.util.function.BiPredicate IS_EMPTY_TEST = (itemstack, i) -> itemstack.isEmpty(); // Paper end - Perf: Optimize Hoppers ++ // Leaves start - hopper counter private static boolean ejectItems(Level world, BlockPos pos, HopperBlockEntity blockEntity) { -+ // Leaves start - hopper counter + if (top.leavesmc.leaves.util.HopperCounter.isEnabled()) { -+ if (woolHopperCounter(world, pos, blockEntity.getBlockState(), blockEntity.persistentDataContainer, blockEntity)) { ++ if (woolHopperCounter(world, pos, world.getBlockState(pos), (Container) blockEntity, blockEntity)) { + return true; + } + } @@ -209,7 +232,7 @@ index 0000000000000000000000000000000000000000..24eecf862f3f5fab678813de7de8d3ba +} diff --git a/src/main/java/top/leavesmc/leaves/util/HopperCounter.java b/src/main/java/top/leavesmc/leaves/util/HopperCounter.java new file mode 100644 -index 0000000000000000000000000000000000000000..3b173b175fe3412ac9f87fb1d520777182125348 +index 0000000000000000000000000000000000000000..54244e9eb3aa830bf5c90e285465662aa11b2e9c --- /dev/null +++ b/src/main/java/top/leavesmc/leaves/util/HopperCounter.java @@ -0,0 +1,334 @@ @@ -394,7 +417,7 @@ index 0000000000000000000000000000000000000000..3b173b175fe3412ac9f87fb1d5207771 + entry(Items.POISONOUS_POTATO, Blocks.SLIME_BLOCK), + entry(Items.SPIDER_EYE, Blocks.NETHERRACK), + entry(Items.GUNPOWDER, Blocks.GRAY_WOOL), -+ entry(Items.SCUTE, Blocks.LIME_WOOL), ++ entry(Items.TURTLE_SCUTE, Blocks.LIME_WOOL), + entry(Items.FEATHER, Blocks.WHITE_WOOL), + entry(Items.FLINT, Blocks.BLACK_WOOL), + entry(Items.LEATHER, Blocks.SPRUCE_PLANKS), @@ -492,7 +515,7 @@ index 0000000000000000000000000000000000000000..3b173b175fe3412ac9f87fb1d5207771 + } + + public static List> getAllMatching(@NotNull RecipeManager manager, RecipeType type, ResourceLocation output, final RegistryAccess registryAccess) { -+ Map> typeRecipes = manager.recipes.get(type); ++ Map> typeRecipes = manager.byName; // Leaves - hopper counter + if (typeRecipes == null) { + return Collections.emptyList(); + } diff --git a/patches/server/0130-Vanilla-hopper.patch b/patches/server/0130-Vanilla-hopper.patch index 3ffaf3f7..7e441545 100644 --- a/patches/server/0130-Vanilla-hopper.patch +++ b/patches/server/0130-Vanilla-hopper.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Vanilla hopper This is a temporary solution designed to attempt to restore the vanilla behavior of the funnel while preserving optimizations as much as possible. It should ultimately be replaced by the optimization solution provided by lithium. diff --git a/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java -index 1668b62910bb18adaeb54ba49119553d69bb2812..030d2da3408543ecbecd67e08ec44f51b7d32ef5 100644 +index f2fde04a6cb56c0c54edd8d48026f200a415d589..3220250073ec05c43da0f2830008652539ef3cf6 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java @@ -290,36 +290,49 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen