Updated Upstream (Paper)

Upstream has released updates that appear to apply and compile correctly

Paper Changes:
PaperMC/Paper@4a903d81 Readd dropped diff
PaperMC/Paper@4fe0ac24 Some more comments
PaperMC/Paper@19a36413 Last per file patches
PaperMC/Paper@e49b5e88 Fix compile issues:
PaperMC/Paper@1b30919a Fix
PaperMC/Paper@df964545 Fixup whatever happened here
PaperMC/Paper@5933bd5b TrialSpawner compile fixes
PaperMC/Paper@20136f71 Some initial adoption of ValueInput/Output
PaperMC/Paper@a1bfc19a Some more compilation issues
PaperMC/Paper@d16b93e6 Generator
PaperMC/Paper@c34fb5f8 Test fixes
PaperMC/Paper@f3bad8c8 Prepare work on feature patches
PaperMC/Paper@ed3b39e9 14 first feature patches
PaperMC/Paper@ff05a2df Hacky EAR 2.0 fixes
This commit is contained in:
granny
2025-06-01 13:16:37 -07:00
parent cfd1e070a2
commit 994dd4f476
34 changed files with 128 additions and 238 deletions

View File

@@ -0,0 +1,19 @@
--- a/io/papermc/paper/entity/activation/ActivationRange.java
+++ b/io/papermc/paper/entity/activation/ActivationRange.java
@@ -147,6 +_,8 @@
continue;
}
+ if (!player.level().purpurConfig.idleTimeoutTickNearbyEntities && player.isAfk()) continue; // Purpur - AFK API
+
final int worldHeight = world.getHeight();
ActivationRange.maxBB = player.getBoundingBox().inflate(maxRange, worldHeight, maxRange);
ActivationType.MISC.boundingBox = player.getBoundingBox().inflate(miscActivationRange, worldHeight, miscActivationRange);
@@ -288,6 +_,7 @@
* @return
*/
public static boolean checkIfActive(final Entity entity) {
+ if (entity.level().purpurConfig.squidImmuneToEAR && entity instanceof net.minecraft.world.entity.animal.Squid) return true; // Purpur - Squid EAR immunity
// Never safe to skip fireworks or item gravity
if (entity instanceof FireworkRocketEntity || (entity instanceof ItemEntity && (entity.tickCount + entity.getId()) % 4 == 0)) { // Needed for item gravity, see ItemEntity tick
return true;

View File

@@ -1,14 +1,6 @@
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 06:37:42 -0700
Subject: [PATCH] purpur File Patches
diff --git a/net/minecraft/commands/CommandSourceStack.java b/net/minecraft/commands/CommandSourceStack.java
index cb63e4c264a31788cd1405428af70f7a018910e9..4d06587cd55af988eecdda5186577ab72ca3d533 100644
--- a/net/minecraft/commands/CommandSourceStack.java
+++ b/net/minecraft/commands/CommandSourceStack.java
@@ -455,6 +455,19 @@ public class CommandSourceStack implements ExecutionCommandSource<CommandSourceS
@@ -457,6 +_,19 @@
}
// CraftBukkit end
@@ -28,10 +20,11 @@ index cb63e4c264a31788cd1405428af70f7a018910e9..4d06587cd55af988eecdda5186577ab7
public Vec3 getPosition() {
return this.worldPosition;
}
@@ -540,6 +553,30 @@ public class CommandSourceStack implements ExecutionCommandSource<CommandSourceS
@@ -541,6 +_,30 @@
}
}
}
+
+ // Purpur start - Purpur config files
+ public void sendSuccess(@Nullable String message) {
+ sendSuccess(message, false);
@@ -55,7 +48,6 @@ index cb63e4c264a31788cd1405428af70f7a018910e9..4d06587cd55af988eecdda5186577ab7
+ sendSuccess(() -> io.papermc.paper.adventure.PaperAdventure.asVanilla(message), broadcastToOps);
+ }
+ // Purpur end - Purpur config files
+
public void sendSuccess(Supplier<Component> messageSupplier, boolean allowLogging) {
boolean flag = this.source.acceptsSuccess() && !this.silent;
boolean flag1 = allowLogging && this.source.shouldInformAdmins() && !this.silent;

View File

@@ -1,8 +1,8 @@
--- a/net/minecraft/core/BlockPos.java
+++ b/net/minecraft/core/BlockPos.java
@@ -61,6 +_,12 @@
private static final int X_OFFSET = PACKED_Y_LENGTH + PACKED_HORIZONTAL_LENGTH;
public static final int MAX_HORIZONTAL_COORDINATE = (1 << PACKED_HORIZONTAL_LENGTH) / 2 - 1;
@@ -63,6 +_,12 @@
public static final int MAX_HORIZONTAL_COORDINATE = 33554431;
// Paper end - Optimize Bit Operations by inlining
+ // Purpur start - Ridables
+ public BlockPos(net.minecraft.world.entity.Entity entity) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/network/Connection.java
+++ b/net/minecraft/network/Connection.java
@@ -486,11 +_,20 @@
@@ -578,11 +_,20 @@
private static final int MAX_PER_TICK = io.papermc.paper.configuration.GlobalConfiguration.get().misc.maxJoinsPerTick; // Paper - Buffer joins to world
private static int joinAttemptsThisTick; // Paper - Buffer joins to world
private static int currTick; // Paper - Buffer joins to world

View File

@@ -1,14 +1,6 @@
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 06:37:42 -0700
Subject: [PATCH] purpur File Patches
diff --git a/net/minecraft/server/Main.java b/net/minecraft/server/Main.java
index 9c9b601a3f903bebb0dd1bda0e24745587229727..29dd9a980bb7dc8457dd9ad6eeaa2c5067e3b954 100644
--- a/net/minecraft/server/Main.java
+++ b/net/minecraft/server/Main.java
@@ -108,6 +108,12 @@ public class Main {
@@ -109,6 +_,12 @@
JvmProfiler.INSTANCE.start(Environment.SERVER);
}

View File

@@ -1,14 +1,6 @@
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 06:37:42 -0700
Subject: [PATCH] purpur File Patches
diff --git a/net/minecraft/server/dedicated/DedicatedServer.java b/net/minecraft/server/dedicated/DedicatedServer.java
index 31e02f50edd46220dac81500dbb273f1ccdbe0b9..6a296adcd9d5289dd86840fdc58dce3accbe9ce5 100644
--- a/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/net/minecraft/server/dedicated/DedicatedServer.java
@@ -105,6 +105,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
@@ -105,6 +_,7 @@
public void run() {
if (!org.bukkit.craftbukkit.Main.useConsole) return; // CraftBukkit
// Paper start - Use TerminalConsoleAppender
@@ -16,7 +8,7 @@ index 31e02f50edd46220dac81500dbb273f1ccdbe0b9..6a296adcd9d5289dd86840fdc58dce3a
new com.destroystokyo.paper.console.PaperConsole(DedicatedServer.this).start();
/*
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in, StandardCharsets.UTF_8));
@@ -183,6 +184,15 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
@@ -183,6 +_,15 @@
io.papermc.paper.command.PaperCommands.registerCommands(this); // Paper - setup /paper command
this.server.spark.registerCommandBeforePlugins(this.server); // Paper - spark
com.destroystokyo.paper.Metrics.PaperMetrics.startMetrics(); // Paper - start metrics
@@ -32,7 +24,7 @@ index 31e02f50edd46220dac81500dbb273f1ccdbe0b9..6a296adcd9d5289dd86840fdc58dce3a
com.destroystokyo.paper.VersionHistoryManager.INSTANCE.getClass(); // Paper - load version history now
this.setPvpAllowed(properties.pvp);
@@ -230,6 +240,30 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
@@ -230,6 +_,30 @@
if (true) throw new IllegalStateException("Failed to bind to port", var10); // Paper - Propagate failed to bind to port error
return false;
}
@@ -63,7 +55,7 @@ index 31e02f50edd46220dac81500dbb273f1ccdbe0b9..6a296adcd9d5289dd86840fdc58dce3a
// CraftBukkit start
this.server.loadPlugins();
@@ -308,6 +342,8 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
@@ -308,6 +_,8 @@
LOGGER.info("JMX monitoring enabled");
}

View File

@@ -1,14 +1,6 @@
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 06:37:42 -0700
Subject: [PATCH] purpur File Patches
diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java
index bfbfbaa9660d21071c420b60b10be0a02a1bc87e..f3f53791d4c5532434abc281a5798ee0e2653da2 100644
--- a/net/minecraft/server/level/ServerLevel.java
+++ b/net/minecraft/server/level/ServerLevel.java
@@ -203,6 +203,8 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
@@ -206,6 +_,8 @@
private final StructureManager structureManager;
private final StructureCheck structureCheck;
private final boolean tickTime;
@@ -17,7 +9,7 @@ index bfbfbaa9660d21071c420b60b10be0a02a1bc87e..f3f53791d4c5532434abc281a5798ee0
private final RandomSequences randomSequences;
// CraftBukkit start
@@ -587,7 +589,24 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
@@ -353,7 +_,24 @@
// CraftBukkit end
this.tickTime = tickTime;
this.server = server;
@@ -43,15 +35,15 @@ index bfbfbaa9660d21071c420b60b10be0a02a1bc87e..f3f53791d4c5532434abc281a5798ee0
this.serverLevelData = serverLevelData;
ChunkGenerator chunkGenerator = levelStem.generator();
// CraftBukkit start
@@ -671,6 +690,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
this.chunkDataController = new ca.spottedleaf.moonrise.patches.chunk_system.io.datacontroller.ChunkDataController((ServerLevel)(Object)this, this.chunkTaskScheduler);
// Paper end - rewrite chunk system
@@ -435,6 +_,7 @@
this.randomSequences = Objects.requireNonNullElseGet(randomSequences, () -> this.getDataStorage().computeIfAbsent(RandomSequences.TYPE));
this.waypointManager = new ServerWaypointManager();
this.getCraftServer().addWorld(this.getWorld()); // CraftBukkit
+ this.preciseTime = this.serverLevelData.getDayTime(); // Purpur - Configurable daylight cycle
}
// Paper start
@@ -717,7 +737,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
@@ -481,7 +_,7 @@
}
int _int = this.getGameRules().getInt(GameRules.RULE_PLAYERS_SLEEPING_PERCENTAGE);
@@ -60,7 +52,7 @@ index bfbfbaa9660d21071c420b60b10be0a02a1bc87e..f3f53791d4c5532434abc281a5798ee0
// Paper start - create time skip event - move up calculations
final long newDayTime = this.levelData.getDayTime() + 24000L;
org.bukkit.event.world.TimeSkipEvent event = new org.bukkit.event.world.TimeSkipEvent(
@@ -836,6 +856,13 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
@@ -598,6 +_,13 @@
this.serverLevelData.getScheduledEvents().tick(this.server, l);
Profiler.get().pop();
if (this.serverLevelData.getGameRules().getBoolean(GameRules.RULE_DAYLIGHT)) {
@@ -74,10 +66,11 @@ index bfbfbaa9660d21071c420b60b10be0a02a1bc87e..f3f53791d4c5532434abc281a5798ee0
this.setDayTime(this.levelData.getDayTime() + 1L);
}
}
@@ -843,7 +870,21 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
@@ -605,7 +_,21 @@
public void setDayTime(long time) {
this.serverLevelData.setDayTime(time);
- }
+ // Purpur start - Configurable daylight cycle
+ this.preciseTime = time;
+ this.forceTime = false;
@@ -91,12 +84,12 @@ index bfbfbaa9660d21071c420b60b10be0a02a1bc87e..f3f53791d4c5532434abc281a5798ee0
+ // Purpur start - Configurable daylight cycle
+ public boolean isForceTime() {
+ return this.forceTime;
}
+ }
+ // Purpur end - Configurable daylight cycle
public void tickCustomSpawners(boolean spawnEnemies, boolean spawnFriendlies) {
for (CustomSpawner customSpawner : this.customSpawners) {
@@ -947,9 +988,17 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
@@ -682,9 +_,17 @@
&& this.random.nextDouble() < currentDifficultyAt.getEffectiveDifficulty() * this.paperConfig().entities.spawning.skeletonHorseThunderSpawnChance.or(0.01) // Paper - Configurable spawn chances for skeleton horses
&& !this.getBlockState(blockPos.below()).is(Blocks.LIGHTNING_ROD);
if (flag) {
@@ -116,7 +109,7 @@ index bfbfbaa9660d21071c420b60b10be0a02a1bc87e..f3f53791d4c5532434abc281a5798ee0
skeletonHorse.setAge(0);
skeletonHorse.setPos(blockPos.getX(), blockPos.getY(), blockPos.getZ());
this.addFreshEntity(skeletonHorse, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.LIGHTNING); // CraftBukkit
@@ -984,9 +1033,35 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
@@ -719,9 +_,35 @@
if (blockState.is(Blocks.SNOW)) {
int layersValue = blockState.getValue(SnowLayerBlock.LAYERS);
if (layersValue < Math.min(_int, 8)) {
@@ -152,7 +145,7 @@ index bfbfbaa9660d21071c420b60b10be0a02a1bc87e..f3f53791d4c5532434abc281a5798ee0
}
} else {
org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(this, heightmapPos, Blocks.SNOW.defaultBlockState(), 3, null); // CraftBukkit
@@ -1007,7 +1082,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
@@ -742,7 +_,7 @@
pointOfInterestType -> pointOfInterestType.is(PoiTypes.LIGHTNING_ROD),
blockPos -> blockPos.getY() == this.getHeight(Heightmap.Types.WORLD_SURFACE, blockPos.getX(), blockPos.getZ()) - 1,
pos,
@@ -161,7 +154,7 @@ index bfbfbaa9660d21071c420b60b10be0a02a1bc87e..f3f53791d4c5532434abc281a5798ee0
PoiManager.Occupancy.ANY
);
return optional.map(blockPos -> blockPos.above(1));
@@ -1056,8 +1131,26 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
@@ -791,8 +_,26 @@
int _int = this.getGameRules().getInt(GameRules.RULE_PLAYERS_SLEEPING_PERCENTAGE);
Component component;
if (this.sleepStatus.areEnoughSleeping(_int)) {
@@ -188,7 +181,7 @@ index bfbfbaa9660d21071c420b60b10be0a02a1bc87e..f3f53791d4c5532434abc281a5798ee0
component = Component.translatable("sleep.players_sleeping", this.sleepStatus.amountSleeping(), this.sleepStatus.sleepersNeeded(_int));
}
@@ -1190,6 +1283,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
@@ -929,6 +_,7 @@
@VisibleForTesting
public void resetWeatherCycle() {
// CraftBukkit start
@@ -196,7 +189,7 @@ index bfbfbaa9660d21071c420b60b10be0a02a1bc87e..f3f53791d4c5532434abc281a5798ee0
this.serverLevelData.setRaining(false, org.bukkit.event.weather.WeatherChangeEvent.Cause.SLEEP); // Paper - Add cause to Weather/ThunderChangeEvents
// If we stop due to everyone sleeping we should reset the weather duration to some other random value.
// Not that everyone ever manages to get the whole server to sleep at the same time....
@@ -1197,6 +1291,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
@@ -936,6 +_,7 @@
this.serverLevelData.setRainTime(0);
}
// CraftBukkit end
@@ -204,7 +197,7 @@ index bfbfbaa9660d21071c420b60b10be0a02a1bc87e..f3f53791d4c5532434abc281a5798ee0
this.serverLevelData.setThundering(false, org.bukkit.event.weather.ThunderChangeEvent.Cause.SLEEP); // Paper - Add cause to Weather/ThunderChangeEvents
// CraftBukkit start
// If we stop due to everyone sleeping we should reset the weather duration to some other random value.
@@ -2674,7 +2769,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
@@ -2384,7 +_,7 @@
// Spigot start
if (entity.getBukkitEntity() instanceof org.bukkit.inventory.InventoryHolder && (!(entity instanceof ServerPlayer) || entity.getRemovalReason() != Entity.RemovalReason.KILLED)) { // SPIGOT-6876: closeInventory clears death message
// Paper start - Fix merchant inventory not closing on entity removal

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/server/level/ServerPlayerGameMode.java
+++ b/net/minecraft/server/level/ServerPlayerGameMode.java
@@ -347,6 +_,7 @@
@@ -348,6 +_,7 @@
}
return false;
}
@@ -8,7 +8,7 @@
}
// CraftBukkit end
@@ -460,6 +_,7 @@
@@ -461,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;
@@ -502,7 +_,7 @@
@@ -503,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);
@@ -548,4 +_,18 @@
@@ -549,4 +_,18 @@
public void setLevel(ServerLevel serverLevel) {
this.level = serverLevel;
}

View File

@@ -1,14 +1,6 @@
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 06:37:42 -0700
Subject: [PATCH] purpur File Patches
diff --git a/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
index 186393485396cfe9b1baef29586198356e2d2600..66d70c330fd70009018d8d0a7441b93fcef96c97 100644
--- a/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
+++ b/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
@@ -41,6 +41,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
@@ -43,6 +_,7 @@
private long keepAliveChallenge;
private long closedListenerTime;
private boolean closed = false;
@@ -16,7 +8,7 @@ index 186393485396cfe9b1baef29586198356e2d2600..66d70c330fd70009018d8d0a7441b93f
private int latency;
private volatile boolean suspendFlushingOnServerThread = false;
// CraftBukkit start
@@ -51,6 +52,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
@@ -53,6 +_,7 @@
public final java.util.Map<java.util.UUID, net.kyori.adventure.resource.ResourcePackCallback> packCallbacks = new java.util.concurrent.ConcurrentHashMap<>(); // Paper - adventure resource pack callbacks
private static final long KEEPALIVE_LIMIT = Long.getLong("paper.playerconnection.keepalive", 30) * 1000; // Paper - provide property to set keepalive limit
protected static final net.minecraft.resources.ResourceLocation MINECRAFT_BRAND = net.minecraft.resources.ResourceLocation.withDefaultNamespace("brand"); // Paper - Brand support
@@ -24,7 +16,7 @@ index 186393485396cfe9b1baef29586198356e2d2600..66d70c330fd70009018d8d0a7441b93f
public ServerCommonPacketListenerImpl(MinecraftServer server, Connection connection, CommonListenerCookie cookie, net.minecraft.server.level.ServerPlayer player) { // CraftBukkit
this.server = server;
@@ -118,6 +120,16 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
@@ -120,6 +_,16 @@
@Override
public void handleKeepAlive(ServerboundKeepAlivePacket packet) {
@@ -41,7 +33,7 @@ index 186393485396cfe9b1baef29586198356e2d2600..66d70c330fd70009018d8d0a7441b93f
if (this.keepAlivePending && packet.getId() == this.keepAliveChallenge) {
int i = (int)(Util.getMillis() - this.keepAliveTime);
this.latency = (this.latency * 3 + i) / 4;
@@ -169,6 +181,12 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
@@ -171,6 +_,12 @@
return;
}
@@ -54,7 +46,7 @@ index 186393485396cfe9b1baef29586198356e2d2600..66d70c330fd70009018d8d0a7441b93f
if (identifier.equals(MINECRAFT_BRAND)) {
this.player.clientBrandName = new net.minecraft.network.FriendlyByteBuf(io.netty.buffer.Unpooled.wrappedBuffer(data)).readUtf(256);
}
@@ -242,6 +260,22 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
@@ -250,6 +_,22 @@
// Paper start - give clients a longer time to respond to pings as per pre 1.12.2 timings
// This should effectively place the keepalive handling back to "as it was" before 1.12.2
final long elapsedTime = millis - this.keepAliveTime;

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
+++ b/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
@@ -308,7 +_,7 @@
@@ -306,7 +_,7 @@
ServerLoginPacketListenerImpl.LOGGER.warn("Failed to verify username but will let them in anyway!");
ServerLoginPacketListenerImpl.this.startClientVerification(ServerLoginPacketListenerImpl.this.createOfflineProfile(string1)); // Spigot
} else {

View File

@@ -1,14 +1,6 @@
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 06:37:42 -0700
Subject: [PATCH] purpur File Patches
diff --git a/net/minecraft/world/entity/ExperienceOrb.java b/net/minecraft/world/entity/ExperienceOrb.java
index c97a0e500e889b406cb2d679a3870715775f5393..81aa1a91a2ecda3053b22c2eb9e59f0ea2faf7b5 100644
--- a/net/minecraft/world/entity/ExperienceOrb.java
+++ b/net/minecraft/world/entity/ExperienceOrb.java
@@ -328,7 +328,7 @@ public class ExperienceOrb extends Entity {
@@ -358,7 +_,7 @@
public void playerTouch(Player entity) {
if (entity instanceof ServerPlayer serverPlayer) {
if (entity.takeXpDelay == 0 && new com.destroystokyo.paper.event.player.PlayerPickupExperienceEvent(serverPlayer.getBukkitEntity(), (org.bukkit.entity.ExperienceOrb) this.getBukkitEntity()).callEvent()) { // Paper - PlayerPickupExperienceEvent
@@ -17,7 +9,7 @@ index c97a0e500e889b406cb2d679a3870715775f5393..81aa1a91a2ecda3053b22c2eb9e59f0e
entity.take(this, 1);
int i = this.repairPlayerItems(serverPlayer, this.getValue());
if (i > 0) {
@@ -344,7 +344,7 @@ public class ExperienceOrb extends Entity {
@@ -374,7 +_,7 @@
}
private int repairPlayerItems(ServerPlayer player, int value) {

View File

@@ -1,14 +1,6 @@
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 06:37:42 -0700
Subject: [PATCH] purpur File Patches
diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java
index ef92dc4384f698cc6b5c4e67fe052a3d4af98f4c..20d9856daa5ef4c42010381091c2a85e0755fa77 100644
--- a/net/minecraft/world/entity/LivingEntity.java
+++ b/net/minecraft/world/entity/LivingEntity.java
@@ -430,6 +430,12 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -444,6 +_,12 @@
if (d < 0.0) {
double damagePerBlock = serverLevel1.getWorldBorder().getDamagePerBlock();
if (damagePerBlock > 0.0) {
@@ -21,7 +13,7 @@ index ef92dc4384f698cc6b5c4e67fe052a3d4af98f4c..20d9856daa5ef4c42010381091c2a85e
this.hurtServer(serverLevel1, this.damageSources().outOfBorder(), Math.max(1, Mth.floor(-d * damagePerBlock)));
}
}
@@ -442,10 +448,10 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -456,10 +_,10 @@
&& (!flag || !((Player)this).getAbilities().invulnerable);
if (flag1) {
this.setAirSupply(this.decreaseAirSupply(this.getAirSupply()));
@@ -34,7 +26,7 @@ index ef92dc4384f698cc6b5c4e67fe052a3d4af98f4c..20d9856daa5ef4c42010381091c2a85e
}
} else if (this.getAirSupply() < this.getMaxAirSupply()) {
this.setAirSupply(this.increaseAirSupply(this.getAirSupply()));
@@ -1014,15 +1020,33 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -1039,14 +_,32 @@
if (lookingEntity != null) {
ItemStack itemBySlot = this.getItemBySlot(EquipmentSlot.HEAD);
EntityType<?> type = lookingEntity.getType();
@@ -44,13 +36,15 @@ index ef92dc4384f698cc6b5c4e67fe052a3d4af98f4c..20d9856daa5ef4c42010381091c2a85e
- || type == EntityType.PIGLIN_BRUTE && itemBySlot.is(Items.PIGLIN_HEAD)
- || type == EntityType.CREEPER && itemBySlot.is(Items.CREEPER_HEAD)) {
- d *= 0.5;
- }
- }
+ // Purpur start - Mob head visibility percent
+ if (type == EntityType.SKELETON && itemBySlot.is(Items.SKELETON_SKULL)) {
+ d *= lookingEntity.level().purpurConfig.skeletonHeadVisibilityPercent;
+ }
+ else if (type == EntityType.ZOMBIE && itemBySlot.is(Items.ZOMBIE_HEAD)) {
+ d *= lookingEntity.level().purpurConfig.zombieHeadVisibilityPercent;
}
+ }
+ else if ((type == EntityType.PIGLIN || type == EntityType.PIGLIN_BRUTE) && itemBySlot.is(Items.PIGLIN_HEAD)) {
+ d *= lookingEntity.level().purpurConfig.piglinHeadVisibilityPercent;
+ }
@@ -58,8 +52,8 @@ index ef92dc4384f698cc6b5c4e67fe052a3d4af98f4c..20d9856daa5ef4c42010381091c2a85e
+ d *= lookingEntity.level().purpurConfig.creeperHeadVisibilityPercent;
+ }
+ // Purpur end - Mob head visibility percent
}
+ }
+
+ // Purpur start - Configurable mob blindness
+ if (lookingEntity instanceof LivingEntity entityliving) {
+ if (entityliving.hasEffect(MobEffects.BLINDNESS)) {
@@ -70,11 +64,10 @@ index ef92dc4384f698cc6b5c4e67fe052a3d4af98f4c..20d9856daa5ef4c42010381091c2a85e
+ }
+ }
+ // Purpur end - Configurable mob blindness
+
return d;
}
@@ -1068,6 +1092,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -1093,6 +_,7 @@
Iterator<MobEffectInstance> iterator = this.activeEffects.values().iterator();
while (iterator.hasNext()) {
MobEffectInstance effect = iterator.next();
@@ -82,7 +75,7 @@ index ef92dc4384f698cc6b5c4e67fe052a3d4af98f4c..20d9856daa5ef4c42010381091c2a85e
EntityPotionEffectEvent event = CraftEventFactory.callEntityPotionEffectChangeEvent(this, effect, null, cause, EntityPotionEffectEvent.Action.CLEARED);
if (event.isCancelled()) {
continue;
@@ -1385,6 +1410,24 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -1417,6 +_,24 @@
this.stopSleeping();
}
@@ -107,7 +100,7 @@ index ef92dc4384f698cc6b5c4e67fe052a3d4af98f4c..20d9856daa5ef4c42010381091c2a85e
this.noActionTime = 0;
if (amount < 0.0F) {
amount = 0.0F;
@@ -1646,10 +1689,10 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -1678,10 +_,10 @@
protected Player resolvePlayerResponsibleForDamage(DamageSource damageSource) {
Entity entity = damageSource.getEntity();
if (entity instanceof Player player) {
@@ -120,7 +113,7 @@ index ef92dc4384f698cc6b5c4e67fe052a3d4af98f4c..20d9856daa5ef4c42010381091c2a85e
} else {
this.lastHurtByPlayer = null;
this.lastHurtByPlayerMemoryTime = 0;
@@ -1700,6 +1743,18 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -1732,6 +_,18 @@
}
}
@@ -139,7 +132,7 @@ index ef92dc4384f698cc6b5c4e67fe052a3d4af98f4c..20d9856daa5ef4c42010381091c2a85e
final org.bukkit.inventory.EquipmentSlot handSlot = (hand != null) ? org.bukkit.craftbukkit.CraftEquipmentSlot.getHand(hand) : null;
final EntityResurrectEvent event = new EntityResurrectEvent((org.bukkit.entity.LivingEntity) this.getBukkitEntity(), handSlot);
event.setCancelled(itemStack == null);
@@ -1875,6 +1930,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -1907,6 +_,7 @@
boolean flag = this.lastHurtByPlayerMemoryTime > 0;
this.dropEquipment(level); // CraftBukkit - from below
if (this.shouldDropLoot() && level.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) {
@@ -147,7 +140,7 @@ index ef92dc4384f698cc6b5c4e67fe052a3d4af98f4c..20d9856daa5ef4c42010381091c2a85e
this.dropFromLootTable(level, damageSource, flag);
// Paper start
final boolean prev = this.clearEquipmentSlots;
@@ -1883,6 +1939,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -1915,6 +_,7 @@
// Paper end
this.dropCustomDeathLoot(level, damageSource, flag);
this.clearEquipmentSlots = prev; // Paper
@@ -155,7 +148,7 @@ index ef92dc4384f698cc6b5c4e67fe052a3d4af98f4c..20d9856daa5ef4c42010381091c2a85e
}
// CraftBukkit start - Call death event // Paper start - call advancement triggers with correct entity equipment
@@ -3057,6 +3114,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -3109,6 +_,7 @@
float f = (float)(d * 10.0 - 3.0);
if (f > 0.0F) {
this.playSound(this.getFallDamageSound((int)f), 1.0F, 1.0F);
@@ -163,16 +156,16 @@ index ef92dc4384f698cc6b5c4e67fe052a3d4af98f4c..20d9856daa5ef4c42010381091c2a85e
this.hurt(this.damageSources().flyIntoWall(), f);
}
}
@@ -4452,6 +4510,12 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -4507,6 +_,12 @@
? slot == EquipmentSlot.MAINHAND && this.canUseSlot(EquipmentSlot.MAINHAND)
: slot == equippable.slot() && this.canUseSlot(equippable.slot()) && equippable.canBeEquippedBy(this.getType());
}
+
+ // Purpur start - Dispenser curse of binding protection
+ public @Nullable EquipmentSlot getEquipmentSlotForDispenserItem(ItemStack itemstack) {
+ return EnchantmentHelper.getItemEnchantmentLevel(net.minecraft.world.item.enchantment.Enchantments.BINDING_CURSE, itemstack) > 0 ? null : this.getEquipmentSlotForItem(itemstack);
+ }
+ // Purpur end - Dispenser curse of binding protection
+
private static SlotAccess createEquipmentSlotAccess(LivingEntity entity, EquipmentSlot slot) {
return slot != EquipmentSlot.HEAD && slot != EquipmentSlot.MAINHAND && slot != EquipmentSlot.OFFHAND
? SlotAccess.forEquipmentSlot(entity, slot, itemStack -> itemStack.isEmpty() || entity.getEquipmentSlotForItem(itemStack) == slot)

View File

@@ -1,14 +1,6 @@
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 06:37:42 -0700
Subject: [PATCH] purpur File Patches
diff --git a/net/minecraft/world/entity/item/ItemEntity.java b/net/minecraft/world/entity/item/ItemEntity.java
index 6c0ebfb2be4e8b884456a2aa3d5fdc87e45a0e3c..4ddf1cdf7a47bf06f95c5bfce8f3c4d035e87cfc 100644
--- a/net/minecraft/world/entity/item/ItemEntity.java
+++ b/net/minecraft/world/entity/item/ItemEntity.java
@@ -59,6 +59,12 @@ public class ItemEntity extends Entity implements TraceableEntity {
@@ -56,6 +_,12 @@
public boolean canMobPickup = true; // Paper - Item#canEntityPickup
private int despawnRate = -1; // Paper - Alternative item-despawn-rate
public net.kyori.adventure.util.TriState frictionState = net.kyori.adventure.util.TriState.NOT_SET; // Paper - Friction API
@@ -21,7 +13,7 @@ index 6c0ebfb2be4e8b884456a2aa3d5fdc87e45a0e3c..4ddf1cdf7a47bf06f95c5bfce8f3c4d0
public ItemEntity(EntityType<? extends ItemEntity> entityType, Level level) {
super(entityType, level);
@@ -344,7 +350,16 @@ public class ItemEntity extends Entity implements TraceableEntity {
@@ -334,7 +_,16 @@
@Override
public final boolean hurtServer(ServerLevel level, DamageSource damageSource, float amount) {
@@ -39,7 +31,7 @@ index 6c0ebfb2be4e8b884456a2aa3d5fdc87e45a0e3c..4ddf1cdf7a47bf06f95c5bfce8f3c4d0
return false;
} else if (!level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) && damageSource.getEntity() instanceof Mob) {
return false;
@@ -528,6 +543,12 @@ public class ItemEntity extends Entity implements TraceableEntity {
@@ -513,6 +_,12 @@
public void setItem(ItemStack stack) {
this.getEntityData().set(DATA_ITEM, stack);
this.despawnRate = this.level().paperConfig().entities.spawning.altItemDespawnRate.enabled ? this.level().paperConfig().entities.spawning.altItemDespawnRate.items.getOrDefault(stack.getItem(), this.level().spigotConfig.itemDespawnRate) : this.level().spigotConfig.itemDespawnRate; // Paper - Alternative item-despawn-rate

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/Phantom.java
+++ b/net/minecraft/world/entity/monster/Phantom.java
@@ -169,7 +_,11 @@
@@ -174,7 +_,11 @@
ServerLevelAccessor level, DifficultyInstance difficulty, EntitySpawnReason spawnReason, @Nullable SpawnGroupData spawnGroupData
) {
this.anchorPoint = this.blockPosition().above(5);

View File

@@ -0,0 +1,143 @@
--- a/net/minecraft/world/entity/npc/Villager.java
+++ b/net/minecraft/world/entity/npc/Villager.java
@@ -179,6 +_,8 @@
MemoryModuleType.MEETING_POINT,
(villager, poiType) -> poiType.is(PoiTypes.MEETING)
);
+ private boolean isLobotomized = false; public boolean isLobotomized() { return this.isLobotomized; } // Purpur - Lobotomize stuck villagers
+ private int notLobotomizedCount = 0; // Purpur - Lobotomize stuck villagers
public Villager(EntityType<? extends Villager> entityType, Level level) {
this(entityType, level, VillagerType.PLAINS);
@@ -197,6 +_,57 @@
this.setVillagerData(this.getVillagerData().withType(villagerType).withProfession(level.registryAccess(), VillagerProfession.NONE));
}
+ // Purpur start - Allow leashing villagers
+ @Override
+ public boolean canBeLeashed() {
+ return level().purpurConfig.villagerCanBeLeashed;
+ }
+ // Purpur end - Allow leashing villagers
+
+ // Purpur start - Lobotomize stuck villagers
+ private boolean checkLobotomized() {
+ int interval = this.level().purpurConfig.villagerLobotomizeCheckInterval;
+ boolean shouldCheckForTradeLocked = this.level().purpurConfig.villagerLobotomizeWaitUntilTradeLocked;
+ if (this.notLobotomizedCount > 3) {
+ // check half as often if not lobotomized for the last 3+ consecutive checks
+ interval *= 2;
+ }
+ if (this.level().getGameTime() % interval == 0) {
+ // offset Y for short blocks like dirt_path/farmland
+ this.isLobotomized = !(shouldCheckForTradeLocked && this.getVillagerXp() == 0) && !canTravelFrom(BlockPos.containing(this.position().x, this.getBoundingBox().minY + 0.0625D, this.position().z));
+
+ if (this.isLobotomized) {
+ this.notLobotomizedCount = 0;
+ } else {
+ this.notLobotomizedCount++;
+ }
+ }
+ return this.isLobotomized;
+ }
+
+ private boolean canTravelFrom(BlockPos pos) {
+ return canTravelTo(pos.east()) || canTravelTo(pos.west()) || canTravelTo(pos.north()) || canTravelTo(pos.south());
+ }
+
+ private boolean canTravelTo(BlockPos pos) {
+ net.minecraft.world.level.block.state.BlockState state = this.level().getBlockStateIfLoaded(pos);
+ if (state == null) {
+ // chunk not loaded
+ return false;
+ }
+ net.minecraft.world.level.block.Block bottom = state.getBlock();
+ if (bottom instanceof net.minecraft.world.level.block.FenceBlock ||
+ bottom instanceof net.minecraft.world.level.block.FenceGateBlock ||
+ bottom instanceof net.minecraft.world.level.block.WallBlock) {
+ // bottom block is too tall to get over
+ return false;
+ }
+ net.minecraft.world.level.block.Block top = level().getBlockState(pos.above()).getBlock();
+ // only if both blocks have no collision
+ return !bottom.hasCollision && !top.hasCollision;
+ }
+ // Purpur end - Lobotomize stuck villagers
+
@Override
public Brain<Villager> getBrain() {
return (Brain<Villager>)super.getBrain();
@@ -293,11 +_,24 @@
// Paper start - EAR 2
this.customServerAiStep(level, false);
}
- protected void customServerAiStep(ServerLevel level, final boolean inactive) {
+ protected void customServerAiStep(ServerLevel level, boolean inactive) { // Purpur - Lobotomize stuck villagers - not final
// Paper end - EAR 2
ProfilerFiller profilerFiller = Profiler.get();
profilerFiller.push("villagerBrain");
- if (!inactive) this.getBrain().tick(level, this); // Paper - EAR 2
+ // Purpur start - Lobotomize stuck villagers
+ if (this.level().purpurConfig.villagerLobotomizeEnabled) {
+ // treat as inactive if lobotomized
+ inactive = inactive || checkLobotomized();
+ } else {
+ this.isLobotomized = false;
+ }
+ // Purpur end - Lobotomize stuck villagers
+ // Pufferfish start
+ if (!inactive /*&& this.behaviorTick++ % this.activatedPriority == 0*/) {
+ this.getBrain().tick(level, this); // Paper - EAR 2
+ }
+ else if (this.isLobotomized && shouldRestock()) restock(); // Purpur - Lobotomize stuck villagers
+ // Pufferfish end
profilerFiller.pop();
if (this.assignProfessionWhenSpawned) {
this.assignProfessionWhenSpawned = false;
@@ -369,6 +_,7 @@
return InteractionResult.CONSUME;
}
+ if (this.level().purpurConfig.villagerAllowTrading) // Purpur - Add config for villager trading
this.startTrading(player);
}
@@ -505,7 +_,7 @@
private void updateDemand() {
for (MerchantOffer merchantOffer : this.getOffers()) {
- merchantOffer.updateDemand();
+ merchantOffer.updateDemand(this.level().purpurConfig.villagerMinimumDemand); // Purpur - Configurable minimum demand for trades
}
}
@@ -698,7 +_,7 @@
@Override
public boolean canBreed() {
- return this.foodLevel + this.countFoodPointsInInventory() >= 12 && !this.isSleeping() && this.getAge() == 0;
+ return this.level().purpurConfig.villagerCanBreed && this.foodLevel + this.countFoodPointsInInventory() >= 12 && !this.isSleeping() && this.getAge() == 0; // Purpur - Configurable villager breeding
}
private boolean hungry() {
@@ -920,6 +_,7 @@
}
public void spawnGolemIfNeeded(ServerLevel serverLevel, long gameTime, int minVillagerAmount) {
+ if (serverLevel.purpurConfig.villagerSpawnIronGolemRadius > 0 && serverLevel.getEntitiesOfClass(net.minecraft.world.entity.animal.IronGolem.class, getBoundingBox().inflate(serverLevel.purpurConfig.villagerSpawnIronGolemRadius)).size() > serverLevel.purpurConfig.villagerSpawnIronGolemLimit) return; // Purpur - Implement configurable search radius for villagers to spawn iron golems
if (this.wantsToSpawnGolem(gameTime)) {
AABB aabb = this.getBoundingBox().inflate(10.0, 10.0, 10.0);
List<Villager> entitiesOfClass = serverLevel.getEntitiesOfClass(Villager.class, aabb);
@@ -993,6 +_,12 @@
@Override
public void startSleeping(BlockPos pos) {
+ // Purpur start - Option for beds to explode on villager sleep
+ if (level().purpurConfig.bedExplodeOnVillagerSleep && this.level().getBlockState(pos).getBlock() instanceof net.minecraft.world.level.block.BedBlock) {
+ this.level().explode(null, (double) pos.getX() + 0.5D, (double) pos.getY() + 0.5D, (double) pos.getZ() + 0.5D, (float) this.level().purpurConfig.bedExplosionPower, this.level().purpurConfig.bedExplosionFire, this.level().purpurConfig.bedExplosionEffect);
+ return;
+ }
+ // Purpur end - Option for beds to explode on villager sleep
super.startSleeping(pos);
this.brain.setMemory(MemoryModuleType.LAST_SLEPT, this.level().getGameTime());
this.brain.eraseMemory(MemoryModuleType.WALK_TARGET);

View File

@@ -1,14 +1,6 @@
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 06:37:42 -0700
Subject: [PATCH] purpur File Patches
diff --git a/net/minecraft/world/entity/player/Player.java b/net/minecraft/world/entity/player/Player.java
index 248ee263a853d1d3148746a63ba422115853f6a1..bd4d3a920e015db49436336cc180bc0b937750a0 100644
--- a/net/minecraft/world/entity/player/Player.java
+++ b/net/minecraft/world/entity/player/Player.java
@@ -210,11 +210,20 @@ public abstract class Player extends LivingEntity {
@@ -219,11 +_,20 @@
private int currentImpulseContextResetGraceTime = 0;
public boolean affectsSpawning = true; // Paper - Affects Spawning API
public net.kyori.adventure.util.TriState flyingFallDamage = net.kyori.adventure.util.TriState.NOT_SET; // Paper - flying fall damage
@@ -29,7 +21,7 @@ index 248ee263a853d1d3148746a63ba422115853f6a1..bd4d3a920e015db49436336cc180bc0b
@Override
public org.bukkit.craftbukkit.entity.CraftHumanEntity getBukkitEntity() {
return (org.bukkit.craftbukkit.entity.CraftHumanEntity) super.getBukkitEntity();
@@ -277,6 +286,12 @@ public abstract class Player extends LivingEntity {
@@ -287,6 +_,12 @@
@Override
public void tick() {
@@ -42,7 +34,7 @@ index 248ee263a853d1d3148746a63ba422115853f6a1..bd4d3a920e015db49436336cc180bc0b
this.noPhysics = this.isSpectator();
if (this.isSpectator() || this.isPassenger()) {
this.setOnGround(false);
@@ -355,6 +370,17 @@ public abstract class Player extends LivingEntity {
@@ -365,6 +_,17 @@
this.turtleHelmetTick();
}
@@ -60,7 +52,7 @@ index 248ee263a853d1d3148746a63ba422115853f6a1..bd4d3a920e015db49436336cc180bc0b
this.cooldowns.tick();
this.updatePlayerPose();
if (this.currentImpulseContextResetGraceTime > 0) {
@@ -620,7 +646,7 @@ public abstract class Player extends LivingEntity {
@@ -630,7 +_,7 @@
List<Entity> list = Lists.newArrayList();
for (Entity entity : entities) {
@@ -69,7 +61,7 @@ index 248ee263a853d1d3148746a63ba422115853f6a1..bd4d3a920e015db49436336cc180bc0b
list.add(entity);
} else if (!entity.isRemoved()) {
this.touch(entity);
@@ -1214,7 +1240,7 @@ public abstract class Player extends LivingEntity {
@@ -1226,7 +_,7 @@
flag2 = flag2 && !this.level().paperConfig().entities.behavior.disablePlayerCrits; // Paper - Toggleable player crits
if (flag2) {
damageSource = damageSource.critical(); // Paper - critical damage API
@@ -78,7 +70,7 @@ index 248ee263a853d1d3148746a63ba422115853f6a1..bd4d3a920e015db49436336cc180bc0b
}
float f2 = f + f1;
@@ -1811,7 +1837,23 @@ public abstract class Player extends LivingEntity {
@@ -1823,7 +_,23 @@
@Override
protected int getBaseExperienceReward(ServerLevel level) {
@@ -103,17 +95,17 @@ index 248ee263a853d1d3148746a63ba422115853f6a1..bd4d3a920e015db49436336cc180bc0b
}
@Override
@@ -1850,6 +1892,13 @@ public abstract class Player extends LivingEntity {
@@ -1861,6 +_,13 @@
public boolean addItem(ItemStack stack) {
return this.inventory.add(stack);
}
+
+ // Purpur start - Player ridable in water option
+ @Override
+ public boolean dismountsUnderwater() {
+ return !level().purpurConfig.playerRidableInWater;
+ }
+ // Purpur end - Player ridable in water option
+
public boolean setEntityOnShoulder(CompoundTag entityCompound) {
if (this.isPassenger() || !this.onGround() || this.isInWater() || this.isInPowderSnow) {
return false;

View File

@@ -1,14 +1,6 @@
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 06:37:42 -0700
Subject: [PATCH] purpur File Patches
diff --git a/net/minecraft/world/inventory/AnvilMenu.java b/net/minecraft/world/inventory/AnvilMenu.java
index 65c400444314049d5529f1f76d65fbd6b1ea7af2..bcffac9f7781ea489e8e4d778181b9ae2392590f 100644
--- a/net/minecraft/world/inventory/AnvilMenu.java
+++ b/net/minecraft/world/inventory/AnvilMenu.java
@@ -20,6 +20,12 @@ import net.minecraft.world.level.block.AnvilBlock;
@@ -21,6 +_,12 @@
import net.minecraft.world.level.block.state.BlockState;
import org.slf4j.Logger;
@@ -21,7 +13,7 @@ index 65c400444314049d5529f1f76d65fbd6b1ea7af2..bcffac9f7781ea489e8e4d778181b9ae
public class AnvilMenu extends ItemCombinerMenu {
public static final int INPUT_SLOT = 0;
public static final int ADDITIONAL_SLOT = 1;
@@ -49,6 +55,10 @@ public class AnvilMenu extends ItemCombinerMenu {
@@ -50,6 +_,10 @@
private org.bukkit.craftbukkit.inventory.view.CraftAnvilView bukkitEntity;
// CraftBukkit end
public boolean bypassEnchantmentLevelRestriction = false; // Paper - bypass anvil level restrictions
@@ -32,7 +24,7 @@ index 65c400444314049d5529f1f76d65fbd6b1ea7af2..bcffac9f7781ea489e8e4d778181b9ae
public AnvilMenu(int containerId, Inventory playerInventory) {
this(containerId, playerInventory, ContainerLevelAccess.NULL);
@@ -74,12 +84,17 @@ public class AnvilMenu extends ItemCombinerMenu {
@@ -75,12 +_,17 @@
@Override
protected boolean mayPickup(Player player, boolean hasStack) {
@@ -51,7 +43,7 @@ index 65c400444314049d5529f1f76d65fbd6b1ea7af2..bcffac9f7781ea489e8e4d778181b9ae
player.giveExperienceLevels(-this.cost.get());
}
@@ -126,13 +141,19 @@ public class AnvilMenu extends ItemCombinerMenu {
@@ -133,13 +_,19 @@
@Override
public void createResult() {
@@ -72,7 +64,7 @@ index 65c400444314049d5529f1f76d65fbd6b1ea7af2..bcffac9f7781ea489e8e4d778181b9ae
ItemStack itemStack = item.copy();
ItemStack item1 = this.inputSlots.getItem(1);
ItemEnchantments.Mutable mutable = new ItemEnchantments.Mutable(EnchantmentHelper.getEnchantmentsForCrafting(itemStack));
@@ -190,23 +211,34 @@ public class AnvilMenu extends ItemCombinerMenu {
@@ -197,23 +_,34 @@
int intValue = entry.getIntValue();
intValue = level == intValue ? intValue + 1 : Math.max(intValue, level);
Enchantment enchantment = holder.value();
@@ -111,7 +103,7 @@ index 65c400444314049d5529f1f76d65fbd6b1ea7af2..bcffac9f7781ea489e8e4d778181b9ae
intValue = enchantment.getMaxLevel();
}
@@ -235,6 +267,54 @@ public class AnvilMenu extends ItemCombinerMenu {
@@ -242,6 +_,54 @@
if (!this.itemName.equals(item.getHoverName().getString())) {
i1 = 1;
i += i1;
@@ -166,7 +158,7 @@ index 65c400444314049d5529f1f76d65fbd6b1ea7af2..bcffac9f7781ea489e8e4d778181b9ae
itemStack.set(DataComponents.CUSTOM_NAME, Component.literal(this.itemName));
}
} else if (item.has(DataComponents.CUSTOM_NAME)) {
@@ -259,6 +339,12 @@ public class AnvilMenu extends ItemCombinerMenu {
@@ -266,6 +_,12 @@
this.onlyRenaming = true;
}
@@ -179,7 +171,7 @@ index 65c400444314049d5529f1f76d65fbd6b1ea7af2..bcffac9f7781ea489e8e4d778181b9ae
if (this.cost.get() >= this.maximumRepairCost && !this.player.hasInfiniteMaterials()) { // CraftBukkit
itemStack = ItemStack.EMPTY;
}
@@ -279,6 +365,13 @@ public class AnvilMenu extends ItemCombinerMenu {
@@ -286,6 +_,13 @@
org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareAnvilEvent(this.getBukkitView(), itemStack); // CraftBukkit
this.broadcastChanges();
@@ -193,7 +185,7 @@ index 65c400444314049d5529f1f76d65fbd6b1ea7af2..bcffac9f7781ea489e8e4d778181b9ae
} else {
org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareAnvilEvent(this.getBukkitView(), ItemStack.EMPTY); // CraftBukkit
this.cost.set(AnvilMenu.DEFAULT_DENIED_COST); // CraftBukkit - use a variable for set a cost for denied item
@@ -287,7 +380,7 @@ public class AnvilMenu extends ItemCombinerMenu {
@@ -294,7 +_,7 @@
}
public static int calculateIncreasedRepairCost(int oldRepairCost) {

View File

@@ -9,9 +9,9 @@
// Paper start - Fire BlockExpEvent on grindstone use
org.bukkit.event.block.BlockExpEvent event = new org.bukkit.event.block.BlockExpEvent(org.bukkit.craftbukkit.block.CraftBlock.at(level, blockPos), this.getExperienceAmount(level));
event.callEvent();
- ExperienceOrb.award((ServerLevel) level, Vec3.atCenterOf(blockPos), event.getExpToDrop(), org.bukkit.entity.ExperienceOrb.SpawnReason.GRINDSTONE, player);
- ExperienceOrb.awardWithDirection((ServerLevel) level, Vec3.atCenterOf(blockPos), Vec3.ZERO, event.getExpToDrop(), org.bukkit.entity.ExperienceOrb.SpawnReason.GRINDSTONE, player, null);
+ org.purpurmc.purpur.event.inventory.GrindstoneTakeResultEvent grindstoneTakeResultEvent = new org.purpurmc.purpur.event.inventory.GrindstoneTakeResultEvent(player.getBukkitEntity(), getBukkitView(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemstack), event.getExpToDrop()); grindstoneTakeResultEvent.callEvent(); // Purpur - Grindstone API
+ ExperienceOrb.award((ServerLevel) level, Vec3.atCenterOf(blockPos), grindstoneTakeResultEvent.getExperienceAmount(), org.bukkit.entity.ExperienceOrb.SpawnReason.GRINDSTONE, player); // Purpur - Grindstone API
+ ExperienceOrb.awardWithDirection((ServerLevel) level, Vec3.atCenterOf(blockPos), Vec3.ZERO, grindstoneTakeResultEvent.getExperienceAmount(), org.bukkit.entity.ExperienceOrb.SpawnReason.GRINDSTONE, player, null); // Purpur - Grindstone API
// Paper end - Fire BlockExpEvent on grindstone use
}

View File

@@ -1,14 +1,6 @@
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 06:37:42 -0700
Subject: [PATCH] purpur File Patches
diff --git a/net/minecraft/world/level/BaseSpawner.java b/net/minecraft/world/level/BaseSpawner.java
index 650ebce14d618076cec2066d134d2ae51a87076a..0babc951d9fed6d32d3dba549cc5ced4dc6b0588 100644
--- a/net/minecraft/world/level/BaseSpawner.java
+++ b/net/minecraft/world/level/BaseSpawner.java
@@ -54,6 +54,7 @@ public abstract class BaseSpawner {
@@ -61,6 +_,7 @@
}
public boolean isNearPlayer(Level level, BlockPos pos) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/Level.java
+++ b/net/minecraft/world/level/Level.java
@@ -152,11 +_,55 @@
@@ -159,11 +_,55 @@
}
// Paper end - add paper world config
@@ -56,7 +56,7 @@
public CraftWorld getWorld() {
return this.world;
}
@@ -199,6 +_,8 @@
@@ -207,6 +_,8 @@
) {
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,7 +65,7 @@
this.generator = generator;
this.world = new CraftWorld((ServerLevel) this, generator, biomeProvider, environment);
@@ -1407,4 +_,14 @@
@@ -1417,4 +_,14 @@
return this.id;
}
}

View File

@@ -0,0 +1,11 @@
--- a/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
+++ b/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
@@ -49,7 +_,7 @@
// Paper start
private static void printOversizedLog(String msg, Path file, int x, int z) {
- org.apache.logging.log4j.LogManager.getLogger().fatal(msg + " (" + file.toString().replaceAll(".+[\\\\/]", "") + " - " + x + "," + z + ") Go clean it up to remove this message. /minecraft:tp " + (x<<4)+" 128 "+(z<<4) + " - DO NOT REPORT THIS TO PAPER - You may ask for help on Discord, but do not file an issue. These error messages can not be removed.");
+ org.apache.logging.log4j.LogManager.getLogger().fatal(msg + " (" + file.toString().replaceAll(".+[\\\\/]", "") + " - " + x + "," + z + ") Go clean it up to remove this message. /minecraft:tp " + (x<<4)+" 128 "+(z<<4) + " - DO NOT REPORT THIS TO PURPUR - You may ask for help on Discord, but do not file an issue. These error messages can not be removed."); // Purpur - Rebrand
}
private static CompoundTag readOversizedChunk(RegionFile regionfile, ChunkPos chunkCoordinate) throws IOException {