From 38bf247e27bb7cac306a49ae6ab0caac82b53497 Mon Sep 17 00:00:00 2001 From: Jake Potrebic Date: Mon, 14 Jun 2021 11:50:22 -0700 Subject: [PATCH] more patches --- ...et-Material-from-Boats-and-Minecarts.patch | 0 .../Add-EntityLoadCrossbowEvent.patch | 0 ...-OBSTRUCTED-reason-to-BedEnterResult.patch | 0 .../Add-PlayerFlowerPotManipulateEvent.patch | 0 .../Add-PlayerShearBlockEvent.patch | 0 .../Add-TargetHitEvent-API.patch | 0 .../Added-PlayerTradeEvent.patch | 0 .../Added-WorldGameRuleChangeEvent.patch | 0 .../Additional-Block-Material-API-s.patch | 0 .../Enable-multi-release-plugin-jars.patch | 0 .../Expose-LivingEntity-hurt-direction.patch | 0 .../Player-Chunk-Load-Unload-Events.patch | 0 .../Zombie-API-breaking-doors.patch | 0 .../Add-EntityLoadCrossbowEvent.patch | 60 --------- .../Add-PlayerShearBlockEvent.patch | 116 ------------------ ...d-missing-default-perms-for-commands.patch | 70 ----------- .../Implement-TargetHitEvent.patch | 58 --------- .../MC-4-Fix-item-position-desync.patch | 84 ------------- .../Optimized-tick-ready-check.patch | 51 -------- .../Player-Chunk-Load-Unload-Events.patch | 41 ------- .../added-PlayerTradeEvent.patch | 75 ----------- .../server/Add-EntityLoadCrossbowEvent.patch | 39 ++++++ ...-OBSTRUCTED-reason-to-BedEnterResult.patch | 0 .../server/Add-PlayerShearBlockEvent.patch | 70 +++++++++++ ...g-for-servers-not-running-on-Java-16.patch | 10 +- .../Added-WorldGameRuleChangeEvent.patch | 62 ++++------ ...d-missing-default-perms-for-commands.patch | 70 +++++++++++ .../Additional-Block-Material-API-s.patch | 8 +- ...mob-spawner-spawn-egg-transformation.patch | 8 +- .../Cache-burn-durations.patch | 37 +----- ...m-invalid-ingredient-lists-in-Villag.patch | 2 +- .../Expose-LivingEntity-hurt-direction.patch | 17 +-- ...x-CraftSound-backwards-compatibility.patch | 0 ...ing-zombie-villager-discount-exploit.patch | 24 ++-- .../Fix-harming-potion-dupe.patch | 24 ++-- ...-event-not-being-called-in-adventure.patch | 12 +- .../Fix-nerfed-slime-when-splitting.patch | 0 .../Guardian-beam-workaround.patch | 24 ++-- ...-get-Material-from-Boats-and-Minecar.patch | 30 +---- ...ement-PlayerFlowerPotManipulateEvent.patch | 25 ++-- patches/server/Implement-TargetHitEvent.patch | 42 +++++++ .../Limit-recipe-packets.patch | 39 ++---- .../MC-4-Fix-item-position-desync.patch | 63 ++++++++++ .../Optimize-Dynamic-get-Missing-Keys.patch | 0 .../Player-Chunk-Load-Unload-Events.patch | 32 +++++ ...erbose-world-setting-to-false-by-def.patch | 6 +- .../Zombie-API-breaking-doors.patch | 17 --- patches/server/added-PlayerTradeEvent.patch | 40 ++++++ 48 files changed, 453 insertions(+), 803 deletions(-) rename patches/{api-unmapped => api}/Add-API-to-get-Material-from-Boats-and-Minecarts.patch (100%) rename patches/{api-unmapped => api}/Add-EntityLoadCrossbowEvent.patch (100%) rename patches/{api-unmapped => api}/Add-OBSTRUCTED-reason-to-BedEnterResult.patch (100%) rename patches/{api-unmapped => api}/Add-PlayerFlowerPotManipulateEvent.patch (100%) rename patches/{api-unmapped => api}/Add-PlayerShearBlockEvent.patch (100%) rename patches/{api-unmapped => api}/Add-TargetHitEvent-API.patch (100%) rename patches/{api-unmapped => api}/Added-PlayerTradeEvent.patch (100%) rename patches/{api-unmapped => api}/Added-WorldGameRuleChangeEvent.patch (100%) rename patches/{api-unmapped => api}/Additional-Block-Material-API-s.patch (100%) rename patches/{api-unmapped => api}/Enable-multi-release-plugin-jars.patch (100%) rename patches/{api-unmapped => api}/Expose-LivingEntity-hurt-direction.patch (100%) rename patches/{api-unmapped => api}/Player-Chunk-Load-Unload-Events.patch (100%) rename patches/{api-unmapped => api}/Zombie-API-breaking-doors.patch (100%) delete mode 100644 patches/server-remapped/Add-EntityLoadCrossbowEvent.patch delete mode 100644 patches/server-remapped/Add-PlayerShearBlockEvent.patch delete mode 100644 patches/server-remapped/Added-missing-default-perms-for-commands.patch delete mode 100644 patches/server-remapped/Implement-TargetHitEvent.patch delete mode 100644 patches/server-remapped/MC-4-Fix-item-position-desync.patch delete mode 100644 patches/server-remapped/Optimized-tick-ready-check.patch delete mode 100644 patches/server-remapped/Player-Chunk-Load-Unload-Events.patch delete mode 100644 patches/server-remapped/added-PlayerTradeEvent.patch create mode 100644 patches/server/Add-EntityLoadCrossbowEvent.patch rename patches/{server-remapped => server}/Add-OBSTRUCTED-reason-to-BedEnterResult.patch (100%) create mode 100644 patches/server/Add-PlayerShearBlockEvent.patch rename patches/{server-remapped => server}/Add-warning-for-servers-not-running-on-Java-16.patch (88%) rename patches/{server-remapped => server}/Added-WorldGameRuleChangeEvent.patch (58%) create mode 100644 patches/server/Added-missing-default-perms-for-commands.patch rename patches/{server-remapped => server}/Additional-Block-Material-API-s.patch (78%) rename patches/{server-remapped => server}/Allow-disabling-mob-spawner-spawn-egg-transformation.patch (91%) rename patches/{server-remapped => server}/Cache-burn-durations.patch (52%) rename patches/{server-remapped => server}/Do-not-crash-from-invalid-ingredient-lists-in-Villag.patch (97%) rename patches/{server-remapped => server}/Expose-LivingEntity-hurt-direction.patch (52%) rename patches/{server-remapped => server}/Fix-CraftSound-backwards-compatibility.patch (100%) rename patches/{server-remapped => server}/Fix-curing-zombie-villager-discount-exploit.patch (71%) rename patches/{server-remapped => server}/Fix-harming-potion-dupe.patch (73%) rename patches/{server-remapped => server}/Fix-interact-event-not-being-called-in-adventure.patch (80%) rename patches/{server-remapped => server}/Fix-nerfed-slime-when-splitting.patch (100%) rename patches/{server-remapped => server}/Guardian-beam-workaround.patch (56%) rename patches/{server-remapped => server}/Implement-API-to-get-Material-from-Boats-and-Minecar.patch (72%) rename patches/{server-remapped => server}/Implement-PlayerFlowerPotManipulateEvent.patch (68%) create mode 100644 patches/server/Implement-TargetHitEvent.patch rename patches/{server-remapped => server}/Limit-recipe-packets.patch (67%) create mode 100644 patches/server/MC-4-Fix-item-position-desync.patch rename patches/{server-remapped => server}/Optimize-Dynamic-get-Missing-Keys.patch (100%) create mode 100644 patches/server/Player-Chunk-Load-Unload-Events.patch rename patches/{server-remapped => server}/Set-spigots-verbose-world-setting-to-false-by-def.patch (76%) rename patches/{server-remapped => server}/Zombie-API-breaking-doors.patch (51%) create mode 100644 patches/server/added-PlayerTradeEvent.patch diff --git a/patches/api-unmapped/Add-API-to-get-Material-from-Boats-and-Minecarts.patch b/patches/api/Add-API-to-get-Material-from-Boats-and-Minecarts.patch similarity index 100% rename from patches/api-unmapped/Add-API-to-get-Material-from-Boats-and-Minecarts.patch rename to patches/api/Add-API-to-get-Material-from-Boats-and-Minecarts.patch diff --git a/patches/api-unmapped/Add-EntityLoadCrossbowEvent.patch b/patches/api/Add-EntityLoadCrossbowEvent.patch similarity index 100% rename from patches/api-unmapped/Add-EntityLoadCrossbowEvent.patch rename to patches/api/Add-EntityLoadCrossbowEvent.patch diff --git a/patches/api-unmapped/Add-OBSTRUCTED-reason-to-BedEnterResult.patch b/patches/api/Add-OBSTRUCTED-reason-to-BedEnterResult.patch similarity index 100% rename from patches/api-unmapped/Add-OBSTRUCTED-reason-to-BedEnterResult.patch rename to patches/api/Add-OBSTRUCTED-reason-to-BedEnterResult.patch diff --git a/patches/api-unmapped/Add-PlayerFlowerPotManipulateEvent.patch b/patches/api/Add-PlayerFlowerPotManipulateEvent.patch similarity index 100% rename from patches/api-unmapped/Add-PlayerFlowerPotManipulateEvent.patch rename to patches/api/Add-PlayerFlowerPotManipulateEvent.patch diff --git a/patches/api-unmapped/Add-PlayerShearBlockEvent.patch b/patches/api/Add-PlayerShearBlockEvent.patch similarity index 100% rename from patches/api-unmapped/Add-PlayerShearBlockEvent.patch rename to patches/api/Add-PlayerShearBlockEvent.patch diff --git a/patches/api-unmapped/Add-TargetHitEvent-API.patch b/patches/api/Add-TargetHitEvent-API.patch similarity index 100% rename from patches/api-unmapped/Add-TargetHitEvent-API.patch rename to patches/api/Add-TargetHitEvent-API.patch diff --git a/patches/api-unmapped/Added-PlayerTradeEvent.patch b/patches/api/Added-PlayerTradeEvent.patch similarity index 100% rename from patches/api-unmapped/Added-PlayerTradeEvent.patch rename to patches/api/Added-PlayerTradeEvent.patch diff --git a/patches/api-unmapped/Added-WorldGameRuleChangeEvent.patch b/patches/api/Added-WorldGameRuleChangeEvent.patch similarity index 100% rename from patches/api-unmapped/Added-WorldGameRuleChangeEvent.patch rename to patches/api/Added-WorldGameRuleChangeEvent.patch diff --git a/patches/api-unmapped/Additional-Block-Material-API-s.patch b/patches/api/Additional-Block-Material-API-s.patch similarity index 100% rename from patches/api-unmapped/Additional-Block-Material-API-s.patch rename to patches/api/Additional-Block-Material-API-s.patch diff --git a/patches/api-unmapped/Enable-multi-release-plugin-jars.patch b/patches/api/Enable-multi-release-plugin-jars.patch similarity index 100% rename from patches/api-unmapped/Enable-multi-release-plugin-jars.patch rename to patches/api/Enable-multi-release-plugin-jars.patch diff --git a/patches/api-unmapped/Expose-LivingEntity-hurt-direction.patch b/patches/api/Expose-LivingEntity-hurt-direction.patch similarity index 100% rename from patches/api-unmapped/Expose-LivingEntity-hurt-direction.patch rename to patches/api/Expose-LivingEntity-hurt-direction.patch diff --git a/patches/api-unmapped/Player-Chunk-Load-Unload-Events.patch b/patches/api/Player-Chunk-Load-Unload-Events.patch similarity index 100% rename from patches/api-unmapped/Player-Chunk-Load-Unload-Events.patch rename to patches/api/Player-Chunk-Load-Unload-Events.patch diff --git a/patches/api-unmapped/Zombie-API-breaking-doors.patch b/patches/api/Zombie-API-breaking-doors.patch similarity index 100% rename from patches/api-unmapped/Zombie-API-breaking-doors.patch rename to patches/api/Zombie-API-breaking-doors.patch diff --git a/patches/server-remapped/Add-EntityLoadCrossbowEvent.patch b/patches/server-remapped/Add-EntityLoadCrossbowEvent.patch deleted file mode 100644 index dbc647923a..0000000000 --- a/patches/server-remapped/Add-EntityLoadCrossbowEvent.patch +++ /dev/null @@ -1,60 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Josh Roy <10731363+JRoy@users.noreply.github.com> -Date: Wed, 7 Oct 2020 12:04:01 -0400 -Subject: [PATCH] Add EntityLoadCrossbowEvent - - -diff --git a/src/main/java/net/minecraft/world/item/CrossbowItem.java b/src/main/java/net/minecraft/world/item/CrossbowItem.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/world/item/CrossbowItem.java -+++ b/src/main/java/net/minecraft/world/item/CrossbowItem.java -@@ -0,0 +0,0 @@ package net.minecraft.world.item; - import com.google.common.collect.Lists; - import com.mojang.math.Quaternion; - import com.mojang.math.Vector3f; -+import org.bukkit.inventory.EquipmentSlot; // Paper -+import io.papermc.paper.event.entity.EntityLoadCrossbowEvent; // Paper - EntityLoadCrossbowEvent namespace conflicts - import java.util.List; - import java.util.Random; - import java.util.function.Predicate; -@@ -0,0 +0,0 @@ public class CrossbowItem extends ProjectileWeaponItem implements Vanishable { - int j = this.getUseDuration(stack) - remainingUseTicks; - float f = getPowerForTime(j, stack); - -- if (f >= 1.0F && !isCharged(stack) && tryLoadProjectiles(user, stack)) { -+ // Paper start - EntityLoadCrossbowEvent -+ if (f >= 1.0F && !isCharged(stack) /*&& a(entityliving, itemstack)*/) { -+ final EntityLoadCrossbowEvent event = new EntityLoadCrossbowEvent(user.getBukkitLivingEntity(), stack.asBukkitMirror(), user.getUsedItemHand() == InteractionHand.MAIN_HAND ? EquipmentSlot.HAND : EquipmentSlot.OFF_HAND); -+ if (!event.callEvent() || !attemptProjectileLoad(user, stack, event.shouldConsumeItem())) return; -+ // Paper end - setCharged(stack, true); - SoundSource soundcategory = user instanceof Player ? SoundSource.PLAYERS : SoundSource.HOSTILE; - -@@ -0,0 +0,0 @@ public class CrossbowItem extends ProjectileWeaponItem implements Vanishable { - - } - -- private static boolean tryLoadProjectiles(LivingEntity shooter, ItemStack projectile) { -- int i = EnchantmentHelper.getItemEnchantmentLevel(Enchantments.MULTISHOT, projectile); -+ private static boolean attemptProjectileLoad(LivingEntity ent, ItemStack bow) { return tryLoadProjectiles(ent, bow); } // Paper - EntityLoadCrossbowEvent - OBFHELPER -+ private static boolean attemptProjectileLoad(LivingEntity ent, ItemStack bow, boolean consume) { return a(ent, bow, consume); } // Paper - EntityLoadCrossbowEvent - OBFHELPER -+ private static boolean tryLoadProjectiles(LivingEntity shooter, ItemStack projectile) { return a(shooter, projectile, true); };// Paper - add consume -+ private static boolean a(LivingEntity entityliving, ItemStack itemstack, boolean consume) { // Paper - add consume -+ int i = EnchantmentHelper.getItemEnchantmentLevel(Enchantments.MULTISHOT, itemstack); - int j = i == 0 ? 1 : 3; -- boolean flag = shooter instanceof Player && ((Player) shooter).abilities.instabuild; -- ItemStack itemstack1 = shooter.getProjectile(projectile); -+ boolean flag = !consume || entityliving instanceof Player && ((Player) entityliving).abilities.instabuild; // Paper - add consme -+ ItemStack itemstack1 = entityliving.getProjectile(itemstack); - ItemStack itemstack2 = itemstack1.copy(); - - for (int k = 0; k < j; ++k) { -@@ -0,0 +0,0 @@ public class CrossbowItem extends ProjectileWeaponItem implements Vanishable { - // CraftBukkit end - } - -- if (!loadProjectile(shooter, projectile, itemstack1, k > 0, flag)) { -+ if (!loadProjectile(entityliving, itemstack, itemstack1, k > 0, flag)) { - return false; - } - } diff --git a/patches/server-remapped/Add-PlayerShearBlockEvent.patch b/patches/server-remapped/Add-PlayerShearBlockEvent.patch deleted file mode 100644 index 4fa43c3ad1..0000000000 --- a/patches/server-remapped/Add-PlayerShearBlockEvent.patch +++ /dev/null @@ -1,116 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Josh Roy <10731363+JRoy@users.noreply.github.com> -Date: Thu, 27 Aug 2020 15:02:48 -0400 -Subject: [PATCH] Add PlayerShearBlockEvent - - -diff --git a/src/main/java/net/minecraft/world/level/block/BeehiveBlock.java b/src/main/java/net/minecraft/world/level/block/BeehiveBlock.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/world/level/block/BeehiveBlock.java -+++ b/src/main/java/net/minecraft/world/level/block/BeehiveBlock.java -@@ -0,0 +0,0 @@ - package net.minecraft.world.level.block; - -+import io.papermc.paper.event.block.PlayerShearBlockEvent; // Paper - PlayerShearBlockEvent namespace conflicts -+ - import java.util.Iterator; - import java.util.List; - import java.util.Random; -@@ -0,0 +0,0 @@ import net.minecraft.core.BlockPos; - import net.minecraft.core.Direction; - import net.minecraft.nbt.CompoundTag; - import net.minecraft.nbt.Tag; -+import net.minecraft.server.MCUtil; - import net.minecraft.server.level.ServerPlayer; - import net.minecraft.sounds.SoundEvents; - import net.minecraft.sounds.SoundSource; -@@ -0,0 +0,0 @@ public class BeehiveBlock extends BaseEntityBlock { - - if (i >= 5) { - if (itemstack.getItem() == Items.SHEARS) { -+ // Paper start - Add PlayerShearBlockEvent -+ PlayerShearBlockEvent event = new PlayerShearBlockEvent((org.bukkit.entity.Player) player.getBukkitEntity(), MCUtil.toBukkitBlock(world, pos), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemstack), (hand == InteractionHand.OFF_HAND ? org.bukkit.inventory.EquipmentSlot.OFF_HAND : org.bukkit.inventory.EquipmentSlot.HAND), new java.util.ArrayList<>()); -+ event.getDrops().add(org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(new ItemStack(Items.HONEYCOMB, 3))); -+ if (!event.callEvent()) { -+ return InteractionResult.PASS; -+ } -+ // Paper end - world.playSound(player, player.getX(), player.getY(), player.getZ(), SoundEvents.BEEHIVE_SHEAR, SoundSource.NEUTRAL, 1.0F, 1.0F); -- dropHoneycomb(world, pos); -+ // Paper start - Add PlayerShearBlockEvent -+ for (org.bukkit.inventory.ItemStack item : event.getDrops()) { -+ dropItem(world, pos, org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(item)); -+ } -+ // Paper end - itemstack.hurtAndBreak(1, player, (entityhuman1) -> { - entityhuman1.broadcastBreakEvent(hand); - }); -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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/world/level/block/Block.java -+++ b/src/main/java/net/minecraft/world/level/block/Block.java -@@ -0,0 +0,0 @@ public class Block extends BlockBehaviour implements ItemLike { - - } - -- public static void popResource(Level world, BlockPos pos, ItemStack stack) { -- if (!world.isClientSide && !stack.isEmpty() && world.getGameRules().getBoolean(GameRules.RULE_DOBLOCKDROPS)) { -+ public static void popResource(Level world, BlockPos pos, ItemStack stack) { dropItem(world, pos, stack); } public static void dropItem(Level world, BlockPos blockposition, ItemStack itemstack) { // Paper - OBFHELPER -+ if (!world.isClientSide && !itemstack.isEmpty() && world.getGameRules().getBoolean(GameRules.RULE_DOBLOCKDROPS)) { - float f = 0.5F; - double d0 = (double) (world.random.nextFloat() * 0.5F) + 0.25D; - double d1 = (double) (world.random.nextFloat() * 0.5F) + 0.25D; - double d2 = (double) (world.random.nextFloat() * 0.5F) + 0.25D; -- ItemEntity entityitem = new ItemEntity(world, (double) pos.getX() + d0, (double) pos.getY() + d1, (double) pos.getZ() + d2, stack); -+ ItemEntity entityitem = new ItemEntity(world, (double) blockposition.getX() + d0, (double) blockposition.getY() + d1, (double) blockposition.getZ() + d2, itemstack); - - entityitem.setDefaultPickUpDelay(); - // CraftBukkit start -diff --git a/src/main/java/net/minecraft/world/level/block/PumpkinBlock.java b/src/main/java/net/minecraft/world/level/block/PumpkinBlock.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/world/level/block/PumpkinBlock.java -+++ b/src/main/java/net/minecraft/world/level/block/PumpkinBlock.java -@@ -0,0 +0,0 @@ package net.minecraft.world.level.block; - - import net.minecraft.core.BlockPos; - import net.minecraft.core.Direction; -+import net.minecraft.server.MCUtil; - import net.minecraft.sounds.SoundEvents; - import net.minecraft.sounds.SoundSource; - import net.minecraft.world.InteractionHand; -@@ -0,0 +0,0 @@ import net.minecraft.world.level.Level; - import net.minecraft.world.level.block.state.BlockBehaviour; - import net.minecraft.world.level.block.state.BlockState; - import net.minecraft.world.phys.BlockHitResult; -+import io.papermc.paper.event.block.PlayerShearBlockEvent; // Paper - PlayerShearBlockEvent namespace conflicts - - public class PumpkinBlock extends StemGrownBlock { - -@@ -0,0 +0,0 @@ public class PumpkinBlock extends StemGrownBlock { - - if (itemstack.getItem() == Items.SHEARS) { - if (!world.isClientSide) { -+ // Paper start - Add PlayerShearBlockEvent -+ PlayerShearBlockEvent event = new PlayerShearBlockEvent((org.bukkit.entity.Player) player.getBukkitEntity(), MCUtil.toBukkitBlock(world, pos), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemstack), (hand == InteractionHand.OFF_HAND ? org.bukkit.inventory.EquipmentSlot.OFF_HAND : org.bukkit.inventory.EquipmentSlot.HAND), new java.util.ArrayList<>()); -+ event.getDrops().add(org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(new ItemStack(Items.PUMPKIN_SEEDS, 4))); -+ if (!event.callEvent()) { -+ return InteractionResult.PASS; -+ } -+ // Paper end - Direction enumdirection = hit.getDirection(); - Direction enumdirection1 = enumdirection.getAxis() == Direction.Axis.Y ? player.getDirection().getOpposite() : enumdirection; - - world.playSound((Player) null, pos, SoundEvents.PUMPKIN_CARVE, SoundSource.BLOCKS, 1.0F, 1.0F); - world.setBlock(pos, (BlockState) Blocks.CARVED_PUMPKIN.defaultBlockState().setValue(CarvedPumpkinBlock.FACING, enumdirection1), 11); -- ItemEntity entityitem = new ItemEntity(world, (double) pos.getX() + 0.5D + (double) enumdirection1.getStepX() * 0.65D, (double) pos.getY() + 0.1D, (double) pos.getZ() + 0.5D + (double) enumdirection1.getStepZ() * 0.65D, new ItemStack(Items.PUMPKIN_SEEDS, 4)); -+ // Paper start - Add PlayerShearBlockEvent -+ for (org.bukkit.inventory.ItemStack item : event.getDrops()) { -+ ItemEntity entityitem = new ItemEntity(world, (double) pos.getX() + 0.5D + (double) enumdirection1.getStepX() * 0.65D, (double) pos.getY() + 0.1D, (double) pos.getZ() + 0.5D + (double) enumdirection1.getStepZ() * 0.65D, org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(item)); -+ // Paper end - - entityitem.setDeltaMovement(0.05D * (double) enumdirection1.getStepX() + world.random.nextDouble() * 0.02D, 0.05D, 0.05D * (double) enumdirection1.getStepZ() + world.random.nextDouble() * 0.02D); - world.addFreshEntity(entityitem); -+ } // Paper - Add PlayerShearBlockEvent - itemstack.hurtAndBreak(1, player, (entityhuman1) -> { - entityhuman1.broadcastBreakEvent(hand); - }); diff --git a/patches/server-remapped/Added-missing-default-perms-for-commands.patch b/patches/server-remapped/Added-missing-default-perms-for-commands.patch deleted file mode 100644 index 063e919c7b..0000000000 --- a/patches/server-remapped/Added-missing-default-perms-for-commands.patch +++ /dev/null @@ -1,70 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Mon, 16 Nov 2020 12:01:52 -0800 -Subject: [PATCH] Added missing default perms for commands - - -diff --git a/src/main/java/org/bukkit/craftbukkit/util/permissions/CommandPermissions.java b/src/main/java/org/bukkit/craftbukkit/util/permissions/CommandPermissions.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/craftbukkit/util/permissions/CommandPermissions.java -+++ b/src/main/java/org/bukkit/craftbukkit/util/permissions/CommandPermissions.java -@@ -0,0 +0,0 @@ public final class CommandPermissions { - DefaultPermissions.registerPermission(PREFIX + "effect", "Allows the user to add/remove effects on players", PermissionDefault.OP, commands); - DefaultPermissions.registerPermission(PREFIX + "selector", "Allows the use of selectors", PermissionDefault.OP, commands); - DefaultPermissions.registerPermission(PREFIX + "trigger", "Allows the use of the trigger command", PermissionDefault.TRUE, commands); -+ // Paper start -+ DefaultPermissions.registerPermission(PREFIX + "attribute", "Allows the user to query, add, remove or set an entity attribute", PermissionDefault.OP, commands); -+ DefaultPermissions.registerPermission(PREFIX + "advancement", "Allows the user to give, remove, or check player advancements", PermissionDefault.OP, commands); -+ DefaultPermissions.registerPermission(PREFIX + "ban", "Allows the user to add players to banlist", PermissionDefault.OP, commands); -+ DefaultPermissions.registerPermission(PREFIX + "ban-ip", "Allows the user to add ip address to banlist", PermissionDefault.OP, commands); -+ DefaultPermissions.registerPermission(PREFIX + "banlist", "Allows the user to display banlist", PermissionDefault.OP, commands); -+ DefaultPermissions.registerPermission(PREFIX + "bossbar", "Allows the user to create and modify bossbars", PermissionDefault.OP, commands); -+ DefaultPermissions.registerPermission(PREFIX + "clear", "Allows the user to clear items from player inventory", PermissionDefault.OP, commands); -+ DefaultPermissions.registerPermission(PREFIX + "clone", "Allows the user to copy blocks from one place to another", PermissionDefault.OP, commands); -+ DefaultPermissions.registerPermission(PREFIX + "data", "Allows the user to get, merge, modify, and remove block entity and entity NBT data", PermissionDefault.OP, commands); -+ DefaultPermissions.registerPermission(PREFIX + "datapack", "Allows the user to control loaded data packs", PermissionDefault.OP, commands); -+ DefaultPermissions.registerPermission(PREFIX + "debug", "Allows the user to start or stop a debugging session", PermissionDefault.OP, commands); -+ DefaultPermissions.registerPermission(PREFIX + "deop", "Allows the user to revoke operator status from a player", PermissionDefault.OP, commands); -+ DefaultPermissions.registerPermission(PREFIX + "difficulty", "Allows the user to set the difficulty level", PermissionDefault.OP, commands); -+ DefaultPermissions.registerPermission(PREFIX + "enchant", "Allows the user to enchant a player item", PermissionDefault.OP, commands); -+ DefaultPermissions.registerPermission(PREFIX + "execute", "Allows the user to execute another command", PermissionDefault.OP, commands); -+ DefaultPermissions.registerPermission(PREFIX + "fill", "Allows the user to fill a region with a specific block", PermissionDefault.OP, commands); -+ DefaultPermissions.registerPermission(PREFIX + "forceload", "Allows the user to force chunks to be constantly loaded or not", PermissionDefault.OP, commands); -+ DefaultPermissions.registerPermission(PREFIX + "function", "Allows the user to run a function", PermissionDefault.OP, commands); -+ DefaultPermissions.registerPermission(PREFIX + "gamerule", "Allows a user to set or query a game rule value", PermissionDefault.OP, commands); -+ DefaultPermissions.registerPermission(PREFIX + "locate", "Allows the user to locate the closest structure", PermissionDefault.OP, commands); -+ DefaultPermissions.registerPermission(PREFIX + "locatebiome", "Allows the user to locate the closest biome", PermissionDefault.OP, commands); -+ DefaultPermissions.registerPermission(PREFIX + "loot", "Allows the user to drop items from an inventory slot onto the ground", PermissionDefault.OP, commands); -+ DefaultPermissions.registerPermission(PREFIX + "op", "Allows the user to grant operator status to a player", PermissionDefault.OP, commands); -+ DefaultPermissions.registerPermission(PREFIX + "pardon", "Allows the user to remove entries from the banlist", PermissionDefault.OP, commands); -+ DefaultPermissions.registerPermission(PREFIX + "particle", "Allows the user to create particles", PermissionDefault.OP, commands); -+ DefaultPermissions.registerPermission(PREFIX + "playsound", "Allows the user to play a sound", PermissionDefault.OP, commands); -+ DefaultPermissions.registerPermission(PREFIX + "recipe", "Allows the user to give or take recipes", PermissionDefault.OP, commands); -+ DefaultPermissions.registerPermission(PREFIX + "reload", "Allows the user to reload loot tables, advancements, and functions from disk", PermissionDefault.OP, commands); -+ DefaultPermissions.registerPermission(PREFIX + "replaceitem", "Allows the user to replace items in inventories", PermissionDefault.OP, commands); // Remove in 1.17 (replaced by /item) -+ DefaultPermissions.registerPermission(PREFIX + "save-all", "Allows the user to save the server to disk", PermissionDefault.OP, commands); -+ DefaultPermissions.registerPermission(PREFIX + "save-off", "Allows the user disable automatic server saves", PermissionDefault.OP, commands); -+ DefaultPermissions.registerPermission(PREFIX + "save-on", "Allows the user enable automatic server saves", PermissionDefault.OP, commands); -+ DefaultPermissions.registerPermission(PREFIX + "schedule", "Allows the user to delay the execution of a function", PermissionDefault.OP, commands); -+ DefaultPermissions.registerPermission(PREFIX + "scoreboard", "Allows the user manage scoreboard objectives and players", PermissionDefault.OP, commands); -+ DefaultPermissions.registerPermission(PREFIX + "setblock", "Allows the user to change a block to another block", PermissionDefault.OP, commands); -+ DefaultPermissions.registerPermission(PREFIX + "setidletimeout", "Allows the user to set the time before idle players are kicked", PermissionDefault.OP, commands); -+ DefaultPermissions.registerPermission(PREFIX + "setworldspawn", "Allows the user to set the world spawn", PermissionDefault.OP, commands); -+ DefaultPermissions.registerPermission(PREFIX + "spawnpoint", "Allows the user to set the spawn point for a player", PermissionDefault.OP, commands); -+ DefaultPermissions.registerPermission(PREFIX + "spectate", "Allows the user to make one player in spectator mode spectate an entity", PermissionDefault.OP, commands); -+ DefaultPermissions.registerPermission(PREFIX + "spreadplayers", "Allows the user to teleport entities to random locations", PermissionDefault.OP, commands); -+ DefaultPermissions.registerPermission(PREFIX + "stopsound", "Allows the user to stop a sound", PermissionDefault.OP, commands); -+ DefaultPermissions.registerPermission(PREFIX + "summon", "Allows the user to summon an entity", PermissionDefault.OP, commands); -+ DefaultPermissions.registerPermission(PREFIX + "tag", "Allows the user to control entity tags", PermissionDefault.OP, commands); -+ DefaultPermissions.registerPermission(PREFIX + "team", "Allows the user to control teams", PermissionDefault.OP, commands); -+ DefaultPermissions.registerPermission(PREFIX + "teammsg", "Allows the user to specify the message to send to team", PermissionDefault.TRUE, commands); -+ DefaultPermissions.registerPermission(PREFIX + "tellraw", "Allows the user to display a JSON message to players", PermissionDefault.OP, commands); -+ DefaultPermissions.registerPermission(PREFIX + "time", "Allows the user to change or query the world's game time", PermissionDefault.OP, commands); -+ DefaultPermissions.registerPermission(PREFIX + "title", "Allows the user to manage screen titles", PermissionDefault.OP, commands); -+ DefaultPermissions.registerPermission(PREFIX + "weather", "Allows the user to set the weather", PermissionDefault.OP, commands); -+ DefaultPermissions.registerPermission(PREFIX + "whitelist", "Allows the user to manage the server whitelist", PermissionDefault.OP, commands); -+ DefaultPermissions.registerPermission(PREFIX + "worldborder", "Allows the user to manage the world border", PermissionDefault.OP, commands); -+ // Paper end - - DefaultPermissions.registerPermission("minecraft.admin.command_feedback", "Receive command broadcasts when sendCommandFeedback is true", PermissionDefault.OP, commands); - diff --git a/patches/server-remapped/Implement-TargetHitEvent.patch b/patches/server-remapped/Implement-TargetHitEvent.patch deleted file mode 100644 index 3400fbcf04..0000000000 --- a/patches/server-remapped/Implement-TargetHitEvent.patch +++ /dev/null @@ -1,58 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jason Penilla <11360596+jpenilla@users.noreply.github.com> -Date: Wed, 25 Nov 2020 23:20:44 -0800 -Subject: [PATCH] Implement TargetHitEvent - - -diff --git a/src/main/java/net/minecraft/world/level/block/TargetBlock.java b/src/main/java/net/minecraft/world/level/block/TargetBlock.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/world/level/block/TargetBlock.java -+++ b/src/main/java/net/minecraft/world/level/block/TargetBlock.java -@@ -0,0 +0,0 @@ - package net.minecraft.world.level.block; - -+import io.papermc.paper.event.block.TargetHitEvent; // Paper - Need to import because 'io' class exists in nms - import java.util.Random; - import net.minecraft.advancements.CriteriaTriggers; - import net.minecraft.core.BlockPos; -@@ -0,0 +0,0 @@ public class TargetBlock extends Block { - @Override - public void onProjectileHit(Level world, BlockState state, BlockHitResult hit, Projectile projectile) { - int i = updateRedstoneOutput((LevelAccessor) world, state, hit, (Entity) projectile); -- Entity entity = projectile.getOwner(); -+ // Paper start -+ } -+ private static void awardTargetHitCriteria(Projectile iprojectile, BlockHitResult movingobjectpositionblock, int i) { -+ // Paper end -+ Entity entity = iprojectile.getOwner(); - - if (entity instanceof ServerPlayer) { - ServerPlayer entityplayer = (ServerPlayer) entity; - - entityplayer.awardStat(Stats.TARGET_HIT); -- CriteriaTriggers.TARGET_BLOCK_HIT.trigger(entityplayer, projectile, hit.getLocation(), i); -+ CriteriaTriggers.TARGET_BLOCK_HIT.trigger(entityplayer, iprojectile, movingobjectpositionblock.getLocation(), i); - } - - } -@@ -0,0 +0,0 @@ public class TargetBlock extends Block { - int i = getRedstoneStrength(movingobjectpositionblock, movingobjectpositionblock.getLocation()); - int j = entity instanceof AbstractArrow ? 20 : 8; - -+ // Paper start -+ if (entity instanceof Projectile) { -+ final Projectile projectile = (Projectile) entity; -+ final org.bukkit.craftbukkit.block.CraftBlock craftBlock = org.bukkit.craftbukkit.block.CraftBlock.at(world, movingobjectpositionblock.getBlockPos()); -+ final org.bukkit.block.BlockFace blockFace = org.bukkit.craftbukkit.block.CraftBlock.notchToBlockFace(movingobjectpositionblock.getDirection()); -+ final TargetHitEvent targetHitEvent = new TargetHitEvent((org.bukkit.entity.Projectile) projectile.getBukkitEntity(), craftBlock, blockFace, i); -+ if (targetHitEvent.callEvent()) { -+ i = targetHitEvent.getSignalStrength(); -+ awardTargetHitCriteria(projectile, movingobjectpositionblock, i); -+ } else { -+ return i; -+ } -+ } -+ // Paper end - if (!world.getBlockTicks().a(movingobjectpositionblock.getBlockPos(), state.getBlock())) { - setOutputPower(world, state, i, movingobjectpositionblock.getBlockPos(), j); - } diff --git a/patches/server-remapped/MC-4-Fix-item-position-desync.patch b/patches/server-remapped/MC-4-Fix-item-position-desync.patch deleted file mode 100644 index 9b0f431581..0000000000 --- a/patches/server-remapped/MC-4-Fix-item-position-desync.patch +++ /dev/null @@ -1,84 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: BillyGalbreath -Date: Tue, 8 Dec 2020 20:24:52 -0600 -Subject: [PATCH] MC-4: Fix item position desync - -This fixes item position desync (MC-4) by running the item coordinates -through the encode/decode methods of the packet that causes the precision -loss, which forces the server to lose the same precision as the client -keeping them in sync. - -diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java -@@ -0,0 +0,0 @@ public class PaperConfig { - private static void trackPluginScoreboards() { - trackPluginScoreboards = getBoolean("settings.track-plugin-scoreboards", false); - } -+ -+ public static boolean fixEntityPositionDesync = true; -+ private static void fixEntityPositionDesync() { -+ fixEntityPositionDesync = getBoolean("settings.fix-entity-position-desync", fixEntityPositionDesync); -+ } - } -diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundMoveEntityPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundMoveEntityPacket.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/network/protocol/game/ClientboundMoveEntityPacket.java -+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundMoveEntityPacket.java -@@ -0,0 +0,0 @@ public class ClientboundMoveEntityPacket implements Packet { -+ private static final float[] SIN = (float[]) Util.make((new float[65536]), (afloat) -> { // Paper - decompile error - for (int i = 0; i < afloat.length; ++i) { - afloat[i] = (float) Math.sin((double) i * 3.141592653589793D * 2.0D / 65536.0D); - } -@@ -0,0 +0,0 @@ public class Mth { - return d0 < (double) i ? i - 1 : i; - } - -+ public static long floorLong(double d0) { return lfloor(d0); } // Paper - OBFHELPER - public static long lfloor(double d0) { - long i = (long) d0; - -diff --git a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java -+++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java -@@ -0,0 +0,0 @@ public class ItemEntity extends Entity { - public Packet getAddEntityPacket() { - return new ClientboundAddEntityPacket(this); - } -+ -+ // Paper start - fix MC-4 -+ public void setPosRaw(double x, double y, double z) { -+ if (com.destroystokyo.paper.PaperConfig.fixEntityPositionDesync) { -+ // encode/decode from PacketPlayOutEntity -+ x = Mth.floorLong(x * 4096.0D) * (1 / 4096.0D); -+ y = Mth.floorLong(y * 4096.0D) * (1 / 4096.0D); -+ z = Mth.floorLong(z * 4096.0D) * (1 / 4096.0D); -+ } -+ super.setPosRaw(x, y, z); -+ } -+ // Paper end - fix MC-4 - } diff --git a/patches/server-remapped/Optimized-tick-ready-check.patch b/patches/server-remapped/Optimized-tick-ready-check.patch deleted file mode 100644 index 28fa517b4c..0000000000 --- a/patches/server-remapped/Optimized-tick-ready-check.patch +++ /dev/null @@ -1,51 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: lukas -Date: Sun, 27 Dec 2020 17:19:51 +0100 -Subject: [PATCH] Optimized tick ready check - - -diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/world/level/Level.java -+++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -0,0 +0,0 @@ public abstract class Level implements LevelAccessor, AutoCloseable { - if (!tileentity.isRemoved() && tileentity.hasLevel()) { - BlockPos blockposition = tileentity.getBlockPos(); - -- if (this.getChunkSource().isTickingChunk(blockposition) && this.getWorldBorder().isWithinBounds(blockposition)) { -+ LevelChunk chunk; ChunkHolder playerChunk; if ((chunk = tileentity.getCurrentChunk()) != null && (playerChunk = chunk.playerChunk) != null && playerChunk.isTickingReady() && this.getWorldBorder().isInBounds(blockposition)) { // Paper - optimized tick ready check by inlining ChunkProviderServer.a(BlockPosition). Chunk lookup is no longer required and we can use the PlayerChunk directly available through the tile entity - try { - gameprofilerfiller.push(() -> { - return String.valueOf(BlockEntityType.getKey(tileentity.getType())); - }); - tileentity.tickTimer.startTiming(); // Spigot -- if (tileentity.getType().isValid(this.getBlockState(blockposition).getBlock())) { -+ if (tileentity.getType().isValid(chunk.getBlockState(blockposition).getBlock())) { // Paper - reuse the chunk from above, do not look it up again - ((TickableBlockEntity) tileentity).tick(); - } else { - tileentity.logInvalidState(); -@@ -0,0 +0,0 @@ public abstract class Level implements LevelAccessor, AutoCloseable { - this.tickableBlockEntities.remove(tileTickPosition--); - // Spigot end - //this.tileEntityList.remove(tileentity); // Paper - remove unused list -- if (this.hasChunkAt(tileentity.getBlockPos())) { -- this.getChunkAt(tileentity.getBlockPos()).removeBlockEntity(tileentity.getBlockPos()); -+ // Paper - prevent double chunk lookups -+ LevelChunk chunk; if ((chunk = this.getChunkIfLoaded(tileentity.getBlockPos())) != null) { // inlined contents of this.isLoaded(BlockPosition). Reuse the returned chunk instead of looking it up again -+ chunk.removeBlockEntity(tileentity.getBlockPos()); - } -+ // Paper end - } - } - -@@ -0,0 +0,0 @@ public abstract class Level implements LevelAccessor, AutoCloseable { - } - // CraftBukkit end */ - -- if (this.hasChunkAt(tileentity1.getBlockPos())) { -- LevelChunk chunk = this.getChunkAt(tileentity1.getBlockPos()); -+ LevelChunk chunk; if ((chunk = this.getChunkIfLoaded(tileentity1.getBlockPos())) != null) { // Paper - inlined contents of this.isLoaded(BlockPosition). Reuse the returned chunk instead of looking it up again -+ // Chunk chunk = this.getChunkAtWorldCoords(tileentity1.getPosition()); // Paper - already computed above - BlockState iblockdata = chunk.getBlockState(tileentity1.getBlockPos()); - - chunk.setBlockEntity(tileentity1.getBlockPos(), tileentity1); diff --git a/patches/server-remapped/Player-Chunk-Load-Unload-Events.patch b/patches/server-remapped/Player-Chunk-Load-Unload-Events.patch deleted file mode 100644 index 3e2a778b3b..0000000000 --- a/patches/server-remapped/Player-Chunk-Load-Unload-Events.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: ysl3000 -Date: Mon, 5 Oct 2020 21:25:16 +0200 -Subject: [PATCH] Player Chunk Load/Unload Events - - -diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/level/ServerPlayer.java -+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -0,0 +0,0 @@ import net.minecraft.world.level.dimension.DimensionType; - import net.minecraft.world.level.portal.PortalInfo; - import net.minecraft.world.phys.AABB; - import net.minecraft.world.phys.Vec3; -+import io.papermc.paper.event.packet.PlayerChunkLoadEvent; // Paper -+import io.papermc.paper.event.packet.PlayerChunkUnloadEvent; // Paper - import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; - import net.minecraft.world.Container; -@@ -0,0 +0,0 @@ public class ServerPlayer extends Player implements ContainerListener { - public void trackChunk(ChunkPos chunkcoordintpair, Packet packet, Packet packet1) { - this.connection.send(packet1); - this.connection.send(packet); -+ // Paper start -+ if(PlayerChunkLoadEvent.getHandlerList().getRegisteredListeners().length > 0){ -+ new PlayerChunkLoadEvent(this.getBukkitEntity().getWorld().getChunkAt(chunkcoordintpair.longKey), this.getBukkitEntity()).callEvent(); -+ } -+ // Paper end - } - - public void untrackChunk(ChunkPos chunkcoordintpair) { - if (this.isAlive()) { - this.connection.send(new ClientboundForgetLevelChunkPacket(chunkcoordintpair.x, chunkcoordintpair.z)); -+ // Paper start -+ if(PlayerChunkUnloadEvent.getHandlerList().getRegisteredListeners().length > 0){ -+ new PlayerChunkUnloadEvent(this.getBukkitEntity().getWorld().getChunkAt(chunkcoordintpair.longKey), this.getBukkitEntity()).callEvent(); -+ } -+ // Paper end - } - - } diff --git a/patches/server-remapped/added-PlayerTradeEvent.patch b/patches/server-remapped/added-PlayerTradeEvent.patch deleted file mode 100644 index 90466cae64..0000000000 --- a/patches/server-remapped/added-PlayerTradeEvent.patch +++ /dev/null @@ -1,75 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Thu, 2 Jul 2020 16:12:10 -0700 -Subject: [PATCH] added PlayerTradeEvent - - -diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/world/entity/Mob.java -+++ b/src/main/java/net/minecraft/world/entity/Mob.java -@@ -0,0 +0,0 @@ import org.bukkit.event.entity.EntityUnleashEvent.UnleashReason; - public abstract class Mob extends LivingEntity { - - private static final EntityDataAccessor DATA_MOB_FLAGS_ID = SynchedEntityData.defineId(Mob.class, EntityDataSerializers.BYTE); -- public int ambientSoundTime; -+ public int ambientSoundTime;public void setAmbientSoundTime(int time) { this.ambientSoundTime = time; } // Paper - OBFHELPER - protected int xpReward; - protected LookControl lookControl; - protected MoveControl moveControl; -@@ -0,0 +0,0 @@ public abstract class Mob extends LivingEntity { - this.entityData.define(Mob.DATA_MOB_FLAGS_ID, (byte) 0); - } - -+ public int getAmbientSoundInterval() { return getAmbientSoundInterval(); } // Paper - OBFHELPER - public int getAmbientSoundInterval() { - return 80; - } -diff --git a/src/main/java/net/minecraft/world/entity/npc/AbstractVillager.java b/src/main/java/net/minecraft/world/entity/npc/AbstractVillager.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/world/entity/npc/AbstractVillager.java -+++ b/src/main/java/net/minecraft/world/entity/npc/AbstractVillager.java -@@ -0,0 +0,0 @@ import org.bukkit.craftbukkit.inventory.CraftMerchant; - import org.bukkit.craftbukkit.inventory.CraftMerchantRecipe; - import org.bukkit.event.entity.VillagerAcquireTradeEvent; - // CraftBukkit end -+// Paper start -+import io.papermc.paper.event.player.PlayerTradeEvent; -+// Paper end - - public abstract class AbstractVillager extends AgableMob implements Npc, Merchant { - -@@ -0,0 +0,0 @@ public abstract class AbstractVillager extends AgableMob implements Npc, Merchan - - @Override - public void notifyTrade(MerchantOffer offer) { -- offer.increaseUses(); -- this.ambientSoundTime = -this.getAmbientSoundInterval(); -- this.rewardTradeXp(offer); -+ // Paper - moved down -+ // Paper start - if (this.tradingPlayer instanceof ServerPlayer) { -- CriteriaTriggers.TRADE.trigger((ServerPlayer) this.tradingPlayer, this, offer.getResult()); -+ PlayerTradeEvent event = new PlayerTradeEvent(((ServerPlayer) this.tradingPlayer).getBukkitEntity(), (org.bukkit.entity.AbstractVillager) this.getBukkitEntity(), offer.asBukkit(), true, true); -+ event.callEvent(); -+ if (!event.isCancelled()) { -+ MerchantOffer recipe = CraftMerchantRecipe.fromBukkit(event.getTrade()).toMinecraft(); -+ if (event.willIncreaseTradeUses()) recipe.increaseUses(); -+ this.setAmbientSoundTime(-getAmbientSoundInterval()); -+ if (event.isRewardingExp()) this.rewardTradeXp(recipe); -+ CriteriaTriggers.TRADE.trigger((ServerPlayer) this.tradingPlayer, this, recipe.getResult()); -+ } -+ } else { -+ offer.increaseUses(); -+ this.setAmbientSoundTime(-getAmbientSoundInterval()); -+ this.rewardTradeXp(offer); - } -- -+ // Paper end - } - -- protected abstract void rewardTradeXp(MerchantOffer offer); -+ protected abstract void rewardTradeXp(MerchantOffer offer); public void rewardTradeXp(MerchantOffer merchantrecipe) { this.rewardTradeXp(merchantrecipe); } // Paper - OBFHELPER - - @Override - public boolean showProgressBar() { diff --git a/patches/server/Add-EntityLoadCrossbowEvent.patch b/patches/server/Add-EntityLoadCrossbowEvent.patch new file mode 100644 index 0000000000..aee527efe0 --- /dev/null +++ b/patches/server/Add-EntityLoadCrossbowEvent.patch @@ -0,0 +1,39 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Josh Roy <10731363+JRoy@users.noreply.github.com> +Date: Wed, 7 Oct 2020 12:04:01 -0400 +Subject: [PATCH] Add EntityLoadCrossbowEvent + + +diff --git a/src/main/java/net/minecraft/world/item/CrossbowItem.java b/src/main/java/net/minecraft/world/item/CrossbowItem.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/item/CrossbowItem.java ++++ b/src/main/java/net/minecraft/world/item/CrossbowItem.java +@@ -0,0 +0,0 @@ public class CrossbowItem extends ProjectileWeaponItem implements Vanishable { + int j = this.getUseDuration(stack) - remainingUseTicks; + float f = CrossbowItem.getPowerForTime(j, stack); + +- if (f >= 1.0F && !CrossbowItem.isCharged(stack) && CrossbowItem.tryLoadProjectiles(user, stack)) { ++ // Paper start - EntityLoadCrossbowEvent ++ if (f >= 1.0F && !CrossbowItem.isCharged(stack) /*&& CrossbowItem.tryLoadProjectiles(entityliving, itemstack)*/) { ++ final io.papermc.paper.event.entity.EntityLoadCrossbowEvent event = new io.papermc.paper.event.entity.EntityLoadCrossbowEvent(user.getBukkitLivingEntity(), stack.asBukkitMirror(), user.getUsedItemHand() == InteractionHand.MAIN_HAND ? org.bukkit.inventory.EquipmentSlot.HAND : org.bukkit.inventory.EquipmentSlot.OFF_HAND); ++ if (!event.callEvent() || !tryLoadProjectiles(user, stack, event.shouldConsumeItem())) return; ++ // Paper end + CrossbowItem.setCharged(stack, true); + SoundSource soundcategory = user instanceof Player ? SoundSource.PLAYERS : SoundSource.HOSTILE; + +@@ -0,0 +0,0 @@ public class CrossbowItem extends ProjectileWeaponItem implements Vanishable { + } + + private static boolean tryLoadProjectiles(LivingEntity shooter, ItemStack projectile) { ++ // Paper start ++ return CrossbowItem.tryLoadProjectiles(shooter, projectile, true); ++ } ++ private static boolean tryLoadProjectiles(LivingEntity shooter, ItemStack projectile, boolean consume) { ++ // Paper end + int i = EnchantmentHelper.getItemEnchantmentLevel(Enchantments.MULTISHOT, projectile); + int j = i == 0 ? 1 : 3; +- boolean flag = shooter instanceof Player && ((Player) shooter).getAbilities().instabuild; ++ boolean flag = !consume || shooter instanceof Player && ((Player) shooter).getAbilities().instabuild; // Paper - add consme + ItemStack itemstack1 = shooter.getProjectile(projectile); + ItemStack itemstack2 = itemstack1.copy(); + diff --git a/patches/server-remapped/Add-OBSTRUCTED-reason-to-BedEnterResult.patch b/patches/server/Add-OBSTRUCTED-reason-to-BedEnterResult.patch similarity index 100% rename from patches/server-remapped/Add-OBSTRUCTED-reason-to-BedEnterResult.patch rename to patches/server/Add-OBSTRUCTED-reason-to-BedEnterResult.patch diff --git a/patches/server/Add-PlayerShearBlockEvent.patch b/patches/server/Add-PlayerShearBlockEvent.patch new file mode 100644 index 0000000000..cf67fece11 --- /dev/null +++ b/patches/server/Add-PlayerShearBlockEvent.patch @@ -0,0 +1,70 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Josh Roy <10731363+JRoy@users.noreply.github.com> +Date: Thu, 27 Aug 2020 15:02:48 -0400 +Subject: [PATCH] Add PlayerShearBlockEvent + + +diff --git a/src/main/java/net/minecraft/world/level/block/BeehiveBlock.java b/src/main/java/net/minecraft/world/level/block/BeehiveBlock.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/block/BeehiveBlock.java ++++ b/src/main/java/net/minecraft/world/level/block/BeehiveBlock.java +@@ -0,0 +0,0 @@ public class BeehiveBlock extends BaseEntityBlock { + } + + public static void dropHoneycomb(Level world, BlockPos pos) { +- popResource(world, pos, new ItemStack(Items.HONEYCOMB, 3)); ++ popResource(world, pos, new ItemStack(Items.HONEYCOMB, 3)); // Paper - conflict on change, item needs to be set below + } + + @Override +@@ -0,0 +0,0 @@ public class BeehiveBlock extends BaseEntityBlock { + Item item = itemstack.getItem(); + + if (itemstack.is(Items.SHEARS)) { ++ // Paper start - Add PlayerShearBlockEvent ++ io.papermc.paper.event.block.PlayerShearBlockEvent event = new io.papermc.paper.event.block.PlayerShearBlockEvent((org.bukkit.entity.Player) player.getBukkitEntity(), net.minecraft.server.MCUtil.toBukkitBlock(world, pos), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemstack), (hand == InteractionHand.OFF_HAND ? org.bukkit.inventory.EquipmentSlot.OFF_HAND : org.bukkit.inventory.EquipmentSlot.HAND), new java.util.ArrayList<>()); ++ event.getDrops().add(org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(new ItemStack(Items.HONEYCOMB, 3))); ++ if (!event.callEvent()) { ++ return InteractionResult.PASS; ++ } ++ // Paper end + world.playSound(player, player.getX(), player.getY(), player.getZ(), SoundEvents.BEEHIVE_SHEAR, SoundSource.NEUTRAL, 1.0F, 1.0F); +- BeehiveBlock.dropHoneycomb(world, pos); ++ // Paper start - Add PlayerShearBlockEvent ++ for (org.bukkit.inventory.ItemStack itemDrop : event.getDrops()) { ++ popResource(world, pos, org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(itemDrop)); ++ } ++ // Paper end + itemstack.hurtAndBreak(1, player, (entityhuman1) -> { + entityhuman1.broadcastBreakEvent(hand); + }); +diff --git a/src/main/java/net/minecraft/world/level/block/PumpkinBlock.java b/src/main/java/net/minecraft/world/level/block/PumpkinBlock.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/block/PumpkinBlock.java ++++ b/src/main/java/net/minecraft/world/level/block/PumpkinBlock.java +@@ -0,0 +0,0 @@ public class PumpkinBlock extends StemGrownBlock { + ItemStack itemStack = player.getItemInHand(hand); + if (itemStack.is(Items.SHEARS)) { + if (!world.isClientSide) { ++ // Paper start - Add PlayerShearBlockEvent ++ io.papermc.paper.event.block.PlayerShearBlockEvent event = new io.papermc.paper.event.block.PlayerShearBlockEvent((org.bukkit.entity.Player) player.getBukkitEntity(), net.minecraft.server.MCUtil.toBukkitBlock(world, pos), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemStack), (hand == InteractionHand.OFF_HAND ? org.bukkit.inventory.EquipmentSlot.OFF_HAND : org.bukkit.inventory.EquipmentSlot.HAND), new java.util.ArrayList<>()); ++ event.getDrops().add(org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(new ItemStack(Items.PUMPKIN_SEEDS, 4))); ++ if (!event.callEvent()) { ++ return InteractionResult.PASS; ++ } ++ // Paper end + Direction direction = hit.getDirection(); + Direction direction2 = direction.getAxis() == Direction.Axis.Y ? player.getDirection().getOpposite() : direction; + world.playSound((Player)null, pos, SoundEvents.PUMPKIN_CARVE, SoundSource.BLOCKS, 1.0F, 1.0F); + world.setBlock(pos, Blocks.CARVED_PUMPKIN.defaultBlockState().setValue(CarvedPumpkinBlock.FACING, direction2), 11); +- ItemEntity itemEntity = new ItemEntity(world, (double)pos.getX() + 0.5D + (double)direction2.getStepX() * 0.65D, (double)pos.getY() + 0.1D, (double)pos.getZ() + 0.5D + (double)direction2.getStepZ() * 0.65D, new ItemStack(Items.PUMPKIN_SEEDS, 4)); ++ // Paper start - Add PlayerShearBlockEvent ++ for (org.bukkit.inventory.ItemStack item : event.getDrops()) { ++ ItemEntity itemEntity = new ItemEntity(world, (double) pos.getX() + 0.5D + (double) direction2.getStepX() * 0.65D, (double) pos.getY() + 0.1D, (double) pos.getZ() + 0.5D + (double) direction2.getStepZ() * 0.65D, org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(item)); ++ // Paper end + itemEntity.setDeltaMovement(0.05D * (double)direction2.getStepX() + world.random.nextDouble() * 0.02D, 0.05D, 0.05D * (double)direction2.getStepZ() + world.random.nextDouble() * 0.02D); + world.addFreshEntity(itemEntity); ++ } // Paper - Add PlayerShearBlockEvent + itemStack.hurtAndBreak(1, player, (playerx) -> { + playerx.broadcastBreakEvent(hand); + }); diff --git a/patches/server-remapped/Add-warning-for-servers-not-running-on-Java-16.patch b/patches/server/Add-warning-for-servers-not-running-on-Java-16.patch similarity index 88% rename from patches/server-remapped/Add-warning-for-servers-not-running-on-Java-16.patch rename to patches/server/Add-warning-for-servers-not-running-on-Java-16.patch index e5c8c7ead3..a6a7e93a66 100644 --- a/patches/server-remapped/Add-warning-for-servers-not-running-on-Java-16.patch +++ b/patches/server/Add-warning-for-servers-not-running-on-Java-16.patch @@ -62,19 +62,11 @@ diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/ index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -0,0 +0,0 @@ import org.bukkit.event.server.ServerLoadEvent; - - import co.aikar.timings.MinecraftTimings; // Paper - import org.spigotmc.SlackActivityAccountant; // Spigot -+import io.papermc.paper.util.PaperJvmChecker; // Paper - - public abstract class MinecraftServer extends ReentrantBlockableEventLoop implements SnooperPopulator, CommandSource, AutoCloseable { - @@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop context, String name); ++ protected abstract void updateFromArgument(CommandContext context, String name, GameRules.Key gameRuleKey); // Paper + +- public void setFromArgument(CommandContext context, String name) { +- this.updateFromArgument(context, name); ++ public void setFromArgument(CommandContext context, String name, GameRules.Key gameRuleKey) { // Paper ++ this.updateFromArgument(context, name, gameRuleKey); // Paper + this.onChanged(((CommandSourceStack) context.getSource()).getServer()); + } @@ -0,0 +0,0 @@ public class GameRules { } @@ -35,8 +41,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @Override - protected void updateFromArgument(CommandContext context, String name) { - this.value = BoolArgumentType.getBool(context, name); -+ protected void a(CommandContext commandcontext, String s, GameRules.Key gameRuleKey) { // Paper start -+ WorldGameRuleChangeEvent event = new WorldGameRuleChangeEvent(commandcontext.getSource().getBukkitWorld(), commandcontext.getSource().getBukkitSender(), (org.bukkit.GameRule) org.bukkit.GameRule.getByName(gameRuleKey.toString()), String.valueOf(BoolArgumentType.getBool(commandcontext, s))); ++ protected void updateFromArgument(CommandContext context, String name, GameRules.Key gameRuleKey) { // Paper start ++ io.papermc.paper.event.world.WorldGameRuleChangeEvent event = new io.papermc.paper.event.world.WorldGameRuleChangeEvent(context.getSource().getBukkitWorld(), context.getSource().getBukkitSender(), (org.bukkit.GameRule) org.bukkit.GameRule.getByName(gameRuleKey.toString()), String.valueOf(BoolArgumentType.getBool(context, name))); + if (!event.callEvent()) return; + this.value = Boolean.parseBoolean(event.getValue()); + // Paper end @@ -49,62 +55,44 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @Override - protected void updateFromArgument(CommandContext context, String name) { - this.value = IntegerArgumentType.getInteger(context, name); -+ protected void a(CommandContext commandcontext, String s, GameRules.Key gameRuleKey) { // Paper start -+ WorldGameRuleChangeEvent event = new WorldGameRuleChangeEvent(commandcontext.getSource().getBukkitWorld(), commandcontext.getSource().getBukkitSender(), (org.bukkit.GameRule) org.bukkit.GameRule.getByName(gameRuleKey.toString()), String.valueOf(IntegerArgumentType.getInteger(commandcontext, s))); ++ protected void updateFromArgument(CommandContext context, String name, GameRules.Key gameRuleKey) { // Paper start ++ io.papermc.paper.event.world.WorldGameRuleChangeEvent event = new io.papermc.paper.event.world.WorldGameRuleChangeEvent(context.getSource().getBukkitWorld(), context.getSource().getBukkitSender(), (org.bukkit.GameRule) org.bukkit.GameRule.getByName(gameRuleKey.toString()), String.valueOf(IntegerArgumentType.getInteger(context, name))); + if (!event.callEvent()) return; + this.value = Integer.parseInt(event.getValue()); + // Paper end } public int get() { -@@ -0,0 +0,0 @@ public class GameRules { - this.type = type; - } - -- protected abstract void updateFromArgument(CommandContext context, String name); -+ protected void updateValue(CommandContext commandcontext, String s, GameRules.Key gameRuleKey) { this.a(commandcontext, s, gameRuleKey); } // Paper - OBFHELPER -+ protected abstract void a(CommandContext commandcontext, String s, GameRules.Key gameRuleKey); // Paper - -- public void setFromArgument(CommandContext context, String name) { -- this.updateFromArgument(context, name); -- this.onChanged(((CommandSourceStack) context.getSource()).getServer()); -+ public void setValue(CommandContext commandcontext, String s, GameRules.Key gameRuleKey) { this.b(commandcontext, s, gameRuleKey); } // Paper - OBFHELPER -+ public void b(CommandContext commandcontext, String s, GameRules.Key gameRuleKey) { // Paper -+ this.updateValue(commandcontext, s, gameRuleKey); // Paper -+ this.onChanged(((CommandSourceStack) commandcontext.getSource()).getServer()); - } - - public void onChanged(@Nullable MinecraftServer server) { diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -0,0 +0,0 @@ public class CraftWorld implements World { - if (!isGameRule(rule)) return false; + if (!this.isGameRule(rule)) return false; + // Paper start + GameRule gameRule = GameRule.getByName(rule); + io.papermc.paper.event.world.WorldGameRuleChangeEvent event = new io.papermc.paper.event.world.WorldGameRuleChangeEvent(this, null, gameRule, value); + if (!event.callEvent()) return false; + // Paper end - GameRules.Value handle = getHandle().getGameRules().getRule(getGameRulesNMS().get(rule)); + GameRules.Value handle = this.getHandle().getGameRules().getRule(CraftWorld.getGameRulesNMS().get(rule)); - handle.deserialize(value); -+ handle.deserialize(event.getValue().toString()); // Paper - handle.onChanged(getHandle().getServer()); ++ handle.deserialize(event.getValue()); // Paper + handle.onChanged(this.getHandle().getServer()); return true; } @@ -0,0 +0,0 @@ public class CraftWorld implements World { - if (!isGameRule(rule.getName())) return false; + if (!this.isGameRule(rule.getName())) return false; + // Paper start + io.papermc.paper.event.world.WorldGameRuleChangeEvent event = new io.papermc.paper.event.world.WorldGameRuleChangeEvent(this, null, rule, String.valueOf(newValue)); + if (!event.callEvent()) return false; + // Paper end - GameRules.Value handle = getHandle().getGameRules().getRule(getGameRulesNMS().get(rule.getName())); + GameRules.Value handle = this.getHandle().getGameRules().getRule(CraftWorld.getGameRulesNMS().get(rule.getName())); - handle.deserialize(newValue.toString()); -+ handle.deserialize(event.getValue().toString()); // Paper - handle.onChanged(getHandle().getServer()); ++ handle.deserialize(event.getValue()); // Paper + handle.onChanged(this.getHandle().getServer()); return true; } diff --git a/patches/server/Added-missing-default-perms-for-commands.patch b/patches/server/Added-missing-default-perms-for-commands.patch new file mode 100644 index 0000000000..aa1f7c7189 --- /dev/null +++ b/patches/server/Added-missing-default-perms-for-commands.patch @@ -0,0 +1,70 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Mon, 16 Nov 2020 12:01:52 -0800 +Subject: [PATCH] Added missing default perms for commands + + +diff --git a/src/main/java/org/bukkit/craftbukkit/util/permissions/CommandPermissions.java b/src/main/java/org/bukkit/craftbukkit/util/permissions/CommandPermissions.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/craftbukkit/util/permissions/CommandPermissions.java ++++ b/src/main/java/org/bukkit/craftbukkit/util/permissions/CommandPermissions.java +@@ -0,0 +0,0 @@ public final class CommandPermissions { + DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "effect", "Allows the user to add/remove effects on players", PermissionDefault.OP, commands); + DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "selector", "Allows the use of selectors", PermissionDefault.OP, commands); + DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "trigger", "Allows the use of the trigger command", PermissionDefault.TRUE, commands); ++ // Paper start ++ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "attribute", "Allows the user to query, add, remove or set an entity attribute", PermissionDefault.OP, commands); ++ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "advancement", "Allows the user to give, remove, or check player advancements", PermissionDefault.OP, commands); ++ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "ban", "Allows the user to add players to banlist", PermissionDefault.OP, commands); ++ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "ban-ip", "Allows the user to add ip address to banlist", PermissionDefault.OP, commands); ++ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "banlist", "Allows the user to display banlist", PermissionDefault.OP, commands); ++ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "bossbar", "Allows the user to create and modify bossbars", PermissionDefault.OP, commands); ++ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "clear", "Allows the user to clear items from player inventory", PermissionDefault.OP, commands); ++ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "clone", "Allows the user to copy blocks from one place to another", PermissionDefault.OP, commands); ++ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "data", "Allows the user to get, merge, modify, and remove block entity and entity NBT data", PermissionDefault.OP, commands); ++ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "datapack", "Allows the user to control loaded data packs", PermissionDefault.OP, commands); ++ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "debug", "Allows the user to start or stop a debugging session", PermissionDefault.OP, commands); ++ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "deop", "Allows the user to revoke operator status from a player", PermissionDefault.OP, commands); ++ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "difficulty", "Allows the user to set the difficulty level", PermissionDefault.OP, commands); ++ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "enchant", "Allows the user to enchant a player item", PermissionDefault.OP, commands); ++ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "execute", "Allows the user to execute another command", PermissionDefault.OP, commands); ++ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "fill", "Allows the user to fill a region with a specific block", PermissionDefault.OP, commands); ++ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "forceload", "Allows the user to force chunks to be constantly loaded or not", PermissionDefault.OP, commands); ++ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "function", "Allows the user to run a function", PermissionDefault.OP, commands); ++ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "gamerule", "Allows a user to set or query a game rule value", PermissionDefault.OP, commands); ++ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "locate", "Allows the user to locate the closest structure", PermissionDefault.OP, commands); ++ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "locatebiome", "Allows the user to locate the closest biome", PermissionDefault.OP, commands); ++ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "loot", "Allows the user to drop items from an inventory slot onto the ground", PermissionDefault.OP, commands); ++ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "op", "Allows the user to grant operator status to a player", PermissionDefault.OP, commands); ++ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "pardon", "Allows the user to remove entries from the banlist", PermissionDefault.OP, commands); ++ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "particle", "Allows the user to create particles", PermissionDefault.OP, commands); ++ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "playsound", "Allows the user to play a sound", PermissionDefault.OP, commands); ++ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "recipe", "Allows the user to give or take recipes", PermissionDefault.OP, commands); ++ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "reload", "Allows the user to reload loot tables, advancements, and functions from disk", PermissionDefault.OP, commands); ++ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "item", "Allows the user to replace items in inventories", PermissionDefault.OP, commands); // Remove in 1.17 (replaced by /item) ++ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "save-all", "Allows the user to save the server to disk", PermissionDefault.OP, commands); ++ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "save-off", "Allows the user disable automatic server saves", PermissionDefault.OP, commands); ++ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "save-on", "Allows the user enable automatic server saves", PermissionDefault.OP, commands); ++ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "schedule", "Allows the user to delay the execution of a function", PermissionDefault.OP, commands); ++ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "scoreboard", "Allows the user manage scoreboard objectives and players", PermissionDefault.OP, commands); ++ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "setblock", "Allows the user to change a block to another block", PermissionDefault.OP, commands); ++ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "setidletimeout", "Allows the user to set the time before idle players are kicked", PermissionDefault.OP, commands); ++ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "setworldspawn", "Allows the user to set the world spawn", PermissionDefault.OP, commands); ++ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "spawnpoint", "Allows the user to set the spawn point for a player", PermissionDefault.OP, commands); ++ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "spectate", "Allows the user to make one player in spectator mode spectate an entity", PermissionDefault.OP, commands); ++ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "spreadplayers", "Allows the user to teleport entities to random locations", PermissionDefault.OP, commands); ++ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "stopsound", "Allows the user to stop a sound", PermissionDefault.OP, commands); ++ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "summon", "Allows the user to summon an entity", PermissionDefault.OP, commands); ++ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "tag", "Allows the user to control entity tags", PermissionDefault.OP, commands); ++ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "team", "Allows the user to control teams", PermissionDefault.OP, commands); ++ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "teammsg", "Allows the user to specify the message to send to team", PermissionDefault.TRUE, commands); ++ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "tellraw", "Allows the user to display a JSON message to players", PermissionDefault.OP, commands); ++ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "time", "Allows the user to change or query the world's game time", PermissionDefault.OP, commands); ++ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "title", "Allows the user to manage screen titles", PermissionDefault.OP, commands); ++ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "weather", "Allows the user to set the weather", PermissionDefault.OP, commands); ++ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "whitelist", "Allows the user to manage the server whitelist", PermissionDefault.OP, commands); ++ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "worldborder", "Allows the user to manage the world border", PermissionDefault.OP, commands); ++ // Paper end + + DefaultPermissions.registerPermission("minecraft.admin.command_feedback", "Receive command broadcasts when sendCommandFeedback is true", PermissionDefault.OP, commands); + diff --git a/patches/server-remapped/Additional-Block-Material-API-s.patch b/patches/server/Additional-Block-Material-API-s.patch similarity index 78% rename from patches/server-remapped/Additional-Block-Material-API-s.patch rename to patches/server/Additional-Block-Material-API-s.patch index ccb6b3496d..346a59c3e6 100644 --- a/patches/server-remapped/Additional-Block-Material-API-s.patch +++ b/patches/server/Additional-Block-Material-API-s.patch @@ -13,17 +13,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java @@ -0,0 +0,0 @@ public class CraftBlock implements Block { - return getNMS().getMaterial().isLiquid(); + return this.getNMS().getMaterial().isLiquid(); } + // Paper start + @Override + public boolean isBuildable() { -+ return getNMS().getMaterial().isBuildable(); ++ return getNMS().getMaterial().isSolid(); // This is in fact isSolid, despite the fact that isSolid below returns blocksMotion + } + @Override + public boolean isBurnable() { -+ return getNMS().getMaterial().isBurnable(); ++ return getNMS().getMaterial().isFlammable(); + } + @Override + public boolean isReplaceable() { @@ -37,4 +37,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + @Override public PistonMoveReaction getPistonMoveReaction() { - return PistonMoveReaction.getById(getNMS().getPistonPushReaction().ordinal()); + return PistonMoveReaction.getById(this.getNMS().getPistonPushReaction().ordinal()); diff --git a/patches/server-remapped/Allow-disabling-mob-spawner-spawn-egg-transformation.patch b/patches/server/Allow-disabling-mob-spawner-spawn-egg-transformation.patch similarity index 91% rename from patches/server-remapped/Allow-disabling-mob-spawner-spawn-egg-transformation.patch rename to patches/server/Allow-disabling-mob-spawner-spawn-egg-transformation.patch index ddd0ad2478..91db7a8951 100644 --- a/patches/server-remapped/Allow-disabling-mob-spawner-spawn-egg-transformation.patch +++ b/patches/server/Allow-disabling-mob-spawner-spawn-egg-transformation.patch @@ -9,15 +9,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -0,0 +0,0 @@ public class PaperWorldConfig { - private void fixCuringExploit() { fixCuringZombieVillagerDiscountExploit = getBoolean("game-mechanics.fix-curing-zombie-villager-discount-exploit", fixCuringZombieVillagerDiscountExploit); } -+ + + public boolean disableMobSpawnerSpawnEggTransformation = false; + private void disableMobSpawnerSpawnEggTransformation() { + disableMobSpawnerSpawnEggTransformation = getBoolean("game-mechanics.disable-mob-spawner-spawn-egg-transformation", disableMobSpawnerSpawnEggTransformation); + } - } ++ + public short keepLoadedRange; + private void keepLoadedRange() { + keepLoadedRange = (short) (getInt("keep-spawn-loaded-range", Math.min(spigotConfig.viewDistance, 10)) * 16); diff --git a/src/main/java/net/minecraft/world/item/SpawnEggItem.java b/src/main/java/net/minecraft/world/item/SpawnEggItem.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/item/SpawnEggItem.java diff --git a/patches/server-remapped/Cache-burn-durations.patch b/patches/server/Cache-burn-durations.patch similarity index 52% rename from patches/server-remapped/Cache-burn-durations.patch rename to patches/server/Cache-burn-durations.patch index cc315fd289..d6e4a4e829 100644 --- a/patches/server-remapped/Cache-burn-durations.patch +++ b/patches/server/Cache-burn-durations.patch @@ -8,20 +8,11 @@ diff --git a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnac index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java -@@ -0,0 +0,0 @@ - package net.minecraft.world.level.block.entity; - -+import com.google.common.collect.ImmutableMap; - import com.google.common.collect.Lists; - import com.google.common.collect.Maps; - import it.unimi.dsi.fastutil.objects.Object2IntMap.Entry; @@ -0,0 +0,0 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit this.recipeType = recipeType; } + private static Map cachedBurnDurations = null; // Paper - cache burn durations -+ -+ public static Map getBurnDurations() { return getFuel(); } // Paper - OBFHELPER public static Map getFuel() { + // Paper start - cache burn durations + if(cachedBurnDurations != null) { @@ -30,34 +21,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper end Map map = Maps.newLinkedHashMap(); - add(map, (ItemLike) Items.LAVA_BUCKET, 20000); + AbstractFurnaceBlockEntity.add(map, (ItemLike) Items.LAVA_BUCKET, 20000); @@ -0,0 +0,0 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit - add(map, (ItemLike) Blocks.FLETCHING_TABLE, 300); - add(map, (ItemLike) Blocks.SMITHING_TABLE, 300); - add(map, (ItemLike) Blocks.COMPOSTER, 300); + AbstractFurnaceBlockEntity.add(map, (ItemLike) Blocks.COMPOSTER, 300); + AbstractFurnaceBlockEntity.add(map, (ItemLike) Blocks.AZALEA, 100); + AbstractFurnaceBlockEntity.add(map, (ItemLike) Blocks.FLOWERING_AZALEA, 100); - return map; + // Paper start - cache burn durations -+ cachedBurnDurations = ImmutableMap.copyOf(map); ++ cachedBurnDurations = com.google.common.collect.ImmutableMap.copyOf(map); + return cachedBurnDurations; + // Paper end } // CraftBukkit start - add fields and methods -@@ -0,0 +0,0 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit - } else { - Item item = fuel.getItem(); - -- return (Integer) getFuel().getOrDefault(item, 0); -+ return getBurnDurations().getOrDefault(item, 0); // Paper - cache burn durations - } - } - -@@ -0,0 +0,0 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit - // Paper end - - public static boolean isFuel(ItemStack stack) { -- return getFuel().containsKey(stack.getItem()); -+ return getBurnDurations().containsKey(stack.getItem()); // Paper - cache burn durations - } - - @Override diff --git a/patches/server-remapped/Do-not-crash-from-invalid-ingredient-lists-in-Villag.patch b/patches/server/Do-not-crash-from-invalid-ingredient-lists-in-Villag.patch similarity index 97% rename from patches/server-remapped/Do-not-crash-from-invalid-ingredient-lists-in-Villag.patch rename to patches/server/Do-not-crash-from-invalid-ingredient-lists-in-Villag.patch index 5b8c0b43ed..5ac05622bf 100644 --- a/patches/server-remapped/Do-not-crash-from-invalid-ingredient-lists-in-Villag.patch +++ b/patches/server/Do-not-crash-from-invalid-ingredient-lists-in-Villag.patch @@ -9,7 +9,7 @@ diff --git a/src/main/java/net/minecraft/world/entity/npc/AbstractVillager.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/entity/npc/AbstractVillager.java +++ b/src/main/java/net/minecraft/world/entity/npc/AbstractVillager.java -@@ -0,0 +0,0 @@ public abstract class AbstractVillager extends AgableMob implements Npc, Merchan +@@ -0,0 +0,0 @@ public abstract class AbstractVillager extends AgeableMob implements InventoryCa Bukkit.getPluginManager().callEvent(event); } if (!event.isCancelled()) { diff --git a/patches/server-remapped/Expose-LivingEntity-hurt-direction.patch b/patches/server/Expose-LivingEntity-hurt-direction.patch similarity index 52% rename from patches/server-remapped/Expose-LivingEntity-hurt-direction.patch rename to patches/server/Expose-LivingEntity-hurt-direction.patch index a028d21b36..a86f75098a 100644 --- a/patches/server-remapped/Expose-LivingEntity-hurt-direction.patch +++ b/patches/server/Expose-LivingEntity-hurt-direction.patch @@ -4,19 +4,6 @@ Date: Sun, 13 Dec 2020 05:32:05 +0200 Subject: [PATCH] Expose LivingEntity hurt direction -diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/world/entity/LivingEntity.java -+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity { - public int removeStingerTime; - public int hurtTime; - public int hurtDuration; -- public float hurtDir; -+ public float hurtDir; public final float getHurtDirection() { return hurtDir; } public final void setHurtDirection(float hurtDirection) { this.hurtDir = hurtDirection; } // Paper - OBFHELPER - public int deathTime; - public float oAttackAnim; - public float attackAnim; diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java @@ -28,12 +15,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + @Override + public float getHurtDirection() { -+ return getHandle().getHurtDirection(); ++ return getHandle().hurtDir; + } + + @Override + public void setHurtDirection(float hurtDirection) { -+ getHandle().setHurtDirection(hurtDirection); ++ getHandle().hurtDir = hurtDirection; + } // Paper end } diff --git a/patches/server-remapped/Fix-CraftSound-backwards-compatibility.patch b/patches/server/Fix-CraftSound-backwards-compatibility.patch similarity index 100% rename from patches/server-remapped/Fix-CraftSound-backwards-compatibility.patch rename to patches/server/Fix-CraftSound-backwards-compatibility.patch diff --git a/patches/server-remapped/Fix-curing-zombie-villager-discount-exploit.patch b/patches/server/Fix-curing-zombie-villager-discount-exploit.patch similarity index 71% rename from patches/server-remapped/Fix-curing-zombie-villager-discount-exploit.patch rename to patches/server/Fix-curing-zombie-villager-discount-exploit.patch index cc9bc338f2..17d300c0b1 100644 --- a/patches/server-remapped/Fix-curing-zombie-villager-discount-exploit.patch +++ b/patches/server/Fix-curing-zombie-villager-discount-exploit.patch @@ -12,27 +12,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -0,0 +0,0 @@ public class PaperWorldConfig { - private void fixClimbingBypassingCrammingRule() { fixClimbingBypassingCrammingRule = getBoolean("fix-climbing-bypassing-cramming-rule", fixClimbingBypassingCrammingRule); } -+ + + public boolean fixCuringZombieVillagerDiscountExploit = true; + private void fixCuringExploit() { + fixCuringZombieVillagerDiscountExploit = getBoolean("game-mechanics.fix-curing-zombie-villager-discount-exploit", fixCuringZombieVillagerDiscountExploit); + } - } -diff --git a/src/main/java/net/minecraft/world/entity/ai/gossip/GossipContainer.java b/src/main/java/net/minecraft/world/entity/ai/gossip/GossipContainer.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/world/entity/ai/gossip/GossipContainer.java -+++ b/src/main/java/net/minecraft/world/entity/ai/gossip/GossipContainer.java -@@ -0,0 +0,0 @@ public class GossipContainer { - - } - -+ public final void removeReputationForType(GossipType reputationType) { this.remove(reputationType); } // Paper - OBFHELPER - public void remove(GossipType gossipType) { - this.entries.removeInt(gossipType); - } ++ + public short keepLoadedRange; + private void keepLoadedRange() { + keepLoadedRange = (short) (getInt("keep-spawn-loaded-range", Math.min(spigotConfig.viewDistance, 10)) * 16); diff --git a/src/main/java/net/minecraft/world/entity/npc/Villager.java b/src/main/java/net/minecraft/world/entity/npc/Villager.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/entity/npc/Villager.java @@ -45,8 +35,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + if (level.paperConfig.fixCuringZombieVillagerDiscountExploit) { + final GossipContainer.EntityGossips playerReputation = this.getReputation().getReputations().get(entity.getUUID()); + if (playerReputation != null) { -+ playerReputation.removeReputationForType(GossipType.MAJOR_POSITIVE); -+ playerReputation.removeReputationForType(GossipType.MINOR_POSITIVE); ++ playerReputation.remove(GossipType.MAJOR_POSITIVE); ++ playerReputation.remove(GossipType.MINOR_POSITIVE); + } + } + // Paper end diff --git a/patches/server-remapped/Fix-harming-potion-dupe.patch b/patches/server/Fix-harming-potion-dupe.patch similarity index 73% rename from patches/server-remapped/Fix-harming-potion-dupe.patch rename to patches/server/Fix-harming-potion-dupe.patch index 94c41b31e4..c8b00beca3 100644 --- a/patches/server-remapped/Fix-harming-potion-dupe.patch +++ b/patches/server/Fix-harming-potion-dupe.patch @@ -11,14 +11,6 @@ diff --git a/src/main/java/net/minecraft/world/item/PotionItem.java b/src/main/j index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/item/PotionItem.java +++ b/src/main/java/net/minecraft/world/item/PotionItem.java -@@ -0,0 +0,0 @@ import net.minecraft.world.entity.player.Player; - import net.minecraft.world.item.alchemy.Potion; - import net.minecraft.world.item.alchemy.PotionUtils; - import net.minecraft.world.item.alchemy.Potions; -+import net.minecraft.world.level.GameRules; - import net.minecraft.world.level.Level; - - public class PotionItem extends Item { @@ -0,0 +0,0 @@ public class PotionItem extends Item { CriteriaTriggers.CONSUME_ITEM.trigger((ServerPlayer) entityhuman, stack); } @@ -30,8 +22,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class PotionItem extends Item { MobEffectInstance mobeffect = (MobEffectInstance) iterator.next(); - if (mobeffect.getMobEffect().isInstant()) { -- mobeffect.getMobEffect().applyInstantEffect(entityhuman, entityhuman, user, mobeffect.getAmplifier(), 1.0D); + if (mobeffect.getEffect().isInstantenous()) { +- mobeffect.getEffect().applyInstantenousEffect(entityhuman, entityhuman, user, mobeffect.getAmplifier(), 1.0D); + instantLater.add(mobeffect); // Paper - Fix harming potion dupe } else { user.addEffect(new MobEffectInstance(mobeffect), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.POTION_DRINK); // CraftBukkit @@ -42,18 +34,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper start - Fix harming potion dupe + for (MobEffectInstance mobeffect : instantLater) { -+ mobeffect.getMobEffect().applyInstantEffect(entityhuman, entityhuman, user, mobeffect.getAmplifier(), 1.0D); ++ mobeffect.getEffect().applyInstantenousEffect(entityhuman, entityhuman, user, mobeffect.getAmplifier(), 1.0D); + } + // Paper end -+ - if (entityhuman == null || !entityhuman.abilities.instabuild) { + if (entityhuman == null || !entityhuman.getAbilities().instabuild) { + // Paper start - Fix harming potion dupe -+ if (user.getHealth() <= 0 && !user.level.getGameRules().getBoolean(GameRules.RULE_KEEPINVENTORY)) { -+ user.dropItem(new ItemStack(Items.GLASS_BOTTLE), 0); -+ return ItemStack.NULL_ITEM; ++ if (user.getHealth() <= 0 && !user.level.getGameRules().getBoolean(net.minecraft.world.level.GameRules.RULE_KEEPINVENTORY)) { ++ user.spawnAtLocation(new ItemStack(Items.GLASS_BOTTLE), 0); ++ return ItemStack.EMPTY; + } + // Paper end -+ if (stack.isEmpty()) { return new ItemStack(Items.GLASS_BOTTLE); } diff --git a/patches/server-remapped/Fix-interact-event-not-being-called-in-adventure.patch b/patches/server/Fix-interact-event-not-being-called-in-adventure.patch similarity index 80% rename from patches/server-remapped/Fix-interact-event-not-being-called-in-adventure.patch rename to patches/server/Fix-interact-event-not-being-called-in-adventure.patch index 2b47f1c1f9..2dfb556a32 100644 --- a/patches/server-remapped/Fix-interact-event-not-being-called-in-adventure.patch +++ b/patches/server/Fix-interact-event-not-being-called-in-adventure.patch @@ -9,21 +9,21 @@ diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListener index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener { - MutableComponent ichatmutablecomponent = (new TranslatableComponent("build.tooHigh", new Object[]{this.server.getMaxBuildHeight()})).withStyle(ChatFormatting.RED); +@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser + MutableComponent ichatmutablecomponent = (new TranslatableComponent("build.tooHigh", new Object[]{i - 1})).withStyle(ChatFormatting.RED); - this.player.connection.send(new ClientboundChatPacket(ichatmutablecomponent, ChatType.GAME_INFO, Util.NIL_UUID)); + this.player.sendMessage((Component) ichatmutablecomponent, ChatType.GAME_INFO, Util.NIL_UUID); - } else if (enuminteractionresult.shouldSwing()) { + } else if (enuminteractionresult.shouldSwing() && !this.player.gameMode.interactResult) { this.player.swing(enumhand, true); } } -@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener { +@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser Vec3 vec3d1 = vec3d.add((double) f7 * d3, (double) f6 * d3, (double) f8 * d3); - HitResult movingobjectposition = this.player.level.clip(new ClipContext(vec3d, vec3d1, ClipContext.Block.OUTLINE, ClipContext.Fluid.NONE, player)); + HitResult movingobjectposition = this.player.level.clip(new ClipContext(vec3d, vec3d1, ClipContext.Block.OUTLINE, ClipContext.Fluid.NONE, this.player)); - if (movingobjectposition == null || movingobjectposition.getType() != HitResult.Type.BLOCK) { + if (movingobjectposition == null || movingobjectposition.getType() != HitResult.Type.BLOCK || this.player.gameMode.getGameModeForPlayer() == GameType.ADVENTURE) { // Paper - call PlayerInteractEvent when left-clicking on a block in adventure mode - CraftEventFactory.callPlayerInteractEvent(this.player, Action.LEFT_CLICK_AIR, this.player.inventory.getSelected(), InteractionHand.MAIN_HAND); + CraftEventFactory.callPlayerInteractEvent(this.player, Action.LEFT_CLICK_AIR, this.player.getInventory().getSelected(), InteractionHand.MAIN_HAND); } diff --git a/patches/server-remapped/Fix-nerfed-slime-when-splitting.patch b/patches/server/Fix-nerfed-slime-when-splitting.patch similarity index 100% rename from patches/server-remapped/Fix-nerfed-slime-when-splitting.patch rename to patches/server/Fix-nerfed-slime-when-splitting.patch diff --git a/patches/server-remapped/Guardian-beam-workaround.patch b/patches/server/Guardian-beam-workaround.patch similarity index 56% rename from patches/server-remapped/Guardian-beam-workaround.patch rename to patches/server/Guardian-beam-workaround.patch index 107d609739..7eb7fedfc4 100644 --- a/patches/server-remapped/Guardian-beam-workaround.patch +++ b/patches/server/Guardian-beam-workaround.patch @@ -9,22 +9,12 @@ diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundSetTim index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/network/protocol/game/ClientboundSetTimePacket.java +++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundSetTimePacket.java -@@ -0,0 +0,0 @@ import net.minecraft.network.protocol.Packet; - - public class ClientboundSetTimePacket implements Packet { - -- private long gameTime; -+ private long gameTime; private final void setWorldAge(final long age) { this.gameTime = age; } private final long getWorldAge() { return this.gameTime; } // Paper - OBFHELPER - private long dayTime; - - public ClientboundSetTimePacket() {} @@ -0,0 +0,0 @@ public class ClientboundSetTimePacket implements Packet +Date: Wed, 25 Nov 2020 23:20:44 -0800 +Subject: [PATCH] Implement TargetHitEvent + + +diff --git a/src/main/java/net/minecraft/world/level/block/TargetBlock.java b/src/main/java/net/minecraft/world/level/block/TargetBlock.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/block/TargetBlock.java ++++ b/src/main/java/net/minecraft/world/level/block/TargetBlock.java +@@ -0,0 +0,0 @@ public class TargetBlock extends Block { + @Override + public void onProjectileHit(Level world, BlockState state, BlockHitResult hit, Projectile projectile) { + int i = updateRedstoneOutput(world, state, hit, projectile); ++ // Paper start ++ } ++ private static void awardTargetHitCriteria(Projectile projectile, BlockHitResult hit, int i) { ++ // Paper end + Entity entity = projectile.getOwner(); + if (entity instanceof ServerPlayer) { + ServerPlayer serverPlayer = (ServerPlayer)entity; +@@ -0,0 +0,0 @@ public class TargetBlock extends Block { + private static int updateRedstoneOutput(LevelAccessor world, BlockState state, BlockHitResult hitResult, Entity entity) { + int i = getRedstoneStrength(hitResult, hitResult.getLocation()); + int j = entity instanceof AbstractArrow ? 20 : 8; ++ // Paper start ++ if (entity instanceof Projectile) { ++ final Projectile projectile = (Projectile) entity; ++ final org.bukkit.craftbukkit.block.CraftBlock craftBlock = org.bukkit.craftbukkit.block.CraftBlock.at(world, hitResult.getBlockPos()); ++ final org.bukkit.block.BlockFace blockFace = org.bukkit.craftbukkit.block.CraftBlock.notchToBlockFace(hitResult.getDirection()); ++ final io.papermc.paper.event.block.TargetHitEvent targetHitEvent = new io.papermc.paper.event.block.TargetHitEvent((org.bukkit.entity.Projectile) projectile.getBukkitEntity(), craftBlock, blockFace, i); ++ if (targetHitEvent.callEvent()) { ++ i = targetHitEvent.getSignalStrength(); ++ awardTargetHitCriteria(projectile, hitResult, i); ++ } else { ++ return i; ++ } ++ } ++ // Paper end + if (!world.getBlockTicks().hasScheduledTick(hitResult.getBlockPos(), state.getBlock())) { + setOutputPower(world, state, i, hitResult.getBlockPos(), j); + } diff --git a/patches/server-remapped/Limit-recipe-packets.patch b/patches/server/Limit-recipe-packets.patch similarity index 67% rename from patches/server-remapped/Limit-recipe-packets.patch rename to patches/server/Limit-recipe-packets.patch index 347ec9da64..993815cc8a 100644 --- a/patches/server-remapped/Limit-recipe-packets.patch +++ b/patches/server/Limit-recipe-packets.patch @@ -26,44 +26,29 @@ diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListener index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -0,0 +0,0 @@ - package net.minecraft.server.network; - -+import com.destroystokyo.paper.PaperConfig; - import com.google.common.collect.Lists; - import com.google.common.primitives.Doubles; - import com.google.common.primitives.Floats; -@@ -0,0 +0,0 @@ import io.papermc.paper.adventure.ChatProcessor; // Paper - import io.papermc.paper.adventure.PaperAdventure; // Paper - import java.util.concurrent.ExecutionException; - import java.util.concurrent.atomic.AtomicIntegerFieldUpdater; -+import org.bukkit.Bukkit; // Paper - import org.bukkit.Location; - import org.bukkit.craftbukkit.entity.CraftPlayer; - import org.bukkit.craftbukkit.event.CraftEventFactory; -@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener { - private volatile int chatSpamTickCount; - private static final AtomicIntegerFieldUpdater chatSpamField = AtomicIntegerFieldUpdater.newUpdater(ServerGamePacketListenerImpl.class, "chatThrottle"); +@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser + // CraftBukkit start - multithreaded fields + private AtomicInteger chatSpamTickCount = new AtomicInteger(); private final java.util.concurrent.atomic.AtomicInteger tabSpamLimiter = new java.util.concurrent.atomic.AtomicInteger(); // Paper - configurable tab spam limits + private final java.util.concurrent.atomic.AtomicInteger recipeSpamPackets = new java.util.concurrent.atomic.AtomicInteger(); // Paper - auto recipe limit // CraftBukkit end private int dropSpamTickCount; - private final Int2ShortMap expectedAcks = new Int2ShortOpenHashMap(); -@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener { + private double firstGoodX; +@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser // CraftBukkit start - for (int spam; (spam = this.chatSpamTickCount) > 0 && !chatSpamField.compareAndSet(this, spam, spam - 1); ) ; + for (int spam; (spam = this.chatSpamTickCount.get()) > 0 && !this.chatSpamTickCount.compareAndSet(spam, spam - 1); ) ; if (tabSpamLimiter.get() > 0) tabSpamLimiter.getAndDecrement(); // Paper - split to seperate variable + if (recipeSpamPackets.get() > 0) recipeSpamPackets.getAndDecrement(); // Paper /* Use thread-safe field access instead - if (this.chatThrottle > 0) { - --this.chatThrottle; -@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener { + if (this.chatSpamTickCount > 0) { + --this.chatSpamTickCount; +@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @Override public void handlePlaceRecipe(ServerboundPlaceRecipePacket packet) { + // Paper start -+ if (!Bukkit.isPrimaryThread()) { -+ if (recipeSpamPackets.addAndGet(PaperConfig.autoRecipeIncrement) > PaperConfig.autoRecipeLimit) { ++ if (!org.bukkit.Bukkit.isPrimaryThread()) { ++ if (recipeSpamPackets.addAndGet(com.destroystokyo.paper.PaperConfig.autoRecipeIncrement) > com.destroystokyo.paper.PaperConfig.autoRecipeLimit) { + server.scheduleOnMain(() -> this.disconnect(new TranslatableComponent("disconnect.spam", new Object[0]))); // Paper + return; + } @@ -71,4 +56,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper end PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); this.player.resetLastActionTime(); - if (!this.player.isSpectator() && this.player.containerMenu.containerId == packet.getContainerId() && this.player.containerMenu.isSynched(this.player) && this.player.containerMenu instanceof RecipeBookMenu) { + if (!this.player.isSpectator() && this.player.containerMenu.containerId == packet.getContainerId() && this.player.containerMenu instanceof RecipeBookMenu) { diff --git a/patches/server/MC-4-Fix-item-position-desync.patch b/patches/server/MC-4-Fix-item-position-desync.patch new file mode 100644 index 0000000000..53d77697f4 --- /dev/null +++ b/patches/server/MC-4-Fix-item-position-desync.patch @@ -0,0 +1,63 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: BillyGalbreath +Date: Tue, 8 Dec 2020 20:24:52 -0600 +Subject: [PATCH] MC-4: Fix item position desync + +This fixes item position desync (MC-4) by running the item coordinates +through the encode/decode methods of the packet that causes the precision +loss, which forces the server to lose the same precision as the client +keeping them in sync. + +diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java ++++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java +@@ -0,0 +0,0 @@ public class PaperConfig { + private static void trackPluginScoreboards() { + trackPluginScoreboards = getBoolean("settings.track-plugin-scoreboards", false); + } ++ ++ public static boolean fixEntityPositionDesync = true; ++ private static void fixEntityPositionDesync() { ++ fixEntityPositionDesync = getBoolean("settings.fix-entity-position-desync", fixEntityPositionDesync); ++ } + } +diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundMoveEntityPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundMoveEntityPacket.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundMoveEntityPacket.java ++++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundMoveEntityPacket.java +@@ -0,0 +0,0 @@ public abstract class ClientboundMoveEntityPacket implements Packet +Date: Mon, 5 Oct 2020 21:25:16 +0200 +Subject: [PATCH] Player Chunk Load/Unload Events + + +diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java ++++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java +@@ -0,0 +0,0 @@ public class ServerPlayer extends Player { + public void trackChunk(ChunkPos chunkcoordintpair, Packet packet, Packet packet1) { + this.connection.send(packet1); + this.connection.send(packet); ++ // Paper start ++ if(io.papermc.paper.event.packet.PlayerChunkLoadEvent.getHandlerList().getRegisteredListeners().length > 0){ ++ new io.papermc.paper.event.packet.PlayerChunkLoadEvent(this.getBukkitEntity().getWorld().getChunkAt(chunkcoordintpair.longKey), this.getBukkitEntity()).callEvent(); ++ } ++ // Paper end + } + + public void untrackChunk(ChunkPos chunkPos) { + if (this.isAlive()) { + this.connection.send(new ClientboundForgetLevelChunkPacket(chunkPos.x, chunkPos.z)); ++ // Paper start ++ if(io.papermc.paper.event.packet.PlayerChunkUnloadEvent.getHandlerList().getRegisteredListeners().length > 0){ ++ new io.papermc.paper.event.packet.PlayerChunkUnloadEvent(this.getBukkitEntity().getWorld().getChunkAt(chunkPos.longKey), this.getBukkitEntity()).callEvent(); ++ } ++ // Paper end + } + + } diff --git a/patches/server-remapped/Set-spigots-verbose-world-setting-to-false-by-def.patch b/patches/server/Set-spigots-verbose-world-setting-to-false-by-def.patch similarity index 76% rename from patches/server-remapped/Set-spigots-verbose-world-setting-to-false-by-def.patch rename to patches/server/Set-spigots-verbose-world-setting-to-false-by-def.patch index ebcfd3f143..d83717b07f 100644 --- a/patches/server-remapped/Set-spigots-verbose-world-setting-to-false-by-def.patch +++ b/patches/server/Set-spigots-verbose-world-setting-to-false-by-def.patch @@ -12,8 +12,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public void init() { -- this.verbose = getBoolean( "verbose", true ); -+ this.verbose = getBoolean( "verbose", false ); // Paper +- this.verbose = this.getBoolean( "verbose", true ); ++ this.verbose = this.getBoolean( "verbose", false ); // Paper - log( "-------- World Settings For [" + worldName + "] --------" ); + this.log( "-------- World Settings For [" + this.worldName + "] --------" ); SpigotConfig.readConfig( SpigotWorldConfig.class, this ); diff --git a/patches/server-remapped/Zombie-API-breaking-doors.patch b/patches/server/Zombie-API-breaking-doors.patch similarity index 51% rename from patches/server-remapped/Zombie-API-breaking-doors.patch rename to patches/server/Zombie-API-breaking-doors.patch index 52e3be8e7e..720a6f2832 100644 --- a/patches/server-remapped/Zombie-API-breaking-doors.patch +++ b/patches/server/Zombie-API-breaking-doors.patch @@ -4,23 +4,6 @@ Date: Wed, 18 Nov 2020 11:32:46 -0800 Subject: [PATCH] Zombie API - breaking doors -diff --git a/src/main/java/net/minecraft/world/entity/monster/Zombie.java b/src/main/java/net/minecraft/world/entity/monster/Zombie.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java -+++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java -@@ -0,0 +0,0 @@ public class Zombie extends Monster { - return (Boolean) this.getEntityData().get(Zombie.DATA_DROWNED_CONVERSION_ID); - } - -+ public boolean canBreakDoors() { return this.canBreakDoors(); } // Paper - OBFHELPER - public boolean canBreakDoors() { - return this.canBreakDoors; - } - -+ public void setCanBreakDoors(boolean canBreakDoors) { this.setCanBreakDoors(canBreakDoors); } // Paper - OBFHELPER - public void setCanBreakDoors(boolean canBreakDoors) { - if (this.supportsBreakDoorGoal() && GoalUtils.hasGroundPathNavigation(this)) { - if (this.canBreakDoors != canBreakDoors) { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftZombie.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftZombie.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftZombie.java diff --git a/patches/server/added-PlayerTradeEvent.patch b/patches/server/added-PlayerTradeEvent.patch new file mode 100644 index 0000000000..2b9ae0dfe0 --- /dev/null +++ b/patches/server/added-PlayerTradeEvent.patch @@ -0,0 +1,40 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Thu, 2 Jul 2020 16:12:10 -0700 +Subject: [PATCH] added PlayerTradeEvent + + +diff --git a/src/main/java/net/minecraft/world/entity/npc/AbstractVillager.java b/src/main/java/net/minecraft/world/entity/npc/AbstractVillager.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/entity/npc/AbstractVillager.java ++++ b/src/main/java/net/minecraft/world/entity/npc/AbstractVillager.java +@@ -0,0 +0,0 @@ public abstract class AbstractVillager extends AgeableMob implements InventoryCa + + @Override + public void notifyTrade(MerchantOffer offer) { +- offer.increaseUses(); +- this.ambientSoundTime = -this.getAmbientSoundInterval(); +- this.rewardTradeXp(offer); ++ // Paper - moved down ++ // Paper start + if (this.tradingPlayer instanceof ServerPlayer) { +- CriteriaTriggers.TRADE.trigger((ServerPlayer) this.tradingPlayer, this, offer.getResult()); ++ io.papermc.paper.event.player.PlayerTradeEvent event = new io.papermc.paper.event.player.PlayerTradeEvent(((ServerPlayer) this.tradingPlayer).getBukkitEntity(), (org.bukkit.entity.AbstractVillager) this.getBukkitEntity(), offer.asBukkit(), true, true); ++ event.callEvent(); ++ if (!event.isCancelled()) { ++ MerchantOffer recipe = CraftMerchantRecipe.fromBukkit(event.getTrade()).toMinecraft(); ++ if (event.willIncreaseTradeUses()) recipe.increaseUses(); ++ this.ambientSoundTime = -this.getAmbientSoundInterval(); ++ if (event.isRewardingExp()) this.rewardTradeXp(recipe); ++ CriteriaTriggers.TRADE.trigger((ServerPlayer) this.tradingPlayer, this, recipe.getResult()); ++ } ++ } else { ++ offer.increaseUses(); ++ this.ambientSoundTime = -getAmbientSoundInterval(); ++ this.rewardTradeXp(offer); + } +- ++ // Paper end + } + + protected abstract void rewardTradeXp(MerchantOffer offer);