apply the rest of the minecraft file patches \o/

This commit is contained in:
granny
2025-06-01 14:33:08 -07:00
parent 994dd4f476
commit 89ee2e0c0f
33 changed files with 484 additions and 689 deletions

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/Commands.java b/net/minecraft/commands/Commands.java
index 1927163db5d44383b69f41e4b9855535e853d127..603feb73bb5b45eec5984d27d0f5cf98ccc8420c 100644
--- a/net/minecraft/commands/Commands.java
+++ b/net/minecraft/commands/Commands.java
@@ -222,7 +222,7 @@ public class Commands {
@@ -251,7 +_,7 @@
JfrCommand.register(this.dispatcher);
}
@@ -17,7 +9,7 @@ index 1927163db5d44383b69f41e4b9855535e853d127..603feb73bb5b45eec5984d27d0f5cf98
RaidCommand.register(this.dispatcher, context);
DebugPathCommand.register(this.dispatcher);
DebugMobSpawningCommand.register(this.dispatcher);
@@ -250,6 +250,14 @@ public class Commands {
@@ -279,6 +_,14 @@
StopCommand.register(this.dispatcher);
TransferCommand.register(this.dispatcher);
WhitelistCommand.register(this.dispatcher);
@@ -32,19 +24,20 @@ index 1927163db5d44383b69f41e4b9855535e853d127..603feb73bb5b45eec5984d27d0f5cf98
}
if (selection.includeIntegrated) {
@@ -502,6 +510,7 @@ public class Commands {
private void runSync(ServerPlayer player, java.util.Collection<String> bukkit, RootCommandNode<SharedSuggestionProvider> rootCommandNode) {
@@ -535,6 +_,7 @@
private void runSync(ServerPlayer player, java.util.Collection<String> bukkit, RootCommandNode<CommandSourceStack> rootCommandNode) {
// Paper end - Perf: Async command map building
new com.destroystokyo.paper.event.brigadier.AsyncPlayerSendCommandsEvent<CommandSourceStack>(player.getBukkitEntity(), (RootCommandNode) rootCommandNode, true).callEvent(); // Paper - Brigadier API
+ if (org.bukkit.event.player.PlayerCommandSendEvent.getHandlerList().getRegisteredListeners().length > 0) { // Purpur - Skip events if there's no listeners
org.bukkit.event.player.PlayerCommandSendEvent event = new org.bukkit.event.player.PlayerCommandSendEvent(player.getBukkitEntity(), new java.util.LinkedHashSet<>(bukkit));
event.getPlayer().getServer().getPluginManager().callEvent(event);
@@ -512,6 +521,7 @@ public class Commands {
@@ -545,6 +_,8 @@
}
}
// CraftBukkit end
+ } // Purpur - Skip events if there's no listeners
player.connection.send(new ClientboundCommandsPacket(rootCommandNode));
+
player.connection.send(new ClientboundCommandsPacket(rootCommandNode, COMMAND_NODE_INSPECTOR));
}

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/PlayerAdvancements.java b/net/minecraft/server/PlayerAdvancements.java
index 52e0ae233a7b1c88bfbbc27707ef5f18453ec865..bc5fe40ba202bf80b925f08ceee045e8a69a7d45 100644
--- a/net/minecraft/server/PlayerAdvancements.java
+++ b/net/minecraft/server/PlayerAdvancements.java
@@ -148,6 +148,7 @@ public class PlayerAdvancements {
@@ -147,6 +_,7 @@
AdvancementHolder advancementHolder = advancementManager.get(path);
if (advancementHolder == null) {
if (!path.getNamespace().equals(ResourceLocation.DEFAULT_NAMESPACE)) return; // CraftBukkit
@@ -16,10 +8,10 @@ index 52e0ae233a7b1c88bfbbc27707ef5f18453ec865..bc5fe40ba202bf80b925f08ceee045e8
LOGGER.warn("Ignored advancement '{}' in progress file {} - it doesn't exist anymore?", path, this.playerSavePath);
} else {
this.startProgress(advancementHolder, progress);
@@ -195,6 +196,7 @@ public class PlayerAdvancements {
@@ -194,6 +_,7 @@
advancement.value().display().ifPresent(displayInfo -> {
// Paper start - Add Adventure message to PlayerAdvancementDoneEvent
if (event.message() != null && this.player.serverLevel().getGameRules().getBoolean(GameRules.RULE_ANNOUNCE_ADVANCEMENTS)) {
if (event.message() != null && this.player.level().getGameRules().getBoolean(GameRules.RULE_ANNOUNCE_ADVANCEMENTS)) {
+ if (org.purpurmc.purpur.PurpurConfig.advancementOnlyBroadcastToAffectedPlayer) this.player.sendMessage(message); else // Purpur - Configurable broadcast settings
this.playerList.broadcastSystemMessage(io.papermc.paper.adventure.PaperAdventure.asVanilla(event.message()), false);
// Paper end

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/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java
index 3781d9cc174b7aecacb9b9855d52c7b1ff05835c..5ced523477c2b86e2b46182a77a9d991cf4cdd1f 100644
--- a/net/minecraft/server/level/ServerPlayer.java
+++ b/net/minecraft/server/level/ServerPlayer.java
@@ -420,6 +420,10 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
@@ -425,6 +_,10 @@
public @Nullable com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper - PlayerNaturallySpawnCreaturesEvent
public @Nullable String clientBrandName = null; // Paper - Brand support
public @Nullable org.bukkit.event.player.PlayerQuitEvent.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
@@ -17,30 +9,30 @@ index 3781d9cc174b7aecacb9b9855d52c7b1ff05835c..5ced523477c2b86e2b46182a77a9d991
+ private boolean compassBar = false; // Purpur - Add compass command
+ private boolean ramBar = false; // Purpur - Implement rambar commands
// Paper start - rewrite chunk system
private ca.spottedleaf.moonrise.patches.chunk_system.player.RegionizedPlayerChunkLoader.PlayerChunkLoaderData chunkLoader;
@@ -553,6 +557,10 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
this.respawnConfig = compound.read("respawn", ServerPlayer.RespawnConfig.CODEC).orElse(null);
this.spawnExtraParticlesOnFall = compound.getBooleanOr("spawn_extra_particles_on_fall", false);
this.raidOmenPosition = compound.read("raid_omen_position", BlockPos.CODEC).orElse(null);
public ServerPlayer(MinecraftServer server, ServerLevel level, GameProfile gameProfile, ClientInformation clientInformation) {
super(level, gameProfile);
@@ -528,6 +_,10 @@
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);
+
+ this.tpsBar = compound.getBooleanOr("Purpur.TPSBar", false); // Purpur - Implement TPSBar
+ this.compassBar = compound.getBooleanOr("Purpur.CompassBar", false); // Purpur - Add compass command
+ this.ramBar = compound.getBooleanOr("Purpur.RamBar", false); // Purpur - Implement rambar command
+ this.tpsBar = input.getBooleanOr("Purpur.TPSBar", false); // Purpur - Implement TPSBar
+ this.compassBar = input.getBooleanOr("Purpur.CompassBar", false); // Purpur - Add compass command
+ this.ramBar = input.getBooleanOr("Purpur.RamBar", false); // Purpur - Implement rambar command
}
@Override
@@ -570,6 +578,9 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
compound.storeNullable("raid_omen_position", BlockPos.CODEC, this.raidOmenPosition);
this.saveEnderPearls(compound);
this.getBukkitEntity().setExtraData(compound); // CraftBukkit
+ compound.putBoolean("Purpur.TPSBar", this.tpsBar); // Purpur - Implement TPSBar
+ compound.putBoolean("Purpur.CompassBar", this.compassBar); // Purpur - Add compass command
+ compound.putBoolean("Purpur.RamBar", this.ramBar); // Purpur - Add rambar command
@@ -545,6 +_,9 @@
output.storeNullable("raid_omen_position", BlockPos.CODEC, this.raidOmenPosition);
this.saveEnderPearls(output);
this.getBukkitEntity().setExtraData(output); // CraftBukkit
+ output.putBoolean("Purpur.TPSBar", this.tpsBar); // Purpur - Implement TPSBar
+ output.putBoolean("Purpur.CompassBar", this.compassBar); // Purpur - Add compass command
+ output.putBoolean("Purpur.RamBar", this.ramBar); // Purpur - Add rambar command
}
private void saveParentVehicle(CompoundTag tag) {
@@ -1063,6 +1074,7 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
private void saveParentVehicle(ValueOutput output) {
@@ -1041,6 +_,7 @@
// Paper - moved up to sendClientboundPlayerCombatKillPacket()
sendClientboundPlayerCombatKillPacket(event.getShowDeathMessages(), deathScreenMessage); // Paper - Expand PlayerDeathEvent
Team team = this.getTeam();
@@ -48,7 +40,7 @@ index 3781d9cc174b7aecacb9b9855d52c7b1ff05835c..5ced523477c2b86e2b46182a77a9d991
if (team == null || team.getDeathMessageVisibility() == Team.Visibility.ALWAYS) {
this.server.getPlayerList().broadcastSystemMessage(deathMessage, false);
} else if (team.getDeathMessageVisibility() == Team.Visibility.HIDE_FOR_OTHER_TEAMS) {
@@ -1169,6 +1181,13 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
@@ -1147,6 +_,13 @@
if (this.isInvulnerableTo(level, damageSource)) {
return false;
} else {
@@ -62,7 +54,7 @@ index 3781d9cc174b7aecacb9b9855d52c7b1ff05835c..5ced523477c2b86e2b46182a77a9d991
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))
@@ -1395,6 +1414,7 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
@@ -1391,6 +_,7 @@
serverLevel.removePlayerImmediately(this, Entity.RemovalReason.CHANGED_DIMENSION);
this.unsetRemoved();
// CraftBukkit end
@@ -70,19 +62,19 @@ index 3781d9cc174b7aecacb9b9855d52c7b1ff05835c..5ced523477c2b86e2b46182a77a9d991
this.setServerLevel(level);
this.connection.internalTeleport(PositionMoveRotation.of(teleportTransition), teleportTransition.relatives()); // CraftBukkit - use internal teleport without event
this.connection.resetPosition();
@@ -1512,7 +1532,7 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
@@ -1507,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.serverLevel(), this)
monster -> monster.isPreventingPlayerRest(this.level(), this)
);
- if (!entitiesOfClass.isEmpty()) {
+ if (!this.level().purpurConfig.playerSleepNearMonsters && !entitiesOfClass.isEmpty()) { // Purpur - Config to ignore nearby mobs when sleeping
return Either.left(Player.BedSleepingProblem.NOT_SAFE);
}
}
@@ -1549,7 +1569,19 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
@@ -1544,7 +_,19 @@
CriteriaTriggers.SLEPT_IN_BED.trigger(this);
});
if (!this.serverLevel().canSleepThroughNights()) {
if (!this.level().canSleepThroughNights()) {
- this.displayClientMessage(Component.translatable("sleep.not_possible"), true);
+ // Purpur start - Customizable sleeping actionbar messages
+ Component clientMessage;
@@ -99,8 +91,8 @@ index 3781d9cc174b7aecacb9b9855d52c7b1ff05835c..5ced523477c2b86e2b46182a77a9d991
+ // Purpur end - Customizable sleeping actionbar messages
}
((ServerLevel)this.level()).updateSleepingPlayerList();
@@ -1641,6 +1673,7 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
this.level().updateSleepingPlayerList();
@@ -1636,6 +_,7 @@
@Override
public void openTextEdit(SignBlockEntity signEntity, boolean isFrontText) {
@@ -108,7 +100,7 @@ index 3781d9cc174b7aecacb9b9855d52c7b1ff05835c..5ced523477c2b86e2b46182a77a9d991
this.connection.send(new ClientboundBlockUpdatePacket(this.level(), signEntity.getBlockPos()));
this.connection.send(new ClientboundOpenSignEditorPacket(signEntity.getBlockPos(), isFrontText));
}
@@ -1943,6 +1976,26 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
@@ -1945,6 +_,26 @@
this.lastSentExp = -1; // CraftBukkit - Added to reset
}
@@ -135,7 +127,7 @@ index 3781d9cc174b7aecacb9b9855d52c7b1ff05835c..5ced523477c2b86e2b46182a77a9d991
@Override
public void displayClientMessage(Component chatComponent, boolean actionBar) {
this.sendSystemMessage(chatComponent, actionBar);
@@ -2160,6 +2213,20 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
@@ -2163,6 +_,20 @@
);
}
@@ -156,13 +148,14 @@ index 3781d9cc174b7aecacb9b9855d52c7b1ff05835c..5ced523477c2b86e2b46182a77a9d991
public void sendSystemMessage(Component mesage) {
this.sendSystemMessage(mesage, false);
}
@@ -2298,8 +2365,68 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
@@ -2301,7 +_,67 @@
public void resetLastActionTime() {
this.lastActionTime = Util.getMillis();
- }
+ this.setAfk(false); // Purpur - AFK API
}
+ }
+
+ // Purpur start - AFK API
+ private boolean isAfk = false;
+
@@ -221,11 +214,10 @@ index 3781d9cc174b7aecacb9b9855d52c7b1ff05835c..5ced523477c2b86e2b46182a77a9d991
+ return !this.isAfk() && super.canBeCollidedWith();
+ }
+ // Purpur end - AFK API
+
public ServerStatsCounter getStats() {
return this.stats;
}
@@ -2926,4 +3053,56 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
@@ -2929,4 +_,56 @@
return (org.bukkit.craftbukkit.entity.CraftPlayer) super.getBukkitEntity();
}
// CraftBukkit end

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/ServerGamePacketListenerImpl.java b/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 9041830c19e2899479e1519488faba5c416ccd88..bf8a8124145e4339cadcc83691f076bdad3ec43d 100644
--- a/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -321,6 +321,20 @@ public class ServerGamePacketListenerImpl
@@ -324,6 +_,20 @@
this.tickEndEvent = new io.papermc.paper.event.packet.ClientTickEndEvent(player.getBukkitEntity()); // Paper - add client tick end event
}
@@ -29,7 +21,7 @@ index 9041830c19e2899479e1519488faba5c416ccd88..bf8a8124145e4339cadcc83691f076bd
@Override
public void tick() {
if (this.ackBlockChangesUpTo > -1) {
@@ -379,6 +393,12 @@ public class ServerGamePacketListenerImpl
@@ -382,6 +_,12 @@
if (this.player.getLastActionTime() > 0L
&& this.server.getPlayerIdleTimeout() > 0
&& Util.getMillis() - this.player.getLastActionTime() > this.server.getPlayerIdleTimeout() * 1000L * 60L && !this.player.wonGame) { // Paper - Prevent AFK kick while watching end credits
@@ -42,7 +34,7 @@ index 9041830c19e2899479e1519488faba5c416ccd88..bf8a8124145e4339cadcc83691f076bd
this.player.resetLastActionTime(); // CraftBukkit - SPIGOT-854
this.disconnect(Component.translatable("multiplayer.disconnect.idling"), org.bukkit.event.player.PlayerKickEvent.Cause.IDLING); // Paper - kick event cause
}
@@ -624,6 +644,8 @@ public class ServerGamePacketListenerImpl
@@ -641,6 +_,8 @@
this.lastYaw = to.getYaw();
this.lastPitch = to.getPitch();
@@ -51,15 +43,15 @@ index 9041830c19e2899479e1519488faba5c416ccd88..bf8a8124145e4339cadcc83691f076bd
Location oldTo = to.clone();
PlayerMoveEvent event = new PlayerMoveEvent(player, from, to);
this.cserver.getPluginManager().callEvent(event);
@@ -703,6 +725,7 @@ public class ServerGamePacketListenerImpl
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
@@ -697,6 +_,7 @@
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.level());
if (packet.getId() == this.awaitingTeleport) {
if (this.awaitingPositionFromClient == null) {
+ ServerGamePacketListenerImpl.LOGGER.warn("Disconnected on accept teleport packet. Was not expecting position data from client at this time"); // Purpur - Add more logger output for invalid movement kicks
this.disconnect(Component.translatable("multiplayer.disconnect.invalid_player_movement"), org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_PLAYER_MOVEMENT); // Paper - kick event cause
return;
}
@@ -1233,6 +1256,10 @@ public class ServerGamePacketListenerImpl
@@ -1230,6 +_,10 @@
final int maxBookPageSize = pageMax.intValue();
final double multiplier = Math.clamp(io.papermc.paper.configuration.GlobalConfiguration.get().itemValidation.bookSize.totalMultiplier, 0.3D, 1D);
long byteAllowed = maxBookPageSize;
@@ -70,7 +62,7 @@ index 9041830c19e2899479e1519488faba5c416ccd88..bf8a8124145e4339cadcc83691f076bd
for (final String page : pageList) {
final int byteLength = page.getBytes(java.nio.charset.StandardCharsets.UTF_8).length;
byteTotal += byteLength;
@@ -1257,7 +1284,8 @@ public class ServerGamePacketListenerImpl
@@ -1254,7 +_,8 @@
}
if (byteTotal > byteAllowed) {
@@ -80,7 +72,7 @@ index 9041830c19e2899479e1519488faba5c416ccd88..bf8a8124145e4339cadcc83691f076bd
this.disconnectAsync(Component.literal("Book too large!"), org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_ACTION); // Paper - kick event cause // Paper - add proper async disconnect
return;
}
@@ -1276,31 +1304,45 @@ public class ServerGamePacketListenerImpl
@@ -1273,31 +_,45 @@
Optional<String> optional = packet.title();
optional.ifPresent(list::add);
list.addAll(packet.pages());
@@ -130,7 +122,7 @@ index 9041830c19e2899479e1519488faba5c416ccd88..bf8a8124145e4339cadcc83691f076bd
itemStack.set(
DataComponents.WRITTEN_BOOK_CONTENT,
new WrittenBookContent(this.filterableFromOutgoing(title), this.player.getName().getString(), 0, list, true)
@@ -1314,6 +1356,16 @@ public class ServerGamePacketListenerImpl
@@ -1311,6 +_,16 @@
return this.player.isTextFilteringEnabled() ? Filterable.passThrough(filteredText.filteredOrEmpty()) : Filterable.from(filteredText);
}
@@ -146,11 +138,11 @@ index 9041830c19e2899479e1519488faba5c416ccd88..bf8a8124145e4339cadcc83691f076bd
+
@Override
public void handleEntityTagQuery(ServerboundEntityTagQueryPacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
@@ -1349,7 +1401,15 @@ public class ServerGamePacketListenerImpl
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.level());
@@ -1350,7 +_,15 @@
@Override
public void handleMovePlayer(ServerboundMovePlayerPacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.level());
- if (containsInvalidValues(packet.getX(0.0), packet.getY(0.0), packet.getZ(0.0), packet.getYRot(0.0F), packet.getXRot(0.0F))) {
+ // Purpur start - Add more logger output for invalid movement kicks
+ boolean invalidX = Double.isNaN(packet.getX(0.0));
@@ -163,8 +155,8 @@ index 9041830c19e2899479e1519488faba5c416ccd88..bf8a8124145e4339cadcc83691f076bd
+ // Purpur end - Add more logger output for invalid movement kicks
this.disconnect(Component.translatable("multiplayer.disconnect.invalid_player_movement"), org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_PLAYER_MOVEMENT); // Paper - kick event cause
} else {
ServerLevel serverLevel = this.player.serverLevel();
@@ -1531,7 +1591,7 @@ public class ServerGamePacketListenerImpl
ServerLevel serverLevel = this.player.level();
@@ -1531,7 +_,7 @@
movedWrongly = true;
if (event.getLogWarning())
// Paper end
@@ -173,7 +165,7 @@ index 9041830c19e2899479e1519488faba5c416ccd88..bf8a8124145e4339cadcc83691f076bd
} // Paper
}
@@ -1597,6 +1657,8 @@ public class ServerGamePacketListenerImpl
@@ -1586,6 +_,8 @@
this.lastYaw = to.getYaw();
this.lastPitch = to.getPitch();
@@ -182,7 +174,7 @@ index 9041830c19e2899479e1519488faba5c416ccd88..bf8a8124145e4339cadcc83691f076bd
Location oldTo = to.clone();
PlayerMoveEvent event = new PlayerMoveEvent(player, from, to);
this.cserver.getPluginManager().callEvent(event);
@@ -1652,6 +1714,13 @@ public class ServerGamePacketListenerImpl
@@ -1641,6 +_,13 @@
this.player.tryResetCurrentImpulseContext();
}
@@ -196,7 +188,7 @@ index 9041830c19e2899479e1519488faba5c416ccd88..bf8a8124145e4339cadcc83691f076bd
this.player.checkMovementStatistics(this.player.getX() - x, this.player.getY() - y, this.player.getZ() - z);
this.lastGoodX = this.player.getX();
this.lastGoodY = this.player.getY();
@@ -1669,6 +1738,17 @@ public class ServerGamePacketListenerImpl
@@ -1658,6 +_,17 @@
}
}
@@ -214,7 +206,7 @@ index 9041830c19e2899479e1519488faba5c416ccd88..bf8a8124145e4339cadcc83691f076bd
private boolean shouldCheckPlayerMovement(boolean isElytraMovement) {
if (this.isSingleplayerOwner()) {
return false;
@@ -2065,6 +2145,7 @@ public class ServerGamePacketListenerImpl
@@ -2028,6 +_,7 @@
boolean cancelled;
if (hitResult == null || hitResult.getType() != HitResult.Type.BLOCK) {
@@ -222,7 +214,7 @@ index 9041830c19e2899479e1519488faba5c416ccd88..bf8a8124145e4339cadcc83691f076bd
org.bukkit.event.player.PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(this.player, Action.RIGHT_CLICK_AIR, itemInHand, hand);
cancelled = event.useItemInHand() == Event.Result.DENY;
} else {
@@ -2737,6 +2818,7 @@ public class ServerGamePacketListenerImpl
@@ -2679,6 +_,7 @@
AABB boundingBox = target.getBoundingBox();
if (this.player.canInteractWithEntity(boundingBox, io.papermc.paper.configuration.GlobalConfiguration.get().misc.clientInteractionLeniencyDistance.or(3.0))) { // Paper - configurable lenience value for interact range

View File

@@ -1,30 +1,23 @@
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/players/PlayerList.java b/net/minecraft/server/players/PlayerList.java
index 9ca3c55a3b5b1a532b86b08eb92460df4cb54f2a..f7b12d5924005a24899aef11746b9f056fac3559 100644
--- a/net/minecraft/server/players/PlayerList.java
+++ b/net/minecraft/server/players/PlayerList.java
@@ -400,6 +400,7 @@ public abstract class PlayerList {
scoreboard.addPlayerToTeam(player.getScoreboardName(), collideRuleTeam);
}
// Paper end - Configurable player collision
+ org.purpurmc.purpur.task.BossBarTask.addToAll(player); // Purpur - Implement TPSBar
PlayerList.LOGGER.info("{}[{}] logged in with entity id {} at ([{}]{}, {}, {})", player.getName().getString(), loggableAddress, player.getId(), serverLevel.serverLevelData.getLevelName(), player.getX(), player.getY(), player.getZ());
// Paper start - Send empty chunk, so players aren't stuck in the world loading screen with our chunk system not sending chunks when dead
if (player.isDeadOrDying()) {
@@ -505,6 +506,7 @@ public abstract class PlayerList {
@@ -406,7 +_,7 @@
scoreboard.addPlayerToTeam(player.getScoreboardName(), collideRuleTeam);
}
// Paper end - Configurable player collision
- PlayerList.LOGGER.info("{}[{}] logged in with entity id {} at ([{}]{}, {}, {})", player.getName().getString(), loggableAddress, player.getId(), serverLevel.serverLevelData.getLevelName(), player.getX(), player.getY(), player.getZ());
+ org.purpurmc.purpur.task.BossBarTask.addToAll(player); // Purpur - Implement TPSBarPlayerList.LOGGER.info("{}[{}] logged in with entity id {} at ([{}]{}, {}, {})", player.getName().getString(), loggableAddress, player.getId(), serverLevel.serverLevelData.getLevelName(), player.getX(), player.getY(), player.getZ());
// Paper start - Send empty chunk, so players aren't stuck in the world loading screen with our chunk system not sending chunks when dead
if (player.isDeadOrDying()) {
net.minecraft.core.Holder<net.minecraft.world.level.biome.Biome> plains = serverLevel.registryAccess().lookupOrThrow(net.minecraft.core.registries.Registries.BIOME)
@@ -512,6 +_,7 @@
}
public @Nullable net.kyori.adventure.text.Component remove(ServerPlayer player, net.kyori.adventure.text.Component leaveMessage) {
// Paper end - Fix kick event leave message not being sent
+ org.purpurmc.purpur.task.BossBarTask.removeFromAll(player.getBukkitEntity()); // Purpur - Implement TPSBar
ServerLevel serverLevel = player.serverLevel();
ServerLevel serverLevel = player.level();
player.awardStat(Stats.LEAVE_GAME);
// CraftBukkit start - Quitting must be before we do final save of data, in case plugins need to modify it
@@ -663,7 +665,7 @@ public abstract class PlayerList {
@@ -670,7 +_,7 @@
// return this.players.size() >= this.maxPlayers && !this.canBypassPlayerLimit(gameProfile)
// ? Component.translatable("multiplayer.disconnect.server_full")
// : null;
@@ -33,7 +26,7 @@ index 9ca3c55a3b5b1a532b86b08eb92460df4cb54f2a..f7b12d5924005a24899aef11746b9f05
event.disallow(org.bukkit.event.player.PlayerLoginEvent.Result.KICK_FULL, net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(org.spigotmc.SpigotConfig.serverFullMessage)); // Spigot // Paper - Adventure
}
}
@@ -932,6 +934,20 @@ public abstract class PlayerList {
@@ -932,6 +_,20 @@
}
}
@@ -54,7 +47,7 @@ index 9ca3c55a3b5b1a532b86b08eb92460df4cb54f2a..f7b12d5924005a24899aef11746b9f05
public void broadcastAll(Packet<?> packet, ResourceKey<Level> dimension) {
for (ServerPlayer serverPlayer : this.players) {
if (serverPlayer.level().dimension() == dimension) {
@@ -1016,6 +1032,7 @@ public abstract class PlayerList {
@@ -1016,6 +_,7 @@
} else {
b = (byte)(24 + permLevel);
}

View File

@@ -1,22 +1,14 @@
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/Entity.java b/net/minecraft/world/entity/Entity.java
index 22d91f99c50e3b3b88ccab4eb5d1b71be5a9dcd8..b8a0abd1cbdc0c86ae9e68ebaeec14cd4728450e 100644
--- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java
@@ -141,6 +141,7 @@ import net.minecraft.world.scores.Team;
import org.jetbrains.annotations.Contract;
@@ -147,6 +_,7 @@
import org.slf4j.Logger;
public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess, ScoreHolder, DataComponentGetter, ca.spottedleaf.moonrise.patches.chunk_system.entity.ChunkSystemEntity, ca.spottedleaf.moonrise.patches.entity_tracker.EntityTrackerEntity { // Paper - rewrite chunk system // Paper - optimise entity tracker
public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess, ScoreHolder, DataComponentGetter {
+ public static javax.script.ScriptEngine scriptEngine = new javax.script.ScriptEngineManager().getEngineByName("rhino"); // Purpur - Configurable entity base attributes
// CraftBukkit start
private static final org.slf4j.Logger LOGGER = com.mojang.logging.LogUtils.getLogger();
private static final int CURRENT_LEVEL = 2;
@@ -260,8 +261,9 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
public boolean preserveMotion = true; // Paper - Fix Entity Teleportation and cancel velocity if teleported; keep initial motion on first snapTo
@@ -323,8 +_,9 @@
public double xOld;
public double yOld;
public double zOld;
@@ -25,9 +17,9 @@ index 22d91f99c50e3b3b88ccab4eb5d1b71be5a9dcd8..b8a0abd1cbdc0c86ae9e68ebaeec14cd
- public final RandomSource random = SHARED_RANDOM; // Paper - Share random for entities to make them more random
+ public final RandomSource random; // Paper - Share random for entities to make them more random // Add toggle for RNG manipulation
public int tickCount;
private int remainingFireTicks = -this.getFireImmuneTicks();
private int remainingFireTicks;
public boolean wasTouchingWater;
@@ -295,8 +297,8 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -358,8 +_,8 @@
public PortalProcessor portalProcess;
public int portalCooldown;
private boolean invulnerable;
@@ -38,7 +30,7 @@ index 22d91f99c50e3b3b88ccab4eb5d1b71be5a9dcd8..b8a0abd1cbdc0c86ae9e68ebaeec14cd
private boolean hasGlowingTag;
private final Set<String> tags = new io.papermc.paper.util.SizeLimitedSet<>(new it.unimi.dsi.fastutil.objects.ObjectOpenHashSet<>(), MAX_ENTITY_TAG_COUNT); // Paper - fully limit tag size - replace set impl
private final double[] pistonDeltas = new double[]{0.0, 0.0, 0.0};
@@ -350,6 +352,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -414,6 +_,7 @@
public long activatedTick = Integer.MIN_VALUE;
public boolean isTemporarilyActive;
public long activatedImmunityTick = Integer.MIN_VALUE;
@@ -46,9 +38,9 @@ index 22d91f99c50e3b3b88ccab4eb5d1b71be5a9dcd8..b8a0abd1cbdc0c86ae9e68ebaeec14cd
public void inactiveTick() {
}
@@ -512,10 +515,21 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -426,10 +_,21 @@
}
// Paper end - optimise entity tracker
// Paper end
+ // Purpur start - Add canSaveToDisk to Entity
+ public boolean canSaveToDisk() {
@@ -68,7 +60,7 @@ index 22d91f99c50e3b3b88ccab4eb5d1b71be5a9dcd8..b8a0abd1cbdc0c86ae9e68ebaeec14cd
this.position = Vec3.ZERO;
this.blockPosition = BlockPos.ZERO;
this.chunkPosition = ChunkPos.ZERO;
@@ -885,6 +899,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -804,6 +_,7 @@
&& this.level.paperConfig().environment.netherCeilingVoidDamageHeight.test(v -> this.getY() >= v)
&& (!(this instanceof Player player) || !player.getAbilities().invulnerable))) {
// Paper end - Configurable nether ceiling damage
@@ -76,7 +68,7 @@ index 22d91f99c50e3b3b88ccab4eb5d1b71be5a9dcd8..b8a0abd1cbdc0c86ae9e68ebaeec14cd
this.onBelowWorld();
}
}
@@ -1830,7 +1845,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -1741,7 +_,7 @@
}
public boolean fireImmune() {
@@ -85,52 +77,50 @@ index 22d91f99c50e3b3b88ccab4eb5d1b71be5a9dcd8..b8a0abd1cbdc0c86ae9e68ebaeec14cd
}
public boolean causeFallDamage(double fallDistance, float damageMultiplier, DamageSource damageSource) {
@@ -1890,7 +1905,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -1816,7 +_,7 @@
return this.isInWater() || flag;
}
- public void updateInWaterStateAndDoWaterCurrentPushing() {
- void updateInWaterStateAndDoWaterCurrentPushing() {
+ public void updateInWaterStateAndDoWaterCurrentPushing() { // Purpur - Movement options for armor stands - package-private -> public - TODO: use AT file
if (this.getVehicle() instanceof AbstractBoat abstractBoat && !abstractBoat.isUnderWater()) {
this.wasTouchingWater = false;
} else if (this.updateFluidHeightAndDoFluidPushing(FluidTags.WATER, 0.014)) {
@@ -2516,6 +2531,13 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
compound.putBoolean("Paper.FreezeLock", true);
@@ -2437,6 +_,11 @@
output.putBoolean("Paper.FreezeLock", true);
}
// Paper end
+
+ // Purpur start - Fire immune API
+ if (immuneToFire != null) {
+ compound.putBoolean("Purpur.FireImmune", immuneToFire);
+ output.putBoolean("Purpur.FireImmune", immuneToFire);
+ }
+ // Purpur end - Fire immune API
+
return compound;
} catch (Throwable var8) {
CrashReport crashReport = CrashReport.forThrowable(var8, "Saving entity NBT");
@@ -2646,6 +2668,13 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
freezeLocked = compound.getBooleanOr("Paper.FreezeLock", false);
} catch (Throwable var7) {
CrashReport crashReport = CrashReport.forThrowable(var7, "Saving entity NBT");
CrashReportCategory crashReportCategory = crashReport.addCategory("Entity being saved");
@@ -2557,6 +_,13 @@
}
freezeLocked = input.getBooleanOr("Paper.FreezeLock", false);
// Paper end
+
+ // Purpur start - Fire immune API
+ if (compound.contains("Purpur.FireImmune")) {
+ immuneToFire = compound.getBoolean("Purpur.FireImmune").orElse(null);
+ if (input.contains("Purpur.FireImmune")) {
+ immuneToFire = input.getBoolean("Purpur.FireImmune").orElse(null);
+ }
+ // Purpur end - Fire immune API
+
} catch (Throwable var8) {
CrashReport crashReport = CrashReport.forThrowable(var8, "Loading entity NBT");
} catch (Throwable var7) {
CrashReport crashReport = CrashReport.forThrowable(var7, "Loading entity NBT");
CrashReportCategory crashReportCategory = crashReport.addCategory("Entity being loaded");
@@ -2874,6 +2903,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
if (this.isAlive() && this instanceof Leashable leashable) {
if (leashable.getLeashHolder() == player) {
if (!this.level().isClientSide()) {
+ if (hand == InteractionHand.OFF_HAND && (level().purpurConfig.villagerCanBeLeashed || level().purpurConfig.wanderingTraderCanBeLeashed) && this instanceof net.minecraft.world.entity.npc.AbstractVillager) return InteractionResult.CONSUME; // Purpur - Allow leashing villagers
// CraftBukkit start - fire PlayerUnleashEntityEvent
// Paper start - Expand EntityUnleashEvent
org.bukkit.event.player.PlayerUnleashEntityEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerUnleashEntityEvent(this, player, hand, !player.hasInfiniteMaterials());
@@ -3190,15 +3220,18 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -2746,6 +_,7 @@
if (this.isAlive() && this instanceof Leashable leashable2) {
if (leashable2.getLeashHolder() == player) {
if (!this.level().isClientSide()) {
+ if (hand == InteractionHand.OFF_HAND && (level().purpurConfig.villagerCanBeLeashed || level().purpurConfig.wanderingTraderCanBeLeashed) && this instanceof net.minecraft.world.entity.npc.AbstractVillager) return InteractionResult.CONSUME; // Purpur - Allow leashing villagers
// Paper start - EntityUnleashEvent
if (!org.bukkit.craftbukkit.event.CraftEventFactory.handlePlayerUnleashEntityEvent(
leashable2, player, hand, !player.hasInfiniteMaterials()
@@ -3151,15 +_,18 @@
return Vec3.directionFromRotation(this.getRotationVector());
}
@@ -150,7 +140,7 @@ index 22d91f99c50e3b3b88ccab4eb5d1b71be5a9dcd8..b8a0abd1cbdc0c86ae9e68ebaeec14cd
}
}
}
@@ -3403,7 +3436,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -3364,7 +_,7 @@
}
public int getMaxAirSupply() {
@@ -159,7 +149,7 @@ index 22d91f99c50e3b3b88ccab4eb5d1b71be5a9dcd8..b8a0abd1cbdc0c86ae9e68ebaeec14cd
}
public int getAirSupply() {
@@ -3931,7 +3964,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -3909,7 +_,7 @@
// CraftBukkit end
public boolean canUsePortal(boolean allowPassengers) {
@@ -168,7 +158,7 @@ index 22d91f99c50e3b3b88ccab4eb5d1b71be5a9dcd8..b8a0abd1cbdc0c86ae9e68ebaeec14cd
}
public boolean canTeleport(Level fromLevel, Level toLevel) {
@@ -4468,6 +4501,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -4432,6 +_,12 @@
return Mth.lerp(partialTick, this.yRotO, this.yRot);
}
@@ -178,10 +168,10 @@ index 22d91f99c50e3b3b88ccab4eb5d1b71be5a9dcd8..b8a0abd1cbdc0c86ae9e68ebaeec14cd
+ }
+ // Purpur end - Stop squids floating on top of water
+
// Paper start - optimise collisions
public boolean updateFluidHeightAndDoFluidPushing(final TagKey<Fluid> fluid, final double flowScale) {
public boolean updateFluidHeightAndDoFluidPushing(TagKey<Fluid> fluidTag, double motionScale) {
if (this.touchingUnloadedChunk()) {
@@ -4876,7 +4915,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
return false;
@@ -4795,7 +_,7 @@
}
public float maxUpStep() {

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/EntityType.java b/net/minecraft/world/entity/EntityType.java
index ed11697d81789ee6cd48ee2de2c9fcb8ff2be0d4..d6a0ad078fd1f0350afaac3f1743896d73b015e1 100644
--- a/net/minecraft/world/entity/EntityType.java
+++ b/net/minecraft/world/entity/EntityType.java
@@ -1095,6 +1095,16 @@ public class EntityType<T extends Entity> implements FeatureElement, EntityTypeT
@@ -1105,6 +_,16 @@
return register(vanillaEntityId(key), builder);
}
@@ -25,7 +17,7 @@ index ed11697d81789ee6cd48ee2de2c9fcb8ff2be0d4..d6a0ad078fd1f0350afaac3f1743896d
public static ResourceLocation getKey(EntityType<?> entityType) {
return BuiltInRegistries.ENTITY_TYPE.getKey(entityType);
}
@@ -1325,6 +1335,16 @@ public class EntityType<T extends Entity> implements FeatureElement, EntityTypeT
@@ -1335,6 +_,16 @@
return this.category;
}
@@ -42,14 +34,14 @@ index ed11697d81789ee6cd48ee2de2c9fcb8ff2be0d4..d6a0ad078fd1f0350afaac3f1743896d
public String getDescriptionId() {
return this.descriptionId;
}
@@ -1384,7 +1404,11 @@ public class EntityType<T extends Entity> implements FeatureElement, EntityTypeT
entity.load(tag);
},
// Paper end - Don't fire sync event during generation
- () -> LOGGER.warn("Skipping Entity with id {}", tag.getStringOr("id", "[invalid]"))
@@ -1394,7 +_,11 @@
entity.load(input);
},
// Paper end - Don't fire sync event during generation
- () -> LOGGER.warn("Skipping Entity with id {}", input.getStringOr("id", "[invalid]"))
+ // Purpur start - log skipped entity's position
+ () -> {LOGGER.warn("Skipping Entity with id {}", tag.getStringOr("id", "[invalid]"));
+ EntityType.LOGGER.warn("Location: {} {}", level.getWorld().getName(), tag.read("Pos", net.minecraft.world.phys.Vec3.CODEC).orElse(net.minecraft.world.phys.Vec3.ZERO));
+ () -> {LOGGER.warn("Skipping Entity with id {}", input.getStringOr("id", "[invalid]"));
+ EntityType.LOGGER.warn("Location: {} {}", level.getWorld().getName(), input.read("Pos", net.minecraft.world.phys.Vec3.CODEC).orElse(net.minecraft.world.phys.Vec3.ZERO));
+ }
+ // Purpur end - log skipped entity's position
);

View File

@@ -1,22 +1,14 @@
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/Mob.java b/net/minecraft/world/entity/Mob.java
index 73ba442b9d39bc021cd5eb6c1c0f98aed94a5a02..e3b804f2d612ed7971db450aeea6768109b63470 100644
--- a/net/minecraft/world/entity/Mob.java
+++ b/net/minecraft/world/entity/Mob.java
@@ -136,6 +136,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
private BlockPos restrictCenter = BlockPos.ZERO;
private float restrictRadius = -1.0F;
@@ -139,6 +_,7 @@
private BlockPos homePosition = BlockPos.ZERO;
private int homeRadius = -1;
public boolean aware = true; // CraftBukkit
+ public int ticksSinceLastInteraction; // Purpur - Entity lifespan
protected Mob(EntityType<? extends Mob> entityType, Level level) {
super(entityType, level);
@@ -281,6 +282,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
@@ -284,6 +_,7 @@
target = null;
}
}
@@ -24,13 +16,14 @@ index 73ba442b9d39bc021cd5eb6c1c0f98aed94a5a02..e3b804f2d612ed7971db450aeea67681
this.target = target;
return true;
// CraftBukkit end
@@ -324,8 +326,28 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
@@ -327,7 +_,27 @@
}
profilerFiller.pop();
- }
+ incrementTicksSinceLastInteraction(); // Purpur - Entity lifespan
}
+ }
+
+ // Purpur start - Entity lifespan
+ private void incrementTicksSinceLastInteraction() {
+ ++this.ticksSinceLastInteraction;
@@ -49,27 +42,26 @@ index 73ba442b9d39bc021cd5eb6c1c0f98aed94a5a02..e3b804f2d612ed7971db450aeea67681
+ }
+ }
+ // Purpur end - Entity lifespan
+
@Override
protected void playHurtSound(DamageSource source) {
this.resetAmbientSoundTime();
@@ -420,6 +442,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
compound.putBoolean("NoAI", this.isNoAi());
@@ -427,6 +_,7 @@
output.putBoolean("NoAI", this.isNoAi());
}
compound.putBoolean("Bukkit.Aware", this.aware); // CraftBukkit
+ compound.putInt("Purpur.ticksSinceLastInteraction", this.ticksSinceLastInteraction); // Purpur - Entity lifespan
output.putBoolean("Bukkit.Aware", this.aware); // CraftBukkit
+ output.putInt("Purpur.ticksSinceLastInteraction", this.ticksSinceLastInteraction); // Purpur - Entity lifespan
}
@Override
@@ -443,6 +466,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
this.lootTableSeed = compound.getLongOr("DeathLootTableSeed", 0L);
this.setNoAi(compound.getBooleanOr("NoAI", false));
this.aware = compound.getBooleanOr("Bukkit.Aware", true); // CraftBukkit
+ this.ticksSinceLastInteraction = compound.getIntOr("Purpur.ticksSinceLastInteraction", 0); // Purpur- Entity lifespan
@@ -454,6 +_,7 @@
this.lootTableSeed = input.getLongOr("DeathLootTableSeed", 0L);
this.setNoAi(input.getBooleanOr("NoAI", false));
this.aware = input.getBooleanOr("Bukkit.Aware", true); // CraftBukkit
+ this.ticksSinceLastInteraction = input.getIntOr("Purpur.ticksSinceLastInteraction", 0); // Purpur- Entity lifespan
}
@Override
@@ -1167,7 +1191,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
@@ -1188,7 +_,7 @@
);
}
@@ -78,7 +70,7 @@ index 73ba442b9d39bc021cd5eb6c1c0f98aed94a5a02..e3b804f2d612ed7971db450aeea67681
return spawnGroupData;
}
@@ -1499,6 +1523,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
@@ -1525,6 +_,7 @@
this.playAttackSound();
}

View File

@@ -0,0 +1,11 @@
--- a/net/minecraft/world/entity/ai/behavior/AcquirePoi.java
+++ b/net/minecraft/world/entity/ai/behavior/AcquirePoi.java
@@ -85,7 +_,7 @@
}
};
Set<Pair<Holder<PoiType>, BlockPos>> set = poiManager.findAllClosestFirstWithType(
- acquirablePois, predicate1, mob.blockPosition(), 48, PoiManager.Occupancy.HAS_SPACE
+ acquirablePois, predicate1, mob.blockPosition(), level.purpurConfig.villagerAcquirePoiSearchRadius, PoiManager.Occupancy.HAS_SPACE // Purpur - Configurable villager search radius
)
.limit(5L)
.filter(pair1 -> predicate.test(level, pair1.getSecond()))

View File

@@ -0,0 +1,14 @@
--- a/net/minecraft/world/entity/ai/sensing/NearestBedSensor.java
+++ b/net/minecraft/world/entity/ai/sensing/NearestBedSensor.java
@@ -54,9 +_,9 @@
}
};
Set<Pair<Holder<PoiType>, BlockPos>> set = poiManager.findAllWithType(
- holder -> holder.is(PoiTypes.HOME), predicate, entity.blockPosition(), 48, PoiManager.Occupancy.ANY
+ holder -> holder.is(PoiTypes.HOME), predicate, entity.blockPosition(), level.purpurConfig.villagerNearestBedSensorSearchRadius, PoiManager.Occupancy.ANY
)
- .collect(Collectors.toSet());
+ .collect(Collectors.toSet()); // Purpur - Configurable villager search radius
Path path = AcquirePoi.findPathToPois(entity, set);
if (path != null && path.canReach()) {
BlockPos target = path.getTarget();

View File

@@ -1,23 +1,15 @@
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/animal/Animal.java b/net/minecraft/world/entity/animal/Animal.java
index b851f94d63a049292a3657009d68bc1641222104..2ce0099460c14a6dd8b128f268ee915ea4be5183 100644
--- a/net/minecraft/world/entity/animal/Animal.java
+++ b/net/minecraft/world/entity/animal/Animal.java
@@ -142,7 +142,7 @@ public abstract class Animal extends AgeableMob {
@@ -143,7 +_,7 @@
ItemStack itemInHand = player.getItemInHand(hand);
if (this.isFood(itemInHand)) {
int age = this.getAge();
- if (!this.level().isClientSide && age == 0 && this.canFallInLove()) {
+ if (!this.level().isClientSide && age == 0 && this.canFallInLove() && (this.level().purpurConfig.animalBreedingCooldownSeconds <= 0 || !this.level().hasBreedingCooldown(player.getUUID(), this.getClass()))) { // Purpur - Add adjustable breeding cooldown to config
- if (player instanceof ServerPlayer serverPlayer && age == 0 && this.canFallInLove()) {
+ if (player instanceof ServerPlayer serverPlayer && age == 0 && this.canFallInLove() && (this.level().purpurConfig.animalBreedingCooldownSeconds <= 0 || !this.level().hasBreedingCooldown(player.getUUID(), this.getClass()))) { // Purpur - Add adjustable breeding cooldown to config
final ItemStack breedCopy = itemInHand.copy(); // Paper - Fix EntityBreedEvent copying
this.usePlayerItem(player, hand, itemInHand);
this.setInLove(player, breedCopy); // Paper - Fix EntityBreedEvent copying
@@ -239,10 +239,20 @@ public abstract class Animal extends AgeableMob {
this.setInLove(serverPlayer, breedCopy); // Paper - Fix EntityBreedEvent copying
@@ -235,10 +_,20 @@
public void spawnChildFromBreeding(ServerLevel level, Animal mate) {
AgeableMob breedOffspring = this.getBreedOffspring(level, mate);
if (breedOffspring != null) {

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/animal/IronGolem.java b/net/minecraft/world/entity/animal/IronGolem.java
index 33245f28c02c5cd42f2daec8748d615b7f5e21ec..91897447d7ef35af3300443e8eb96340081fed48 100644
--- a/net/minecraft/world/entity/animal/IronGolem.java
+++ b/net/minecraft/world/entity/animal/IronGolem.java
@@ -57,13 +57,26 @@ public class IronGolem extends AbstractGolem implements NeutralMob {
@@ -58,13 +_,26 @@
private int remainingPersistentAngerTime;
@Nullable
private UUID persistentAngerTarget;
@@ -35,23 +27,23 @@ index 33245f28c02c5cd42f2daec8748d615b7f5e21ec..91897447d7ef35af3300443e8eb96340
this.goalSelector.addGoal(1, new MeleeAttackGoal(this, 1.0, true));
this.goalSelector.addGoal(2, new MoveTowardsTargetGoal(this, 0.9, 32.0F));
this.goalSelector.addGoal(2, new MoveBackToVillageGoal(this, 0.6, false));
@@ -141,6 +154,7 @@ public class IronGolem extends AbstractGolem implements NeutralMob {
public void addAdditionalSaveData(CompoundTag compound) {
super.addAdditionalSaveData(compound);
compound.putBoolean("PlayerCreated", this.isPlayerCreated());
+ compound.storeNullable("Purpur.Summoner", net.minecraft.core.UUIDUtil.CODEC, getSummoner()); // Purpur - Summoner API
this.addPersistentAngerSaveData(compound);
@@ -142,6 +_,7 @@
protected void addAdditionalSaveData(ValueOutput output) {
super.addAdditionalSaveData(output);
output.putBoolean("PlayerCreated", this.isPlayerCreated());
+ output.storeNullable("Purpur.Summoner", net.minecraft.core.UUIDUtil.CODEC, getSummoner()); // Purpur - Summoner API
this.addPersistentAngerSaveData(output);
}
@@ -148,6 +162,7 @@ public class IronGolem extends AbstractGolem implements NeutralMob {
public void readAdditionalSaveData(CompoundTag compound) {
super.readAdditionalSaveData(compound);
this.setPlayerCreated(compound.getBooleanOr("PlayerCreated", false));
+ this.setSummoner(compound.read("Purpur.Summoner", net.minecraft.core.UUIDUtil.CODEC).orElse(null)); // Purpur - Summoner API
this.readPersistentAngerSaveData(this.level(), compound);
@@ -149,6 +_,7 @@
protected void readAdditionalSaveData(ValueInput input) {
super.readAdditionalSaveData(input);
this.setPlayerCreated(input.getBooleanOr("PlayerCreated", false));
+ this.setSummoner(input.read("Purpur.Summoner", net.minecraft.core.UUIDUtil.CODEC).orElse(null)); // Purpur - Summoner API
this.readPersistentAngerSaveData(this.level(), input);
}
@@ -267,6 +282,7 @@ public class IronGolem extends AbstractGolem implements NeutralMob {
@@ -268,6 +_,7 @@
float f = 1.0F + (this.random.nextFloat() - this.random.nextFloat()) * 0.2F;
this.playSound(SoundEvents.IRON_GOLEM_REPAIR, 1.0F, f);
itemInHand.consume(1, player);

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/animal/SnowGolem.java b/net/minecraft/world/entity/animal/SnowGolem.java
index 7d73f02efb37aeafe41c23325a02d641d57bdaf4..67c8f1e82c775818f906eeaa639e55d7c02834c6 100644
--- a/net/minecraft/world/entity/animal/SnowGolem.java
+++ b/net/minecraft/world/entity/animal/SnowGolem.java
@@ -45,15 +45,27 @@ public class SnowGolem extends AbstractGolem implements Shearable, RangedAttackM
@@ -46,15 +_,27 @@
private static final EntityDataAccessor<Byte> DATA_PUMPKIN_ID = SynchedEntityData.defineId(SnowGolem.class, EntityDataSerializers.BYTE);
private static final byte PUMPKIN_FLAG = 16;
private static final boolean DEFAULT_PUMPKIN = true;
@@ -38,22 +30,22 @@ index 7d73f02efb37aeafe41c23325a02d641d57bdaf4..67c8f1e82c775818f906eeaa639e55d7
this.goalSelector.addGoal(3, new LookAtPlayerGoal(this, Player.class, 6.0F));
this.goalSelector.addGoal(4, new RandomLookAroundGoal(this));
this.targetSelector.addGoal(1, new NearestAttackableTargetGoal<>(this, Mob.class, 10, true, false, (entity, level) -> entity instanceof Enemy));
@@ -73,12 +85,14 @@ public class SnowGolem extends AbstractGolem implements Shearable, RangedAttackM
public void addAdditionalSaveData(CompoundTag compound) {
super.addAdditionalSaveData(compound);
compound.putBoolean("Pumpkin", this.hasPumpkin());
+ compound.storeNullable("Purpur.Summoner", net.minecraft.core.UUIDUtil.CODEC, getSummoner()); // Purpur - Summoner API
@@ -74,12 +_,14 @@
protected void addAdditionalSaveData(ValueOutput output) {
super.addAdditionalSaveData(output);
output.putBoolean("Pumpkin", this.hasPumpkin());
+ output.storeNullable("Purpur.Summoner", net.minecraft.core.UUIDUtil.CODEC, getSummoner()); // Purpur - Summoner API
}
@Override
public void readAdditionalSaveData(CompoundTag compound) {
super.readAdditionalSaveData(compound);
this.setPumpkin(compound.getBooleanOr("Pumpkin", true));
+ this.setSummoner(compound.read("Purpur.Summoner", net.minecraft.core.UUIDUtil.CODEC).orElse(null)); // Purpur - Summoner API
protected void readAdditionalSaveData(ValueInput input) {
super.readAdditionalSaveData(input);
this.setPumpkin(input.getBooleanOr("Pumpkin", true));
+ this.setSummoner(input.read("Purpur.Summoner", net.minecraft.core.UUIDUtil.CODEC).orElse(null)); // Purpur - Summoner API
}
@Override
@@ -152,6 +166,14 @@ public class SnowGolem extends AbstractGolem implements Shearable, RangedAttackM
@@ -153,6 +_,14 @@
}
return InteractionResult.SUCCESS;

View File

@@ -0,0 +1,42 @@
--- a/net/minecraft/world/entity/animal/horse/Llama.java
+++ b/net/minecraft/world/entity/animal/horse/Llama.java
@@ -78,6 +_,7 @@
private Llama caravanHead;
@Nullable
public Llama caravanTail; // Paper
+ public boolean shouldJoinCaravan = true; // Purpur - Llama API
public Llama(EntityType<? extends Llama> entityType, Level level) {
super(entityType, level);
@@ -112,6 +_,7 @@
super.addAdditionalSaveData(output);
output.store("Variant", Llama.Variant.LEGACY_CODEC, this.getVariant());
output.putInt("Strength", this.getStrength());
+ output.putBoolean("Purpur.ShouldJoinCaravan", shouldJoinCaravan); // Purpur - Llama API
}
@Override
@@ -119,6 +_,7 @@
this.setStrength(input.getIntOr("Strength", 0));
super.readAdditionalSaveData(input);
this.setVariant(input.read("Variant", Llama.Variant.LEGACY_CODEC).orElse(Llama.Variant.DEFAULT));
+ this.shouldJoinCaravan = input.getBooleanOr("Purpur.ShouldJoinCaravan", true); // Purpur - Llama API
}
@Override
@@ -400,6 +_,7 @@
public void leaveCaravan() {
if (this.caravanHead != null) {
+ new org.purpurmc.purpur.event.entity.LlamaLeaveCaravanEvent((org.bukkit.entity.Llama) getBukkitEntity()).callEvent(); // Purpur - Llama API
this.caravanHead.caravanTail = null;
}
@@ -407,6 +_,7 @@
}
public void joinCaravan(Llama caravanHead) {
+ if (!this.level().purpurConfig.llamaJoinCaravans || !shouldJoinCaravan || !new org.purpurmc.purpur.event.entity.LlamaJoinCaravanEvent((org.bukkit.entity.Llama) getBukkitEntity(), (org.bukkit.entity.Llama) caravanHead.getBukkitEntity()).callEvent()) return; // Purpur - Llama API // Purpur - Config to disable Llama caravans
this.caravanHead = caravanHead;
this.caravanHead.caravanTail = this;
}

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/animal/wolf/Wolf.java b/net/minecraft/world/entity/animal/wolf/Wolf.java
index d926ecd041ca2a421057bc22efe66a8b811ee649..0487c463806509b1dd93dcfee3b518c95b0bdb19 100644
--- a/net/minecraft/world/entity/animal/wolf/Wolf.java
+++ b/net/minecraft/world/entity/animal/wolf/Wolf.java
@@ -100,6 +100,37 @@ public class Wolf extends TamableAnimal implements NeutralMob {
@@ -99,6 +_,37 @@
EntityType<?> type = entity.getType();
return type == EntityType.SHEEP || type == EntityType.RABBIT || type == EntityType.FOX;
};
@@ -46,7 +38,7 @@ index d926ecd041ca2a421057bc22efe66a8b811ee649..0487c463806509b1dd93dcfee3b518c9
private static final float START_HEALTH = 8.0F;
private static final float TAME_HEALTH = 40.0F;
private static final float ARMOR_REPAIR_UNIT = 0.125F;
@@ -122,12 +153,47 @@ public class Wolf extends TamableAnimal implements NeutralMob {
@@ -121,12 +_,47 @@
this.setPathfindingMalus(PathType.DANGER_POWDER_SNOW, -1.0F);
}
@@ -94,7 +86,7 @@ index d926ecd041ca2a421057bc22efe66a8b811ee649..0487c463806509b1dd93dcfee3b518c9
this.goalSelector.addGoal(4, new LeapAtTargetGoal(this, 0.4F));
this.goalSelector.addGoal(5, new MeleeAttackGoal(this, 1.0, true));
this.goalSelector.addGoal(6, new FollowOwnerGoal(this, 1.0, 10.0F, 2.0F));
@@ -140,7 +206,7 @@ public class Wolf extends TamableAnimal implements NeutralMob {
@@ -139,7 +_,7 @@
this.targetSelector.addGoal(2, new OwnerHurtTargetGoal(this));
this.targetSelector.addGoal(3, new HurtByTargetGoal(this).setAlertOthers());
this.targetSelector.addGoal(4, new NearestAttackableTargetGoal<>(this, Player.class, 10, true, false, this::isAngryAt));
@@ -103,29 +95,29 @@ index d926ecd041ca2a421057bc22efe66a8b811ee649..0487c463806509b1dd93dcfee3b518c9
this.targetSelector.addGoal(6, new NonTameRandomTargetGoal<>(this, Turtle.class, false, Turtle.BABY_ON_LAND_SELECTOR));
this.targetSelector.addGoal(7, new NearestAttackableTargetGoal<>(this, AbstractSkeleton.class, false));
this.targetSelector.addGoal(8, new ResetUniversalAngerTargetGoal<>(this, true));
@@ -231,6 +297,7 @@ public class Wolf extends TamableAnimal implements NeutralMob {
public void addAdditionalSaveData(CompoundTag compound) {
super.addAdditionalSaveData(compound);
compound.store("CollarColor", DyeColor.LEGACY_ID_CODEC, this.getCollarColor());
+ compound.putBoolean("Purpur.IsRabid", this.isRabid); // Purpur - Configurable chance for wolves to spawn rabid
VariantUtils.writeVariant(compound, this.getVariant());
this.addPersistentAngerSaveData(compound);
@@ -230,6 +_,7 @@
protected void addAdditionalSaveData(ValueOutput output) {
super.addAdditionalSaveData(output);
output.store("CollarColor", DyeColor.LEGACY_ID_CODEC, this.getCollarColor());
+ output.putBoolean("Purpur.IsRabid", this.isRabid); // Purpur - Configurable chance for wolves to spawn rabid
VariantUtils.writeVariant(output, this.getVariant());
this.addPersistentAngerSaveData(output);
this.getSoundVariant()
@@ -245,6 +312,10 @@ public class Wolf extends TamableAnimal implements NeutralMob {
super.readAdditionalSaveData(compound);
VariantUtils.readVariant(compound, this.registryAccess(), Registries.WOLF_VARIANT).ifPresent(this::setVariant);
this.setCollarColor(compound.read("CollarColor", DyeColor.LEGACY_ID_CODEC).orElse(DEFAULT_COLLAR_COLOR));
@@ -244,6 +_,10 @@
super.readAdditionalSaveData(input);
VariantUtils.readVariant(input, Registries.WOLF_VARIANT).ifPresent(this::setVariant);
this.setCollarColor(input.read("CollarColor", DyeColor.LEGACY_ID_CODEC).orElse(DEFAULT_COLLAR_COLOR));
+ // Purpur start - Configurable chance for wolves to spawn rabid
+ this.isRabid = compound.getBooleanOr("Purpur.IsRabid", false);
+ this.isRabid = input.getBooleanOr("Purpur.IsRabid", false);
+ this.updatePathfinders(false);
+ // Purpur end - Configurable chance for wolves to spawn rabid
this.readPersistentAngerSaveData(this.level(), compound);
compound.read("sound_variant", ResourceKey.codec(Registries.WOLF_SOUND_VARIANT))
this.readPersistentAngerSaveData(this.level(), input);
input.read("sound_variant", ResourceKey.codec(Registries.WOLF_SOUND_VARIANT))
.flatMap(resourceKey -> this.registryAccess().lookupOrThrow(Registries.WOLF_SOUND_VARIANT).get((ResourceKey<WolfSoundVariant>)resourceKey))
@@ -269,6 +340,10 @@ public class Wolf extends TamableAnimal implements NeutralMob {
@@ -268,6 +_,10 @@
}
this.setSoundVariant(WolfSoundVariants.pickRandomSoundVariant(this.registryAccess(), this.random));
this.setSoundVariant(WolfSoundVariants.pickRandomSoundVariant(this.registryAccess(), level.getRandom()));
+ // Purpur start - Configurable chance for wolves to spawn rabid
+ this.isRabid = level.getLevel().purpurConfig.wolfNaturalRabid > 0.0D && random.nextDouble() <= level.getLevel().purpurConfig.wolfNaturalRabid;
+ this.updatePathfinders(false);
@@ -133,7 +125,7 @@ index d926ecd041ca2a421057bc22efe66a8b811ee649..0487c463806509b1dd93dcfee3b518c9
return super.finalizeSpawn(level, difficulty, spawnReason, spawnGroupData);
}
@@ -319,6 +394,11 @@ public class Wolf extends TamableAnimal implements NeutralMob {
@@ -318,6 +_,11 @@
public void tick() {
super.tick();
if (this.isAlive()) {
@@ -145,7 +137,7 @@ index d926ecd041ca2a421057bc22efe66a8b811ee649..0487c463806509b1dd93dcfee3b518c9
this.interestedAngleO = this.interestedAngle;
if (this.isInterested()) {
this.interestedAngle = this.interestedAngle + (1.0F - this.interestedAngle) * 0.4F;
@@ -532,13 +612,27 @@ public class Wolf extends TamableAnimal implements NeutralMob {
@@ -519,13 +_,27 @@
itemInHand.consume(1, player);
this.tryToTame(player);
return InteractionResult.SUCCESS_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/world/entity/boss/wither/WitherBoss.java b/net/minecraft/world/entity/boss/wither/WitherBoss.java
index 09924cccf9208abda22cc7e1635b567ed166e95a..2f7da367b58fd9c06c4e012e8eb7f59e5a7f9b6d 100644
--- a/net/minecraft/world/entity/boss/wither/WitherBoss.java
+++ b/net/minecraft/world/entity/boss/wither/WitherBoss.java
@@ -78,6 +78,7 @@ public class WitherBoss extends Monster implements RangedAttackMob {
@@ -79,6 +_,7 @@
private static final TargetingConditions.Selector LIVING_ENTITY_SELECTOR = (entity, level) -> !entity.getType().is(EntityTypeTags.WITHER_FRIENDS)
&& entity.attackable();
private static final TargetingConditions TARGETING_CONDITIONS = TargetingConditions.forCombat().range(20.0).selector(LIVING_ENTITY_SELECTOR);
@@ -16,7 +8,7 @@ index 09924cccf9208abda22cc7e1635b567ed166e95a..2f7da367b58fd9c06c4e012e8eb7f59e
public WitherBoss(EntityType<? extends WitherBoss> entityType, Level level) {
super(entityType, level);
@@ -86,6 +87,17 @@ public class WitherBoss extends Monster implements RangedAttackMob {
@@ -87,6 +_,17 @@
this.xpReward = 50;
}
@@ -34,23 +26,23 @@ index 09924cccf9208abda22cc7e1635b567ed166e95a..2f7da367b58fd9c06c4e012e8eb7f59e
@Override
protected PathNavigation createNavigation(Level level) {
FlyingPathNavigation flyingPathNavigation = new FlyingPathNavigation(this, level);
@@ -118,6 +130,7 @@ public class WitherBoss extends Monster implements RangedAttackMob {
public void addAdditionalSaveData(CompoundTag compound) {
super.addAdditionalSaveData(compound);
compound.putInt("Invul", this.getInvulnerableTicks());
+ compound.storeNullable("Purpur.Summoner", net.minecraft.core.UUIDUtil.CODEC, getSummoner()); // Purpur - Summoner API
@@ -119,6 +_,7 @@
protected void addAdditionalSaveData(ValueOutput output) {
super.addAdditionalSaveData(output);
output.putInt("Invul", this.getInvulnerableTicks());
+ output.storeNullable("Purpur.Summoner", net.minecraft.core.UUIDUtil.CODEC, getSummoner()); // Purpur - Summoner API
}
@Override
@@ -127,6 +140,7 @@ public class WitherBoss extends Monster implements RangedAttackMob {
@@ -128,6 +_,7 @@
if (this.hasCustomName()) {
this.bossEvent.setName(this.getDisplayName());
}
+ this.setSummoner(compound.read("Purpur.Summoner", net.minecraft.core.UUIDUtil.CODEC).orElse(null)); // Purpur - Summoner API
+ this.setSummoner(input.read("Purpur.Summoner", net.minecraft.core.UUIDUtil.CODEC).orElse(null)); // Purpur - Summoner API
}
@Override
@@ -270,7 +284,7 @@ public class WitherBoss extends Monster implements RangedAttackMob {
@@ -271,7 +_,7 @@
level.explode(this, this.getX(), this.getEyeY(), this.getZ(), event.getRadius(), event.getFire(), Level.ExplosionInteraction.MOB);
}
// CraftBukkit end
@@ -59,7 +51,7 @@ index 09924cccf9208abda22cc7e1635b567ed166e95a..2f7da367b58fd9c06c4e012e8eb7f59e
// CraftBukkit start - Use relative location for far away sounds
// level.globalLevelEvent(1023, this.blockPosition(), 0);
int viewDistance = level.getCraftServer().getViewDistance() * 16;
@@ -377,8 +391,10 @@ public class WitherBoss extends Monster implements RangedAttackMob {
@@ -378,8 +_,10 @@
}
}
@@ -72,7 +64,7 @@ index 09924cccf9208abda22cc7e1635b567ed166e95a..2f7da367b58fd9c06c4e012e8eb7f59e
}
this.bossEvent.setProgress(this.getHealth() / this.getMaxHealth());
@@ -575,6 +591,7 @@ public class WitherBoss extends Monster implements RangedAttackMob {
@@ -576,6 +_,7 @@
@Override
protected boolean canRide(Entity entity) {

View File

@@ -1,15 +1,7 @@
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/decoration/ArmorStand.java b/net/minecraft/world/entity/decoration/ArmorStand.java
index 5248f3c22abb608d7d7b338f169f13bfbf4cd2d6..fa20c642c05fa4ed3739cd0b3964e31fd4dba1d3 100644
--- a/net/minecraft/world/entity/decoration/ArmorStand.java
+++ b/net/minecraft/world/entity/decoration/ArmorStand.java
@@ -95,10 +95,13 @@ public class ArmorStand extends LivingEntity {
private boolean noTickPoseDirty = false;
@@ -91,10 +_,13 @@
public boolean canTickSetByAPI = false;
private boolean noTickEquipmentDirty = false;
// Paper end - Allow ArmorStands not to tick
+ public boolean canMovementTick = true; // Purpur - Movement options for armor stands
@@ -22,15 +14,15 @@ index 5248f3c22abb608d7d7b338f169f13bfbf4cd2d6..fa20c642c05fa4ed3739cd0b3964e31f
}
public ArmorStand(Level level, double x, double y, double z) {
@@ -546,6 +549,7 @@ public class ArmorStand extends LivingEntity {
@@ -521,6 +_,7 @@
// Paper start - Allow ArmorStands not to tick
@Override
public void tick() {
+ maxUpStep = level().purpurConfig.armorstandStepHeight; // Purpur - Add option to set armorstand step height
// Paper start - Allow ArmorStands not to tick
if (!this.canTick) {
if (this.noTickPoseDirty) {
@@ -875,4 +879,18 @@ public class ArmorStand extends LivingEntity {
if (this.noTickEquipmentDirty) {
this.noTickEquipmentDirty = false;
@@ -811,4 +_,18 @@
}
}
// Paper end

View File

@@ -0,0 +1,41 @@
--- a/net/minecraft/world/entity/monster/Endermite.java
+++ b/net/minecraft/world/entity/monster/Endermite.java
@@ -30,12 +_,23 @@
private static final int MAX_LIFE = 2400;
private static final int DEFAULT_LIFE = 0;
public int life = 0;
+ private boolean isPlayerSpawned; // Purpur - Add back player spawned endermite API
public Endermite(EntityType<? extends Endermite> entityType, Level level) {
super(entityType, level);
this.xpReward = 3;
}
+ // Purpur start - Add back player spawned endermite API
+ public boolean isPlayerSpawned() {
+ return this.isPlayerSpawned;
+ }
+
+ public void setPlayerSpawned(boolean playerSpawned) {
+ this.isPlayerSpawned = playerSpawned;
+ }
+ // Purpur end - Add back player spawned endermite API
+
@Override
protected void registerGoals() {
this.goalSelector.addGoal(1, new FloatGoal(this));
@@ -81,12 +_,14 @@
protected void readAdditionalSaveData(ValueInput input) {
super.readAdditionalSaveData(input);
this.life = input.getIntOr("Lifetime", 0);
+ this.isPlayerSpawned = input.getBooleanOr("PlayerSpawned", false); // Purpur - Add back player spawned endermite API
}
@Override
protected void addAdditionalSaveData(ValueOutput output) {
super.addAdditionalSaveData(output);
output.putInt("Lifetime", this.life);
+ output.putBoolean("PlayerSpawned", this.isPlayerSpawned); // Purpur - Add back player spawned endermite API
}
@Override

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/projectile/ThrownEnderpearl.java b/net/minecraft/world/entity/projectile/ThrownEnderpearl.java
index bda858b1e1c6b28cd9d5a664758b3e445eaf4f22..6575e8ef16f6011f7a799ba31531a2ebefee0c4d 100644
--- a/net/minecraft/world/entity/projectile/ThrownEnderpearl.java
+++ b/net/minecraft/world/entity/projectile/ThrownEnderpearl.java
@@ -129,9 +129,10 @@ public class ThrownEnderpearl extends ThrowableItemProjectile {
@@ -126,9 +_,10 @@
return;
}
// CraftBukkit end
@@ -20,12 +12,12 @@ index bda858b1e1c6b28cd9d5a664758b3e445eaf4f22..6575e8ef16f6011f7a799ba31531a2eb
endermite.snapTo(owner.getX(), owner.getY(), owner.getZ(), owner.getYRot(), owner.getXRot());
serverLevel.addFreshEntity(endermite, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.ENDER_PEARL);
}
@@ -151,7 +152,7 @@ public class ThrownEnderpearl extends ThrowableItemProjectile {
@@ -148,7 +_,7 @@
if (serverPlayer1 != null) {
serverPlayer1.resetFallDistance();
serverPlayer1.resetCurrentImpulseContext();
- serverPlayer1.hurtServer(serverPlayer.serverLevel(), this.damageSources().enderPearl().eventEntityDamager(this), 5.0F); // CraftBukkit // Paper - fix DamageSource API
+ serverPlayer1.hurtServer(serverPlayer.serverLevel(), this.damageSources().enderPearl().eventEntityDamager(this), this.level().purpurConfig.enderPearlDamage); // CraftBukkit // Paper - fix DamageSource API // Purpur - Configurable Ender Pearl damage
- serverPlayer1.hurtServer(serverPlayer.level(), this.damageSources().enderPearl().eventEntityDamager(this), 5.0F); // CraftBukkit // Paper - fix DamageSource API
+ serverPlayer1.hurtServer(serverPlayer.level(), this.damageSources().enderPearl().eventEntityDamager(this), this.level().purpurConfig.enderPearlDamage); // CraftBukkit // Paper - fix DamageSource API // Purpur - Configurable Ender Pearl damage
}
this.playSound(serverLevel, vec3);

View File

@@ -0,0 +1,22 @@
--- a/net/minecraft/world/item/crafting/Ingredient.java
+++ b/net/minecraft/world/item/crafting/Ingredient.java
@@ -36,6 +_,7 @@
// CraftBukkit start
@javax.annotation.Nullable
private java.util.List<ItemStack> itemStacks;
+ 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;
}
// CraftBukkit end
+ // Purpur start - Add predicate to recipe's ExactChoice ingredient
+ if (predicate != null) {
+ return predicate.test(stack.asBukkitCopy());
+ }
+ // Purpur end - Add predicate to recipe's ExactChoice ingredient
return stack.is(this.values);
}

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/ServerExplosion.java b/net/minecraft/world/level/ServerExplosion.java
index ec4b63a574e7ff2c807c283c9f4b402229864e51..1953b2e59f4f6e6f78079ade6faa93bff6bf1a27 100644
--- a/net/minecraft/world/level/ServerExplosion.java
+++ b/net/minecraft/world/level/ServerExplosion.java
@@ -316,7 +316,7 @@ public class ServerExplosion implements Explosion {
@@ -73,7 +_,7 @@
) {
this.level = level;
this.source = source;
@@ -17,7 +9,7 @@ index ec4b63a574e7ff2c807c283c9f4b402229864e51..1953b2e59f4f6e6f78079ade6faa93bf
this.center = center;
this.fire = fire;
this.blockInteraction = blockInteraction;
@@ -638,10 +638,27 @@ public class ServerExplosion implements Explosion {
@@ -356,10 +_,27 @@
public void explode() {
// CraftBukkit start
@@ -43,6 +35,6 @@ index ec4b63a574e7ff2c807c283c9f4b402229864e51..1953b2e59f4f6e6f78079ade6faa93bf
+ }
+ }
+ // Purpur end - Add PreExplodeEvents
// Paper start - collision optimisations
this.blockCache = new it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap<>();
this.chunkPosCache = new long[CHUNK_CACHE_WIDTH * CHUNK_CACHE_WIDTH];
this.level.gameEvent(this.source, GameEvent.EXPLODE, this.center);
List<BlockPos> list = this.calculateExplodedPositions();
this.hurtEntities();

View File

@@ -1,16 +1,8 @@
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/block/entity/BlockEntity.java b/net/minecraft/world/level/block/entity/BlockEntity.java
index a1075c26d55cc01219acd94d0138f81aa9d34c48..d7a08a4ecac2bb4f5626fb53e27f8d50b6936f1c 100644
--- a/net/minecraft/world/level/block/entity/BlockEntity.java
+++ b/net/minecraft/world/level/block/entity/BlockEntity.java
@@ -105,6 +105,10 @@ public abstract class BlockEntity {
this.persistentDataContainer.putAll((CompoundTag) persistentDataTag);
}
@@ -104,6 +_,10 @@
input.read("PublicBukkitValues", CompoundTag.CODEC)
.ifPresent(this.persistentDataContainer::putAll);
// Paper end - read persistent data container
+
+
@@ -18,22 +10,21 @@ index a1075c26d55cc01219acd94d0138f81aa9d34c48..d7a08a4ecac2bb4f5626fb53e27f8d50
+
}
public final void loadWithComponents(CompoundTag tag, HolderLookup.Provider registries) {
@@ -118,6 +122,12 @@ public abstract class BlockEntity {
public final void loadWithComponents(ValueInput input) {
@@ -116,6 +_,11 @@
}
protected void saveAdditional(CompoundTag tag, HolderLookup.Provider registries) {
protected void saveAdditional(ValueOutput output) {
+ // Purpur start - Persistent BlockEntity Lore and DisplayName
+ if (this.persistentLore != null) {
+ net.minecraft.resources.RegistryOps<net.minecraft.nbt.Tag> registryOps = registries.createSerializationContext(NbtOps.INSTANCE);
+ tag.store("Purpur.persistentLore", net.minecraft.world.item.component.ItemLore.CODEC, registryOps, this.persistentLore);
+ output.store("Purpur.persistentLore", net.minecraft.world.item.component.ItemLore.CODEC, this.persistentLore);
+ }
+ // Purpur end - Persistent BlockEntity Lore and DisplayName
}
public final CompoundTag saveWithFullMetadata(HolderLookup.Provider registries) {
@@ -379,4 +389,17 @@ public abstract class BlockEntity {
private ComponentHelper() {
@@ -400,4 +_,17 @@
return this.blockEntity.getNameForReporting() + "@" + this.blockEntity.getBlockPos();
}
}
+

View File

@@ -0,0 +1,67 @@
--- a/net/minecraft/world/level/block/entity/ConduitBlockEntity.java
+++ b/net/minecraft/world/level/block/entity/ConduitBlockEntity.java
@@ -151,7 +_,7 @@
BlockPos blockPos1 = pos.offset(i, i1, i2x);
BlockState blockState = level.getBlockState(blockPos1);
- for (Block block : VALID_BLOCKS) {
+ for (Block block : level.purpurConfig.conduitBlocks) { // Purpur - Conduit behavior configuration
if (blockState.is(block)) {
positions.add(blockPos1);
}
@@ -166,13 +_,13 @@
private static void applyEffects(Level level, BlockPos pos, List<BlockPos> positions) {
// CraftBukkit start
- ConduitBlockEntity.applyEffects(level, pos, ConduitBlockEntity.getRange(positions));
+ ConduitBlockEntity.applyEffects(level, pos, ConduitBlockEntity.getRange(positions, level)); // Purpur - Conduit behavior configuration
}
- public static int getRange(List<BlockPos> positions) {
+ public static int getRange(List<BlockPos> positions, Level level) { // Purpur - Conduit behavior configuration
// CraftBukkit end
int size = positions.size();
- int i = size / 7 * 16;
+ int i = size / 7 * level.purpurConfig.conduitDistance; // Purpur - Conduit behavior configuration
// CraftBukkit start
return i;
}
@@ -202,7 +_,7 @@
EntityReference<LivingEntity> entityReference = updateDestroyTarget(blockEntity.destroyTarget, level, pos, canDestroy);
LivingEntity livingEntity = EntityReference.get(entityReference, level, LivingEntity.class);
if (damageTarget && livingEntity != null) { // CraftBukkit
- if (livingEntity.hurtServer(level, level.damageSources().magic(), 4.0F)) // CraftBukkit - move up
+ if (livingEntity.hurtServer(level, level.damageSources().magic(), level.purpurConfig.conduitDamageAmount)) // CraftBukkit - move up // Purpur - Conduit behavior configuration
level.playSound(
null, livingEntity.getX(), livingEntity.getY(), livingEntity.getZ(), SoundEvents.CONDUIT_ATTACK_TARGET, SoundSource.BLOCKS, 1.0F, 1.0F
);
@@ -224,20 +_,26 @@
return selectNewTarget(level, pos);
} else {
LivingEntity livingEntity = EntityReference.get(destroyTarget, level, LivingEntity.class);
- return livingEntity != null && livingEntity.isAlive() && pos.closerThan(livingEntity.blockPosition(), 8.0) ? destroyTarget : null;
+ return livingEntity != null && livingEntity.isAlive() && pos.closerThan(livingEntity.blockPosition(), level.purpurConfig.conduitDamageDistance) ? destroyTarget : null; // Purpur - Conduit behavior configuration
}
}
@Nullable
private static EntityReference<LivingEntity> selectNewTarget(ServerLevel level, BlockPos pos) {
List<LivingEntity> entitiesOfClass = level.getEntitiesOfClass(
- LivingEntity.class, getDestroyRangeAABB(pos), livingEntity -> livingEntity instanceof Enemy && livingEntity.isInWaterOrRain()
+ LivingEntity.class, getDestroyRangeAABB(pos, level), livingEntity -> livingEntity instanceof Enemy && livingEntity.isInWaterOrRain() // Purpur - Conduit behavior configuration
);
return entitiesOfClass.isEmpty() ? null : new EntityReference<>(Util.getRandom(entitiesOfClass, level.random));
}
public static AABB getDestroyRangeAABB(BlockPos pos) {
- return new AABB(pos).inflate(8.0);
+ // Purpur start - Conduit behavior configuration
+ return getDestroyRangeAABB(pos, null);
+ }
+
+ private static AABB getDestroyRangeAABB(BlockPos pos, Level level) {
+ // Purpur end - Conduit behavior configuration
+ return new AABB(pos).inflate(level == null ? 8.0 : level.purpurConfig.conduitDamageDistance); // Purpur - Conduit behavior configuration
}
private static void animationTick(Level level, BlockPos pos, List<BlockPos> positions, @Nullable Entity entity, int tickCount) {

View File

@@ -0,0 +1,40 @@
--- a/net/minecraft/world/level/block/entity/EnchantingTableBlockEntity.java
+++ b/net/minecraft/world/level/block/entity/EnchantingTableBlockEntity.java
@@ -30,6 +_,7 @@
private static final RandomSource RANDOM = RandomSource.create();
@Nullable
private Component name;
+ private int lapis = 0; // Purpur - Enchantment Table Persists Lapis
public EnchantingTableBlockEntity(BlockPos pos, BlockState state) {
super(BlockEntityType.ENCHANTING_TABLE, pos, state);
@@ -39,12 +_,14 @@
protected void saveAdditional(ValueOutput output) {
super.saveAdditional(output);
output.storeNullable("CustomName", ComponentSerialization.CODEC, this.name);
+ output.putInt("Purpur.Lapis", this.lapis); // Purpur - Enchantment Table Persists Lapis
}
@Override
protected void loadAdditional(ValueInput input) {
super.loadAdditional(input);
this.name = parseCustomNameSafe(input, "CustomName");
+ this.lapis = input.getIntOr("Purpur.Lapis", 0); // Purpur - Enchantment Table Persists Lapis
}
public static void bookAnimationTick(Level level, BlockPos pos, BlockState state, EnchantingTableBlockEntity enchantingTable) {
@@ -136,4 +_,14 @@
public void removeComponentsFromTag(ValueOutput output) {
output.discard("CustomName");
}
+
+ // Purpur start - Enchantment Table Persists Lapis
+ public int getLapis() {
+ return this.lapis;
+ }
+
+ public void setLapis(int lapis) {
+ this.lapis = lapis;
+ }
+ // Purpur end - Enchantment Table Persists Lapis
}

View File

@@ -0,0 +1,10 @@
--- a/net/minecraft/world/level/chunk/storage/EntityStorage.java
+++ b/net/minecraft/world/level/chunk/storage/EntityStorage.java
@@ -97,6 +_,7 @@
ListTag listTag = new ListTag();
entities.getEntities().forEach(entity -> {
TagValueOutput tagValueOutput = TagValueOutput.createWithContext(scopedCollector.forChild(entity.problemPath()), entity.registryAccess());
+ if (!entity.canSaveToDisk()) return; // Purpur - Add canSaveToDisk to Entity
if (entity.save(tagValueOutput)) {
CompoundTag compoundTag1 = tagValueOutput.buildResult();
listTag.add(compoundTag1);

View File

@@ -1,19 +0,0 @@
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/ai/behavior/AcquirePoi.java b/net/minecraft/world/entity/ai/behavior/AcquirePoi.java
index b9174ae7e3a3e2de2d570b95ab5012ac3c3a2eda..67cbf9f5760fae5db6f31e64095cd1b6be6ade8e 100644
--- a/net/minecraft/world/entity/ai/behavior/AcquirePoi.java
+++ b/net/minecraft/world/entity/ai/behavior/AcquirePoi.java
@@ -86,7 +86,7 @@ public class AcquirePoi {
};
// Paper start - optimise POI access
final java.util.List<Pair<Holder<PoiType>, BlockPos>> poiposes = new java.util.ArrayList<>();
- io.papermc.paper.util.PoiAccess.findNearestPoiPositions(poiManager, acquirablePois, predicate1, mob.blockPosition(), 48, 48*48, PoiManager.Occupancy.HAS_SPACE, false, 5, poiposes);
+ io.papermc.paper.util.PoiAccess.findNearestPoiPositions(poiManager, acquirablePois, predicate1, mob.blockPosition(), level.purpurConfig.villagerAcquirePoiSearchRadius, level.purpurConfig.villagerAcquirePoiSearchRadius*level.purpurConfig.villagerAcquirePoiSearchRadius, PoiManager.Occupancy.HAS_SPACE, false, 5, poiposes); // Purpur - Configurable villager search radius
final Set<Pair<Holder<PoiType>, BlockPos>> set = new java.util.HashSet<>(poiposes.size());
for (final Pair<Holder<PoiType>, BlockPos> poiPose : poiposes) {
if (predicate.test(level, poiPose.getSecond())) {

View File

@@ -1,19 +0,0 @@
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/ai/sensing/NearestBedSensor.java b/net/minecraft/world/entity/ai/sensing/NearestBedSensor.java
index 066faa704338c573472381e1ebd063e0d52aaaa4..1f96fd5085bacb4c584576c7cb9f51e7898e9b03 100644
--- a/net/minecraft/world/entity/ai/sensing/NearestBedSensor.java
+++ b/net/minecraft/world/entity/ai/sensing/NearestBedSensor.java
@@ -56,7 +56,7 @@ public class NearestBedSensor extends Sensor<Mob> {
// Paper start - optimise POI access
java.util.List<Pair<Holder<PoiType>, BlockPos>> poiposes = new java.util.ArrayList<>();
// don't ask me why it's unbounded. ask mojang.
- io.papermc.paper.util.PoiAccess.findAnyPoiPositions(poiManager, type -> type.is(PoiTypes.HOME), predicate, entity.blockPosition(), 48, PoiManager.Occupancy.ANY, false, Integer.MAX_VALUE, poiposes);
+ io.papermc.paper.util.PoiAccess.findAnyPoiPositions(poiManager, type -> type.is(PoiTypes.HOME), predicate, entity.blockPosition(), level.purpurConfig.villagerNearestBedSensorSearchRadius, PoiManager.Occupancy.ANY, false, Integer.MAX_VALUE, poiposes); // Purpur - Configurable villager search radius
Path path = AcquirePoi.findPathToPois(entity, new java.util.HashSet<>(poiposes));
// Paper end - optimise POI access
if (path != null && path.canReach()) {

View File

@@ -1,50 +0,0 @@
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/animal/horse/Llama.java b/net/minecraft/world/entity/animal/horse/Llama.java
index 6916adb865ff8fea498d3a61c2b5560472a223f4..d4467235e8dc9d10c61dfb6fd9dc32386903dd09 100644
--- a/net/minecraft/world/entity/animal/horse/Llama.java
+++ b/net/minecraft/world/entity/animal/horse/Llama.java
@@ -77,6 +77,7 @@ public class Llama extends AbstractChestedHorse implements RangedAttackMob {
private Llama caravanHead;
@Nullable
public Llama caravanTail; // Paper
+ public boolean shouldJoinCaravan = true; // Purpur - Llama API
public Llama(EntityType<? extends Llama> entityType, Level level) {
super(entityType, level);
@@ -111,6 +112,7 @@ public class Llama extends AbstractChestedHorse implements RangedAttackMob {
super.addAdditionalSaveData(compound);
compound.store("Variant", Llama.Variant.LEGACY_CODEC, this.getVariant());
compound.putInt("Strength", this.getStrength());
+ compound.putBoolean("Purpur.ShouldJoinCaravan", shouldJoinCaravan); // Purpur - Llama API
}
@Override
@@ -118,6 +120,7 @@ public class Llama extends AbstractChestedHorse implements RangedAttackMob {
this.setStrength(compound.getIntOr("Strength", 0));
super.readAdditionalSaveData(compound);
this.setVariant(compound.read("Variant", Llama.Variant.LEGACY_CODEC).orElse(Llama.Variant.DEFAULT));
+ this.shouldJoinCaravan = compound.getBooleanOr("Purpur.ShouldJoinCaravan", true); // Purpur - Llama API
}
@Override
@@ -399,6 +402,7 @@ public class Llama extends AbstractChestedHorse implements RangedAttackMob {
public void leaveCaravan() {
if (this.caravanHead != null) {
+ new org.purpurmc.purpur.event.entity.LlamaLeaveCaravanEvent((org.bukkit.entity.Llama) getBukkitEntity()).callEvent(); // Purpur - Llama API
this.caravanHead.caravanTail = null;
}
@@ -406,6 +410,7 @@ public class Llama extends AbstractChestedHorse implements RangedAttackMob {
}
public void joinCaravan(Llama caravanHead) {
+ if (!this.level().purpurConfig.llamaJoinCaravans || !shouldJoinCaravan || !new org.purpurmc.purpur.event.entity.LlamaJoinCaravanEvent((org.bukkit.entity.Llama) getBukkitEntity(), (org.bukkit.entity.Llama) caravanHead.getBukkitEntity()).callEvent()) return; // Purpur - Llama API // Purpur - Config to disable Llama caravans
this.caravanHead = caravanHead;
this.caravanHead.caravanTail = this;
}

View File

@@ -1,49 +0,0 @@
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/monster/Endermite.java b/net/minecraft/world/entity/monster/Endermite.java
index 7fad96756972308e71fd38033f06148467a7aecd..37eaed1455f34011c24170ca0b05f606bd03fac0 100644
--- a/net/minecraft/world/entity/monster/Endermite.java
+++ b/net/minecraft/world/entity/monster/Endermite.java
@@ -29,12 +29,23 @@ public class Endermite extends Monster {
private static final int MAX_LIFE = 2400;
private static final int DEFAULT_LIFE = 0;
public int life = 0;
+ private boolean isPlayerSpawned; // Purpur - Add back player spawned endermite API
public Endermite(EntityType<? extends Endermite> entityType, Level level) {
super(entityType, level);
this.xpReward = 3;
}
+ // Purpur start - Add back player spawned endermite API
+ public boolean isPlayerSpawned() {
+ return this.isPlayerSpawned;
+ }
+
+ public void setPlayerSpawned(boolean playerSpawned) {
+ this.isPlayerSpawned = playerSpawned;
+ }
+ // Purpur end - Add back player spawned endermite API
+
@Override
protected void registerGoals() {
this.goalSelector.addGoal(1, new FloatGoal(this));
@@ -80,12 +91,14 @@ public class Endermite extends Monster {
public void readAdditionalSaveData(CompoundTag compound) {
super.readAdditionalSaveData(compound);
this.life = compound.getIntOr("Lifetime", 0);
+ this.isPlayerSpawned = compound.getBooleanOr("PlayerSpawned", false); // Purpur - Add back player spawned endermite API
}
@Override
public void addAdditionalSaveData(CompoundTag compound) {
super.addAdditionalSaveData(compound);
compound.putInt("Lifetime", this.life);
+ compound.putBoolean("PlayerSpawned", this.isPlayerSpawned); // Purpur - Add back player spawned endermite API
}
@Override

View File

@@ -1,30 +0,0 @@
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/item/crafting/Ingredient.java b/net/minecraft/world/item/crafting/Ingredient.java
index 879c8fe1f20decc793cfa39e686b61d521bd76ba..9c383a1028988cdd3de8b29ba72a4d7bd2a37c7e 100644
--- a/net/minecraft/world/item/crafting/Ingredient.java
+++ b/net/minecraft/world/item/crafting/Ingredient.java
@@ -36,6 +36,7 @@ public final class Ingredient implements StackedContents.IngredientInfo<io.paper
// CraftBukkit start
@javax.annotation.Nullable
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;
@@ -88,6 +89,11 @@ public final class Ingredient implements StackedContents.IngredientInfo<io.paper
return this.itemStacks.contains(stack); // Paper - Improve exact choice recipe ingredients (hashing FTW!)
}
// CraftBukkit end
+ // Purpur start - Add predicate to recipe's ExactChoice ingredient
+ if (predicate != null) {
+ return predicate.test(stack.asBukkitCopy());
+ }
+ // Purpur end - Add predicate to recipe's ExactChoice ingredient
return stack.is(this.values);
}

View File

@@ -1,82 +0,0 @@
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/block/entity/ConduitBlockEntity.java b/net/minecraft/world/level/block/entity/ConduitBlockEntity.java
index 2f07a23a6151a4dfb28ddc0ab38ec2abefcdd27c..aeb10f21cd9dab3b134d1d8478083453dc37e3f2 100644
--- a/net/minecraft/world/level/block/entity/ConduitBlockEntity.java
+++ b/net/minecraft/world/level/block/entity/ConduitBlockEntity.java
@@ -151,7 +151,7 @@ public class ConduitBlockEntity extends BlockEntity {
BlockPos blockPos1 = pos.offset(i, i1, i2x);
BlockState blockState = level.getBlockState(blockPos1);
- for (Block block : VALID_BLOCKS) {
+ for (Block block : level.purpurConfig.conduitBlocks) { // Purpur - Conduit behavior configuration
if (blockState.is(block)) {
positions.add(blockPos1);
}
@@ -166,13 +166,13 @@ public class ConduitBlockEntity extends BlockEntity {
private static void applyEffects(Level level, BlockPos pos, List<BlockPos> positions) {
// CraftBukkit start
- ConduitBlockEntity.applyEffects(level, pos, ConduitBlockEntity.getRange(positions));
+ ConduitBlockEntity.applyEffects(level, pos, ConduitBlockEntity.getRange(positions, level)); // Purpur - Conduit behavior configuration
}
- public static int getRange(List<BlockPos> positions) {
+ public static int getRange(List<BlockPos> positions, Level level) { // Purpur - Conduit behavior configuration
// CraftBukkit end
int size = positions.size();
- int i = size / 7 * 16;
+ int i = size / 7 * level.purpurConfig.conduitDistance; // Purpur - Conduit behavior configuration
// CraftBukkit start
return i;
}
@@ -209,17 +209,17 @@ public class ConduitBlockEntity extends BlockEntity {
blockEntity.destroyTargetUUID = null;
} else if (blockEntity.destroyTarget == null) {
List<LivingEntity> entitiesOfClass = level.getEntitiesOfClass(
- LivingEntity.class, getDestroyRangeAABB(pos), collidedEntity -> collidedEntity instanceof Enemy && collidedEntity.isInWaterOrRain()
+ LivingEntity.class, getDestroyRangeAABB(pos, level), collidedEntity -> collidedEntity instanceof Enemy && collidedEntity.isInWaterOrRain() // Purpur - Conduit behavior configuration
);
if (!entitiesOfClass.isEmpty()) {
blockEntity.destroyTarget = entitiesOfClass.get(level.random.nextInt(entitiesOfClass.size()));
}
- } else if (!blockEntity.destroyTarget.isAlive() || !pos.closerThan(blockEntity.destroyTarget.blockPosition(), 8.0)) {
+ } else if (!blockEntity.destroyTarget.isAlive() || !pos.closerThan(blockEntity.destroyTarget.blockPosition(), level.purpurConfig.conduitDamageDistance)) { // Purpur - Conduit behavior configuration
blockEntity.destroyTarget = null;
}
if (damageTarget && blockEntity.destroyTarget != null) { // CraftBukkit
- if (blockEntity.destroyTarget.hurtServer((net.minecraft.server.level.ServerLevel) level, level.damageSources().magic().eventBlockDamager(level, pos), 4.0F)) // CraftBukkit
+ if (blockEntity.destroyTarget.hurtServer((net.minecraft.server.level.ServerLevel) level, level.damageSources().magic().eventBlockDamager(level, pos), level.purpurConfig.conduitDamageAmount)) // CraftBukkit // Purpur - Conduit behavior configuration
level.playSound(
null,
blockEntity.destroyTarget.getX(),
@@ -249,16 +249,22 @@ public class ConduitBlockEntity extends BlockEntity {
}
public static AABB getDestroyRangeAABB(BlockPos pos) {
+ // Purpur start - Conduit behavior configuration
+ return getDestroyRangeAABB(pos, null);
+ }
+
+ private static AABB getDestroyRangeAABB(BlockPos pos, Level level) {
+ // Purpur end - Conduit behavior configuration
int x = pos.getX();
int y = pos.getY();
int z = pos.getZ();
- return new AABB(x, y, z, x + 1, y + 1, z + 1).inflate(8.0);
+ return new AABB(x, y, z, x + 1, y + 1, z + 1).inflate(level == null ? 8.0 : level.purpurConfig.conduitDamageDistance); // Purpur - Conduit behavior configuration
}
@Nullable
private static LivingEntity findDestroyTarget(Level level, BlockPos pos, UUID targetId) {
List<LivingEntity> entitiesOfClass = level.getEntitiesOfClass(
- LivingEntity.class, getDestroyRangeAABB(pos), collidedEntity -> collidedEntity.getUUID().equals(targetId)
+ LivingEntity.class, getDestroyRangeAABB(pos, level), collidedEntity -> collidedEntity.getUUID().equals(targetId) // Purpur - Conduit behavior configuration
);
return entitiesOfClass.size() == 1 ? entitiesOfClass.get(0) : null;
}

View File

@@ -1,48 +0,0 @@
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/block/entity/EnchantingTableBlockEntity.java b/net/minecraft/world/level/block/entity/EnchantingTableBlockEntity.java
index 4b2462ece4eb5abb76ea9259b3e6a77f8a8e4e07..d35d04823e5d0de4487310caadd013f7dab1f419 100644
--- a/net/minecraft/world/level/block/entity/EnchantingTableBlockEntity.java
+++ b/net/minecraft/world/level/block/entity/EnchantingTableBlockEntity.java
@@ -31,6 +31,7 @@ public class EnchantingTableBlockEntity extends BlockEntity implements Nameable
private static final RandomSource RANDOM = RandomSource.create();
@Nullable
private Component name;
+ private int lapis = 0; // Purpur - Enchantment Table Persists Lapis
public EnchantingTableBlockEntity(BlockPos pos, BlockState state) {
super(BlockEntityType.ENCHANTING_TABLE, pos, state);
@@ -42,12 +43,14 @@ public class EnchantingTableBlockEntity extends BlockEntity implements Nameable
if (this.hasCustomName()) {
tag.store("CustomName", ComponentSerialization.CODEC, registries.createSerializationContext(NbtOps.INSTANCE), this.name);
}
+ tag.putInt("Purpur.Lapis", this.lapis); // Purpur - Enchantment Table Persists Lapis
}
@Override
protected void loadAdditional(CompoundTag tag, HolderLookup.Provider registries) {
super.loadAdditional(tag, registries);
this.name = parseCustomNameSafe(tag.get("CustomName"), registries);
+ this.lapis = tag.getIntOr("Purpur.Lapis", 0); // Purpur - Enchantment Table Persists Lapis
}
public static void bookAnimationTick(Level level, BlockPos pos, BlockState state, EnchantingTableBlockEntity enchantingTable) {
@@ -139,4 +142,14 @@ public class EnchantingTableBlockEntity extends BlockEntity implements Nameable
public void removeComponentsFromTag(CompoundTag tag) {
tag.remove("CustomName");
}
+
+ // Purpur start - Enchantment Table Persists Lapis
+ public int getLapis() {
+ return this.lapis;
+ }
+
+ public void setLapis(int lapis) {
+ this.lapis = lapis;
+ }
+ // Purpur end - Enchantment Table Persists Lapis
}

View File

@@ -1,18 +0,0 @@
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/chunk/storage/EntityStorage.java b/net/minecraft/world/level/chunk/storage/EntityStorage.java
index f9fb1380be9cbe960127c208c65c19f770e50b6d..17315201b8d3546058e2440b8fb8a5bb465f1259 100644
--- a/net/minecraft/world/level/chunk/storage/EntityStorage.java
+++ b/net/minecraft/world/level/chunk/storage/EntityStorage.java
@@ -100,6 +100,7 @@ public class EntityStorage implements EntityPersistentStorage<Entity> {
}
// Paper end - Entity load/save limit per chunk
CompoundTag compoundTag1 = new CompoundTag();
+ if (!entity.canSaveToDisk()) return; // Purpur - Add canSaveToDisk to Entity
if (entity.save(compoundTag1)) {
listTag.add(compoundTag1);
}