mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-22 10:57:43 +01:00
Updated Upstream (Paper)
Upstream has released updates that appear to apply and compile correctly Paper Changes: PaperMC/Paper@a2c9f58a Update to 1.21.11-pre3 (#13194) PaperMC/Paper@168287b2 Update exact choice recipe patch (#13346) PaperMC/Paper@354a5d54 [ci/skip] Add missing Nullable annotation for KineticWeapon.Builder methods (#13347) PaperMC/Paper@df4b6681 Restore legacy command restrictions PaperMC/Paper@2efb4e7a Merge branch 'ver/1.21.10' PaperMC/Paper@fdfdec66 Trigger build after merge commit PaperMC/Paper@6348ac89 Schedule PlayerSpawnFinder chunk callbacks to mainThreadProcessor instead of server queue fixes #13354 PaperMC/Paper@b786cbe8 Update to 1.21.11-pre4 (#13357) PaperMC/Paper@889c6617 Flush region storage if configured for ChunkMap#synchronize PaperMC/Paper@c7a138b0 Remove ItemStack mutation on drop methods (#11831) PaperMC/Paper@1d09b617 Fix ItemType#isEdible to also check for DataComponents#CONSUMABLE (#13348) PaperMC/Paper@84a789b2 Add Decorated Pot wobble API (#12994) PaperMC/Paper@ec0ad8b9 Update to 1.21.11-pre5 PaperMC/Paper@ffce96cf Fix wrong translation key in /give command (#13364) PaperMC/Paper@1cb31fd3 Update to 1.21.11-rc1 PaperMC/Paper@51c1b16b Optimize getEntityCount by directly accessing Moonrise data structures
This commit is contained in:
@@ -88,7 +88,7 @@
|
||||
continue;
|
||||
}
|
||||
ServerPlayer entityplayer = (ServerPlayer) entityhuman;
|
||||
@@ -1952,7 +_,7 @@
|
||||
@@ -1953,7 +_,7 @@
|
||||
|
||||
@DontObfuscate
|
||||
public String getServerModName() {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/commands/GiveCommand.java
|
||||
+++ b/net/minecraft/server/commands/GiveCommand.java
|
||||
@@ -69,6 +_,7 @@
|
||||
@@ -68,6 +_,7 @@
|
||||
i1 -= min;
|
||||
ItemStack itemStack1 = item.createItemStack(min, false);
|
||||
boolean flag = serverPlayer.getInventory().add(itemStack1);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -428,6 +_,9 @@
|
||||
@@ -433,6 +_,9 @@
|
||||
public boolean isRealPlayer; // Paper
|
||||
public com.destroystokyo.paper.event.entity.@Nullable PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper - PlayerNaturallySpawnCreaturesEvent
|
||||
public org.bukkit.event.player.PlayerQuitEvent.@Nullable QuitReason quitReason = null; // Paper - Add API for quit reason; there are a lot of changes to do if we change all methods leading to the event
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
// Paper start - rewrite chunk system
|
||||
private ca.spottedleaf.moonrise.patches.chunk_system.player.RegionizedPlayerChunkLoader.PlayerChunkLoaderData chunkLoader;
|
||||
@@ -501,6 +_,9 @@
|
||||
@@ -506,6 +_,9 @@
|
||||
this.respawnConfig = input.read("respawn", ServerPlayer.RespawnConfig.CODEC).orElse(null);
|
||||
this.spawnExtraParticlesOnFall = input.getBooleanOr("spawn_extra_particles_on_fall", false);
|
||||
this.raidOmenPosition = input.read("raid_omen_position", BlockPos.CODEC).orElse(null);
|
||||
@@ -20,7 +20,7 @@
|
||||
// Paper start - Expand PlayerGameModeChangeEvent
|
||||
this.loadGameTypes(input);
|
||||
}
|
||||
@@ -542,6 +_,9 @@
|
||||
@@ -547,6 +_,9 @@
|
||||
output.store("ShoulderEntityRight", CompoundTag.CODEC, this.getShoulderEntityRight());
|
||||
}
|
||||
this.getBukkitEntity().setExtraData(output); // CraftBukkit
|
||||
@@ -30,7 +30,7 @@
|
||||
}
|
||||
|
||||
private void saveParentVehicle(ValueOutput output) {
|
||||
@@ -1178,6 +_,7 @@
|
||||
@@ -1183,6 +_,7 @@
|
||||
// Paper - moved up to sendClientboundPlayerCombatKillPacket()
|
||||
sendClientboundPlayerCombatKillPacket(event.getShowDeathMessages(), deathScreenMessage); // Paper - Expand PlayerDeathEvent
|
||||
Team team = this.getTeam();
|
||||
@@ -38,7 +38,7 @@
|
||||
if (team == null || team.getDeathMessageVisibility() == Team.Visibility.ALWAYS) {
|
||||
this.server.getPlayerList().broadcastSystemMessage(deathMessage, false);
|
||||
} else if (team.getDeathMessageVisibility() == Team.Visibility.HIDE_FOR_OTHER_TEAMS) {
|
||||
@@ -1285,6 +_,13 @@
|
||||
@@ -1290,6 +_,13 @@
|
||||
if (this.isInvulnerableTo(level, damageSource)) {
|
||||
return false;
|
||||
} else {
|
||||
@@ -52,7 +52,7 @@
|
||||
Entity entity = damageSource.getEntity();
|
||||
if (!( // Paper - split the if statement. If below statement is false, hurtServer would not have been evaluated. Return false.
|
||||
!(entity instanceof Player player && !this.canHarmPlayer(player))
|
||||
@@ -1539,6 +_,7 @@
|
||||
@@ -1544,6 +_,7 @@
|
||||
|
||||
profilerFiller.pop();
|
||||
profilerFiller.push("placing");
|
||||
@@ -60,7 +60,7 @@
|
||||
this.setServerLevel(level);
|
||||
this.connection.internalTeleport(PositionMoveRotation.of(teleportTransition), teleportTransition.relatives()); // CraftBukkit - use internal teleport without event
|
||||
this.connection.resetPosition();
|
||||
@@ -1647,7 +_,7 @@
|
||||
@@ -1652,7 +_,7 @@
|
||||
new AABB(vec3.x() - 8.0, vec3.y() - 5.0, vec3.z() - 8.0, vec3.x() + 8.0, vec3.y() + 5.0, vec3.z() + 8.0),
|
||||
monster -> monster.isPreventingPlayerRest(this.level(), this)
|
||||
);
|
||||
@@ -69,7 +69,7 @@
|
||||
return Either.left(Player.BedSleepingProblem.NOT_SAFE);
|
||||
}
|
||||
}
|
||||
@@ -1687,8 +_,19 @@
|
||||
@@ -1692,8 +_,19 @@
|
||||
CriteriaTriggers.SLEPT_IN_BED.trigger(this);
|
||||
});
|
||||
if (!this.level().canSleepThroughNights()) {
|
||||
@@ -90,7 +90,7 @@
|
||||
|
||||
this.level().updateSleepingPlayerList();
|
||||
return either;
|
||||
@@ -1779,6 +_,7 @@
|
||||
@@ -1784,6 +_,7 @@
|
||||
|
||||
@Override
|
||||
public void openTextEdit(SignBlockEntity signEntity, boolean isFrontText) {
|
||||
@@ -98,7 +98,7 @@
|
||||
this.connection.send(new ClientboundBlockUpdatePacket(this.level(), signEntity.getBlockPos()));
|
||||
this.connection.send(new ClientboundOpenSignEditorPacket(signEntity.getBlockPos(), isFrontText));
|
||||
}
|
||||
@@ -2116,6 +_,26 @@
|
||||
@@ -2121,6 +_,26 @@
|
||||
this.lastSentExp = -1; // CraftBukkit - Added to reset
|
||||
}
|
||||
|
||||
@@ -125,7 +125,7 @@
|
||||
@Override
|
||||
public void displayClientMessage(Component message, boolean overlay) {
|
||||
this.sendSystemMessage(message, overlay);
|
||||
@@ -2350,6 +_,20 @@
|
||||
@@ -2355,6 +_,20 @@
|
||||
);
|
||||
}
|
||||
|
||||
@@ -146,7 +146,7 @@
|
||||
public void sendSystemMessage(Component message) {
|
||||
this.sendSystemMessage(message, false);
|
||||
}
|
||||
@@ -2487,7 +_,67 @@
|
||||
@@ -2492,7 +_,67 @@
|
||||
|
||||
public void resetLastActionTime() {
|
||||
this.lastActionTime = Util.getMillis();
|
||||
@@ -215,7 +215,7 @@
|
||||
|
||||
public ServerStatsCounter getStats() {
|
||||
return this.stats;
|
||||
@@ -3123,4 +_,65 @@
|
||||
@@ -3128,4 +_,65 @@
|
||||
return (org.bukkit.craftbukkit.entity.CraftPlayer) super.getBukkitEntity();
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/level/ServerPlayerGameMode.java
|
||||
+++ b/net/minecraft/server/level/ServerPlayerGameMode.java
|
||||
@@ -364,6 +_,7 @@
|
||||
@@ -365,6 +_,7 @@
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -8,7 +8,7 @@
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
@@ -481,6 +_,7 @@
|
||||
@@ -482,6 +_,7 @@
|
||||
public InteractionHand interactHand;
|
||||
public ItemStack interactItemStack;
|
||||
public InteractionResult useItemOn(ServerPlayer player, Level level, ItemStack stack, InteractionHand hand, BlockHitResult hitResult) {
|
||||
@@ -16,7 +16,7 @@
|
||||
BlockPos blockPos = hitResult.getBlockPos();
|
||||
BlockState blockState = level.getBlockState(blockPos);
|
||||
boolean cancelledBlock = false;
|
||||
@@ -523,7 +_,7 @@
|
||||
@@ -524,7 +_,7 @@
|
||||
boolean flag = !player.getMainHandItem().isEmpty() || !player.getOffhandItem().isEmpty();
|
||||
boolean flag1 = player.isSecondaryUseActive() && flag;
|
||||
ItemStack itemStack = stack.copy();
|
||||
@@ -25,7 +25,7 @@
|
||||
InteractionResult interactionResult = blockState.useItemOn(player.getItemInHand(hand), level, player, hand, hitResult);
|
||||
if (interactionResult.consumesAction()) {
|
||||
CriteriaTriggers.ITEM_USED_ON_BLOCK.trigger(player, blockPos, itemStack);
|
||||
@@ -569,4 +_,18 @@
|
||||
@@ -570,4 +_,18 @@
|
||||
public void setLevel(ServerLevel level) {
|
||||
this.level = level;
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@
|
||||
this.onBelowWorld();
|
||||
}
|
||||
}
|
||||
@@ -1956,7 +_,7 @@
|
||||
@@ -1960,7 +_,7 @@
|
||||
}
|
||||
|
||||
public boolean fireImmune() {
|
||||
@@ -77,7 +77,7 @@
|
||||
}
|
||||
|
||||
public boolean causeFallDamage(double fallDistance, float damageMultiplier, DamageSource damageSource) {
|
||||
@@ -2654,6 +_,11 @@
|
||||
@@ -2658,6 +_,11 @@
|
||||
output.putBoolean("Paper.FreezeLock", true);
|
||||
}
|
||||
// Paper end
|
||||
@@ -89,7 +89,7 @@
|
||||
} catch (Throwable var7) {
|
||||
CrashReport crashReport = CrashReport.forThrowable(var7, "Saving entity NBT");
|
||||
CrashReportCategory crashReportCategory = crashReport.addCategory("Entity being saved");
|
||||
@@ -2774,6 +_,9 @@
|
||||
@@ -2778,6 +_,9 @@
|
||||
}
|
||||
freezeLocked = input.getBooleanOr("Paper.FreezeLock", false);
|
||||
// Paper end
|
||||
@@ -99,7 +99,7 @@
|
||||
} catch (Throwable var7) {
|
||||
CrashReport crashReport = CrashReport.forThrowable(var7, "Loading entity NBT");
|
||||
CrashReportCategory crashReportCategory = crashReport.addCategory("Entity being loaded");
|
||||
@@ -3039,6 +_,7 @@
|
||||
@@ -3041,6 +_,7 @@
|
||||
if (this.isAlive() && this instanceof Leashable leashable2) {
|
||||
if (leashable2.getLeashHolder() == player) {
|
||||
if (!this.level().isClientSide()) {
|
||||
@@ -107,7 +107,7 @@
|
||||
// Paper start - EntityUnleashEvent
|
||||
if (!org.bukkit.craftbukkit.event.CraftEventFactory.handlePlayerUnleashEntityEvent(
|
||||
leashable2, player, hand, !player.hasInfiniteMaterials(), true
|
||||
@@ -3469,15 +_,18 @@
|
||||
@@ -3471,15 +_,18 @@
|
||||
return Vec3.directionFromRotation(this.getRotationVector());
|
||||
}
|
||||
|
||||
@@ -127,7 +127,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3683,7 +_,7 @@
|
||||
@@ -3685,7 +_,7 @@
|
||||
}
|
||||
|
||||
public int getMaxAirSupply() {
|
||||
@@ -136,7 +136,7 @@
|
||||
}
|
||||
|
||||
public int getAirSupply() {
|
||||
@@ -4218,7 +_,7 @@
|
||||
@@ -4220,7 +_,7 @@
|
||||
}
|
||||
|
||||
public boolean canUsePortal(boolean allowPassengers) {
|
||||
@@ -145,7 +145,7 @@
|
||||
}
|
||||
|
||||
public boolean canTeleport(Level fromLevel, Level toLevel) {
|
||||
@@ -4737,6 +_,12 @@
|
||||
@@ -4739,6 +_,12 @@
|
||||
return Mth.lerp(partialTick, this.yRotO, this.yRot);
|
||||
}
|
||||
|
||||
@@ -158,7 +158,7 @@
|
||||
// Paper start - optimise collisions
|
||||
public boolean updateFluidHeightAndDoFluidPushing(final TagKey<Fluid> fluid, final double flowScale) {
|
||||
if (this.touchingUnloadedChunk()) {
|
||||
@@ -5157,7 +_,7 @@
|
||||
@@ -5159,7 +_,7 @@
|
||||
}
|
||||
|
||||
public float maxUpStep() {
|
||||
|
||||
@@ -173,7 +173,7 @@
|
||||
this.hurt(this.damageSources().flyIntoWall(), f);
|
||||
}
|
||||
}
|
||||
@@ -4671,6 +_,12 @@
|
||||
@@ -4666,6 +_,12 @@
|
||||
? slot == EquipmentSlot.MAINHAND && this.canUseSlot(EquipmentSlot.MAINHAND)
|
||||
: slot == equippable.slot() && this.canUseSlot(equippable.slot()) && equippable.canBeEquippedBy(this.getType());
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/animal/Animal.java
|
||||
+++ b/net/minecraft/world/entity/animal/Animal.java
|
||||
@@ -140,7 +_,7 @@
|
||||
@@ -146,7 +_,7 @@
|
||||
ItemStack itemInHand = player.getItemInHand(hand);
|
||||
if (this.isFood(itemInHand)) {
|
||||
int age = this.getAge();
|
||||
@@ -9,7 +9,7 @@
|
||||
final ItemStack breedCopy = itemInHand.copy(); // Paper - Fix EntityBreedEvent copying
|
||||
this.usePlayerItem(player, hand, itemInHand);
|
||||
this.setInLove(serverPlayer, breedCopy); // Paper - Fix EntityBreedEvent copying
|
||||
@@ -221,10 +_,20 @@
|
||||
@@ -227,10 +_,20 @@
|
||||
public void spawnChildFromBreeding(ServerLevel level, Animal partner) {
|
||||
AgeableMob breedOffspring = this.getBreedOffspring(level, partner);
|
||||
if (breedOffspring != null) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/animal/pig/Pig.java
|
||||
+++ b/net/minecraft/world/entity/animal/pig/Pig.java
|
||||
@@ -142,6 +_,19 @@
|
||||
@@ -138,6 +_,19 @@
|
||||
@Override
|
||||
public InteractionResult mobInteract(Player player, InteractionHand hand) {
|
||||
boolean isFood = this.isFood(player.getItemInHand(hand));
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/monster/zombie/ZombieVillager.java
|
||||
+++ b/net/minecraft/world/entity/monster/zombie/ZombieVillager.java
|
||||
@@ -137,10 +_,10 @@
|
||||
@@ -159,10 +_,10 @@
|
||||
public InteractionResult mobInteract(Player player, InteractionHand hand) {
|
||||
ItemStack itemInHand = player.getItemInHand(hand);
|
||||
if (itemInHand.is(Items.GOLDEN_APPLE)) {
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
public int getDamageValue() {
|
||||
return Mth.clamp(this.getOrDefault(DataComponents.DAMAGE, 0), 0, this.getMaxDamage());
|
||||
}
|
||||
@@ -1241,6 +_,12 @@
|
||||
@@ -1247,6 +_,12 @@
|
||||
public boolean isEnchanted() {
|
||||
return !this.getOrDefault(DataComponents.ENCHANTMENTS, ItemEnchantments.EMPTY).isEmpty();
|
||||
}
|
||||
|
||||
@@ -3,13 +3,13 @@
|
||||
@@ -36,6 +_,7 @@
|
||||
// CraftBukkit start
|
||||
@javax.annotation.Nullable
|
||||
private java.util.List<ItemStack> itemStacks;
|
||||
private java.util.Set<ItemStack> itemStacks; // Paper - Improve exact choice recipe ingredients
|
||||
+ public Predicate<org.bukkit.inventory.ItemStack> predicate; // Purpur - Add predicate to recipe's ExactChoice ingredient
|
||||
|
||||
public boolean isExact() {
|
||||
return this.itemStacks != null;
|
||||
@@ -90,6 +_,11 @@
|
||||
return false;
|
||||
@@ -88,6 +_,11 @@
|
||||
return this.itemStacks.contains(stack); // Paper - Improve exact choice recipe ingredients (hashing FTW!)
|
||||
}
|
||||
// CraftBukkit end
|
||||
+ // Purpur start - Add predicate to recipe's ExactChoice ingredient
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/Level.java
|
||||
+++ b/net/minecraft/world/level/Level.java
|
||||
@@ -165,11 +_,55 @@
|
||||
@@ -166,11 +_,55 @@
|
||||
}
|
||||
// Paper end - add paper world config
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
public CraftWorld getWorld() {
|
||||
return this.world;
|
||||
}
|
||||
@@ -844,6 +_,8 @@
|
||||
@@ -846,6 +_,8 @@
|
||||
// Paper end - getblock optimisations - cache world height/sections
|
||||
this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) levelData).getLevelName()); // Spigot
|
||||
this.paperConfig = paperWorldConfigCreator.apply(this.spigotConfig); // Paper - create paper world config
|
||||
@@ -65,11 +65,11 @@
|
||||
this.generator = generator;
|
||||
this.world = new CraftWorld((ServerLevel) this, generator, biomeProvider, environment);
|
||||
|
||||
@@ -2071,4 +_,14 @@
|
||||
return this.id;
|
||||
}
|
||||
@@ -2081,4 +_,14 @@
|
||||
return this.moonrise$getEntityLookup().getEntityCount(); // Paper - rewrite chunk system
|
||||
}
|
||||
+
|
||||
// Paper end - allow patching this logic
|
||||
+
|
||||
+ // Purpur start - Add allow water in end world option
|
||||
+ public boolean isNether() {
|
||||
+ return getWorld().getEnvironment() == org.bukkit.World.Environment.NETHER;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/NaturalSpawner.java
|
||||
+++ b/net/minecraft/world/level/NaturalSpawner.java
|
||||
@@ -209,7 +_,7 @@
|
||||
@@ -264,7 +_,7 @@
|
||||
mutableBlockPos.set(x, y, z);
|
||||
double d = x + 0.5;
|
||||
double d1 = z + 0.5;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/entity/BlockEntity.java
|
||||
+++ b/net/minecraft/world/level/block/entity/BlockEntity.java
|
||||
@@ -104,6 +_,10 @@
|
||||
@@ -105,6 +_,10 @@
|
||||
input.read("PublicBukkitValues", CompoundTag.CODEC)
|
||||
.ifPresent(this.persistentDataContainer::putAll);
|
||||
// Paper end - read persistent data container
|
||||
@@ -11,7 +11,7 @@
|
||||
}
|
||||
|
||||
public final void loadWithComponents(ValueInput input) {
|
||||
@@ -116,6 +_,11 @@
|
||||
@@ -117,6 +_,11 @@
|
||||
}
|
||||
|
||||
protected void saveAdditional(ValueOutput output) {
|
||||
@@ -23,7 +23,7 @@
|
||||
}
|
||||
|
||||
public final CompoundTag saveWithFullMetadata(HolderLookup.Provider registries) {
|
||||
@@ -400,4 +_,16 @@
|
||||
@@ -402,4 +_,16 @@
|
||||
return this.blockEntity.getNameForReporting() + "@" + this.blockEntity.getBlockPos();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user