This commit is contained in:
Jake Potrebic 2024-04-23 22:43:09 -07:00
parent 309ebc13fc
commit 1d7d7e92f2
No known key found for this signature in database
GPG Key ID: ECE0B3C133C016C5
52 changed files with 333 additions and 310 deletions

View File

@ -6,7 +6,7 @@ Subject: [PATCH] Prevent various interactions from causing chunk loads
Co-authored-by: Shane Freeder <theboyetronic@gmail.com> Co-authored-by: Shane Freeder <theboyetronic@gmail.com>
diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/RemoveBlockGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/RemoveBlockGoal.java diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/RemoveBlockGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/RemoveBlockGoal.java
index e3d070d46729c023d594699619a4b3f8658edbce..5580a396a56c6e0f364a5368985ee99b9e2be0a8 100644 index da5373d8eb4643414a0f2c699044fde93715c258..6634228ef002cbef67980272a26be4a75c954116 100644
--- a/src/main/java/net/minecraft/world/entity/ai/goal/RemoveBlockGoal.java --- a/src/main/java/net/minecraft/world/entity/ai/goal/RemoveBlockGoal.java
+++ b/src/main/java/net/minecraft/world/entity/ai/goal/RemoveBlockGoal.java +++ b/src/main/java/net/minecraft/world/entity/ai/goal/RemoveBlockGoal.java
@@ -126,7 +126,9 @@ public class RemoveBlockGoal extends MoveToBlockGoal { @@ -126,7 +126,9 @@ public class RemoveBlockGoal extends MoveToBlockGoal {
@ -40,10 +40,10 @@ index e3d070d46729c023d594699619a4b3f8658edbce..5580a396a56c6e0f364a5368985ee99b
return ichunkaccess == null ? false : ichunkaccess.getBlockState(pos).is(this.blockToRemove) && ichunkaccess.getBlockState(pos.above()).isAir() && ichunkaccess.getBlockState(pos.above(2)).isAir(); return ichunkaccess == null ? false : ichunkaccess.getBlockState(pos).is(this.blockToRemove) && ichunkaccess.getBlockState(pos.above()).isAir() && ichunkaccess.getBlockState(pos.above(2)).isAir();
} }
diff --git a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java diff --git a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
index 13ba764d51f941c2b0d1d2af88ffd0c1fc3982c0..9637c26a3c381869f0a4dfe9189c0095387009b4 100644 index 4d659fc8355542e6b9cadc6e1e86002e136702d2..853d65025d5e049467c1f1e7322580880506c347 100644
--- a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java --- a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
+++ b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java +++ b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
@@ -517,7 +517,8 @@ public class EnderMan extends Monster implements NeutralMob { @@ -500,7 +500,8 @@ public class EnderMan extends Monster implements NeutralMob {
int j = Mth.floor(this.enderman.getY() + randomsource.nextDouble() * 2.0D); int j = Mth.floor(this.enderman.getY() + randomsource.nextDouble() * 2.0D);
int k = Mth.floor(this.enderman.getZ() - 1.0D + randomsource.nextDouble() * 2.0D); int k = Mth.floor(this.enderman.getZ() - 1.0D + randomsource.nextDouble() * 2.0D);
BlockPos blockposition = new BlockPos(i, j, k); BlockPos blockposition = new BlockPos(i, j, k);
@ -53,7 +53,7 @@ index 13ba764d51f941c2b0d1d2af88ffd0c1fc3982c0..9637c26a3c381869f0a4dfe9189c0095
BlockPos blockposition1 = blockposition.below(); BlockPos blockposition1 = blockposition.below();
BlockState iblockdata1 = world.getBlockState(blockposition1); BlockState iblockdata1 = world.getBlockState(blockposition1);
BlockState iblockdata2 = this.enderman.getCarriedBlock(); BlockState iblockdata2 = this.enderman.getCarriedBlock();
@@ -561,7 +562,8 @@ public class EnderMan extends Monster implements NeutralMob { @@ -544,7 +545,8 @@ public class EnderMan extends Monster implements NeutralMob {
int j = Mth.floor(this.enderman.getY() + randomsource.nextDouble() * 3.0D); int j = Mth.floor(this.enderman.getY() + randomsource.nextDouble() * 3.0D);
int k = Mth.floor(this.enderman.getZ() - 2.0D + randomsource.nextDouble() * 4.0D); int k = Mth.floor(this.enderman.getZ() - 2.0D + randomsource.nextDouble() * 4.0D);
BlockPos blockposition = new BlockPos(i, j, k); BlockPos blockposition = new BlockPos(i, j, k);
@ -63,19 +63,19 @@ index 13ba764d51f941c2b0d1d2af88ffd0c1fc3982c0..9637c26a3c381869f0a4dfe9189c0095
Vec3 vec3d = new Vec3((double) this.enderman.getBlockX() + 0.5D, (double) j + 0.5D, (double) this.enderman.getBlockZ() + 0.5D); Vec3 vec3d = new Vec3((double) this.enderman.getBlockX() + 0.5D, (double) j + 0.5D, (double) this.enderman.getBlockZ() + 0.5D);
Vec3 vec3d1 = new Vec3((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D); Vec3 vec3d1 = new Vec3((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D);
BlockHitResult movingobjectpositionblock = world.clip(new ClipContext(vec3d, vec3d1, ClipContext.Block.OUTLINE, ClipContext.Fluid.NONE, this.enderman)); BlockHitResult movingobjectpositionblock = world.clip(new ClipContext(vec3d, vec3d1, ClipContext.Block.OUTLINE, ClipContext.Fluid.NONE, this.enderman));
diff --git a/src/main/java/net/minecraft/world/item/CompassItem.java b/src/main/java/net/minecraft/world/item/CompassItem.java diff --git a/src/main/java/net/minecraft/world/item/component/LodestoneTracker.java b/src/main/java/net/minecraft/world/item/component/LodestoneTracker.java
index b8c6ac4c254787e285f97ad15bf10ddfd9cb294f..0f3621483a6ddcaeeb25eac51dbfaad41933579a 100644 index c02a2f9e1b4e727b1deeb73377e1f7193f5ee072..cdd1f6939ce33e62f6609f7eb3a5dff59bf12675 100644
--- a/src/main/java/net/minecraft/world/item/CompassItem.java --- a/src/main/java/net/minecraft/world/item/component/LodestoneTracker.java
+++ b/src/main/java/net/minecraft/world/item/CompassItem.java +++ b/src/main/java/net/minecraft/world/item/component/LodestoneTracker.java
@@ -77,7 +77,7 @@ public class CompassItem extends Item implements Vanishable { @@ -29,7 +29,7 @@ public record LodestoneTracker(Optional<GlobalPos> target, boolean tracked) {
Optional<ResourceKey<Level>> optional = getLodestoneDimension(compoundTag); return this;
if (optional.isPresent() && optional.get() == world.dimension() && compoundTag.contains("LodestonePos")) { } else {
BlockPos blockPos = NbtUtils.readBlockPos(compoundTag.getCompound("LodestonePos")); BlockPos blockPos = this.target.get().pos();
- if (!world.isInWorldBounds(blockPos) || !((ServerLevel)world).getPoiManager().existsAtPosition(PoiTypes.LODESTONE, blockPos)) { - return world.isInWorldBounds(blockPos) && world.getPoiManager().existsAtPosition(PoiTypes.LODESTONE, blockPos)
+ if (!world.isInWorldBounds(blockPos) || (world.hasChunkAt(blockPos) && !((ServerLevel)world).getPoiManager().existsAtPosition(PoiTypes.LODESTONE, blockPos))) { // Paper - Prevent compass from loading chunks + return world.isInWorldBounds(blockPos) && (!world.hasChunkAt(blockPos) || world.getPoiManager().existsAtPosition(PoiTypes.LODESTONE, blockPos)) // Paper - Prevent compass from loading chunks
compoundTag.remove("LodestonePos"); ? this
} : new LodestoneTracker(Optional.empty(), true);
} }
diff --git a/src/main/java/net/minecraft/world/level/BlockGetter.java b/src/main/java/net/minecraft/world/level/BlockGetter.java diff --git a/src/main/java/net/minecraft/world/level/BlockGetter.java b/src/main/java/net/minecraft/world/level/BlockGetter.java
index d6d8bbc98fc71997cb52521d59ebb59d727d3c22..c3760e0c8ac0b3ea200f4e1c237e250137a78caf 100644 index d6d8bbc98fc71997cb52521d59ebb59d727d3c22..c3760e0c8ac0b3ea200f4e1c237e250137a78caf 100644
--- a/src/main/java/net/minecraft/world/level/BlockGetter.java --- a/src/main/java/net/minecraft/world/level/BlockGetter.java

View File

@ -6,10 +6,10 @@ Subject: [PATCH] Prevent mob spawning from loading/generating chunks
also prevents if out of world border bounds also prevents if out of world border bounds
diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
index 352d230b365c512a4b9831265d3a57825f80fbfd..d5ada3301429e7fec0d157d7a33d4937e0f82fbb 100644 index bce78beaadbfd0e400457bd14bcf6538be702879..41eef8bfd1572aecaf086bfbec300abeae2df794 100644
--- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java --- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java
+++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java +++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
@@ -170,9 +170,9 @@ public final class NaturalSpawner { @@ -165,9 +165,9 @@ public final class NaturalSpawner {
StructureManager structuremanager = world.structureManager(); StructureManager structuremanager = world.structureManager();
ChunkGenerator chunkgenerator = world.getChunkSource().getGenerator(); ChunkGenerator chunkgenerator = world.getChunkSource().getGenerator();
int i = pos.getY(); int i = pos.getY();
@ -21,7 +21,7 @@ index 352d230b365c512a4b9831265d3a57825f80fbfd..d5ada3301429e7fec0d157d7a33d4937
BlockPos.MutableBlockPos blockposition_mutableblockposition = new BlockPos.MutableBlockPos(); BlockPos.MutableBlockPos blockposition_mutableblockposition = new BlockPos.MutableBlockPos();
int j = 0; int j = 0;
int k = 0; int k = 0;
@@ -201,7 +201,7 @@ public final class NaturalSpawner { @@ -196,7 +196,7 @@ public final class NaturalSpawner {
if (entityhuman != null) { if (entityhuman != null) {
double d2 = entityhuman.distanceToSqr(d0, (double) i, d1); double d2 = entityhuman.distanceToSqr(d0, (double) i, d1);

View File

@ -9,16 +9,18 @@ to the nearest Integer when updating its current cook time.
Co-authored-by: Eric Su <ericsu@alumni.usc.edu> Co-authored-by: Eric Su <ericsu@alumni.usc.edu>
diff --git a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java diff --git a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
index 7a13042631bea761952490cfd14dc20147405161..9801b777bc6ab7de91d82b29a142459292ee8605 100644 index 70e068c3d0f72f31df749add2c57450f793524ae..4cd7232f538649d99892f3b31f2741b1d7e792e8 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java --- a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
@@ -78,11 +78,13 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit @@ -79,6 +79,7 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
protected NonNullList<ItemStack> items; protected NonNullList<ItemStack> items;
public int litTime; public int litTime;
int litDuration; int litDuration;
+ public double cookSpeedMultiplier = 1.0; // Paper - cook speed multiplier API + public double cookSpeedMultiplier = 1.0; // Paper - cook speed multiplier API
public int cookingProgress; public int cookingProgress;
public int cookingTotalTime; public int cookingTotalTime;
@Nullable
@@ -86,6 +87,7 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
protected final ContainerData dataAccess; protected final ContainerData dataAccess;
public final Object2IntOpenHashMap<ResourceLocation> recipesUsed; public final Object2IntOpenHashMap<ResourceLocation> recipesUsed;
private final RecipeManager.CachedCheck<Container, ? extends AbstractCookingRecipe> quickCheck; private final RecipeManager.CachedCheck<Container, ? extends AbstractCookingRecipe> quickCheck;
@ -26,15 +28,15 @@ index 7a13042631bea761952490cfd14dc20147405161..9801b777bc6ab7de91d82b29a1424592
protected AbstractFurnaceBlockEntity(BlockEntityType<?> blockEntityType, BlockPos pos, BlockState state, RecipeType<? extends AbstractCookingRecipe> recipeType) { protected AbstractFurnaceBlockEntity(BlockEntityType<?> blockEntityType, BlockPos pos, BlockState state, RecipeType<? extends AbstractCookingRecipe> recipeType) {
super(blockEntityType, pos, state); super(blockEntityType, pos, state);
@@ -129,6 +131,7 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit @@ -132,6 +134,7 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
}; };
this.recipesUsed = new Object2IntOpenHashMap(); this.recipesUsed = new Object2IntOpenHashMap();
this.quickCheck = RecipeManager.createCheck((RecipeType<AbstractCookingRecipe>) recipeType); // CraftBukkit - decompile error // Eclipse fail this.quickCheck = RecipeManager.createCheck((RecipeType<AbstractCookingRecipe>) recipeType); // CraftBukkit - decompile error // Eclipse fail
+ this.recipeType = recipeType; // Paper - cook speed multiplier API + this.recipeType = recipeType; // Paper - cook speed multiplier API
} }
public static Map<Item, Integer> getFuel() { public static void invalidateCache() {
@@ -281,6 +284,11 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit @@ -295,6 +298,11 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
this.recipesUsed.put(new ResourceLocation(s), nbttagcompound1.getInt(s)); this.recipesUsed.put(new ResourceLocation(s), nbttagcompound1.getInt(s));
} }
@ -46,15 +48,15 @@ index 7a13042631bea761952490cfd14dc20147405161..9801b777bc6ab7de91d82b29a1424592
} }
@Override @Override
@@ -289,6 +297,7 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit @@ -303,6 +311,7 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
nbt.putShort("BurnTime", (short) this.litTime); nbt.putShort("BurnTime", (short) this.litTime);
nbt.putShort("CookTime", (short) this.cookingProgress); nbt.putShort("CookTime", (short) this.cookingProgress);
nbt.putShort("CookTimeTotal", (short) this.cookingTotalTime); nbt.putShort("CookTimeTotal", (short) this.cookingTotalTime);
+ nbt.putDouble("Paper.CookSpeedMultiplier", this.cookSpeedMultiplier); // Paper - cook speed multiplier API + nbt.putDouble("Paper.CookSpeedMultiplier", this.cookSpeedMultiplier); // Paper - cook speed multiplier API
ContainerHelper.saveAllItems(nbt, this.items); ContainerHelper.saveAllItems(nbt, this.items, registryLookup);
CompoundTag nbttagcompound1 = new CompoundTag(); CompoundTag nbttagcompound1 = new CompoundTag();
@@ -360,7 +369,7 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit @@ -374,7 +383,7 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
CraftItemStack source = CraftItemStack.asCraftMirror(blockEntity.items.get(0)); CraftItemStack source = CraftItemStack.asCraftMirror(blockEntity.items.get(0));
CookingRecipe<?> recipe = (CookingRecipe<?>) recipeholder.toBukkitRecipe(); CookingRecipe<?> recipe = (CookingRecipe<?>) recipeholder.toBukkitRecipe();
@ -63,7 +65,7 @@ index 7a13042631bea761952490cfd14dc20147405161..9801b777bc6ab7de91d82b29a1424592
world.getCraftServer().getPluginManager().callEvent(event); world.getCraftServer().getPluginManager().callEvent(event);
blockEntity.cookingTotalTime = event.getTotalCookTime(); blockEntity.cookingTotalTime = event.getTotalCookTime();
@@ -368,9 +377,9 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit @@ -382,9 +391,9 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
// CraftBukkit end // CraftBukkit end
++blockEntity.cookingProgress; ++blockEntity.cookingProgress;
@ -75,7 +77,7 @@ index 7a13042631bea761952490cfd14dc20147405161..9801b777bc6ab7de91d82b29a1424592
if (AbstractFurnaceBlockEntity.burn(blockEntity.level, blockEntity.worldPosition, world.registryAccess(), recipeholder, blockEntity.items, i)) { // CraftBukkit if (AbstractFurnaceBlockEntity.burn(blockEntity.level, blockEntity.worldPosition, world.registryAccess(), recipeholder, blockEntity.items, i)) { // CraftBukkit
blockEntity.setRecipeUsed(recipeholder); blockEntity.setRecipeUsed(recipeholder);
} }
@@ -470,11 +479,12 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit @@ -484,11 +493,12 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
} }
} }
@ -93,9 +95,9 @@ index 7a13042631bea761952490cfd14dc20147405161..9801b777bc6ab7de91d82b29a1424592
} }
public static boolean isFuel(ItemStack stack) { public static boolean isFuel(ItemStack stack) {
@@ -544,7 +554,7 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit @@ -533,7 +543,7 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
} this.items.set(slot, stack);
stack.limitSize(this.getMaxStackSize(stack));
if (slot == 0 && !flag) { if (slot == 0 && !flag) {
- this.cookingTotalTime = AbstractFurnaceBlockEntity.getTotalCookTime(this.level, this); - this.cookingTotalTime = AbstractFurnaceBlockEntity.getTotalCookTime(this.level, this);
+ this.cookingTotalTime = AbstractFurnaceBlockEntity.getTotalCookTime(this.level, this.recipeType, this, this.cookSpeedMultiplier); // Paper - cook speed multiplier API + this.cookingTotalTime = AbstractFurnaceBlockEntity.getTotalCookTime(this.level, this.recipeType, this, this.cookSpeedMultiplier); // Paper - cook speed multiplier API
@ -103,13 +105,13 @@ index 7a13042631bea761952490cfd14dc20147405161..9801b777bc6ab7de91d82b29a1424592
this.setChanged(); this.setChanged();
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftFurnace.java b/src/main/java/org/bukkit/craftbukkit/block/CraftFurnace.java diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftFurnace.java b/src/main/java/org/bukkit/craftbukkit/block/CraftFurnace.java
index 2f25a502c5c7223101f2d8c125977e2c614cd899..f98cf44e929d326037e1089dafe4f82c6f6d8647 100644 index 46a1c96efc5ffb5c8d6c20af758bdca5bb4a5049..ddbbf977c8f536a156ff6b2462353f7be5ab5742 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftFurnace.java --- a/src/main/java/org/bukkit/craftbukkit/block/CraftFurnace.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftFurnace.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftFurnace.java
@@ -85,4 +85,20 @@ public abstract class CraftFurnace<T extends AbstractFurnaceBlockEntity> extends @@ -89,4 +89,20 @@ public abstract class CraftFurnace<T extends AbstractFurnaceBlockEntity> extends
@Override @Override
public abstract CraftFurnace<T> copy(); public abstract CraftFurnace<T> copy(Location location);
+ +
+ // Paper start - cook speed multiplier API + // Paper start - cook speed multiplier API
+ @Override + @Override

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Honor EntityAgeable.ageLock
diff --git a/src/main/java/net/minecraft/world/entity/AgeableMob.java b/src/main/java/net/minecraft/world/entity/AgeableMob.java diff --git a/src/main/java/net/minecraft/world/entity/AgeableMob.java b/src/main/java/net/minecraft/world/entity/AgeableMob.java
index be5e603d505566feac61cc7e591d35ce483a92df..8dcdc664470fcac00c203b9499ea0a45df7d86ef 100644 index f07cf6d91e0cbad80c3c630c0d505820e701ce81..3dc3609d13a7b823d15384d1c385b68eeb933d26 100644
--- a/src/main/java/net/minecraft/world/entity/AgeableMob.java --- a/src/main/java/net/minecraft/world/entity/AgeableMob.java
+++ b/src/main/java/net/minecraft/world/entity/AgeableMob.java +++ b/src/main/java/net/minecraft/world/entity/AgeableMob.java
@@ -85,6 +85,7 @@ public abstract class AgeableMob extends PathfinderMob { @@ -85,6 +85,7 @@ public abstract class AgeableMob extends PathfinderMob {
@ -17,22 +17,22 @@ index be5e603d505566feac61cc7e591d35ce483a92df..8dcdc664470fcac00c203b9499ea0a45
int k = j; int k = j;
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java diff --git a/src/main/java/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java
index 70400c9d8835046523c55e3777a2f02da6168dcb..b0c57922fa6160772ba1aaf61c0e97c03a0e6e8c 100644 index be91618d84be4a77b2f8a13e9b4024b5892c25e0..344b18127d3e8c7408a162cc85287382bdfdda9a 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java --- a/src/main/java/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java
@@ -303,6 +303,7 @@ public class BeehiveBlockEntity extends BlockEntity { @@ -446,6 +446,7 @@ public class BeehiveBlockEntity extends BlockEntity {
}
private static void setBeeReleaseData(int ticks, Bee bee) {
+ if (!bee.ageLocked) { // Paper - Honor ageLock
int j = bee.getAge();
if (j < 0) {
@@ -310,6 +311,7 @@ public class BeehiveBlockEntity extends BlockEntity {
} else if (j > 0) {
bee.setAge(Math.max(0, j - ticks));
} }
+ } // Paper - Honor ageLock
bee.setInLoveTime(Math.max(0, bee.getInLoveTime() - ticks)); private static void setBeeReleaseData(int ticksInHive, Bee beeEntity) {
+ if (!beeEntity.ageLocked) { // Paper - Honor ageLock
int j = beeEntity.getAge();
if (j < 0) {
@@ -455,6 +456,7 @@ public class BeehiveBlockEntity extends BlockEntity {
}
beeEntity.setInLoveTime(Math.max(0, beeEntity.getInLoveTime() - ticksInHive));
+ } // Paper - Honor ageLock
}
} }

View File

@ -0,0 +1,19 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Shane Freeder <theboyetronic@gmail.com>
Date: Tue, 2 Oct 2018 09:57:50 +0100
Subject: [PATCH] Configurable connection throttle kick message
diff --git a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
index 644214cc3a3c8e560b6ce470fe5997e3c10a2e3d..bc15794e0a3909ab9ceeded35158bea4c23fb45a 100644
--- a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
@@ -82,7 +82,7 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL
synchronized (ServerHandshakePacketListenerImpl.throttleTracker) {
if (ServerHandshakePacketListenerImpl.throttleTracker.containsKey(address) && !"127.0.0.1".equals(address.getHostAddress()) && currentTime - ServerHandshakePacketListenerImpl.throttleTracker.get(address) < connectionThrottle) {
ServerHandshakePacketListenerImpl.throttleTracker.put(address, currentTime);
- MutableComponent chatmessage = Component.literal("Connection throttled! Please wait before reconnecting.");
+ Component chatmessage = io.papermc.paper.adventure.PaperAdventure.asVanilla(io.papermc.paper.configuration.GlobalConfiguration.get().messages.kick.connectionThrottle); // Paper - Configurable connection throttle kick message
this.connection.send(new ClientboundLoginDisconnectPacket(chatmessage));
this.connection.disconnect(chatmessage);
return;

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Prevent chunk loading from Fluid Flowing
diff --git a/src/main/java/net/minecraft/world/level/material/FlowingFluid.java b/src/main/java/net/minecraft/world/level/material/FlowingFluid.java diff --git a/src/main/java/net/minecraft/world/level/material/FlowingFluid.java b/src/main/java/net/minecraft/world/level/material/FlowingFluid.java
index 818c83934a97c4b2ad4db69f4b0fcf0a500ea918..0aeb9faa1ce22359361741a591aa3d465d955970 100644 index b67bc6d6a02fdac377f32a766fd8cc2c5fc43488..3a2ae2bca410708736da64560e74b8010444f2dc 100644
--- a/src/main/java/net/minecraft/world/level/material/FlowingFluid.java --- a/src/main/java/net/minecraft/world/level/material/FlowingFluid.java
+++ b/src/main/java/net/minecraft/world/level/material/FlowingFluid.java +++ b/src/main/java/net/minecraft/world/level/material/FlowingFluid.java
@@ -176,7 +176,8 @@ public abstract class FlowingFluid extends Fluid { @@ -176,7 +176,8 @@ public abstract class FlowingFluid extends Fluid {

View File

@ -9,10 +9,10 @@ SpawnerSpawnEvent gets called instead of the CreatureSpawnEvent for
spawners. spawners.
diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java
index 0166c5ff685490cbf67a9d26f48cb1a0be754488..cae8c508972d771ad96228ace8a7e6cbc34d5489 100644 index d13abdcc7a54bdecf853c883911ef535733610b4..ee897b8c9462dbb3d7be9a2994753155065ce205 100644
--- a/src/main/java/net/minecraft/world/level/BaseSpawner.java --- a/src/main/java/net/minecraft/world/level/BaseSpawner.java
+++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java +++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java
@@ -131,10 +131,10 @@ public abstract class BaseSpawner { @@ -133,10 +133,10 @@ public abstract class BaseSpawner {
continue; continue;
} }
// Paper start - PreCreatureSpawnEvent // Paper start - PreCreatureSpawnEvent

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Add LivingEntity#getTargetEntity
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 4b3d1c8452bd759db6fc8d3d9fcf98e2a8d25084..1a328de32b69b69814e11a5b6bc55bfccf408d6b 100644 index a770d2bda45cee739a5371119018e6f6e4cbb2cb..9f97c1c18d7f7e084897f584be77b128c5cbfa13 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -115,6 +115,7 @@ import net.minecraft.world.level.storage.loot.LootTable; @@ -121,6 +121,7 @@ import net.minecraft.world.level.storage.loot.LootTable;
import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets; import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets;
import net.minecraft.world.level.storage.loot.parameters.LootContextParams; import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.AABB;
@ -16,7 +16,7 @@ index 4b3d1c8452bd759db6fc8d3d9fcf98e2a8d25084..1a328de32b69b69814e11a5b6bc55bfc
import net.minecraft.world.phys.HitResult; import net.minecraft.world.phys.HitResult;
import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.Vec3;
import net.minecraft.world.scores.PlayerTeam; import net.minecraft.world.scores.PlayerTeam;
@@ -3911,6 +3912,38 @@ public abstract class LivingEntity extends Entity implements Attackable { @@ -3996,6 +3997,38 @@ public abstract class LivingEntity extends Entity implements Attackable {
return this.level().clip(raytrace); return this.level().clip(raytrace);
} }
@ -56,7 +56,7 @@ index 4b3d1c8452bd759db6fc8d3d9fcf98e2a8d25084..1a328de32b69b69814e11a5b6bc55bfc
public int getShieldBlockingDelay() { public int getShieldBlockingDelay() {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index 8139ea88988e2e3551258b6686873753353ab9f8..5def5bccd8fce86ce015567e65fefae329819c18 100644 index fa2cb4820698d4f0f317d7abd14216bdd54143a7..b2172a8c70ab77ba7c98b6b2b27595765d7eba11 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -1,5 +1,6 @@ @@ -1,5 +1,6 @@
@ -66,7 +66,7 @@ index 8139ea88988e2e3551258b6686873753353ab9f8..5def5bccd8fce86ce015567e65fefae3
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
import java.util.ArrayList; import java.util.ArrayList;
@@ -226,6 +227,39 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { @@ -225,6 +226,39 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
} }
return null; return null;
} }

View File

@ -7,7 +7,7 @@ Subject: [PATCH] Add sun related API
public net.minecraft.world.entity.Mob isSunBurnTick()Z public net.minecraft.world.entity.Mob isSunBurnTick()Z
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index fd04c5c7e08b54de65ffaf58385dcc05ef22bba0..18db1aa374495a214807c5eb3ccc0213fc7c6a47 100644 index 4a7c418a497b98d5038794b6bbc38f5e0b7fedd7..5d5eb6cef3b9646fab6c8da2a67d269312e6958c 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -731,6 +731,13 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -731,6 +731,13 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@ -25,10 +25,10 @@ index fd04c5c7e08b54de65ffaf58385dcc05ef22bba0..18db1aa374495a214807c5eb3ccc0213
public long getGameTime() { public long getGameTime() {
return this.world.levelData.getGameTime(); return this.world.levelData.getGameTime();
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java
index 018884ced888fcd03d2fb17b3620f8e6125e67da..0ad9885f939bcb50026d50ed78b970a44772ceb8 100644 index d597eea5d5c2f223e87bff06f292619657596f1f..2a8596e4f9d7be966c18e867c2c7b5bfbea9742c 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java
@@ -93,4 +93,11 @@ public abstract class CraftMob extends CraftLivingEntity implements Mob { @@ -90,4 +90,11 @@ public abstract class CraftMob extends CraftLivingEntity implements Mob {
public long getSeed() { public long getSeed() {
return this.getHandle().lootTableSeed; return this.getHandle().lootTableSeed;
} }

View File

@ -13,7 +13,7 @@ Shulkers) may need to be changed in order for it to re-save properly
No more crashing though. No more crashing though.
diff --git a/src/main/java/io/papermc/paper/util/MCUtil.java b/src/main/java/io/papermc/paper/util/MCUtil.java diff --git a/src/main/java/io/papermc/paper/util/MCUtil.java b/src/main/java/io/papermc/paper/util/MCUtil.java
index c57e8b6458800fe9bb27050eecc42bd3e5cf5a15..83c7b47e189a934345f6548df9b101cc8c501910 100644 index c57e8b6458800fe9bb27050eecc42bd3e5cf5a15..cdb514137797f4265dea5edb094caada5cee46a3 100644
--- a/src/main/java/io/papermc/paper/util/MCUtil.java --- a/src/main/java/io/papermc/paper/util/MCUtil.java
+++ b/src/main/java/io/papermc/paper/util/MCUtil.java +++ b/src/main/java/io/papermc/paper/util/MCUtil.java
@@ -558,4 +558,19 @@ public final class MCUtil { @@ -558,4 +558,19 @@ public final class MCUtil {
@ -22,13 +22,13 @@ index c57e8b6458800fe9bb27050eecc42bd3e5cf5a15..83c7b47e189a934345f6548df9b101cc
} }
+ +
+ @Nullable + @Nullable
+ public static net.minecraft.network.chat.Component getBaseComponentFromNbt(String key, net.minecraft.nbt.CompoundTag compound) { + public static net.minecraft.network.chat.Component getBaseComponentFromNbt(final String key, final net.minecraft.nbt.CompoundTag compound, final net.minecraft.core.HolderLookup.Provider lookupProvider) {
+ if (!compound.contains(key)) { + if (!compound.contains(key)) {
+ return null; + return null;
+ } + }
+ String string = compound.getString(key); + final String string = compound.getString(key);
+ try { + try {
+ return net.minecraft.network.chat.Component.Serializer.fromJson(string); + return net.minecraft.network.chat.Component.Serializer.fromJson(string, lookupProvider);
+ } catch (com.google.gson.JsonParseException e) { + } catch (com.google.gson.JsonParseException e) {
+ org.bukkit.Bukkit.getLogger().warning("Unable to parse " + key + " from " + compound +": " + e.getMessage()); + org.bukkit.Bukkit.getLogger().warning("Unable to parse " + key + " from " + compound +": " + e.getMessage());
+ } + }
@ -37,67 +37,80 @@ index c57e8b6458800fe9bb27050eecc42bd3e5cf5a15..83c7b47e189a934345f6548df9b101cc
+ } + }
} }
diff --git a/src/main/java/net/minecraft/world/level/BaseCommandBlock.java b/src/main/java/net/minecraft/world/level/BaseCommandBlock.java diff --git a/src/main/java/net/minecraft/world/level/BaseCommandBlock.java b/src/main/java/net/minecraft/world/level/BaseCommandBlock.java
index 129f0e6108366dbba1bafb04e01e5e5e6489f577..ac0aeb53176069d0835b6b08c8d871edae846763 100644 index 626e4fe03dea008907823b49f0dd936bbf7e4e04..2d0eac7a8aa94ed6c4ec024bc6024440cbeac702 100644
--- a/src/main/java/net/minecraft/world/level/BaseCommandBlock.java --- a/src/main/java/net/minecraft/world/level/BaseCommandBlock.java
+++ b/src/main/java/net/minecraft/world/level/BaseCommandBlock.java +++ b/src/main/java/net/minecraft/world/level/BaseCommandBlock.java
@@ -72,7 +72,7 @@ public abstract class BaseCommandBlock implements CommandSource { @@ -75,7 +75,7 @@ public abstract class BaseCommandBlock implements CommandSource {
this.command = nbt.getString("Command"); this.command = nbt.getString("Command");
this.successCount = nbt.getInt("SuccessCount"); this.successCount = nbt.getInt("SuccessCount");
if (nbt.contains("CustomName", 8)) { if (nbt.contains("CustomName", 8)) {
- this.setName(Component.Serializer.fromJson(nbt.getString("CustomName"))); - this.setCustomName(Component.Serializer.fromJson(nbt.getString("CustomName"), registries));
+ this.setName(io.papermc.paper.util.MCUtil.getBaseComponentFromNbt("CustomName", nbt)); // Paper - Catch ParseException + this.setCustomName(io.papermc.paper.util.MCUtil.getBaseComponentFromNbt("CustomName", nbt, registries)); // Paper - Catch ParseException
} else {
this.setCustomName((Component) null);
} }
if (nbt.contains("TrackOutput", 1)) {
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BannerBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BannerBlockEntity.java diff --git a/src/main/java/net/minecraft/world/level/block/entity/BannerBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BannerBlockEntity.java
index c6194fa1611412ac119fed493d5eab5a160e593d..d89037a83ae1b6d2afa6a589c1b8098cbedf3d2d 100644 index df4cd333ecd5c90e910df0c7c5ab5aa44c182903..2656e06ab2269141a13011eaa906f601887ca3e2 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/BannerBlockEntity.java --- a/src/main/java/net/minecraft/world/level/block/entity/BannerBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/BannerBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/BannerBlockEntity.java
@@ -98,7 +98,7 @@ public class BannerBlockEntity extends BlockEntity implements Nameable { @@ -77,7 +77,7 @@ public class BannerBlockEntity extends BlockEntity implements Nameable {
public void load(CompoundTag nbt) { protected void loadAdditional(CompoundTag nbt, HolderLookup.Provider registryLookup) {
super.load(nbt); super.loadAdditional(nbt, registryLookup);
if (nbt.contains("CustomName", 8)) { if (nbt.contains("CustomName", 8)) {
- this.name = Component.Serializer.fromJson(nbt.getString("CustomName")); - this.name = Component.Serializer.fromJson(nbt.getString("CustomName"), registryLookup);
+ this.name = io.papermc.paper.util.MCUtil.getBaseComponentFromNbt("CustomName", nbt); // Paper - Catch ParseException + this.name = io.papermc.paper.util.MCUtil.getBaseComponentFromNbt("CustomName", nbt, registryLookup); // Paper - Catch ParseException
} }
this.itemPatterns = nbt.getList("Patterns", 10); if (nbt.contains("patterns")) {
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BaseContainerBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BaseContainerBlockEntity.java diff --git a/src/main/java/net/minecraft/world/level/block/entity/BaseContainerBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BaseContainerBlockEntity.java
index 25764076fec05b1362aa9b9b608e03bd39817d90..fce3a45d09a93ca68a3d49f2e666afa4c860d042 100644 index ee3b370b6b36914146db33a3211b6bbd2f8f16b7..ff3f26c31bd11b48f48e354ea6b33aa55dcbff5d 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/BaseContainerBlockEntity.java --- a/src/main/java/net/minecraft/world/level/block/entity/BaseContainerBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/BaseContainerBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/BaseContainerBlockEntity.java
@@ -31,7 +31,7 @@ public abstract class BaseContainerBlockEntity extends BlockEntity implements Co @@ -39,7 +39,7 @@ public abstract class BaseContainerBlockEntity extends BlockEntity implements Co
super.load(nbt); super.loadAdditional(nbt, registryLookup);
this.lockKey = LockCode.fromTag(nbt); this.lockKey = LockCode.fromTag(nbt);
if (nbt.contains("CustomName", 8)) { if (nbt.contains("CustomName", 8)) {
- this.name = Component.Serializer.fromJson(nbt.getString("CustomName")); - this.name = Component.Serializer.fromJson(nbt.getString("CustomName"), registryLookup);
+ this.name = io.papermc.paper.util.MCUtil.getBaseComponentFromNbt("CustomName", nbt); // Paper - Catch ParseException + this.name = io.papermc.paper.util.MCUtil.getBaseComponentFromNbt("CustomName", nbt, registryLookup); // Paper - Catch ParseException
} }
} }
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java diff --git a/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java
index 25ec3ab534872500a2eb51cd44062e2754c404bb..a1097950766ad31393340b423ea3f98a1f555368 100644 index d3ef3d9a67bc54a4c82a39718f01201201dfc44c..18450017bc3df2f0b1a5715e6021e8e5defa24a1 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java --- a/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java
@@ -389,7 +389,7 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider, Name @@ -391,7 +391,7 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider, Name
this.secondaryPower = BeaconBlockEntity.loadEffect(nbt, "secondary_effect"); this.secondaryPower = BeaconBlockEntity.loadEffect(nbt, "secondary_effect");
this.levels = nbt.getInt("Levels"); // CraftBukkit - SPIGOT-5053, use where available this.levels = nbt.getInt("Levels"); // CraftBukkit - SPIGOT-5053, use where available
if (nbt.contains("CustomName", 8)) { if (nbt.contains("CustomName", 8)) {
- this.name = Component.Serializer.fromJson(nbt.getString("CustomName")); - this.name = Component.Serializer.fromJson(nbt.getString("CustomName"), registryLookup);
+ this.name = io.papermc.paper.util.MCUtil.getBaseComponentFromNbt("CustomName", nbt); // Paper - Catch ParseException + this.name = io.papermc.paper.util.MCUtil.getBaseComponentFromNbt("CustomName", nbt, registryLookup); // Paper - Catch ParseException
} }
this.lockKey = LockCode.fromTag(nbt); this.lockKey = LockCode.fromTag(nbt);
diff --git a/src/main/java/net/minecraft/world/level/block/entity/EnchantmentTableBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/EnchantmentTableBlockEntity.java diff --git a/src/main/java/net/minecraft/world/level/block/entity/EnchantingTableBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/EnchantingTableBlockEntity.java
index 00de0cc29775a219a763431fd4d54b2fa2585477..4d1a895f3749bdcb132de199e81a9d93330c0ee6 100644 index 767994f493fb0a0e4bf097cd7cc178c10e79e937..c3503eaec5c5ece6e27a52fb703d06ec7c767383 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/EnchantmentTableBlockEntity.java --- a/src/main/java/net/minecraft/world/level/block/entity/EnchantingTableBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/EnchantmentTableBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/EnchantingTableBlockEntity.java
@@ -41,7 +41,7 @@ public class EnchantmentTableBlockEntity extends BlockEntity implements Nameable @@ -45,7 +45,7 @@ public class EnchantingTableBlockEntity extends BlockEntity implements Nameable
public void load(CompoundTag nbt) { protected void loadAdditional(CompoundTag nbt, HolderLookup.Provider registryLookup) {
super.load(nbt); super.loadAdditional(nbt, registryLookup);
if (nbt.contains("CustomName", 8)) { if (nbt.contains("CustomName", 8)) {
- this.name = Component.Serializer.fromJson(nbt.getString("CustomName")); - this.name = Component.Serializer.fromJson(nbt.getString("CustomName"), registryLookup);
+ this.name = io.papermc.paper.util.MCUtil.getBaseComponentFromNbt("CustomName", nbt); // Paper - Catch ParseException + this.name = io.papermc.paper.util.MCUtil.getBaseComponentFromNbt("CustomName", nbt, registryLookup); // Paper - Catch ParseException
} }
} }
diff --git a/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java
index ebba6bc5b337d19e32be5a78294501ed8300f2bd..adc87c2da5a4a4a89eb9708850376eaed49cf20a 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java
@@ -145,7 +145,7 @@ public class SkullBlockEntity extends BlockEntity {
}
if (nbt.contains("custom_name", 8)) {
- this.customName = Component.Serializer.fromJson(nbt.getString("custom_name"), registryLookup);
+ this.customName = io.papermc.paper.util.MCUtil.getBaseComponentFromNbt("custom_name", nbt, registryLookup); // Paper - Catch ParseException
} else {
this.customName = null;
}

View File

@ -12,10 +12,10 @@ public net.minecraft.world.entity.animal.Turtle isTravelling()Z
public net.minecraft.world.entity.animal.Turtle setTravelling(Z)V public net.minecraft.world.entity.animal.Turtle setTravelling(Z)V
diff --git a/src/main/java/net/minecraft/world/entity/animal/Turtle.java b/src/main/java/net/minecraft/world/entity/animal/Turtle.java diff --git a/src/main/java/net/minecraft/world/entity/animal/Turtle.java b/src/main/java/net/minecraft/world/entity/animal/Turtle.java
index 11322066522a3268063bad7267ef4dd4f06d983e..cfc0cee09dfd522409bb5853fc96528bd0137475 100644 index e6bc782683ea5d69840ca7b89b20cfdc1adac5fd..b550befd7bd05951be160f81600200b0b31bae5b 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Turtle.java --- a/src/main/java/net/minecraft/world/entity/animal/Turtle.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Turtle.java +++ b/src/main/java/net/minecraft/world/entity/animal/Turtle.java
@@ -489,14 +489,17 @@ public class Turtle extends Animal { @@ -487,14 +487,17 @@ public class Turtle extends Animal {
if (!this.turtle.isInWater() && this.isReachedTarget()) { if (!this.turtle.isInWater() && this.isReachedTarget()) {
if (this.turtle.layEggCounter < 1) { if (this.turtle.layEggCounter < 1) {
@ -35,8 +35,8 @@ index 11322066522a3268063bad7267ef4dd4f06d983e..cfc0cee09dfd522409bb5853fc96528b
+ BlockState iblockdata = (BlockState) Blocks.TURTLE_EGG.defaultBlockState().setValue(TurtleEggBlock.EGGS, layEggEvent.getEggCount()); // Paper + BlockState iblockdata = (BlockState) Blocks.TURTLE_EGG.defaultBlockState().setValue(TurtleEggBlock.EGGS, layEggEvent.getEggCount()); // Paper
world.setBlock(blockposition1, iblockdata, 3); world.setBlock(blockposition1, iblockdata, 3);
world.gameEvent(GameEvent.BLOCK_PLACE, blockposition1, GameEvent.Context.of(this.turtle, iblockdata)); world.gameEvent((Holder) GameEvent.BLOCK_PLACE, blockposition1, GameEvent.Context.of(this.turtle, iblockdata));
@@ -566,7 +569,7 @@ public class Turtle extends Animal { @@ -564,7 +567,7 @@ public class Turtle extends Animal {
@Override @Override
public boolean canUse() { public boolean canUse() {

View File

@ -19,10 +19,10 @@ spectate the target entity.
Co-authored-by: Spottedleaf <Spottedleaf@users.noreply.github.com> Co-authored-by: Spottedleaf <Spottedleaf@users.noreply.github.com>
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 054057482d191d8e77bf4d179d51e32b5d9ca16e..19c3eb566552f7994ae5e60dc869c94e08590fbb 100644 index c97410f580f31389987ef944fc410e44459a4693..b331af6de6a23dedf6cd21b97cb81048db215f10 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -2041,6 +2041,21 @@ public class ServerPlayer extends Player { @@ -2123,6 +2123,21 @@ public class ServerPlayer extends Player {
this.camera = (Entity) (entity == null ? this : entity); this.camera = (Entity) (entity == null ? this : entity);
if (entity1 != this.camera) { if (entity1 != this.camera) {

View File

@ -7,15 +7,15 @@ Subject: [PATCH] Add more Witch API
public net.minecraft.world.entity.monster.Witch usingTime public net.minecraft.world.entity.monster.Witch usingTime
diff --git a/src/main/java/net/minecraft/world/entity/monster/Witch.java b/src/main/java/net/minecraft/world/entity/monster/Witch.java diff --git a/src/main/java/net/minecraft/world/entity/monster/Witch.java b/src/main/java/net/minecraft/world/entity/monster/Witch.java
index 25a1edf64602a13c07779e58b167a8471019588e..f9ffc5f4cbfdcf5c7351a883d2e5c26492175283 100644 index d286239d02b81624124c4e32ff4413bbac902d54..5803c1d36b769f0186baa0665976749765b4cb61 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Witch.java --- a/src/main/java/net/minecraft/world/entity/monster/Witch.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Witch.java +++ b/src/main/java/net/minecraft/world/entity/monster/Witch.java
@@ -160,21 +160,7 @@ public class Witch extends Raider implements RangedAttackMob { @@ -150,21 +150,7 @@ public class Witch extends Raider implements RangedAttackMob {
} }
if (potionregistry != null) { if (holder != null) {
- // Paper start - // Paper start
- ItemStack potion = PotionUtils.setPotion(new ItemStack(Items.POTION), potionregistry); - ItemStack potion = PotionContents.createItemStack(Items.POTION, holder);
- potion = org.bukkit.craftbukkit.event.CraftEventFactory.handleWitchReadyPotionEvent(this, potion); - potion = org.bukkit.craftbukkit.event.CraftEventFactory.handleWitchReadyPotionEvent(this, potion);
- this.setItemSlot(EquipmentSlot.MAINHAND, potion); - this.setItemSlot(EquipmentSlot.MAINHAND, potion);
- // Paper end - // Paper end
@ -27,13 +27,13 @@ index 25a1edf64602a13c07779e58b167a8471019588e..f9ffc5f4cbfdcf5c7351a883d2e5c264
- -
- AttributeInstance attributemodifiable = this.getAttribute(Attributes.MOVEMENT_SPEED); - AttributeInstance attributemodifiable = this.getAttribute(Attributes.MOVEMENT_SPEED);
- -
- attributemodifiable.removeModifier(Witch.SPEED_MODIFIER_DRINKING.getId()); - attributemodifiable.removeModifier(Witch.SPEED_MODIFIER_DRINKING.id());
- attributemodifiable.addTransientModifier(Witch.SPEED_MODIFIER_DRINKING); - attributemodifiable.addTransientModifier(Witch.SPEED_MODIFIER_DRINKING);
+ this.setDrinkingPotion(PotionUtils.setPotion(new ItemStack(Items.POTION), potionregistry)); // Paper - logic moved into setDrinkingPotion, copy exact impl into the method and then comment out + this.setDrinkingPotion(PotionContents.createItemStack(Items.POTION, holder)); // Paper - logic moved into setDrinkingPotion, copy exact impl into the method and then comment out
} }
} }
@@ -186,6 +172,23 @@ public class Witch extends Raider implements RangedAttackMob { @@ -176,6 +162,23 @@ public class Witch extends Raider implements RangedAttackMob {
super.aiStep(); super.aiStep();
} }
@ -49,7 +49,7 @@ index 25a1edf64602a13c07779e58b167a8471019588e..f9ffc5f4cbfdcf5c7351a883d2e5c264
+ +
+ AttributeInstance attributemodifiable = this.getAttribute(Attributes.MOVEMENT_SPEED); + AttributeInstance attributemodifiable = this.getAttribute(Attributes.MOVEMENT_SPEED);
+ +
+ attributemodifiable.removeModifier(Witch.SPEED_MODIFIER_DRINKING.getId()); + attributemodifiable.removeModifier(Witch.SPEED_MODIFIER_DRINKING.id());
+ attributemodifiable.addTransientModifier(Witch.SPEED_MODIFIER_DRINKING); + attributemodifiable.addTransientModifier(Witch.SPEED_MODIFIER_DRINKING);
+ } + }
+ // Paper end + // Paper end

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Check Drowned for Villager Aggression Config
diff --git a/src/main/java/net/minecraft/world/entity/monster/Drowned.java b/src/main/java/net/minecraft/world/entity/monster/Drowned.java diff --git a/src/main/java/net/minecraft/world/entity/monster/Drowned.java b/src/main/java/net/minecraft/world/entity/monster/Drowned.java
index ee2abc0c39a76a74c151ecc8660d2037f3db0636..01897af1e6253b987734a24c052daf2ce1314092 100644 index d4b3ce2bb2021625c90a3f51c6f9da6056b2e2ff..cff1b5e0e3fd32d82157d5f13d83d4abdfad7378 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Drowned.java --- a/src/main/java/net/minecraft/world/entity/monster/Drowned.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Drowned.java +++ b/src/main/java/net/minecraft/world/entity/monster/Drowned.java
@@ -78,7 +78,7 @@ public class Drowned extends Zombie implements RangedAttackMob { @@ -81,7 +81,7 @@ public class Drowned extends Zombie implements RangedAttackMob {
this.goalSelector.addGoal(7, new RandomStrollGoal(this, 1.0D)); this.goalSelector.addGoal(7, new RandomStrollGoal(this, 1.0D));
this.targetSelector.addGoal(1, (new HurtByTargetGoal(this, new Class[]{Drowned.class})).setAlertOthers(ZombifiedPiglin.class)); this.targetSelector.addGoal(1, (new HurtByTargetGoal(this, new Class[]{Drowned.class})).setAlertOthers(ZombifiedPiglin.class));
this.targetSelector.addGoal(2, new NearestAttackableTargetGoal<>(this, Player.class, 10, true, false, this::okTarget)); this.targetSelector.addGoal(2, new NearestAttackableTargetGoal<>(this, Player.class, 10, true, false, this::okTarget));

View File

@ -6,10 +6,10 @@ Subject: [PATCH] Add option to prevent players from moving into unloaded
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 7663110df928ec88fc97e3b7d65671001db2d1bc..1de240ecfbe815c12fc35aee1198f8c7a44f3527 100644 index f49f412781a8f341eda02de323f7298d5f0b25ee..8a7b286bb2d2151d8f2182d1a8e0d891ff6d677a 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -474,9 +474,9 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -500,9 +500,9 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
double d0 = entity.getX(); double d0 = entity.getX();
double d1 = entity.getY(); double d1 = entity.getY();
double d2 = entity.getZ(); double d2 = entity.getZ();
@ -22,7 +22,7 @@ index 7663110df928ec88fc97e3b7d65671001db2d1bc..1de240ecfbe815c12fc35aee1198f8c7
float f = Mth.wrapDegrees(packet.getYRot()); float f = Mth.wrapDegrees(packet.getYRot());
float f1 = Mth.wrapDegrees(packet.getXRot()); float f1 = Mth.wrapDegrees(packet.getXRot());
double d6 = d3 - this.vehicleFirstGoodX; double d6 = d3 - this.vehicleFirstGoodX;
@@ -510,6 +510,16 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -536,6 +536,16 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
} }
speed *= 2f; // TODO: Get the speed of the vehicle instead of the player speed *= 2f; // TODO: Get the speed of the vehicle instead of the player
@ -39,7 +39,7 @@ index 7663110df928ec88fc97e3b7d65671001db2d1bc..1de240ecfbe815c12fc35aee1198f8c7
if (d10 - d9 > Math.max(100.0D, Math.pow((double) (org.spigotmc.SpigotConfig.movedTooQuicklyMultiplier * (float) i * speed), 2)) && !this.isSingleplayerOwner()) { if (d10 - d9 > Math.max(100.0D, Math.pow((double) (org.spigotmc.SpigotConfig.movedTooQuicklyMultiplier * (float) i * speed), 2)) && !this.isSingleplayerOwner()) {
// CraftBukkit end // CraftBukkit end
ServerGamePacketListenerImpl.LOGGER.warn("{} (vehicle of {}) moved too quickly! {},{},{}", new Object[]{entity.getName().getString(), this.player.getName().getString(), d6, d7, d8}); ServerGamePacketListenerImpl.LOGGER.warn("{} (vehicle of {}) moved too quickly! {},{},{}", new Object[]{entity.getName().getString(), this.player.getName().getString(), d6, d7, d8});
@@ -1178,9 +1188,9 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -1168,9 +1178,9 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
} else { } else {
this.awaitingTeleportTime = this.tickCount; this.awaitingTeleportTime = this.tickCount;
@ -52,7 +52,7 @@ index 7663110df928ec88fc97e3b7d65671001db2d1bc..1de240ecfbe815c12fc35aee1198f8c7
float f = Mth.wrapDegrees(packet.getYRot(this.player.getYRot())); float f = Mth.wrapDegrees(packet.getYRot(this.player.getYRot()));
float f1 = Mth.wrapDegrees(packet.getXRot(this.player.getXRot())); float f1 = Mth.wrapDegrees(packet.getXRot(this.player.getXRot()));
@@ -1236,6 +1246,12 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -1228,6 +1238,12 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
} else { } else {
speed = this.player.getAbilities().walkingSpeed * 10f; speed = this.player.getAbilities().walkingSpeed * 10f;
} }
@ -63,5 +63,5 @@ index 7663110df928ec88fc97e3b7d65671001db2d1bc..1de240ecfbe815c12fc35aee1198f8c7
+ } + }
+ // Paper end - Prevent moving into unloaded chunks + // Paper end - Prevent moving into unloaded chunks
if (!this.player.isChangingDimension() && (!this.player.level().getGameRules().getBoolean(GameRules.RULE_DISABLE_ELYTRA_MOVEMENT_CHECK) || !this.player.isFallFlying())) { if (!this.player.isChangingDimension() && (!this.player.level().getGameRules().getBoolean(GameRules.RULE_DISABLE_ELYTRA_MOVEMENT_CHECK) || !flag)) {
float f2 = this.player.isFallFlying() ? 300.0F : 100.0F; float f2 = flag ? 300.0F : 100.0F;

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Reset players airTicks on respawn
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 19c3eb566552f7994ae5e60dc869c94e08590fbb..08c936288b5ac8738d7cff9fe95b1256ae32cd28 100644 index b331af6de6a23dedf6cd21b97cb81048db215f10..3b71ea8263b2049c54432a64c7f01aed3848d1c7 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -2516,6 +2516,7 @@ public class ServerPlayer extends Player { @@ -2614,6 +2614,7 @@ public class ServerPlayer extends Player {
this.setHealth(this.getMaxHealth()); this.setHealth(this.getMaxHealth());
this.stopUsingItem(); // CraftBukkit - SPIGOT-6682: Clear active item on reset this.stopUsingItem(); // CraftBukkit - SPIGOT-6682: Clear active item on reset

View File

@ -38,10 +38,10 @@ index 0000000000000000000000000000000000000000..b60f59cf5cc8eb84a6055b7861857dec
+ } + }
+} +}
diff --git a/src/main/java/net/minecraft/Util.java b/src/main/java/net/minecraft/Util.java diff --git a/src/main/java/net/minecraft/Util.java b/src/main/java/net/minecraft/Util.java
index 3db6962b9f6f5da09694d57b7323c39f314b1327..722734ce612fb790ddc80488a795a85ebcd4a842 100644 index cf54e2c8e8aadb9e7343382a5ba59c657234c9b9..c7a21a11efba5c212958d56095217621828c1062 100644
--- a/src/main/java/net/minecraft/Util.java --- a/src/main/java/net/minecraft/Util.java
+++ b/src/main/java/net/minecraft/Util.java +++ b/src/main/java/net/minecraft/Util.java
@@ -88,7 +88,7 @@ public class Util { @@ -90,7 +90,7 @@ public class Util {
private static final int DEFAULT_MAX_THREADS = 255; private static final int DEFAULT_MAX_THREADS = 255;
private static final int DEFAULT_SAFE_FILE_OPERATION_RETRIES = 10; private static final int DEFAULT_SAFE_FILE_OPERATION_RETRIES = 10;
private static final String MAX_THREADS_SYSTEM_PROPERTY = "max.bg.threads"; private static final String MAX_THREADS_SYSTEM_PROPERTY = "max.bg.threads";
@ -50,7 +50,7 @@ index 3db6962b9f6f5da09694d57b7323c39f314b1327..722734ce612fb790ddc80488a795a85e
private static final ExecutorService IO_POOL = makeIoExecutor("IO-Worker-", false); private static final ExecutorService IO_POOL = makeIoExecutor("IO-Worker-", false);
private static final ExecutorService DOWNLOAD_POOL = makeIoExecutor("Download-", true); private static final ExecutorService DOWNLOAD_POOL = makeIoExecutor("Download-", true);
// Paper start - don't submit BLOCKING PROFILE LOOKUPS to the world gen thread // Paper start - don't submit BLOCKING PROFILE LOOKUPS to the world gen thread
@@ -154,15 +154,27 @@ public class Util { @@ -160,15 +160,27 @@ public class Util {
return FILENAME_DATE_TIME_FORMATTER.format(ZonedDateTime.now()); return FILENAME_DATE_TIME_FORMATTER.format(ZonedDateTime.now());
} }
@ -83,7 +83,7 @@ index 3db6962b9f6f5da09694d57b7323c39f314b1327..722734ce612fb790ddc80488a795a85e
@Override @Override
protected void onTermination(Throwable throwable) { protected void onTermination(Throwable throwable) {
if (throwable != null) { if (throwable != null) {
@@ -178,6 +190,7 @@ public class Util { @@ -184,6 +196,7 @@ public class Util {
return forkJoinWorkerThread; return forkJoinWorkerThread;
}, Util::onThreadException, true); }, Util::onThreadException, true);
} }
@ -92,10 +92,10 @@ index 3db6962b9f6f5da09694d57b7323c39f314b1327..722734ce612fb790ddc80488a795a85e
return executorService; return executorService;
} }
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 8196ecb2a7280a4f60a5fea18c484d6419953b48..dd2cbb4d3bda6776e94279513b8d58d20661a8aa 100644 index 23a5358a5fe4784e75b327741e6fcb174c04d287..0a460ae7f57d1a58385e23fb9f95a7c475aec1da 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -312,6 +312,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -319,6 +319,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
thread.setUncaughtExceptionHandler((thread1, throwable) -> { thread.setUncaughtExceptionHandler((thread1, throwable) -> {
MinecraftServer.LOGGER.error("Uncaught exception in server thread", throwable); MinecraftServer.LOGGER.error("Uncaught exception in server thread", throwable);
}); });

View File

@ -8,10 +8,10 @@ the updates per world, so that we can re-use the same packet
object for every player unless they have per-player time enabled. object for every player unless they have per-player time enabled.
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index dd2cbb4d3bda6776e94279513b8d58d20661a8aa..01acf93115db41212adf703d44481f50c746a8fa 100644 index 0a460ae7f57d1a58385e23fb9f95a7c475aec1da..34e5adcbeb105e6da8ab660d7f322969305d44ec 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1478,12 +1478,24 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1538,12 +1538,24 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
MinecraftTimings.timeUpdateTimer.startTiming(); // Spigot // Paper MinecraftTimings.timeUpdateTimer.startTiming(); // Spigot // Paper
// Send time updates to everyone, it will get the right time from the world the player is in. // Send time updates to everyone, it will get the right time from the world the player is in.

View File

@ -253,7 +253,7 @@ index fc0e1212022d1aa3506699b60ef338196eb54eba..da1c1fe0faf6819b15a81d6ad5337094
static class MinecraftInventory implements Container { static class MinecraftInventory implements Container {
private final NonNullList<ItemStack> items; private final NonNullList<ItemStack> items;
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/util/CraftTileInventoryConverter.java b/src/main/java/org/bukkit/craftbukkit/inventory/util/CraftTileInventoryConverter.java diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/util/CraftTileInventoryConverter.java b/src/main/java/org/bukkit/craftbukkit/inventory/util/CraftTileInventoryConverter.java
index 3aecc929c0a9ea6a770326304dacd51fc08ac894..8d3f71689087d687e6400e2ea9750a6fb3535bf1 100644 index 02f9a9e5240222548bec643b817734f702ba8e98..4a4996f8653edaf3182887821a8762caceab58ee 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/util/CraftTileInventoryConverter.java --- a/src/main/java/org/bukkit/craftbukkit/inventory/util/CraftTileInventoryConverter.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/util/CraftTileInventoryConverter.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/util/CraftTileInventoryConverter.java
@@ -28,7 +28,7 @@ public abstract class CraftTileInventoryConverter implements CraftInventoryCreat @@ -28,7 +28,7 @@ public abstract class CraftTileInventoryConverter implements CraftInventoryCreat
@ -275,7 +275,7 @@ index 3aecc929c0a9ea6a770326304dacd51fc08ac894..8d3f71689087d687e6400e2ea9750a6f
// Paper end // Paper end
@@ -50,10 +50,18 @@ public abstract class CraftTileInventoryConverter implements CraftInventoryCreat @@ -50,10 +50,18 @@ public abstract class CraftTileInventoryConverter implements CraftInventoryCreat
((RandomizableContainerBlockEntity) te).setCustomName(CraftChatMessage.fromStringOrNull(title)); ((RandomizableContainerBlockEntity) te).name = CraftChatMessage.fromStringOrNull(title);
} }
- return this.getInventory(te); - return this.getInventory(te);
@ -306,7 +306,7 @@ index 3aecc929c0a9ea6a770326304dacd51fc08ac894..8d3f71689087d687e6400e2ea9750a6f
@@ -78,11 +86,19 @@ public abstract class CraftTileInventoryConverter implements CraftInventoryCreat @@ -78,11 +86,19 @@ public abstract class CraftTileInventoryConverter implements CraftInventoryCreat
public Inventory createInventory(InventoryHolder owner, InventoryType type, String title) { public Inventory createInventory(InventoryHolder owner, InventoryType type, String title) {
Container tileEntity = this.getTileEntity(); Container tileEntity = this.getTileEntity();
((AbstractFurnaceBlockEntity) tileEntity).setCustomName(CraftChatMessage.fromStringOrNull(title)); ((AbstractFurnaceBlockEntity) tileEntity).name = CraftChatMessage.fromStringOrNull(title);
- return this.getInventory(tileEntity); - return this.getInventory(tileEntity);
+ return this.getInventory(owner, type, tileEntity); // Paper + return this.getInventory(owner, type, tileEntity); // Paper
} }
@ -335,7 +335,7 @@ index 3aecc929c0a9ea6a770326304dacd51fc08ac894..8d3f71689087d687e6400e2ea9750a6f
@@ -113,11 +129,19 @@ public abstract class CraftTileInventoryConverter implements CraftInventoryCreat @@ -113,11 +129,19 @@ public abstract class CraftTileInventoryConverter implements CraftInventoryCreat
if (tileEntity instanceof BrewingStandBlockEntity) { if (tileEntity instanceof BrewingStandBlockEntity) {
((BrewingStandBlockEntity) tileEntity).setCustomName(CraftChatMessage.fromStringOrNull(title)); ((BrewingStandBlockEntity) tileEntity).name = CraftChatMessage.fromStringOrNull(title);
} }
- return this.getInventory(tileEntity); - return this.getInventory(tileEntity);
+ return this.getInventory(holder, type, tileEntity); // Paper + return this.getInventory(holder, type, tileEntity); // Paper

View File

@ -6,7 +6,7 @@ Subject: [PATCH] Fix SpongeAbsortEvent handling
Only process drops when the block is actually going to be removed Only process drops when the block is actually going to be removed
diff --git a/src/main/java/net/minecraft/world/level/block/SpongeBlock.java b/src/main/java/net/minecraft/world/level/block/SpongeBlock.java diff --git a/src/main/java/net/minecraft/world/level/block/SpongeBlock.java b/src/main/java/net/minecraft/world/level/block/SpongeBlock.java
index 1238317d3e6d968525a10c5480a7d44d56abb071..8f3cca228f8ec1ea9379fa43af4baa7b18012dd2 100644 index 2e54730deee3149517a535f15ef6c0628ba659c2..902825ec9ea05f4418b45f56a008d73f217bd178 100644
--- a/src/main/java/net/minecraft/world/level/block/SpongeBlock.java --- a/src/main/java/net/minecraft/world/level/block/SpongeBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/SpongeBlock.java +++ b/src/main/java/net/minecraft/world/level/block/SpongeBlock.java
@@ -134,7 +134,11 @@ public class SpongeBlock extends Block { @@ -134,7 +134,11 @@ public class SpongeBlock extends Block {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Don't allow digging into unloaded chunks
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
index a8d33286832786031ac57e6ce27d5181e1a3d9b1..e8b12b27e5ec74afb940f575e5ce78e5905d55f4 100644 index 5f2dec1917f1c1c3bb69446832321f3fc21dc129..cd6f34ee326228036f8c025e4e6d04e0c15ba06f 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java --- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
@@ -119,8 +119,8 @@ public class ServerPlayerGameMode { @@ -122,8 +122,8 @@ public class ServerPlayerGameMode {
BlockState iblockdata; BlockState iblockdata;
if (this.hasDelayedDestroy) { if (this.hasDelayedDestroy) {
@ -19,7 +19,7 @@ index a8d33286832786031ac57e6ce27d5181e1a3d9b1..e8b12b27e5ec74afb940f575e5ce78e5
this.hasDelayedDestroy = false; this.hasDelayedDestroy = false;
} else { } else {
float f = this.incrementDestroyProgress(iblockdata, this.delayedDestroyPos, this.delayedTickStart); float f = this.incrementDestroyProgress(iblockdata, this.delayedDestroyPos, this.delayedTickStart);
@@ -131,7 +131,13 @@ public class ServerPlayerGameMode { @@ -134,7 +134,13 @@ public class ServerPlayerGameMode {
} }
} }
} else if (this.isDestroyingBlock) { } else if (this.isDestroyingBlock) {
@ -34,15 +34,15 @@ index a8d33286832786031ac57e6ce27d5181e1a3d9b1..e8b12b27e5ec74afb940f575e5ce78e5
if (iblockdata.isAir()) { if (iblockdata.isAir()) {
this.level.destroyBlockProgress(this.player.getId(), this.destroyPos, -1); this.level.destroyBlockProgress(this.player.getId(), this.destroyPos, -1);
this.lastSentState = -1; this.lastSentState = -1;
@@ -160,6 +166,7 @@ public class ServerPlayerGameMode { @@ -163,6 +169,7 @@ public class ServerPlayerGameMode {
public void handleBlockBreakAction(BlockPos pos, ServerboundPlayerActionPacket.Action action, Direction direction, int worldHeight, int sequence) { public void handleBlockBreakAction(BlockPos pos, ServerboundPlayerActionPacket.Action action, Direction direction, int worldHeight, int sequence) {
if (this.player.getEyePosition().distanceToSqr(Vec3.atCenterOf(pos)) > ServerGamePacketListenerImpl.MAX_INTERACTION_DISTANCE) { if (!this.player.canInteractWithBlock(pos, 1.0D)) {
+ if (true) return; // Paper - Don't allow digging into unloaded chunks; Don't notify if unreasonably far away + if (true) return; // Paper - Don't allow digging into unloaded chunks; Don't notify if unreasonably far away
this.debugLogging(pos, false, sequence, "too far"); this.debugLogging(pos, false, sequence, "too far");
} else if (pos.getY() >= worldHeight) { } else if (pos.getY() >= worldHeight) {
this.player.connection.send(new ClientboundBlockUpdatePacket(pos, this.level.getBlockState(pos))); this.player.connection.send(new ClientboundBlockUpdatePacket(pos, this.level.getBlockState(pos)));
@@ -299,10 +306,12 @@ public class ServerPlayerGameMode { @@ -302,10 +309,12 @@ public class ServerPlayerGameMode {
this.debugLogging(pos, true, sequence, "stopped destroying"); this.debugLogging(pos, true, sequence, "stopped destroying");
} else if (action == ServerboundPlayerActionPacket.Action.ABORT_DESTROY_BLOCK) { } else if (action == ServerboundPlayerActionPacket.Action.ABORT_DESTROY_BLOCK) {
this.isDestroyingBlock = false; this.isDestroyingBlock = false;
@ -59,10 +59,10 @@ index a8d33286832786031ac57e6ce27d5181e1a3d9b1..e8b12b27e5ec74afb940f575e5ce78e5
this.level.destroyBlockProgress(this.player.getId(), pos, -1); this.level.destroyBlockProgress(this.player.getId(), pos, -1);
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 1de240ecfbe815c12fc35aee1198f8c7a44f3527..f7529016db5d6f933d8f44de07bbdb9e67040cb1 100644 index 8a7b286bb2d2151d8f2182d1a8e0d891ff6d677a..5443a2713c957b23deb903baf7039b0220699095 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1590,6 +1590,12 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -1589,6 +1589,12 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
case START_DESTROY_BLOCK: case START_DESTROY_BLOCK:
case ABORT_DESTROY_BLOCK: case ABORT_DESTROY_BLOCK:
case STOP_DESTROY_BLOCK: case STOP_DESTROY_BLOCK:

View File

@ -18,10 +18,10 @@ index 6d06b772ffb9d47d6a717462a4b2b494544e80ae..69ffd6ea2ce7c6d4f211c6081fcea79a
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index abdff07588cb06f8ec4f3f2172f7dce92fa8a979..43c69ec522a2c91d47b5cea05aaf86f979c5fcb2 100644 index af9140513970fc5c3797a170eab02de40048543c..8254a5d2a72bf12b2f2600a99eb3058c6e76042a 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -2815,6 +2815,16 @@ public final class CraftServer implements Server { @@ -2834,6 +2834,16 @@ public final class CraftServer implements Server {
return io.papermc.paper.configuration.GlobalConfiguration.get().commands.suggestPlayerNamesWhenNullTabCompletions; return io.papermc.paper.configuration.GlobalConfiguration.get().commands.suggestPlayerNamesWhenNullTabCompletions;
} }

View File

@ -20,10 +20,10 @@ this is going to be the best soultion all around.
Improvements/suggestions welcome! Improvements/suggestions welcome!
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index c46ad2013439f043145fb7fc67bbcd80728e3c16..f746829f1e94ee58821e56ec4192269add00395b 100644 index d39aec1b3233e91aa5b953396d876e7466a9a5bc..28708e1e8ade8fbfec24120478d250ddf1351bf4 100644
--- 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
@@ -2570,11 +2570,16 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -2601,11 +2601,16 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
} }
public void removeVehicle() { public void removeVehicle() {
@ -41,7 +41,7 @@ index c46ad2013439f043145fb7fc67bbcd80728e3c16..f746829f1e94ee58821e56ec4192269a
} }
} }
@@ -2605,7 +2610,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -2636,7 +2641,10 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
} }
} }
@ -53,7 +53,7 @@ index c46ad2013439f043145fb7fc67bbcd80728e3c16..f746829f1e94ee58821e56ec4192269a
if (entity.getVehicle() == this) { if (entity.getVehicle() == this) {
throw new IllegalStateException("Use x.stopRiding(y), not y.removePassenger(x)"); throw new IllegalStateException("Use x.stopRiding(y), not y.removePassenger(x)");
} else { } else {
@@ -2615,7 +2623,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -2646,7 +2654,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
if (this.getBukkitEntity() instanceof Vehicle && entity.getBukkitEntity() instanceof LivingEntity) { if (this.getBukkitEntity() instanceof Vehicle && entity.getBukkitEntity() instanceof LivingEntity) {
VehicleExitEvent event = new VehicleExitEvent( VehicleExitEvent event = new VehicleExitEvent(
(Vehicle) this.getBukkitEntity(), (Vehicle) this.getBukkitEntity(),
@ -62,7 +62,7 @@ index c46ad2013439f043145fb7fc67bbcd80728e3c16..f746829f1e94ee58821e56ec4192269a
); );
// Suppress during worldgen // Suppress during worldgen
if (this.valid) { if (this.valid) {
@@ -2628,7 +2636,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -2659,7 +2667,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
} }
} }
@ -72,10 +72,10 @@ index c46ad2013439f043145fb7fc67bbcd80728e3c16..f746829f1e94ee58821e56ec4192269a
if (this.valid) { if (this.valid) {
Bukkit.getPluginManager().callEvent(event); Bukkit.getPluginManager().callEvent(event);
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 1a328de32b69b69814e11a5b6bc55bfccf408d6b..4be7b136dd2b35b0637a1455985ab99bbd3af0a5 100644 index 9f97c1c18d7f7e084897f584be77b128c5cbfa13..709bcc209299fcc5a593c1b4c93a179af2b5eff1 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3492,9 +3492,15 @@ public abstract class LivingEntity extends Entity implements Attackable { @@ -3579,9 +3579,15 @@ public abstract class LivingEntity extends Entity implements Attackable {
@Override @Override
public void stopRiding() { public void stopRiding() {
@ -93,10 +93,10 @@ index 1a328de32b69b69814e11a5b6bc55bfccf408d6b..4be7b136dd2b35b0637a1455985ab99b
this.dismountVehicle(entity); this.dismountVehicle(entity);
} }
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
index 83c7ba56900ce40f71d98062bf15110a76597dce..3c3c953f05c18279d3245fe6bc8afef83cd62cd1 100644 index 9cc9c6f7e211d9cf42a050f3a265d0bceaf7fd40..42911a87a9028a7ba8c3f63f498e4f15bcd07f24 100644
--- a/src/main/java/net/minecraft/world/entity/player/Player.java --- a/src/main/java/net/minecraft/world/entity/player/Player.java
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java +++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -1141,7 +1141,13 @@ public abstract class Player extends LivingEntity { @@ -1150,7 +1150,13 @@ public abstract class Player extends LivingEntity {
@Override @Override
public void removeVehicle() { public void removeVehicle() {

View File

@ -7,10 +7,10 @@ Subject: [PATCH] Add more Zombie API
public net.minecraft.world.entity.monster.Zombie isSunSensitive()Z public net.minecraft.world.entity.monster.Zombie isSunSensitive()Z
diff --git a/src/main/java/net/minecraft/world/entity/monster/Zombie.java b/src/main/java/net/minecraft/world/entity/monster/Zombie.java 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 15ccde8ee8bac1f70c6047464595aff6db073646..2c8529540bf3644896f3c05d5f544bd848647807 100644 index 1226abd6ce7bb13942a0583c721835aeb769bbb6..7c206dc6f8db4b21d6d068eccc768203d041f51b 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java --- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java +++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
@@ -96,6 +96,7 @@ public class Zombie extends Monster { @@ -93,6 +93,7 @@ public class Zombie extends Monster {
private int inWaterTime; private int inWaterTime;
public int conversionTime; public int conversionTime;
private int lastTick = MinecraftServer.currentTick; // CraftBukkit - add field private int lastTick = MinecraftServer.currentTick; // CraftBukkit - add field
@ -18,7 +18,7 @@ index 15ccde8ee8bac1f70c6047464595aff6db073646..2c8529540bf3644896f3c05d5f544bd8
public Zombie(EntityType<? extends Zombie> type, Level world) { public Zombie(EntityType<? extends Zombie> type, Level world) {
super(type, world); super(type, world);
@@ -264,6 +265,12 @@ public class Zombie extends Monster { @@ -261,6 +262,12 @@ public class Zombie extends Monster {
super.aiStep(); super.aiStep();
} }
@ -31,7 +31,7 @@ index 15ccde8ee8bac1f70c6047464595aff6db073646..2c8529540bf3644896f3c05d5f544bd8
public void startUnderWaterConversion(int ticksUntilWaterConversion) { public void startUnderWaterConversion(int ticksUntilWaterConversion) {
this.lastTick = MinecraftServer.currentTick; // CraftBukkit this.lastTick = MinecraftServer.currentTick; // CraftBukkit
this.conversionTime = ticksUntilWaterConversion; this.conversionTime = ticksUntilWaterConversion;
@@ -293,9 +300,15 @@ public class Zombie extends Monster { @@ -290,9 +297,15 @@ public class Zombie extends Monster {
} }
public boolean isSunSensitive() { public boolean isSunSensitive() {
@ -48,7 +48,7 @@ index 15ccde8ee8bac1f70c6047464595aff6db073646..2c8529540bf3644896f3c05d5f544bd8
@Override @Override
public boolean hurt(DamageSource source, float amount) { public boolean hurt(DamageSource source, float amount) {
if (!super.hurt(source, amount)) { if (!super.hurt(source, amount)) {
@@ -415,6 +428,7 @@ public class Zombie extends Monster { @@ -406,6 +419,7 @@ public class Zombie extends Monster {
nbt.putBoolean("CanBreakDoors", this.canBreakDoors()); nbt.putBoolean("CanBreakDoors", this.canBreakDoors());
nbt.putInt("InWaterTime", this.isInWater() ? this.inWaterTime : -1); nbt.putInt("InWaterTime", this.isInWater() ? this.inWaterTime : -1);
nbt.putInt("DrownedConversionTime", this.isUnderWaterConverting() ? this.conversionTime : -1); nbt.putInt("DrownedConversionTime", this.isUnderWaterConverting() ? this.conversionTime : -1);
@ -56,7 +56,7 @@ index 15ccde8ee8bac1f70c6047464595aff6db073646..2c8529540bf3644896f3c05d5f544bd8
} }
@Override @Override
@@ -426,6 +440,11 @@ public class Zombie extends Monster { @@ -417,6 +431,11 @@ public class Zombie extends Monster {
if (nbt.contains("DrownedConversionTime", 99) && nbt.getInt("DrownedConversionTime") > -1) { if (nbt.contains("DrownedConversionTime", 99) && nbt.getInt("DrownedConversionTime") > -1) {
this.startUnderWaterConversion(nbt.getInt("DrownedConversionTime")); this.startUnderWaterConversion(nbt.getInt("DrownedConversionTime"));
} }

View File

@ -6,10 +6,10 @@ Subject: [PATCH] Book Size Limits
Puts some limits on the size of books. Puts some limits on the size of books.
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index f7529016db5d6f933d8f44de07bbdb9e67040cb1..b42b429e318b9ee784847a1824157573df99f683 100644 index 5443a2713c957b23deb903baf7039b0220699095..a82a6e0381da86e5173a815e1a0160beb8927a1c 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1024,6 +1024,45 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -1046,6 +1046,45 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@Override @Override
public void handleEditBook(ServerboundEditBookPacket packet) { public void handleEditBook(ServerboundEditBookPacket packet) {

View File

@ -38,10 +38,10 @@ public net.minecraft.server.network.ServerLoginPacketListenerImpl$State
public net.minecraft.server.network.ServerLoginPacketListenerImpl state public net.minecraft.server.network.ServerLoginPacketListenerImpl state
diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java
index 157f055df00faf3a7870df8109e84fdb12f55964..7648b889bc488197f32545e8c3671a54102c01ec 100644 index 42c0723e2fe43e1f268119a16067e8bdfb971208..9885dec92cd26dec61c303dda687b0f910d49749 100644
--- a/src/main/java/net/minecraft/network/Connection.java --- a/src/main/java/net/minecraft/network/Connection.java
+++ b/src/main/java/net/minecraft/network/Connection.java +++ b/src/main/java/net/minecraft/network/Connection.java
@@ -644,6 +644,26 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> { @@ -680,6 +680,26 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
packetlistener1.onDisconnect(ichatbasecomponent); packetlistener1.onDisconnect(ichatbasecomponent);
} }
this.pendingActions.clear(); // Free up packet queue. this.pendingActions.clear(); // Free up packet queue.
@ -69,15 +69,15 @@ index 157f055df00faf3a7870df8109e84fdb12f55964..7648b889bc488197f32545e8c3671a54
} }
} }
diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
index e745061f3e6a4541f44ba119106915cdb7023fc6..f4ed58b03876c35f8964a8a1b8ce89961b9ee6d3 100644 index 96a7d52f982d2dcc5fa391007e5861ca62ec0841..88dfd9d66fbd1583407814978a1fd68edd386519 100644
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
@@ -60,7 +60,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener, @@ -79,7 +79,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
@Nullable @Nullable
String requestedUsername; String requestedUsername;
@Nullable @Nullable
- private GameProfile authenticatedProfile; - private GameProfile authenticatedProfile;
+ public GameProfile authenticatedProfile; // Paper - public + public GameProfile authenticatedProfile; // Paper - public
private final String serverId; private final String serverId;
private final boolean transferred;
private ServerPlayer player; // CraftBukkit private ServerPlayer player; // CraftBukkit

View File

@ -16,10 +16,10 @@ intent to remove) and replace it with two new methods, clearly named and
documented as to their purpose. documented as to their purpose.
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 08c936288b5ac8738d7cff9fe95b1256ae32cd28..a8de1f58fffe2541478083defc18be949d0c75f1 100644 index 3b71ea8263b2049c54432a64c7f01aed3848d1c7..05379ea4581db4277e6cc625ed0f3228bd0130fd 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -248,6 +248,7 @@ public class ServerPlayer extends Player { @@ -263,6 +263,7 @@ public class ServerPlayer extends Player {
private int containerCounter; private int containerCounter;
public boolean wonGame; public boolean wonGame;
private int containerUpdateDelay; // Paper - Configurable container update tick rate private int containerUpdateDelay; // Paper - Configurable container update tick rate
@ -28,19 +28,19 @@ index 08c936288b5ac8738d7cff9fe95b1256ae32cd28..a8de1f58fffe2541478083defc18be94
public boolean queueHealthUpdatePacket; public boolean queueHealthUpdatePacket;
public net.minecraft.network.protocol.game.ClientboundSetHealthPacket queuedHealthUpdatePacket; public net.minecraft.network.protocol.game.ClientboundSetHealthPacket queuedHealthUpdatePacket;
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 7d81334b8bbfc04f1188de777b0cacd6f80131d3..2a0d3319899f0b3f38135e25306b87b1974b3d83 100644 index 4dea09aa0f5f45d449ba12d8a9db3e0a3b708757..7112c6c77c5527f530223d5ffdf81c837a609b7c 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java --- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -180,6 +180,7 @@ public abstract class PlayerList { @@ -182,6 +182,7 @@ public abstract class PlayerList {
public void placeNewPlayer(Connection connection, ServerPlayer player, CommonListenerCookie clientData) { public void placeNewPlayer(Connection connection, ServerPlayer player, CommonListenerCookie clientData) {
player.isRealPlayer = true; // Paper player.isRealPlayer = true; // Paper
+ player.loginTime = System.currentTimeMillis(); // Paper - Replace OfflinePlayer#getLastPlayed + player.loginTime = System.currentTimeMillis(); // Paper - Replace OfflinePlayer#getLastPlayed
GameProfile gameprofile = player.getGameProfile(); GameProfile gameprofile = player.getGameProfile();
GameProfileCache usercache = this.server.getProfileCache(); GameProfileCache usercache = this.server.getProfileCache();
String s; // Optional optional; // CraftBukkit - decompile error
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java b/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java b/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java
index 34925d6448e0ef1d5bb4b24359f732b67aaa4230..0c1b5f625a351905e082b2c2a63bfd737101527e 100644 index 461656e1cb095243bfe7a9ee2906e5b00574ae78..411b280ac3e27e72091db813c0c9b69b62df6097 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java
@@ -262,6 +262,61 @@ public class CraftOfflinePlayer implements OfflinePlayer, ConfigurationSerializa @@ -262,6 +262,61 @@ public class CraftOfflinePlayer implements OfflinePlayer, ConfigurationSerializa
@ -106,10 +106,10 @@ index 34925d6448e0ef1d5bb4b24359f732b67aaa4230..0c1b5f625a351905e082b2c2a63bfd73
public Location getLastDeathLocation() { public Location getLastDeathLocation() {
if (this.getData().contains("LastDeathLocation", 10)) { if (this.getData().contains("LastDeathLocation", 10)) {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 29ede2405a645499e804a2f914a2563ef443f919..0e251c385db7969398eca95e3353de4a3de6d189 100644 index 32bd55d8853cd1be12e910fc6626b96a6f3ea558..3ef95c7fb6bac4d79ecefd1f8591824258f84342 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -197,6 +197,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -207,6 +207,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
private BorderChangeListener clientWorldBorderListener = this.createWorldBorderListener(); private BorderChangeListener clientWorldBorderListener = this.createWorldBorderListener();
public org.bukkit.event.player.PlayerResourcePackStatusEvent.Status resourcePackStatus; // Paper - more resource pack API public org.bukkit.event.player.PlayerResourcePackStatusEvent.Status resourcePackStatus; // Paper - more resource pack API
private static final boolean DISABLE_CHANNEL_LIMIT = System.getProperty("paper.disableChannelLimit") != null; // Paper - add a flag to disable the channel limit private static final boolean DISABLE_CHANNEL_LIMIT = System.getProperty("paper.disableChannelLimit") != null; // Paper - add a flag to disable the channel limit
@ -117,7 +117,7 @@ index 29ede2405a645499e804a2f914a2563ef443f919..0e251c385db7969398eca95e3353de4a
public CraftPlayer(CraftServer server, ServerPlayer entity) { public CraftPlayer(CraftServer server, ServerPlayer entity) {
super(server, entity); super(server, entity);
@@ -1958,6 +1959,18 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -2034,6 +2035,18 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
this.firstPlayed = firstPlayed; this.firstPlayed = firstPlayed;
} }
@ -136,7 +136,7 @@ index 29ede2405a645499e804a2f914a2563ef443f919..0e251c385db7969398eca95e3353de4a
public void readExtraData(CompoundTag nbttagcompound) { public void readExtraData(CompoundTag nbttagcompound) {
this.hasPlayedBefore = true; this.hasPlayedBefore = true;
if (nbttagcompound.contains("bukkit")) { if (nbttagcompound.contains("bukkit")) {
@@ -1980,6 +1993,8 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -2056,6 +2069,8 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
} }
public void setExtraData(CompoundTag nbttagcompound) { public void setExtraData(CompoundTag nbttagcompound) {
@ -145,7 +145,7 @@ index 29ede2405a645499e804a2f914a2563ef443f919..0e251c385db7969398eca95e3353de4a
if (!nbttagcompound.contains("bukkit")) { if (!nbttagcompound.contains("bukkit")) {
nbttagcompound.put("bukkit", new CompoundTag()); nbttagcompound.put("bukkit", new CompoundTag());
} }
@@ -1994,6 +2009,16 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -2070,6 +2085,16 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
data.putLong("firstPlayed", this.getFirstPlayed()); data.putLong("firstPlayed", this.getFirstPlayed());
data.putLong("lastPlayed", System.currentTimeMillis()); data.putLong("lastPlayed", System.currentTimeMillis());
data.putString("lastKnownName", handle.getScoreboardName()); data.putString("lastKnownName", handle.getScoreboardName());

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Workaround for vehicle tracking issue on disconnect
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index a8de1f58fffe2541478083defc18be949d0c75f1..7433116ee68b92c86d1588296d521e5df49e5ac2 100644 index 05379ea4581db4277e6cc625ed0f3228bd0130fd..e5d8384830c83694a3560fc743dc38e645cf9cfd 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -1705,6 +1705,13 @@ public class ServerPlayer extends Player { @@ -1789,6 +1789,13 @@ public class ServerPlayer extends Player {
public void disconnect() { public void disconnect() {
this.disconnected = true; this.disconnected = true;
this.ejectPassengers(); this.ejectPassengers();

View File

@ -8,10 +8,10 @@ We just add a check to ensure that the CraftPlayer's handle
is a ServerPlayer is a ServerPlayer
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 0e251c385db7969398eca95e3353de4a3de6d189..314e01920fe0302441d2cc08a0098ff8fee263e5 100644 index 3ef95c7fb6bac4d79ecefd1f8591824258f84342..356d814e09c4804dc32e320c01c26f4a059693da 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -211,8 +211,12 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -221,8 +221,12 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@Override @Override
public void remove() { public void remove() {

View File

@ -11,10 +11,10 @@ floating in the air.
This can replace many uses of BlockPhysicsEvent This can replace many uses of BlockPhysicsEvent
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 2eb80978ffc26c6250f3a96b73ee20bfea4ecd45..12809bc84aa07e724bebbc631199f352b7d7bbcb 100644 index d050d72eb87a2d1b4723ab831dfef5e25c6a65b2..65b556d6ecae489c1c40b60d0eb432f4e1542e04 100644
--- a/src/main/java/net/minecraft/world/level/Level.java --- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -26,6 +26,7 @@ import net.minecraft.nbt.CompoundTag; @@ -25,6 +25,7 @@ import net.minecraft.core.registries.Registries;
import net.minecraft.network.protocol.Packet; import net.minecraft.network.protocol.Packet;
import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
@ -22,7 +22,7 @@ index 2eb80978ffc26c6250f3a96b73ee20bfea4ecd45..12809bc84aa07e724bebbc631199f352
import net.minecraft.server.MinecraftServer; import net.minecraft.server.MinecraftServer;
import net.minecraft.server.level.FullChunkStatus; import net.minecraft.server.level.FullChunkStatus;
import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerLevel;
@@ -582,9 +583,26 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -576,9 +577,26 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
return false; return false;
} else { } else {
FluidState fluid = this.getFluidState(pos); FluidState fluid = this.getFluidState(pos);

View File

@ -9,10 +9,10 @@ commands if the server is restarting. Using the default async pool caused issues
due to the shutdown logic generally being much later. due to the shutdown logic generally being much later.
diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java
index 15a5059994371da4850adcf726034a715b80efba..af7cb518a32a4d550eae833fdd5bb17fd4058717 100644 index 03966f447354fb16a01442ff6c6257fa19461bcd..6383cdfe3e2b61314fee7f7236dc7df1c1e8bfb6 100644
--- a/src/main/java/net/minecraft/commands/Commands.java --- a/src/main/java/net/minecraft/commands/Commands.java
+++ b/src/main/java/net/minecraft/commands/Commands.java +++ b/src/main/java/net/minecraft/commands/Commands.java
@@ -457,6 +457,24 @@ public class Commands { @@ -460,6 +460,24 @@ public class Commands {
if ( org.spigotmc.SpigotConfig.tabComplete < 0 ) return; // Spigot if ( org.spigotmc.SpigotConfig.tabComplete < 0 ) return; // Spigot
// CraftBukkit start // CraftBukkit start
// Register Vanilla commands into builtRoot as before // Register Vanilla commands into builtRoot as before
@ -37,7 +37,7 @@ index 15a5059994371da4850adcf726034a715b80efba..af7cb518a32a4d550eae833fdd5bb17f
Map<CommandNode<CommandSourceStack>, CommandNode<SharedSuggestionProvider>> map = Maps.newIdentityHashMap(); // Use identity to prevent aliasing issues Map<CommandNode<CommandSourceStack>, CommandNode<SharedSuggestionProvider>> map = Maps.newIdentityHashMap(); // Use identity to prevent aliasing issues
RootCommandNode vanillaRoot = new RootCommandNode(); RootCommandNode vanillaRoot = new RootCommandNode();
@@ -474,7 +492,14 @@ public class Commands { @@ -477,7 +495,14 @@ public class Commands {
for (CommandNode node : rootcommandnode.getChildren()) { for (CommandNode node : rootcommandnode.getChildren()) {
bukkit.add(node.getName()); bukkit.add(node.getName());
} }
@ -53,10 +53,10 @@ index 15a5059994371da4850adcf726034a715b80efba..af7cb518a32a4d550eae833fdd5bb17f
event.getPlayer().getServer().getPluginManager().callEvent(event); event.getPlayer().getServer().getPluginManager().callEvent(event);
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 01acf93115db41212adf703d44481f50c746a8fa..3d59c9f256f00c213af33c35cd6471a78b97c290 100644 index 34e5adcbeb105e6da8ab660d7f322969305d44ec..270ec206c0dd3183db8f81241d7b87087681c80c 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -916,6 +916,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -927,6 +927,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
} }
MinecraftServer.LOGGER.info("Stopping server"); MinecraftServer.LOGGER.info("Stopping server");

View File

@ -10,10 +10,10 @@ Adds CommandRegisteredEvent
- Allows manipulating the CommandNode to add more children/metadata for the client - Allows manipulating the CommandNode to add more children/metadata for the client
diff --git a/build.gradle.kts b/build.gradle.kts diff --git a/build.gradle.kts b/build.gradle.kts
index 470c55412e7a4f09235947adc72944b903d6543d..9cd80bc7f2b47e1044eef2592274e38d1988ff5d 100644 index ad86fc6ed56bdf8227e92ffdce17e5cd2ef19cc0..a668438780c5b77d6b8bcbcc52d24bd92c59b85f 100644
--- a/build.gradle.kts --- a/build.gradle.kts
+++ b/build.gradle.kts +++ b/build.gradle.kts
@@ -14,6 +14,7 @@ val alsoShade: Configuration by configurations.creating @@ -15,6 +15,7 @@ val alsoShade: Configuration by configurations.creating
dependencies { dependencies {
implementation(project(":paper-api")) implementation(project(":paper-api"))
@ -59,7 +59,7 @@ index da6250df1c5f3385b683cffde47754bca4606f5e..d8142624f9f3a5909e7cc5665f1629a1
public void removeCommand(String name) { public void removeCommand(String name) {
this.children.remove(name); this.children.remove(name);
diff --git a/src/main/java/net/minecraft/commands/CommandSourceStack.java b/src/main/java/net/minecraft/commands/CommandSourceStack.java diff --git a/src/main/java/net/minecraft/commands/CommandSourceStack.java b/src/main/java/net/minecraft/commands/CommandSourceStack.java
index edf49f2d9921b4517fb98929d842f7a62c5549df..0f98345f8adc6e9bf7fb2dc9ce4eba59a33ded61 100644 index d9fc3c25bef251df6a53ee47ec224b07240a931c..2a22827f44dd0d524c22264447959a6979e9f0de 100644
--- a/src/main/java/net/minecraft/commands/CommandSourceStack.java --- a/src/main/java/net/minecraft/commands/CommandSourceStack.java
+++ b/src/main/java/net/minecraft/commands/CommandSourceStack.java +++ b/src/main/java/net/minecraft/commands/CommandSourceStack.java
@@ -45,7 +45,7 @@ import net.minecraft.world.phys.Vec2; @@ -45,7 +45,7 @@ import net.minecraft.world.phys.Vec2;
@ -99,10 +99,10 @@ index edf49f2d9921b4517fb98929d842f7a62c5549df..0f98345f8adc6e9bf7fb2dc9ce4eba59
public boolean hasPermission(int level) { public boolean hasPermission(int level) {
// CraftBukkit start // CraftBukkit start
diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java
index af7cb518a32a4d550eae833fdd5bb17fd4058717..40ff3090fb17fb0f01a9b52639fb783ea57ce6b6 100644 index 6383cdfe3e2b61314fee7f7236dc7df1c1e8bfb6..3b59f3d92d781c16825f6f67b725225256425d11 100644
--- a/src/main/java/net/minecraft/commands/Commands.java --- a/src/main/java/net/minecraft/commands/Commands.java
+++ b/src/main/java/net/minecraft/commands/Commands.java +++ b/src/main/java/net/minecraft/commands/Commands.java
@@ -493,6 +493,7 @@ public class Commands { @@ -496,6 +496,7 @@ public class Commands {
bukkit.add(node.getName()); bukkit.add(node.getName());
} }
// Paper start - Perf: Async command map building // Paper start - Perf: Async command map building
@ -110,7 +110,7 @@ index af7cb518a32a4d550eae833fdd5bb17fd4058717..40ff3090fb17fb0f01a9b52639fb783e
net.minecraft.server.MinecraftServer.getServer().execute(() -> { net.minecraft.server.MinecraftServer.getServer().execute(() -> {
runSync(player, bukkit, rootcommandnode); runSync(player, bukkit, rootcommandnode);
}); });
@@ -500,6 +501,7 @@ public class Commands { @@ -503,6 +504,7 @@ public class Commands {
private void runSync(ServerPlayer player, Collection<String> bukkit, RootCommandNode<SharedSuggestionProvider> rootcommandnode) { private void runSync(ServerPlayer player, Collection<String> bukkit, RootCommandNode<SharedSuggestionProvider> rootcommandnode) {
// Paper end - Perf: Async command map building // Paper end - Perf: Async command map building
@ -118,7 +118,7 @@ index af7cb518a32a4d550eae833fdd5bb17fd4058717..40ff3090fb17fb0f01a9b52639fb783e
PlayerCommandSendEvent event = new PlayerCommandSendEvent(player.getBukkitEntity(), new LinkedHashSet<>(bukkit)); PlayerCommandSendEvent event = new PlayerCommandSendEvent(player.getBukkitEntity(), new LinkedHashSet<>(bukkit));
event.getPlayer().getServer().getPluginManager().callEvent(event); event.getPlayer().getServer().getPluginManager().callEvent(event);
@@ -518,6 +520,11 @@ public class Commands { @@ -521,6 +523,11 @@ public class Commands {
while (iterator.hasNext()) { while (iterator.hasNext()) {
CommandNode<CommandSourceStack> commandnode2 = (CommandNode) iterator.next(); CommandNode<CommandSourceStack> commandnode2 = (CommandNode) iterator.next();
@ -131,10 +131,10 @@ index af7cb518a32a4d550eae833fdd5bb17fd4058717..40ff3090fb17fb0f01a9b52639fb783e
if (commandnode2.canUse(source)) { if (commandnode2.canUse(source)) {
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index b42b429e318b9ee784847a1824157573df99f683..9e7598a0cc3965e382ba13d7fd700585a4884a97 100644 index a82a6e0381da86e5173a815e1a0160beb8927a1c..ba6944eb4602549ef139a427788f8175ce912677 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -746,7 +746,14 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -772,19 +772,34 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
builder.suggest(completion.suggestion(), PaperAdventure.asVanilla(completion.tooltip())); builder.suggest(completion.suggestion(), PaperAdventure.asVanilla(completion.tooltip()));
} }
} }
@ -144,23 +144,31 @@ index b42b429e318b9ee784847a1824157573df99f683..9e7598a0cc3965e382ba13d7fd700585
+ com.destroystokyo.paper.event.brigadier.AsyncPlayerSendSuggestionsEvent suggestEvent = new com.destroystokyo.paper.event.brigadier.AsyncPlayerSendSuggestionsEvent(this.getCraftPlayer(), suggestions, packet.getCommand()); + com.destroystokyo.paper.event.brigadier.AsyncPlayerSendSuggestionsEvent suggestEvent = new com.destroystokyo.paper.event.brigadier.AsyncPlayerSendSuggestionsEvent(this.getCraftPlayer(), suggestions, packet.getCommand());
+ suggestEvent.setCancelled(suggestions.isEmpty()); + suggestEvent.setCancelled(suggestions.isEmpty());
+ if (suggestEvent.callEvent()) { + if (suggestEvent.callEvent()) {
+ this.connection.send(new ClientboundCommandSuggestionsPacket(packet.getId(), suggestEvent.getSuggestions())); + this.connection.send(new ClientboundCommandSuggestionsPacket(packet.getId(), limitTo(suggestEvent.getSuggestions(), ServerGamePacketListenerImpl.MAX_COMMAND_SUGGESTIONS)));
+ } + }
+ // Paper end - Brigadier API + // Paper end - Brigadier API
} }
} }
+ // Paper start - brig API
+ private static Suggestions limitTo(final Suggestions suggestions, final int size) {
+ return suggestions.getList().size() <= size ? suggestions : new Suggestions(suggestions.getRange(), suggestions.getList().subList(0, size));
+ }
+ // Paper end - brig API
@@ -755,8 +762,13 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl private void sendServerSuggestions(final ServerboundCommandSuggestionPacket packet, final StringReader stringreader) {
// Paper end - AsyncTabCompleteEvent
ParseResults<CommandSourceStack> parseresults = this.server.getCommands().getDispatcher().parse(stringreader, this.player.createCommandSourceStack()); ParseResults<CommandSourceStack> parseresults = this.server.getCommands().getDispatcher().parse(stringreader, this.player.createCommandSourceStack());
this.server.getCommands().getDispatcher().getCompletionSuggestions(parseresults).thenAccept((suggestions) -> { this.server.getCommands().getDispatcher().getCompletionSuggestions(parseresults).thenAccept((suggestions) -> {
- if (suggestions.isEmpty()) return; // CraftBukkit - don't send through empty suggestions - prevents [<args>] from showing for plugins with nothing more to offer - if (suggestions.isEmpty()) return; // CraftBukkit - don't send through empty suggestions - prevents [<args>] from showing for plugins with nothing more to offer
- this.send(new ClientboundCommandSuggestionsPacket(packet.getId(), suggestions)); - Suggestions suggestions1 = suggestions.getList().size() <= 1000 ? suggestions : new Suggestions(suggestions.getRange(), suggestions.getList().subList(0, 1000));
-
- this.send(new ClientboundCommandSuggestionsPacket(packet.getId(), suggestions1));
+ // Paper start - Brigadier API + // Paper start - Brigadier API
+ com.destroystokyo.paper.event.brigadier.AsyncPlayerSendSuggestionsEvent suggestEvent = new com.destroystokyo.paper.event.brigadier.AsyncPlayerSendSuggestionsEvent(this.getCraftPlayer(), suggestions, packet.getCommand()); + com.destroystokyo.paper.event.brigadier.AsyncPlayerSendSuggestionsEvent suggestEvent = new com.destroystokyo.paper.event.brigadier.AsyncPlayerSendSuggestionsEvent(this.getCraftPlayer(), suggestions, packet.getCommand());
+ suggestEvent.setCancelled(suggestions.isEmpty()); + suggestEvent.setCancelled(suggestions.isEmpty());
+ if (suggestEvent.callEvent()) { + if (suggestEvent.callEvent()) {
+ this.send(new ClientboundCommandSuggestionsPacket(packet.getId(), suggestEvent.getSuggestions())); + this.send(new ClientboundCommandSuggestionsPacket(packet.getId(), limitTo(suggestEvent.getSuggestions(), ServerGamePacketListenerImpl.MAX_COMMAND_SUGGESTIONS)));
+ } + }
+ // Paper end - Brigadier API + // Paper end - Brigadier API
}); });

View File

@ -48,7 +48,7 @@ index 0000000000000000000000000000000000000000..2a2f8327a5bd3983a3a13fd663beb989
+} +}
diff --git a/src/main/java/io/papermc/paper/inventory/recipe/StackedContentsExtraMap.java b/src/main/java/io/papermc/paper/inventory/recipe/StackedContentsExtraMap.java diff --git a/src/main/java/io/papermc/paper/inventory/recipe/StackedContentsExtraMap.java b/src/main/java/io/papermc/paper/inventory/recipe/StackedContentsExtraMap.java
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..63db0b843c5bd11f979e613ba6cfac9d9da956bb index 0000000000000000000000000000000000000000..2258d4556a1c608e2b0ece38471350646718eb19
--- /dev/null --- /dev/null
+++ b/src/main/java/io/papermc/paper/inventory/recipe/StackedContentsExtraMap.java +++ b/src/main/java/io/papermc/paper/inventory/recipe/StackedContentsExtraMap.java
@@ -0,0 +1,79 @@ @@ -0,0 +1,79 @@
@ -93,7 +93,7 @@ index 0000000000000000000000000000000000000000..63db0b843c5bd11f979e613ba6cfac9d
+ final IntList idList = new IntArrayList(items.length); + final IntList idList = new IntArrayList(items.length);
+ for (final ItemStack item : items) { + for (final ItemStack item : items) {
+ idList.add(this.registerExact(item)); // I think not copying the stack here is safe because cb copies the stack when creating the ingredient + idList.add(this.registerExact(item)); // I think not copying the stack here is safe because cb copies the stack when creating the ingredient
+ if (!item.hasTag()) { + if (item.getComponentsPatch().isEmpty()) {
+ // add regular index if it's a plain itemstack but still registered as exact + // add regular index if it's a plain itemstack but still registered as exact
+ idList.add(StackedContents.getStackingIndex(item)); + idList.add(StackedContents.getStackingIndex(item));
+ } + }
@ -143,7 +143,7 @@ index 0000000000000000000000000000000000000000..413dfa52760db393ad6a8b5341200ee7
+import org.checkerframework.checker.nullness.qual.NonNull; +import org.checkerframework.checker.nullness.qual.NonNull;
+import org.checkerframework.framework.qual.DefaultQualifier; +import org.checkerframework.framework.qual.DefaultQualifier;
diff --git a/src/main/java/net/minecraft/recipebook/ServerPlaceRecipe.java b/src/main/java/net/minecraft/recipebook/ServerPlaceRecipe.java diff --git a/src/main/java/net/minecraft/recipebook/ServerPlaceRecipe.java b/src/main/java/net/minecraft/recipebook/ServerPlaceRecipe.java
index f7328e583c63b4b74664ea78110f8b71c635ce60..80f032cca3309b709a11898cbc08bce27cbd624d 100644 index fc97748870f2cddea5d5b3afed756d6383fecfa8..5c5a4b4450301cd3bc7c895f976b991467234a42 100644
--- a/src/main/java/net/minecraft/recipebook/ServerPlaceRecipe.java --- a/src/main/java/net/minecraft/recipebook/ServerPlaceRecipe.java
+++ b/src/main/java/net/minecraft/recipebook/ServerPlaceRecipe.java +++ b/src/main/java/net/minecraft/recipebook/ServerPlaceRecipe.java
@@ -34,6 +34,7 @@ public class ServerPlaceRecipe<C extends Container> implements PlaceRecipe<Integ @@ -34,6 +34,7 @@ public class ServerPlaceRecipe<C extends Container> implements PlaceRecipe<Integ
@ -158,12 +158,12 @@ index f7328e583c63b4b74664ea78110f8b71c635ce60..80f032cca3309b709a11898cbc08bce2
int l = k; int l = k;
for (int m : intList) { for (int m : intList) {
- int n = StackedContents.fromStackingIndex(m).getMaxStackSize(); - ItemStack itemStack2 = StackedContents.fromStackingIndex(m);
+ int n = StackedContents.maxStackSizeFromStackingIndex(m, this.stackedContents); // Paper - Improve exact choice recipe ingredients + ItemStack itemStack2 = StackedContents.fromStackingIndexWithExtras(m, this.stackedContents); // Paper - Improve exact choice recipe ingredients
if (n < l) { if (!itemStack2.isEmpty()) {
l = n; int n = itemStack2.getMaxStackSize();
} if (n < l) {
@@ -96,10 +97,21 @@ public class ServerPlaceRecipe<C extends Container> implements PlaceRecipe<Integ @@ -99,10 +100,21 @@ public class ServerPlaceRecipe<C extends Container> implements PlaceRecipe<Integ
@Override @Override
public void addItemToSlot(Iterator<Integer> inputs, int slot, int amount, int gridX, int gridY) { public void addItemToSlot(Iterator<Integer> inputs, int slot, int amount, int gridX, int gridY) {
Slot slot2 = this.menu.getSlot(slot); Slot slot2 = this.menu.getSlot(slot);
@ -187,7 +187,7 @@ index f7328e583c63b4b74664ea78110f8b71c635ce60..80f032cca3309b709a11898cbc08bce2
} }
} }
} }
@@ -128,8 +140,14 @@ public class ServerPlaceRecipe<C extends Container> implements PlaceRecipe<Integ @@ -131,8 +143,14 @@ public class ServerPlaceRecipe<C extends Container> implements PlaceRecipe<Integ
return i; return i;
} }
@ -204,29 +204,29 @@ index f7328e583c63b4b74664ea78110f8b71c635ce60..80f032cca3309b709a11898cbc08bce2
ItemStack itemStack = this.inventory.getItem(i); ItemStack itemStack = this.inventory.getItem(i);
if (!itemStack.isEmpty()) { if (!itemStack.isEmpty()) {
diff --git a/src/main/java/net/minecraft/world/entity/player/StackedContents.java b/src/main/java/net/minecraft/world/entity/player/StackedContents.java diff --git a/src/main/java/net/minecraft/world/entity/player/StackedContents.java b/src/main/java/net/minecraft/world/entity/player/StackedContents.java
index a3a7bfaf5d21a50410017c8d17484ef5a409d68a..33e493874cb8cecd820e80f2c15e6f654bc64b02 100644 index b11121e0846183ceeb7f4ad536aab2ee89ea9d26..0a58698dcd62adf3dc06a8c7dc782aada50409f5 100644
--- a/src/main/java/net/minecraft/world/entity/player/StackedContents.java --- a/src/main/java/net/minecraft/world/entity/player/StackedContents.java
+++ b/src/main/java/net/minecraft/world/entity/player/StackedContents.java +++ b/src/main/java/net/minecraft/world/entity/player/StackedContents.java
@@ -21,8 +21,10 @@ import net.minecraft.world.item.crafting.RecipeHolder; @@ -22,8 +22,10 @@ import net.minecraft.world.item.crafting.RecipeHolder;
public class StackedContents { public class StackedContents {
private static final int EMPTY = 0; private static final int EMPTY = 0;
public final Int2IntMap contents = new Int2IntOpenHashMap(); public final Int2IntMap contents = new Int2IntOpenHashMap();
+ @Nullable public io.papermc.paper.inventory.recipe.StackedContentsExtraMap extrasMap = null; // Paper - Improve exact choice recipe ingredients + @Nullable public io.papermc.paper.inventory.recipe.StackedContentsExtraMap extrasMap = null; // Paper - Improve exact choice recipe ingredients
public void accountSimpleStack(ItemStack stack) { public void accountSimpleStack(ItemStack stack) {
+ if (this.extrasMap != null && stack.hasTag() && this.extrasMap.accountStack(stack, Math.min(64, stack.getCount()))) return; // Paper - Improve exact choice recipe ingredients; max of 64 due to accountStack method below + if (this.extrasMap != null && !stack.getComponentsPatch().isEmpty() && this.extrasMap.accountStack(stack, Math.min(64, stack.getCount()))) return; // Paper - Improve exact choice recipe ingredients; max of 64 due to accountStack method below
if (!stack.isDamaged() && !stack.isEnchanted() && !stack.hasCustomHoverName()) { if (!stack.isDamaged() && !stack.isEnchanted() && !stack.has(DataComponents.CUSTOM_NAME)) {
this.accountStack(stack); this.accountStack(stack);
} }
@@ -36,6 +38,7 @@ public class StackedContents { @@ -37,6 +39,7 @@ public class StackedContents {
if (!stack.isEmpty()) { if (!stack.isEmpty()) {
int i = getStackingIndex(stack); int i = getStackingIndex(stack);
int j = Math.min(maxCount, stack.getCount()); int j = Math.min(maxCount, stack.getCount());
+ if (this.extrasMap != null && stack.hasTag() && this.extrasMap.accountStack(stack, j)) return; // Paper - Improve exact choice recipe ingredients; if an exact ingredient, don't include it + if (this.extrasMap != null && !stack.getComponentsPatch().isEmpty() && this.extrasMap.accountStack(stack, j)) return; // Paper - Improve exact choice recipe ingredients; if an exact ingredient, don't include it
this.put(i, j); this.put(i, j);
} }
} }
@@ -82,6 +85,23 @@ public class StackedContents { @@ -83,6 +86,23 @@ public class StackedContents {
return itemId == 0 ? ItemStack.EMPTY : new ItemStack(Item.byId(itemId)); return itemId == 0 ? ItemStack.EMPTY : new ItemStack(Item.byId(itemId));
} }
@ -235,11 +235,11 @@ index a3a7bfaf5d21a50410017c8d17484ef5a409d68a..33e493874cb8cecd820e80f2c15e6f65
+ this.extrasMap = new io.papermc.paper.inventory.recipe.StackedContentsExtraMap(this, recipe); + this.extrasMap = new io.papermc.paper.inventory.recipe.StackedContentsExtraMap(this, recipe);
+ } + }
+ +
+ public static int maxStackSizeFromStackingIndex(final int itemId, @Nullable final StackedContents contents) { + public static ItemStack fromStackingIndexWithExtras(final int itemId, @Nullable final StackedContents contents) {
+ if (contents != null && contents.extrasMap != null && itemId >= BuiltInRegistries.ITEM.size()) { + if (contents != null && contents.extrasMap != null && itemId >= BuiltInRegistries.ITEM.size()) {
+ return fromStackingIndexExtras(itemId, contents.extrasMap).getMaxStackSize(); + return fromStackingIndexExtras(itemId, contents.extrasMap);
+ } + }
+ return fromStackingIndex(itemId).getMaxStackSize(); + return fromStackingIndex(itemId);
+ } + }
+ +
+ public static ItemStack fromStackingIndexExtras(final int itemId, final io.papermc.paper.inventory.recipe.StackedContentsExtraMap extrasMap) { + public static ItemStack fromStackingIndexExtras(final int itemId, final io.papermc.paper.inventory.recipe.StackedContentsExtraMap extrasMap) {
@ -250,7 +250,7 @@ index a3a7bfaf5d21a50410017c8d17484ef5a409d68a..33e493874cb8cecd820e80f2c15e6f65
public void clear() { public void clear() {
this.contents.clear(); this.contents.clear();
} }
@@ -105,7 +125,7 @@ public class StackedContents { @@ -106,7 +126,7 @@ public class StackedContents {
this.data = new BitSet(this.ingredientCount + this.itemCount + this.ingredientCount + this.ingredientCount * this.itemCount); this.data = new BitSet(this.ingredientCount + this.itemCount + this.ingredientCount + this.ingredientCount * this.itemCount);
for (int i = 0; i < this.ingredients.size(); i++) { for (int i = 0; i < this.ingredients.size(); i++) {
@ -259,7 +259,7 @@ index a3a7bfaf5d21a50410017c8d17484ef5a409d68a..33e493874cb8cecd820e80f2c15e6f65
for (int j = 0; j < this.itemCount; j++) { for (int j = 0; j < this.itemCount; j++) {
if (intList.contains(this.items[j])) { if (intList.contains(this.items[j])) {
@@ -168,7 +188,7 @@ public class StackedContents { @@ -169,7 +189,7 @@ public class StackedContents {
IntCollection intCollection = new IntAVLTreeSet(); IntCollection intCollection = new IntAVLTreeSet();
for (Ingredient ingredient : this.ingredients) { for (Ingredient ingredient : this.ingredients) {
@ -268,7 +268,7 @@ index a3a7bfaf5d21a50410017c8d17484ef5a409d68a..33e493874cb8cecd820e80f2c15e6f65
} }
IntIterator intIterator = intCollection.iterator(); IntIterator intIterator = intCollection.iterator();
@@ -297,7 +317,7 @@ public class StackedContents { @@ -298,7 +318,7 @@ public class StackedContents {
for (Ingredient ingredient : this.ingredients) { for (Ingredient ingredient : this.ingredients) {
int j = 0; int j = 0;
@ -277,7 +277,7 @@ index a3a7bfaf5d21a50410017c8d17484ef5a409d68a..33e493874cb8cecd820e80f2c15e6f65
j = Math.max(j, StackedContents.this.contents.get(k)); j = Math.max(j, StackedContents.this.contents.get(k));
} }
@@ -308,5 +328,17 @@ public class StackedContents { @@ -309,5 +329,17 @@ public class StackedContents {
return i; return i;
} }
@ -296,7 +296,7 @@ index a3a7bfaf5d21a50410017c8d17484ef5a409d68a..33e493874cb8cecd820e80f2c15e6f65
} }
} }
diff --git a/src/main/java/net/minecraft/world/item/crafting/AbstractCookingRecipe.java b/src/main/java/net/minecraft/world/item/crafting/AbstractCookingRecipe.java diff --git a/src/main/java/net/minecraft/world/item/crafting/AbstractCookingRecipe.java b/src/main/java/net/minecraft/world/item/crafting/AbstractCookingRecipe.java
index 7fe2389df3f033da60ec246937f67662355d3715..2a99d6b9c5c0bed7c971303cff82f84303184bca 100644 index 3b55a36192f75fafcf2f37727d891b461ca494a1..e037647ea39c5ecc566a9198bb77fecc0ed3f997 100644
--- a/src/main/java/net/minecraft/world/item/crafting/AbstractCookingRecipe.java --- a/src/main/java/net/minecraft/world/item/crafting/AbstractCookingRecipe.java
+++ b/src/main/java/net/minecraft/world/item/crafting/AbstractCookingRecipe.java +++ b/src/main/java/net/minecraft/world/item/crafting/AbstractCookingRecipe.java
@@ -6,7 +6,7 @@ import net.minecraft.world.Container; @@ -6,7 +6,7 @@ import net.minecraft.world.Container;
@ -317,10 +317,10 @@ index 7fe2389df3f033da60ec246937f67662355d3715..2a99d6b9c5c0bed7c971303cff82f843
@Override @Override
diff --git a/src/main/java/net/minecraft/world/item/crafting/Recipe.java b/src/main/java/net/minecraft/world/item/crafting/Recipe.java diff --git a/src/main/java/net/minecraft/world/item/crafting/Recipe.java b/src/main/java/net/minecraft/world/item/crafting/Recipe.java
index 8b631e457f783e55b7c37dd915b699912a9c5b49..e2d6c8ed586ef429cc712139e501df696ed10f6e 100644 index 5ccc99f8a64503db4478662f31a035b1ca7daade..b975bd02087ee40fc9d35ebd99b7730bb26ef6b2 100644
--- a/src/main/java/net/minecraft/world/item/crafting/Recipe.java --- a/src/main/java/net/minecraft/world/item/crafting/Recipe.java
+++ b/src/main/java/net/minecraft/world/item/crafting/Recipe.java +++ b/src/main/java/net/minecraft/world/item/crafting/Recipe.java
@@ -69,4 +69,10 @@ public interface Recipe<C extends Container> { @@ -74,4 +74,10 @@ public interface Recipe<C extends Container> {
} }
org.bukkit.inventory.Recipe toBukkitRecipe(org.bukkit.NamespacedKey id); // CraftBukkit org.bukkit.inventory.Recipe toBukkitRecipe(org.bukkit.NamespacedKey id); // CraftBukkit
@ -332,10 +332,10 @@ index 8b631e457f783e55b7c37dd915b699912a9c5b49..e2d6c8ed586ef429cc712139e501df69
+ // Paper end + // Paper end
} }
diff --git a/src/main/java/net/minecraft/world/item/crafting/ShapedRecipe.java b/src/main/java/net/minecraft/world/item/crafting/ShapedRecipe.java diff --git a/src/main/java/net/minecraft/world/item/crafting/ShapedRecipe.java b/src/main/java/net/minecraft/world/item/crafting/ShapedRecipe.java
index 201897bbde809699b53617e09703f5b22bbbe938..d772cf80fa3831e1c79d601ea09a073da089e2c5 100644 index 22f8396b438a0ca4532190e1a27f0f5ad77832c5..482d7b12b80328fba97a01bcfeb974b7ac4bcdb7 100644
--- a/src/main/java/net/minecraft/world/item/crafting/ShapedRecipe.java --- a/src/main/java/net/minecraft/world/item/crafting/ShapedRecipe.java
+++ b/src/main/java/net/minecraft/world/item/crafting/ShapedRecipe.java +++ b/src/main/java/net/minecraft/world/item/crafting/ShapedRecipe.java
@@ -17,7 +17,7 @@ import org.bukkit.craftbukkit.inventory.CraftShapedRecipe; @@ -18,7 +18,7 @@ import org.bukkit.craftbukkit.inventory.CraftShapedRecipe;
import org.bukkit.inventory.RecipeChoice; import org.bukkit.inventory.RecipeChoice;
// CraftBukkit end // CraftBukkit end
@ -344,7 +344,7 @@ index 201897bbde809699b53617e09703f5b22bbbe938..d772cf80fa3831e1c79d601ea09a073d
final ShapedRecipePattern pattern; final ShapedRecipePattern pattern;
final ItemStack result; final ItemStack result;
@@ -31,6 +31,7 @@ public class ShapedRecipe implements CraftingRecipe { @@ -32,6 +32,7 @@ public class ShapedRecipe implements CraftingRecipe {
this.pattern = raw; this.pattern = raw;
this.result = result; this.result = result;
this.showNotification = showNotification; this.showNotification = showNotification;
@ -353,10 +353,10 @@ index 201897bbde809699b53617e09703f5b22bbbe938..d772cf80fa3831e1c79d601ea09a073d
public ShapedRecipe(String group, CraftingBookCategory category, ShapedRecipePattern raw, ItemStack result) { public ShapedRecipe(String group, CraftingBookCategory category, ShapedRecipePattern raw, ItemStack result) {
diff --git a/src/main/java/net/minecraft/world/item/crafting/ShapelessRecipe.java b/src/main/java/net/minecraft/world/item/crafting/ShapelessRecipe.java diff --git a/src/main/java/net/minecraft/world/item/crafting/ShapelessRecipe.java b/src/main/java/net/minecraft/world/item/crafting/ShapelessRecipe.java
index 870e07140d835feaa55808101722d4547d5021d0..27b0a79f7a7c47047216aae42944bac2a2151181 100644 index 5d58922c0953b997ad7f2a174e2ca60f81789305..3554109bcc4651ca93b6275c914e57e007e2204e 100644
--- a/src/main/java/net/minecraft/world/item/crafting/ShapelessRecipe.java --- a/src/main/java/net/minecraft/world/item/crafting/ShapelessRecipe.java
+++ b/src/main/java/net/minecraft/world/item/crafting/ShapelessRecipe.java +++ b/src/main/java/net/minecraft/world/item/crafting/ShapelessRecipe.java
@@ -20,7 +20,7 @@ import org.bukkit.craftbukkit.inventory.CraftRecipe; @@ -21,7 +21,7 @@ import org.bukkit.craftbukkit.inventory.CraftRecipe;
import org.bukkit.craftbukkit.inventory.CraftShapelessRecipe; import org.bukkit.craftbukkit.inventory.CraftShapelessRecipe;
// CraftBukkit end // CraftBukkit end
@ -365,7 +365,7 @@ index 870e07140d835feaa55808101722d4547d5021d0..27b0a79f7a7c47047216aae42944bac2
final String group; final String group;
final CraftingBookCategory category; final CraftingBookCategory category;
@@ -32,6 +32,7 @@ public class ShapelessRecipe implements CraftingRecipe { @@ -33,6 +33,7 @@ public class ShapelessRecipe implements CraftingRecipe {
this.category = category; this.category = category;
this.result = result; this.result = result;
this.ingredients = ingredients; this.ingredients = ingredients;
@ -373,7 +373,7 @@ index 870e07140d835feaa55808101722d4547d5021d0..27b0a79f7a7c47047216aae42944bac2
} }
// CraftBukkit start // CraftBukkit start
@@ -77,6 +78,7 @@ public class ShapelessRecipe implements CraftingRecipe { @@ -78,6 +79,7 @@ public class ShapelessRecipe implements CraftingRecipe {
public boolean matches(CraftingContainer inventory, Level world) { public boolean matches(CraftingContainer inventory, Level world) {
StackedContents autorecipestackmanager = new StackedContents(); StackedContents autorecipestackmanager = new StackedContents();

View File

@ -22,10 +22,10 @@ it only impacts data sent from the client.
Set -DPaper.maxSignLength=XX to change limit or -1 to disable Set -DPaper.maxSignLength=XX to change limit or -1 to disable
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 9e7598a0cc3965e382ba13d7fd700585a4884a97..6d540917d0d4f4787e9abc8c80fd797b2ec1656f 100644 index ba6944eb4602549ef139a427788f8175ce912677..eae6e3aeaca1b567698eaa05ed02c6c45717d7f6 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -290,6 +290,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -300,6 +300,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
private final MessageSignatureCache messageSignatureCache = MessageSignatureCache.createDefault(); private final MessageSignatureCache messageSignatureCache = MessageSignatureCache.createDefault();
private final FutureChain chatMessageChain; private final FutureChain chatMessageChain;
private boolean waitingForSwitchToConfig; private boolean waitingForSwitchToConfig;
@ -33,7 +33,7 @@ index 9e7598a0cc3965e382ba13d7fd700585a4884a97..6d540917d0d4f4787e9abc8c80fd797b
public ServerGamePacketListenerImpl(MinecraftServer server, Connection connection, ServerPlayer player, CommonListenerCookie clientData) { public ServerGamePacketListenerImpl(MinecraftServer server, Connection connection, ServerPlayer player, CommonListenerCookie clientData) {
super(server, connection, clientData, player); // CraftBukkit super(server, connection, clientData, player); // CraftBukkit
@@ -3059,7 +3060,19 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -3144,7 +3145,19 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@Override @Override
public void handleSignUpdate(ServerboundSignUpdatePacket packet) { public void handleSignUpdate(ServerboundSignUpdatePacket packet) {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Call WhitelistToggleEvent when whitelist is toggled
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 2a0d3319899f0b3f38135e25306b87b1974b3d83..28b81e29be07902ad4d04aeb18bffd49757c3029 100644 index 7112c6c77c5527f530223d5ffdf81c837a609b7c..f29cd4d7c528404ea8e77e82a5ae17a9d9d19ed5 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java --- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -1158,6 +1158,7 @@ public abstract class PlayerList { @@ -1157,6 +1157,7 @@ public abstract class PlayerList {
} }
public void setUsingWhiteList(boolean whitelistEnabled) { public void setUsingWhiteList(boolean whitelistEnabled) {

View File

@ -10,7 +10,7 @@ persistenting Living Entity, SPAWNER for spawners,
or DEFAULT since data was not stored. or DEFAULT since data was not stored.
diff --git a/src/main/java/net/minecraft/server/commands/SummonCommand.java b/src/main/java/net/minecraft/server/commands/SummonCommand.java diff --git a/src/main/java/net/minecraft/server/commands/SummonCommand.java b/src/main/java/net/minecraft/server/commands/SummonCommand.java
index 2eddeb8d5239bbfeefbf4d3bd363f1ad083299b6..e2b44b8ddb8afc6e1f7dddadb434c2268f284809 100644 index bf72cf288ade52ee8cc41ca978f368b3ad575951..798999be50d26be357ef3c6d5b9383ce4d1048c1 100644
--- a/src/main/java/net/minecraft/server/commands/SummonCommand.java --- a/src/main/java/net/minecraft/server/commands/SummonCommand.java
+++ b/src/main/java/net/minecraft/server/commands/SummonCommand.java +++ b/src/main/java/net/minecraft/server/commands/SummonCommand.java
@@ -57,6 +57,7 @@ public class SummonCommand { @@ -57,6 +57,7 @@ public class SummonCommand {
@ -22,10 +22,10 @@ index 2eddeb8d5239bbfeefbf4d3bd363f1ad083299b6..e2b44b8ddb8afc6e1f7dddadb434c226
}); });
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 0811a2e87192b46c39f54c26ce0e56fc6e9d87e5..57f129651778d6c20c695bf7b3a8b4d40c402a20 100644 index ce89f04b74e579dedae05cfdf681827a92626f9a..e008b0b1b04dd8da118be6ee0bdd05c146a97532 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1203,6 +1203,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -1209,6 +1209,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
return true; return true;
} }
// Paper end - extra debug info // Paper end - extra debug info
@ -34,10 +34,10 @@ index 0811a2e87192b46c39f54c26ce0e56fc6e9d87e5..57f129651778d6c20c695bf7b3a8b4d4
// WorldServer.LOGGER.warn("Tried to add entity {} but it was marked as removed already", EntityTypes.getKey(entity.getType())); // CraftBukkit // WorldServer.LOGGER.warn("Tried to add entity {} but it was marked as removed already", EntityTypes.getKey(entity.getType())); // CraftBukkit
return false; return false;
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 28b81e29be07902ad4d04aeb18bffd49757c3029..bc440f9a239d3935bf6837edf815d4fdc6093655 100644 index f29cd4d7c528404ea8e77e82a5ae17a9d9d19ed5..7d4b2c499dfe449e6f7116ae140535450b95e6d1 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java --- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -224,6 +224,11 @@ public abstract class PlayerList { @@ -223,6 +223,11 @@ public abstract class PlayerList {
worldserver1 = worldserver; worldserver1 = worldserver;
} }
@ -50,19 +50,19 @@ index 28b81e29be07902ad4d04aeb18bffd49757c3029..bc440f9a239d3935bf6837edf815d4fd
String s1 = connection.getLoggableAddress(this.server.logIPs()); String s1 = connection.getLoggableAddress(this.server.logIPs());
@@ -355,7 +360,7 @@ public abstract class PlayerList { @@ -355,7 +360,7 @@ public abstract class PlayerList {
// CraftBukkit start CompoundTag nbttagcompound = ((CompoundTag) optional.get()).getCompound("RootVehicle");
ServerLevel finalWorldServer = worldserver1; ServerLevel finalWorldServer = worldserver1; // CraftBukkit - decompile error
Entity entity = EntityType.loadEntityRecursive(nbttagcompound1.getCompound("Entity"), finalWorldServer, (entity1) -> { Entity entity = EntityType.loadEntityRecursive(nbttagcompound.getCompound("Entity"), worldserver1, (entity1) -> {
- return !finalWorldServer.addWithUUID(entity1) ? null : entity1; - return !finalWorldServer.addWithUUID(entity1) ? null : entity1; // CraftBukkit - decompile error
+ return !finalWorldServer.addWithUUID(entity1, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.MOUNT) ? null : entity1; // Paper - Entity#getEntitySpawnReason + return !finalWorldServer.addWithUUID(entity1, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.MOUNT) ? null : entity1; // CraftBukkit - decompile error // Paper - Entity#getEntitySpawnReason
// CraftBukkit end
}); });
if (entity != null) {
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index f746829f1e94ee58821e56ec4192269add00395b..257be4dd3f38c089dd970b9ac6f292b4f010a01c 100644 index 28708e1e8ade8fbfec24120478d250ddf1351bf4..ce2594baa8eb5cfff75a2fb9f3277676a7b08e18 100644
--- 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
@@ -238,6 +238,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -241,6 +241,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
} }
} }
// Paper end - Share random for entities to make them more random // Paper end - Share random for entities to make them more random
@ -70,7 +70,7 @@ index f746829f1e94ee58821e56ec4192269add00395b..257be4dd3f38c089dd970b9ac6f292b4
public com.destroystokyo.paper.loottable.PaperLootableInventoryData lootableData; // Paper public com.destroystokyo.paper.loottable.PaperLootableInventoryData lootableData; // Paper
private CraftEntity bukkitEntity; private CraftEntity bukkitEntity;
@@ -2178,6 +2179,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -2206,6 +2207,9 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
} }
nbttagcompound.put("Paper.Origin", this.newDoubleList(origin.getX(), origin.getY(), origin.getZ())); nbttagcompound.put("Paper.Origin", this.newDoubleList(origin.getX(), origin.getY(), origin.getZ()));
} }
@ -80,7 +80,7 @@ index f746829f1e94ee58821e56ec4192269add00395b..257be4dd3f38c089dd970b9ac6f292b4
// Save entity's from mob spawner status // Save entity's from mob spawner status
if (spawnedViaMobSpawner) { if (spawnedViaMobSpawner) {
nbttagcompound.putBoolean("Paper.FromMobSpawner", true); nbttagcompound.putBoolean("Paper.FromMobSpawner", true);
@@ -2324,6 +2328,26 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -2352,6 +2356,26 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
} }
spawnedViaMobSpawner = nbt.getBoolean("Paper.FromMobSpawner"); // Restore entity's from mob spawner status spawnedViaMobSpawner = nbt.getBoolean("Paper.FromMobSpawner"); // Restore entity's from mob spawner status
@ -108,10 +108,10 @@ index f746829f1e94ee58821e56ec4192269add00395b..257be4dd3f38c089dd970b9ac6f292b4
} catch (Throwable throwable) { } catch (Throwable throwable) {
diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java
index cae8c508972d771ad96228ace8a7e6cbc34d5489..3184f73ce799cc5202d2129be736e2fed9a3b8e3 100644 index ee897b8c9462dbb3d7be9a2994753155065ce205..1d0964a7f544735a0213d5c7832c71f53db139a9 100644
--- a/src/main/java/net/minecraft/world/level/BaseSpawner.java --- a/src/main/java/net/minecraft/world/level/BaseSpawner.java
+++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java +++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java
@@ -182,6 +182,7 @@ public abstract class BaseSpawner { @@ -191,6 +191,7 @@ public abstract class BaseSpawner {
} }
entity.spawnedViaMobSpawner = true; // Paper entity.spawnedViaMobSpawner = true; // Paper
@ -120,10 +120,10 @@ index cae8c508972d771ad96228ace8a7e6cbc34d5489..3184f73ce799cc5202d2129be736e2fe
// CraftBukkit start // CraftBukkit start
if (org.bukkit.craftbukkit.event.CraftEventFactory.callSpawnerSpawnEvent(entity, pos).isCancelled()) { if (org.bukkit.craftbukkit.event.CraftEventFactory.callSpawnerSpawnEvent(entity, pos).isCancelled()) {
diff --git a/src/main/java/net/minecraft/world/level/block/entity/SculkShriekerBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SculkShriekerBlockEntity.java diff --git a/src/main/java/net/minecraft/world/level/block/entity/SculkShriekerBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SculkShriekerBlockEntity.java
index 41fa4258fbdd2f887383b9d3def10466557c406c..d71a9fb54269f7c7e251e0e3bdd8b5a072af5201 100644 index 570957f00ad4817d5631c72060e85f85af634619..baa876db3a58a3c756a72ef1ad081964b358f58e 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/SculkShriekerBlockEntity.java --- a/src/main/java/net/minecraft/world/level/block/entity/SculkShriekerBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/SculkShriekerBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/SculkShriekerBlockEntity.java
@@ -181,7 +181,7 @@ public class SculkShriekerBlockEntity extends BlockEntity implements GameEventLi @@ -183,7 +183,7 @@ public class SculkShriekerBlockEntity extends BlockEntity implements GameEventLi
private boolean trySummonWarden(ServerLevel world) { private boolean trySummonWarden(ServerLevel world) {
return this.warningLevel >= 4 return this.warningLevel >= 4
@ -133,10 +133,10 @@ index 41fa4258fbdd2f887383b9d3def10466557c406c..d71a9fb54269f7c7e251e0e3bdd8b5a0
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index 6fddbcec673564ac531a852f631f6acc460accbd..9ed122efb2b380bb2c1b50fdfe75bf3e679c9c6e 100644 index 621970006f21d219784dc58d7aa8d6062c4620f1..571b8352de4070622cdc47a50643beada0b16c36 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -991,4 +991,11 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { @@ -1001,4 +1001,11 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
return this.getHandle().spawnedViaMobSpawner; return this.getHandle().spawnedViaMobSpawner;
} }
// Paper end - Entity#fromMobSpawner // Paper end - Entity#fromMobSpawner

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Add PlayerPostRespawnEvent
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index bc440f9a239d3935bf6837edf815d4fdc6093655..6bd83549e2ff84b1bc993ef2be79a336ced28f67 100644 index 7d4b2c499dfe449e6f7116ae140535450b95e6d1..03051e2252d7b871adc06dbbe48d2a90854c7adf 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java --- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -752,9 +752,14 @@ public abstract class PlayerList { @@ -751,9 +751,14 @@ public abstract class PlayerList {
boolean flag2 = false; boolean flag2 = false;
@ -24,7 +24,7 @@ index bc440f9a239d3935bf6837edf815d4fdc6093655..6bd83549e2ff84b1bc993ef2be79a336
ServerLevel worldserver1 = this.server.getLevel(entityplayer.getRespawnDimension()); ServerLevel worldserver1 = this.server.getLevel(entityplayer.getRespawnDimension());
if (worldserver1 != null) { if (worldserver1 != null) {
Optional optional; Optional optional;
@@ -806,6 +811,7 @@ public abstract class PlayerList { @@ -805,6 +810,7 @@ public abstract class PlayerList {
location = respawnEvent.getRespawnLocation(); location = respawnEvent.getRespawnLocation();
if (!flag) entityplayer.reset(); // SPIGOT-4785 if (!flag) entityplayer.reset(); // SPIGOT-4785
@ -32,7 +32,7 @@ index bc440f9a239d3935bf6837edf815d4fdc6093655..6bd83549e2ff84b1bc993ef2be79a336
} else { } else {
location.setWorld(worldserver.getWorld()); location.setWorld(worldserver.getWorld());
} }
@@ -864,6 +870,13 @@ public abstract class PlayerList { @@ -863,6 +869,13 @@ public abstract class PlayerList {
if (entityplayer.connection.isDisconnected()) { if (entityplayer.connection.isDisconnected()) {
this.save(entityplayer); this.save(entityplayer);
} }

View File

@ -6,10 +6,10 @@ Subject: [PATCH] don't go below 0 for pickupDelay, breaks picking up items
vanilla checks for == 0 vanilla checks for == 0
diff --git a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java 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 d568726f80308e29bcfa3714728096d7d0aa822c..bfbbb9382cf483a23acf35c17250f6f9223f7507 100644 index d97e12a2dca072ae102b029fb67472dacc2c5b40..f0e6375236d61f32235ed23c3bae49db1545d1a2 100644
--- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java --- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
+++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java +++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
@@ -141,6 +141,7 @@ public class ItemEntity extends Entity implements TraceableEntity { @@ -148,6 +148,7 @@ public class ItemEntity extends Entity implements TraceableEntity {
// CraftBukkit start - Use wall time for pickup and despawn timers // CraftBukkit start - Use wall time for pickup and despawn timers
int elapsedTicks = MinecraftServer.currentTick - this.lastTick; int elapsedTicks = MinecraftServer.currentTick - this.lastTick;
if (this.pickupDelay != 32767) this.pickupDelay -= elapsedTicks; if (this.pickupDelay != 32767) this.pickupDelay -= elapsedTicks;
@ -17,7 +17,7 @@ index d568726f80308e29bcfa3714728096d7d0aa822c..bfbbb9382cf483a23acf35c17250f6f9
if (this.age != -32768) this.age += elapsedTicks; if (this.age != -32768) this.age += elapsedTicks;
this.lastTick = MinecraftServer.currentTick; this.lastTick = MinecraftServer.currentTick;
// CraftBukkit end // CraftBukkit end
@@ -227,6 +228,7 @@ public class ItemEntity extends Entity implements TraceableEntity { @@ -233,6 +234,7 @@ public class ItemEntity extends Entity implements TraceableEntity {
// CraftBukkit start - Use wall time for pickup and despawn timers // CraftBukkit start - Use wall time for pickup and despawn timers
int elapsedTicks = MinecraftServer.currentTick - this.lastTick; int elapsedTicks = MinecraftServer.currentTick - this.lastTick;
if (this.pickupDelay != 32767) this.pickupDelay -= elapsedTicks; if (this.pickupDelay != 32767) this.pickupDelay -= elapsedTicks;

View File

@ -6,10 +6,10 @@ Subject: [PATCH] Server Tick Events
Fires event at start and end of a server tick Fires event at start and end of a server tick
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 3d59c9f256f00c213af33c35cd6471a78b97c290..176378ddbf21d758694e8e624cc6c555c78e0fab 100644 index 270ec206c0dd3183db8f81241d7b87087681c80c..fbe459664f93ec9d314cd305f1e3857710191cfd 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1357,6 +1357,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1410,6 +1410,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}); });
isOversleep = false;MinecraftTimings.serverOversleep.stopTiming(); isOversleep = false;MinecraftTimings.serverOversleep.stopTiming();
// Paper end // Paper end
@ -17,7 +17,7 @@ index 3d59c9f256f00c213af33c35cd6471a78b97c290..176378ddbf21d758694e8e624cc6c555
++this.tickCount; ++this.tickCount;
this.tickRateManager.tick(); this.tickRateManager.tick();
@@ -1383,6 +1384,11 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1436,6 +1437,11 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.runAllTasks(); this.runAllTasks();
} }
// Paper end // Paper end

View File

@ -11,10 +11,10 @@ Example Usage: https://gist.github.com/aikar/5bb202de6057a051a950ce1f29feb0b4
public net.minecraft.world.entity.player.Inventory compartments public net.minecraft.world.entity.player.Inventory compartments
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 7433116ee68b92c86d1588296d521e5df49e5ac2..eb9668f94dbc36f3abc7d5c47c9b1b657aa94ced 100644 index e5d8384830c83694a3560fc743dc38e645cf9cfd..209d9f294a387e63b725be76cb645ca8925fa5a4 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -813,6 +813,46 @@ public class ServerPlayer extends Player { @@ -880,6 +880,46 @@ public class ServerPlayer extends Player {
}); });
} }
@ -61,7 +61,7 @@ index 7433116ee68b92c86d1588296d521e5df49e5ac2..eb9668f94dbc36f3abc7d5c47c9b1b65
@Override @Override
public void die(DamageSource damageSource) { public void die(DamageSource damageSource) {
// this.gameEvent(GameEvent.ENTITY_DIE); // Paper - move below event cancellation check // this.gameEvent(GameEvent.ENTITY_DIE); // Paper - move below event cancellation check
@@ -897,7 +937,12 @@ public class ServerPlayer extends Player { @@ -964,7 +1004,12 @@ public class ServerPlayer extends Player {
this.dropExperience(); this.dropExperience();
// we clean the player's inventory after the EntityDeathEvent is called so plugins can get the exact state of the inventory. // we clean the player's inventory after the EntityDeathEvent is called so plugins can get the exact state of the inventory.
if (!event.getKeepInventory()) { if (!event.getKeepInventory()) {

View File

@ -10,10 +10,10 @@ Optimize to check if the captured list even has values in it, and also to
just do a get call since the value can never be null. just do a get call since the value can never be null.
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 12809bc84aa07e724bebbc631199f352b7d7bbcb..6d5a0aa8f8cee0897a920c2abf18efc03cad2abb 100644 index 65b556d6ecae489c1c40b60d0eb432f4e1542e04..eec2ca8306d42e4eafdf3ab0778bf2023739cb83 100644
--- a/src/main/java/net/minecraft/world/level/Level.java --- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -911,9 +911,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -908,9 +908,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@Nullable @Nullable
public BlockEntity getBlockEntity(BlockPos blockposition, boolean validate) { public BlockEntity getBlockEntity(BlockPos blockposition, boolean validate) {

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Add Heightmap API
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 18db1aa374495a214807c5eb3ccc0213fc7c6a47..4001a8c13ceed6037174bb81fd06d9758fa0336c 100644 index 5d5eb6cef3b9646fab6c8da2a67d269312e6958c..2bea9911fe29244d9028e29b60d986f8db0e14b3 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -229,6 +229,29 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -229,6 +229,29 @@ public class CraftWorld extends CraftRegionAccessor implements World {

View File

@ -9,10 +9,10 @@ public net.minecraft.world.level.BaseSpawner delay(Lnet/minecraft/world/level/Le
public net.minecraft.world.level.BaseSpawner setNextSpawnData(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/SpawnData;)V public net.minecraft.world.level.BaseSpawner setNextSpawnData(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/SpawnData;)V
diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java
index 3184f73ce799cc5202d2129be736e2fed9a3b8e3..b771f954f3fccd92e15196bf542e0d3703cfb71a 100644 index 1d0964a7f544735a0213d5c7832c71f53db139a9..b90127f9f805fdb5bb43a4b8ad2b10499b0b6b78 100644
--- a/src/main/java/net/minecraft/world/level/BaseSpawner.java --- a/src/main/java/net/minecraft/world/level/BaseSpawner.java
+++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java +++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java
@@ -228,7 +228,13 @@ public abstract class BaseSpawner { @@ -237,7 +237,13 @@ public abstract class BaseSpawner {
} }
public void load(@Nullable Level world, BlockPos pos, CompoundTag nbt) { public void load(@Nullable Level world, BlockPos pos, CompoundTag nbt) {
@ -26,7 +26,7 @@ index 3184f73ce799cc5202d2129be736e2fed9a3b8e3..b771f954f3fccd92e15196bf542e0d37
boolean flag = nbt.contains("SpawnData", 10); boolean flag = nbt.contains("SpawnData", 10);
if (flag) { if (flag) {
@@ -251,9 +257,15 @@ public abstract class BaseSpawner { @@ -260,9 +266,15 @@ public abstract class BaseSpawner {
this.spawnPotentials = SimpleWeightedRandomList.single(this.nextSpawnData != null ? this.nextSpawnData : new SpawnData()); this.spawnPotentials = SimpleWeightedRandomList.single(this.nextSpawnData != null ? this.nextSpawnData : new SpawnData());
} }
@ -44,7 +44,7 @@ index 3184f73ce799cc5202d2129be736e2fed9a3b8e3..b771f954f3fccd92e15196bf542e0d37
this.spawnCount = nbt.getShort("SpawnCount"); this.spawnCount = nbt.getShort("SpawnCount");
} }
@@ -270,9 +282,20 @@ public abstract class BaseSpawner { @@ -279,9 +291,20 @@ public abstract class BaseSpawner {
} }
public CompoundTag save(CompoundTag nbt) { public CompoundTag save(CompoundTag nbt) {
@ -69,12 +69,12 @@ index 3184f73ce799cc5202d2129be736e2fed9a3b8e3..b771f954f3fccd92e15196bf542e0d37
nbt.putShort("MaxNearbyEntities", (short) this.maxNearbyEntities); nbt.putShort("MaxNearbyEntities", (short) this.maxNearbyEntities);
nbt.putShort("RequiredPlayerRange", (short) this.requiredPlayerRange); nbt.putShort("RequiredPlayerRange", (short) this.requiredPlayerRange);
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftCreatureSpawner.java b/src/main/java/org/bukkit/craftbukkit/block/CraftCreatureSpawner.java diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftCreatureSpawner.java b/src/main/java/org/bukkit/craftbukkit/block/CraftCreatureSpawner.java
index 777241d3196a7984042967bc67fcf7429a1ddee7..0d39223d1eaa3fe7065eb9dc9f945ca965d3b43e 100644 index 1a8fe7adf7c3ab9eb4cbc9847df4cfc872b97921..03a464bcb38b23e44bc02d632d469aab1c8b5b23 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftCreatureSpawner.java --- a/src/main/java/org/bukkit/craftbukkit/block/CraftCreatureSpawner.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftCreatureSpawner.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftCreatureSpawner.java
@@ -226,4 +226,28 @@ public class CraftCreatureSpawner extends CraftBlockEntityState<SpawnerBlockEnti @@ -256,4 +256,28 @@ public class CraftCreatureSpawner extends CraftBlockEntityState<SpawnerBlockEnti
public CraftCreatureSpawner copy() { new HashMap<>(nms.slotDropChances().entrySet().stream().collect(Collectors.toMap((entry) -> CraftEquipmentSlot.getSlot(entry.getKey()), Map.Entry::getValue)))
return new CraftCreatureSpawner(this); )).orElse(null);
} }
+ +
+ // Paper start + // Paper start

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Fix CB call to changed postToMainThread method
diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
index d0f89a66734423ceea67fbeb99b0e72797f80e63..e69043316372d98b122ed3788fda79cdd36849e8 100644 index 89c05909c10ef5172693c5d9d8fdf7e6efead53b..96b5e033aab4e1ee090af77a871e643dbf6300a4 100644
--- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
@@ -310,7 +310,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack @@ -355,7 +355,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
Objects.requireNonNull(this.connection); Objects.requireNonNull(this.connection);
// CraftBukkit - Don't wait // CraftBukkit - Don't wait

View File

@ -6,10 +6,10 @@ Subject: [PATCH] Fix sounds when item frames are modified (MC-123450)
This also fixes the adding sound playing when the item frame direction is changed. This also fixes the adding sound playing when the item frame direction is changed.
diff --git a/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java b/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java diff --git a/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java b/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java
index f90878e0449f39f66ae3a7036a65c374b36b7dbc..5c507b1160835fd4beb3b2d5b621250540545d4e 100644 index d4f498789ae1d93533f058b0ce4981eed1ce8ea2..5a0658932cc45c49c9285b1419d574dd83041732 100644
--- a/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java --- a/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java
+++ b/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java +++ b/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java
@@ -326,7 +326,7 @@ public class ItemFrame extends HangingEntity { @@ -313,7 +313,7 @@ public class ItemFrame extends HangingEntity {
this.onItemChanged(itemstack); this.onItemChanged(itemstack);
this.getEntityData().set(ItemFrame.DATA_ITEM, itemstack); this.getEntityData().set(ItemFrame.DATA_ITEM, itemstack);

View File

@ -1,19 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Shane Freeder <theboyetronic@gmail.com>
Date: Tue, 2 Oct 2018 09:57:50 +0100
Subject: [PATCH] Configurable connection throttle kick message
diff --git a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
index 3dfec4462d85f3223071b4e78465587db6185f0d..08a7461a92ae84cac69e4bb57a099d1f35ff1c1a 100644
--- a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
@@ -51,7 +51,7 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL
synchronized (ServerHandshakePacketListenerImpl.throttleTracker) {
if (ServerHandshakePacketListenerImpl.throttleTracker.containsKey(address) && !"127.0.0.1".equals(address.getHostAddress()) && currentTime - ServerHandshakePacketListenerImpl.throttleTracker.get(address) < connectionThrottle) {
ServerHandshakePacketListenerImpl.throttleTracker.put(address, currentTime);
- MutableComponent chatmessage = Component.literal("Connection throttled! Please wait before reconnecting.");
+ Component chatmessage = io.papermc.paper.adventure.PaperAdventure.asVanilla(io.papermc.paper.configuration.GlobalConfiguration.get().messages.kick.connectionThrottle); // Paper - Configurable connection throttle kick message
this.connection.send(new ClientboundLoginDisconnectPacket(chatmessage));
this.connection.disconnect(chatmessage);
return;