45 more patches

This commit is contained in:
Jake Potrebic 2023-06-07 16:56:33 -07:00
parent 6e86dd9422
commit 752fd058f1
45 changed files with 24 additions and 21 deletions

View File

@ -25,18 +25,20 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
SoundSource soundcategory = user instanceof Player ? SoundSource.PLAYERS : SoundSource.HOSTILE; SoundSource soundcategory = user instanceof Player ? SoundSource.PLAYERS : SoundSource.HOSTILE;
@@ -0,0 +0,0 @@ public class CrossbowItem extends ProjectileWeaponItem implements Vanishable { @@ -0,0 +0,0 @@ public class CrossbowItem extends ProjectileWeaponItem implements Vanishable {
} }
private static boolean tryLoadProjectiles(LivingEntity shooter, ItemStack projectile) { + @io.papermc.paper.annotation.DoNotUse // Paper
private static boolean tryLoadProjectiles(LivingEntity shooter, ItemStack crossbow) {
+ // Paper start + // Paper start
+ return CrossbowItem.tryLoadProjectiles(shooter, projectile, true); + return CrossbowItem.tryLoadProjectiles(shooter, crossbow, true);
+ } + }
+ private static boolean tryLoadProjectiles(LivingEntity shooter, ItemStack projectile, boolean consume) { + private static boolean tryLoadProjectiles(LivingEntity shooter, ItemStack crossbow, boolean consume) {
+ // Paper end + // Paper end
int i = EnchantmentHelper.getItemEnchantmentLevel(Enchantments.MULTISHOT, projectile); int i = EnchantmentHelper.getItemEnchantmentLevel(Enchantments.MULTISHOT, crossbow);
int j = i == 0 ? 1 : 3; int j = i == 0 ? 1 : 3;
- boolean flag = shooter instanceof Player && ((Player) shooter).getAbilities().instabuild; - boolean flag = shooter instanceof Player && ((Player) shooter).getAbilities().instabuild;
+ boolean flag = !consume || shooter instanceof Player && ((Player) shooter).getAbilities().instabuild; // Paper - add consume + boolean flag = !consume || shooter instanceof Player && ((Player) shooter).getAbilities().instabuild; // Paper - add consume
ItemStack itemstack1 = shooter.getProjectile(projectile); ItemStack itemstack1 = shooter.getProjectile(crossbow);
ItemStack itemstack2 = itemstack1.copy(); ItemStack itemstack2 = itemstack1.copy();

View File

@ -14,9 +14,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- t0.setFromArgument(context, "value"); - t0.setFromArgument(context, "value");
+ t0.setFromArgument(context, "value", key); // Paper + t0.setFromArgument(context, "value", key); // Paper
commandlistenerwrapper.sendSuccess(Component.translatable("commands.gamerule.set", key.getId(), t0.toString()), true); commandlistenerwrapper.sendSuccess(() -> {
return t0.getCommandResult(); return Component.translatable("commands.gamerule.set", key.getId(), t0.toString());
} }, true);
diff --git a/src/main/java/net/minecraft/world/level/GameRules.java b/src/main/java/net/minecraft/world/level/GameRules.java diff --git a/src/main/java/net/minecraft/world/level/GameRules.java b/src/main/java/net/minecraft/world/level/GameRules.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/GameRules.java --- a/src/main/java/net/minecraft/world/level/GameRules.java

View File

@ -13,7 +13,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
+++ b/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 { @@ -0,0 +0,0 @@ public class CraftBlock implements Block {
return this.getNMS().getMaterial().isLiquid(); return this.getNMS().liquid();
} }
+ // Paper start + // Paper start

View File

@ -42,7 +42,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- if (!entity1.canCollideWithBukkit(entity) || !entity.canCollideWithBukkit(entity1)) { // CraftBukkit - collidable API - if (!entity1.canCollideWithBukkit(entity) || !entity.canCollideWithBukkit(entity1)) { // CraftBukkit - collidable API
+ if (!entity1.isCollidable(ignoreClimbing) || !entity1.canCollideWithBukkit(entity) || !entity.canCollideWithBukkit(entity1)) { // CraftBukkit - collidable API // Paper - isCollidable + if (!entity1.isCollidable(ignoreClimbing) || !entity1.canCollideWithBukkit(entity) || !entity.canCollideWithBukkit(entity1)) { // CraftBukkit - collidable API // Paper - isCollidable
return false; return false;
} else if (entity.level.isClientSide && (!(entity1 instanceof Player) || !((Player) entity1).isLocalPlayer())) { } else if (entity.level().isClientSide && (!(entity1 instanceof Player) || !((Player) entity1).isLocalPlayer())) {
return false; return false;
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java 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 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
@ -52,8 +52,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
return; return;
} }
// Paper end - don't run getEntities if we're not going to use its result // Paper end - don't run getEntities if we're not going to use its result
- List<Entity> list = this.level.getEntities((Entity) this, this.getBoundingBox(), EntitySelector.pushableBy(this)); - List<Entity> list = this.level().getEntities((Entity) this, this.getBoundingBox(), EntitySelector.pushableBy(this));
+ List<Entity> list = this.level.getEntities((Entity) this, this.getBoundingBox(), EntitySelector.pushable(this, level.paperConfig().collisions.fixClimbingBypassingCrammingRule)); // Paper - fix climbing bypassing cramming rule + List<Entity> list = this.level().getEntities((Entity) this, this.getBoundingBox(), EntitySelector.pushable(this, this.level().paperConfig().collisions.fixClimbingBypassingCrammingRule)); // Paper - fix climbing bypassing cramming rule
if (!list.isEmpty()) { if (!list.isEmpty()) {
// Paper - moved up // Paper - moved up
@ -65,7 +65,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@Override @Override
public boolean isPushable() { public boolean isPushable() {
- return this.isAlive() && !this.isSpectator() && !this.onClimbable() && this.collides; // CraftBukkit - return this.isAlive() && !this.isSpectator() && !this.onClimbable() && this.collides; // CraftBukkit
+ return this.isCollidable(level.paperConfig().collisions.fixClimbingBypassingCrammingRule); + return this.isCollidable(this.level().paperConfig().collisions.fixClimbingBypassingCrammingRule);
+ } + }
+ +
+ @Override + @Override

View File

@ -20,7 +20,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
} }
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
// SPIGOT-5607: Only call interact event if no block or entity is being clicked. Use bukkit ray trace method, because it handles blocks and entities at the same time // SPIGOT-5607: Only call interact event if no block or entity is being clicked. Use bukkit ray trace method, because it handles blocks and entities at the same time
org.bukkit.util.RayTraceResult result = this.player.level.getWorld().rayTrace(origin, origin.getDirection(), d3, org.bukkit.FluidCollisionMode.NEVER, false, 0.1, entity -> entity != this.player.getBukkitEntity() && this.player.getBukkitEntity().canSee(entity)); org.bukkit.util.RayTraceResult result = this.player.level().getWorld().rayTrace(origin, origin.getDirection(), d3, org.bukkit.FluidCollisionMode.NEVER, false, 0.1, entity -> entity != this.player.getBukkitEntity() && this.player.getBukkitEntity().canSee(entity));
- if (result == null) { - if (result == null) {
+ if (result == null || this.player.gameMode.getGameModeForPlayer() == GameType.ADVENTURE) { // Paper - call PlayerInteractEvent when left-clicking on a block in adventure mode + if (result == null || this.player.gameMode.getGameModeForPlayer() == GameType.ADVENTURE) { // Paper - call PlayerInteractEvent when left-clicking on a block in adventure mode

View File

@ -14,7 +14,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (i < 0) { if (i < 0) {
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFailedDispenseEvent(world, pos)) {// Paper - BlockFailedDispenseEvent is called here + if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFailedDispenseEvent(world, pos)) {// Paper - BlockFailedDispenseEvent is called here
world.levelEvent(1001, pos, 0); world.levelEvent(1001, pos, 0);
world.gameEvent((Entity) null, GameEvent.DISPENSE_FAIL, pos); world.gameEvent(GameEvent.BLOCK_ACTIVATE, pos, GameEvent.Context.of(tileentitydispenser.getBlockState()));
+ } // Paper + } // Paper
} else { } else {
ItemStack itemstack = tileentitydispenser.getItem(i); ItemStack itemstack = tileentitydispenser.getItem(i);

View File

@ -28,14 +28,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@Override @Override
public void handlePlaceRecipe(ServerboundPlaceRecipePacket packet) { public void handlePlaceRecipe(ServerboundPlaceRecipePacket packet) {
+ PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
+ // Paper start + // Paper start
+ if (!org.bukkit.Bukkit.isPrimaryThread()) { + if (!org.bukkit.Bukkit.isPrimaryThread()) {
+ if (recipeSpamPackets.addAndGet(io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.recipeSpamIncrement) > io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.recipeSpamLimit) { + if (this.recipeSpamPackets.addAndGet(io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.recipeSpamIncrement) > io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.recipeSpamLimit) {
+ server.scheduleOnMain(() -> this.disconnect(net.minecraft.network.chat.Component.translatable("disconnect.spam", new Object[0]))); // Paper + this.server.scheduleOnMain(() -> this.disconnect(net.minecraft.network.chat.Component.translatable("disconnect.spam", new Object[0]))); // Paper
+ return; + return;
+ } + }
+ } + }
+ // Paper end + // Paper end
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
this.player.resetLastActionTime(); this.player.resetLastActionTime();
if (!this.player.isSpectator() && this.player.containerMenu.containerId == packet.getContainerId() && this.player.containerMenu instanceof RecipeBookMenu) { if (!this.player.isSpectator() && this.player.containerMenu.containerId == packet.getContainerId() && this.player.containerMenu instanceof RecipeBookMenu) {

View File

@ -32,9 +32,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/world/entity/Entity.java --- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { @@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
return; }
} public final void setPosRaw(double x, double y, double z, boolean forceBoundingBoxUpdate) {
// Paper end - rewrite chunk system // Paper end
+ // Paper start - fix MC-4 + // Paper start - fix MC-4
+ if (this instanceof ItemEntity) { + if (this instanceof ItemEntity) {
+ if (io.papermc.paper.configuration.GlobalConfiguration.get().misc.fixEntityPositionDesync) { + if (io.papermc.paper.configuration.GlobalConfiguration.get().misc.fixEntityPositionDesync) {