Begin 1.21.6-pre1

Initial move of patches to rejected and non rejected source patches to
publish to patch-roulette.
This commit is contained in:
Bjarne Koll
2025-05-28 13:23:32 +02:00
parent a033e3b9ef
commit b745ab65e6
233 changed files with 2443 additions and 1712 deletions

View File

@@ -1,6 +1,6 @@
group=io.papermc.paper
version=1.21.5-R0.1-SNAPSHOT
mcVersion=1.21.5
version=1.21.6-R0.1-SNAPSHOT
mcVersion=1.21.6-pre1
# Set to true while updating Minecraft version
updatingMinecraft=true

View File

@@ -15,7 +15,7 @@ plugins {
val paperMavenPublicUrl = "https://repo.papermc.io/repository/maven-public/"
dependencies {
mache("io.papermc:mache:1.21.5+build.2")
mache("io.papermc:mache:1.21.6-pre1+build.2")
paperclip("io.papermc:paperclip:3.0.3")
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
}
@@ -24,9 +24,9 @@ paperweight {
minecraftVersion = providers.gradleProperty("mcVersion")
gitFilePatches = false
//updatingMinecraft {
// oldPaperCommit = "f4f275519f7c1fbe9db173b7144a4fe81440e365"
//}
updatingMinecraft {
oldPaperCommit = "a033e3b9ef78cfe85be807ac3fd1dd956274d4db"
}
spigot {
buildDataRef = "702e1a0a5072b2c4082371d5228cb30525687efc"

View File

@@ -1,6 +1,14 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/commands/CommandSourceStack.java b/net/minecraft/commands/CommandSourceStack.java
index 5b51e130f440273f03396a53938e0c771cde2c75..cb63e4c264a31788cd1405428af70f7a018910e9 100644
--- a/net/minecraft/commands/CommandSourceStack.java
+++ b/net/minecraft/commands/CommandSourceStack.java
@@ -45,7 +_,7 @@
@@ -45,7 +45,7 @@ import net.minecraft.world.level.dimension.DimensionType;
import net.minecraft.world.phys.Vec2;
import net.minecraft.world.phys.Vec3;
@@ -9,7 +17,7 @@
public static final SimpleCommandExceptionType ERROR_NOT_PLAYER = new SimpleCommandExceptionType(Component.translatable("permissions.requires.player"));
public static final SimpleCommandExceptionType ERROR_NOT_ENTITY = new SimpleCommandExceptionType(Component.translatable("permissions.requires.entity"));
public final CommandSource source;
@@ -63,6 +_,8 @@
@@ -63,6 +63,8 @@ public class CommandSourceStack implements ExecutionCommandSource<CommandSourceS
private final Vec2 rotation;
private final CommandSigningContext signingContext;
private final TaskChainer chatMessageChainer;
@@ -18,7 +26,7 @@
public CommandSourceStack(
CommandSource source,
@@ -188,6 +_,30 @@
@@ -188,6 +190,30 @@ public class CommandSourceStack implements ExecutionCommandSource<CommandSourceS
);
}
@@ -49,7 +57,7 @@
public CommandSourceStack withRotation(Vec2 rotation) {
return this.rotation.equals(rotation)
? this
@@ -391,9 +_,44 @@
@@ -391,9 +417,44 @@ public class CommandSourceStack implements ExecutionCommandSource<CommandSourceS
@Override
public boolean hasPermission(int level) {
@@ -94,7 +102,7 @@
public Vec3 getPosition() {
return this.worldPosition;
}
@@ -498,20 +_,25 @@
@@ -498,20 +559,25 @@ public class CommandSourceStack implements ExecutionCommandSource<CommandSourceS
Component component = Component.translatable("chat.type.admin", this.getDisplayName(), message).withStyle(ChatFormatting.GRAY, ChatFormatting.ITALIC);
if (this.server.getGameRules().getBoolean(GameRules.RULE_SENDCOMMANDFEEDBACK)) {
for (ServerPlayer serverPlayer : this.server.getPlayerList().getPlayers()) {
@@ -123,7 +131,7 @@
}
}
@@ -522,7 +_,7 @@
@@ -522,7 +588,7 @@ public class CommandSourceStack implements ExecutionCommandSource<CommandSourceS
@Override
public Collection<String> getOnlinePlayerNames() {
@@ -132,7 +140,7 @@
}
@Override
@@ -597,4 +_,16 @@
@@ -597,4 +663,16 @@ public class CommandSourceStack implements ExecutionCommandSource<CommandSourceS
public boolean isSilent() {
return this.silent;
}

View File

@@ -1,6 +1,14 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/commands/Commands.java b/net/minecraft/commands/Commands.java
index fe4da263cd7c62805239fff40fd2b51655f829d5..1927163db5d44383b69f41e4b9855535e853d127 100644
--- a/net/minecraft/commands/Commands.java
+++ b/net/minecraft/commands/Commands.java
@@ -150,6 +_,11 @@
@@ -150,6 +150,11 @@ public class Commands {
private final CommandDispatcher<CommandSourceStack> dispatcher = new CommandDispatcher<>();
public Commands(Commands.CommandSelection selection, CommandBuildContext context) {
@@ -12,7 +20,7 @@
AdvancementCommands.register(this.dispatcher);
AttributeCommand.register(this.dispatcher, context);
ExecuteCommand.register(this.dispatcher, context);
@@ -251,6 +_,40 @@
@@ -251,6 +256,40 @@ public class Commands {
PublishCommand.register(this.dispatcher);
}
@@ -53,7 +61,7 @@
this.dispatcher.setConsumer(ExecutionCommandSource.resultConsumer());
}
@@ -260,15 +_,58 @@
@@ -260,15 +299,58 @@ public class Commands {
return new ParseResults<>(commandContextBuilder, parseResults.getReader(), parseResults.getExceptions());
}
@@ -114,7 +122,7 @@
try {
if (contextChain != null) {
@@ -280,9 +_,10 @@
@@ -280,9 +362,10 @@ public class Commands {
);
}
} catch (Exception var12) {
@@ -127,7 +135,7 @@
StackTraceElement[] stackTrace = var12.getStackTrace();
for (int i = 0; i < Math.min(stackTrace.length, 3); i++) {
@@ -308,18 +_,22 @@
@@ -308,18 +391,22 @@ public class Commands {
}
@Nullable
@@ -153,7 +161,7 @@
if (min > 10) {
mutableComponent.append(CommonComponents.ELLIPSIS);
}
@@ -331,7 +_,17 @@
@@ -331,7 +418,17 @@ public class Commands {
}
mutableComponent.append(Component.translatable("command.context.here").withStyle(ChatFormatting.RED, ChatFormatting.ITALIC));
@@ -172,7 +180,7 @@
}
return null;
@@ -359,26 +_,121 @@
@@ -359,26 +456,121 @@ public class Commands {
}
public void sendCommands(ServerPlayer player) {
@@ -255,6 +263,9 @@
+ if (commandNode.wrappedCached != null && commandNode.wrappedCached.apiCommandMeta != null && commandNode.wrappedCached.apiCommandMeta.serverSideOnly()) continue; // Paper
if (commandNode.canUse(source)) {
ArgumentBuilder<SharedSuggestionProvider, ?> argumentBuilder = (ArgumentBuilder) commandNode.createBuilder();
- argumentBuilder.requires(suggestions -> true);
- if (argumentBuilder.getCommand() != null) {
- argumentBuilder.executes(commandContext -> 0);
+ // Paper start
+ /*
+ Because of how commands can be yeeted right left and center due to bad bukkit practices
@@ -288,19 +299,16 @@
+ }
+
+ argumentBuilder = builder;
+ }
}
+ // Paper end
argumentBuilder.requires(suggestions -> true);
- if (argumentBuilder.getCommand() != null) {
- argumentBuilder.executes(commandContext -> 0);
- }
+ argumentBuilder.requires(suggestions -> true);
+ // Paper - don't replace Command instance on suggestion node
+ // we want the exact command instance to be used for equality checks
+ // when assigning serialization ids to each command node
if (argumentBuilder instanceof RequiredArgumentBuilder requiredArgumentBuilder
&& requiredArgumentBuilder.getSuggestionsProvider() != null) {
@@ -393,7 +_,7 @@
@@ -393,7 +585,7 @@ public class Commands {
commandNodeToSuggestionNode.put(commandNode, commandNode1);
rootSuggestion.addChild(commandNode1);
if (!commandNode.getChildren().isEmpty()) {

View File

@@ -1,6 +1,14 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/commands/arguments/selector/EntitySelector.java b/net/minecraft/commands/arguments/selector/EntitySelector.java
index c5419fd9ca690fc65c2ffc6a4e0a4bbf747afcf4..514f8fbdeb776087608665c35de95294aadf5cf0 100644
--- a/net/minecraft/commands/arguments/selector/EntitySelector.java
+++ b/net/minecraft/commands/arguments/selector/EntitySelector.java
@@ -105,7 +_,7 @@
@@ -105,7 +105,7 @@ public class EntitySelector {
}
private void checkPermissions(CommandSourceStack source) throws CommandSyntaxException {

View File

@@ -1,6 +1,14 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/commands/arguments/selector/EntitySelectorParser.java b/net/minecraft/commands/arguments/selector/EntitySelectorParser.java
index 343381f8190061e6f42131e36c256fff6fbc85a6..a6f232747df631f6afe440606bea94c588f1a0dd 100644
--- a/net/minecraft/commands/arguments/selector/EntitySelectorParser.java
+++ b/net/minecraft/commands/arguments/selector/EntitySelectorParser.java
@@ -122,6 +_,11 @@
@@ -122,6 +122,11 @@ public class EntitySelectorParser {
}
public static <S> boolean allowSelectors(S suggestionProvider) {
@@ -12,7 +20,7 @@
return suggestionProvider instanceof SharedSuggestionProvider sharedSuggestionProvider && sharedSuggestionProvider.hasPermission(2);
}
@@ -198,8 +_,10 @@
@@ -198,8 +203,10 @@ public class EntitySelectorParser {
};
}
@@ -25,7 +33,7 @@
this.suggestions = this::suggestSelector;
if (!this.reader.canRead()) {
throw ERROR_MISSING_SELECTOR_TYPE.createWithContext(this.reader);
@@ -467,6 +_,12 @@
@@ -467,6 +474,12 @@ public class EntitySelectorParser {
}
public EntitySelector parse() throws CommandSyntaxException {
@@ -38,7 +46,7 @@
this.startPosition = this.reader.getCursor();
this.suggestions = this::suggestNameOrSelector;
if (this.reader.canRead() && this.reader.peek() == '@') {
@@ -475,7 +_,7 @@
@@ -475,7 +488,7 @@ public class EntitySelectorParser {
}
this.reader.skip();

View File

@@ -1,6 +1,14 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/core/dispenser/ShearsDispenseItemBehavior.java b/net/minecraft/core/dispenser/ShearsDispenseItemBehavior.java
index 51206597d13d8c2d539268b92c076377f2d1573d..c1bd6d91cf9828ccc7275efe0f5c959c0f457c13 100644
--- a/net/minecraft/core/dispenser/ShearsDispenseItemBehavior.java
+++ b/net/minecraft/core/dispenser/ShearsDispenseItemBehavior.java
@@ -20,9 +_,30 @@
@@ -20,9 +20,30 @@ public class ShearsDispenseItemBehavior extends OptionalDispenseItemBehavior {
@Override
protected ItemStack execute(BlockSource blockSource, ItemStack item) {
ServerLevel serverLevel = blockSource.level();
@@ -32,7 +40,7 @@
if (this.isSuccess()) {
item.hurtAndBreak(1, serverLevel, null, item1 -> {});
}
@@ -50,10 +_,18 @@
@@ -50,10 +71,18 @@ public class ShearsDispenseItemBehavior extends OptionalDispenseItemBehavior {
return false;
}

View File

@@ -1,6 +1,14 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/nbt/CompoundTag.java b/net/minecraft/nbt/CompoundTag.java
index 163443001458b939a49a560cb79a9194498a0e31..052ca6beb06a3256fdf04bac5f2085ad622d7df0 100644
--- a/net/minecraft/nbt/CompoundTag.java
+++ b/net/minecraft/nbt/CompoundTag.java
@@ -54,7 +_,7 @@
@@ -54,7 +54,7 @@ public final class CompoundTag implements Tag {
private static CompoundTag loadCompound(DataInput input, NbtAccounter nbtAccounter) throws IOException {
nbtAccounter.accountBytes(48L);
@@ -9,7 +17,7 @@
byte b;
while ((b = input.readByte()) != 0) {
@@ -171,7 +_,7 @@
@@ -171,7 +171,7 @@ public final class CompoundTag implements Tag {
}
public CompoundTag() {
@@ -18,7 +26,7 @@
}
@Override
@@ -402,9 +_,16 @@
@@ -402,9 +402,16 @@ public final class CompoundTag implements Tag {
@Override
public CompoundTag copy() {
@@ -38,7 +46,7 @@
}
@Override
@@ -525,22 +_,47 @@
@@ -525,22 +532,47 @@ public final class CompoundTag implements Tag {
this.merge((CompoundTag)mapCodec.encoder().encodeStart(ops, data).getOrThrow());
}

View File

@@ -1,6 +1,14 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/network/protocol/login/ClientboundLoginDisconnectPacket.java b/net/minecraft/network/protocol/login/ClientboundLoginDisconnectPacket.java
index f14ca3e8f1bdcec8f8a00f4ca62bc37223764ff2..549ea1ca4824c39bcd32321f4c404c1ff4203777 100644
--- a/net/minecraft/network/protocol/login/ClientboundLoginDisconnectPacket.java
+++ b/net/minecraft/network/protocol/login/ClientboundLoginDisconnectPacket.java
@@ -18,11 +_,16 @@
@@ -18,11 +18,16 @@ public class ClientboundLoginDisconnectPacket implements Packet<ClientLoginPacke
}
private ClientboundLoginDisconnectPacket(FriendlyByteBuf buffer) {

View File

@@ -1,6 +1,14 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/server/Main.java b/net/minecraft/server/Main.java
index 5cd0ef6d6dfab24420178cf238fcf4b0b2e6c14b..58be6e1d1607a3af5e28f851718b82321f2feb25 100644
--- a/net/minecraft/server/Main.java
+++ b/net/minecraft/server/Main.java
@@ -67,8 +_,10 @@
@@ -67,8 +67,10 @@ public class Main {
reason = "System.out needed before bootstrap"
)
@DontObfuscate
@@ -12,7 +20,7 @@
OptionParser optionParser = new OptionParser();
OptionSpec<Void> optionSpec = optionParser.accepts("nogui");
OptionSpec<Void> optionSpec1 = optionParser.accepts("initSettings", "Initializes 'server.properties' and 'eula.txt', then quits");
@@ -93,41 +_,94 @@
@@ -93,41 +95,94 @@ public class Main {
optionParser.printHelpOn(System.err);
return;
}
@@ -116,7 +124,7 @@
Dynamic<?> dataTag;
if (levelStorageAccess.hasWorldData()) {
LevelSummary summary;
@@ -169,12 +_,33 @@
@@ -169,12 +224,33 @@ public class Main {
}
Dynamic<?> dynamic = dataTag;
@@ -151,7 +159,7 @@
WorldStem worldStem;
try {
@@ -183,6 +_,7 @@
@@ -183,6 +259,7 @@ public class Main {
executor -> WorldLoader.load(
initConfig,
context -> {
@@ -159,7 +167,7 @@
Registry<LevelStem> registry = context.datapackDimensions().lookupOrThrow(Registries.LEVEL_STEM);
if (dynamic != null) {
LevelDataAndDimensions levelDataAndDimensions = LevelStorageSource.getLevelDataAndDimensions(
@@ -196,7 +_,7 @@
@@ -196,7 +273,7 @@ public class Main {
LevelSettings levelSettings;
WorldOptions worldOptions;
WorldDimensions worldDimensions;
@@ -168,7 +176,7 @@
levelSettings = MinecraftServer.DEMO_SETTINGS;
worldOptions = WorldOptions.DEMO_OPTIONS;
worldDimensions = WorldPresets.createNormalWorldDimensions(context.datapackWorldgen());
@@ -211,7 +_,7 @@
@@ -211,7 +288,7 @@ public class Main {
new GameRules(context.dataConfiguration().enabledFeatures()),
context.dataConfiguration()
);
@@ -177,7 +185,7 @@
worldDimensions = properties.createDimensions(context.datapackWorldgen());
}
@@ -237,6 +_,7 @@
@@ -237,6 +314,7 @@ public class Main {
return;
}
@@ -185,7 +193,7 @@
RegistryAccess.Frozen frozen = worldStem.registries().compositeAccess();
WorldData worldData = worldStem.worldData();
boolean hasOptionSpec1 = optionSet.has(optionSpec6);
@@ -245,9 +_,13 @@
@@ -245,9 +323,13 @@ public class Main {
}
levelStorageAccess.saveDataTag(frozen, worldData);
@@ -199,7 +207,7 @@
thread1,
levelStorageAccess,
packRepository,
@@ -257,17 +_,34 @@
@@ -257,17 +339,34 @@ public class Main {
services,
LoggerChunkProgressListener::createFromGameruleRadius
);
@@ -236,7 +244,7 @@
Thread thread = new Thread("Server Shutdown Thread") {
@Override
public void run() {
@@ -276,6 +_,7 @@
@@ -276,6 +375,7 @@ public class Main {
};
thread.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(LOGGER));
Runtime.getRuntime().addShutdownHook(thread);
@@ -244,7 +252,7 @@
} catch (Exception var42) {
LOGGER.error(LogUtils.FATAL_MARKER, "Failed to start the minecraft server", (Throwable)var42);
}
@@ -317,7 +_,7 @@
@@ -317,7 +417,7 @@ public class Main {
RegistryAccess registryAccess,
boolean recreateRegionFiles
) {

View File

@@ -1,6 +1,14 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/server/PlayerAdvancements.java b/net/minecraft/server/PlayerAdvancements.java
index 9316688b6e7448c2f4805a399498e5562fa39f7c..52e0ae233a7b1c88bfbbc27707ef5f18453ec865 100644
--- a/net/minecraft/server/PlayerAdvancements.java
+++ b/net/minecraft/server/PlayerAdvancements.java
@@ -47,7 +_,7 @@
@@ -47,7 +47,7 @@ import org.slf4j.Logger;
public class PlayerAdvancements {
private static final Logger LOGGER = LogUtils.getLogger();
@@ -9,7 +17,7 @@
private final PlayerList playerList;
private final Path playerSavePath;
private AdvancementTree tree;
@@ -60,6 +_,7 @@
@@ -60,6 +60,7 @@ public class PlayerAdvancements {
private AdvancementHolder lastSelectedTab;
private boolean isFirstPacket = true;
private final Codec<PlayerAdvancements.Data> codec;
@@ -17,7 +25,7 @@
public PlayerAdvancements(DataFixer dataFixer, PlayerList playerList, ServerAdvancementManager manager, Path playerSavePath, ServerPlayer player) {
this.playerList = playerList;
@@ -128,6 +_,7 @@
@@ -128,6 +129,7 @@ public class PlayerAdvancements {
}
public void save() {
@@ -25,7 +33,7 @@
JsonElement jsonElement = this.codec.encodeStart(JsonOps.INSTANCE, this.asData()).getOrThrow();
try {
@@ -145,6 +_,7 @@
@@ -145,6 +147,7 @@ public class PlayerAdvancements {
data.forEach((path, progress) -> {
AdvancementHolder advancementHolder = advancementManager.get(path);
if (advancementHolder == null) {
@@ -33,7 +41,7 @@
LOGGER.warn("Ignored advancement '{}' in progress file {} - it doesn't exist anymore?", path, this.playerSavePath);
} else {
this.startProgress(advancementHolder, progress);
@@ -169,14 +_,31 @@
@@ -169,14 +172,31 @@ public class PlayerAdvancements {
AdvancementProgress orStartProgress = this.getOrStartProgress(advancement);
boolean isDone = orStartProgress.isDone();
if (orStartProgress.grantProgress(criterionKey)) {
@@ -67,7 +75,7 @@
}
});
}
@@ -247,7 +_,7 @@
@@ -247,7 +267,7 @@ public class PlayerAdvancements {
public void flushDirty(ServerPlayer player, boolean showAdvancements) {
if (this.isFirstPacket || !this.rootsToUpdate.isEmpty() || !this.progressChanged.isEmpty()) {
Map<ResourceLocation, AdvancementProgress> map = new HashMap<>();

View File

@@ -1,6 +1,14 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/server/ServerScoreboard.java b/net/minecraft/server/ServerScoreboard.java
index a485da44e599ccf22837dd912d2bb7e32c835661..9e22e93b1fab6822e0e9c1122024a88942c8679e 100644
--- a/net/minecraft/server/ServerScoreboard.java
+++ b/net/minecraft/server/ServerScoreboard.java
@@ -43,9 +_,7 @@
@@ -43,9 +43,7 @@ public class ServerScoreboard extends Scoreboard {
protected void onScoreChanged(ScoreHolder scoreHolder, Objective objective, Score score) {
super.onScoreChanged(scoreHolder, objective, score);
if (this.trackedObjectives.contains(objective)) {
@@ -11,7 +19,7 @@
new ClientboundSetScorePacket(
scoreHolder.getScoreboardName(),
objective.getName(),
@@ -68,7 +_,7 @@
@@ -68,7 +66,7 @@ public class ServerScoreboard extends Scoreboard {
@Override
public void onPlayerRemoved(ScoreHolder scoreHolder) {
super.onPlayerRemoved(scoreHolder);
@@ -20,7 +28,7 @@
this.setDirty();
}
@@ -76,7 +_,7 @@
@@ -76,7 +74,7 @@ public class ServerScoreboard extends Scoreboard {
public void onPlayerScoreRemoved(ScoreHolder scoreHolder, Objective objective) {
super.onPlayerScoreRemoved(scoreHolder, objective);
if (this.trackedObjectives.contains(objective)) {
@@ -29,7 +37,7 @@
}
this.setDirty();
@@ -88,7 +_,7 @@
@@ -88,7 +86,7 @@ public class ServerScoreboard extends Scoreboard {
super.setDisplayObjective(slot, objective);
if (displayObjective != objective && displayObjective != null) {
if (this.getObjectiveDisplaySlotCount(displayObjective) > 0) {
@@ -38,7 +46,7 @@
} else {
this.stopTrackingObjective(displayObjective);
}
@@ -96,7 +_,7 @@
@@ -96,7 +94,7 @@ public class ServerScoreboard extends Scoreboard {
if (objective != null) {
if (this.trackedObjectives.contains(objective)) {
@@ -47,27 +55,21 @@
} else {
this.startTrackingObjective(objective);
}
@@ -108,24 +_,50 @@
@@ -108,9 +106,7 @@ public class ServerScoreboard extends Scoreboard {
@Override
public boolean addPlayerToTeam(String playerName, PlayerTeam team) {
if (super.addPlayerToTeam(playerName, team)) {
- this.server
- .getPlayerList()
- .broadcastAll(ClientboundSetPlayerTeamPacket.createPlayerPacket(team, playerName, ClientboundSetPlayerTeamPacket.Action.ADD));
- this.setDirty();
- return true;
- } else {
- return false;
- }
- }
+ this.broadcastAll(ClientboundSetPlayerTeamPacket.createPlayerPacket(team, playerName, ClientboundSetPlayerTeamPacket.Action.ADD)); // CraftBukkit
+ this.setDirty();
+ return true;
+ } else {
+ return false;
+ }
+ }
+
this.setDirty();
return true;
} else {
@@ -118,15 +114,43 @@ public class ServerScoreboard extends Scoreboard {
}
}
+ // Paper start - Multiple Entries with Scoreboards
+ public boolean addPlayersToTeam(java.util.Collection<String> players, PlayerTeam team) {
+ boolean anyAdded = false;
@@ -86,19 +88,17 @@
+ }
+ }
+ // Paper end - Multiple Entries with Scoreboards
+
@Override
public void removePlayerFromTeam(String username, PlayerTeam playerTeam) {
super.removePlayerFromTeam(username, playerTeam);
- this.server
- .getPlayerList()
- .broadcastAll(ClientboundSetPlayerTeamPacket.createPlayerPacket(playerTeam, username, ClientboundSetPlayerTeamPacket.Action.REMOVE));
- this.setDirty();
- }
+ this.broadcastAll(ClientboundSetPlayerTeamPacket.createPlayerPacket(playerTeam, username, ClientboundSetPlayerTeamPacket.Action.REMOVE)); // CraftBukkit
+ this.setDirty();
+ }
+
this.setDirty();
}
+ // Paper start - Multiple Entries with Scoreboards
+ public void removePlayersFromTeam(java.util.Collection<String> players, PlayerTeam team) {
+ for (String playerName : players) {
@@ -109,10 +109,11 @@
+ this.setDirty();
+ }
+ // Paper end - Multiple Entries with Scoreboards
+
@Override
public void onObjectiveAdded(Objective objective) {
@@ -137,7 +_,7 @@
super.onObjectiveAdded(objective);
@@ -137,7 +161,7 @@ public class ServerScoreboard extends Scoreboard {
public void onObjectiveChanged(Objective objective) {
super.onObjectiveChanged(objective);
if (this.trackedObjectives.contains(objective)) {
@@ -121,7 +122,7 @@
}
this.setDirty();
@@ -156,21 +_,21 @@
@@ -156,21 +180,21 @@ public class ServerScoreboard extends Scoreboard {
@Override
public void onTeamAdded(PlayerTeam playerTeam) {
super.onTeamAdded(playerTeam);
@@ -146,7 +147,7 @@
this.setDirty();
}
@@ -213,6 +_,7 @@
@@ -213,6 +237,7 @@ public class ServerScoreboard extends Scoreboard {
List<Packet<?>> startTrackingPackets = this.getStartTrackingPackets(objective);
for (ServerPlayer serverPlayer : this.server.getPlayerList().getPlayers()) {
@@ -154,7 +155,7 @@
for (Packet<?> packet : startTrackingPackets) {
serverPlayer.connection.send(packet);
}
@@ -238,6 +_,7 @@
@@ -238,6 +263,7 @@ public class ServerScoreboard extends Scoreboard {
List<Packet<?>> stopTrackingPackets = this.getStopTrackingPackets(objective);
for (ServerPlayer serverPlayer : this.server.getPlayerList().getPlayers()) {
@@ -162,11 +163,10 @@
for (Packet<?> packet : stopTrackingPackets) {
serverPlayer.connection.send(packet);
}
@@ -269,6 +_,16 @@
scoreboardSaveData.loadFrom(data);
@@ -270,6 +296,16 @@ public class ServerScoreboard extends Scoreboard {
return scoreboardSaveData;
}
+
+ // CraftBukkit start - Send to players
+ private void broadcastAll(Packet<?> packet) {
+ for (ServerPlayer serverPlayer : this.server.getPlayerList().players) {
@@ -176,6 +176,7 @@
+ }
+ }
+ // CraftBukkit end
+
public static enum Method {
CHANGE,
REMOVE;

View File

@@ -1,6 +1,14 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/server/commands/GameModeCommand.java b/net/minecraft/server/commands/GameModeCommand.java
index c112ca29596a68c6ba12dcc4d33460b4c181fa47..c44cdbbdc06b25bd20a208386545a10af9b96df8 100644
--- a/net/minecraft/server/commands/GameModeCommand.java
+++ b/net/minecraft/server/commands/GameModeCommand.java
@@ -54,9 +_,14 @@
@@ -54,9 +54,14 @@ public class GameModeCommand {
int i = 0;
for (ServerPlayer serverPlayer : players) {

View File

@@ -1,6 +1,14 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/server/dedicated/DedicatedServer.java b/net/minecraft/server/dedicated/DedicatedServer.java
index 6c49c5a88d2dcee911cd862da01a009fba4b50c9..0c861f882d3e8f8ce417ce2ace0f3f5ca2673620 100644
--- a/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/net/minecraft/server/dedicated/DedicatedServer.java
@@ -63,10 +_,10 @@
@@ -63,10 +63,10 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
static final Logger LOGGER = LogUtils.getLogger();
private static final int CONVERSION_RETRY_DELAY_MS = 5000;
private static final int CONVERSION_RETRIES = 2;
@@ -13,7 +21,7 @@
@Nullable
private RconThread rconThread;
public DedicatedServerSettings settings;
@@ -81,6 +_,7 @@
@@ -81,6 +81,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
public ServerLinks serverLinks;
public DedicatedServer(
@@ -21,7 +29,7 @@
Thread serverThread,
LevelStorageSource.LevelStorageAccess storageSource,
PackRepository packRepository,
@@ -90,9 +_,9 @@
@@ -90,9 +91,9 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
Services services,
ChunkProgressListenerFactory progressListenerFactory
) {
@@ -33,7 +41,7 @@
this.serverTextFilter = ServerTextFilter.createFromConfig(settings.getProperties());
this.serverLinks = createServerLinks(settings);
}
@@ -102,6 +_,10 @@
@@ -102,6 +103,10 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
Thread thread = new Thread("Server console handler") {
@Override
public void run() {
@@ -44,7 +52,7 @@
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in, StandardCharsets.UTF_8));
String string1;
@@ -111,17 +_,41 @@
@@ -111,17 +116,41 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
}
} catch (IOException var4) {
DedicatedServer.LOGGER.error("Exception handling console input", (Throwable)var4);
@@ -88,7 +96,7 @@
LOGGER.info("Loading properties");
DedicatedServerProperties properties = this.settings.getProperties();
if (this.isSingleplayer()) {
@@ -132,13 +_,51 @@
@@ -132,13 +161,51 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
this.setLocalIp(properties.serverIp);
}
@@ -141,7 +149,7 @@
InetAddress inetAddress = null;
if (!this.getLocalIp().isEmpty()) {
inetAddress = InetAddress.getByName(this.getLocalIp());
@@ -147,36 +_,61 @@
@@ -147,36 +214,61 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
if (this.getPort() < 0) {
this.setPort(properties.serverPort);
}
@@ -208,7 +216,7 @@
this.debugSampleSubscriptionTracker = new DebugSampleSubscriptionTracker(this.getPlayerList());
this.tickTimeLogger = new RemoteSampleLogger(
TpsDebugDimensions.values().length, this.debugSampleSubscriptionTracker, RemoteDebugSampleType.TICK_TIME
@@ -185,12 +_,12 @@
@@ -185,12 +277,12 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
SkullBlockEntity.setup(this.services, this);
GameProfileCache.setUsesAuthentication(this.usesAuthentication());
LOGGER.info("Preparing level \"{}\"", this.getLevelIdName());
@@ -224,7 +232,7 @@
}
if (properties.enableQuery) {
@@ -203,7 +_,7 @@
@@ -203,7 +295,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
this.rconThread = RconThread.create(this);
}
@@ -233,7 +241,7 @@
Thread thread1 = new Thread(new ServerWatchdog(this));
thread1.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandlerWithName(LOGGER));
thread1.setName("Server Watchdog");
@@ -220,6 +_,12 @@
@@ -220,6 +312,12 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
}
}
@@ -246,7 +254,7 @@
@Override
public boolean isSpawningMonsters() {
return this.settings.getProperties().spawnMonsters && super.isSpawningMonsters();
@@ -232,7 +_,7 @@
@@ -232,7 +330,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
@Override
public void forceDifficulty() {
@@ -255,7 +263,7 @@
}
@Override
@@ -271,12 +_,15 @@
@@ -271,12 +369,15 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
}
if (this.rconThread != null) {
@@ -273,7 +281,7 @@
}
@Override
@@ -291,13 +_,23 @@
@@ -291,13 +392,23 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
}
public void handleConsoleInput(String msg, CommandSourceStack source) {
@@ -301,7 +309,7 @@
}
}
@@ -430,7 +_,11 @@
@@ -430,7 +541,11 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
@Override
public boolean enforceSecureProfile() {
DedicatedServerProperties properties = this.getProperties();
@@ -314,7 +322,7 @@
}
@Override
@@ -515,14 +_,54 @@
@@ -515,14 +630,54 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
@Override
public String getPluginNames() {
@@ -373,7 +381,7 @@
}
public void storeUsingWhiteList(boolean isStoreUsingWhiteList) {
@@ -532,7 +_,7 @@
@@ -532,7 +687,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
@Override
public void stopServer() {
super.stopServer();
@@ -382,7 +390,7 @@
SkullBlockEntity.clear();
}
@@ -626,4 +_,15 @@
@@ -626,4 +781,15 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
}
}
}

View File

@@ -1,6 +1,14 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/server/level/ServerEntity.java b/net/minecraft/server/level/ServerEntity.java
index 9b13a536dc7a9d5d71eb8dbf75597ccdc4bc8f2a..69fbcd734c269bbc9858b0ad0b3b268ddb81fcc6 100644
--- a/net/minecraft/server/level/ServerEntity.java
+++ b/net/minecraft/server/level/ServerEntity.java
@@ -69,11 +_,12 @@
@@ -69,11 +69,12 @@ public class ServerEntity {
private Vec3 lastSentMovement;
private int tickCount;
private int teleportDelay;
@@ -14,7 +22,7 @@
public ServerEntity(
ServerLevel level,
@@ -81,8 +_,12 @@
@@ -81,8 +82,12 @@ public class ServerEntity {
int updateInterval,
boolean trackDelta,
Consumer<Packet<?>> broadcast,
@@ -28,7 +36,7 @@
this.level = level;
this.broadcast = broadcast;
this.entity = entity;
@@ -103,16 +_,22 @@
@@ -103,16 +108,22 @@ public class ServerEntity {
if (!passengers.equals(this.lastPassengers)) {
List<UUID> list = this.mountedOrDismounted(passengers).map(Entity::getUUID).toList();
this.broadcastWithIgnore.accept(new ClientboundSetPassengersPacket(this.entity), list);
@@ -55,7 +63,7 @@
savedData.tickCarriedBy(serverPlayer, item);
Packet<?> updatePacket = savedData.getUpdatePacket(mapId, serverPlayer);
if (updatePacket != null) {
@@ -145,7 +_,13 @@
@@ -145,7 +156,13 @@ public class ServerEntity {
} else {
this.teleportDelay++;
Vec3 vec3 = this.entity.trackingPosition();
@@ -70,7 +78,7 @@
Packet<?> packet = null;
boolean flag2 = flag1 || this.tickCount % 60 == 0;
boolean flag3 = false;
@@ -223,6 +_,25 @@
@@ -223,6 +240,25 @@ public class ServerEntity {
this.tickCount++;
if (this.entity.hurtMarked) {
@@ -96,7 +104,7 @@
this.entity.hurtMarked = false;
this.broadcastAndSend(new ClientboundSetEntityMotionPacket(this.entity));
}
@@ -280,7 +_,10 @@
@@ -280,7 +316,10 @@ public class ServerEntity {
public void sendPairingData(ServerPlayer player, Consumer<Packet<ClientGamePacketListener>> consumer) {
if (this.entity.isRemoved()) {
@@ -108,7 +116,7 @@
}
Packet<ClientGamePacketListener> addEntityPacket = this.entity.getAddEntityPacket(this);
@@ -292,6 +_,12 @@
@@ -292,6 +331,12 @@ public class ServerEntity {
boolean flag = this.trackDelta;
if (this.entity instanceof LivingEntity) {
Collection<AttributeInstance> syncableAttributes = ((LivingEntity)this.entity).getAttributes().getSyncableAttributes();
@@ -121,7 +129,7 @@
if (!syncableAttributes.isEmpty()) {
consumer.accept(new ClientboundUpdateAttributesPacket(this.entity.getId(), syncableAttributes));
}
@@ -316,8 +_,9 @@
@@ -316,8 +361,9 @@ public class ServerEntity {
}
if (!list.isEmpty()) {
@@ -132,7 +140,7 @@
}
if (!this.entity.getPassengers().isEmpty()) {
@@ -364,6 +_,11 @@
@@ -364,6 +410,11 @@ public class ServerEntity {
if (this.entity instanceof LivingEntity) {
Set<AttributeInstance> attributesToSync = ((LivingEntity)this.entity).getAttributes().getAttributesToSync();
if (!attributesToSync.isEmpty()) {

View File

@@ -1,6 +1,14 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java
index 52092ab5a57968e3ce37d996d522975d162b001f..81c615d00323bdf86bdb76db17bb47288cf3feba 100644
--- a/net/minecraft/server/level/ServerLevel.java
+++ b/net/minecraft/server/level/ServerLevel.java
@@ -178,7 +_,7 @@
@@ -178,7 +178,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
final List<ServerPlayer> players = Lists.newArrayList();
public final ServerChunkCache chunkSource;
private final MinecraftServer server;
@@ -9,7 +17,7 @@
private int lastSpawnChunkRadius;
final EntityTickList entityTickList = new EntityTickList();
public final PersistentEntitySectionManager<Entity> entityManager;
@@ -205,11 +_,131 @@
@@ -205,11 +205,131 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
private final boolean tickTime;
private final RandomSequences randomSequences;
@@ -142,7 +150,7 @@
ResourceKey<Level> dimension,
LevelStem levelStem,
ChunkProgressListener progressListener,
@@ -217,14 +_,38 @@
@@ -217,14 +337,38 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
long biomeZoomSeed,
List<CustomSpawner> customSpawners,
boolean tickTime,
@@ -183,7 +191,7 @@
boolean flag = server.forceSynchronousWrites();
DataFixer fixerUpper = server.getFixerUpper();
EntityPersistentStorage<Entity> entityPersistentStorage = new EntityStorage(
@@ -246,8 +_,8 @@
@@ -246,8 +390,8 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
server.getStructureManager(),
dispatcher,
chunkGenerator,
@@ -194,7 +202,7 @@
flag,
progressListener,
this.entityManager::updateChunkStatus,
@@ -268,7 +_,7 @@
@@ -268,7 +412,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
this.chunkSource.chunkScanner(),
this.registryAccess(),
server.getStructureManager(),
@@ -203,7 +211,7 @@
chunkGenerator,
this.chunkSource.randomState(),
this,
@@ -276,9 +_,9 @@
@@ -276,9 +420,9 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
seed,
fixerUpper
);
@@ -216,11 +224,10 @@
} else {
this.dragonFight = null;
}
@@ -286,7 +_,15 @@
@@ -286,7 +430,15 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
this.sleepStatus = new SleepStatus();
this.gameEventDispatcher = new GameEventDispatcher(this);
this.randomSequences = Objects.requireNonNullElseGet(randomSequences, () -> this.getDataStorage().computeIfAbsent(RandomSequences.TYPE));
- }
+ this.getCraftServer().addWorld(this.getWorld()); // CraftBukkit
+ }
+
@@ -228,12 +235,12 @@
+ @Override
+ public boolean hasChunk(int chunkX, int chunkZ) {
+ return this.getChunkSource().getChunkAtIfLoadedImmediately(chunkX, chunkZ) != null;
+ }
}
+ // Paper end
@Deprecated
@VisibleForTesting
@@ -298,8 +_,8 @@
@@ -298,8 +450,8 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
this.serverLevelData.setClearWeatherTime(clearTime);
this.serverLevelData.setRainTime(weatherTime);
this.serverLevelData.setThunderTime(weatherTime);
@@ -244,7 +251,7 @@
}
@Override
@@ -326,12 +_,25 @@
@@ -326,12 +478,25 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
int _int = this.getGameRules().getInt(GameRules.RULE_PLAYERS_SLEEPING_PERCENTAGE);
if (this.sleepStatus.areEnoughSleeping(_int) && this.sleepStatus.areEnoughDeepSleeping(_int, this.players)) {
@@ -273,7 +280,7 @@
if (this.getGameRules().getBoolean(GameRules.RULE_WEATHER_CYCLE) && this.isRaining()) {
this.resetWeatherCycle();
}
@@ -346,9 +_,9 @@
@@ -346,9 +511,9 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
if (!this.isDebug() && runsNormally) {
long l = this.getGameTime();
profilerFiller.push("blockTicks");
@@ -285,7 +292,7 @@
profilerFiller.pop();
}
@@ -366,7 +_,7 @@
@@ -366,7 +531,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
this.handlingTick = false;
profilerFiller.pop();
@@ -294,7 +301,7 @@
if (flag) {
this.resetEmptyTime();
}
@@ -455,11 +_,13 @@
@@ -455,11 +620,13 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
ProfilerFiller profilerFiller = Profiler.get();
profilerFiller.push("iceandsnow");
@@ -308,7 +315,7 @@
profilerFiller.popPush("tickBlocks");
if (randomTickSpeed > 0) {
@@ -502,12 +_,12 @@
@@ -502,12 +669,12 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
int minBlockZ = pos.getMinBlockZ();
ProfilerFiller profilerFiller = Profiler.get();
profilerFiller.push("thunder");
@@ -323,7 +330,7 @@
&& !this.getBlockState(blockPos.below()).is(Blocks.LIGHTNING_ROD);
if (flag) {
SkeletonHorse skeletonHorse = EntityType.SKELETON_HORSE.create(this, EntitySpawnReason.EVENT);
@@ -515,7 +_,7 @@
@@ -515,7 +682,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
skeletonHorse.setTrap(true);
skeletonHorse.setAge(0);
skeletonHorse.setPos(blockPos.getX(), blockPos.getY(), blockPos.getZ());
@@ -332,7 +339,7 @@
}
}
@@ -523,7 +_,7 @@
@@ -523,7 +690,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
if (lightningBolt != null) {
lightningBolt.snapTo(Vec3.atBottomCenterOf(blockPos));
lightningBolt.setVisualOnly(flag);
@@ -341,7 +348,7 @@
}
}
}
@@ -537,7 +_,7 @@
@@ -537,7 +704,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
BlockPos blockPos1 = heightmapPos.below();
Biome biome = this.getBiome(heightmapPos).value();
if (biome.shouldFreeze(this, blockPos1)) {
@@ -350,7 +357,7 @@
}
if (this.isRaining()) {
@@ -549,10 +_,10 @@
@@ -549,10 +716,10 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
if (layersValue < Math.min(_int, 8)) {
BlockState blockState1 = blockState.setValue(SnowLayerBlock.LAYERS, layersValue + 1);
Block.pushEntitiesUp(blockState, blockState1, this, heightmapPos);
@@ -363,7 +370,7 @@
}
}
@@ -577,6 +_,12 @@
@@ -577,6 +744,12 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
}
protected BlockPos findLightningTargetAround(BlockPos pos) {
@@ -376,7 +383,7 @@
BlockPos heightmapPos = this.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, pos);
Optional<BlockPos> optional = this.findLightningRod(heightmapPos);
if (optional.isPresent()) {
@@ -584,11 +_,12 @@
@@ -584,11 +757,12 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
} else {
AABB aabb = AABB.encapsulatingFullBlocks(heightmapPos, heightmapPos.atY(this.getMaxY() + 1)).inflate(3.0);
List<LivingEntity> entitiesOfClass = this.getEntitiesOfClass(
@@ -390,7 +397,7 @@
if (heightmapPos.getY() == this.getMinY() - 1) {
heightmapPos = heightmapPos.above(2);
}
@@ -675,8 +_,8 @@
@@ -675,8 +849,8 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
this.serverLevelData.setThunderTime(thunderTime);
this.serverLevelData.setRainTime(rainTime);
this.serverLevelData.setClearWeatherTime(clearWeatherTime);
@@ -401,7 +408,7 @@
}
this.oThunderLevel = this.thunderLevel;
@@ -697,6 +_,7 @@
@@ -697,6 +871,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
this.rainLevel = Mth.clamp(this.rainLevel, 0.0F, 1.0F);
}
@@ -409,7 +416,7 @@
if (this.oRainLevel != this.rainLevel) {
this.server
.getPlayerList()
@@ -719,14 +_,47 @@
@@ -719,14 +894,47 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
this.server.getPlayerList().broadcastAll(new ClientboundGameEventPacket(ClientboundGameEventPacket.RAIN_LEVEL_CHANGE, this.rainLevel));
this.server.getPlayerList().broadcastAll(new ClientboundGameEventPacket(ClientboundGameEventPacket.THUNDER_LEVEL_CHANGE, this.thunderLevel));
}
@@ -461,7 +468,7 @@
}
public void resetEmptyTime() {
@@ -748,18 +_,46 @@
@@ -748,18 +956,46 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
}
}
@@ -508,7 +515,7 @@
}
private void tickPassenger(Entity ridingEntity, Entity passengerEntity) {
@@ -768,10 +_,12 @@
@@ -768,10 +1004,12 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
} else if (passengerEntity instanceof Player || this.entityTickList.contains(passengerEntity)) {
passengerEntity.setOldPosAndRot();
passengerEntity.tickCount++;
@@ -521,7 +528,7 @@
profilerFiller.pop();
for (Entity entity : passengerEntity.getPassengers()) {
@@ -788,6 +_,7 @@
@@ -788,6 +1026,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
public void save(@Nullable ProgressListener progress, boolean flush, boolean skipSave) {
ServerChunkCache chunkSource = this.getChunkSource();
if (!skipSave) {
@@ -529,7 +536,7 @@
if (progress != null) {
progress.progressStartNoAbort(Component.translatable("menu.savingLevel"));
}
@@ -804,11 +_,19 @@
@@ -804,11 +1043,19 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
this.entityManager.autoSave();
}
}
@@ -550,7 +557,7 @@
}
DimensionDataStorage dataStorage = this.getChunkSource().getDataStorage();
@@ -873,18 +_,40 @@
@@ -873,18 +1120,40 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
@Override
public boolean addFreshEntity(Entity entity) {
@@ -594,7 +601,7 @@
}
}
@@ -907,40 +_,119 @@
@@ -907,40 +1176,119 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
this.entityManager.addNewEntity(player);
}
@@ -668,15 +675,14 @@
public void removePlayerImmediately(ServerPlayer player, Entity.RemovalReason reason) {
- player.remove(reason);
- }
+ player.remove(reason, null); // CraftBukkit - add Bukkit remove cause
+ }
+
+ // CraftBukkit start
+ public boolean strikeLightning(Entity entitylightning) {
+ return this.strikeLightning(entitylightning, org.bukkit.event.weather.LightningStrikeEvent.Cause.UNKNOWN);
+ }
+
}
+ public boolean strikeLightning(Entity entitylightning, org.bukkit.event.weather.LightningStrikeEvent.Cause cause) {
+ org.bukkit.event.weather.LightningStrikeEvent lightning = org.bukkit.craftbukkit.event.CraftEventFactory.callLightningStrikeEvent((org.bukkit.entity.LightningStrike) entitylightning.getBukkitEntity(), cause);
+
@@ -687,7 +693,7 @@
+ return this.addFreshEntity(entitylightning);
+ }
+ // CraftBukkit end
+
@Override
public void destroyBlockProgress(int breakerId, BlockPos pos, int progress) {
+ // CraftBukkit start
@@ -719,7 +725,7 @@
if (d * d + d1 * d1 + d2 * d2 < 1024.0) {
serverPlayer.connection.send(new ClientboundBlockDestructionPacket(breakerId, pos, progress));
}
@@ -1015,7 +_,7 @@
@@ -1015,7 +1363,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
pos.getX(),
pos.getY(),
pos.getZ(),
@@ -728,7 +734,7 @@
this.dimension(),
new ClientboundLevelEventPacket(type, pos, data, false)
);
@@ -1027,6 +_,11 @@
@@ -1027,6 +1375,11 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
@Override
public void gameEvent(Holder<GameEvent> gameEvent, Vec3 pos, GameEvent.Context context) {
@@ -740,7 +746,7 @@
this.gameEventDispatcher.post(gameEvent, pos, context);
}
@@ -1039,17 +_,28 @@
@@ -1039,17 +1392,28 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
this.getChunkSource().blockChanged(pos);
this.pathTypesByPosCache.invalidate(pos);
@@ -769,7 +775,7 @@
try {
this.isUpdatingNavigations = true;
@@ -1061,15 +_,23 @@
@@ -1061,15 +1425,23 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
this.isUpdatingNavigations = false;
}
}
@@ -793,7 +799,7 @@
this.neighborUpdater.updateNeighborsAtExceptFromFacing(pos, block, null, orientation);
}
@@ -1118,6 +_,42 @@
@@ -1118,6 +1490,42 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
ParticleOptions largeExplosionParticles,
Holder<SoundEvent> explosionSound
) {
@@ -836,7 +842,7 @@
Explosion.BlockInteraction blockInteraction = switch (explosionInteraction) {
case NONE -> Explosion.BlockInteraction.KEEP;
case BLOCK -> this.getDestroyType(GameRules.RULE_BLOCK_EXPLOSION_DROP_DECAY);
@@ -1126,10 +_,17 @@
@@ -1126,10 +1534,17 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
: Explosion.BlockInteraction.KEEP;
case TNT -> this.getDestroyType(GameRules.RULE_TNT_EXPLOSION_DROP_DECAY);
case TRIGGER -> Explosion.BlockInteraction.TRIGGER_BLOCK;
@@ -854,7 +860,7 @@
ParticleOptions particleOptions = serverExplosion.isSmall() ? smallExplosionParticles : largeExplosionParticles;
for (ServerPlayer serverPlayer : this.players) {
@@ -1138,6 +_,8 @@
@@ -1138,6 +1553,8 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
serverPlayer.connection.send(new ClientboundExplodePacket(vec3, optional, particleOptions, explosionSound));
}
}
@@ -863,7 +869,7 @@
}
private Explosion.BlockInteraction getDestroyType(GameRules.Key<GameRules.BooleanValue> decayGameRule) {
@@ -1208,7 +_,7 @@
@@ -1208,7 +1625,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
public <T extends ParticleOptions> int sendParticles(
T type, double posX, double posY, double posZ, int particleCount, double xOffset, double yOffset, double zOffset, double speed
) {
@@ -872,7 +878,7 @@
}
public <T extends ParticleOptions> int sendParticles(
@@ -1224,13 +_,49 @@
@@ -1224,13 +1641,49 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
double zOffset,
double speed
) {
@@ -924,7 +930,7 @@
if (this.sendParticles(serverPlayer, overrideLimiter, posX, posY, posZ, clientboundLevelParticlesPacket)) {
i++;
}
@@ -1293,7 +_,7 @@
@@ -1293,7 +1746,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
@Nullable
public BlockPos findNearestMapStructure(TagKey<Structure> structureTag, BlockPos pos, int radius, boolean skipExistingChunks) {
@@ -933,7 +939,7 @@
return null;
} else {
Optional<HolderSet.Named<Structure>> optional = this.registryAccess().lookupOrThrow(Registries.STRUCTURE).get(structureTag);
@@ -1340,10 +_,36 @@
@@ -1340,10 +1793,36 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
@Nullable
@Override
public MapItemSavedData getMapData(MapId mapId) {
@@ -971,7 +977,7 @@
this.getServer().overworld().getDataStorage().set(MapItemSavedData.type(mapId), data);
}
@@ -1355,17 +_,27 @@
@@ -1355,17 +1834,27 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
BlockPos spawnPos = this.levelData.getSpawnPos();
float spawnAngle = this.levelData.getSpawnAngle();
if (!spawnPos.equals(pos) || spawnAngle != angle) {
@@ -1001,7 +1007,7 @@
}
this.lastSpawnChunkRadius = i;
@@ -1400,6 +_,11 @@
@@ -1400,6 +1889,11 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
DebugPackets.sendPoiRemovedPacket(this, blockPos);
}));
optional1.ifPresent(holder -> this.getServer().execute(() -> {
@@ -1013,7 +1019,7 @@
this.getPoiManager().add(blockPos, (Holder<PoiType>)holder);
DebugPackets.sendPoiAddedPacket(this, blockPos);
}));
@@ -1552,12 +_,12 @@
@@ -1552,12 +2046,12 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
}
public boolean isFlat() {
@@ -1028,7 +1034,7 @@
}
@Nullable
@@ -1608,6 +_,7 @@
@@ -1608,6 +2102,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
@Override
public LevelEntityGetter<Entity> getEntities() {
@@ -1036,7 +1042,7 @@
return this.entityManager.getEntityGetter();
}
@@ -1697,6 +_,28 @@
@@ -1697,6 +2192,28 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
return this.serverLevelData.getGameRules();
}
@@ -1065,7 +1071,7 @@
@Override
public CrashReportCategory fillReportDetails(CrashReport report) {
CrashReportCategory crashReportCategory = super.fillReportDetails(report);
@@ -1712,6 +_,7 @@
@@ -1712,6 +2229,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
final class EntityCallbacks implements LevelCallback<Entity> {
@Override
public void onCreated(Entity entity) {
@@ -1073,7 +1079,7 @@
}
@Override
@@ -1721,24 +_,32 @@
@@ -1721,24 +2239,32 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
@Override
public void onTickingStart(Entity entity) {
@@ -1108,7 +1114,7 @@
String string = "onTrackingStart called during navigation iteration";
Util.logAndPauseIfInIde(
"onTrackingStart called during navigation iteration", new IllegalStateException("onTrackingStart called during navigation iteration")
@@ -1755,10 +_,52 @@
@@ -1755,10 +2281,52 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
}
entity.updateDynamicGameEventListener(DynamicGameEventListener::add);
@@ -1161,7 +1167,7 @@
ServerLevel.this.getChunkSource().removeEntity(entity);
if (entity instanceof ServerPlayer serverPlayer) {
ServerLevel.this.players.remove(serverPlayer);
@@ -1766,7 +_,7 @@
@@ -1766,7 +2334,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
}
if (entity instanceof Mob mob) {
@@ -1170,7 +1176,7 @@
String string = "onTrackingStart called during navigation iteration";
Util.logAndPauseIfInIde(
"onTrackingStart called during navigation iteration", new IllegalStateException("onTrackingStart called during navigation iteration")
@@ -1783,6 +_,15 @@
@@ -1783,6 +2351,15 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
}
entity.updateDynamicGameEventListener(DynamicGameEventListener::remove);
@@ -1186,7 +1192,7 @@
}
@Override
@@ -1790,4 +_,24 @@
@@ -1790,4 +2367,24 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
entity.updateDynamicGameEventListener(DynamicGameEventListener::move);
}
}

View File

@@ -1,6 +1,14 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java
index 62cd0d7f900130806c007ffba1bc95367725e991..57af8cd7629fa14176c6e7a29956617ec9506999 100644
--- a/net/minecraft/server/level/ServerPlayer.java
+++ b/net/minecraft/server/level/ServerPlayer.java
@@ -65,7 +_,6 @@
@@ -65,7 +65,6 @@ import net.minecraft.network.protocol.game.ClientboundHorseScreenOpenPacket;
import net.minecraft.network.protocol.game.ClientboundHurtAnimationPacket;
import net.minecraft.network.protocol.game.ClientboundMerchantOffersPacket;
import net.minecraft.network.protocol.game.ClientboundOpenBookPacket;
@@ -8,7 +16,7 @@
import net.minecraft.network.protocol.game.ClientboundOpenSignEditorPacket;
import net.minecraft.network.protocol.game.ClientboundPlayerAbilitiesPacket;
import net.minecraft.network.protocol.game.ClientboundPlayerCombatEndPacket;
@@ -235,7 +_,8 @@
@@ -235,7 +234,8 @@ public class ServerPlayer extends Player {
private int levitationStartTime;
private boolean disconnected;
private int requestedViewDistance = 2;
@@ -18,7 +26,7 @@
@Nullable
private Vec3 startingToFallPosition;
@Nullable
@@ -281,6 +_,13 @@
@@ -281,6 +281,13 @@ public class ServerPlayer extends Player {
}
}
@@ -32,7 +40,7 @@
@Override
public void sendSlotChange(AbstractContainerMenu container, int slot, ItemStack itemStack) {
ServerPlayer.this.connection.send(new ClientboundContainerSetSlotPacket(container.containerId, container.incrementStateId(), slot, itemStack));
@@ -316,6 +_,32 @@
@@ -316,6 +323,32 @@ public class ServerPlayer extends Player {
}
}
@@ -65,7 +73,7 @@
@Override
public void dataChanged(AbstractContainerMenu containerMenu, int dataSlotIndex, int value) {
}
@@ -344,9 +_,43 @@
@@ -344,9 +377,43 @@ public class ServerPlayer extends Player {
public void sendSystemMessage(Component component) {
ServerPlayer.this.sendSystemMessage(component);
}
@@ -109,7 +117,7 @@
public ServerPlayer(MinecraftServer server, ServerLevel level, GameProfile gameProfile, ClientInformation clientInformation) {
super(level, level.getSharedSpawnPos(), level.getSharedSpawnAngle(), gameProfile);
@@ -356,16 +_,22 @@
@@ -356,16 +423,22 @@ public class ServerPlayer extends Player {
this.server = server;
this.stats = server.getPlayerList().getPlayerStats(this);
this.advancements = server.getPlayerList().getPlayerAdvancements(this);
@@ -135,7 +143,7 @@
int max = Math.max(0, this.server.getSpawnRadius(level));
int floor = Mth.floor(level.getWorldBorder().getDistanceToBorder(pos.getX(), pos.getZ()));
if (floor < max) {
@@ -436,6 +_,7 @@
@@ -436,6 +509,7 @@ public class ServerPlayer extends Player {
this.enteredNetherPosition = compound.read("entered_nether_pos", Vec3.CODEC).orElse(null);
this.seenCredits = compound.getBooleanOr("seenCredits", false);
this.recipeBook.fromNbt(compound.getCompoundOrEmpty("recipeBook"), key -> this.server.getRecipeManager().byKey(key).isPresent());
@@ -143,7 +151,7 @@
if (this.isSleeping()) {
this.stopSleeping();
}
@@ -459,12 +_,24 @@
@@ -459,12 +533,24 @@ public class ServerPlayer extends Player {
compound.putBoolean("spawn_extra_particles_on_fall", this.spawnExtraParticlesOnFall);
compound.storeNullable("raid_omen_position", BlockPos.CODEC, this.raidOmenPosition);
this.saveEnderPearls(compound);
@@ -169,7 +177,7 @@
CompoundTag compoundTag = new CompoundTag();
CompoundTag compoundTag1 = new CompoundTag();
rootVehicle.save(compoundTag1);
@@ -479,7 +_,7 @@
@@ -479,7 +565,7 @@ public class ServerPlayer extends Player {
if (!compound.isEmpty()) {
ServerLevel serverLevel = this.serverLevel();
Entity entity = EntityType.loadEntityRecursive(
@@ -178,7 +186,7 @@
);
if (entity != null) {
UUID uuid = compound.get().read("Attach", UUIDUtil.CODEC).orElse(null);
@@ -496,10 +_,10 @@
@@ -496,10 +582,10 @@ public class ServerPlayer extends Player {
if (!this.isPassenger()) {
LOGGER.warn("Couldn't reattach entity to player");
@@ -191,7 +199,7 @@
}
}
}
@@ -511,6 +_,7 @@
@@ -511,6 +597,7 @@ public class ServerPlayer extends Player {
ListTag listTag = new ListTag();
for (ThrownEnderpearl thrownEnderpearl : this.enderPearls) {
@@ -199,7 +207,7 @@
if (thrownEnderpearl.isRemoved()) {
LOGGER.warn("Trying to save removed ender pearl, skipping");
} else {
@@ -546,6 +_,16 @@
@@ -546,6 +633,16 @@ public class ServerPlayer extends Player {
}
}
@@ -216,7 +224,7 @@
public void setExperiencePoints(int experiencePoints) {
float f = this.getXpNeededForNextLevel();
float f1 = (f - 1.0F) / f;
@@ -603,6 +_,11 @@
@@ -603,6 +700,11 @@ public class ServerPlayer extends Player {
@Override
public void tick() {
@@ -228,7 +236,7 @@
this.tickClientLoadTimeout();
this.gameMode.tick();
this.wardenSpawnTracker.tick();
@@ -610,9 +_,14 @@
@@ -610,9 +712,14 @@ public class ServerPlayer extends Player {
this.invulnerableTime--;
}
@@ -246,7 +254,7 @@
this.containerMenu = this.inventoryMenu;
}
@@ -662,7 +_,7 @@
@@ -662,7 +769,7 @@ public class ServerPlayer extends Player {
public void doTick() {
try {
@@ -255,7 +263,7 @@
super.tick();
}
@@ -676,7 +_,7 @@
@@ -676,7 +783,7 @@ public class ServerPlayer extends Player {
if (this.getHealth() != this.lastSentHealth
|| this.lastSentFood != this.foodData.getFoodLevel()
|| this.foodData.getSaturationLevel() == 0.0F != this.lastFoodSaturationZero) {
@@ -264,7 +272,7 @@
this.lastSentHealth = this.getHealth();
this.lastSentFood = this.foodData.getFoodLevel();
this.lastFoodSaturationZero = this.foodData.getSaturationLevel() == 0.0F;
@@ -707,6 +_,12 @@
@@ -707,6 +814,12 @@ public class ServerPlayer extends Player {
this.updateScoreForCriteria(ObjectiveCriteria.EXPERIENCE, Mth.ceil((float)this.lastRecordedExperience));
}
@@ -277,7 +285,7 @@
if (this.experienceLevel != this.lastRecordedLevel) {
this.lastRecordedLevel = this.experienceLevel;
this.updateScoreForCriteria(ObjectiveCriteria.LEVEL, Mth.ceil((float)this.lastRecordedLevel));
@@ -720,6 +_,21 @@
@@ -720,6 +833,21 @@ public class ServerPlayer extends Player {
if (this.tickCount % 20 == 0) {
CriteriaTriggers.LOCATION.trigger(this);
}
@@ -299,7 +307,7 @@
} catch (Throwable var4) {
CrashReport crashReport = CrashReport.forThrowable(var4, "Ticking player");
CrashReportCategory crashReportCategory = crashReport.addCategory("Player being ticked");
@@ -744,7 +_,7 @@
@@ -744,7 +872,7 @@ public class ServerPlayer extends Player {
if (this.level().getDifficulty() == Difficulty.PEACEFUL && this.serverLevel().getGameRules().getBoolean(GameRules.RULE_NATURAL_REGENERATION)) {
if (this.tickCount % 20 == 0) {
if (this.getHealth() < this.getMaxHealth()) {
@@ -308,22 +316,20 @@
}
float saturationLevel = this.foodData.getSaturationLevel();
@@ -793,15 +_,36 @@
@@ -793,15 +921,36 @@ public class ServerPlayer extends Player {
}
private void updateScoreForCriteria(ObjectiveCriteria criteria, int points) {
- this.getScoreboard().forAllObjectives(criteria, this, score -> score.set(points));
- }
-
+ this.level().getCraftServer().getScoreboardManager().forAllObjectives(criteria, this, score -> score.set(points)); // CraftBukkit - Use our scores instead
}
- @Override
- public void die(DamageSource cause) {
- this.gameEvent(GameEvent.ENTITY_DIE);
- boolean _boolean = this.serverLevel().getGameRules().getBoolean(GameRules.RULE_SHOWDEATHMESSAGES);
- if (_boolean) {
- Component deathMessage = this.getCombatTracker().getDeathMessage();
+ this.level().getCraftServer().getScoreboardManager().forAllObjectives(criteria, this, score -> score.set(points)); // CraftBukkit - Use our scores instead
+ }
+
+ // Paper start - PlayerDeathEvent#getItemsToKeep
+ private static boolean shouldKeepDeathEventItem(
+ final org.bukkit.event.entity.PlayerDeathEvent event,
@@ -354,7 +360,7 @@
this.connection
.send(
new ClientboundPlayerCombatKillPacket(this.getId(), deathMessage),
@@ -818,6 +_,65 @@
@@ -818,6 +967,65 @@ public class ServerPlayer extends Player {
}
)
);
@@ -420,7 +426,7 @@
Team team = this.getTeam();
if (team == null || team.getDeathMessageVisibility() == Team.Visibility.ALWAYS) {
this.server.getPlayerList().broadcastSystemMessage(deathMessage, false);
@@ -827,7 +_,7 @@
@@ -827,7 +1035,7 @@ public class ServerPlayer extends Player {
this.server.getPlayerList().broadcastSystemToAllExceptTeam(this, deathMessage);
}
} else {
@@ -429,7 +435,7 @@
}
this.removeEntitiesOnShoulder();
@@ -835,11 +_,35 @@
@@ -835,11 +1043,35 @@ public class ServerPlayer extends Player {
this.tellNeutralMobsThatIDied();
}
@@ -468,7 +474,7 @@
LivingEntity killCredit = this.getKillCredit();
if (killCredit != null) {
this.awardStat(Stats.ENTITY_KILLED_BY.get(killCredit.getType()));
@@ -872,10 +_,10 @@
@@ -872,10 +1104,10 @@ public class ServerPlayer extends Player {
public void awardKillScore(Entity entity, DamageSource damageSource) {
if (entity != this) {
super.awardKillScore(entity, damageSource);
@@ -481,7 +487,7 @@
} else {
this.awardStat(Stats.MOB_KILLS);
}
@@ -891,7 +_,7 @@
@@ -891,7 +1123,7 @@ public class ServerPlayer extends Player {
if (playersTeam != null) {
int id = playersTeam.getColor().getId();
if (id >= 0 && id < crtieria.length) {
@@ -490,7 +496,7 @@
}
}
}
@@ -902,9 +_,20 @@
@@ -902,9 +1134,20 @@ public class ServerPlayer extends Player {
return false;
} else {
Entity entity = damageSource.getEntity();
@@ -513,7 +519,7 @@
}
}
@@ -914,23 +_,77 @@
@@ -914,23 +1157,77 @@ public class ServerPlayer extends Player {
}
private boolean isPvpAllowed() {
@@ -546,7 +552,6 @@
}
} else {
- return new TeleportTransition(this.server.overworld(), this, postTeleportTransition);
- }
+ teleportTransition = new TeleportTransition(this.server.overworld(), this, postTeleportTransition); // CraftBukkit
+ }
+ // CraftBukkit start
@@ -576,7 +581,7 @@
+ // Spigot start
+ if (this.connection.isDisconnected()) {
+ return null;
+ }
}
+ // Spigot end
+
+ location = respawnEvent.getRespawnLocation();
@@ -597,7 +602,7 @@
}
public static Optional<ServerPlayer.RespawnPosAngle> findRespawnAndUseSpawnBlock(
@@ -947,10 +_,10 @@
@@ -947,10 +1244,10 @@ public class ServerPlayer extends Player {
level.setBlock(blockPos, blockState.setValue(RespawnAnchorBlock.CHARGE, blockState.getValue(RespawnAnchorBlock.CHARGE) - 1), 3);
}
@@ -610,7 +615,7 @@
} else if (!flag) {
return Optional.empty();
} else {
@@ -958,7 +_,7 @@
@@ -958,7 +1255,7 @@ public class ServerPlayer extends Player {
BlockState blockState1 = level.getBlockState(blockPos.above());
boolean isPossibleToRespawnInThis1 = blockState1.getBlock().isPossibleToRespawnInThis(blockState1);
return isPossibleToRespawnInThis && isPossibleToRespawnInThis1
@@ -619,7 +624,7 @@
: Optional.empty();
}
}
@@ -976,6 +_,7 @@
@@ -976,6 +1273,7 @@ public class ServerPlayer extends Player {
@Nullable
@Override
public ServerPlayer teleport(TeleportTransition teleportTransition) {
@@ -627,7 +632,7 @@
if (this.isRemoved()) {
return null;
} else {
@@ -985,17 +_,52 @@
@@ -985,17 +1283,52 @@ public class ServerPlayer extends Player {
ServerLevel level = teleportTransition.newLevel();
ServerLevel serverLevel = this.serverLevel();
@@ -683,7 +688,7 @@
this.isChangingDimension = true;
LevelData levelData = level.getLevelData();
this.connection.send(new ClientboundRespawnPacket(this.createCommonSpawnInfo(level), (byte)3));
@@ -1004,16 +_,30 @@
@@ -1004,16 +1337,30 @@ public class ServerPlayer extends Player {
playerList.sendPlayerPermissionLevel(this);
serverLevel.removePlayerImmediately(this, Entity.RemovalReason.CHANGED_DIMENSION);
this.unsetRemoved();
@@ -716,7 +721,7 @@
this.connection.resetPosition();
level.addDuringTeleport(this);
profilerFiller.pop();
@@ -1027,10 +_,39 @@
@@ -1027,11 +1374,40 @@ public class ServerPlayer extends Player {
this.lastSentExp = -1;
this.lastSentHealth = -1.0F;
this.lastSentFood = -1;
@@ -735,7 +740,7 @@
}
}
}
+
+ // CraftBukkit start
+ @Override
+ public @Nullable org.bukkit.craftbukkit.event.CraftPortalEvent callPortalEvent(
@@ -753,10 +758,11 @@
+ return new org.bukkit.craftbukkit.event.CraftPortalEvent(event);
+ }
+ // CraftBukkit end
+
@Override
public void forceSetRotation(float yRot, float xRot) {
@@ -1040,12 +_,26 @@
this.connection.send(new ClientboundPlayerRotationPacket(yRot, xRot));
@@ -1040,12 +1416,26 @@ public class ServerPlayer extends Player {
public void triggerDimensionChangeTriggers(ServerLevel level) {
ResourceKey<Level> resourceKey = level.dimension();
ResourceKey<Level> resourceKey1 = this.level().dimension();
@@ -786,7 +792,7 @@
this.enteredNetherPosition = null;
}
}
@@ -1061,19 +_,18 @@
@@ -1061,19 +1451,18 @@ public class ServerPlayer extends Player {
this.containerMenu.broadcastChanges();
}
@@ -810,7 +816,7 @@
if (this.level().isBrightOutside()) {
return Either.left(Player.BedSleepingProblem.NOT_POSSIBLE_NOW);
} else {
@@ -1092,7 +_,34 @@
@@ -1092,7 +1481,34 @@ public class ServerPlayer extends Player {
}
}
@@ -846,7 +852,7 @@
this.awardStat(Stats.SLEEP_IN_BED);
CriteriaTriggers.SLEPT_IN_BED.trigger(this);
});
@@ -1128,21 +_,29 @@
@@ -1128,21 +1544,29 @@ public class ServerPlayer extends Player {
@Override
public void stopSleepInBed(boolean wakeImmediately, boolean updateLevelForSleepingPlayers) {
@@ -879,7 +885,7 @@
}
@Override
@@ -1185,8 +_,9 @@
@@ -1185,8 +1609,9 @@ public class ServerPlayer extends Player {
this.connection.send(new ClientboundOpenSignEditorPacket(signEntity.getBlockPos(), isFrontText));
}
@@ -890,7 +896,7 @@
}
@Override
@@ -1194,12 +_,39 @@
@@ -1194,12 +1619,39 @@ public class ServerPlayer extends Player {
if (menu == null) {
return OptionalInt.empty();
} else {
@@ -931,7 +937,7 @@
if (abstractContainerMenu == null) {
if (this.isSpectator()) {
this.displayClientMessage(Component.translatable("container.spectatorCantOpen").withStyle(ChatFormatting.RED), true);
@@ -1207,10 +_,14 @@
@@ -1207,10 +1659,14 @@ public class ServerPlayer extends Player {
return OptionalInt.empty();
} else {
@@ -948,7 +954,7 @@
return OptionalInt.of(this.containerCounter);
}
}
@@ -1223,14 +_,25 @@
@@ -1223,14 +1679,25 @@ public class ServerPlayer extends Player {
@Override
public void openHorseInventory(AbstractHorse horse, Container inventory) {
@@ -977,7 +983,7 @@
this.initMenu(this.containerMenu);
}
@@ -1252,10 +_,30 @@
@@ -1252,10 +1719,30 @@ public class ServerPlayer extends Player {
@Override
public void closeContainer() {
@@ -1008,7 +1014,7 @@
@Override
public void doCloseContainer() {
this.containerMenu.removed(this);
@@ -1278,19 +_,19 @@
@@ -1278,19 +1765,19 @@ public class ServerPlayer extends Player {
int rounded = Math.round((float)Math.sqrt(dx * dx + dy * dy + dz * dz) * 100.0F);
if (rounded > 0) {
this.awardStat(Stats.SWIM_ONE_CM, rounded);
@@ -1031,7 +1037,7 @@
}
} else if (this.onClimbable()) {
if (dy > 0.0) {
@@ -1301,13 +_,13 @@
@@ -1301,13 +1788,13 @@ public class ServerPlayer extends Player {
if (rounded > 0) {
if (this.isSprinting()) {
this.awardStat(Stats.SPRINT_ONE_CM, rounded);
@@ -1048,7 +1054,7 @@
}
}
} else if (this.isFallFlying()) {
@@ -1347,13 +_,13 @@
@@ -1347,13 +1834,13 @@ public class ServerPlayer extends Player {
@Override
public void awardStat(Stat<?> stat, int amount) {
this.stats.increment(this, stat, amount);
@@ -1064,7 +1070,7 @@
}
@Override
@@ -1384,9 +_,9 @@
@@ -1384,9 +1871,9 @@ public class ServerPlayer extends Player {
super.jumpFromGround();
this.awardStat(Stats.JUMP);
if (this.isSprinting()) {
@@ -1076,7 +1082,7 @@
}
}
@@ -1399,6 +_,13 @@
@@ -1399,6 +1886,13 @@ public class ServerPlayer extends Player {
public void disconnect() {
this.disconnected = true;
this.ejectPassengers();
@@ -1090,7 +1096,7 @@
if (this.isSleeping()) {
this.stopSleepInBed(true, false);
}
@@ -1410,6 +_,7 @@
@@ -1410,6 +1904,7 @@ public class ServerPlayer extends Player {
public void resetSentInfo() {
this.lastSentHealth = -1.0E8F;
@@ -1098,7 +1104,7 @@
}
@Override
@@ -1444,12 +_,12 @@
@@ -1444,12 +1939,12 @@ public class ServerPlayer extends Player {
this.onUpdateAbilities();
if (keepEverything) {
this.getAttributes().assignBaseValues(that.getAttributes());
@@ -1113,7 +1119,7 @@
}
this.getInventory().replaceWith(that.getInventory());
@@ -1460,7 +_,7 @@
@@ -1460,7 +1955,7 @@ public class ServerPlayer extends Player {
this.portalProcess = that.portalProcess;
} else {
this.getAttributes().assignBaseValues(that.getAttributes());
@@ -1122,7 +1128,7 @@
if (this.serverLevel().getGameRules().getBoolean(GameRules.RULE_KEEPINVENTORY) || that.isSpectator()) {
this.getInventory().replaceWith(that.getInventory());
this.experienceLevel = that.experienceLevel;
@@ -1476,7 +_,7 @@
@@ -1476,7 +1971,7 @@ public class ServerPlayer extends Player {
this.lastSentExp = -1;
this.lastSentHealth = -1.0F;
this.lastSentFood = -1;
@@ -1131,7 +1137,7 @@
this.seenCredits = that.seenCredits;
this.enteredNetherPosition = that.enteredNetherPosition;
this.chunkTrackingView = that.chunkTrackingView;
@@ -1529,7 +_,7 @@
@@ -1529,7 +2024,7 @@ public class ServerPlayer extends Player {
}
@Override
@@ -1140,7 +1146,7 @@
if (this.isSleeping()) {
this.stopSleepInBed(true, true);
}
@@ -1538,7 +_,7 @@
@@ -1538,7 +2033,7 @@ public class ServerPlayer extends Player {
this.setCamera(this);
}
@@ -1149,7 +1155,7 @@
if (flag) {
this.setYHeadRot(relativeMovements.contains(Relative.Y_ROT) ? this.getYHeadRot() + yaw : yaw);
}
@@ -1575,9 +_,17 @@
@@ -1575,9 +2070,17 @@ public class ServerPlayer extends Player {
}
public boolean setGameMode(GameType gameMode) {
@@ -1169,7 +1175,7 @@
} else {
this.connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.CHANGE_GAME_MODE, gameMode.getId()));
if (gameMode == GameType.SPECTATOR) {
@@ -1593,7 +_,7 @@
@@ -1593,7 +2096,7 @@ public class ServerPlayer extends Player {
this.onUpdateAbilities();
this.updateEffectVisibility();
@@ -1178,7 +1184,7 @@
}
}
@@ -1649,8 +_,13 @@
@@ -1649,8 +2152,13 @@ public class ServerPlayer extends Player {
}
public void sendChatMessage(OutgoingChatMessage message, boolean filtered, ChatType.Bound boundType) {
@@ -1193,7 +1199,7 @@
}
}
@@ -1661,7 +_,42 @@
@@ -1661,7 +2169,42 @@ public class ServerPlayer extends Player {
}
public void updateOptions(ClientInformation clientInformation) {
@@ -1236,7 +1242,7 @@
this.requestedViewDistance = clientInformation.viewDistance();
this.chatVisibility = clientInformation.chatVisibility();
this.canChatColor = clientInformation.chatColors();
@@ -1747,8 +_,23 @@
@@ -1747,8 +2290,23 @@ public class ServerPlayer extends Player {
Entity camera = this.getCamera();
this.camera = (Entity)(entityToSpectate == null ? this : entityToSpectate);
if (camera != this.camera) {
@@ -1261,7 +1267,7 @@
}
if (entityToSpectate != null) {
@@ -1782,11 +_,11 @@
@@ -1782,11 +2340,11 @@ public class ServerPlayer extends Player {
@Nullable
public Component getTabListDisplayName() {
@@ -1275,7 +1281,7 @@
}
@Override
@@ -1817,11 +_,56 @@
@@ -1817,11 +2375,56 @@ public class ServerPlayer extends Player {
}
public void setRespawnPosition(@Nullable ServerPlayer.RespawnConfig respawnConfig, boolean displayInChat) {
@@ -1334,7 +1340,7 @@
}
public SectionPos getLastSectionPos() {
@@ -1851,16 +_,23 @@
@@ -1851,16 +2454,23 @@ public class ServerPlayer extends Player {
}
@Override
@@ -1362,7 +1368,7 @@
return itemEntity;
}
@@ -1888,6 +_,16 @@
@@ -1888,6 +2498,16 @@ public class ServerPlayer extends Player {
}
public void loadGameTypes(@Nullable CompoundTag tag) {
@@ -1379,7 +1385,7 @@
this.gameMode
.setGameModeForPlayer(this.calculateGameModeForNewPlayer(readPlayerMode(tag, "playerGameType")), readPlayerMode(tag, "previousPlayerGameType"));
}
@@ -1989,8 +_,14 @@
@@ -1989,8 +2609,14 @@ public class ServerPlayer extends Player {
@Override
public void removeVehicle() {
@@ -1395,7 +1401,7 @@
if (vehicle instanceof LivingEntity livingEntity) {
for (MobEffectInstance mobEffectInstance : livingEntity.getActiveEffects()) {
this.connection.send(new ClientboundRemoveMobEffectPacket(vehicle.getId(), mobEffectInstance.getEffect()));
@@ -2089,7 +_,7 @@
@@ -2089,7 +2715,7 @@ public class ServerPlayer extends Player {
}
public static long placeEnderPearlTicket(ServerLevel level, ChunkPos pos) {
@@ -1404,7 +1410,7 @@
return TicketType.ENDER_PEARL.timeout();
}
@@ -2113,9 +_,11 @@
@@ -2113,9 +2739,11 @@ public class ServerPlayer extends Player {
}
}
@@ -1419,7 +1425,7 @@
}
private static float calculateLookAtYaw(Vec3 position, BlockPos towardsPos) {
@@ -2123,4 +_,143 @@
@@ -2123,4 +2751,143 @@ public class ServerPlayer extends Player {
return (float)Mth.wrapDegrees(Mth.atan2(vec3.z, vec3.x) * 180.0F / (float)Math.PI - 90.0);
}
}

View File

@@ -1,6 +1,14 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
index aa2c3c670063f980fce003c1b7df926df8c61f12..186393485396cfe9b1baef29586198356e2d2600 100644
--- a/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
+++ b/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
@@ -27,30 +_,67 @@
@@ -27,31 +27,68 @@ import net.minecraft.util.VisibleForDebug;
import net.minecraft.util.profiling.Profiler;
import org.slf4j.Logger;
@@ -39,13 +47,12 @@
this.keepAliveTime = Util.getMillis();
this.latency = cookie.latency();
this.transferred = cookie.transferred();
- }
+ // CraftBukkit start - add fields and methods
+ this.player = player;
+ this.player.transferCookieConnection = this;
+ this.cserver = server.server;
+ }
+
}
+ public org.bukkit.craftbukkit.entity.CraftPlayer getCraftPlayer() {
+ return this.player.getBukkitEntity();
+ }
@@ -70,10 +77,11 @@
+ this.disconnect(reason, cause); // Paper - kick event causes
+ }
+ // CraftBukkit end
+
private void close() {
if (!this.closed) {
@@ -61,6 +_,12 @@
this.closedListenerTime = Util.getMillis();
@@ -61,6 +98,12 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
@Override
public void onDisconnect(DisconnectionDetails details) {
@@ -86,7 +94,7 @@
if (this.isSingleplayerOwner()) {
LOGGER.info("Stopping singleplayer server as player logged out");
this.server.halt(false);
@@ -80,7 +_,7 @@
@@ -80,7 +123,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
this.latency = (this.latency * 3 + i) / 4;
this.keepAlivePending = false;
} else if (!this.isSingleplayerOwner()) {
@@ -95,7 +103,7 @@
}
}
@@ -88,30 +_,123 @@
@@ -88,30 +131,123 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
public void handlePong(ServerboundPongPacket packet) {
}
@@ -104,7 +112,6 @@
+
@Override
public void handleCustomPayload(ServerboundCustomPayloadPacket packet) {
- }
+ // Paper start
+ if (packet.payload() instanceof net.minecraft.network.protocol.common.custom.BrandPayload(String brand)) {
+ this.player.clientBrandName = brand;
@@ -165,7 +172,7 @@
+
+ public final boolean isDisconnected() {
+ return (!this.player.joining && !this.connection.isConnected()) || this.processedDisconnect; // Paper - Fix duplication bugs
+ }
}
+ // Paper end
@Override
@@ -174,9 +181,8 @@
if (packet.action() == ServerboundResourcePackPacket.Action.DECLINED && this.server.isResourcePackRequired()) {
LOGGER.info("Disconnecting {} due to resource pack {} rejection", this.playerProfile().getName(), packet.id());
- this.disconnect(Component.translatable("multiplayer.requiredTexturePrompt.disconnect"));
- }
+ this.disconnect(Component.translatable("multiplayer.requiredTexturePrompt.disconnect"), org.bukkit.event.player.PlayerKickEvent.Cause.RESOURCE_PACK_REJECTION); // Paper - kick event cause
+ }
}
+ // Paper start - adventure pack callbacks
+ // call the callbacks before the previously-existing event so the event has final say
+ final net.kyori.adventure.resource.ResourcePackCallback callback;
@@ -225,7 +231,7 @@
} else if (this.checkIfClosed(millis)) {
this.keepAlivePending = true;
this.keepAliveTime = millis;
@@ -126,7 +_,7 @@
@@ -126,7 +262,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
private boolean checkIfClosed(long time) {
if (this.closed) {
if (time - this.closedListenerTime >= 15000L) {
@@ -234,7 +240,7 @@
}
return false;
@@ -149,6 +_,13 @@
@@ -149,6 +285,13 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
}
public void send(Packet<?> packet, @Nullable PacketSendListener listener) {
@@ -248,7 +254,7 @@
if (packet.isTerminal()) {
this.close();
}
@@ -165,19 +_,115 @@
@@ -165,19 +308,115 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
}
}
@@ -265,9 +271,6 @@
+ @Deprecated @io.papermc.paper.annotation.DoNotUse // Paper - kick event causes
public void disconnect(Component reason) {
- this.disconnect(new DisconnectionDetails(reason));
- }
-
- public void disconnect(DisconnectionDetails disconnectionDetails) {
+ // Paper start - kick event causes
+ this.disconnect(reason, org.bukkit.event.player.PlayerKickEvent.Cause.UNKNOWN);
+ }
@@ -324,8 +327,9 @@
+
+ // Send the possibly modified leave message
+ this.disconnect0(new DisconnectionDetails(io.papermc.paper.adventure.PaperAdventure.asVanilla(event.reason()), disconnectionDetails.report(), disconnectionDetails.bugReportLink()), event.leaveMessage()); // Paper - Adventure & use kick event leave message
+ }
+
}
- public void disconnect(DisconnectionDetails disconnectionDetails) {
+ private void disconnect0(DisconnectionDetails disconnectionDetails, @Nullable net.kyori.adventure.text.Component leaveMessage) { // Paper - use kick event leave message
+ // CraftBukkit end
+ this.player.quitReason = org.bukkit.event.player.PlayerQuitEvent.QuitReason.KICKED; // Paper - Add API for quit reason
@@ -334,11 +338,9 @@
new ClientboundDisconnectPacket(disconnectionDetails.reason()),
PacketSendListener.thenRun(() -> this.connection.disconnect(disconnectionDetails))
);
- this.connection.setReadOnly();
- this.server.executeBlocking(this.connection::handleDisconnection);
- }
+ this.onDisconnect(disconnectionDetails, leaveMessage); // CraftBukkit - fire quit instantly // Paper - use kick event leave message
+ this.connection.setReadOnly();
this.connection.setReadOnly();
- this.server.executeBlocking(this.connection::handleDisconnection);
+ // CraftBukkit - Don't wait
+ this.server.scheduleOnMain(this.connection::handleDisconnection); // Paper
+ }
@@ -366,7 +368,7 @@
+ ServerCommonPacketListenerImpl.this.connection.enableAutoRead();
+ }
+ });
+ }
}
+ // Paper end - add proper async disconnect
protected boolean isSingleplayerOwner() {

View File

@@ -1,6 +1,14 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/server/network/ServerConfigurationPacketListenerImpl.java b/net/minecraft/server/network/ServerConfigurationPacketListenerImpl.java
index 8e39d689fc5eb405d76dee0a071b45960f74a25b..2e9eb04c7c4342393c05339906c267bca9ff29b1 100644
--- a/net/minecraft/server/network/ServerConfigurationPacketListenerImpl.java
+++ b/net/minecraft/server/network/ServerConfigurationPacketListenerImpl.java
@@ -48,8 +_,10 @@
@@ -48,8 +48,10 @@ public class ServerConfigurationPacketListenerImpl extends ServerCommonPacketLis
@Nullable
private SynchronizeRegistriesTask synchronizeRegistriesTask;
@@ -13,7 +21,7 @@
this.gameProfile = cookie.gameProfile();
this.clientInformation = cookie.clientInformation();
}
@@ -61,6 +_,11 @@
@@ -61,6 +63,11 @@ public class ServerConfigurationPacketListenerImpl extends ServerCommonPacketLis
@Override
public void onDisconnect(DisconnectionDetails details) {
@@ -25,7 +33,7 @@
LOGGER.info("{} lost connection: {}", this.gameProfile, details.reason().getString());
super.onDisconnect(details);
}
@@ -73,6 +_,12 @@
@@ -73,6 +80,12 @@ public class ServerConfigurationPacketListenerImpl extends ServerCommonPacketLis
public void startConfiguration() {
this.send(new ClientboundCustomPayloadPacket(new BrandPayload(this.server.getServerModName())));
ServerLinks serverLinks = this.server.serverLinks();
@@ -38,7 +46,7 @@
if (!serverLinks.isEmpty()) {
this.send(new ClientboundServerLinksPacket(serverLinks.untrust()));
}
@@ -105,6 +_,7 @@
@@ -105,6 +118,7 @@ public class ServerConfigurationPacketListenerImpl extends ServerCommonPacketLis
@Override
public void handleClientInformation(ServerboundClientInformationPacket packet) {
this.clientInformation = packet.information();
@@ -46,7 +54,7 @@
}
@Override
@@ -139,16 +_,21 @@
@@ -139,16 +153,21 @@ public class ServerConfigurationPacketListenerImpl extends ServerCommonPacketLis
return;
}

View File

@@ -1,6 +1,14 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 94c5293981cb33fdc029ba4c80284d3b538e9699..f636efc5b31c996cb083b47877c58bc75d3f279b 100644
--- a/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -204,6 +_,39 @@
@@ -204,6 +204,39 @@ import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;
import org.slf4j.Logger;
@@ -40,7 +48,7 @@
public class ServerGamePacketListenerImpl
extends ServerCommonPacketListenerImpl
implements GameProtocols.Context,
@@ -222,7 +_,9 @@
@@ -222,7 +255,9 @@ public class ServerGamePacketListenerImpl
private int tickCount;
private int ackBlockChangesUpTo = -1;
private final TickThrottler chatSpamThrottler = new TickThrottler(20, 200);
@@ -50,7 +58,7 @@
private double firstGoodX;
private double firstGoodY;
private double firstGoodZ;
@@ -248,23 +_,42 @@
@@ -248,23 +283,42 @@ public class ServerGamePacketListenerImpl
private int receivedMovePacketCount;
private int knownMovePacketCount;
private boolean receivedMovementThisTick;
@@ -95,7 +103,7 @@
}
@Override
@@ -284,8 +_,8 @@
@@ -284,8 +338,8 @@ public class ServerGamePacketListenerImpl
this.knownMovePacketCount = this.receivedMovePacketCount;
if (this.clientIsFloating && !this.player.isSleeping() && !this.player.isPassenger() && !this.player.isDeadOrDying()) {
if (++this.aboveGroundTickCount > this.getMaximumFlyingTicks(this.player)) {
@@ -106,7 +114,7 @@
return;
}
} else {
@@ -303,8 +_,8 @@
@@ -303,8 +357,8 @@ public class ServerGamePacketListenerImpl
this.vehicleLastGoodZ = this.lastVehicle.getZ();
if (this.clientVehicleIsFloating && this.lastVehicle.getControllingPassenger() == this.player) {
if (++this.aboveGroundVehicleTickCount > this.getMaximumFlyingTicks(this.lastVehicle)) {
@@ -117,7 +125,7 @@
return;
}
} else {
@@ -320,11 +_,20 @@
@@ -320,11 +374,20 @@ public class ServerGamePacketListenerImpl
this.keepConnectionAlive();
this.chatSpamThrottler.tick();
this.dropSpamThrottler.tick();
@@ -127,7 +135,6 @@
&& this.server.getPlayerIdleTimeout() > 0
- && Util.getMillis() - this.player.getLastActionTime() > this.server.getPlayerIdleTimeout() * 1000L * 60L) {
- this.disconnect(Component.translatable("multiplayer.disconnect.idling"));
- }
+ && Util.getMillis() - this.player.getLastActionTime() > this.server.getPlayerIdleTimeout() * 1000L * 60L && !this.player.wonGame) { // Paper - Prevent AFK kick while watching end credits
+ this.player.resetLastActionTime(); // CraftBukkit - SPIGOT-854
+ this.disconnect(Component.translatable("multiplayer.disconnect.idling"), org.bukkit.event.player.PlayerKickEvent.Cause.IDLING); // Paper - kick event cause
@@ -136,12 +143,12 @@
+ if (!this.hasLoggedExpiry && this.chatSession != null && this.chatSession.profilePublicKey().data().hasExpired()) {
+ LOGGER.info("Player profile key for {} has expired!", this.player.getName().getString());
+ this.hasLoggedExpiry = true;
+ }
}
+ // Paper end - Prevent causing expired keys from impacting new joins
}
private int getMaximumFlyingTicks(Entity entity) {
@@ -384,6 +_,12 @@
@@ -384,6 +447,12 @@ public class ServerGamePacketListenerImpl
@Override
public void handlePlayerInput(ServerboundPlayerInputPacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
@@ -154,7 +161,7 @@
this.player.setLastClientInput(packet.input());
}
@@ -403,17 +_,29 @@
@@ -403,17 +472,29 @@ public class ServerGamePacketListenerImpl
public void handleMoveVehicle(ServerboundMoveVehiclePacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
if (containsInvalidValues(packet.position().x(), packet.position().y(), packet.position().z(), packet.yRot(), packet.xRot())) {
@@ -188,7 +195,7 @@
float f = Mth.wrapDegrees(packet.yRot());
float f1 = Mth.wrapDegrees(packet.xRot());
double d3 = d - this.vehicleFirstGoodX;
@@ -421,7 +_,52 @@
@@ -421,7 +502,52 @@ public class ServerGamePacketListenerImpl
double d5 = d2 - this.vehicleFirstGoodZ;
double d6 = rootVehicle.getDeltaMovement().lengthSqr();
double d7 = d3 * d3 + d4 * d4 + d5 * d5;
@@ -242,7 +249,7 @@
LOGGER.warn(
"{} (vehicle of {}) moved too quickly! {},{},{}", rootVehicle.getName().getString(), this.player.getName().getString(), d3, d4, d5
);
@@ -430,15 +_,16 @@
@@ -430,15 +556,16 @@ public class ServerGamePacketListenerImpl
}
boolean flag = serverLevel.noCollision(rootVehicle, rootVehicle.getBoundingBox().deflate(0.0625));
@@ -262,7 +269,7 @@
d3 = d - rootVehicle.getX();
d4 = d1 - rootVehicle.getY();
if (d4 > -0.5 || d4 < 0.5) {
@@ -448,27 +_,80 @@
@@ -448,27 +575,80 @@ public class ServerGamePacketListenerImpl
d5 = d2 - rootVehicle.getZ();
d7 = d3 * d3 + d4 * d4 + d5 * d5;
boolean flag2 = false;
@@ -345,7 +352,7 @@
&& !flag1
&& !this.server.isFlightAllowed()
&& !rootVehicle.isNoGravity()
@@ -491,12 +_,12 @@
@@ -491,12 +671,12 @@ public class ServerGamePacketListenerImpl
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
if (packet.getId() == this.awaitingTeleport) {
if (this.awaitingPositionFromClient == null) {
@@ -360,7 +367,7 @@
this.awaitingPositionFromClient.x,
this.awaitingPositionFromClient.y,
this.awaitingPositionFromClient.z,
@@ -508,12 +_,20 @@
@@ -508,12 +688,20 @@ public class ServerGamePacketListenerImpl
this.lastGoodZ = this.awaitingPositionFromClient.z;
this.player.hasChangedDimension();
this.awaitingPositionFromClient = null;
@@ -381,7 +388,7 @@
this.player.setClientLoaded(true);
}
@@ -535,6 +_,7 @@
@@ -535,6 +723,7 @@ public class ServerGamePacketListenerImpl
@Override
public void handleRecipeBookChangeSettingsPacket(ServerboundRecipeBookChangeSettingsPacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
@@ -389,7 +396,7 @@
this.player.getRecipeBook().setBookSetting(packet.getBookType(), packet.isOpen(), packet.isFiltering());
}
@@ -550,25 +_,110 @@
@@ -550,25 +739,110 @@ public class ServerGamePacketListenerImpl
}
}
@@ -505,7 +512,7 @@
}
);
}
@@ -578,7 +_,7 @@
@@ -578,7 +852,7 @@ public class ServerGamePacketListenerImpl
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
if (!this.server.isCommandBlockEnabled()) {
this.player.sendSystemMessage(Component.translatable("advMode.notEnabled"));
@@ -514,7 +521,7 @@
this.player.sendSystemMessage(Component.translatable("advMode.notAllowed"));
} else {
BaseCommandBlock baseCommandBlock = null;
@@ -633,7 +_,7 @@
@@ -633,7 +907,7 @@ public class ServerGamePacketListenerImpl
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
if (!this.server.isCommandBlockEnabled()) {
this.player.sendSystemMessage(Component.translatable("advMode.notEnabled"));
@@ -523,7 +530,7 @@
this.player.sendSystemMessage(Component.translatable("advMode.notAllowed"));
} else {
BaseCommandBlock commandBlock = packet.getCommandBlock(this.player.level());
@@ -661,11 +_,11 @@
@@ -661,11 +935,11 @@ public class ServerGamePacketListenerImpl
boolean flag = this.player.hasInfiniteMaterials() && packet.includeData();
ItemStack cloneItemStack = blockState.getCloneItemStack(serverLevel, blockPos, flag);
if (!cloneItemStack.isEmpty()) {
@@ -537,7 +544,7 @@
}
}
}
@@ -689,27 +_,40 @@
@@ -689,27 +963,40 @@ public class ServerGamePacketListenerImpl
if (entityOrPart != null && this.player.canInteractWithEntity(entityOrPart, 3.0)) {
ItemStack pickResult = entityOrPart.getPickResult();
if (pickResult != null && !pickResult.isEmpty()) {
@@ -584,7 +591,7 @@
}
}
@@ -887,6 +_,13 @@
@@ -887,6 +1174,13 @@ public class ServerGamePacketListenerImpl
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
int item = packet.getItem();
if (this.player.containerMenu instanceof MerchantMenu merchantMenu) {
@@ -598,7 +605,7 @@
if (!merchantMenu.stillValid(this.player)) {
LOGGER.debug("Player {} interacted with invalid menu {}", this.player, merchantMenu);
return;
@@ -899,6 +_,51 @@
@@ -899,6 +1193,51 @@ public class ServerGamePacketListenerImpl
@Override
public void handleEditBook(ServerboundEditBookPacket packet) {
@@ -650,7 +657,7 @@
int slot = packet.slot();
if (Inventory.isHotbarSlot(slot) || slot == 40) {
List<String> list = Lists.newArrayList();
@@ -913,10 +_,14 @@
@@ -913,10 +1252,14 @@ public class ServerGamePacketListenerImpl
}
private void updateBookContents(List<FilteredText> pages, int index) {
@@ -666,7 +673,7 @@
}
}
@@ -930,7 +_,8 @@
@@ -930,7 +1273,8 @@ public class ServerGamePacketListenerImpl
DataComponents.WRITTEN_BOOK_CONTENT,
new WrittenBookContent(this.filterableFromOutgoing(title), this.player.getName().getString(), 0, list, true)
);
@@ -676,7 +683,7 @@
}
}
@@ -974,27 +_,35 @@
@@ -974,27 +1318,35 @@ public class ServerGamePacketListenerImpl
public void handleMovePlayer(ServerboundMovePlayerPacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
if (containsInvalidValues(packet.getX(0.0), packet.getY(0.0), packet.getZ(0.0), packet.getYRot(0.0F), packet.getXRot(0.0F))) {
@@ -719,7 +726,7 @@
double x = this.player.getX();
double y = this.player.getY();
double z = this.player.getZ();
@@ -1003,6 +_,16 @@
@@ -1003,6 +1355,16 @@ public class ServerGamePacketListenerImpl
double d5 = d2 - this.firstGoodZ;
double d6 = this.player.getDeltaMovement().lengthSqr();
double d7 = d3 * d3 + d4 * d4 + d5 * d5;
@@ -736,7 +743,7 @@
if (this.player.isSleeping()) {
if (d7 > 1.0) {
this.teleport(this.player.getX(), this.player.getY(), this.player.getZ(), f, f1);
@@ -1012,36 +_,109 @@
@@ -1012,36 +1374,109 @@ public class ServerGamePacketListenerImpl
if (serverLevel.tickRateManager().runsNormally()) {
this.receivedMovePacketCount++;
int i = this.receivedMovePacketCount - this.knownMovePacketCount;
@@ -857,7 +864,7 @@
d3 = d - this.player.getX();
d4 = d1 - this.player.getY();
if (d4 > -0.5 || d4 < 0.5) {
@@ -1050,23 +_,104 @@
@@ -1050,23 +1485,104 @@ public class ServerGamePacketListenerImpl
d5 = d2 - this.player.getZ();
d7 = d3 * d3 + d4 * d4 + d5 * d5;
@@ -878,15 +885,13 @@
+ if (event.getLogWarning())
+ // Paper end
LOGGER.warn("{} moved wrongly!", this.player.getName().getString());
- }
-
+ } // Paper
}
- if (this.player.noPhysics
- || this.player.isSleeping()
- || (!flag2 || !serverLevel.noCollision(this.player, boundingBox))
- && !this.isPlayerCollidingWithAnythingNew(serverLevel, boundingBox, d, d1, d2)) {
+ } // Paper
+ }
+
+ // Paper start - Add fail move event
+ boolean teleportBack = !this.player.noPhysics && !this.player.isSleeping() && (movedWrongly && serverLevel.noCollision(this.player, boundingBox) || this.isPlayerCollidingWithAnythingNew(serverLevel, boundingBox, d, d1, d2));
+ if (teleportBack) {
@@ -972,7 +977,7 @@
&& !flag1
&& !this.player.isSpectator()
&& !this.server.isFlightAllowed()
@@ -1098,7 +_,7 @@
@@ -1098,7 +1614,7 @@ public class ServerGamePacketListenerImpl
this.lastGoodY = this.player.getY();
this.lastGoodZ = this.player.getZ();
} else {
@@ -981,7 +986,7 @@
this.player.doCheckFallDamage(this.player.getX() - x, this.player.getY() - y, this.player.getZ() - z, packet.isOnGround());
this.player.removeLatestMovementRecordingBatch();
}
@@ -1134,6 +_,7 @@
@@ -1134,6 +1650,7 @@ public class ServerGamePacketListenerImpl
this.player.getXRot()
);
}
@@ -989,7 +994,7 @@
return true;
} else {
@@ -1157,10 +_,77 @@
@@ -1157,10 +1674,77 @@ public class ServerGamePacketListenerImpl
}
public void teleport(double x, double y, double z, float yaw, float pitch) {
@@ -1068,7 +1073,7 @@
this.awaitingTeleportTime = this.tickCount;
if (++this.awaitingTeleport == Integer.MAX_VALUE) {
this.awaitingTeleport = 0;
@@ -1168,12 +_,20 @@
@@ -1168,12 +1752,20 @@ public class ServerGamePacketListenerImpl
this.player.teleportSetPosition(posMoveRotation, relatives);
this.awaitingPositionFromClient = this.player.position();
@@ -1089,7 +1094,7 @@
if (this.player.hasClientLoaded()) {
BlockPos pos = packet.getPos();
this.player.resetLastActionTime();
@@ -1182,32 +_,95 @@
@@ -1182,32 +1774,95 @@ public class ServerGamePacketListenerImpl
case SWAP_ITEM_WITH_OFFHAND:
if (!this.player.isSpectator()) {
ItemStack itemInHand = this.player.getItemInHand(InteractionHand.OFF_HAND);
@@ -1188,7 +1193,7 @@
return;
default:
throw new IllegalArgumentException("Invalid player action");
@@ -1224,9 +_,31 @@
@@ -1224,9 +1879,31 @@ public class ServerGamePacketListenerImpl
}
}
@@ -1220,7 +1225,7 @@
if (this.player.hasClientLoaded()) {
this.player.connection.ackBlockChangesUpTo(packet.getSequence());
ServerLevel serverLevel = this.player.serverLevel();
@@ -1235,6 +_,11 @@
@@ -1235,6 +1912,11 @@ public class ServerGamePacketListenerImpl
if (itemInHand.isItemEnabled(serverLevel.enabledFeatures())) {
BlockHitResult hitResult = packet.getHitResult();
Vec3 location = hitResult.getLocation();
@@ -1232,7 +1237,7 @@
BlockPos blockPos = hitResult.getBlockPos();
if (this.player.canInteractWithBlock(blockPos, 1.0)) {
Vec3 vec3 = location.subtract(Vec3.atCenterOf(blockPos));
@@ -1244,7 +_,8 @@
@@ -1244,7 +1926,8 @@ public class ServerGamePacketListenerImpl
this.player.resetLastActionTime();
int maxY = this.player.level().getMaxY();
if (blockPos.getY() <= maxY) {
@@ -1242,7 +1247,7 @@
InteractionResult interactionResult = this.player.gameMode.useItemOn(this.player, serverLevel, itemInHand, hand, hitResult);
if (interactionResult.consumesAction()) {
CriteriaTriggers.ANY_BLOCK_USE.trigger(this.player, hitResult.getBlockPos(), itemInHand.copy());
@@ -1257,10 +_,10 @@
@@ -1257,10 +1940,10 @@ public class ServerGamePacketListenerImpl
Component component = Component.translatable("build.tooHigh", maxY).withStyle(ChatFormatting.RED);
this.player.sendSystemMessage(component, true);
} else if (interactionResult instanceof InteractionResult.Success success
@@ -1255,7 +1260,7 @@
} else {
Component component1 = Component.translatable("build.tooHigh", maxY).withStyle(ChatFormatting.RED);
this.player.sendSystemMessage(component1, true);
@@ -1268,13 +_,7 @@
@@ -1268,13 +1951,7 @@ public class ServerGamePacketListenerImpl
this.player.connection.send(new ClientboundBlockUpdatePacket(serverLevel, blockPos));
this.player.connection.send(new ClientboundBlockUpdatePacket(serverLevel, blockPos.relative(direction)));
@@ -1270,7 +1275,7 @@
}
}
}
@@ -1284,6 +_,8 @@
@@ -1284,6 +1961,8 @@ public class ServerGamePacketListenerImpl
@Override
public void handleUseItem(ServerboundUseItemPacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
@@ -1279,7 +1284,7 @@
if (this.player.hasClientLoaded()) {
this.ackBlockChangesUpTo(packet.getSequence());
ServerLevel serverLevel = this.player.serverLevel();
@@ -1297,6 +_,48 @@
@@ -1297,6 +1976,48 @@ public class ServerGamePacketListenerImpl
this.player.absSnapRotationTo(f, f1);
}
@@ -1328,7 +1333,7 @@
if (this.player.gameMode.useItem(this.player, serverLevel, itemInHand, hand) instanceof InteractionResult.Success success
&& success.swingSource() == InteractionResult.SwingSource.SERVER) {
this.player.swing(hand, true);
@@ -1312,7 +_,7 @@
@@ -1312,7 +2033,7 @@ public class ServerGamePacketListenerImpl
for (ServerLevel serverLevel : this.server.getAllLevels()) {
Entity entity = packet.getEntity(serverLevel);
if (entity != null) {
@@ -1337,7 +1342,7 @@
return;
}
}
@@ -1329,24 +_,54 @@
@@ -1329,24 +2050,54 @@ public class ServerGamePacketListenerImpl
@Override
public void onDisconnect(DisconnectionDetails details) {
@@ -1395,7 +1400,7 @@
throw new IllegalArgumentException("Expected packet sequence nr >= 0");
} else {
this.ackBlockChangesUpTo = Math.max(sequence, this.ackBlockChangesUpTo);
@@ -1356,20 +_,38 @@
@@ -1356,20 +2107,38 @@ public class ServerGamePacketListenerImpl
@Override
public void handleSetCarriedItem(ServerboundSetCarriedItemPacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
@@ -1434,7 +1439,7 @@
Optional<LastSeenMessages> optional = this.unpackAndApplyLastSeen(packet.lastSeenMessages());
if (!optional.isEmpty()) {
this.tryHandleChat(packet.message(), () -> {
@@ -1381,25 +_,45 @@
@@ -1381,25 +2150,45 @@ public class ServerGamePacketListenerImpl
return;
}
@@ -1487,7 +1492,7 @@
ParseResults<CommandSourceStack> parseResults = this.parseCommand(command);
if (this.server.enforceSecureProfile() && SignableCommand.hasSignableArguments(parseResults)) {
LOGGER.error(
@@ -1416,28 +_,57 @@
@@ -1416,28 +2205,57 @@ public class ServerGamePacketListenerImpl
Optional<LastSeenMessages> optional = this.unpackAndApplyLastSeen(packet.lastSeenMessages());
if (!optional.isEmpty()) {
this.tryHandleChat(packet.command(), () -> {
@@ -1548,7 +1553,7 @@
}
private void handleMessageDecodeFailure(SignedMessageChain.DecodeException exception) {
@@ -1501,14 +_,20 @@
@@ -1501,14 +2319,20 @@ public class ServerGamePacketListenerImpl
return dispatcher.parse(command, this.player.createCommandSourceStack());
}
@@ -1573,7 +1578,7 @@
}
}
@@ -1520,7 +_,7 @@
@@ -1520,7 +2344,7 @@ public class ServerGamePacketListenerImpl
var10000 = Optional.of(lastSeenMessages);
} catch (LastSeenMessagesValidator.ValidationException var5) {
LOGGER.error("Failed to validate message acknowledgements from {}: {}", this.player.getName().getString(), var5.getMessage());
@@ -1582,7 +1587,7 @@
return Optional.empty();
}
@@ -1538,22 +_,81 @@
@@ -1538,22 +2362,81 @@ public class ServerGamePacketListenerImpl
return false;
}
@@ -1670,7 +1675,7 @@
}
}
@@ -1564,7 +_,7 @@
@@ -1564,7 +2447,7 @@ public class ServerGamePacketListenerImpl
this.lastSeenMessages.applyOffset(packet.offset());
} catch (LastSeenMessagesValidator.ValidationException var5) {
LOGGER.error("Failed to validate message acknowledgement offset from {}: {}", this.player.getName().getString(), var5.getMessage());
@@ -1679,7 +1684,7 @@
}
}
}
@@ -1572,7 +_,40 @@
@@ -1572,7 +2455,40 @@ public class ServerGamePacketListenerImpl
@Override
public void handleAnimate(ServerboundSwingPacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
@@ -1720,7 +1725,7 @@
this.player.swing(packet.getHand());
}
@@ -1580,10 +_,41 @@
@@ -1580,10 +2496,41 @@ public class ServerGamePacketListenerImpl
public void handlePlayerCommand(ServerboundPlayerCommandPacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
if (this.player.hasClientLoaded()) {
@@ -1762,7 +1767,7 @@
break;
case RELEASE_SHIFT_KEY:
this.player.setShiftKeyDown(false);
@@ -1630,6 +_,14 @@
@@ -1630,6 +2577,14 @@ public class ServerGamePacketListenerImpl
}
public void sendPlayerChatMessage(PlayerChatMessage chatMessage, ChatType.Bound boundType) {
@@ -1777,7 +1782,7 @@
this.send(
new ClientboundPlayerChatPacket(
this.nextChatIndex++,
@@ -1652,9 +_,11 @@
@@ -1652,9 +2607,11 @@ public class ServerGamePacketListenerImpl
}
if (i > 4096) {
@@ -1790,7 +1795,7 @@
}
public void sendDisguisedChatMessage(Component message, ChatType.Bound boundType) {
@@ -1665,6 +_,17 @@
@@ -1665,6 +2622,17 @@ public class ServerGamePacketListenerImpl
return this.connection.getRemoteAddress();
}
@@ -1808,7 +1813,7 @@
public void switchToConfig() {
this.waitingForSwitchToConfig = true;
this.removePlayerFromWorld();
@@ -1680,9 +_,16 @@
@@ -1680,9 +2648,16 @@ public class ServerGamePacketListenerImpl
@Override
public void handleInteract(ServerboundInteractPacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
@@ -1825,7 +1830,7 @@
this.player.resetLastActionTime();
this.player.setShiftKeyDown(packet.isUsingSecondaryAction());
if (target != null) {
@@ -1691,16 +_,58 @@
@@ -1691,16 +2666,58 @@ public class ServerGamePacketListenerImpl
}
AABB boundingBox = target.getBoundingBox();
@@ -1889,7 +1894,7 @@
ItemStack itemStack1 = success.wasItemInteraction() ? itemStack : ItemStack.EMPTY;
CriteriaTriggers.PLAYER_INTERACTED_WITH_ENTITY.trigger(ServerGamePacketListenerImpl.this.player, itemStack1, target);
if (success.swingSource() == InteractionResult.SwingSource.SERVER) {
@@ -1712,13 +_,13 @@
@@ -1712,13 +2729,13 @@ public class ServerGamePacketListenerImpl
@Override
public void onInteraction(InteractionHand hand) {
@@ -1905,7 +1910,7 @@
);
}
@@ -1726,14 +_,19 @@
@@ -1726,14 +2743,19 @@ public class ServerGamePacketListenerImpl
public void onAttack() {
if (!(target instanceof ItemEntity)
&& !(target instanceof ExperienceOrb)
@@ -1927,7 +1932,7 @@
ServerGamePacketListenerImpl.LOGGER
.warn("Player {} tried to attack an invalid entity", ServerGamePacketListenerImpl.this.player.getName().getString());
}
@@ -1742,6 +_,27 @@
@@ -1742,6 +2764,27 @@ public class ServerGamePacketListenerImpl
);
}
}
@@ -1955,7 +1960,7 @@
}
}
@@ -1754,7 +_,7 @@
@@ -1754,7 +2797,7 @@ public class ServerGamePacketListenerImpl
case PERFORM_RESPAWN:
if (this.player.wonGame) {
this.player.wonGame = false;
@@ -1964,7 +1969,7 @@
this.resetPosition();
CriteriaTriggers.CHANGED_DIMENSION.trigger(this.player, Level.END, Level.OVERWORLD);
} else {
@@ -1762,11 +_,11 @@
@@ -1762,11 +2805,11 @@ public class ServerGamePacketListenerImpl
return;
}
@@ -1979,7 +1984,7 @@
}
}
break;
@@ -1777,16 +_,28 @@
@@ -1777,16 +2820,28 @@ public class ServerGamePacketListenerImpl
@Override
public void handleContainerClose(ServerboundContainerClosePacket packet) {
@@ -2010,7 +2015,7 @@
this.player.containerMenu.sendAllDataToRemote();
} else if (!this.player.containerMenu.stillValid(this.player)) {
LOGGER.debug("Player {} interacted with invalid menu {}", this.player, this.player.containerMenu);
@@ -1799,7 +_,340 @@
@@ -1799,7 +2854,340 @@ public class ServerGamePacketListenerImpl
} else {
boolean flag = packet.stateId() != this.player.containerMenu.getStateId();
this.player.containerMenu.suppressRemoteUpdates();
@@ -2352,7 +2357,7 @@
for (Entry<HashedStack> entry : Int2ObjectMaps.fastIterable(packet.changedSlots())) {
this.player.containerMenu.setRemoteSlotUnsafe(entry.getIntKey(), entry.getValue());
@@ -1812,6 +_,7 @@
@@ -1812,6 +3200,7 @@ public class ServerGamePacketListenerImpl
} else {
this.player.containerMenu.broadcastChanges();
}
@@ -2360,7 +2365,7 @@
}
}
}
@@ -1819,6 +_,14 @@
@@ -1819,6 +3208,14 @@ public class ServerGamePacketListenerImpl
@Override
public void handlePlaceRecipe(ServerboundPlaceRecipePacket packet) {
@@ -2375,7 +2380,7 @@
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
this.player.resetLastActionTime();
if (!this.player.isSpectator() && this.player.containerMenu.containerId == packet.containerId()) {
@@ -1835,9 +_,44 @@
@@ -1835,9 +3232,44 @@ public class ServerGamePacketListenerImpl
return;
}
@@ -2421,7 +2426,7 @@
if (postPlaceAction == RecipeBookMenu.PostPlaceAction.PLACE_GHOST_RECIPE) {
this.player
.connection
@@ -1853,6 +_,7 @@
@@ -1853,6 +3285,7 @@ public class ServerGamePacketListenerImpl
@Override
public void handleContainerButtonClick(ServerboundContainerButtonClickPacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
@@ -2429,7 +2434,7 @@
this.player.resetLastActionTime();
if (this.player.containerMenu.containerId == packet.containerId() && !this.player.isSpectator()) {
if (!this.player.containerMenu.stillValid(this.player)) {
@@ -1862,6 +_,7 @@
@@ -1862,6 +3295,7 @@ public class ServerGamePacketListenerImpl
if (flag) {
this.player.containerMenu.broadcastChanges();
}
@@ -2437,7 +2442,7 @@
}
}
}
@@ -1878,10 +_,48 @@
@@ -1878,10 +3312,48 @@ public class ServerGamePacketListenerImpl
boolean flag1 = packet.slotNum() >= 1 && packet.slotNum() <= 45;
boolean flag2 = itemStack.isEmpty() || itemStack.getCount() <= itemStack.getMaxStackSize();
@@ -2486,7 +2491,7 @@
} else if (flag && flag2) {
if (this.dropSpamThrottler.isUnderThreshold()) {
this.dropSpamThrottler.increment();
@@ -1895,15 +_,38 @@
@@ -1895,15 +3367,38 @@ public class ServerGamePacketListenerImpl
@Override
public void handleSignUpdate(ServerboundSignUpdatePacket packet) {
@@ -2526,7 +2531,7 @@
if (!(serverLevel.getBlockEntity(pos) instanceof SignBlockEntity signBlockEntity)) {
return;
}
@@ -1915,14 +_,32 @@
@@ -1915,14 +3410,32 @@ public class ServerGamePacketListenerImpl
@Override
public void handlePlayerAbilities(ServerboundPlayerAbilitiesPacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
@@ -2560,7 +2565,7 @@
if (this.player.isModelPartShown(PlayerModelPart.HAT) != isModelPartShown) {
this.server.getPlayerList().broadcastAll(new ClientboundPlayerInfoUpdatePacket(ClientboundPlayerInfoUpdatePacket.Action.UPDATE_HAT, this.player));
}
@@ -1932,7 +_,7 @@
@@ -1932,7 +3445,7 @@ public class ServerGamePacketListenerImpl
public void handleChangeDifficulty(ServerboundChangeDifficultyPacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
if (this.player.hasPermissions(2) || this.isSingleplayerOwner()) {
@@ -2569,7 +2574,7 @@
}
}
@@ -1952,7 +_,7 @@
@@ -1952,7 +3465,7 @@ public class ServerGamePacketListenerImpl
ProfilePublicKey.Data data2 = data.profilePublicKey();
if (!Objects.equals(data1, data2)) {
if (data1 != null && data2.expiresAt().isBefore(data1.expiresAt())) {
@@ -2578,7 +2583,7 @@
} else {
try {
SignatureValidator profileKeySignatureValidator = this.server.getProfileKeySignatureValidator();
@@ -1963,8 +_,8 @@
@@ -1963,8 +3476,8 @@ public class ServerGamePacketListenerImpl
this.resetPlayerChatState(data.validate(this.player.getGameProfile(), profileKeySignatureValidator));
} catch (ProfilePublicKey.ValidationException var6) {
@@ -2589,7 +2594,7 @@
}
}
}
@@ -1978,7 +_,7 @@
@@ -1978,7 +3491,7 @@ public class ServerGamePacketListenerImpl
this.connection
.setupInboundProtocol(
ConfigurationProtocols.SERVERBOUND,
@@ -2598,7 +2603,7 @@
);
}
}
@@ -1997,27 +_,32 @@
@@ -1997,27 +3510,32 @@ public class ServerGamePacketListenerImpl
private void resetPlayerChatState(RemoteChatSession chatSession) {
this.chatSession = chatSession;
@@ -2632,7 +2637,7 @@
if (!this.receivedMovementThisTick) {
this.player.setKnownMovement(Vec3.ZERO);
}
@@ -2048,4 +_,17 @@
@@ -2048,4 +3566,17 @@ public class ServerGamePacketListenerImpl
interface EntityInteraction {
InteractionResult run(ServerPlayer player, Entity entity, InteractionHand hand);
}

View File

@@ -1,6 +1,14 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java b/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
index 22d8ebffcd347051a917fcc2c994c38ddb713622..0ae31252b2e2d82bfa883abc8fb78d550ecf4849 100644
--- a/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
+++ b/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
@@ -14,9 +_,20 @@
@@ -14,9 +14,20 @@ import net.minecraft.server.MinecraftServer;
public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketListener {
private static final Component IGNORE_STATUS_REASON = Component.translatable("disconnect.ignoring_status_request");
@@ -21,7 +29,7 @@
public ServerHandshakePacketListenerImpl(MinecraftServer server, Connection connection) {
this.server = server;
this.connection = connection;
@@ -24,6 +_,7 @@
@@ -24,6 +35,7 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL
@Override
public void handleIntention(ClientIntentionPacket packet) {
@@ -29,7 +37,7 @@
switch (packet.intention()) {
case LOGIN:
this.beginLogin(packet, false);
@@ -50,22 +_,118 @@
@@ -50,22 +62,118 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL
default:
throw new UnsupportedOperationException("Invalid intention " + packet.intention());
}

View File

@@ -1,6 +1,14 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/server/players/PlayerList.java b/net/minecraft/server/players/PlayerList.java
index aa7b0ea3f5203aafa86a8d36cd01b661cd16147c..ed23e8e29d08d69ec1d0dca49193a3a6a3dc0dd0 100644
--- a/net/minecraft/server/players/PlayerList.java
+++ b/net/minecraft/server/players/PlayerList.java
@@ -112,14 +_,16 @@
@@ -112,14 +112,16 @@ public abstract class PlayerList {
private static final int SEND_PLAYER_INFO_INTERVAL = 600;
private static final SimpleDateFormat BAN_DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd 'at' HH:mm:ss z");
private final MinecraftServer server;
@@ -20,7 +28,7 @@
public final PlayerDataStorage playerIo;
private boolean doWhiteList;
private final LayeredRegistryAccess<RegistryLayer> registries;
@@ -130,14 +_,26 @@
@@ -130,14 +132,26 @@ public abstract class PlayerList {
private static final boolean ALLOW_LOGOUTIVATOR = false;
private int sendAllPlayerInfoIn;
@@ -47,7 +55,7 @@
GameProfile gameProfile = player.getGameProfile();
GameProfileCache profileCache = this.server.getProfileCache();
String string;
@@ -150,30 +_,94 @@
@@ -150,30 +164,94 @@ public abstract class PlayerList {
}
Optional<CompoundTag> optional = this.load(player);
@@ -154,7 +162,7 @@
LevelData levelData = serverLevel.getLevelData();
player.loadGameTypes(optional.orElse(null));
ServerGamePacketListenerImpl serverGamePacketListenerImpl = new ServerGamePacketListenerImpl(this.server, connection, player, cookie);
@@ -191,8 +_,8 @@
@@ -191,8 +269,8 @@ public abstract class PlayerList {
levelData.isHardcore(),
this.server.levelKeys(),
this.getMaxPlayers(),
@@ -165,7 +173,7 @@
_boolean1,
!_boolean,
_boolean2,
@@ -200,6 +_,7 @@
@@ -200,6 +278,7 @@ public abstract class PlayerList {
this.server.enforceSecureProfile()
)
);
@@ -173,7 +181,7 @@
serverGamePacketListenerImpl.send(new ClientboundChangeDifficultyPacket(levelData.getDifficulty(), levelData.isDifficultyLocked()));
serverGamePacketListenerImpl.send(new ClientboundPlayerAbilitiesPacket(player.getAbilities()));
serverGamePacketListenerImpl.send(new ClientboundSetHeldSlotPacket(player.getInventory().getSelectedSlot()));
@@ -219,26 +_,119 @@
@@ -219,26 +298,119 @@ public abstract class PlayerList {
mutableComponent = Component.translatable("multiplayer.player.joined.renamed", player.getDisplayName(), string);
}
@@ -299,7 +307,7 @@
}
public void updateEntireScoreboard(ServerScoreboard scoreboard, ServerPlayer player) {
@@ -261,30 +_,31 @@
@@ -261,30 +433,31 @@ public abstract class PlayerList {
}
public void addWorldborderListener(ServerLevel level) {
@@ -336,7 +344,7 @@
}
@Override
@@ -312,56 +_,156 @@
@@ -312,56 +485,156 @@ public abstract class PlayerList {
}
protected void save(ServerPlayer player) {
@@ -440,15 +448,13 @@
this.playersByUUID.remove(uuid);
- this.stats.remove(uuid);
- this.advancements.remove(uuid);
- }
-
- this.broadcastAll(new ClientboundPlayerInfoRemovePacket(List.of(player.getUUID())));
+ // CraftBukkit start
+ // this.stats.remove(uuid);
+ // this.advancements.remove(uuid);
+ // CraftBukkit end
+ }
+
}
- this.broadcastAll(new ClientboundPlayerInfoRemovePacket(List.of(player.getUUID())));
+ // CraftBukkit start
+ // this.broadcastAll(new ClientboundPlayerInfoRemovePacket(List.of(player.getUUID())));
+ ClientboundPlayerInfoRemovePacket packet = new ClientboundPlayerInfoRemovePacket(List.of(player.getUUID()));
@@ -507,7 +513,7 @@
MutableComponent mutableComponent = Component.translatable("multiplayer.disconnect.banned.reason", userBanListEntry.getReason());
if (userBanListEntry.getExpires() != null) {
mutableComponent.append(
@@ -369,10 +_,12 @@
@@ -369,10 +642,12 @@ public abstract class PlayerList {
);
}
@@ -524,7 +530,7 @@
IpBanListEntry ipBanListEntry = this.ipBans.get(socketAddress);
MutableComponent mutableComponent = Component.translatable("multiplayer.disconnect.banned_ip.reason", ipBanListEntry.getReason());
if (ipBanListEntry.getExpires() != null) {
@@ -381,69 +_,131 @@
@@ -381,69 +656,131 @@ public abstract class PlayerList {
);
}
@@ -535,13 +541,30 @@
- return this.players.size() >= this.maxPlayers && !this.canBypassPlayerLimit(gameProfile)
- ? Component.translatable("multiplayer.disconnect.server_full")
- : null;
- }
- }
-
+ // return this.players.size() >= this.maxPlayers && !this.canBypassPlayerLimit(gameProfile)
+ // ? Component.translatable("multiplayer.disconnect.server_full")
+ // : null;
+ if (this.players.size() >= this.maxPlayers && !this.canBypassPlayerLimit(gameProfile)) {
+ 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
+ }
+ }
+ this.cserver.getPluginManager().callEvent(event);
+ if (event.getResult() != org.bukkit.event.player.PlayerLoginEvent.Result.ALLOWED) {
+ loginlistener.disconnect(io.papermc.paper.adventure.PaperAdventure.asVanilla(event.kickMessage())); // Paper - Adventure
+ return null;
}
+ return entity;
}
- public ServerPlayer getPlayerForLogin(GameProfile gameProfile, ClientInformation clientInformation) {
- return new ServerPlayer(this.server, this.server.overworld(), gameProfile, clientInformation);
- }
-
+ // CraftBukkit start - added EntityPlayer
+ public ServerPlayer getPlayerForLogin(GameProfile gameProfile, ClientInformation clientInformation, ServerPlayer player) {
+ player.updateOptions(clientInformation);
+ return player;
+ // CraftBukkit end
}
- public boolean disconnectAllPlayersWithProfile(GameProfile gameProfile) {
- UUID id = gameProfile.getId();
- Set<ServerPlayer> set = Sets.newIdentityHashSet();
@@ -549,13 +572,8 @@
- for (ServerPlayer serverPlayer : this.players) {
- if (serverPlayer.getUUID().equals(id)) {
- set.add(serverPlayer);
+ // return this.players.size() >= this.maxPlayers && !this.canBypassPlayerLimit(gameProfile)
+ // ? Component.translatable("multiplayer.disconnect.server_full")
+ // : null;
+ if (this.players.size() >= this.maxPlayers && !this.canBypassPlayerLimit(gameProfile)) {
+ 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
}
}
- }
- }
-
- ServerPlayer serverPlayer1 = this.playersByUUID.get(gameProfile.getId());
- if (serverPlayer1 != null) {
@@ -565,26 +583,6 @@
- for (ServerPlayer serverPlayer2 : set) {
- serverPlayer2.connection.disconnect(DUPLICATE_LOGIN_DISCONNECT_MESSAGE);
- }
-
- return !set.isEmpty();
- }
-
- public ServerPlayer respawn(ServerPlayer player, boolean keepInventory, Entity.RemovalReason reason) {
+ this.cserver.getPluginManager().callEvent(event);
+ if (event.getResult() != org.bukkit.event.player.PlayerLoginEvent.Result.ALLOWED) {
+ loginlistener.disconnect(io.papermc.paper.adventure.PaperAdventure.asVanilla(event.kickMessage())); // Paper - Adventure
+ return null;
+ }
+ return entity;
+ }
+
+ // CraftBukkit start - added EntityPlayer
+ public ServerPlayer getPlayerForLogin(GameProfile gameProfile, ClientInformation clientInformation, ServerPlayer player) {
+ player.updateOptions(clientInformation);
+ return player;
+ // CraftBukkit end
+ }
+
+ public boolean disconnectAllPlayersWithProfile(GameProfile gameProfile, ServerPlayer player) { // CraftBukkit - added ServerPlayer
+ // CraftBukkit start - Moved up
+ // UUID id = gameProfile.getId();
@@ -609,12 +607,14 @@
+ return player == null;
+ // CraftBukkit end
+ }
+
- return !set.isEmpty();
+ // CraftBukkit start
+ public ServerPlayer respawn(ServerPlayer player, boolean keepInventory, Entity.RemovalReason reason, @Nullable org.bukkit.event.player.PlayerRespawnEvent.RespawnReason eventReason) {
+ return this.respawn(player, keepInventory, reason, eventReason, null);
+ }
+
}
- public ServerPlayer respawn(ServerPlayer player, boolean keepInventory, Entity.RemovalReason reason) {
+ public ServerPlayer respawn(ServerPlayer player, boolean keepInventory, Entity.RemovalReason reason, @Nullable org.bukkit.event.player.PlayerRespawnEvent.RespawnReason eventReason, @Nullable org.bukkit.Location location) {
+ player.stopRiding(); // CraftBukkit
this.players.remove(player);
@@ -697,7 +697,7 @@
serverPlayer.connection.send(new ClientboundSetDefaultSpawnPositionPacket(level.getSharedSpawnPos(), level.getSharedSpawnAngle()));
serverPlayer.connection.send(new ClientboundChangeDifficultyPacket(levelData.getDifficulty(), levelData.isDifficultyLocked()));
serverPlayer.connection
@@ -451,10 +_,13 @@
@@ -451,10 +788,13 @@ public abstract class PlayerList {
this.sendActivePlayerEffects(serverPlayer);
this.sendLevelInfo(serverPlayer, level);
this.sendPlayerPermissionLevel(serverPlayer);
@@ -715,7 +715,7 @@
serverPlayer.setHealth(serverPlayer.getHealth());
ServerPlayer.RespawnConfig respawnConfig = serverPlayer.getRespawnConfig();
if (!keepInventory && respawnConfig != null) {
@@ -477,8 +_,52 @@
@@ -477,8 +817,52 @@ public abstract class PlayerList {
)
);
}
@@ -768,7 +768,7 @@
return serverPlayer;
}
@@ -488,24 +_,59 @@
@@ -488,24 +872,59 @@ public abstract class PlayerList {
}
public void sendActiveEffects(LivingEntity entity, ServerGamePacketListenerImpl connection) {
@@ -831,7 +831,7 @@
public void broadcastAll(Packet<?> packet) {
for (ServerPlayer serverPlayer : this.players) {
serverPlayer.connection.send(packet);
@@ -581,6 +_,12 @@
@@ -581,6 +1000,12 @@ public abstract class PlayerList {
}
private void sendPlayerPermissionLevel(ServerPlayer player, int permLevel) {
@@ -844,7 +844,7 @@
if (player.connection != null) {
byte b;
if (permLevel <= 0) {
@@ -594,11 +_,33 @@
@@ -594,11 +1019,33 @@ public abstract class PlayerList {
player.connection.send(new ClientboundEntityEventPacket(player, b));
}
@@ -879,7 +879,7 @@
}
public boolean isOp(GameProfile profile) {
@@ -609,21 +_,17 @@
@@ -609,21 +1056,17 @@ public abstract class PlayerList {
@Nullable
public ServerPlayer getPlayerByName(String username) {
@@ -907,7 +907,7 @@
if (serverPlayer != except && serverPlayer.level().dimension() == dimension) {
double d = x - serverPlayer.getX();
double d1 = y - serverPlayer.getY();
@@ -636,9 +_,11 @@
@@ -636,9 +1079,11 @@ public abstract class PlayerList {
}
public void saveAll() {
@@ -919,7 +919,7 @@
}
public UserWhiteList getWhiteList() {
@@ -661,14 +_,18 @@
@@ -661,14 +1106,18 @@ public abstract class PlayerList {
}
public void sendLevelInfo(ServerPlayer player, ServerLevel level) {
@@ -942,7 +942,7 @@
}
player.connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.LEVEL_CHUNKS_LOAD_START, 0.0F));
@@ -677,8 +_,21 @@
@@ -677,8 +1126,21 @@ public abstract class PlayerList {
public void sendAllPlayerInfo(ServerPlayer player) {
player.inventoryMenu.sendAllDataToRemote();
@@ -965,7 +965,7 @@
}
public int getPlayerCount() {
@@ -694,6 +_,7 @@
@@ -694,6 +1156,7 @@ public abstract class PlayerList {
}
public void setUsingWhiteList(boolean whitelistEnabled) {
@@ -973,14 +973,12 @@
this.doWhiteList = whitelistEnabled;
}
@@ -731,10 +_,35 @@
@@ -731,11 +1194,36 @@ public abstract class PlayerList {
}
public void removeAll() {
- for (int i = 0; i < this.players.size(); i++) {
- this.players.get(i).connection.disconnect(Component.translatable("multiplayer.disconnect.server_shutdown"));
- }
- }
+ // Paper start - Extract method to allow for restarting flag
+ this.removeAll(false);
+ }
@@ -991,7 +989,7 @@
+ for (ServerPlayer player : this.players) {
+ if (isRestarting) player.connection.disconnect(net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(org.spigotmc.SpigotConfig.restartMessage), org.bukkit.event.player.PlayerKickEvent.Cause.UNKNOWN); else // Paper - kick event cause (cause is never used here)
+ player.connection.disconnect(java.util.Objects.requireNonNullElseGet(this.server.server.shutdownMessage(), net.kyori.adventure.text.Component::empty)); // CraftBukkit - add custom shutdown message // Paper - Adventure
+ }
}
+ // CraftBukkit end
+
+ // Paper start - Configurable player collision; Remove collideRule team if it exists
@@ -1001,8 +999,8 @@
+ if (team != null) scoreboard.removePlayerTeam(team);
+ }
+ // Paper end - Configurable player collision
+ }
+
}
+ // CraftBukkit start
+ public void broadcastMessage(Component[] iChatBaseComponents) {
+ for (Component component : iChatBaseComponents) {
@@ -1010,10 +1008,11 @@
+ }
+ }
+ // CraftBukkit end
+
public void broadcastSystemMessage(Component message, boolean bypassHiddenChat) {
this.broadcastSystemMessage(message, serverPlayer -> message, bypassHiddenChat);
@@ -756,20 +_,39 @@
}
@@ -756,20 +1244,39 @@ public abstract class PlayerList {
}
public void broadcastChatMessage(PlayerChatMessage message, ServerPlayer sender, ChatType.Bound boundChatType) {
@@ -1056,7 +1055,7 @@
flag1 |= flag2 && message.isFullyFiltered();
}
@@ -782,14 +_,21 @@
@@ -782,14 +1289,21 @@ public abstract class PlayerList {
return message.hasSignature() && !message.hasExpiredServer(Instant.now());
}
@@ -1082,7 +1081,7 @@
Path path = file2.toPath();
if (FileUtil.isPathNormalized(path) && FileUtil.isPathPortable(path) && path.startsWith(file.getPath()) && file2.isFile()) {
file2.renameTo(file1);
@@ -797,7 +_,7 @@
@@ -797,7 +1311,7 @@ public abstract class PlayerList {
}
serverStatsCounter = new ServerStatsCounter(this.server, file1);
@@ -1091,7 +1090,7 @@
}
return serverStatsCounter;
@@ -805,11 +_,11 @@
@@ -805,11 +1319,11 @@ public abstract class PlayerList {
public PlayerAdvancements getPlayerAdvancements(ServerPlayer player) {
UUID uuid = player.getUUID();
@@ -1105,7 +1104,7 @@
}
playerAdvancements.setPlayer(player);
@@ -852,11 +_,34 @@
@@ -852,11 +1366,34 @@ public abstract class PlayerList {
}
public void reloadResources() {

View File

@@ -1,6 +1,14 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/util/datafix/fixes/RaidRenamesDataFix.java b/net/minecraft/util/datafix/fixes/RaidRenamesDataFix.java
index 6d1a64758c2f383cf7f047539daa2b869614694d..682c75c4c61181fb50214326c317f2fe7e893dbd 100644
--- a/net/minecraft/util/datafix/fixes/RaidRenamesDataFix.java
+++ b/net/minecraft/util/datafix/fixes/RaidRenamesDataFix.java
@@ -39,6 +_,6 @@
@@ -39,6 +39,6 @@ public class RaidRenamesDataFix extends DataFix {
.renameField("PostRaidTicks", "post_raid_ticks")
.renameField("TotalHealth", "total_health")
.renameField("NumGroups", "group_count")

View File

@@ -1,6 +1,14 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/world/RandomizableContainer.java b/net/minecraft/world/RandomizableContainer.java
index 4cb1c2d6bc64bf65a553a08d1d259e202456b2b3..c97dffd9cf9bdf70f2bb3d94cc5054ad02d038e1 100644
--- a/net/minecraft/world/RandomizableContainer.java
+++ b/net/minecraft/world/RandomizableContainer.java
@@ -26,7 +_,7 @@
@@ -26,7 +26,7 @@ public interface RandomizableContainer extends Container {
void setLootTable(@Nullable ResourceKey<LootTable> lootTable);
@@ -9,7 +17,7 @@
this.setLootTable(lootTable);
this.setLootTableSeed(seed);
}
@@ -49,8 +_,9 @@
@@ -49,8 +49,9 @@ public interface RandomizableContainer extends Container {
default boolean tryLoadLootTable(CompoundTag tag) {
ResourceKey<LootTable> resourceKey = tag.read("LootTable", LootTable.KEY_CODEC).orElse(null);
this.setLootTable(resourceKey);
@@ -20,7 +28,7 @@
}
default boolean trySaveLootTable(CompoundTag tag) {
@@ -59,26 +_,42 @@
@@ -59,26 +60,42 @@ public interface RandomizableContainer extends Container {
return false;
} else {
tag.store("LootTable", LootTable.KEY_CODEC, lootTable);
@@ -65,7 +73,7 @@
LootParams.Builder builder = new LootParams.Builder((ServerLevel)level).withParameter(LootContextParams.ORIGIN, Vec3.atCenterOf(blockPos));
if (player != null) {
builder.withLuck(player.getLuck()).withParameter(LootContextParams.THIS_ENTITY, player);
@@ -87,4 +_,17 @@
@@ -87,4 +104,17 @@ public interface RandomizableContainer extends Container {
lootTable1.fill(this, builder.create(LootContextParamSets.CHEST), this.getLootTableSeed());
}
}

View File

@@ -1,6 +1,14 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/world/entity/AgeableMob.java b/net/minecraft/world/entity/AgeableMob.java
index 1088bfb93fa13542ee909adc864fb170e6c2c1cd..f9cfa9dd17bd259cfbc0d96bf48a17556b365d8b 100644
--- a/net/minecraft/world/entity/AgeableMob.java
+++ b/net/minecraft/world/entity/AgeableMob.java
@@ -22,6 +_,7 @@
@@ -22,6 +22,7 @@ public abstract class AgeableMob extends PathfinderMob {
protected int age = 0;
protected int forcedAge = 0;
protected int forcedAgeTimer;
@@ -8,7 +16,7 @@
protected AgeableMob(EntityType<? extends AgeableMob> entityType, Level level) {
super(entityType, level);
@@ -68,13 +_,15 @@
@@ -68,13 +69,15 @@ public abstract class AgeableMob extends PathfinderMob {
}
public void ageUp(int amount, boolean forced) {
@@ -25,7 +33,7 @@
this.setAge(age);
if (forced) {
this.forcedAge += i1;
@@ -106,6 +_,7 @@
@@ -106,6 +109,7 @@ public abstract class AgeableMob extends PathfinderMob {
super.addAdditionalSaveData(compound);
compound.putInt("Age", this.getAge());
compound.putInt("ForcedAge", this.forcedAge);
@@ -33,7 +41,7 @@
}
@Override
@@ -113,6 +_,7 @@
@@ -113,6 +117,7 @@ public abstract class AgeableMob extends PathfinderMob {
super.readAdditionalSaveData(compound);
this.setAge(compound.getIntOr("Age", 0));
this.forcedAge = compound.getIntOr("ForcedAge", 0);
@@ -41,7 +49,7 @@
}
@Override
@@ -127,7 +_,7 @@
@@ -127,7 +132,7 @@ public abstract class AgeableMob extends PathfinderMob {
@Override
public void aiStep() {
super.aiStep();

View File

@@ -1,6 +1,14 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/world/entity/AreaEffectCloud.java b/net/minecraft/world/entity/AreaEffectCloud.java
index 7942d6ef5124335259682ad6173f7e53c756f4f9..bf44f6b9c8710e0c9a85d44f6217501abc98a7b1 100644
--- a/net/minecraft/world/entity/AreaEffectCloud.java
+++ b/net/minecraft/world/entity/AreaEffectCloud.java
@@ -59,7 +_,7 @@
@@ -59,7 +59,7 @@ public class AreaEffectCloud extends Entity implements TraceableEntity {
public float radiusOnUse = 0.0F;
public float radiusPerTick = 0.0F;
@Nullable
@@ -9,7 +17,7 @@
@Nullable
public UUID ownerUUID;
@@ -193,7 +_,7 @@
@@ -193,7 +193,7 @@ public class AreaEffectCloud extends Entity implements TraceableEntity {
private void serverTick(ServerLevel level) {
if (this.duration != -1 && this.tickCount >= this.waitTime + this.duration) {
@@ -18,7 +26,7 @@
} else {
boolean isWaiting = this.isWaiting();
boolean flag = this.tickCount < this.waitTime;
@@ -206,7 +_,7 @@
@@ -206,7 +206,7 @@ public class AreaEffectCloud extends Entity implements TraceableEntity {
if (this.radiusPerTick != 0.0F) {
radius += this.radiusPerTick;
if (radius < 0.5F) {
@@ -27,7 +35,7 @@
return;
}
@@ -222,6 +_,7 @@
@@ -222,6 +222,7 @@ public class AreaEffectCloud extends Entity implements TraceableEntity {
this.potionContents.forEachEffect(list::add, this.potionDurationScale);
List<LivingEntity> entitiesOfClass = this.level().getEntitiesOfClass(LivingEntity.class, this.getBoundingBox());
if (!entitiesOfClass.isEmpty()) {
@@ -35,7 +43,7 @@
for (LivingEntity livingEntity : entitiesOfClass) {
if (!this.victims.containsKey(livingEntity)
&& livingEntity.isAffectedByPotions()
@@ -230,6 +_,17 @@
@@ -230,6 +231,17 @@ public class AreaEffectCloud extends Entity implements TraceableEntity {
double d1 = livingEntity.getZ() - this.getZ();
double d2 = d * d + d1 * d1;
if (d2 <= radius * radius) {
@@ -53,7 +61,7 @@
this.victims.put(livingEntity, this.tickCount + this.reapplicationDelay);
for (MobEffectInstance mobEffectInstance : list) {
@@ -238,14 +_,14 @@
@@ -238,14 +250,14 @@ public class AreaEffectCloud extends Entity implements TraceableEntity {
.value()
.applyInstantenousEffect(level, this, this.getOwner(), livingEntity, mobEffectInstance.getAmplifier(), 0.5);
} else {
@@ -70,7 +78,7 @@
return;
}
@@ -255,7 +_,7 @@
@@ -255,7 +267,7 @@ public class AreaEffectCloud extends Entity implements TraceableEntity {
if (this.durationOnUse != 0 && this.duration != -1) {
this.duration = this.duration + this.durationOnUse;
if (this.duration <= 0) {

View File

@@ -1,6 +1,14 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
index 64e2aa03baeb5d1622f5acd5ce77c62d4398dc13..19edb22d183eae73b6106c1c7a92b4ce7254da18 100644
--- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java
@@ -141,6 +_,107 @@
@@ -141,6 +141,107 @@ import net.minecraft.world.scores.Team;
import org.jetbrains.annotations.Contract;
public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess, ScoreHolder, DataComponentGetter {
@@ -108,7 +116,7 @@
public static final String ID_TAG = "id";
public static final String PASSENGERS_TAG = "Passengers";
private static final String DATA_TAG = "data";
@@ -203,7 +_,7 @@
@@ -203,7 +304,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
public double yOld;
public double zOld;
public boolean noPhysics;
@@ -117,7 +125,7 @@
public int tickCount;
private int remainingFireTicks = -this.getFireImmuneTicks();
public boolean wasTouchingWater;
@@ -240,7 +_,7 @@
@@ -240,7 +341,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
protected UUID uuid = Mth.createInsecureUUID(this.random);
protected String stringUUID = this.uuid.toString();
private boolean hasGlowingTag;
@@ -126,7 +134,7 @@
private final double[] pistonDeltas = new double[]{0.0, 0.0, 0.0};
private long pistonDeltasGameTime;
private EntityDimensions dimensions;
@@ -251,7 +_,7 @@
@@ -251,7 +352,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
private boolean onGroundNoBlocks = false;
private float crystalSoundIntensity;
private int lastCrystalSoundPlayTick;
@@ -135,7 +143,7 @@
@Nullable
private BlockState inBlockState = null;
private final List<List<Entity.Movement>> movementThisTick = new ObjectArrayList<>();
@@ -259,6 +_,41 @@
@@ -259,6 +360,41 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
private final LongSet visitedBlocks = new LongOpenHashSet();
private final InsideBlockEffectApplier.StepBasedCollector insideEffectCollector = new InsideBlockEffectApplier.StepBasedCollector();
private CustomData customData = CustomData.EMPTY;
@@ -177,7 +185,7 @@
public Entity(EntityType<?> entityType, Level level) {
this.type = entityType;
@@ -280,6 +_,7 @@
@@ -280,6 +416,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
this.entityData = builder.build();
this.setPos(0.0, 0.0, 0.0);
this.eyeHeight = this.dimensions.eyeHeight();
@@ -185,7 +193,7 @@
}
public boolean isColliding(BlockPos pos, BlockState state) {
@@ -292,6 +_,12 @@
@@ -292,6 +429,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
return team != null && team.getColor().getColor() != null ? team.getColor().getColor() : 16777215;
}
@@ -198,7 +206,7 @@
public boolean isSpectator() {
return false;
}
@@ -332,7 +_,7 @@
@@ -332,7 +475,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}
public boolean addTag(String tag) {
@@ -207,7 +215,7 @@
}
public boolean removeTag(String tag) {
@@ -340,12 +_,18 @@
@@ -340,12 +483,18 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}
public void kill(ServerLevel level) {
@@ -228,7 +236,7 @@
}
protected abstract void defineSynchedData(SynchedEntityData.Builder builder);
@@ -354,6 +_,48 @@
@@ -354,6 +503,48 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
return this.entityData;
}
@@ -277,7 +285,7 @@
@Override
public boolean equals(Object object) {
return object instanceof Entity && ((Entity)object).id == this.id;
@@ -365,7 +_,13 @@
@@ -365,7 +556,13 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}
public void remove(Entity.RemovalReason reason) {
@@ -292,7 +300,7 @@
}
public void onClientRemoval() {
@@ -375,6 +_,15 @@
@@ -375,6 +572,15 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}
public void setPose(Pose pose) {
@@ -308,7 +316,7 @@
this.entityData.set(DATA_POSE, pose);
}
@@ -398,6 +_,32 @@
@@ -398,6 +604,32 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}
public void setRot(float yRot, float xRot) {
@@ -341,7 +349,7 @@
this.setYRot(yRot % 360.0F);
this.setXRot(xRot % 360.0F);
}
@@ -407,8 +_,8 @@
@@ -407,8 +639,8 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}
public void setPos(double x, double y, double z) {
@@ -352,7 +360,7 @@
}
protected final AABB makeBoundingBox() {
@@ -438,12 +_,28 @@
@@ -438,12 +670,28 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}
public void tick() {
@@ -381,7 +389,7 @@
this.inBlockState = null;
if (this.isPassenger() && this.getVehicle().isRemoved()) {
this.stopRiding();
@@ -453,7 +_,7 @@
@@ -453,7 +701,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
this.boardingCooldown--;
}
@@ -390,7 +398,7 @@
if (this.canSpawnSprintParticle()) {
this.spawnSprintParticle();
}
@@ -484,6 +_,10 @@
@@ -484,6 +732,10 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
if (this.isInLava()) {
this.fallDistance *= 0.5;
@@ -401,7 +409,7 @@
}
this.checkBelowWorld();
@@ -500,11 +_,16 @@
@@ -500,11 +752,16 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}
public void setSharedFlagOnFire(boolean isOnFire) {
@@ -420,7 +428,7 @@
this.onBelowWorld();
}
}
@@ -532,15 +_,41 @@
@@ -532,15 +789,41 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}
public void lavaIgnite() {
@@ -464,7 +472,7 @@
&& this.shouldPlayLavaHurtSound()
&& !this.isSilent()) {
serverLevel.playSound(
@@ -555,6 +_,20 @@
@@ -555,6 +838,20 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}
public final void igniteForSeconds(float seconds) {
@@ -485,7 +493,7 @@
this.igniteForTicks(Mth.floor(seconds * 20.0F));
}
@@ -579,7 +_,7 @@
@@ -579,7 +876,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}
protected void onBelowWorld() {
@@ -494,7 +502,7 @@
}
public boolean isFree(double x, double y, double z) {
@@ -635,7 +_,28 @@
@@ -635,7 +932,28 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
return this.onGround;
}
@@ -523,7 +531,7 @@
if (this.noPhysics) {
this.setPos(this.getX() + movement.x, this.getY() + movement.y, this.getZ() + movement.z);
} else {
@@ -721,6 +_,27 @@
@@ -721,6 +1039,27 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
block.updateEntityMovementAfterFallOn(this.level(), this);
}
}
@@ -551,7 +559,7 @@
if (!this.level().isClientSide() || this.isLocalInstanceAuthoritative()) {
Entity.MovementEmission movementEmission = this.getMovementEmission();
@@ -734,6 +_,13 @@
@@ -734,6 +1073,13 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
profilerFiller.pop();
}
}
@@ -565,7 +573,7 @@
}
private void applyMovementEmissionAndPlaySound(Entity.MovementEmission movementEmission, Vec3 movement, BlockPos pos, BlockState state) {
@@ -898,7 +_,7 @@
@@ -898,7 +1244,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}
protected BlockPos getOnPos(float yOffset) {
@@ -574,7 +582,7 @@
BlockPos blockPos = this.mainSupportingBlockPos.get();
if (!(yOffset > 1.0E-5F)) {
return blockPos;
@@ -1104,7 +_,7 @@
@@ -1104,7 +1450,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|| this.collidedWithShapeMovingFrom(vec3, vec31, entityInsideCollisionShape.move(new Vec3(pos)).toAabbs());
if (flag) {
try {
@@ -583,7 +591,7 @@
blockState.entityInside(this.level(), pos, this, stepBasedCollector);
this.onInsideBlock(blockState);
} catch (Throwable var14) {
@@ -1119,7 +_,7 @@
@@ -1119,7 +1465,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
boolean flag1 = this.collidedWithFluid(blockState.getFluidState(), pos, vec3, vec31);
if (flag1) {
@@ -592,7 +600,7 @@
blockState.getFluidState().entityInside(this.level(), pos, this, stepBasedCollector);
}
}
@@ -1519,6 +_,7 @@
@@ -1519,6 +1865,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
this.setXRot(Mth.clamp(xRot, -90.0F, 90.0F) % 360.0F);
this.yRotO = this.getYRot();
this.xRotO = this.getXRot();
@@ -600,7 +608,7 @@
}
public void absSnapTo(double x, double y, double z) {
@@ -1528,6 +_,7 @@
@@ -1528,6 +1875,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
this.yo = y;
this.zo = d1;
this.setPos(d, y, d1);
@@ -608,7 +616,7 @@
}
public void snapTo(Vec3 pos) {
@@ -1547,11 +_,19 @@
@@ -1547,11 +1895,19 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}
public void snapTo(double x, double y, double z, float yRot, float xRot) {
@@ -628,7 +636,7 @@
}
public final void setOldPosAndRot() {
@@ -1618,6 +_,7 @@
@@ -1618,6 +1974,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
public void push(Entity entity) {
if (!this.isPassengerOfSameVehicle(entity)) {
if (!entity.noPhysics && !this.noPhysics) {
@@ -636,7 +644,7 @@
double d = entity.getX() - this.getX();
double d1 = entity.getZ() - this.getZ();
double max = Mth.absMax(d, d1);
@@ -1651,7 +_,21 @@
@@ -1651,7 +2008,21 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}
public void push(double x, double y, double z) {
@@ -659,7 +667,7 @@
this.hasImpulse = true;
}
@@ -1758,8 +_,20 @@
@@ -1758,9 +2129,21 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}
public boolean isPushable() {
@@ -671,16 +679,17 @@
+ // Paper end - Climbing should not bypass cramming gamerule
return false;
}
+
+ // CraftBukkit start - collidable API
+ public boolean canCollideWithBukkit(Entity entity) {
+ return this.isPushable();
+ }
+ // CraftBukkit end
+
public void awardKillScore(Entity entity, DamageSource damageSource) {
if (entity instanceof ServerPlayer) {
@@ -1786,15 +_,23 @@
CriteriaTriggers.ENTITY_KILLED_PLAYER.trigger((ServerPlayer)entity, this, damageSource);
@@ -1786,15 +2169,23 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}
public boolean saveAsPassenger(CompoundTag compound) {
@@ -708,7 +717,7 @@
return true;
}
}
@@ -1805,14 +_,35 @@
@@ -1805,14 +2196,35 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}
public CompoundTag saveWithoutId(CompoundTag compound) {
@@ -744,7 +753,7 @@
compound.store("Rotation", Vec2.CODEC, new Vec2(this.getYRot(), this.getXRot()));
compound.putDouble("fall_distance", this.fallDistance);
compound.putShort("Fire", (short)this.remainingFireTicks);
@@ -1820,7 +_,29 @@
@@ -1820,7 +2232,29 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
compound.putBoolean("OnGround", this.onGround());
compound.putBoolean("Invulnerable", this.invulnerable);
compound.putInt("PortalCooldown", this.portalCooldown);
@@ -775,7 +784,7 @@
Component customName = this.getCustomName();
if (customName != null) {
RegistryOps<Tag> registryOps = this.registryAccess().createSerializationContext(NbtOps.INSTANCE);
@@ -1848,9 +_,12 @@
@@ -1848,9 +2282,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
compound.putInt("TicksFrozen", this.getTicksFrozen());
}
@@ -790,7 +799,7 @@
if (!this.tags.isEmpty()) {
compound.store("Tags", TAG_LIST_CODEC, List.copyOf(this.tags));
@@ -1860,13 +_,13 @@
@@ -1860,13 +2297,13 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
compound.store("data", CustomData.CODEC, this.customData);
}
@@ -806,7 +815,7 @@
listTag.add(compoundTag);
}
}
@@ -1876,6 +_,33 @@
@@ -1876,6 +2313,33 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}
}
@@ -840,7 +849,7 @@
return compound;
} catch (Throwable var8) {
CrashReport crashReport = CrashReport.forThrowable(var8, "Saving entity NBT");
@@ -1888,7 +_,7 @@
@@ -1888,7 +2352,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
public void load(CompoundTag compound) {
try {
Vec3 vec3 = compound.read("Pos", Vec3.CODEC).orElse(Vec3.ZERO);
@@ -849,7 +858,7 @@
Vec2 vec2 = compound.read("Rotation", Vec2.CODEC).orElse(Vec2.ZERO);
this.setDeltaMovement(Math.abs(vec31.x) > 10.0 ? 0.0 : vec31.x, Math.abs(vec31.y) > 10.0 ? 0.0 : vec31.y, Math.abs(vec31.z) > 10.0 ? 0.0 : vec31.z);
this.hasImpulse = true;
@@ -1921,7 +_,20 @@
@@ -1921,7 +2385,20 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
this.setNoGravity(compound.getBooleanOr("NoGravity", false));
this.setGlowingTag(compound.getBooleanOr("Glowing", false));
this.setTicksFrozen(compound.getIntOr("TicksFrozen", 0));
@@ -871,7 +880,7 @@
this.customData = compound.read("data", CustomData.CODEC).orElse(CustomData.EMPTY);
this.tags.clear();
compound.read("Tags", TAG_LIST_CODEC).ifPresent(this.tags::addAll);
@@ -1932,6 +_,67 @@
@@ -1932,6 +2409,67 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
} else {
throw new IllegalStateException("Entity has invalid rotation");
}
@@ -939,7 +948,7 @@
} catch (Throwable var8) {
CrashReport crashReport = CrashReport.forThrowable(var8, "Loading entity NBT");
CrashReportCategory crashReportCategory = crashReport.addCategory("Entity being loaded");
@@ -1946,10 +_,21 @@
@@ -1946,11 +2484,22 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@Nullable
public final String getEncodeId() {
@@ -951,19 +960,19 @@
EntityType<?> type = this.getType();
ResourceLocation key = EntityType.getKey(type);
- return type.canSerialize() && key != null ? key.toString() : null;
- }
+ return (type.canSerialize() || includeNonSaveable) && key != null ? key.toString() : null; // Paper - Raw entity serialization API
+ }
+
}
+ // CraftBukkit start - allow excluding certain data when saving
+ protected void addAdditionalSaveData(CompoundTag tag, boolean includeAll) {
+ this.addAdditionalSaveData(tag);
+ }
+ // CraftBukkit end
+
protected abstract void readAdditionalSaveData(CompoundTag tag);
@@ -1972,11 +_,63 @@
protected abstract void addAdditionalSaveData(CompoundTag tag);
@@ -1972,11 +2521,63 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@Nullable
public ItemEntity spawnAtLocation(ServerLevel level, ItemStack stack, float yOffset) {
@@ -1028,7 +1037,7 @@
level.addFreshEntity(itemEntity);
return itemEntity;
}
@@ -2008,7 +_,16 @@
@@ -2008,7 +2609,16 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
if (this.isAlive() && this instanceof Leashable leashable) {
if (leashable.getLeashHolder() == player) {
if (!this.level().isClientSide()) {
@@ -1046,7 +1055,7 @@
leashable.removeLeash();
} else {
leashable.dropLeash();
@@ -2023,6 +_,13 @@
@@ -2023,6 +2633,13 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
ItemStack itemInHand = player.getItemInHand(hand);
if (itemInHand.is(Items.LEAD) && leashable.canHaveALeashAttachedToIt()) {
if (!this.level().isClientSide()) {
@@ -1060,7 +1069,7 @@
leashable.setLeashedTo(player, true);
}
@@ -2096,11 +_,11 @@
@@ -2096,11 +2713,11 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}
public boolean startRiding(Entity vehicle, boolean force) {
@@ -1074,7 +1083,7 @@
return false;
} else {
for (Entity entity = vehicle; entity.vehicle != null; entity = entity.vehicle) {
@@ -2110,6 +_,27 @@
@@ -2110,6 +2727,27 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}
if (force || this.canRide(vehicle) && vehicle.canAddPassenger(this)) {
@@ -1102,7 +1111,7 @@
if (this.isPassenger()) {
this.stopRiding();
}
@@ -2138,15 +_,26 @@
@@ -2138,15 +2776,26 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}
public void removeVehicle() {
@@ -1131,7 +1140,7 @@
}
protected void addPassenger(Entity passenger) {
@@ -2170,10 +_,43 @@
@@ -2170,10 +2819,43 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}
}
@@ -1176,7 +1185,7 @@
if (this.passengers.size() == 1 && this.passengers.get(0) == passenger) {
this.passengers = ImmutableList.of();
} else {
@@ -2183,6 +_,7 @@
@@ -2183,6 +2865,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
passenger.boardingCooldown = 60;
this.gameEvent(GameEvent.ENTITY_DISMOUNT, passenger);
}
@@ -1184,7 +1193,7 @@
}
protected boolean canAddPassenger(Entity passenger) {
@@ -2266,8 +_,8 @@
@@ -2266,8 +2949,8 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
TeleportTransition portalDestination = this.portalProcess.getPortalDestination(serverLevel, this);
if (portalDestination != null) {
ServerLevel level = portalDestination.newLevel();
@@ -1195,7 +1204,7 @@
this.teleport(portalDestination);
}
}
@@ -2348,7 +_,7 @@
@@ -2348,7 +3031,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}
public boolean isCrouching() {
@@ -1204,7 +1213,7 @@
}
public boolean isSprinting() {
@@ -2364,7 +_,7 @@
@@ -2364,7 +3047,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}
public boolean isVisuallySwimming() {
@@ -1213,7 +1222,7 @@
}
public boolean isVisuallyCrawling() {
@@ -2372,6 +_,13 @@
@@ -2372,6 +3055,13 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}
public void setSwimming(boolean swimming) {
@@ -1227,7 +1236,7 @@
this.setSharedFlag(4, swimming);
}
@@ -2410,6 +_,7 @@
@@ -2410,6 +3100,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@Nullable
public PlayerTeam getTeam() {
@@ -1235,7 +1244,7 @@
return this.level().getScoreboard().getPlayersTeam(this.getScoreboardName());
}
@@ -2426,7 +_,11 @@
@@ -2426,7 +3117,11 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}
public void setInvisible(boolean invisible) {
@@ -1248,7 +1257,7 @@
}
public boolean getSharedFlag(int flag) {
@@ -2443,7 +_,7 @@
@@ -2443,7 +3138,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}
public int getMaxAirSupply() {
@@ -1257,7 +1266,7 @@
}
public int getAirSupply() {
@@ -2451,10 +_,22 @@
@@ -2451,10 +3146,22 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}
public void setAirSupply(int air) {
@@ -1281,7 +1290,7 @@
this.setTicksFrozen(0);
}
@@ -2481,11 +_,43 @@
@@ -2481,11 +3188,43 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
public void thunderHit(ServerLevel level, LightningBolt lightning) {
this.setRemainingFireTicks(this.remainingFireTicks + 1);
@@ -1292,9 +1301,6 @@
+ // CraftBukkit end
if (this.remainingFireTicks == 0) {
- this.igniteForSeconds(8.0F);
- }
-
- this.hurtServer(level, this.damageSources().lightningBolt(), 5.0F);
+ // CraftBukkit start - Call a combust event when lightning strikes
+ org.bukkit.event.entity.EntityCombustByEntityEvent entityCombustEvent = new org.bukkit.event.entity.EntityCombustByEntityEvent(stormBukkitEntity, thisBukkitEntity, 8.0F);
+ pluginManager.callEvent(entityCombustEvent);
@@ -1306,8 +1312,9 @@
+ // Paper end - fix EntityCombustEvent cancellation
+ }
+ // CraftBukkit end
+ }
+
}
- this.hurtServer(level, this.damageSources().lightningBolt(), 5.0F);
+ // CraftBukkit start
+ if (thisBukkitEntity instanceof org.bukkit.entity.Hanging) {
+ org.bukkit.event.hanging.HangingBreakByEntityEvent hangingEvent = new org.bukkit.event.hanging.HangingBreakByEntityEvent((org.bukkit.entity.Hanging) thisBukkitEntity, stormBukkitEntity);
@@ -1329,7 +1336,7 @@
}
public void onAboveBubbleColumn(boolean downwards, BlockPos pos) {
@@ -2641,26 +_,30 @@
@@ -2641,26 +3380,30 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
return this.removalReason != null
? String.format(
Locale.ROOT,
@@ -1363,7 +1370,7 @@
);
}
@@ -2684,6 +_,13 @@
@@ -2684,6 +3427,13 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}
public void restoreFrom(Entity entity) {
@@ -1377,7 +1384,7 @@
CompoundTag compoundTag = entity.saveWithoutId(new CompoundTag());
compoundTag.remove("Dimension");
this.load(compoundTag);
@@ -2693,7 +_,56 @@
@@ -2693,7 +3443,56 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@Nullable
public Entity teleport(TeleportTransition teleportTransition) {
@@ -1434,7 +1441,7 @@
ServerLevel level = teleportTransition.newLevel();
boolean flag = level.dimension() != serverLevel.dimension();
if (!teleportTransition.asPassenger()) {
@@ -2742,10 +_,15 @@
@@ -2742,10 +3541,15 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
profilerFiller.pop();
return null;
} else {
@@ -1451,7 +1458,7 @@
for (Entity entity2 : list) {
entity2.startRiding(entityx, true);
@@ -2818,9 +_,17 @@
@@ -2818,9 +3622,17 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}
protected void removeAfterChangingDimensions() {
@@ -1472,7 +1479,7 @@
}
}
@@ -2828,11 +_,37 @@
@@ -2828,11 +3640,37 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
return PortalShape.getRelativePosition(portal, axis, this.position(), this.getDimensions(this.getPose()));
}
@@ -1510,7 +1517,7 @@
if (fromLevel.dimension() == Level.END && toLevel.dimension() == Level.OVERWORLD) {
for (Entity entity : this.getPassengers()) {
if (entity instanceof ServerPlayer serverPlayer && !serverPlayer.seenCredits) {
@@ -2940,8 +_,14 @@
@@ -2940,8 +3778,14 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
return this.entityData.get(DATA_CUSTOM_NAME_VISIBLE);
}
@@ -1527,7 +1534,7 @@
return entity != null;
}
@@ -3055,7 +_,26 @@
@@ -3055,7 +3899,26 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}
public final void setBoundingBox(AABB bb) {
@@ -1555,7 +1562,7 @@
}
public final float getEyeHeight(Pose pose) {
@@ -3099,6 +_,12 @@
@@ -3099,6 +3962,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}
public void stopSeenByPlayer(ServerPlayer serverPlayer) {
@@ -1568,7 +1575,7 @@
}
public float rotate(Rotation transformRotation) {
@@ -3132,7 +_,7 @@
@@ -3132,7 +4001,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}
@Nullable
@@ -1577,7 +1584,7 @@
return null;
}
@@ -3164,21 +_,32 @@
@@ -3164,21 +4033,32 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}
private Stream<Entity> getIndirectPassengersStream() {
@@ -1611,7 +1618,7 @@
}
public int countPlayerPassengers() {
@@ -3186,6 +_,7 @@
@@ -3186,6 +4066,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}
public boolean hasExactlyOnePlayerPassenger() {
@@ -1619,7 +1626,7 @@
return this.countPlayerPassengers() == 1;
}
@@ -3268,9 +_,38 @@
@@ -3268,9 +4149,38 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
return 1;
}
@@ -1659,7 +1666,7 @@
);
}
@@ -3328,6 +_,11 @@
@@ -3328,6 +4238,11 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
vec3 = vec3.add(flow);
i++;
}
@@ -1671,7 +1678,7 @@
}
}
}
@@ -3425,7 +_,9 @@
@@ -3425,7 +4340,9 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}
public void setDeltaMovement(Vec3 deltaMovement) {
@@ -1681,7 +1688,7 @@
}
public void addDeltaMovement(Vec3 addend) {
@@ -3488,9 +_,45 @@
@@ -3488,9 +4405,45 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
return this.getZ((2.0 * this.random.nextDouble() - 1.0) * scale);
}
@@ -1727,7 +1734,7 @@
int floor = Mth.floor(x);
int floor1 = Mth.floor(y);
int floor2 = Mth.floor(z);
@@ -3504,6 +_,12 @@
@@ -3504,6 +4457,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
this.levelCallback.onMove();
}
@@ -1740,7 +1747,7 @@
}
public void checkDespawn() {
@@ -3543,6 +_,12 @@
@@ -3543,6 +4502,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
return this.getTicksFrozen() > 0;
}
@@ -1753,7 +1760,7 @@
public float getYRot() {
return this.yRot;
}
@@ -3593,7 +_,9 @@
@@ -3593,7 +4558,9 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}
@Override
@@ -1764,7 +1771,7 @@
if (this.removalReason == null) {
this.removalReason = removalReason;
}
@@ -3605,12 +_,28 @@
@@ -3605,12 +4572,28 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
this.getPassengers().forEach(Entity::stopRiding);
this.levelCallback.onRemove(removalReason);
this.onRemoval(removalReason);
@@ -1793,7 +1800,7 @@
@Override
public void setLevelCallback(EntityInLevelCallback levelCallback) {
this.levelCallback = levelCallback;
@@ -3780,4 +_,14 @@
@@ -3780,4 +4763,14 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
return this.save;
}
}

View File

@@ -1,6 +1,14 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/world/entity/EntitySelector.java b/net/minecraft/world/entity/EntitySelector.java
index 68da3831bb0a7aac59607e913e3a3e8ec9c3c64f..bfd58eb04eee606ac0a8071de9bf75f46c35decb 100644
--- a/net/minecraft/world/entity/EntitySelector.java
+++ b/net/minecraft/world/entity/EntitySelector.java
@@ -17,6 +_,22 @@
@@ -17,6 +17,22 @@ public final class EntitySelector {
public static final Predicate<Entity> NO_SPECTATORS = entity -> !entity.isSpectator();
public static final Predicate<Entity> CAN_BE_COLLIDED_WITH = NO_SPECTATORS.and(Entity::canBeCollidedWith);
public static final Predicate<Entity> CAN_BE_PICKED = NO_SPECTATORS.and(Entity::isPickable);
@@ -23,7 +31,7 @@
private EntitySelector() {
}
@@ -27,18 +_,24 @@
@@ -27,18 +43,24 @@ public final class EntitySelector {
}
public static Predicate<Entity> pushableBy(Entity entity) {

View File

@@ -1,6 +1,14 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/world/entity/EntityType.java b/net/minecraft/world/entity/EntityType.java
index 3993b90daeff2a5a72816e9cc76dacc830d6af77..4c57990c94721dd0973477669e1dadfab5f16404 100644
--- a/net/minecraft/world/entity/EntityType.java
+++ b/net/minecraft/world/entity/EntityType.java
@@ -216,7 +_,7 @@
@@ -216,7 +216,7 @@ public class EntityType<T extends Entity> implements FeatureElement, EntityTypeT
.fireImmune()
.sized(6.0F, 0.5F)
.clientTrackingRange(10)
@@ -9,7 +17,7 @@
);
public static final EntityType<Armadillo> ARMADILLO = register(
"armadillo", EntityType.Builder.of(Armadillo::new, MobCategory.CREATURE).sized(0.7F, 0.65F).eyeHeight(0.26F).clientTrackingRange(10)
@@ -1145,6 +_,22 @@
@@ -1145,6 +1145,22 @@ public class EntityType<T extends Entity> implements FeatureElement, EntityTypeT
boolean shouldOffsetY,
boolean shouldOffsetYMore
) {
@@ -32,7 +40,7 @@
Consumer<T> consumer;
if (spawnedFrom != null) {
consumer = createDefaultStackConfig(level, spawnedFrom, owner);
@@ -1152,7 +_,7 @@
@@ -1152,7 +1168,7 @@ public class EntityType<T extends Entity> implements FeatureElement, EntityTypeT
consumer = entity -> {};
}
@@ -41,7 +49,7 @@
}
public static <T extends Entity> Consumer<T> createDefaultStackConfig(Level level, ItemStack stack, @Nullable LivingEntity owner) {
@@ -1169,19 +_,56 @@
@@ -1169,19 +1185,56 @@ public class EntityType<T extends Entity> implements FeatureElement, EntityTypeT
public static <T extends Entity> Consumer<T> appendCustomEntityStackConfig(Consumer<T> consumer, Level level, ItemStack stack, @Nullable LivingEntity owner) {
CustomData customData = stack.getOrDefault(DataComponents.ENTITY_DATA, CustomData.EMPTY);
@@ -101,7 +109,7 @@
if (entity instanceof Mob mob) {
mob.playAmbientSound();
}
@@ -1237,6 +_,15 @@
@@ -1237,6 +1290,15 @@ public class EntityType<T extends Entity> implements FeatureElement, EntityTypeT
if (level.isClientSide
|| !entity.getType().onlyOpCanSetNbt()
|| owner instanceof Player player && server.getPlayerList().isOp(player.getGameProfile())) {
@@ -117,7 +125,7 @@
customData.loadInto(entity);
}
}
@@ -1308,9 +_,20 @@
@@ -1308,9 +1370,20 @@ public class EntityType<T extends Entity> implements FeatureElement, EntityTypeT
}
public static Optional<Entity> create(CompoundTag tag, Level level, EntitySpawnReason spawnReason) {

View File

@@ -1,10 +1,17 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/world/entity/ExperienceOrb.java b/net/minecraft/world/entity/ExperienceOrb.java
index 8f5d415aeed587c8477f0a0839104fdbd4be9724..c97a0e500e889b406cb2d679a3870715775f5393 100644
--- a/net/minecraft/world/entity/ExperienceOrb.java
+++ b/net/minecraft/world/entity/ExperienceOrb.java
@@ -41,9 +_,54 @@
@@ -41,9 +41,54 @@ public class ExperienceOrb extends Entity {
@Nullable
private Player followingPlayer;
private final InterpolationHandler interpolation = new InterpolationHandler(this);
-
+ // Paper start
+ @Nullable
+ public java.util.UUID sourceEntityId;
@@ -17,7 +24,7 @@
+ if (expData.isEmpty()) {
+ return;
+ }
+
+ this.sourceEntityId = expData.read("source", net.minecraft.core.UUIDUtil.CODEC).orElse(null);
+ this.triggerEntityId = expData.read("trigger", net.minecraft.core.UUIDUtil.CODEC).orElse(null);
+ expData.getString("reason").ifPresent(reason -> {
@@ -56,7 +63,7 @@
this.setPos(x, y, z);
if (!this.level().isClientSide) {
this.setYRot((float)(this.random.nextDouble() * 360.0));
@@ -119,12 +_,13 @@
@@ -119,12 +164,13 @@ public class ExperienceOrb extends Entity {
this.age++;
if (this.age >= 6000) {
@@ -71,7 +78,7 @@
if (this.followingPlayer == null || this.followingPlayer.isSpectator() || this.followingPlayer.distanceToSqr(this) > 64.0) {
Player nearestPlayer = this.level().getNearestPlayer(this, 8.0);
if (nearestPlayer != null && !nearestPlayer.isSpectator() && !nearestPlayer.isDeadOrDying()) {
@@ -134,7 +_,24 @@
@@ -134,7 +180,24 @@ public class ExperienceOrb extends Entity {
}
}
@@ -97,7 +104,7 @@
Vec3 vec3 = new Vec3(
this.followingPlayer.getX() - this.getX(),
this.followingPlayer.getY() + this.followingPlayer.getEyeHeight() / 2.0 - this.getY(),
@@ -161,18 +_,29 @@
@@ -161,18 +224,29 @@ public class ExperienceOrb extends Entity {
}
public static void award(ServerLevel level, Vec3 pos, int amount) {
@@ -129,7 +136,7 @@
List<ExperienceOrb> entities = level.getEntities(EntityTypeTest.forClass(ExperienceOrb.class), aabb, orb -> canMerge(orb, randomInt, amount));
if (!entities.isEmpty()) {
ExperienceOrb experienceOrb = entities.get(0);
@@ -189,13 +_,18 @@
@@ -189,13 +263,18 @@ public class ExperienceOrb extends Entity {
}
private static boolean canMerge(ExperienceOrb orb, int amount, int other) {
@@ -150,7 +157,7 @@
}
private void setUnderwaterMovement() {
@@ -220,7 +_,7 @@
@@ -220,7 +299,7 @@ public class ExperienceOrb extends Entity {
this.markHurt();
this.health = (int)(this.health - amount);
if (this.health <= 0) {
@@ -159,7 +166,7 @@
}
return true;
@@ -231,32 +_,34 @@
@@ -231,32 +310,34 @@ public class ExperienceOrb extends Entity {
public void addAdditionalSaveData(CompoundTag compound) {
compound.putShort("Health", (short)this.health);
compound.putShort("Age", (short)this.age);
@@ -200,7 +207,7 @@
}
}
}
@@ -270,9 +_,19 @@
@@ -270,9 +351,19 @@ public class ExperienceOrb extends Entity {
ItemStack itemStack = randomItemWith.get().itemStack();
int i = EnchantmentHelper.modifyDurabilityToRepairFromXp(player.serverLevel(), itemStack, value);
int min = Math.min(i, itemStack.getDamageValue());
@@ -221,7 +228,7 @@
if (i1 > 0) {
return this.repairPlayerItems(player, i1);
}
@@ -318,6 +_,24 @@
@@ -318,6 +409,24 @@ public class ExperienceOrb extends Entity {
}
public static int getExperienceValue(int expValue) {

View File

@@ -1,6 +1,14 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/world/entity/Leashable.java b/net/minecraft/world/entity/Leashable.java
index d658dfeb7d1e154f0153621ff6779b6e2bb1cc4d..24b663e48a88345bb366cc4c9afbabac22c9df85 100644
--- a/net/minecraft/world/entity/Leashable.java
+++ b/net/minecraft/world/entity/Leashable.java
@@ -56,6 +_,11 @@
@@ -56,6 +56,11 @@ public interface Leashable {
}
default void writeLeashData(CompoundTag tag, @Nullable Leashable.LeashData leashData) {
@@ -12,7 +20,7 @@
tag.storeNullable("leash", Leashable.LeashData.CODEC, leashData);
}
@@ -75,7 +_,9 @@
@@ -75,7 +80,9 @@ public interface Leashable {
}
if (entity.tickCount > 100) {
@@ -22,7 +30,7 @@
entity.setLeashData(null);
}
}
@@ -99,7 +_,9 @@
@@ -99,7 +106,9 @@ public interface Leashable {
entity.onLeashRemoved();
if (entity.level() instanceof ServerLevel serverLevel) {
if (dropItem) {
@@ -32,7 +40,7 @@
}
if (broadcastPacket) {
@@ -117,7 +_,15 @@
@@ -117,7 +126,15 @@ public interface Leashable {
if (leashData != null && leashData.leashHolder != null) {
if (!entity.isAlive() || !leashData.leashHolder.isAlive()) {
@@ -49,7 +57,7 @@
entity.dropLeash();
} else {
entity.removeLeash();
@@ -131,7 +_,7 @@
@@ -131,7 +148,7 @@ public interface Leashable {
return;
}
@@ -58,7 +66,7 @@
entity.leashTooFarBehaviour();
} else if (f > 6.0) {
entity.elasticRangeLeashBehaviour(leashHolder, f);
@@ -148,7 +_,21 @@
@@ -148,7 +165,21 @@ public interface Leashable {
}
default void leashTooFarBehaviour() {

View File

@@ -1,6 +1,14 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java
index cf7386c6f44d8c32dfa93e1333eca9fba510fa03..267544f50fafd914566df1c4b2327bc64d673165 100644
--- a/net/minecraft/world/entity/LivingEntity.java
+++ b/net/minecraft/world/entity/LivingEntity.java
@@ -135,6 +_,17 @@
@@ -135,6 +135,17 @@ import net.minecraft.world.scores.Scoreboard;
import org.jetbrains.annotations.Contract;
import org.slf4j.Logger;
@@ -18,7 +26,7 @@
public abstract class LivingEntity extends Entity implements Attackable {
private static final Logger LOGGER = LogUtils.getLogger();
private static final String TAG_ACTIVE_EFFECTS = "active_effects";
@@ -251,11 +_,25 @@
@@ -251,11 +262,25 @@ public abstract class LivingEntity extends Entity implements Attackable {
EquipmentSlot.class
);
protected final EntityEquipment equipment;
@@ -45,7 +53,7 @@
this.equipment = this.createEquipment();
this.blocksBuilding = true;
this.reapplyPosition();
@@ -350,7 +_,13 @@
@@ -350,7 +375,13 @@ public abstract class LivingEntity extends Entity implements Attackable {
double d1 = Math.min(0.2F + d / 15.0, 2.5);
int i = (int)(150.0 * d1);
@@ -60,7 +68,7 @@
}
}
@@ -535,7 +_,7 @@
@@ -535,7 +566,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
this.deathTime++;
if (this.deathTime >= 20 && !this.level().isClientSide() && !this.isRemoved()) {
this.level().broadcastEntityEvent(this, (byte)60);
@@ -69,7 +77,7 @@
}
}
@@ -640,7 +_,7 @@
@@ -640,7 +671,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
public boolean shouldDiscardFriction() {
@@ -78,7 +86,7 @@
}
public void setDiscardFriction(boolean discardFriction) {
@@ -652,10 +_,15 @@
@@ -652,10 +683,15 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
public void onEquipItem(EquipmentSlot slot, ItemStack oldItem, ItemStack newItem) {
@@ -95,7 +103,7 @@
this.level()
.playSeededSound(
null,
@@ -682,12 +_,12 @@
@@ -682,12 +718,12 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
@Override
@@ -110,7 +118,7 @@
this.brain.clearMemories();
}
@@ -696,11 +_,17 @@
@@ -696,11 +732,17 @@ public abstract class LivingEntity extends Entity implements Attackable {
mobEffectInstance.onMobRemoved(level, this, removalReason);
}
@@ -128,14 +136,13 @@
compound.putFloat("Health", this.getHealth());
compound.putShort("HurtTime", (short)this.hurtTime);
compound.putInt("HurtByTimestamp", this.lastHurtByMobTimestamp);
@@ -731,8 +_,15 @@
@@ -731,8 +773,15 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
}
- @Nullable
- public ItemEntity drop(ItemStack stack, boolean randomizeMotion, boolean includeThrower) {
+ // Paper start - Extend dropItem API
+ @Nullable
@Nullable
- public ItemEntity drop(ItemStack stack, boolean randomizeMotion, boolean includeThrower) {
+ public final ItemEntity drop(ItemStack stack, boolean randomizeMotion, boolean includeThrower) {
+ return this.drop(stack, randomizeMotion, includeThrower, true, null);
+ }
@@ -146,7 +153,7 @@
if (stack.isEmpty()) {
return null;
} else if (this.level().isClientSide) {
@@ -741,6 +_,31 @@
@@ -741,6 +790,31 @@ public abstract class LivingEntity extends Entity implements Attackable {
} else {
ItemEntity itemEntity = this.createItemStackToDrop(stack, randomizeMotion, includeThrower);
if (itemEntity != null) {
@@ -178,7 +185,7 @@
this.level().addFreshEntity(itemEntity);
}
@@ -750,7 +_,22 @@
@@ -750,7 +824,22 @@ public abstract class LivingEntity extends Entity implements Attackable {
@Override
public void readAdditionalSaveData(CompoundTag compound) {
@@ -202,7 +209,7 @@
if (this.level() != null && !this.level().isClientSide) {
compound.getList("attributes").ifPresent(this.getAttributes()::load);
}
@@ -763,6 +_,11 @@
@@ -763,6 +852,11 @@ public abstract class LivingEntity extends Entity implements Attackable {
this.activeEffects.put(mobEffectInstance.getEffect(), mobEffectInstance);
}
@@ -214,7 +221,7 @@
this.setHealth(compound.getFloatOr("Health", this.getMaxHealth()));
this.hurtTime = compound.getShortOr("HurtTime", (short)0);
this.deathTime = compound.getShortOr("DeathTime", (short)0);
@@ -770,6 +_,7 @@
@@ -770,6 +864,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
compound.getString("Team").ifPresent(string -> {
Scoreboard scoreboard = this.level().getScoreboard();
PlayerTeam playerTeam = scoreboard.getPlayerTeam(string);
@@ -222,7 +229,7 @@
boolean flag = playerTeam != null && scoreboard.addPlayerToTeam(this.getStringUUID(), playerTeam);
if (!flag) {
LOGGER.warn("Unable to add mob to team \"{}\" (that team probably doesn't exist)", string);
@@ -777,11 +_,13 @@
@@ -777,11 +872,13 @@ public abstract class LivingEntity extends Entity implements Attackable {
});
this.setSharedFlag(7, compound.getBooleanOr("FallFlying", false));
compound.read("sleeping_pos", BlockPos.CODEC).ifPresentOrElse(blockPos -> {
@@ -236,7 +243,7 @@
}, this::clearSleepingPos);
compound.getCompound("Brain").ifPresent(compoundTag -> this.brain = this.makeBrain(new Dynamic<>(NbtOps.INSTANCE, compoundTag)));
this.lastHurtByPlayer = EntityReference.read(compound, "last_hurt_by_player");
@@ -791,15 +_,44 @@
@@ -791,15 +888,44 @@ public abstract class LivingEntity extends Entity implements Attackable {
this.equipment.setAll(compound.read("equipment", EntityEquipment.CODEC, registryOps).orElseGet(EntityEquipment::new));
}
@@ -281,7 +288,7 @@
iterator.remove();
this.onEffectsRemoved(List.of(mobEffectInstance));
} else if (mobEffectInstance.getDuration() % 600 == 0) {
@@ -809,6 +_,17 @@
@@ -809,6 +935,17 @@ public abstract class LivingEntity extends Entity implements Attackable {
} catch (ConcurrentModificationException var6) {
}
@@ -299,7 +306,7 @@
if (this.effectsDirty) {
this.updateInvisibilityStatus();
this.updateGlowingStatus();
@@ -916,15 +_,33 @@
@@ -916,15 +1053,33 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
public boolean removeAllEffects() {
@@ -337,7 +344,7 @@
}
}
@@ -951,21 +_,57 @@
@@ -951,21 +1106,57 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
public final boolean addEffect(MobEffectInstance effectInstance) {
@@ -397,7 +404,7 @@
this.onEffectUpdated(mobEffectInstance, true, entity);
flag = true;
}
@@ -1004,11 +_,37 @@
@@ -1004,11 +1195,37 @@ public abstract class LivingEntity extends Entity implements Attackable {
@Nullable
public final MobEffectInstance removeEffectNoUpdate(Holder<MobEffect> effect) {
@@ -436,7 +443,7 @@
if (mobEffectInstance != null) {
this.onEffectsRemoved(List.of(mobEffectInstance));
return true;
@@ -1092,17 +_,62 @@
@@ -1092,17 +1309,62 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
public void heal(float healAmount) {
@@ -500,7 +507,7 @@
this.entityData.set(DATA_HEALTH_ID, Mth.clamp(health, 0.0F, this.getMaxHealth()));
}
@@ -1114,7 +_,7 @@
@@ -1114,7 +1376,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
public boolean hurtServer(ServerLevel level, DamageSource damageSource, float amount) {
if (this.isInvulnerableTo(level, damageSource)) {
return false;
@@ -509,7 +516,7 @@
return false;
} else if (damageSource.is(DamageTypeTags.IS_FIRE) && this.hasEffect(MobEffects.FIRE_RESISTANCE)) {
return false;
@@ -1128,35 +_,59 @@
@@ -1128,35 +1390,59 @@ public abstract class LivingEntity extends Entity implements Attackable {
amount = 0.0F;
}
@@ -577,7 +584,7 @@
this.hurtDuration = 10;
this.hurtTime = this.hurtDuration;
}
@@ -1171,7 +_,7 @@
@@ -1171,7 +1457,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
level.broadcastDamageEvent(this, damageSource);
}
@@ -586,7 +593,7 @@
this.markHurt();
}
@@ -1186,8 +_,16 @@
@@ -1186,8 +1472,16 @@ public abstract class LivingEntity extends Entity implements Attackable {
d = damageSource.getSourcePosition().x() - this.getX();
d1 = damageSource.getSourcePosition().z() - this.getZ();
}
@@ -604,7 +611,7 @@
if (!flag) {
this.indicateDamage(d, d1);
}
@@ -1196,19 +_,19 @@
@@ -1196,19 +1490,19 @@ public abstract class LivingEntity extends Entity implements Attackable {
if (this.isDeadOrDying()) {
if (!this.checkTotemDeathProtection(damageSource)) {
@@ -629,7 +636,7 @@
if (flag2) {
this.lastDamageSource = damageSource;
this.lastDamageStamp = this.level().getGameTime();
@@ -1234,6 +_,12 @@
@@ -1234,6 +1528,12 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
public float applyItemBlocking(ServerLevel level, DamageSource damageSource, float damageAmount) {
@@ -642,7 +649,7 @@
if (damageAmount <= 0.0F) {
return 0.0F;
} else {
@@ -1258,10 +_,12 @@
@@ -1258,10 +1558,12 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
float f = blocksAttacks.resolveBlockedDamage(damageSource, damageAmount, acos);
@@ -656,7 +663,7 @@
return f;
}
@@ -1272,6 +_,59 @@
@@ -1272,6 +1574,59 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
}
@@ -716,7 +723,7 @@
public void playSecondaryHurtSound(DamageSource damageSource) {
if (damageSource.is(DamageTypes.THORNS)) {
SoundSource soundSource = this instanceof Player ? SoundSource.PLAYERS : SoundSource.HOSTILE;
@@ -1304,12 +_,24 @@
@@ -1304,12 +1659,24 @@ public abstract class LivingEntity extends Entity implements Attackable {
return EntityReference.get(this.lastHurtByPlayer, this.level(), Player.class);
}
@@ -742,7 +749,7 @@
}
private boolean checkTotemDeathProtection(DamageSource damageSource) {
@@ -1319,18 +_,39 @@
@@ -1319,18 +1686,39 @@ public abstract class LivingEntity extends Entity implements Attackable {
ItemStack itemStack = null;
DeathProtection deathProtection = null;
@@ -756,11 +763,14 @@
if (deathProtection != null) {
+ hand = interactionHand; // CraftBukkit
itemStack = itemInHand.copy();
- itemInHand.shrink(1);
+ // itemInHand.shrink(1); // CraftBukkit
+ break;
+ }
+ }
+
break;
}
}
- if (itemStack != null) {
- if (this instanceof ServerPlayer serverPlayer) {
+ final org.bukkit.inventory.EquipmentSlot handSlot = (hand != null) ? org.bukkit.craftbukkit.CraftEquipmentSlot.getHand(hand) : null;
+ final EntityResurrectEvent event = new EntityResurrectEvent((org.bukkit.entity.LivingEntity) this.getBukkitEntity(), handSlot);
+ event.setCancelled(itemStack == null);
@@ -770,13 +780,7 @@
+ deathProtection = null;
+ } else {
+ if (!itemInHand.isEmpty() && itemStack != null) { // Paper - only reduce item if actual totem was found
itemInHand.shrink(1);
- break;
- }
- }
-
- if (itemStack != null) {
- if (this instanceof ServerPlayer serverPlayer) {
+ itemInHand.shrink(1);
+ }
+ // Paper start - fix NPE when pre-cancelled EntityResurrectEvent is uncancelled
+ // restore the previous behavior in that case by defaulting to vanillas totem of undying effect
@@ -789,7 +793,7 @@
serverPlayer.awardStat(Stats.ITEM_USED.get(itemStack.getItem()));
CriteriaTriggers.USED_TOTEM.trigger(serverPlayer, itemStack);
this.gameEvent(GameEvent.ITEM_INTERACT_FINISH);
@@ -1389,6 +_,7 @@
@@ -1389,6 +1777,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
if (!this.isRemoved() && !this.dead) {
Entity entity = damageSource.getEntity();
LivingEntity killCredit = this.getKillCredit();
@@ -797,7 +801,7 @@
if (killCredit != null) {
killCredit.awardKillScore(this, damageSource);
}
@@ -1398,68 +_,141 @@
@@ -1398,68 +1787,141 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
if (!this.level().isClientSide && this.hasCustomName()) {
@@ -936,7 +940,6 @@
|| this.lastHurtByPlayerMemoryTime > 0 && this.shouldDropExperience() && level.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)
)) {
- ExperienceOrb.award(level, this.position(), this.getExperienceReward(level, entity));
- }
+ return this.getExperienceReward(level, entity); // CraftBukkit
+ }
+ return 0; // CraftBukkit
@@ -947,12 +950,12 @@
+ if (!(this instanceof net.minecraft.world.entity.boss.enderdragon.EnderDragon)) { // CraftBukkit - SPIGOT-2420: Special case ender dragon will drop the xp over time
+ ExperienceOrb.award(level, this.position(), this.expToDrop, this instanceof ServerPlayer ? org.bukkit.entity.ExperienceOrb.SpawnReason.PLAYER_DEATH : org.bukkit.entity.ExperienceOrb.SpawnReason.ENTITY_DEATH, entity, this); // Paper
+ this.expToDrop = 0;
+ }
}
+ // CraftBukkit end
}
protected void dropCustomDeathLoot(ServerLevel level, DamageSource damageSource, boolean recentlyHit) {
@@ -1539,9 +_,14 @@
@@ -1539,9 +2001,14 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
public void knockback(double strength, double x, double z) {
@@ -969,7 +972,7 @@
Vec3 deltaMovement = this.getDeltaMovement();
while (x * x + z * z < 1.0E-5F) {
@@ -1550,11 +_,22 @@
@@ -1550,11 +2017,22 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
Vec3 vec3 = new Vec3(x, 0.0, z).normalize().scale(strength);
@@ -993,7 +996,7 @@
}
}
@@ -1639,7 +_,7 @@
@@ -1639,7 +2117,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
@Override
public boolean isAlive() {
@@ -1002,7 +1005,7 @@
}
public boolean isLookingAtMe(LivingEntity entity, double tolerance, boolean scaleByDistance, boolean visual, double... yValues) {
@@ -1673,9 +_,14 @@
@@ -1673,9 +2151,14 @@ public abstract class LivingEntity extends Entity implements Attackable {
boolean flag = super.causeFallDamage(fallDistance, damageMultiplier, damageSource);
int i = this.calculateFallDamage(fallDistance, damageMultiplier);
if (i > 0) {
@@ -1018,7 +1021,7 @@
return true;
} else {
return flag;
@@ -1740,7 +_,7 @@
@@ -1740,7 +2223,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
protected float getDamageAfterArmorAbsorb(DamageSource damageSource, float damageAmount) {
if (!damageSource.is(DamageTypeTags.BYPASSES_ARMOR)) {
@@ -1027,7 +1030,7 @@
damageAmount = CombatRules.getDamageAfterAbsorb(
this, damageAmount, damageSource, this.getArmorValue(), (float)this.getAttributeValue(Attributes.ARMOR_TOUGHNESS)
);
@@ -1753,7 +_,8 @@
@@ -1753,7 +2236,8 @@ public abstract class LivingEntity extends Entity implements Attackable {
if (damageSource.is(DamageTypeTags.BYPASSES_EFFECTS)) {
return damageAmount;
} else {
@@ -1037,7 +1040,7 @@
int i = (this.getEffect(MobEffects.RESISTANCE).getAmplifier() + 1) * 5;
int i1 = 25 - i;
float f = damageAmount * i1;
@@ -1790,24 +_,201 @@
@@ -1790,24 +2274,201 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
}
@@ -1249,7 +1252,7 @@
}
public CombatTracker getCombatTracker() {
@@ -1836,7 +_,17 @@
@@ -1836,7 +2497,17 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
public final void setArrowCount(int count) {
@@ -1268,7 +1271,7 @@
}
public final int getStingerCount() {
@@ -1991,7 +_,7 @@
@@ -1991,7 +2662,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
@Override
protected void onBelowWorld() {
@@ -1277,15 +1280,14 @@
}
protected void updateSwingTime() {
@@ -2087,8 +_,15 @@
@@ -2087,8 +2758,15 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
public void setItemSlot(EquipmentSlot slot, ItemStack stack) {
- this.onEquipItem(slot, this.equipment.set(slot, stack), stack);
- }
+ // Paper start
+ this.setItemSlot(slot, stack, false);
+ }
}
+ // CraftBukkit start
+ public void setItemSlot(EquipmentSlot slot, ItemStack stack, boolean silent) {
+ // Paper end
@@ -1295,7 +1297,7 @@
public float getArmorCoverPercentage() {
int i = 0;
@@ -2180,14 +_,27 @@
@@ -2180,14 +2858,27 @@ public abstract class LivingEntity extends Entity implements Attackable {
return this.hasEffect(MobEffects.JUMP_BOOST) ? 0.1F * (this.getEffect(MobEffects.JUMP_BOOST).getAmplifier() + 1.0F) : 0.0F;
}
@@ -1323,7 +1325,7 @@
this.addDeltaMovement(new Vec3(-Mth.sin(f) * 0.2, 0.0, Mth.cos(f) * 0.2));
}
@@ -2327,8 +_,10 @@
@@ -2327,8 +3018,10 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
public void stopFallFlying() {
@@ -1334,7 +1336,7 @@
}
private Vec3 updateFallFlyingMovement(Vec3 deltaMovement) {
@@ -2454,7 +_,7 @@
@@ -2454,7 +3147,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
protected float getFlyingSpeed() {
@@ -1343,7 +1345,7 @@
}
public float getSpeed() {
@@ -2538,37 +_,15 @@
@@ -2538,37 +3231,15 @@ public abstract class LivingEntity extends Entity implements Attackable {
profilerFiller.pop();
profilerFiller.push("rangeChecks");
@@ -1362,15 +1364,19 @@
- while (this.yBodyRot - this.yBodyRotO >= 180.0F) {
- this.yBodyRotO += 360.0F;
- }
-
+ // Paper start - stop large pitch and yaw changes from crashing the server
+ this.yRotO += Math.round((this.getYRot() - this.yRotO) / 360.0F) * 360.0F;
- while (this.getXRot() - this.xRotO < -180.0F) {
- this.xRotO -= 360.0F;
- }
-
+ this.yBodyRotO += Math.round((this.yBodyRot - this.yBodyRotO) / 360.0F) * 360.0F;
- while (this.getXRot() - this.xRotO >= 180.0F) {
- this.xRotO += 360.0F;
- }
-
+ this.xRotO += Math.round((this.getXRot() - this.xRotO) / 360.0F) * 360.0F;
- while (this.yHeadRot - this.yHeadRotO < -180.0F) {
- this.yHeadRotO -= 360.0F;
- }
@@ -1378,19 +1384,12 @@
- while (this.yHeadRot - this.yHeadRotO >= 180.0F) {
- this.yHeadRotO += 360.0F;
- }
+ // Paper start - stop large pitch and yaw changes from crashing the server
+ this.yRotO += Math.round((this.getYRot() - this.yRotO) / 360.0F) * 360.0F;
+
+ this.yBodyRotO += Math.round((this.yBodyRot - this.yBodyRotO) / 360.0F) * 360.0F;
+
+ this.xRotO += Math.round((this.getXRot() - this.xRotO) / 360.0F) * 360.0F;
+
+ this.yHeadRotO += Math.round((this.yHeadRot - this.yHeadRotO) / 360.0F) * 360.0F;
+ // Paper end - stop large pitch and yaw changes from crashing the server
profilerFiller.pop();
if (this.isFallFlying()) {
@@ -2598,16 +_,39 @@
@@ -2598,16 +3269,39 @@ public abstract class LivingEntity extends Entity implements Attackable {
@Nullable
private Map<EquipmentSlot, ItemStack> collectEquipmentChanges() {
Map<EquipmentSlot, ItemStack> map = null;
@@ -1430,7 +1429,7 @@
AttributeMap attributes = this.getAttributes();
if (!itemStack.isEmpty()) {
this.stopLocationBasedEffects(itemStack, equipmentSlot, attributes);
@@ -2632,6 +_,8 @@
@@ -2632,6 +3326,8 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
}
}
@@ -1439,7 +1438,7 @@
}
return map;
@@ -2663,7 +_,7 @@
@@ -2663,7 +3359,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
list.add(Pair.of(equipmentSlot, itemStack1));
this.lastEquipmentItems.put(equipmentSlot, itemStack1);
});
@@ -1448,7 +1447,7 @@
}
protected void tickHeadTurn(float yBodyRot) {
@@ -2749,8 +_,10 @@
@@ -2749,8 +3445,10 @@ public abstract class LivingEntity extends Entity implements Attackable {
if (!flag || this.onGround() && !(fluidHeight > fluidJumpThreshold)) {
if (!this.isInLava() || this.onGround() && !(fluidHeight > fluidJumpThreshold)) {
if ((this.onGround() || flag && fluidHeight <= fluidJumpThreshold) && this.noJumpDelay == 0) {
@@ -1459,7 +1458,7 @@
}
} else {
this.jumpInLiquid(FluidTags.LAVA);
@@ -2791,7 +_,7 @@
@@ -2791,7 +3489,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
profilerFiller.pop();
if (this.level() instanceof ServerLevel serverLevel) {
profilerFiller.push("freezing");
@@ -1468,7 +1467,7 @@
this.setTicksFrozen(Math.max(0, this.getTicksFrozen() - 2));
}
@@ -2812,6 +_,20 @@
@@ -2812,6 +3510,20 @@ public abstract class LivingEntity extends Entity implements Attackable {
this.pushEntities();
profilerFiller.pop();
@@ -1489,7 +1488,7 @@
if (this.level() instanceof ServerLevel serverLevel && this.isSensitiveToWater() && this.isInWaterOrRain()) {
this.hurtServer(serverLevel, this.damageSources().drown(), 1.0F);
}
@@ -2830,6 +_,7 @@
@@ -2830,6 +3542,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
this.checkSlowFallDistance();
if (!this.level().isClientSide) {
if (!this.canGlide()) {
@@ -1497,7 +1496,7 @@
this.setSharedFlag(7, false);
return;
}
@@ -2869,10 +_,25 @@
@@ -2869,10 +3582,25 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
protected void pushEntities() {
@@ -1524,7 +1523,7 @@
if (_int > 0 && pushableEntities.size() > _int - 1 && this.random.nextInt(4) == 0) {
int i = 0;
@@ -2888,7 +_,16 @@
@@ -2888,7 +3616,16 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
}
@@ -1541,7 +1540,7 @@
this.doPush(entity1);
}
}
@@ -2930,9 +_,16 @@
@@ -2930,9 +3667,16 @@ public abstract class LivingEntity extends Entity implements Attackable {
@Override
public void stopRiding() {
@@ -1560,7 +1559,7 @@
this.dismountVehicle(vehicle);
}
}
@@ -2959,7 +_,7 @@
@@ -2959,7 +3703,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
public void onItemPickup(ItemEntity itemEntity) {
@@ -1569,7 +1568,7 @@
if (owner instanceof ServerPlayer) {
CriteriaTriggers.THROWN_ITEM_PICKED_UP_BY_ENTITY.trigger((ServerPlayer)owner, itemEntity.getItem(), this);
}
@@ -2969,7 +_,7 @@
@@ -2969,7 +3713,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
if (!entity.isRemoved()
&& !this.level().isClientSide
&& (entity instanceof ItemEntity || entity instanceof AbstractArrow || entity instanceof ExperienceOrb)) {
@@ -1578,7 +1577,7 @@
}
}
@@ -2983,7 +_,8 @@
@@ -2983,7 +3727,8 @@ public abstract class LivingEntity extends Entity implements Attackable {
} else {
Vec3 vec3 = new Vec3(this.getX(), this.getEyeY(), this.getZ());
Vec3 vec31 = new Vec3(entity.getX(), y, entity.getZ());
@@ -1588,7 +1587,7 @@
}
}
@@ -3003,13 +_,27 @@
@@ -3003,14 +3748,28 @@ public abstract class LivingEntity extends Entity implements Attackable {
@Override
public boolean isPickable() {
@@ -1600,10 +1599,9 @@
@Override
public boolean isPushable() {
- return this.isAlive() && !this.isSpectator() && !this.onClimbable();
- }
+ return this.isCollidable(this.level().paperConfig().collisions.fixClimbingBypassingCrammingRule);
+ }
+
}
+ @Override
+ public boolean isCollidable(boolean ignoreClimbing) {
+ return this.isAlive() && !this.isSpectator() && (ignoreClimbing || !this.onClimbable()) && this.collides; // CraftBukkit
@@ -1616,10 +1614,11 @@
+ return this.isPushable() && this.collides != this.collidableExemptions.contains(entity.getUUID());
+ }
+ // CraftBukkit end
+
@Override
public float getYHeadRot() {
@@ -3040,7 +_,7 @@
return this.yHeadRot;
@@ -3040,7 +3799,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
public final void setAbsorptionAmount(float absorptionAmount) {
@@ -1628,7 +1627,7 @@
}
protected void internalSetAbsorptionAmount(float absorptionAmount) {
@@ -3067,6 +_,15 @@
@@ -3067,6 +3826,15 @@ public abstract class LivingEntity extends Entity implements Attackable {
return (this.entityData.get(DATA_LIVING_ENTITY_FLAGS) & 2) > 0 ? InteractionHand.OFF_HAND : InteractionHand.MAIN_HAND;
}
@@ -1644,7 +1643,7 @@
private void updatingUsingItem() {
if (this.isUsingItem()) {
if (ItemStack.isSameItem(this.getItemInHand(this.getUsedItemHand()), this.useItem)) {
@@ -3084,6 +_,11 @@
@@ -3084,6 +3852,11 @@ public abstract class LivingEntity extends Entity implements Attackable {
return null;
} else {
double d = this.getEyeY() - 0.3F;
@@ -1656,7 +1655,7 @@
ItemEntity itemEntity = new ItemEntity(this.level(), this.getX(), d, this.getZ(), stack);
itemEntity.setPickUpDelay(40);
if (includeThrower) {
@@ -3115,7 +_,12 @@
@@ -3115,7 +3888,12 @@ public abstract class LivingEntity extends Entity implements Attackable {
protected void updateUsingItem(ItemStack usingItem) {
usingItem.onUseTick(this.level(), this, this.getUseItemRemainingTicks());
@@ -1670,7 +1669,7 @@
this.completeUsingItem();
}
}
@@ -3141,10 +_,19 @@
@@ -3141,10 +3919,19 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
public void startUsingItem(InteractionHand hand) {
@@ -1692,7 +1691,7 @@
if (!this.level().isClientSide) {
this.setLivingEntityFlag(1, true);
this.setLivingEntityFlag(2, hand == InteractionHand.OFF_HAND);
@@ -3168,7 +_,10 @@
@@ -3168,7 +3955,10 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
} else if (!this.isUsingItem() && !this.useItem.isEmpty()) {
this.useItem = ItemStack.EMPTY;
@@ -1704,7 +1703,7 @@
}
}
}
@@ -3207,12 +_,49 @@
@@ -3207,12 +3997,49 @@ public abstract class LivingEntity extends Entity implements Attackable {
this.releaseUsingItem();
} else {
if (!this.useItem.isEmpty() && this.isUsingItem()) {
@@ -1755,7 +1754,7 @@
}
}
}
@@ -3237,6 +_,7 @@
@@ -3237,6 +4064,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
ItemStack itemInHand = this.getItemInHand(this.getUsedItemHand());
if (!this.useItem.isEmpty() && ItemStack.isSameItem(itemInHand, this.useItem)) {
this.useItem = itemInHand;
@@ -1763,7 +1762,7 @@
this.useItem.releaseUsing(this.level(), this, this.getUseItemRemainingTicks());
if (this.useItem.useOnRelease()) {
this.updatingUsingItem();
@@ -3256,7 +_,10 @@
@@ -3256,7 +4084,10 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
this.useItem = ItemStack.EMPTY;
@@ -1775,7 +1774,7 @@
}
public boolean isBlocking() {
@@ -3280,6 +_,60 @@
@@ -3280,6 +4111,60 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
}
@@ -1836,7 +1835,7 @@
public boolean isSuppressingSlidingDownLadder() {
return this.isShiftKeyDown();
}
@@ -3298,6 +_,12 @@
@@ -3298,6 +4183,12 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
public boolean randomTeleport(double x, double y, double z, boolean broadcastTeleport) {
@@ -1849,7 +1848,7 @@
double x1 = this.getX();
double y1 = this.getY();
double z1 = this.getZ();
@@ -3320,16 +_,39 @@
@@ -3320,16 +4211,39 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
if (flag1) {
@@ -1892,7 +1891,7 @@
} else {
if (broadcastTeleport) {
level.broadcastEntityEvent(this, (byte)46);
@@ -3339,7 +_,7 @@
@@ -3339,7 +4253,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
pathfinderMob.getNavigation().stop();
}

View File

@@ -1,6 +1,14 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/world/entity/Mob.java b/net/minecraft/world/entity/Mob.java
index 5d5d2ad050e47c52eda5aa1a772a72a77bfe1858..8f5c377540f83911c8d245fb00569f08dbc6a690 100644
--- a/net/minecraft/world/entity/Mob.java
+++ b/net/minecraft/world/entity/Mob.java
@@ -83,6 +_,14 @@
@@ -83,6 +83,14 @@ import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
import net.minecraft.world.phys.AABB;
import net.minecraft.world.ticks.ContainerSingleItem;
@@ -15,7 +23,7 @@
public abstract class Mob extends LivingEntity implements EquipmentUser, Leashable, Targeting {
private static final EntityDataAccessor<Byte> DATA_MOB_FLAGS_ID = SynchedEntityData.defineId(Mob.class, EntityDataSerializers.BYTE);
private static final int MOB_FLAG_NO_AI = 1;
@@ -112,6 +_,7 @@
@@ -112,6 +120,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
private final BodyRotationControl bodyRotationControl;
protected PathNavigation navigation;
public GoalSelector goalSelector;
@@ -23,7 +31,7 @@
public GoalSelector targetSelector;
@Nullable
private LivingEntity target;
@@ -126,6 +_,7 @@
@@ -126,6 +135,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
private Leashable.LeashData leashData;
private BlockPos restrictCenter = BlockPos.ZERO;
private float restrictRadius = -1.0F;
@@ -31,7 +39,7 @@
protected Mob(EntityType<? extends Mob> entityType, Level level) {
super(entityType, level);
@@ -142,6 +_,12 @@
@@ -142,6 +152,12 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
}
}
@@ -44,7 +52,7 @@
protected void registerGoals() {
}
@@ -222,7 +_,39 @@
@@ -222,7 +238,39 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
}
public void setTarget(@Nullable LivingEntity target) {
@@ -84,7 +92,7 @@
}
@Override
@@ -358,13 +_,22 @@
@@ -358,13 +406,22 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
if (this.isNoAi()) {
compound.putBoolean("NoAI", this.isNoAi());
}
@@ -109,7 +117,7 @@
RegistryOps<Tag> registryOps = this.registryAccess().createSerializationContext(NbtOps.INSTANCE);
this.dropChances = compound.read("drop_chances", DropChances.CODEC, registryOps).orElse(DropChances.DEFAULT);
this.readLeashData(compound);
@@ -372,6 +_,7 @@
@@ -372,6 +429,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
this.lootTable = compound.read("DeathLootTable", LootTable.KEY_CODEC);
this.lootTableSeed = compound.getLongOr("DeathLootTableSeed", 0L);
this.setNoAi(compound.getBooleanOr("NoAI", false));
@@ -117,7 +125,7 @@
}
@Override
@@ -433,6 +_,11 @@
@@ -433,6 +491,11 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
&& !itemEntity.getItem().isEmpty()
&& !itemEntity.hasPickUpDelay()
&& this.wantsToPickUp(serverLevel, itemEntity.getItem())) {
@@ -129,7 +137,7 @@
this.pickUpItem(serverLevel, itemEntity);
}
}
@@ -447,18 +_,24 @@
@@ -447,18 +510,24 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
protected void pickUpItem(ServerLevel level, ItemEntity entity) {
ItemStack item = entity.getItem();
@@ -156,7 +164,7 @@
EquipmentSlot equipmentSlotForItem = this.getEquipmentSlotForItem(stack);
if (!this.isEquippableInSlot(stack, equipmentSlotForItem)) {
return ItemStack.EMPTY;
@@ -471,10 +_,18 @@
@@ -471,10 +540,18 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
canReplaceCurrentItem = itemBySlot.isEmpty();
}
@@ -176,7 +184,7 @@
}
ItemStack itemStack = equipmentSlotForItem.limit(stack);
@@ -591,22 +_,29 @@
@@ -591,22 +668,29 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
@Override
public void checkDespawn() {
if (this.level().getDifficulty() == Difficulty.PEACEFUL && this.shouldDespawnInPeaceful()) {
@@ -192,6 +200,12 @@
- if (d > i && this.removeWhenFarAway(d)) {
- this.discard();
- }
-
- int noDespawnDistance = this.getType().getCategory().getNoDespawnDistance();
- int i1 = noDespawnDistance * noDespawnDistance;
- if (this.noActionTime > 600 && this.random.nextInt(800) == 0 && d > i1 && this.removeWhenFarAway(d)) {
- this.discard();
- } else if (d < i1) {
+ // Paper start - Configurable despawn distances
+ final io.papermc.paper.configuration.WorldConfiguration.Entities.Spawning.DespawnRangePair despawnRangePair = this.level().paperConfig().entities.spawning.despawnRanges.get(this.getType().getCategory());
+ final io.papermc.paper.configuration.type.DespawnRange.Shape shape = this.level().paperConfig().entities.spawning.despawnRangeShape;
@@ -204,12 +218,7 @@
+ if (despawnRangePair.hard().shouldDespawn(shape, dxSqr, dySqr, dzSqr, dy) && this.removeWhenFarAway(distanceSquared)) {
+ this.discard(EntityRemoveEvent.Cause.DESPAWN); // CraftBukkit - add Bukkit remove cause
+ }
- int noDespawnDistance = this.getType().getCategory().getNoDespawnDistance();
- int i1 = noDespawnDistance * noDespawnDistance;
- if (this.noActionTime > 600 && this.random.nextInt(800) == 0 && d > i1 && this.removeWhenFarAway(d)) {
- this.discard();
- } else if (d < i1) {
+
+ if (despawnRangePair.soft().shouldDespawn(shape, dxSqr, dySqr, dzSqr, dy)) {
+ if (this.noActionTime > 600 && this.random.nextInt(800) == 0 && this.removeWhenFarAway(distanceSquared)) {
+ this.discard(EntityRemoveEvent.Cause.DESPAWN); // CraftBukkit - add Bukkit remove cause
@@ -219,7 +228,7 @@
this.noActionTime = 0;
}
}
@@ -618,6 +_,15 @@
@@ -618,6 +702,15 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
@Override
protected final void serverAiStep() {
this.noActionTime++;
@@ -235,7 +244,7 @@
ProfilerFiller profilerFiller = Profiler.get();
profilerFiller.push("sensing");
this.sensing.tick();
@@ -793,14 +_,69 @@
@@ -793,14 +886,69 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
public boolean stillValid(Player player) {
return player.getVehicle() == Mob.this || player.canInteractWithEntity(Mob.this, 4.0);
}
@@ -305,7 +314,7 @@
ItemStack itemBySlot = this.getItemBySlot(equipmentSlot);
float f = this.dropChances.byEquipment(equipmentSlot);
if (f != 0.0F) {
@@ -820,7 +_,13 @@
@@ -820,7 +968,13 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
}
this.spawnAtLocation(level, itemBySlot);
@@ -319,7 +328,7 @@
}
}
}
@@ -844,7 +_,9 @@
@@ -844,7 +998,9 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
set.add(equipmentSlot);
} else if (this.dropChances.isPreserved(equipmentSlot)) {
this.setItemSlot(equipmentSlot, ItemStack.EMPTY);
@@ -329,7 +338,7 @@
}
}
}
@@ -1122,6 +_,21 @@
@@ -1122,6 +1278,21 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
public <T extends Mob> T convertTo(
EntityType<T> entityType, ConversionParams conversionParams, EntitySpawnReason spawnReason, ConversionParams.AfterConversion<T> afterConversion
) {
@@ -351,7 +360,7 @@
if (this.isRemoved()) {
return null;
} else {
@@ -1130,13 +_,23 @@
@@ -1130,13 +1301,23 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
return null;
} else {
conversionParams.type().convert(this, mob, conversionParams);
@@ -378,7 +387,7 @@
}
return mob;
@@ -1146,7 +_,18 @@
@@ -1146,7 +1327,18 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
@Nullable
public <T extends Mob> T convertTo(EntityType<T> entityType, ConversionParams coversionParams, ConversionParams.AfterConversion<T> afterConversion) {
@@ -398,7 +407,7 @@
}
@Nullable
@@ -1182,7 +_,17 @@
@@ -1182,7 +1374,17 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
public boolean startRiding(Entity entity, boolean force) {
boolean flag = super.startRiding(entity, force);
if (flag && this.isLeashed()) {
@@ -417,7 +426,7 @@
}
return flag;
@@ -1270,7 +_,7 @@
@@ -1270,7 +1472,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
float knockback = this.getKnockback(source, damageSource);
if (knockback > 0.0F && source instanceof LivingEntity livingEntity) {
livingEntity.knockback(

View File

@@ -1,6 +1,14 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/world/entity/TamableAnimal.java b/net/minecraft/world/entity/TamableAnimal.java
index 925db6260a57d4a54294ef2d8d9a3c903ee04518..1cdebee93d6c7e08c1923beed426d17310208be8 100644
--- a/net/minecraft/world/entity/TamableAnimal.java
+++ b/net/minecraft/world/entity/TamableAnimal.java
@@ -77,7 +_,7 @@
@@ -77,7 +77,7 @@ public abstract class TamableAnimal extends Animal implements OwnableEntity {
}
this.orderedToSit = compound.getBooleanOr("Sitting", false);
@@ -9,7 +17,7 @@
}
@Override
@@ -88,8 +_,16 @@
@@ -88,8 +88,16 @@ public abstract class TamableAnimal extends Animal implements OwnableEntity {
@Override
public boolean handleLeashAtDistance(Entity leashHolder, float distance) {
if (this.isInSittingPose()) {
@@ -28,7 +36,7 @@
}
return false;
@@ -148,6 +_,13 @@
@@ -148,6 +156,13 @@ public abstract class TamableAnimal extends Animal implements OwnableEntity {
}
public void setInSittingPose(boolean sitting) {
@@ -42,7 +50,7 @@
byte b = this.entityData.get(DATA_FLAGS_ID);
if (sitting) {
this.entityData.set(DATA_FLAGS_ID, (byte)(b | 1));
@@ -230,7 +_,12 @@
@@ -230,7 +245,12 @@ public abstract class TamableAnimal extends Animal implements OwnableEntity {
if (this.level() instanceof ServerLevel serverLevel
&& serverLevel.getGameRules().getBoolean(GameRules.RULE_SHOWDEATHMESSAGES)
&& this.getOwner() instanceof ServerPlayer serverPlayer) {
@@ -56,7 +64,7 @@
}
super.die(cause);
@@ -273,7 +_,14 @@
@@ -273,7 +293,14 @@ public abstract class TamableAnimal extends Animal implements OwnableEntity {
if (!this.canTeleportTo(new BlockPos(x, y, z))) {
return false;
} else {

View File

@@ -1,6 +1,14 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/world/entity/ai/behavior/BabyFollowAdult.java b/net/minecraft/world/entity/ai/behavior/BabyFollowAdult.java
index 39893361d4af95e74f89a5a99352cababc073856..a9be3acbf4ea52d2988347abfa6f4f8c02b1da26 100644
--- a/net/minecraft/world/entity/ai/behavior/BabyFollowAdult.java
+++ b/net/minecraft/world/entity/ai/behavior/BabyFollowAdult.java
@@ -24,8 +_,19 @@
@@ -24,8 +24,19 @@ public class BabyFollowAdult {
if (!mob.isBaby()) {
return false;
} else {

View File

@@ -1,6 +1,14 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/world/entity/animal/Animal.java b/net/minecraft/world/entity/animal/Animal.java
index 9e699961d7937e4f52b22f54af9809445692c32e..b851f94d63a049292a3657009d68bc1641222104 100644
--- a/net/minecraft/world/entity/animal/Animal.java
+++ b/net/minecraft/world/entity/animal/Animal.java
@@ -41,6 +_,7 @@
@@ -41,6 +41,7 @@ public abstract class Animal extends AgeableMob {
public int inLove = 0;
@Nullable
public UUID loveCause;
@@ -8,7 +16,7 @@
protected Animal(EntityType<? extends Animal> entityType, Level level) {
super(entityType, level);
@@ -80,9 +_,13 @@
@@ -80,9 +81,13 @@ public abstract class Animal extends AgeableMob {
}
@Override
@@ -24,7 +32,7 @@
}
@Override
@@ -138,8 +_,9 @@
@@ -138,8 +143,9 @@ public abstract class Animal extends AgeableMob {
if (this.isFood(itemInHand)) {
int age = this.getAge();
if (!this.level().isClientSide && age == 0 && this.canFallInLove()) {
@@ -35,7 +43,7 @@
this.playEatingSound();
return InteractionResult.SUCCESS_SERVER;
}
@@ -176,8 +_,23 @@
@@ -176,8 +182,23 @@ public abstract class Animal extends AgeableMob {
return this.inLove <= 0;
}
@@ -60,7 +68,7 @@
if (player != null) {
this.loveCause = player.getUUID();
}
@@ -220,23 +_,45 @@
@@ -220,23 +241,45 @@ public abstract class Animal extends AgeableMob {
if (breedOffspring != null) {
breedOffspring.setBaby(true);
breedOffspring.snapTo(this.getX(), this.getY(), this.getZ(), 0.0F, 0.0F);

View File

@@ -1,6 +1,14 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/world/entity/animal/Bee.java b/net/minecraft/world/entity/animal/Bee.java
index 6cfee8b732647c4d220641854ce23ff99f65ac1b..edca2fa21e600fa1e7ef91af673adaae7d4c86c4 100644
--- a/net/minecraft/world/entity/animal/Bee.java
+++ b/net/minecraft/world/entity/animal/Bee.java
@@ -145,10 +_,26 @@
@@ -145,10 +145,26 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
Bee.BeeGoToHiveGoal goToHiveGoal;
private Bee.BeeGoToKnownFlowerGoal goToKnownFlowerGoal;
private int underWaterTicks;
@@ -28,7 +36,7 @@
this.lookControl = new Bee.BeeLookControl(this);
this.setPathfindingMalus(PathType.DANGER_FIRE, -1.0F);
this.setPathfindingMalus(PathType.WATER, -1.0F);
@@ -195,9 +_,18 @@
@@ -195,9 +211,18 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
@Override
public void addAdditionalSaveData(CompoundTag compound) {
@@ -47,7 +55,7 @@
compound.putBoolean("HasNectar", this.hasNectar());
compound.putBoolean("HasStung", this.hasStung());
compound.putInt("TicksSincePollination", this.ticksWithoutNectarSinceExitingHive);
@@ -235,7 +_,7 @@
@@ -235,7 +260,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
}
if (i > 0) {
@@ -56,7 +64,7 @@
}
}
@@ -490,7 +_,11 @@
@@ -490,7 +515,11 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
if (this.hivePos == null) {
return null;
} else {
@@ -69,7 +77,7 @@
}
}
@@ -523,6 +_,7 @@
@@ -523,6 +552,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
}
public void setRolling(boolean isRolling) {
@@ -77,7 +85,7 @@
this.setFlag(2, isRolling);
}
@@ -579,7 +_,7 @@
@@ -579,7 +609,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
if (beeInteractionEffect != null) {
this.usePlayerItem(player, hand, itemInHand);
if (!this.level().isClientSide) {
@@ -86,7 +94,7 @@
}
return InteractionResult.SUCCESS;
@@ -648,8 +_,9 @@
@@ -648,8 +678,9 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
if (this.isInvulnerableTo(level, damageSource)) {
return false;
} else {
@@ -97,7 +105,7 @@
}
}
@@ -770,7 +_,7 @@
@@ -770,7 +801,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
@VisibleForDebug
public class BeeGoToHiveGoal extends Bee.BaseBeeGoal {
public static final int MAX_TRAVELLING_TICKS = 2400;
@@ -106,7 +114,7 @@
private static final int MAX_BLACKLISTED_TARGETS = 3;
final List<BlockPos> blacklistedTargets = Lists.newArrayList();
@Nullable
@@ -886,7 +_,7 @@
@@ -886,7 +917,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
public class BeeGoToKnownFlowerGoal extends Bee.BaseBeeGoal {
private static final int MAX_TRAVELLING_TICKS = 2400;
@@ -115,7 +123,7 @@
BeeGoToKnownFlowerGoal() {
this.setFlags(EnumSet.of(Goal.Flag.MOVE));
@@ -983,7 +_,7 @@
@@ -983,7 +1014,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
}
}
@@ -124,7 +132,7 @@
Bee.this.level().levelEvent(2011, blockPos, 15);
Bee.this.level().setBlockAndUpdate(blockPos, blockState1);
Bee.this.incrementNumCropsGrownSincePollination();
@@ -1007,7 +_,7 @@
@@ -1007,7 +1038,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
@Override
protected void alertOther(Mob mob, LivingEntity target) {
if (mob instanceof Bee && this.mob.hasLineOfSight(target)) {
@@ -133,7 +141,7 @@
}
}
}
@@ -1165,7 +_,7 @@
@@ -1165,7 +1196,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
Bee.this.dropFlower();
this.pollinating = false;
Bee.this.remainingCooldownBeforeLocatingNewFlower = 200;

View File

@@ -1,6 +1,14 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/world/entity/animal/Fox.java b/net/minecraft/world/entity/animal/Fox.java
index 6174f2ca3d289c11ab2d6103632fc77c36c2d005..5c7572b75afcfa9965fcda5965f6ae2e59babb46 100644
--- a/net/minecraft/world/entity/animal/Fox.java
+++ b/net/minecraft/world/entity/animal/Fox.java
@@ -429,7 +_,7 @@
@@ -429,7 +429,7 @@ public class Fox extends Animal {
compound.read("Trusted", TRUSTED_LIST_CODEC).orElse(List.of()).forEach(this::addTrustedEntity);
this.setSleeping(compound.getBooleanOr("Sleeping", false));
this.setVariant(compound.read("Type", Fox.Variant.CODEC).orElse(Fox.Variant.DEFAULT));
@@ -9,7 +17,7 @@
this.setIsCrouching(compound.getBooleanOr("Crouching", false));
if (this.level() instanceof ServerLevel) {
this.setTargetGoals();
@@ -446,6 +_,12 @@
@@ -446,6 +446,12 @@ public class Fox extends Animal {
}
public void setSitting(boolean sitting) {
@@ -22,7 +30,7 @@
this.setFlag(1, sitting);
}
@@ -505,19 +_,20 @@
@@ -505,19 +511,20 @@ public class Fox extends Animal {
itemEntity.setPickUpDelay(40);
itemEntity.setThrower(this);
this.playSound(SoundEvents.FOX_SPIT, 1.0F, 1.0F);
@@ -46,7 +54,7 @@
int count = item.getCount();
if (count > 1) {
this.dropItemStack(item.split(count - 1));
@@ -528,7 +_,7 @@
@@ -528,7 +535,7 @@ public class Fox extends Animal {
this.setItemSlot(EquipmentSlot.MAINHAND, item.split(1));
this.setGuaranteedDrop(EquipmentSlot.MAINHAND);
this.take(entity, item.getCount());
@@ -55,7 +63,7 @@
this.ticksSinceEaten = 0;
}
}
@@ -623,12 +_,12 @@
@@ -623,12 +630,12 @@ public class Fox extends Animal {
}
@Override
@@ -70,12 +78,10 @@
}
void wakeUp() {
@@ -692,15 +_,33 @@
@@ -692,15 +699,33 @@ public class Fox extends Animal {
return this.getTrustedEntities().anyMatch(entityReference -> entityReference.matches(entity));
}
- @Override
- protected void dropAllDeathLoot(ServerLevel level, DamageSource damageSource) {
+ // Paper start - handle the bitten item separately like vanilla
+ @Override
+ protected boolean shouldSkipLoot(EquipmentSlot slot) {
@@ -83,7 +89,8 @@
+ }
+ // Paper end
+
+ @Override
@Override
- protected void dropAllDeathLoot(ServerLevel level, DamageSource damageSource) {
+ // Paper start - Cancellable death event
+ protected org.bukkit.event.entity.EntityDeathEvent dropAllDeathLoot(ServerLevel level, DamageSource damageSource) {
ItemStack itemBySlot = this.getItemBySlot(EquipmentSlot.MAINHAND);
@@ -108,7 +115,7 @@
}
public static boolean isPathClear(Fox fox, LivingEntity livingEntity) {
@@ -876,6 +_,19 @@
@@ -876,6 +901,19 @@ public class Fox extends Animal {
fox.addTrustedEntity(loveCause1);
}
@@ -128,7 +135,7 @@
if (serverPlayer != null) {
serverPlayer.awardStat(Stats.ANIMALS_BRED);
CriteriaTriggers.BRED_ANIMALS.trigger(serverPlayer, this.animal, this.partner, fox);
@@ -885,14 +_,12 @@
@@ -885,14 +923,12 @@ public class Fox extends Animal {
this.partner.setAge(6000);
this.animal.resetLove();
this.partner.resetLove();
@@ -146,7 +153,7 @@
);
}
}
@@ -956,6 +_,7 @@
@@ -956,6 +992,7 @@ public class Fox extends Animal {
private void pickSweetBerries(BlockState state) {
int ageValue = state.getValue(SweetBerryBushBlock.AGE);
state.setValue(SweetBerryBushBlock.AGE, 1);

View File

@@ -1,6 +1,14 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/world/entity/animal/ShoulderRidingEntity.java b/net/minecraft/world/entity/animal/ShoulderRidingEntity.java
index d63ff7886984bbaa7107d76bf5714017ff3ab2ab..1489d5704cc1b9d5670ad728e87b6a660571a52a 100644
--- a/net/minecraft/world/entity/animal/ShoulderRidingEntity.java
+++ b/net/minecraft/world/entity/animal/ShoulderRidingEntity.java
@@ -19,7 +_,7 @@
@@ -19,7 +19,7 @@ public abstract class ShoulderRidingEntity extends TamableAnimal {
compoundTag.putString("id", this.getEncodeId());
this.saveWithoutId(compoundTag);
if (player.setEntityOnShoulder(compoundTag)) {

View File

@@ -1,6 +1,14 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/world/entity/animal/allay/Allay.java b/net/minecraft/world/entity/animal/allay/Allay.java
index 2d2a9fcadfc3f1c3817dcb071be346810d0dd982..eaa1745d34323cd684782a7fb2e153851a736471 100644
--- a/net/minecraft/world/entity/animal/allay/Allay.java
+++ b/net/minecraft/world/entity/animal/allay/Allay.java
@@ -116,6 +_,7 @@
@@ -116,6 +116,7 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS
private float dancingAnimationTicks;
private float spinningAnimationTicks;
private float spinningAnimationTicks0;
@@ -8,7 +16,7 @@
public Allay(EntityType<? extends Allay> entityType, Level level) {
super(entityType, level);
@@ -129,6 +_,12 @@
@@ -129,6 +130,12 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS
);
}
@@ -21,7 +29,7 @@
@Override
protected Brain.Provider<Allay> brainProvider() {
return Brain.provider(MEMORY_TYPES, SENSOR_TYPES);
@@ -248,7 +_,7 @@
@@ -248,7 +255,7 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS
public void aiStep() {
super.aiStep();
if (!this.level().isClientSide && this.isAlive() && this.tickCount % 10 == 0) {
@@ -30,7 +38,7 @@
}
if (this.isDancing() && this.shouldStopDancing() && this.tickCount % 20 == 0) {
@@ -316,7 +_,12 @@
@@ -316,7 +323,12 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS
ItemStack itemInHand = player.getItemInHand(hand);
ItemStack itemInHand1 = this.getItemInHand(InteractionHand.MAIN_HAND);
if (this.isDancing() && itemInHand.is(ItemTags.DUPLICATES_ALLAYS) && this.canDuplicate()) {
@@ -44,7 +52,7 @@
this.level().broadcastEntityEvent(this, (byte)18);
this.level().playSound(player, this, SoundEvents.AMETHYST_BLOCK_CHIME, SoundSource.NEUTRAL, 2.0F, 1.0F);
this.removeInteractionItem(player, itemInHand);
@@ -421,6 +_,7 @@
@@ -421,6 +433,7 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS
}
private boolean shouldStopDancing() {
@@ -52,7 +60,7 @@
return this.jukeboxPos == null
|| !this.jukeboxPos.closerToCenterThan(this.position(), GameEvent.JUKEBOX_PLAY.value().notificationRadius())
|| !this.level().getBlockState(this.jukeboxPos).is(Blocks.JUKEBOX);
@@ -475,7 +_,7 @@
@@ -475,7 +488,7 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS
this.readInventoryFromTag(compound, this.registryAccess());
RegistryOps<Tag> registryOps = this.registryAccess().createSerializationContext(NbtOps.INSTANCE);
this.vibrationData = compound.read("listener", VibrationSystem.Data.CODEC, registryOps).orElseGet(VibrationSystem.Data::new);
@@ -61,7 +69,7 @@
}
@Override
@@ -494,15 +_,17 @@
@@ -494,15 +507,17 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS
this.entityData.set(DATA_CAN_DUPLICATE, duplicationCooldown == 0L);
}

View File

@@ -1,6 +1,14 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/world/entity/animal/frog/Tadpole.java b/net/minecraft/world/entity/animal/frog/Tadpole.java
index 20bd64ee79a22af97e3ea1331fcabb3d2a08f707..ebdfd3fb6c0de48982d392bb2aa415f3676c6056 100644
--- a/net/minecraft/world/entity/animal/frog/Tadpole.java
+++ b/net/minecraft/world/entity/animal/frog/Tadpole.java
@@ -63,6 +_,7 @@
@@ -63,6 +63,7 @@ public class Tadpole extends AbstractFish {
MemoryModuleType.BREED_TARGET,
MemoryModuleType.IS_PANICKING
);
@@ -8,7 +16,7 @@
public Tadpole(EntityType<? extends AbstractFish> entityType, Level level) {
super(entityType, level);
@@ -114,7 +_,7 @@
@@ -114,7 +115,7 @@ public class Tadpole extends AbstractFish {
@Override
public void aiStep() {
super.aiStep();
@@ -17,7 +25,7 @@
this.setAge(this.age + 1);
}
}
@@ -123,12 +_,14 @@
@@ -123,12 +124,14 @@ public class Tadpole extends AbstractFish {
public void addAdditionalSaveData(CompoundTag compound) {
super.addAdditionalSaveData(compound);
compound.putInt("Age", this.age);
@@ -32,7 +40,7 @@
}
@Nullable
@@ -178,13 +_,19 @@
@@ -178,13 +181,19 @@ public class Tadpole extends AbstractFish {
@Override
public void saveToBucketTag(ItemStack stack) {
Bucketable.saveDefaultDataToBucketTag(this, stack);
@@ -53,7 +61,7 @@
}
@Override
@@ -216,6 +_,7 @@
@@ -216,6 +225,7 @@ public class Tadpole extends AbstractFish {
}
private void ageUp(int offset) {
@@ -61,7 +69,7 @@
this.setAge(this.age + offset * 20);
}
@@ -228,12 +_,17 @@
@@ -228,12 +238,17 @@ public class Tadpole extends AbstractFish {
private void ageUp() {
if (this.level() instanceof ServerLevel serverLevel) {

View File

@@ -1,6 +1,14 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/world/entity/animal/horse/AbstractHorse.java b/net/minecraft/world/entity/animal/horse/AbstractHorse.java
index 6688b21327cea13f1fc756a224e22a7fe7a07b71..7c473eea481f5e055cc70512027726f41f0c6f67 100644
--- a/net/minecraft/world/entity/animal/horse/AbstractHorse.java
+++ b/net/minecraft/world/entity/animal/horse/AbstractHorse.java
@@ -122,6 +_,7 @@
@@ -122,6 +122,7 @@ public abstract class AbstractHorse extends Animal implements HasCustomInventory
protected int gallopSoundCounter;
@Nullable
public EntityReference<LivingEntity> owner;
@@ -8,7 +16,7 @@
protected AbstractHorse(EntityType<? extends AbstractHorse> entityType, Level level) {
super(entityType, level);
@@ -250,7 +_,7 @@
@@ -250,7 +251,7 @@ public abstract class AbstractHorse extends Animal implements HasCustomInventory
}
@Override
@@ -17,7 +25,7 @@
return !this.isVehicle();
}
@@ -301,7 +_,7 @@
@@ -301,7 +302,7 @@ public abstract class AbstractHorse extends Animal implements HasCustomInventory
public void createInventory() {
SimpleContainer simpleContainer = this.inventory;
@@ -26,7 +34,7 @@
if (simpleContainer != null) {
int min = Math.min(simpleContainer.getContainerSize(), this.inventory.getContainerSize());
@@ -395,7 +_,7 @@
@@ -395,7 +396,7 @@ public abstract class AbstractHorse extends Animal implements HasCustomInventory
}
public int getMaxTemper() {
@@ -35,7 +43,7 @@
}
@Override
@@ -450,7 +_,7 @@
@@ -450,7 +451,7 @@ public abstract class AbstractHorse extends Animal implements HasCustomInventory
i1 = 5;
if (!this.level().isClientSide && this.isTamed() && this.getAge() == 0 && !this.isInLove()) {
flag = true;
@@ -44,7 +52,7 @@
}
} else if (stack.is(Items.GOLDEN_APPLE) || stack.is(Items.ENCHANTED_GOLDEN_APPLE)) {
f = 10.0F;
@@ -458,12 +_,12 @@
@@ -458,12 +459,12 @@ public abstract class AbstractHorse extends Animal implements HasCustomInventory
i1 = 10;
if (!this.level().isClientSide && this.isTamed() && this.getAge() == 0 && !this.isInLove()) {
flag = true;
@@ -59,7 +67,7 @@
flag = true;
}
@@ -534,7 +_,7 @@
@@ -534,7 +535,7 @@ public abstract class AbstractHorse extends Animal implements HasCustomInventory
super.aiStep();
if (this.level() instanceof ServerLevel serverLevel && this.isAlive()) {
if (this.random.nextInt(900) == 0 && this.deathTime == 0) {
@@ -68,7 +76,7 @@
}
if (this.canEatGrass()) {
@@ -637,6 +_,16 @@
@@ -637,6 +638,16 @@ public abstract class AbstractHorse extends Animal implements HasCustomInventory
}
}
@@ -85,7 +93,7 @@
@Override
public InteractionResult mobInteract(Player player, InteractionHand hand) {
if (this.isVehicle() || this.isBaby()) {
@@ -674,6 +_,12 @@
@@ -674,6 +685,12 @@ public abstract class AbstractHorse extends Animal implements HasCustomInventory
this.setFlag(16, eating);
}
@@ -98,7 +106,7 @@
public void setStanding(boolean standing) {
if (standing) {
this.setEating(false);
@@ -785,6 +_,7 @@
@@ -785,6 +802,7 @@ public abstract class AbstractHorse extends Animal implements HasCustomInventory
if (this.owner != null) {
this.owner.store(compound, "Owner");
}
@@ -106,7 +114,7 @@
}
@Override
@@ -795,6 +_,7 @@
@@ -795,6 +813,7 @@ public abstract class AbstractHorse extends Animal implements HasCustomInventory
this.setTemper(compound.getIntOr("Temper", 0));
this.setTamed(compound.getBooleanOr("Tame", false));
this.owner = EntityReference.readWithOldOwnerConversion(compound, "Owner", this.level());
@@ -114,7 +122,7 @@
}
@Override
@@ -883,6 +_,17 @@
@@ -883,6 +902,17 @@ public abstract class AbstractHorse extends Animal implements HasCustomInventory
@Override
public void handleStartJump(int jumpPower) {

View File

@@ -1,6 +1,14 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/world/entity/animal/wolf/Wolf.java b/net/minecraft/world/entity/animal/wolf/Wolf.java
index 6b00988dafe9e2ac32e543623a4a1942a0c78a76..d926ecd041ca2a421057bc22efe66a8b811ee649 100644
--- a/net/minecraft/world/entity/animal/wolf/Wolf.java
+++ b/net/minecraft/world/entity/animal/wolf/Wolf.java
@@ -400,16 +_,18 @@
@@ -400,16 +400,18 @@ public class Wolf extends TamableAnimal implements NeutralMob {
if (this.isInvulnerableTo(level, damageSource)) {
return false;
} else {
@@ -22,7 +30,7 @@
ItemStack bodyArmorItem = this.getBodyArmorItem();
int damageValue = bodyArmorItem.getDamageValue();
int maxDamage = bodyArmorItem.getMaxDamage();
@@ -429,6 +_,7 @@
@@ -429,6 +431,7 @@ public class Wolf extends TamableAnimal implements NeutralMob {
);
}
}
@@ -30,7 +38,7 @@
}
private boolean canArmorAbsorb(DamageSource damageSource) {
@@ -439,7 +_,7 @@
@@ -439,7 +442,7 @@ public class Wolf extends TamableAnimal implements NeutralMob {
protected void applyTamingSideEffects() {
if (this.isTame()) {
this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(40.0);
@@ -39,7 +47,7 @@
} else {
this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(8.0);
}
@@ -459,7 +_,7 @@
@@ -459,7 +462,7 @@ public class Wolf extends TamableAnimal implements NeutralMob {
this.usePlayerItem(player, hand, itemInHand);
FoodProperties foodProperties = itemInHand.get(DataComponents.FOOD);
float f = foodProperties != null ? foodProperties.nutrition() : 1.0F;
@@ -48,7 +56,7 @@
return InteractionResult.SUCCESS;
}
@@ -492,7 +_,7 @@
@@ -492,7 +495,7 @@ public class Wolf extends TamableAnimal implements NeutralMob {
this.setOrderedToSit(!this.isOrderedToSit());
this.jumping = false;
this.navigation.stop();
@@ -57,7 +65,7 @@
return InteractionResult.SUCCESS.withoutItem();
}
@@ -504,7 +_,9 @@
@@ -504,7 +507,9 @@ public class Wolf extends TamableAnimal implements NeutralMob {
ItemStack bodyArmorItem = this.getBodyArmorItem();
this.setBodyArmorItem(ItemStack.EMPTY);
if (this.level() instanceof ServerLevel serverLevel) {
@@ -67,7 +75,7 @@
}
return InteractionResult.SUCCESS;
@@ -512,6 +_,13 @@
@@ -512,6 +517,13 @@ public class Wolf extends TamableAnimal implements NeutralMob {
DyeColor dyeColor = dyeItem.getDyeColor();
if (dyeColor != this.getCollarColor()) {
@@ -81,7 +89,7 @@
this.setCollarColor(dyeColor);
itemInHand.consume(1, player);
return InteractionResult.SUCCESS;
@@ -526,7 +_,7 @@
@@ -526,7 +538,7 @@ public class Wolf extends TamableAnimal implements NeutralMob {
}
private void tryToTame(Player player) {

View File

@@ -1,6 +1,14 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/world/entity/boss/enderdragon/EndCrystal.java b/net/minecraft/world/entity/boss/enderdragon/EndCrystal.java
index 81a56d7a8939dd3edb03de23a214e6f26275d7e1..d813427cf20117014bc42af0eb7cdee037fbcd9c 100644
--- a/net/minecraft/world/entity/boss/enderdragon/EndCrystal.java
+++ b/net/minecraft/world/entity/boss/enderdragon/EndCrystal.java
@@ -25,6 +_,7 @@
@@ -25,6 +25,7 @@ public class EndCrystal extends Entity {
private static final EntityDataAccessor<Boolean> DATA_SHOW_BOTTOM = SynchedEntityData.defineId(EndCrystal.class, EntityDataSerializers.BOOLEAN);
private static final boolean DEFAULT_SHOW_BOTTOM = true;
public int time;
@@ -8,17 +16,15 @@
public EndCrystal(EntityType<? extends EndCrystal> entityType, Level level) {
super(entityType, level);
@@ -56,21 +_,37 @@
@@ -56,21 +57,37 @@ public class EndCrystal extends Entity {
if (this.level() instanceof ServerLevel) {
BlockPos blockPos = this.blockPosition();
if (((ServerLevel)this.level()).getDragonFight() != null && this.level().getBlockState(blockPos).isAir()) {
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(this.level(), blockPos, this).isCancelled()) { // Paper
this.level().setBlockAndUpdate(blockPos, BaseFireBlock.getState(this.level(), blockPos));
- }
- }
+ } // Paper
+ }
+ }
}
}
+
+ // Paper start - Fix invulnerable end crystals
+ if (this.level().paperConfig().unsupportedSettings.fixInvulnerableEndCrystalExploit && this.generatedByDragonFight && this.isInvulnerable()) {
@@ -48,7 +54,7 @@
}
@Override
@@ -91,10 +_,24 @@
@@ -91,10 +108,24 @@ public class EndCrystal extends Entity {
return false;
} else {
if (!this.isRemoved()) {

View File

@@ -1,6 +1,14 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java b/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
index 835a34db317d40f9fa36808c1e5d744d496415ca..0f3c88601357399d3b8efd2f0e3a531482bc1f3d 100644
--- a/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
+++ b/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
@@ -87,6 +_,10 @@
@@ -87,6 +87,10 @@ public class EnderDragon extends Mob implements Enemy {
private final Node[] nodes = new Node[24];
private final int[] nodeAdjacency = new int[24];
private final BinaryHeap openSet = new BinaryHeap();
@@ -11,7 +19,7 @@
public EnderDragon(EntityType<? extends EnderDragon> entityType, Level level) {
super(EntityType.ENDER_DRAGON, level);
@@ -102,6 +_,7 @@
@@ -102,6 +106,7 @@ public class EnderDragon extends Mob implements Enemy {
this.setHealth(this.getMaxHealth());
this.noPhysics = true;
this.phaseManager = new EnderDragonPhaseManager(this);
@@ -19,7 +27,7 @@
}
public void setDragonFight(EndDragonFight dragonFight) {
@@ -120,6 +_,19 @@
@@ -120,6 +125,19 @@ public class EnderDragon extends Mob implements Enemy {
return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 200.0);
}
@@ -39,7 +47,7 @@
@Override
public boolean isFlapping() {
float cos = Mth.cos(this.flapTime * (float) (Math.PI * 2));
@@ -211,7 +_,7 @@
@@ -211,7 +229,7 @@ public class EnderDragon extends Mob implements Enemy {
}
Vec3 flyTargetLocation = currentPhase.getFlyTargetLocation();
@@ -48,7 +56,7 @@
double d = flyTargetLocation.x - this.getX();
double d1 = flyTargetLocation.y - this.getY();
double d2 = flyTargetLocation.z - this.getZ();
@@ -366,7 +_,12 @@
@@ -366,7 +384,12 @@ public class EnderDragon extends Mob implements Enemy {
if (this.nearestCrystal.isRemoved()) {
this.nearestCrystal = null;
} else if (this.tickCount % 10 == 0 && this.getHealth() < this.getMaxHealth()) {
@@ -62,7 +70,7 @@
}
}
@@ -396,7 +_,7 @@
@@ -396,7 +419,7 @@ public class EnderDragon extends Mob implements Enemy {
double d2 = entity.getX() - d;
double d3 = entity.getZ() - d1;
double max = Math.max(d2 * d2 + d3 * d3, 0.1);
@@ -71,7 +79,7 @@
if (!this.phaseManager.getCurrentPhase().isSitting() && livingEntity.getLastHurtByMobTimestamp() < entity.tickCount - 2) {
DamageSource damageSource = this.damageSources().mobAttack(this);
entity.hurtServer(level, damageSource, 5.0F);
@@ -429,6 +_,7 @@
@@ -429,6 +452,7 @@ public class EnderDragon extends Mob implements Enemy {
int floor5 = Mth.floor(box.maxZ);
boolean flag = false;
boolean flag1 = false;
@@ -79,7 +87,7 @@
for (int i = floor; i <= floor3; i++) {
for (int i1 = floor1; i1 <= floor4; i1++) {
@@ -437,7 +_,11 @@
@@ -437,7 +461,11 @@ public class EnderDragon extends Mob implements Enemy {
BlockState blockState = level.getBlockState(blockPos);
if (!blockState.isAir() && !blockState.is(BlockTags.DRAGON_TRANSPARENT)) {
if (level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) && !blockState.is(BlockTags.DRAGON_IMMUNE)) {
@@ -92,7 +100,7 @@
} else {
flag = true;
}
@@ -446,6 +_,58 @@
@@ -446,6 +474,58 @@ public class EnderDragon extends Mob implements Enemy {
}
}
@@ -151,7 +159,7 @@
if (flag1) {
BlockPos blockPos1 = new BlockPos(
floor + this.random.nextInt(floor3 - floor + 1),
@@ -503,7 +_,15 @@
@@ -503,7 +583,15 @@ public class EnderDragon extends Mob implements Enemy {
@Override
public void kill(ServerLevel level) {
@@ -168,7 +176,7 @@
this.gameEvent(GameEvent.ENTITY_DIE);
if (this.dragonFight != null) {
this.dragonFight.updateDragon(this);
@@ -525,18 +_,41 @@
@@ -525,18 +613,41 @@ public class EnderDragon extends Mob implements Enemy {
this.level().addParticle(ParticleTypes.EXPLOSION_EMITTER, this.getX() + f, this.getY() + 2.0 + f1, this.getZ() + f2, 0.0, 0.0, 0.0);
}
@@ -213,7 +221,7 @@
}
}
@@ -549,15 +_,15 @@
@@ -549,15 +660,15 @@ public class EnderDragon extends Mob implements Enemy {
}
if (this.dragonDeathTime == 200 && this.level() instanceof ServerLevel serverLevel1) {
@@ -232,7 +240,7 @@
this.gameEvent(GameEvent.ENTITY_DIE);
}
}
@@ -739,6 +_,7 @@
@@ -739,6 +850,7 @@ public class EnderDragon extends Mob implements Enemy {
super.addAdditionalSaveData(compound);
compound.putInt("DragonPhase", this.phaseManager.getCurrentPhase().getPhase().getId());
compound.putInt("DragonDeathTime", this.dragonDeathTime);
@@ -240,7 +248,7 @@
}
@Override
@@ -746,6 +_,7 @@
@@ -746,6 +858,7 @@ public class EnderDragon extends Mob implements Enemy {
super.readAdditionalSaveData(compound);
compound.getInt("DragonPhase").ifPresent(integer -> this.phaseManager.setPhase(EnderDragonPhase.getById(integer)));
this.dragonDeathTime = compound.getIntOr("DragonDeathTime", 0);
@@ -248,7 +256,7 @@
}
@Override
@@ -786,7 +_,7 @@
@@ -786,7 +899,7 @@ public class EnderDragon extends Mob implements Enemy {
EnderDragonPhase<? extends DragonPhaseInstance> phase = currentPhase.getPhase();
Vec3 viewVector;
if (phase == EnderDragonPhase.LANDING || phase == EnderDragonPhase.TAKEOFF) {
@@ -257,7 +265,7 @@
float max = Math.max((float)Math.sqrt(heightmapPos.distToCenterSqr(this.position())) / 4.0F, 1.0F);
float f = 6.0F / max;
float xRot = this.getXRot();
@@ -874,4 +_,19 @@
@@ -874,4 +987,19 @@ public class EnderDragon extends Mob implements Enemy {
protected float sanitizeScale(float scale) {
return 1.0F;
}

View File

@@ -1,6 +1,14 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/world/entity/decoration/ArmorStand.java b/net/minecraft/world/entity/decoration/ArmorStand.java
index 30e2d529bb98748fcd2caab997fd8f6bbed49e3f..f5ce8151bb1bae9be638ced7f74899d452d517e1 100644
--- a/net/minecraft/world/entity/decoration/ArmorStand.java
+++ b/net/minecraft/world/entity/decoration/ArmorStand.java
@@ -88,9 +_,17 @@
@@ -88,9 +88,17 @@ public class ArmorStand extends LivingEntity {
public Rotations rightArmPose = DEFAULT_RIGHT_ARM_POSE;
public Rotations leftLegPose = DEFAULT_LEFT_LEG_POSE;
public Rotations rightLegPose = DEFAULT_RIGHT_LEG_POSE;
@@ -18,7 +26,7 @@
}
public ArmorStand(Level level, double x, double y, double z) {
@@ -102,6 +_,13 @@
@@ -102,6 +110,13 @@ public class ArmorStand extends LivingEntity {
return createLivingAttributes().add(Attributes.STEP_HEIGHT, 0.0);
}
@@ -32,7 +40,7 @@
@Override
public void refreshDimensions() {
double x = this.getX();
@@ -137,6 +_,14 @@
@@ -137,6 +152,14 @@ public class ArmorStand extends LivingEntity {
return slot != EquipmentSlot.BODY && slot != EquipmentSlot.SADDLE && !this.isDisabled(slot);
}
@@ -47,7 +55,7 @@
@Override
public void addAdditionalSaveData(CompoundTag compound) {
super.addAdditionalSaveData(compound);
@@ -150,6 +_,7 @@
@@ -150,6 +173,7 @@ public class ArmorStand extends LivingEntity {
}
compound.put("Pose", this.writePose());
@@ -55,7 +63,7 @@
}
@Override
@@ -163,6 +_,12 @@
@@ -163,6 +187,12 @@ public class ArmorStand extends LivingEntity {
this.setMarker(compound.getBooleanOr("Marker", false));
this.noPhysics = !this.hasPhysics();
this.readPose(compound.getCompoundOrEmpty("Pose"));
@@ -68,7 +76,7 @@
}
private void readPose(CompoundTag compound) {
@@ -204,7 +_,7 @@
@@ -204,7 +234,7 @@ public class ArmorStand extends LivingEntity {
}
@Override
@@ -77,7 +85,7 @@
return false;
}
@@ -214,6 +_,7 @@
@@ -214,6 +244,7 @@ public class ArmorStand extends LivingEntity {
@Override
protected void pushEntities() {
@@ -85,7 +93,7 @@
for (Entity entity : this.level().getEntities(this, this.getBoundingBox(), RIDABLE_MINECARTS)) {
if (this.distanceToSqr(entity) <= 0.2) {
entity.push(this);
@@ -286,7 +_,25 @@
@@ -286,7 +317,25 @@ public class ArmorStand extends LivingEntity {
return false;
} else if (itemBySlot.isEmpty() && (this.disabledSlots & 1 << slot.getFilterBit(16)) != 0) {
return false;
@@ -112,7 +120,7 @@
this.setItemSlot(slot, stack.copyWithCount(1));
return true;
} else if (stack.isEmpty() || stack.getCount() <= 1) {
@@ -299,6 +_,7 @@
@@ -299,6 +348,7 @@ public class ArmorStand extends LivingEntity {
this.setItemSlot(slot, stack.split(1));
return true;
}
@@ -120,7 +128,7 @@
}
@Override
@@ -308,15 +_,32 @@
@@ -308,15 +358,32 @@ public class ArmorStand extends LivingEntity {
} else if (!level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) && damageSource.getEntity() instanceof Mob) {
return false;
} else if (damageSource.is(DamageTypeTags.BYPASSES_INVULNERABILITY)) {
@@ -157,7 +165,7 @@
if (this.isOnFire()) {
this.causeDamage(level, damageSource, 0.15F);
} else {
@@ -325,9 +_,19 @@
@@ -325,9 +392,19 @@ public class ArmorStand extends LivingEntity {
return false;
} else if (damageSource.is(DamageTypeTags.BURNS_ARMOR_STANDS) && this.getHealth() > 0.5F) {
@@ -177,7 +185,7 @@
boolean isCanBreakArmorStand = damageSource.is(DamageTypeTags.CAN_BREAK_ARMOR_STAND);
boolean isAlwaysKillsArmorStands = damageSource.is(DamageTypeTags.ALWAYS_KILLS_ARMOR_STANDS);
if (!isCanBreakArmorStand && !isAlwaysKillsArmorStands) {
@@ -337,7 +_,7 @@
@@ -337,7 +414,7 @@ public class ArmorStand extends LivingEntity {
} else if (damageSource.isCreativePlayer()) {
this.playBrokenSound();
this.showBreakingParticles();
@@ -186,7 +194,7 @@
return true;
} else {
long gameTime = level.getGameTime();
@@ -346,9 +_,9 @@
@@ -346,9 +423,9 @@ public class ArmorStand extends LivingEntity {
this.gameEvent(GameEvent.ENTITY_DAMAGE, damageSource.getEntity());
this.lastHit = gameTime;
} else {
@@ -198,7 +206,7 @@
}
return true;
@@ -400,31 +_,42 @@
@@ -400,31 +477,42 @@ public class ArmorStand extends LivingEntity {
float health = this.getHealth();
health -= damageAmount;
if (health <= 0.5F) {
@@ -235,8 +243,6 @@
+ ItemStack itemStack = this.equipment.get(equipmentSlot); // Paper - move equipment removal past event call
if (!itemStack.isEmpty()) {
- Block.popResource(this.level(), this.blockPosition().above(), itemStack);
- }
- }
+ this.drops.add(new DefaultDrop(itemStack, stack -> Block.popResource(this.level(), this.blockPosition().above(), stack))); // CraftBukkit - add to drops // Paper - Restore vanilla drops behavior; mirror so we can destroy it later - though this call site was safe & spawn drops correctly}
+ }
+ }
@@ -245,14 +251,14 @@
+ if (!event.isCancelled()) {
+ for (EquipmentSlot equipmentSlot : EquipmentSlot.VALUES) {
+ this.equipment.set(equipmentSlot, ItemStack.EMPTY);
+ }
+ }
}
}
+ return event;
+ // Paper end - move equipment removal past event call
}
private void playBrokenSound() {
@@ -458,7 +_,28 @@
@@ -458,7 +546,28 @@ public class ArmorStand extends LivingEntity {
@Override
public void tick() {
@@ -281,7 +287,7 @@
Rotations rotations = this.entityData.get(DATA_HEAD_POSE);
if (!this.headPose.equals(rotations)) {
this.setHeadPose(rotations);
@@ -506,9 +_,32 @@
@@ -506,9 +615,32 @@ public class ArmorStand extends LivingEntity {
return this.isSmall();
}
@@ -315,7 +321,7 @@
this.gameEvent(GameEvent.ENTITY_DIE);
}
@@ -572,31 +_,37 @@
@@ -572,31 +704,37 @@ public class ArmorStand extends LivingEntity {
public void setHeadPose(Rotations headPose) {
this.headPose = headPose;
this.entityData.set(DATA_HEAD_POSE, headPose);
@@ -353,7 +359,7 @@
}
public Rotations getHeadPose() {
@@ -728,4 +_,13 @@
@@ -728,4 +866,13 @@ public class ArmorStand extends LivingEntity {
public boolean canBeSeenByAnyone() {
return !this.isInvisible() && !this.isMarker();
}

View File

@@ -1,6 +1,14 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/world/entity/decoration/LeashFenceKnotEntity.java b/net/minecraft/world/entity/decoration/LeashFenceKnotEntity.java
index b40927c73ab847264b1110cd272adc2e8da42526..258696853e9f3539cb44c86343fbec81f6a3e770 100644
--- a/net/minecraft/world/entity/decoration/LeashFenceKnotEntity.java
+++ b/net/minecraft/world/entity/decoration/LeashFenceKnotEntity.java
@@ -81,6 +_,15 @@
@@ -81,6 +81,15 @@ public class LeashFenceKnotEntity extends BlockAttachedEntity {
for (Leashable leashable : list) {
if (leashable.getLeashHolder() == player) {
@@ -16,7 +24,7 @@
leashable.setLeashedTo(this, true);
flag = true;
}
@@ -88,14 +_,39 @@
@@ -88,14 +97,39 @@ public class LeashFenceKnotEntity extends BlockAttachedEntity {
boolean flag1 = false;
if (!flag) {

View File

@@ -1,6 +1,14 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/world/entity/item/FallingBlockEntity.java b/net/minecraft/world/entity/item/FallingBlockEntity.java
index 735e8bcfdc4380f37da1fb95955a190868858f7c..31edd0d45ac6c38887e4cebffe5a7cf377b47466 100644
--- a/net/minecraft/world/entity/item/FallingBlockEntity.java
+++ b/net/minecraft/world/entity/item/FallingBlockEntity.java
@@ -69,6 +_,7 @@
@@ -69,6 +69,7 @@ public class FallingBlockEntity extends Entity {
public CompoundTag blockData;
public boolean forceTickAfterTeleportToDuplicate;
protected static final EntityDataAccessor<BlockPos> DATA_START_POS = SynchedEntityData.defineId(FallingBlockEntity.class, EntityDataSerializers.BLOCK_POS);
@@ -8,7 +16,7 @@
public FallingBlockEntity(EntityType<? extends FallingBlockEntity> entityType, Level level) {
super(entityType, level);
@@ -94,6 +_,7 @@
@@ -94,6 +95,7 @@ public class FallingBlockEntity extends Entity {
pos.getZ() + 0.5,
blockState.hasProperty(BlockStateProperties.WATERLOGGED) ? blockState.setValue(BlockStateProperties.WATERLOGGED, false) : blockState
);
@@ -16,7 +24,7 @@
level.setBlock(pos, blockState.getFluidState().createLegacyBlock(), 3);
level.addFreshEntity(fallingBlockEntity);
return fallingBlockEntity;
@@ -144,13 +_,22 @@
@@ -144,13 +146,22 @@ public class FallingBlockEntity extends Entity {
@Override
public void tick() {
if (this.blockState.isAir()) {
@@ -40,7 +48,7 @@
this.handlePortal();
if (this.level() instanceof ServerLevel serverLevel && (this.isAlive() || this.forceTickAfterTeleportToDuplicate)) {
BlockPos blockPos = this.blockPosition();
@@ -171,12 +_,12 @@
@@ -171,12 +182,12 @@ public class FallingBlockEntity extends Entity {
}
if (!this.onGround() && !flag1) {
@@ -55,7 +63,7 @@
}
} else {
BlockState blockState = this.level().getBlockState(blockPos);
@@ -194,12 +_,18 @@
@@ -194,12 +205,18 @@ public class FallingBlockEntity extends Entity {
this.blockState = this.blockState.setValue(BlockStateProperties.WATERLOGGED, true);
}
@@ -75,7 +83,7 @@
if (block instanceof Fallable) {
((Fallable)block).onLand(this.level(), blockPos, this.blockState, blockState, this);
}
@@ -220,19 +_,19 @@
@@ -220,19 +237,19 @@ public class FallingBlockEntity extends Entity {
}
}
} else if (this.dropItem && serverLevel.getGameRules().getBoolean(GameRules.RULE_DOENTITYDROPS)) {
@@ -98,7 +106,7 @@
this.callOnBrokenAfterFall(block, blockPos);
}
}
@@ -293,6 +_,7 @@
@@ -293,6 +310,7 @@ public class FallingBlockEntity extends Entity {
}
compound.putBoolean("CancelDrop", this.cancelDrop);
@@ -106,7 +114,7 @@
}
@Override
@@ -305,8 +_,9 @@
@@ -305,8 +323,9 @@ public class FallingBlockEntity extends Entity {
this.fallDamagePerDistance = compound.getFloatOr("FallHurtAmount", 0.0F);
this.fallDamageMax = compound.getIntOr("FallHurtMax", 40);
this.dropItem = compound.getBooleanOr("DropItem", true);
@@ -117,7 +125,7 @@
}
public void setHurtsEntities(float fallDamagePerDistance, int fallDamageMax) {
@@ -363,7 +_,7 @@
@@ -363,7 +382,7 @@ public class FallingBlockEntity extends Entity {
ResourceKey<Level> resourceKey1 = this.level().dimension();
boolean flag = (resourceKey1 == Level.END || resourceKey == Level.END) && resourceKey1 != resourceKey;
Entity entity = super.teleport(teleportTransition);

View File

@@ -1,6 +1,14 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/world/entity/item/ItemEntity.java b/net/minecraft/world/entity/item/ItemEntity.java
index dd6d590d5cb0e63e1bb8e135c79d2747635c61e7..ea3afc27600cde05a17197b071f14972d2c832e6 100644
--- a/net/minecraft/world/entity/item/ItemEntity.java
+++ b/net/minecraft/world/entity/item/ItemEntity.java
@@ -56,6 +_,9 @@
@@ -56,6 +56,9 @@ public class ItemEntity extends Entity implements TraceableEntity {
@Nullable
public UUID target;
public final float bobOffs;
@@ -10,7 +18,7 @@
public ItemEntity(EntityType<? extends ItemEntity> entityType, Level level) {
super(entityType, level);
@@ -64,7 +_,12 @@
@@ -64,7 +67,12 @@ public class ItemEntity extends Entity implements TraceableEntity {
}
public ItemEntity(Level level, double posX, double posY, double posZ, ItemStack itemStack) {
@@ -24,7 +32,7 @@
}
public ItemEntity(Level level, double posX, double posY, double posZ, ItemStack itemStack, double deltaX, double deltaY, double deltaZ) {
@@ -126,7 +_,7 @@
@@ -126,7 +134,7 @@ public class ItemEntity extends Entity implements TraceableEntity {
@Override
public void tick() {
if (this.getItem().isEmpty()) {
@@ -33,7 +41,7 @@
} else {
super.tick();
if (this.pickupDelay > 0 && this.pickupDelay != 32767) {
@@ -154,11 +_,15 @@
@@ -154,11 +162,15 @@ public class ItemEntity extends Entity implements TraceableEntity {
}
}
@@ -51,7 +59,7 @@
f = this.level().getBlockState(this.getBlockPosBelowThatAffectsMyMovement()).getBlock().getFriction() * 0.98F;
}
@@ -191,8 +_,14 @@
@@ -191,8 +203,14 @@ public class ItemEntity extends Entity implements TraceableEntity {
}
}
@@ -68,7 +76,7 @@
}
}
}
@@ -217,9 +_,18 @@
@@ -217,9 +235,18 @@ public class ItemEntity extends Entity implements TraceableEntity {
private void mergeWithNeighbours() {
if (this.isMergable()) {
@@ -88,7 +96,7 @@
this.tryToMerge(itemEntity);
if (this.isRemoved()) {
break;
@@ -231,7 +_,7 @@
@@ -231,7 +258,7 @@ public class ItemEntity extends Entity implements TraceableEntity {
private boolean isMergable() {
ItemStack item = this.getItem();
@@ -97,7 +105,7 @@
}
private void tryToMerge(ItemEntity itemEntity) {
@@ -264,11 +_,16 @@
@@ -264,11 +291,16 @@ public class ItemEntity extends Entity implements TraceableEntity {
}
private static void merge(ItemEntity destinationEntity, ItemStack destinationStack, ItemEntity originEntity, ItemStack originStack) {
@@ -115,7 +123,7 @@
}
}
@@ -296,12 +_,17 @@
@@ -296,12 +328,17 @@ public class ItemEntity extends Entity implements TraceableEntity {
} else if (!this.getItem().canBeHurtBy(damageSource)) {
return false;
} else {
@@ -134,7 +142,7 @@
}
return true;
@@ -324,6 +_,11 @@
@@ -324,6 +361,11 @@ public class ItemEntity extends Entity implements TraceableEntity {
RegistryOps<Tag> registryOps = this.registryAccess().createSerializationContext(NbtOps.INSTANCE);
compound.store("Item", ItemStack.CODEC, registryOps, this.getItem());
}
@@ -146,7 +154,7 @@
}
@Override
@@ -336,8 +_,19 @@
@@ -336,8 +378,19 @@ public class ItemEntity extends Entity implements TraceableEntity {
this.cachedThrower = null;
RegistryOps<Tag> registryOps = this.registryAccess().createSerializationContext(NbtOps.INSTANCE);
this.setItem(compound.read("Item", ItemStack.CODEC, registryOps).orElse(ItemStack.EMPTY));
@@ -167,7 +175,7 @@
}
}
@@ -347,10 +_,73 @@
@@ -347,10 +400,73 @@ public class ItemEntity extends Entity implements TraceableEntity {
ItemStack item = this.getItem();
Item item1 = item.getItem();
int count = item.getCount();
@@ -242,7 +250,7 @@
item.setCount(count);
}
@@ -388,6 +_,7 @@
@@ -388,6 +504,7 @@ public class ItemEntity extends Entity implements TraceableEntity {
public void setItem(ItemStack stack) {
this.getEntityData().set(DATA_ITEM, stack);
@@ -250,7 +258,7 @@
}
@Override
@@ -441,7 +_,7 @@
@@ -441,7 +558,7 @@ public class ItemEntity extends Entity implements TraceableEntity {
public void makeFakeItem() {
this.setNeverPickUp();

View File

@@ -1,6 +1,14 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/world/entity/monster/Creeper.java b/net/minecraft/world/entity/monster/Creeper.java
index 1b2783b71ccb6f632c32fc2ee898b1b14e8186dc..3f5e1e98802e5dd1cfc9075559e1102046605a04 100644
--- a/net/minecraft/world/entity/monster/Creeper.java
+++ b/net/minecraft/world/entity/monster/Creeper.java
@@ -53,6 +_,7 @@
@@ -53,6 +53,7 @@ public class Creeper extends Monster {
public int maxSwell = 30;
public int explosionRadius = 3;
private int droppedSkulls;
@@ -8,7 +16,7 @@
public Creeper(EntityType<? extends Creeper> entityType, Level level) {
super(entityType, level);
@@ -116,7 +_,7 @@
@@ -116,7 +117,7 @@ public class Creeper extends Monster {
this.maxSwell = compound.getShortOr("Fuse", (short)30);
this.explosionRadius = compound.getByteOr("ExplosionRadius", (byte)3);
if (compound.getBooleanOr("ignited", false)) {
@@ -17,7 +25,7 @@
}
}
@@ -149,10 +_,11 @@
@@ -149,10 +150,11 @@ public class Creeper extends Monster {
}
@Override
@@ -31,7 +39,7 @@
}
@Override
@@ -199,9 +_,20 @@
@@ -199,9 +201,20 @@ public class Creeper extends Monster {
@Override
public void thunderHit(ServerLevel level, LightningBolt lightning) {
super.thunderHit(level, lightning);
@@ -52,7 +60,7 @@
@Override
protected InteractionResult mobInteract(Player player, InteractionHand hand) {
ItemStack itemInHand = player.getItemInHand(hand);
@@ -210,8 +_,9 @@
@@ -210,8 +223,9 @@ public class Creeper extends Monster {
this.level()
.playSound(player, this.getX(), this.getY(), this.getZ(), soundEvent, this.getSoundSource(), 1.0F, this.random.nextFloat() * 0.4F + 0.8F);
if (!this.level().isClientSide) {
@@ -63,7 +71,7 @@
itemInHand.shrink(1);
} else {
itemInHand.hurtAndBreak(1, player, getSlotForHand(hand));
@@ -227,18 +_,29 @@
@@ -227,18 +241,29 @@ public class Creeper extends Monster {
public void explodeCreeper() {
if (this.level() instanceof ServerLevel serverLevel) {
float f = this.isPowered() ? 2.0F : 1.0F;
@@ -96,13 +104,11 @@
areaEffectCloud.setRadius(2.5F);
areaEffectCloud.setRadiusOnUse(-0.5F);
areaEffectCloud.setWaitTime(10);
@@ -250,16 +_,27 @@
@@ -250,16 +275,27 @@ public class Creeper extends Monster {
areaEffectCloud.addEffect(new MobEffectInstance(mobEffectInstance));
}
- this.level().addFreshEntity(areaEffectCloud);
- }
- }
+ this.level().addFreshEntity(areaEffectCloud, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.EXPLOSION); // CraftBukkit
+ }
+ }
@@ -114,8 +120,8 @@
+ if (event.callEvent()) {
+ this.entityData.set(DATA_IS_IGNITED, event.isIgnited());
+ }
+ }
+ }
}
}
+ // Paper end - Call CreeperIgniteEvent
public boolean isIgnited() {

View File

@@ -1,6 +1,14 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/world/entity/monster/Phantom.java b/net/minecraft/world/entity/monster/Phantom.java
index 0d11c55e826fc4b69ba63585dc28be5147d07031..483b0499f1f70b3aa8862e6cd8e512748492bee0 100644
--- a/net/minecraft/world/entity/monster/Phantom.java
+++ b/net/minecraft/world/entity/monster/Phantom.java
@@ -48,6 +_,11 @@
@@ -48,6 +48,11 @@ public class Phantom extends FlyingMob implements Enemy {
@Nullable
public BlockPos anchorPoint;
Phantom.AttackPhase attackPhase = Phantom.AttackPhase.CIRCLE;
@@ -12,7 +20,7 @@
public Phantom(EntityType<? extends Phantom> entityType, Level level) {
super(entityType, level);
@@ -142,7 +_,7 @@
@@ -142,7 +147,7 @@ public class Phantom extends FlyingMob implements Enemy {
@Override
public void aiStep() {
@@ -21,7 +29,7 @@
this.igniteForSeconds(8.0F);
}
@@ -163,6 +_,10 @@
@@ -163,6 +168,10 @@ public class Phantom extends FlyingMob implements Enemy {
super.readAdditionalSaveData(compound);
this.anchorPoint = compound.read("anchor_pos", BlockPos.CODEC).orElse(null);
this.setPhantomSize(compound.getIntOr("size", 0));
@@ -32,7 +40,7 @@
}
@Override
@@ -170,6 +_,10 @@
@@ -170,6 +179,10 @@ public class Phantom extends FlyingMob implements Enemy {
super.addAdditionalSaveData(compound);
compound.storeNullable("anchor_pos", BlockPos.CODEC, this.anchorPoint);
compound.putInt("size", this.getPhantomSize());
@@ -43,7 +51,7 @@
}
@Override
@@ -243,7 +_,8 @@
@@ -243,7 +256,8 @@ public class Phantom extends FlyingMob implements Enemy {
for (Player player : nearbyPlayers) {
if (Phantom.this.canAttack(serverLevel, player, TargetingConditions.DEFAULT)) {

View File

@@ -1,6 +1,14 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/world/entity/monster/Slime.java b/net/minecraft/world/entity/monster/Slime.java
index 8e3ffc4ffd90ee12b96d0666c3363164d93c57c2..5a81172c88f5699f1440b69b331a8ea353c1950a 100644
--- a/net/minecraft/world/entity/monster/Slime.java
+++ b/net/minecraft/world/entity/monster/Slime.java
@@ -57,6 +_,7 @@
@@ -57,6 +57,7 @@ public class Slime extends Mob implements Enemy {
public float squish;
public float oSquish;
private boolean wasOnGround = false;
@@ -8,7 +16,7 @@
public Slime(EntityType<? extends Slime> entityType, Level level) {
super(entityType, level);
@@ -111,6 +_,7 @@
@@ -111,6 +112,7 @@ public class Slime extends Mob implements Enemy {
super.addAdditionalSaveData(compound);
compound.putInt("Size", this.getSize() - 1);
compound.putBoolean("wasOnGround", this.wasOnGround);
@@ -16,7 +24,7 @@
}
@Override
@@ -118,6 +_,7 @@
@@ -118,6 +120,7 @@ public class Slime extends Mob implements Enemy {
this.setSize(compound.getIntOr("Size", 0) + 1, false);
super.readAdditionalSaveData(compound);
this.wasOnGround = compound.getBooleanOr("wasOnGround", false);
@@ -24,7 +32,7 @@
}
public boolean isTiny() {
@@ -197,7 +_,7 @@
@@ -197,7 +200,7 @@ public class Slime extends Mob implements Enemy {
}
@Override
@@ -33,7 +41,7 @@
int size = this.getSize();
if (!this.level().isClientSide && size > 1 && this.isDeadOrDying()) {
float width = this.getDimensions(this.getPose()).width();
@@ -205,18 +_,43 @@
@@ -205,18 +208,43 @@ public class Slime extends Mob implements Enemy {
int i = size / 2;
int i1 = 2 + this.random.nextInt(3);
PlayerTeam team = this.getTeam();
@@ -57,7 +65,6 @@
mob.setSize(i, true);
mob.snapTo(this.getX() + f1, this.getY() + 0.5, this.getZ() + f2, this.random.nextFloat() * 360.0F, 0.0F);
- });
- }
+ // CraftBukkit start
+ }, null, null);
+ if (converted != null) {
@@ -72,7 +79,7 @@
+ }
+ for (LivingEntity living : slimes) {
+ this.level().addFreshEntity(living, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SLIME_SPLIT);
+ }
}
+ // CraftBukkit end
}
@@ -81,7 +88,7 @@
}
@Override
@@ -282,9 +_,13 @@
@@ -282,9 +310,13 @@ public class Slime extends Mob implements Enemy {
return checkMobSpawnRules(entityType, level, spawnReason, pos, random);
}
@@ -97,7 +104,7 @@
&& random.nextFloat() < 0.5F
&& random.nextFloat() < level.getMoonBrightness()
&& level.getMaxLocalRawBrightness(pos) <= random.nextInt(8)) {
@@ -296,8 +_,11 @@
@@ -296,8 +328,11 @@ public class Slime extends Mob implements Enemy {
}
ChunkPos chunkPos = new ChunkPos(pos);
@@ -111,7 +118,7 @@
return checkMobSpawnRules(entityType, level, spawnReason, pos, random);
}
}
@@ -356,6 +_,16 @@
@@ -356,6 +391,16 @@ public class Slime extends Mob implements Enemy {
return super.getDefaultDimensions(pose).scale(this.getSize());
}
@@ -128,7 +135,7 @@
static class SlimeAttackGoal extends Goal {
private final Slime slime;
private int growTiredTimer;
@@ -368,7 +_,16 @@
@@ -368,7 +413,16 @@ public class Slime extends Mob implements Enemy {
@Override
public boolean canUse() {
LivingEntity target = this.slime.getTarget();
@@ -146,7 +153,7 @@
}
@Override
@@ -380,7 +_,16 @@
@@ -380,7 +434,16 @@ public class Slime extends Mob implements Enemy {
@Override
public boolean canContinueToUse() {
LivingEntity target = this.slime.getTarget();
@@ -164,7 +171,7 @@
}
@Override
@@ -399,6 +_,13 @@
@@ -399,6 +462,13 @@ public class Slime extends Mob implements Enemy {
slimeMoveControl.setDirection(this.slime.getYRot(), this.slime.isDealsDamage());
}
}
@@ -178,7 +185,7 @@
}
static class SlimeFloatGoal extends Goal {
@@ -412,7 +_,7 @@
@@ -412,7 +482,7 @@ public class Slime extends Mob implements Enemy {
@Override
public boolean canUse() {
@@ -187,7 +194,7 @@
}
@Override
@@ -442,7 +_,7 @@
@@ -442,7 +512,7 @@ public class Slime extends Mob implements Enemy {
@Override
public boolean canUse() {
@@ -196,7 +203,7 @@
}
@Override
@@ -520,7 +_,7 @@
@@ -520,7 +590,7 @@ public class Slime extends Mob implements Enemy {
@Override
public boolean canUse() {
@@ -205,7 +212,7 @@
&& (this.slime.onGround() || this.slime.isInWater() || this.slime.isInLava() || this.slime.hasEffect(MobEffects.LEVITATION))
&& this.slime.getMoveControl() instanceof Slime.SlimeMoveControl;
}
@@ -530,6 +_,11 @@
@@ -530,6 +600,11 @@ public class Slime extends Mob implements Enemy {
if (--this.nextRandomizeTime <= 0) {
this.nextRandomizeTime = this.adjustedTickDelay(40 + this.slime.getRandom().nextInt(60));
this.chosenDegrees = this.slime.getRandom().nextInt(360);

View File

@@ -1,6 +1,14 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/world/entity/monster/Vex.java b/net/minecraft/world/entity/monster/Vex.java
index 19452f4117d5e11d8a1ec32f379b78a27ef049a6..bc74bdc3e13f1d51ed6d31470f3ac6f9855778c9 100644
--- a/net/minecraft/world/entity/monster/Vex.java
+++ b/net/minecraft/world/entity/monster/Vex.java
@@ -286,7 +_,7 @@
@@ -286,7 +286,7 @@ public class Vex extends Monster implements TraceableEntity {
@Override
public void start() {
@@ -9,7 +17,7 @@
super.start();
}
}
@@ -345,7 +_,10 @@
@@ -345,7 +345,10 @@ public class Vex extends Monster implements TraceableEntity {
for (int i = 0; i < 3; i++) {
BlockPos blockPos = boundOrigin.offset(Vex.this.random.nextInt(15) - 7, Vex.this.random.nextInt(11) - 5, Vex.this.random.nextInt(15) - 7);

View File

@@ -1,6 +1,14 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/world/entity/monster/Zombie.java b/net/minecraft/world/entity/monster/Zombie.java
index ef6807c5c14a4426791447b936f1c646c4ca149e..39b65970a48568c95ff482b9636e7391f300ffa8 100644
--- a/net/minecraft/world/entity/monster/Zombie.java
+++ b/net/minecraft/world/entity/monster/Zombie.java
@@ -68,9 +_,7 @@
@@ -68,9 +68,7 @@ import net.minecraft.world.level.block.state.BlockState;
public class Zombie extends Monster {
private static final ResourceLocation SPEED_MODIFIER_BABY_ID = ResourceLocation.withDefaultNamespace("baby");
@@ -11,7 +19,7 @@
private static final ResourceLocation REINFORCEMENT_CALLER_CHARGE_ID = ResourceLocation.withDefaultNamespace("reinforcement_caller_charge");
private static final AttributeModifier ZOMBIE_REINFORCEMENT_CALLEE_CHARGE = new AttributeModifier(
ResourceLocation.withDefaultNamespace("reinforcement_callee_charge"), -0.05F, AttributeModifier.Operation.ADD_VALUE
@@ -91,13 +_,15 @@
@@ -91,13 +89,15 @@ public class Zombie extends Monster {
private static final boolean DEFAULT_BABY = false;
private static final boolean DEFAULT_CAN_BREAK_DOORS = false;
private static final int DEFAULT_IN_WATER_TIME = 0;
@@ -28,7 +36,7 @@
}
public Zombie(Level level) {
@@ -106,7 +_,7 @@
@@ -106,7 +106,7 @@ public class Zombie extends Monster {
@Override
protected void registerGoals() {
@@ -37,7 +45,7 @@
this.goalSelector.addGoal(8, new LookAtPlayerGoal(this, Player.class, 8.0F));
this.goalSelector.addGoal(8, new RandomLookAroundGoal(this));
this.addBehaviourGoals();
@@ -118,7 +_,7 @@
@@ -118,7 +118,7 @@ public class Zombie extends Monster {
this.goalSelector.addGoal(7, new WaterAvoidingRandomStrollGoal(this, 1.0));
this.targetSelector.addGoal(1, new HurtByTargetGoal(this).setAlertOthers(ZombifiedPiglin.class));
this.targetSelector.addGoal(2, new NearestAttackableTargetGoal<>(this, Player.class, true));
@@ -46,7 +54,7 @@
this.targetSelector.addGoal(3, new NearestAttackableTargetGoal<>(this, IronGolem.class, true));
this.targetSelector.addGoal(5, new NearestAttackableTargetGoal<>(this, Turtle.class, 10, true, false, Turtle.BABY_ON_LAND_SELECTOR));
}
@@ -172,11 +_,16 @@
@@ -172,11 +172,16 @@ public class Zombie extends Monster {
@Override
protected int getBaseExperienceReward(ServerLevel level) {
@@ -64,7 +72,7 @@
}
@Override
@@ -184,9 +_,9 @@
@@ -184,9 +189,9 @@ public class Zombie extends Monster {
this.getEntityData().set(DATA_BABY_ID, childZombie);
if (this.level() != null && !this.level().isClientSide) {
AttributeInstance attribute = this.getAttribute(Attributes.MOVEMENT_SPEED);
@@ -76,7 +84,7 @@
}
}
}
@@ -255,6 +_,13 @@
@@ -255,6 +260,13 @@ public class Zombie extends Monster {
super.aiStep();
}
@@ -90,7 +98,7 @@
public void startUnderWaterConversion(int conversionTime) {
this.conversionTime = conversionTime;
this.getEntityData().set(DATA_DROWNED_CONVERSION_ID, true);
@@ -268,31 +_,50 @@
@@ -268,32 +280,51 @@ public class Zombie extends Monster {
}
protected void convertToZombieType(EntityType<? extends Zombie> entityType) {
@@ -138,19 +146,19 @@
public boolean isSunSensitive() {
- return true;
- }
+ return this.shouldBurnInDay; // Paper - Add more Zombie API
+ }
+
}
+ // Paper start - Add more Zombie API
+ public void setShouldBurnInDay(boolean shouldBurnInDay) {
+ this.shouldBurnInDay = shouldBurnInDay;
+ }
+ // Paper end - Add more Zombie API
+
@Override
public boolean hurtServer(ServerLevel level, DamageSource damageSource, float amount) {
@@ -325,13 +_,13 @@
if (!super.hurtServer(level, damageSource, amount)) {
@@ -325,13 +356,13 @@ public class Zombie extends Monster {
if (SpawnPlacements.isSpawnPositionOk(type, level, blockPos)
&& SpawnPlacements.checkSpawnRules(type, level, EntitySpawnReason.REINFORCEMENT, blockPos, level.random)) {
zombie.setPos(i1, i2, i3);
@@ -167,7 +175,7 @@
AttributeInstance attribute = this.getAttribute(Attributes.SPAWN_REINFORCEMENTS_CHANCE);
AttributeModifier modifier = attribute.getModifier(REINFORCEMENT_CALLER_CHARGE_ID);
double d = modifier != null ? modifier.amount() : 0.0;
@@ -356,7 +_,12 @@
@@ -356,7 +387,12 @@ public class Zombie extends Monster {
if (flag) {
float effectiveDifficulty = this.level().getCurrentDifficultyAt(this.blockPosition()).getEffectiveDifficulty();
if (this.getMainHandItem().isEmpty() && this.isOnFire() && this.random.nextFloat() < effectiveDifficulty * 0.3F) {
@@ -181,7 +189,7 @@
}
}
@@ -416,6 +_,7 @@
@@ -416,6 +452,7 @@ public class Zombie extends Monster {
compound.putBoolean("CanBreakDoors", this.canBreakDoors());
compound.putInt("InWaterTime", this.isInWater() ? this.inWaterTime : -1);
compound.putInt("DrownedConversionTime", this.isUnderWaterConverting() ? this.conversionTime : -1);
@@ -189,7 +197,7 @@
}
@Override
@@ -430,13 +_,15 @@
@@ -430,13 +467,15 @@ public class Zombie extends Monster {
} else {
this.getEntityData().set(DATA_DROWNED_CONVERSION_ID, false);
}
@@ -207,7 +215,7 @@
return flag;
}
@@ -472,7 +_,7 @@
@@ -472,7 +511,7 @@ public class Zombie extends Monster {
spawnGroupData = super.finalizeSpawn(level, difficulty, spawnReason, spawnGroupData);
float specialMultiplier = difficulty.getSpecialMultiplier();
if (spawnReason != EntitySpawnReason.CONVERSION) {
@@ -216,7 +224,7 @@
}
if (spawnGroupData == null) {
@@ -499,7 +_,7 @@
@@ -499,7 +538,7 @@ public class Zombie extends Monster {
chicken1.finalizeSpawn(level, difficulty, EntitySpawnReason.JOCKEY, null);
chicken1.setChickenJockey(true);
this.startRiding(chicken1);

View File

@@ -1,6 +1,14 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/world/entity/monster/ZombieVillager.java b/net/minecraft/world/entity/monster/ZombieVillager.java
index 39ea7415cb280ae22465e3eb7ab3983e182ebaa7..a8cd7103e636b57be1270d0f3549c709330b5536 100644
--- a/net/minecraft/world/entity/monster/ZombieVillager.java
+++ b/net/minecraft/world/entity/monster/ZombieVillager.java
@@ -160,12 +_,20 @@
@@ -160,12 +160,20 @@ public class ZombieVillager extends Zombie implements VillagerDataHolder {
}
public void startConverting(@Nullable UUID conversionStarter, int villagerConversionTime) {
@@ -24,7 +32,7 @@
}
@Override
@@ -190,7 +_,7 @@
@@ -190,7 +198,7 @@ public class ZombieVillager extends Zombie implements VillagerDataHolder {
}
private void finishConversion(ServerLevel level) {
@@ -33,7 +41,7 @@
EntityType.VILLAGER,
ConversionParams.single(this, false, false),
villager -> {
@@ -214,19 +_,24 @@
@@ -214,19 +222,24 @@ public class ZombieVillager extends Zombie implements VillagerDataHolder {
villager.finalizeSpawn(level, level.getCurrentDifficultyAt(villager.blockPosition()), EntitySpawnReason.CONVERSION, null);
villager.refreshBrain(level);
if (this.conversionStarter != null) {

View File

@@ -1,6 +1,14 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/world/entity/monster/piglin/Piglin.java b/net/minecraft/world/entity/monster/piglin/Piglin.java
index 059020829324915e15d6240920e61db9688e724e..e200e974e46de6166d56e051806c00a69aefc9bb 100644
--- a/net/minecraft/world/entity/monster/piglin/Piglin.java
+++ b/net/minecraft/world/entity/monster/piglin/Piglin.java
@@ -124,6 +_,12 @@
@@ -124,6 +124,12 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento
MemoryModuleType.ATE_RECENTLY,
MemoryModuleType.NEAREST_REPELLENT
);
@@ -13,7 +21,7 @@
public Piglin(EntityType<? extends AbstractPiglin> entityType, Level level) {
super(entityType, level);
@@ -136,6 +_,10 @@
@@ -136,6 +142,10 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento
compound.putBoolean("IsBaby", this.isBaby());
compound.putBoolean("CannotHunt", this.cannotHunt);
this.writeInventoryToTag(compound, this.registryAccess());
@@ -24,7 +32,7 @@
}
@Override
@@ -144,6 +_,10 @@
@@ -144,6 +154,10 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento
this.setBaby(compound.getBooleanOr("IsBaby", false));
this.setCannotHunt(compound.getBooleanOr("CannotHunt", false));
this.readInventoryFromTag(compound, this.registryAccess());
@@ -35,7 +43,7 @@
}
@VisibleForDebug
@@ -321,7 +_,9 @@
@@ -321,7 +335,9 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento
@Override
protected void finishConversion(ServerLevel serverLevel) {
PiglinAi.cancelAdmiring(serverLevel, this);
@@ -45,7 +53,7 @@
super.finishConversion(serverLevel);
}
@@ -397,7 +_,7 @@
@@ -397,7 +413,7 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento
}
protected void holdInOffHand(ItemStack stack) {
@@ -54,7 +62,7 @@
this.setItemSlot(EquipmentSlot.OFFHAND, stack);
this.setGuaranteedDrop(EquipmentSlot.OFFHAND);
} else {
@@ -422,15 +_,15 @@
@@ -422,15 +438,15 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento
return false;
} else {
TagKey<Item> preferredWeaponType = this.getPreferredWeaponType();

View File

@@ -1,6 +1,14 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/world/entity/player/Player.java b/net/minecraft/world/entity/player/Player.java
index 5418c07c58f12de53aabe75b43ff77848769c23d..2046c4d3ad5ea3254ad6bc83e6437e5c237c92b6 100644
--- a/net/minecraft/world/entity/player/Player.java
+++ b/net/minecraft/world/entity/player/Player.java
@@ -169,7 +_,7 @@
@@ -169,7 +169,7 @@ public abstract class Player extends LivingEntity {
private static final int DEFAULT_CURRENT_IMPULSE_CONTEXT_RESET_GRACE_TIME = 0;
private long timeEntitySatOnShoulder;
final Inventory inventory;
@@ -9,7 +17,7 @@
public final InventoryMenu inventoryMenu;
public AbstractContainerMenu containerMenu;
protected FoodData foodData = new FoodData();
@@ -208,6 +_,18 @@
@@ -208,6 +208,18 @@ public abstract class Player extends LivingEntity {
public Entity currentExplosionCause;
private boolean ignoreFallDamageFromCurrentImpulse = false;
private int currentImpulseContextResetGraceTime = 0;
@@ -28,7 +36,7 @@
public Player(Level level, BlockPos pos, float yRot, GameProfile gameProfile) {
super(EntityType.PLAYER, level);
@@ -276,6 +_,13 @@
@@ -276,6 +288,13 @@ public abstract class Player extends LivingEntity {
if (this.isSleeping()) {
this.sleepCounter++;
@@ -42,7 +50,7 @@
if (this.sleepCounter > 100) {
this.sleepCounter = 100;
}
@@ -293,7 +_,7 @@
@@ -293,7 +312,7 @@ public abstract class Player extends LivingEntity {
this.updateIsUnderwater();
super.tick();
if (!this.level().isClientSide && this.containerMenu != null && !this.containerMenu.stillValid(this)) {
@@ -51,7 +59,7 @@
this.containerMenu = this.inventoryMenu;
}
@@ -380,7 +_,7 @@
@@ -380,7 +399,7 @@ public abstract class Player extends LivingEntity {
}
private void turtleHelmetTick() {
@@ -60,7 +68,7 @@
}
private boolean isEquipped(Item item) {
@@ -527,6 +_,18 @@
@@ -527,6 +546,18 @@ public abstract class Player extends LivingEntity {
}
}
@@ -79,7 +87,7 @@
public void closeContainer() {
this.containerMenu = this.inventoryMenu;
}
@@ -538,8 +_,14 @@
@@ -538,8 +569,14 @@ public abstract class Player extends LivingEntity {
public void rideTick() {
if (!this.level().isClientSide && this.wantsToStopRiding() && this.isPassenger()) {
this.stopRiding();
@@ -96,7 +104,7 @@
super.rideTick();
this.oBob = this.bob;
this.bob = 0.0F;
@@ -598,6 +_,7 @@
@@ -598,6 +635,7 @@ public abstract class Player extends LivingEntity {
this.playShoulderEntityAmbientSound(this.getShoulderEntityLeft());
this.playShoulderEntityAmbientSound(this.getShoulderEntityRight());
if (!this.level().isClientSide && (this.fallDistance > 0.5 || this.isInWater()) || this.abilities.flying || this.isSleeping() || this.isInPowderSnow) {
@@ -104,7 +112,7 @@
this.removeEntitiesOnShoulder();
}
}
@@ -841,10 +_,10 @@
@@ -841,10 +879,10 @@ public abstract class Player extends LivingEntity {
if (this.isDeadOrDying()) {
return false;
} else {
@@ -117,7 +125,7 @@
}
if (level.getDifficulty() == Difficulty.EASY) {
@@ -856,7 +_,14 @@
@@ -856,7 +894,14 @@ public abstract class Player extends LivingEntity {
}
}
@@ -133,7 +141,7 @@
}
}
}
@@ -868,7 +_,7 @@
@@ -868,7 +913,7 @@ public abstract class Player extends LivingEntity {
BlocksAttacks blocksAttacks = itemBlockingWith != null ? itemBlockingWith.get(DataComponents.BLOCKS_ATTACKS) : null;
float secondsToDisableBlocking = entity.getSecondsToDisableBlocking();
if (secondsToDisableBlocking > 0.0F && blocksAttacks != null) {
@@ -142,7 +150,7 @@
}
}
@@ -878,9 +_,29 @@
@@ -878,9 +923,29 @@ public abstract class Player extends LivingEntity {
}
public boolean canHarmPlayer(Player other) {
@@ -175,7 +183,7 @@
}
@Override
@@ -894,7 +_,12 @@
@@ -894,7 +959,12 @@ public abstract class Player extends LivingEntity {
}
@Override
@@ -189,7 +197,7 @@
if (!this.isInvulnerableTo(level, damageSource)) {
amount = this.getDamageAfterArmorAbsorb(damageSource, amount);
amount = this.getDamageAfterMagicAbsorb(damageSource, amount);
@@ -906,7 +_,7 @@
@@ -906,7 +976,7 @@ public abstract class Player extends LivingEntity {
}
if (var8 != 0.0F) {
@@ -198,7 +206,7 @@
this.getCombatTracker().recordDamage(damageSource, var8);
this.setHealth(this.getHealth() - var8);
if (var8 < 3.4028235E37F) {
@@ -916,6 +_,7 @@
@@ -916,6 +986,7 @@ public abstract class Player extends LivingEntity {
this.gameEvent(GameEvent.ENTITY_DAMAGE);
}
}
@@ -206,7 +214,7 @@
}
public boolean isTextFilteringEnabled() {
@@ -997,13 +_,19 @@
@@ -997,13 +1068,19 @@ public abstract class Player extends LivingEntity {
@Override
public void removeVehicle() {
@@ -228,7 +236,7 @@
}
@Override
@@ -1082,8 +_,17 @@
@@ -1082,8 +1159,17 @@ public abstract class Player extends LivingEntity {
}
public void attack(Entity target) {
@@ -248,7 +256,7 @@
float f = this.isAutoSpinAttack() ? this.autoSpinAttackDmg : (float)this.getAttributeValue(Attributes.ATTACK_DAMAGE);
ItemStack weaponItem = this.getWeaponItem();
DamageSource damageSource = Optional.ofNullable(weaponItem.getItem().getDamageSource(this)).orElse(this.damageSources().playerAttack(this));
@@ -1091,18 +_,25 @@
@@ -1091,18 +1177,25 @@ public abstract class Player extends LivingEntity {
float attackStrengthScale = this.getAttackStrengthScale(0.5F);
f *= 0.2F + attackStrengthScale * attackStrengthScale * 0.8F;
f1 *= attackStrengthScale;
@@ -281,7 +289,7 @@
flag1 = true;
} else {
flag1 = false;
@@ -1118,7 +_,9 @@
@@ -1118,7 +1211,9 @@ public abstract class Player extends LivingEntity {
&& !this.isPassenger()
&& target instanceof LivingEntity
&& !this.isSprinting();
@@ -291,7 +299,7 @@
f *= 1.5F;
}
@@ -1145,17 +_,23 @@
@@ -1145,17 +1240,23 @@ public abstract class Player extends LivingEntity {
if (target instanceof LivingEntity livingEntity1) {
livingEntity1.knockback(
f4 * 0.5F, Mth.sin(this.getYRot() * (float) (Math.PI / 180.0)), -Mth.cos(this.getYRot() * (float) (Math.PI / 180.0))
@@ -315,7 +323,7 @@
}
if (flag3) {
@@ -1169,42 +_,59 @@
@@ -1169,42 +1270,59 @@ public abstract class Player extends LivingEntity {
&& !(livingEntity2 instanceof ArmorStand armorStand && armorStand.isMarker())
&& this.distanceToSqr(livingEntity2) < 9.0) {
float f6 = this.getEnchantedDamage(livingEntity2, f5, damageSource) * attackStrengthScale;
@@ -386,7 +394,7 @@
);
}
}
@@ -1252,10 +_,11 @@
@@ -1252,10 +1370,11 @@ public abstract class Player extends LivingEntity {
}
}
@@ -401,7 +409,7 @@
}
}
}
@@ -1290,8 +_,8 @@
@@ -1290,8 +1409,8 @@ public abstract class Player extends LivingEntity {
}
@Override
@@ -412,7 +420,7 @@
this.inventoryMenu.removed(this);
if (this.containerMenu != null && this.hasContainerOpen()) {
this.doCloseContainer();
@@ -1355,6 +_,12 @@
@@ -1355,6 +1474,12 @@ public abstract class Player extends LivingEntity {
}
public Either<Player.BedSleepingProblem, Unit> startSleepInBed(BlockPos bedPos) {
@@ -425,7 +433,7 @@
this.startSleeping(bedPos);
this.sleepCounter = 0;
return Either.right(Unit.INSTANCE);
@@ -1466,7 +_,7 @@
@@ -1466,7 +1591,7 @@ public abstract class Player extends LivingEntity {
@Override
public boolean causeFallDamage(double fallDistance, float damageMultiplier, DamageSource damageSource) {
@@ -434,7 +442,7 @@
return false;
} else {
if (fallDistance >= 2.0) {
@@ -1507,7 +_,15 @@
@@ -1507,7 +1632,15 @@ public abstract class Player extends LivingEntity {
}
public void startFallFlying() {
@@ -451,7 +459,7 @@
}
@Override
@@ -1613,15 +_,35 @@
@@ -1613,15 +1746,35 @@ public abstract class Player extends LivingEntity {
public int getXpNeededForNextLevel() {
if (this.experienceLevel >= 30) {
return 112 + (this.experienceLevel - 30) * 9;
@@ -489,7 +497,7 @@
}
}
}
@@ -1715,24 +_,53 @@
@@ -1715,24 +1868,53 @@ public abstract class Player extends LivingEntity {
public void removeEntitiesOnShoulder() {
if (this.timeEntitySatOnShoulder + 20L < this.level().getGameTime()) {
@@ -549,7 +557,7 @@
}
@Nullable
@@ -1926,17 +_,32 @@
@@ -1926,17 +2108,32 @@ public abstract class Player extends LivingEntity {
return ImmutableList.of(Pose.STANDING, Pose.CROUCHING, Pose.SWIMMING);
}
@@ -584,7 +592,7 @@
for (int i = 0; i < this.inventory.getContainerSize(); i++) {
ItemStack item = this.inventory.getItem(i);
@@ -1945,6 +_,7 @@
@@ -1945,6 +2142,7 @@ public abstract class Player extends LivingEntity {
}
}
@@ -592,7 +600,7 @@
return this.hasInfiniteMaterials() ? new ItemStack(Items.ARROW) : ItemStack.EMPTY;
}
}
@@ -2027,12 +_,20 @@
@@ -2027,12 +2225,20 @@ public abstract class Player extends LivingEntity {
}
public boolean hasClientLoaded() {

View File

@@ -1,6 +1,14 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/world/entity/projectile/AbstractThrownPotion.java b/net/minecraft/world/entity/projectile/AbstractThrownPotion.java
index cd39446836b9706134e164c07db57e3632b41299..3a1d9d0022f64d522138439cd1d55d571ff5e2ce 100644
--- a/net/minecraft/world/entity/projectile/AbstractThrownPotion.java
+++ b/net/minecraft/world/entity/projectile/AbstractThrownPotion.java
@@ -70,54 +_,95 @@
@@ -70,54 +70,95 @@ public abstract class AbstractThrownPotion extends ThrowableItemProjectile {
@Override
protected void onHit(HitResult result) {
super.onHit(result);

View File

@@ -1,6 +1,14 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/world/entity/projectile/EyeOfEnder.java b/net/minecraft/world/entity/projectile/EyeOfEnder.java
index 6c2eea22bc33abfe5c143abbca732310677073b0..59941c605085d93357211939114ecf1b88aef05d 100644
--- a/net/minecraft/world/entity/projectile/EyeOfEnder.java
+++ b/net/minecraft/world/entity/projectile/EyeOfEnder.java
@@ -73,6 +_,12 @@
@@ -73,6 +73,12 @@ public class EyeOfEnder extends Entity implements ItemSupplier {
}
public void signalTo(BlockPos pos) {
@@ -13,7 +21,7 @@
double d = pos.getX();
int y = pos.getY();
double d1 = pos.getZ();
@@ -89,8 +_,10 @@
@@ -89,8 +95,10 @@ public class EyeOfEnder extends Entity implements ItemSupplier {
this.tz = d1;
}
@@ -24,7 +32,7 @@
}
@Override
@@ -164,7 +_,7 @@
@@ -164,7 +172,7 @@ public class EyeOfEnder extends Entity implements ItemSupplier {
this.life++;
if (this.life > 80 && !this.level().isClientSide) {
this.playSound(SoundEvents.ENDER_EYE_DEATH, 1.0F, 1.0F);

View File

@@ -1,6 +1,14 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/world/entity/projectile/FireworkRocketEntity.java b/net/minecraft/world/entity/projectile/FireworkRocketEntity.java
index 12bd5a49e2297f93c85a20d023fe4c95c3d29bd8..dcb7714b2edeab8cfb0358929d07bd04cead26bf 100644
--- a/net/minecraft/world/entity/projectile/FireworkRocketEntity.java
+++ b/net/minecraft/world/entity/projectile/FireworkRocketEntity.java
@@ -50,6 +_,7 @@
@@ -50,6 +50,7 @@ public class FireworkRocketEntity extends Projectile implements ItemSupplier {
public int lifetime = 0;
@Nullable
public LivingEntity attachedToEntity;
@@ -8,7 +16,7 @@
public FireworkRocketEntity(EntityType<? extends FireworkRocketEntity> entityType, Level level) {
super(entityType, level);
@@ -165,7 +_,7 @@
@@ -165,7 +166,7 @@ public class FireworkRocketEntity extends Projectile implements ItemSupplier {
}
if (!this.noPhysics && this.isAlive() && hitResultOnMoveVector.getType() != HitResult.Type.MISS) {
@@ -17,7 +25,7 @@
this.hasImpulse = true;
}
@@ -189,7 +_,11 @@
@@ -189,7 +190,11 @@ public class FireworkRocketEntity extends Projectile implements ItemSupplier {
}
if (this.life > this.lifetime && this.level() instanceof ServerLevel serverLevel) {
@@ -30,7 +38,7 @@
}
}
@@ -197,14 +_,18 @@
@@ -197,14 +202,18 @@ public class FireworkRocketEntity extends Projectile implements ItemSupplier {
level.broadcastEntityEvent(this, (byte)17);
this.gameEvent(GameEvent.EXPLODE, this.getOwner());
this.dealExplosionDamage(level);
@@ -51,7 +59,7 @@
}
}
@@ -213,7 +_,11 @@
@@ -213,7 +222,11 @@ public class FireworkRocketEntity extends Projectile implements ItemSupplier {
BlockPos blockPos = new BlockPos(result.getBlockPos());
this.level().getBlockState(blockPos).entityInside(this.level(), blockPos, this, InsideBlockEffectApplier.NOOP);
if (this.level() instanceof ServerLevel serverLevel && this.hasExplosion()) {
@@ -64,7 +72,7 @@
}
super.onHitBlock(result);
@@ -286,6 +_,7 @@
@@ -286,6 +299,7 @@ public class FireworkRocketEntity extends Projectile implements ItemSupplier {
RegistryOps<Tag> registryOps = this.registryAccess().createSerializationContext(NbtOps.INSTANCE);
compound.store("FireworksItem", ItemStack.CODEC, registryOps, this.getItem());
compound.putBoolean("ShotAtAngle", this.entityData.get(DATA_SHOT_AT_ANGLE));
@@ -72,7 +80,7 @@
}
@Override
@@ -296,6 +_,7 @@
@@ -296,6 +310,7 @@ public class FireworkRocketEntity extends Projectile implements ItemSupplier {
RegistryOps<Tag> registryOps = this.registryAccess().createSerializationContext(NbtOps.INSTANCE);
this.entityData.set(DATA_ID_FIREWORKS_ITEM, compound.read("FireworksItem", ItemStack.CODEC, registryOps).orElse(getDefaultItem()));
this.entityData.set(DATA_SHOT_AT_ANGLE, compound.getBooleanOr("ShotAtAngle", false));

View File

@@ -1,6 +1,14 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/world/entity/projectile/LargeFireball.java b/net/minecraft/world/entity/projectile/LargeFireball.java
index 048ba5e45d6e0ee2be135e3ab07766eae8445543..db1b5bce212a5147be82504469f1fa9660812ebc 100644
--- a/net/minecraft/world/entity/projectile/LargeFireball.java
+++ b/net/minecraft/world/entity/projectile/LargeFireball.java
@@ -19,11 +_,13 @@
@@ -19,11 +19,13 @@ public class LargeFireball extends Fireball {
public LargeFireball(EntityType<? extends LargeFireball> entityType, Level level) {
super(entityType, level);
@@ -14,7 +22,7 @@
}
@Override
@@ -31,8 +_,13 @@
@@ -31,8 +33,13 @@ public class LargeFireball extends Fireball {
super.onHit(result);
if (this.level() instanceof ServerLevel serverLevel) {
boolean _boolean = serverLevel.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING);
@@ -30,7 +38,7 @@
}
}
@@ -57,6 +_,6 @@
@@ -57,6 +64,6 @@ public class LargeFireball extends Fireball {
@Override
public void readAdditionalSaveData(CompoundTag compound) {
super.readAdditionalSaveData(compound);

View File

@@ -1,6 +1,14 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/world/entity/projectile/Projectile.java b/net/minecraft/world/entity/projectile/Projectile.java
index 6c9a5aa2ca7d002c5b015b0e3adaa160748e36b8..4487c03183d20a187d391dd124abb7b926508b5b 100644
--- a/net/minecraft/world/entity/projectile/Projectile.java
+++ b/net/minecraft/world/entity/projectile/Projectile.java
@@ -47,6 +_,7 @@
@@ -47,6 +47,7 @@ public abstract class Projectile extends Entity implements TraceableEntity {
public boolean hasBeenShot = false;
@Nullable
private Entity lastDeflectedBy;
@@ -8,11 +16,10 @@
Projectile(EntityType<? extends Projectile> entityType, Level level) {
super(entityType, level);
@@ -57,15 +_,36 @@
@@ -57,15 +58,36 @@ public abstract class Projectile extends Entity implements TraceableEntity {
this.ownerUUID = owner.getUUID();
this.cachedOwner = owner;
}
- }
+ // Paper start - Refresh ProjectileSource for projectiles
+ else {
+ this.ownerUUID = null;
@@ -31,7 +38,7 @@
+ if (this.cachedOwner != null && !this.cachedOwner.isRemoved() && this.projectileSource == null && this.cachedOwner.getBukkitEntity() instanceof org.bukkit.projectiles.ProjectileSource projSource) {
+ this.projectileSource = projSource;
+ }
+ }
}
+ // Paper end - Refresh ProjectileSource for projectiles
@Nullable
@@ -46,7 +53,7 @@
return this.cachedOwner;
} else {
return null;
@@ -98,6 +_,7 @@
@@ -98,6 +120,7 @@ public abstract class Projectile extends Entity implements TraceableEntity {
@Override
protected void readAdditionalSaveData(CompoundTag compound) {
this.setOwnerThroughUUID(compound.read("Owner", UUIDUtil.CODEC).orElse(null));
@@ -54,7 +61,7 @@
this.leftOwner = compound.getBooleanOr("LeftOwner", false);
this.hasBeenShot = compound.getBooleanOr("HasBeenShot", false);
}
@@ -173,7 +_,14 @@
@@ -173,7 +196,14 @@ public abstract class Projectile extends Entity implements TraceableEntity {
float f2 = Mth.cos(y * (float) (Math.PI / 180.0)) * Mth.cos(x * (float) (Math.PI / 180.0));
this.shoot(f, f1, f2, velocity, inaccuracy);
Vec3 knownMovement = shooter.getKnownMovement();
@@ -69,7 +76,7 @@
}
@Override
@@ -193,7 +_,12 @@
@@ -193,7 +223,12 @@ public abstract class Projectile extends Entity implements TraceableEntity {
public static <T extends Projectile> T spawnProjectileFromRotation(
Projectile.ProjectileFactory<T> factory, ServerLevel level, ItemStack spawnedFrom, LivingEntity owner, float z, float velocity, float innaccuracy
) {
@@ -83,7 +90,7 @@
factory.create(level, owner, spawnedFrom),
level,
spawnedFrom,
@@ -218,7 +_,13 @@
@@ -218,7 +253,13 @@ public abstract class Projectile extends Entity implements TraceableEntity {
public static <T extends Projectile> T spawnProjectileUsingShoot(
T projectile, ServerLevel level, ItemStack spawnedFrom, double x, double y, double z, float velocity, float inaccuracy
) {
@@ -98,7 +105,7 @@
}
public static <T extends Projectile> T spawnProjectile(T projectile, ServerLevel level, ItemStack spawnedFrom) {
@@ -226,11 +_,46 @@
@@ -226,12 +267,47 @@ public abstract class Projectile extends Entity implements TraceableEntity {
}
public static <T extends Projectile> T spawnProjectile(T projectile, ServerLevel level, ItemStack stack, Consumer<T> adapter) {
@@ -112,10 +119,9 @@
- level.addFreshEntity(projectile);
- projectile.applyOnProjectileSpawned(level, stack);
- return projectile;
- }
+ return new Delayed<>(projectile, level, stack); // Paper - delayed projectile spawning
+ }
+
}
+ // Paper start - delayed projectile spawning
+ public record Delayed<T extends Projectile>(
+ T projectile,
@@ -146,10 +152,11 @@
+ }
+ }
+ // Paper end - delayed projectile spawning
+
public void applyOnProjectileSpawned(ServerLevel level, ItemStack spawnedFrom) {
EnchantmentHelper.onProjectileSpawned(level, spawnedFrom, this, item -> {});
@@ -242,6 +_,17 @@
if (this instanceof AbstractArrow abstractArrow) {
@@ -242,6 +318,17 @@ public abstract class Projectile extends Entity implements TraceableEntity {
}
}
@@ -167,7 +174,7 @@
protected ProjectileDeflection hitTargetOrDeflectSelf(HitResult hitResult) {
if (hitResult.getType() == HitResult.Type.ENTITY) {
EntityHitResult entityHitResult = (EntityHitResult)hitResult;
@@ -273,7 +_,13 @@
@@ -273,7 +360,13 @@ public abstract class Projectile extends Entity implements TraceableEntity {
public boolean deflect(ProjectileDeflection deflection, @Nullable Entity entity, @Nullable Entity owner, boolean deflectedByPlayer) {
deflection.deflect(this, entity, this.random);
if (!this.level().isClientSide) {
@@ -182,7 +189,7 @@
this.onDeflection(entity, deflectedByPlayer);
}
@@ -309,15 +_,35 @@
@@ -309,15 +402,35 @@ public abstract class Projectile extends Entity implements TraceableEntity {
}
protected void onHitBlock(BlockHitResult result) {
@@ -218,7 +225,7 @@
return owner == null || this.leftOwner || !owner.isPassengerOfSameVehicle(target);
}
}
@@ -330,13 +_,7 @@
@@ -330,13 +443,7 @@ public abstract class Projectile extends Entity implements TraceableEntity {
}
protected static float lerpRotation(float currentRotation, float targetRotation) {

View File

@@ -1,13 +1,20 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/world/entity/projectile/ShulkerBullet.java b/net/minecraft/world/entity/projectile/ShulkerBullet.java
index 43c36a76e633c34ee1f61d79dd6345af8b9ce8e0..0789b9b6904ae07d80a828ef18632fb3093cc3cc 100644
--- a/net/minecraft/world/entity/projectile/ShulkerBullet.java
+++ b/net/minecraft/world/entity/projectile/ShulkerBullet.java
@@ -58,7 +_,21 @@
@@ -58,8 +58,22 @@ public class ShulkerBullet extends Projectile {
this.finalTarget = finalTarget;
this.currentMoveDirection = Direction.UP;
this.selectNextMoveDirection(axis);
- }
+ this.projectileSource = shooter.getBukkitLivingEntity(); // CraftBukkit
+ }
+
}
+ // CraftBukkit start
+ @Nullable
+ public Entity getTarget() {
@@ -20,10 +27,11 @@
+ this.selectNextMoveDirection(Direction.Axis.X);
+ }
+ // CraftBukkit end
+
@Override
public SoundSource getSoundSource() {
@@ -180,7 +_,7 @@
return SoundSource.HOSTILE;
@@ -180,7 +194,7 @@ public class ShulkerBullet extends Projectile {
@Override
public void checkDespawn() {
if (this.level().getDifficulty() == Difficulty.PEACEFUL) {
@@ -32,7 +40,7 @@
}
}
@@ -226,7 +_,7 @@
@@ -226,7 +240,7 @@ public class ShulkerBullet extends Projectile {
}
if (hitResult != null && this.isAlive() && hitResult.getType() != HitResult.Type.MISS) {
@@ -41,7 +49,7 @@
}
ProjectileUtil.rotateTowardsMovement(this, 0.5F);
@@ -299,7 +_,7 @@
@@ -299,7 +313,7 @@ public class ShulkerBullet extends Projectile {
}
if (entity instanceof LivingEntity livingEntity1) {
@@ -50,7 +58,7 @@
}
}
}
@@ -312,14 +_,20 @@
@@ -312,14 +326,20 @@ public class ShulkerBullet extends Projectile {
}
private void destroy() {
@@ -73,7 +81,7 @@
}
@Override
@@ -334,9 +_,14 @@
@@ -334,9 +354,14 @@ public class ShulkerBullet extends Projectile {
@Override
public boolean hurtServer(ServerLevel level, DamageSource damageSource, float amount) {

View File

@@ -1,6 +1,14 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/world/entity/projectile/ThrownEnderpearl.java b/net/minecraft/world/entity/projectile/ThrownEnderpearl.java
index cd7eb7037b223674ffa492a68c55b371e6db8195..bda858b1e1c6b28cd9d5a664758b3e445eaf4f22 100644
--- a/net/minecraft/world/entity/projectile/ThrownEnderpearl.java
+++ b/net/minecraft/world/entity/projectile/ThrownEnderpearl.java
@@ -122,11 +_,18 @@
@@ -122,11 +122,18 @@ public class ThrownEnderpearl extends ThrowableItemProjectile {
Vec3 vec3 = this.oldPosition();
if (owner instanceof ServerPlayer serverPlayer) {
if (serverPlayer.connection.isAcceptingMessages()) {
@@ -20,7 +28,7 @@
}
}
@@ -134,15 +_,17 @@
@@ -134,15 +141,17 @@ public class ThrownEnderpearl extends ThrowableItemProjectile {
owner.setPortalCooldown();
}
@@ -44,7 +52,7 @@
}
this.playSound(serverLevel, vec3);
@@ -158,9 +_,9 @@
@@ -158,9 +167,9 @@ public class ThrownEnderpearl extends ThrowableItemProjectile {
this.playSound(serverLevel, vec3);
}
@@ -56,7 +64,7 @@
}
}
}
@@ -181,7 +_,7 @@
@@ -181,7 +190,7 @@ public class ThrownEnderpearl extends ThrowableItemProjectile {
if (owner instanceof ServerPlayer serverPlayer
&& !owner.isAlive()
&& serverPlayer.serverLevel().getGameRules().getBoolean(GameRules.RULE_ENDER_PEARLS_VANISH_ON_DEATH)) {
@@ -65,7 +73,7 @@
} else {
super.tick();
}
@@ -208,7 +_,7 @@
@@ -208,7 +217,7 @@ public class ThrownEnderpearl extends ThrowableItemProjectile {
public Entity teleport(TeleportTransition teleportTransition) {
Entity entity = super.teleport(teleportTransition);
if (entity != null) {
@@ -74,7 +82,7 @@
}
return entity;
@@ -216,7 +_,7 @@
@@ -216,7 +225,7 @@ public class ThrownEnderpearl extends ThrowableItemProjectile {
@Override
public boolean canTeleport(Level fromLevel, Level toLevel) {

View File

@@ -1,6 +1,14 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/world/entity/projectile/ThrownExperienceBottle.java b/net/minecraft/world/entity/projectile/ThrownExperienceBottle.java
index ee366e5eab69fc816e124d2718897ee5872c8bd1..7911809e0b957fbb2258a10547e9c1ba79ab289c 100644
--- a/net/minecraft/world/entity/projectile/ThrownExperienceBottle.java
+++ b/net/minecraft/world/entity/projectile/ThrownExperienceBottle.java
@@ -37,10 +_,17 @@
@@ -37,10 +37,17 @@ public class ThrownExperienceBottle extends ThrowableItemProjectile {
protected void onHit(HitResult result) {
super.onHit(result);
if (this.level() instanceof ServerLevel) {

View File

@@ -1,6 +1,14 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/world/entity/projectile/ThrownLingeringPotion.java b/net/minecraft/world/entity/projectile/ThrownLingeringPotion.java
index c566e20f1f71f87dd7e92b78b36ce76b1d32ef1f..35492f6f1ebad32adbd79cc7e50d37fdcef84367 100644
--- a/net/minecraft/world/entity/projectile/ThrownLingeringPotion.java
+++ b/net/minecraft/world/entity/projectile/ThrownLingeringPotion.java
@@ -30,7 +_,7 @@
@@ -30,7 +30,7 @@ public class ThrownLingeringPotion extends AbstractThrownPotion {
}
@Override
@@ -9,7 +17,7 @@
AreaEffectCloud areaEffectCloud = new AreaEffectCloud(this.level(), this.getX(), this.getY(), this.getZ());
if (this.getOwner() instanceof LivingEntity livingEntity) {
areaEffectCloud.setOwner(livingEntity);
@@ -42,6 +_,15 @@
@@ -42,6 +42,15 @@ public class ThrownLingeringPotion extends AbstractThrownPotion {
areaEffectCloud.setWaitTime(10);
areaEffectCloud.setRadiusPerTick(-areaEffectCloud.getRadius() / areaEffectCloud.getDuration());
areaEffectCloud.applyComponentsFromItemStack(stack);

View File

@@ -1,6 +1,14 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/world/entity/projectile/ThrownSplashPotion.java b/net/minecraft/world/entity/projectile/ThrownSplashPotion.java
index 13de6a2c8f4b04899af1687e827332c6a1874ab4..5be6707179c480cb33bf8ee9d40ec01b13d248df 100644
--- a/net/minecraft/world/entity/projectile/ThrownSplashPotion.java
+++ b/net/minecraft/world/entity/projectile/ThrownSplashPotion.java
@@ -36,12 +_,13 @@
@@ -36,12 +36,13 @@ public class ThrownSplashPotion extends AbstractThrownPotion {
}
@Override
@@ -15,7 +23,7 @@
if (!entitiesOfClass.isEmpty()) {
Entity effectSource = this.getEffectSource();
@@ -50,12 +_,31 @@
@@ -50,12 +51,31 @@ public class ThrownSplashPotion extends AbstractThrownPotion {
double d = this.distanceToSqr(livingEntity);
if (d < 16.0) {
double d1;
@@ -47,7 +55,7 @@
for (MobEffectInstance mobEffectInstance : allEffects) {
Holder<MobEffect> effect = mobEffectInstance.getEffect();
if (effect.value().isInstantenous()) {
@@ -66,7 +_,7 @@
@@ -66,7 +86,7 @@ public class ThrownSplashPotion extends AbstractThrownPotion {
effect, i, mobEffectInstance.getAmplifier(), mobEffectInstance.isAmbient(), mobEffectInstance.isVisible()
);
if (!mobEffectInstance1.endsWithin(20)) {
@@ -56,7 +64,7 @@
}
}
}
@@ -74,5 +_,6 @@
@@ -74,5 +94,6 @@ public class ThrownSplashPotion extends AbstractThrownPotion {
}
}
}

View File

@@ -1,6 +1,14 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/world/entity/vehicle/AbstractMinecart.java b/net/minecraft/world/entity/vehicle/AbstractMinecart.java
index 4b9090c9e2804f2e2340a392e71d434992125442..99617c08cbd989092ba357d8df928786fd04c89a 100644
--- a/net/minecraft/world/entity/vehicle/AbstractMinecart.java
+++ b/net/minecraft/world/entity/vehicle/AbstractMinecart.java
@@ -94,6 +_,17 @@
@@ -94,6 +94,17 @@ public abstract class AbstractMinecart extends VehicleEntity {
}
)
);
@@ -18,7 +26,7 @@
protected AbstractMinecart(EntityType<?> entityType, Level level) {
super(entityType, level);
@@ -153,11 +_,19 @@
@@ -153,11 +164,19 @@ public abstract class AbstractMinecart extends VehicleEntity {
@Override
public boolean canCollideWith(Entity entity) {
@@ -40,7 +48,7 @@
return true;
}
@@ -258,6 +_,14 @@
@@ -258,6 +277,14 @@ public abstract class AbstractMinecart extends VehicleEntity {
@Override
public void tick() {
@@ -55,7 +63,7 @@
if (this.getHurtTime() > 0) {
this.setHurtTime(this.getHurtTime() - 1);
}
@@ -267,8 +_,20 @@
@@ -267,8 +294,20 @@ public abstract class AbstractMinecart extends VehicleEntity {
}
this.checkBelowWorld();
@@ -77,7 +85,7 @@
this.updateInWaterStateAndDoFluidPushing();
if (this.isInLava()) {
this.lavaIgnite();
@@ -350,12 +_,16 @@
@@ -350,12 +389,16 @@ public abstract class AbstractMinecart extends VehicleEntity {
Vec3 deltaMovement = this.getDeltaMovement();
this.setDeltaMovement(Mth.clamp(deltaMovement.x, -maxSpeed, maxSpeed), deltaMovement.y, Mth.clamp(deltaMovement.z, -maxSpeed, maxSpeed));
if (this.onGround()) {
@@ -96,7 +104,7 @@
}
}
@@ -457,6 +_,15 @@
@@ -457,6 +500,15 @@ public abstract class AbstractMinecart extends VehicleEntity {
this.setDisplayOffset(compound.getIntOr("DisplayOffset", this.getDefaultDisplayOffset()));
this.flipped = compound.getBooleanOr("FlippedRotation", false);
this.firstTick = compound.getBooleanOr("HasTicked", false);
@@ -112,7 +120,7 @@
}
@Override
@@ -472,13 +_,27 @@
@@ -472,13 +524,27 @@ public abstract class AbstractMinecart extends VehicleEntity {
compound.putBoolean("FlippedRotation", this.flipped);
compound.putBoolean("HasTicked", this.firstTick);
@@ -140,7 +148,7 @@
double d = entity.getX() - this.getX();
double d1 = entity.getZ() - this.getZ();
double d2 = d * d + d1 * d1;
@@ -587,4 +_,26 @@
@@ -587,4 +653,26 @@ public abstract class AbstractMinecart extends VehicleEntity {
public boolean isFurnace() {
return false;
}

View File

@@ -1,6 +1,14 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/world/entity/vehicle/ContainerEntity.java b/net/minecraft/world/entity/vehicle/ContainerEntity.java
index 498e188a4b5fa22378fe146bba689fff595575af..feebd1610ebd3c26a337259c14f5c774dc72b937 100644
--- a/net/minecraft/world/entity/vehicle/ContainerEntity.java
+++ b/net/minecraft/world/entity/vehicle/ContainerEntity.java
@@ -60,12 +_,12 @@
@@ -60,12 +60,12 @@ public interface ContainerEntity extends Container, MenuProvider {
default void addChestVehicleSaveData(CompoundTag tag, HolderLookup.Provider levelRegistry) {
if (this.getContainerLootTable() != null) {
tag.putString("LootTable", this.getContainerLootTable().location().toString());
@@ -15,7 +23,7 @@
}
default void readChestVehicleSaveData(CompoundTag tag, HolderLookup.Provider levelRegistry) {
@@ -73,7 +_,12 @@
@@ -73,7 +73,12 @@ public interface ContainerEntity extends Container, MenuProvider {
ResourceKey<LootTable> resourceKey = tag.read("LootTable", LootTable.KEY_CODEC).orElse(null);
this.setContainerLootTable(resourceKey);
this.setContainerLootTableSeed(tag.getLongOr("LootTableSeed", 0L));
@@ -29,7 +37,7 @@
ContainerHelper.loadAllItems(tag, this.getItemStacks(), levelRegistry);
}
}
@@ -89,19 +_,27 @@
@@ -89,19 +94,27 @@ public interface ContainerEntity extends Container, MenuProvider {
}
default InteractionResult interactWithContainerVehicle(Player player) {
@@ -60,7 +68,7 @@
LootParams.Builder builder = new LootParams.Builder((ServerLevel)this.level()).withParameter(LootContextParams.ORIGIN, this.position());
if (player != null) {
builder.withLuck(player.getLuck()).withParameter(LootContextParams.THIS_ENTITY, player);
@@ -171,4 +_,14 @@
@@ -171,4 +184,14 @@ public interface ContainerEntity extends Container, MenuProvider {
default boolean isChestVehicleStillValid(Player player) {
return !this.isRemoved() && player.canInteractWithEntity(this.getBoundingBox(), 4.0);
}

View File

@@ -1,6 +1,14 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/world/inventory/AnvilMenu.java b/net/minecraft/world/inventory/AnvilMenu.java
index fa76f539268a77c67dbc489ca47447cf80aa4622..65c400444314049d5529f1f76d65fbd6b1ea7af2 100644
--- a/net/minecraft/world/inventory/AnvilMenu.java
+++ b/net/minecraft/world/inventory/AnvilMenu.java
@@ -43,6 +_,12 @@
@@ -43,6 +43,12 @@ public class AnvilMenu extends ItemCombinerMenu {
private static final int ADDITIONAL_SLOT_X_PLACEMENT = 76;
private static final int RESULT_SLOT_X_PLACEMENT = 134;
private static final int SLOT_Y_PLACEMENT = 47;
@@ -13,7 +21,7 @@
public AnvilMenu(int containerId, Inventory playerInventory) {
this(containerId, playerInventory, ContainerLevelAccess.NULL);
@@ -68,7 +_,7 @@
@@ -68,7 +74,7 @@ public class AnvilMenu extends ItemCombinerMenu {
@Override
protected boolean mayPickup(Player player, boolean hasStack) {
@@ -22,7 +30,7 @@
}
@Override
@@ -89,12 +_,22 @@
@@ -89,12 +95,22 @@ public class AnvilMenu extends ItemCombinerMenu {
this.inputSlots.setItem(1, ItemStack.EMPTY);
}
@@ -46,7 +54,7 @@
if (blockState1 == null) {
level.removeBlock(blockPos, false);
level.levelEvent(1029, blockPos, 0);
@@ -127,8 +_,8 @@
@@ -127,8 +143,8 @@ public class AnvilMenu extends ItemCombinerMenu {
if (itemStack.isDamageableItem() && item.isValidRepairItem(item1)) {
int min = Math.min(itemStack.getDamageValue(), itemStack.getMaxDamage() / 4);
if (min <= 0) {
@@ -57,7 +65,7 @@
return;
}
@@ -143,8 +_,8 @@
@@ -143,8 +159,8 @@ public class AnvilMenu extends ItemCombinerMenu {
this.repairItemCountCost = i2;
} else {
if (!hasStoredEnchantments && (!itemStack.is(item1.getItem()) || !itemStack.isDamageableItem())) {
@@ -68,7 +76,7 @@
return;
}
@@ -190,7 +_,7 @@
@@ -190,7 +206,7 @@ public class AnvilMenu extends ItemCombinerMenu {
flag1 = true;
} else {
flag = true;
@@ -77,7 +85,7 @@
intValue = enchantment.getMaxLevel();
}
@@ -208,8 +_,8 @@
@@ -208,8 +224,8 @@ public class AnvilMenu extends ItemCombinerMenu {
}
if (flag1 && !flag) {
@@ -88,7 +96,7 @@
return;
}
}
@@ -234,14 +_,16 @@
@@ -234,14 +250,16 @@ public class AnvilMenu extends ItemCombinerMenu {
}
if (i1 == i && i1 > 0) {
@@ -108,7 +116,7 @@
itemStack = ItemStack.EMPTY;
}
@@ -259,12 +_,13 @@
@@ -259,12 +277,13 @@ public class AnvilMenu extends ItemCombinerMenu {
EnchantmentHelper.setEnchantments(itemStack, mutable.toImmutable());
}
@@ -125,7 +133,7 @@
}
public static int calculateIncreasedRepairCost(int oldRepairCost) {
@@ -285,6 +_,7 @@
@@ -285,6 +304,7 @@ public class AnvilMenu extends ItemCombinerMenu {
}
this.createResult();
@@ -133,7 +141,7 @@
return true;
} else {
return false;
@@ -300,4 +_,19 @@
@@ -300,4 +320,19 @@ public class AnvilMenu extends ItemCombinerMenu {
public int getCost() {
return this.cost.get();
}

View File

@@ -1,6 +1,14 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/world/item/FireworkRocketItem.java b/net/minecraft/world/item/FireworkRocketItem.java
index 2b1198f45b79261c2e3997b3674a94e61768a644..18d63d2da49451a2d5e1da7bf0c00e05e2f192bc 100644
--- a/net/minecraft/world/item/FireworkRocketItem.java
+++ b/net/minecraft/world/item/FireworkRocketItem.java
@@ -29,7 +_,7 @@
@@ -29,7 +29,7 @@ public class FireworkRocketItem extends Item implements ProjectileItem {
ItemStack itemInHand = context.getItemInHand();
Vec3 clickLocation = context.getClickLocation();
Direction clickedFace = context.getClickedFace();
@@ -9,7 +17,7 @@
new FireworkRocketEntity(
level,
context.getPlayer(),
@@ -39,9 +_,14 @@
@@ -39,9 +39,14 @@ public class FireworkRocketItem extends Item implements ProjectileItem {
itemInHand
),
serverLevel,
@@ -26,7 +34,7 @@
}
return InteractionResult.SUCCESS;
@@ -52,9 +_,21 @@
@@ -52,9 +57,21 @@ public class FireworkRocketItem extends Item implements ProjectileItem {
if (player.isFallFlying()) {
ItemStack itemInHand = player.getItemInHand(hand);
if (level instanceof ServerLevel serverLevel) {

View File

@@ -1,6 +1,14 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/world/item/LeadItem.java b/net/minecraft/world/item/LeadItem.java
index de70db3b8c8f862dabde9be736f3a64955488c14..8c13ae2da3cf2b0979b501be5e3829da44fea45e 100644
--- a/net/minecraft/world/item/LeadItem.java
+++ b/net/minecraft/world/item/LeadItem.java
@@ -28,23 +_,43 @@
@@ -28,23 +28,43 @@ public class LeadItem extends Item {
if (blockState.is(BlockTags.FENCES)) {
Player player = context.getPlayer();
if (!level.isClientSide && player != null) {
@@ -47,7 +55,7 @@
leashable.setLeashedTo(leashFenceKnotEntity, true);
}
@@ -52,9 +_,20 @@
@@ -52,10 +72,21 @@ public class LeadItem extends Item {
level.gameEvent(GameEvent.BLOCK_ATTACH, pos, GameEvent.Context.of(player));
return InteractionResult.SUCCESS_SERVER;
} else {
@@ -59,12 +67,13 @@
return InteractionResult.PASS;
}
}
+
+ // CraftBukkit start
+ public static InteractionResult bindPlayerMobs(Player player, Level world, BlockPos pos) {
+ return LeadItem.bindPlayerMobs(player, world, pos, net.minecraft.world.InteractionHand.MAIN_HAND);
+ }
+ // CraftBukkit end
+
public static List<Leashable> leashableInArea(Level level, BlockPos pos, Predicate<Leashable> predicate) {
double d = 7.0;
int x = pos.getX();

View File

@@ -1,6 +1,14 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/world/item/component/ResolvableProfile.java b/net/minecraft/world/item/component/ResolvableProfile.java
index b990a4f1c97a8aeeffda47e12f5744a9b583f634..d60bd011747d381fdf23e9fe33c541590c92e9b7 100644
--- a/net/minecraft/world/item/component/ResolvableProfile.java
+++ b/net/minecraft/world/item/component/ResolvableProfile.java
@@ -20,9 +_,10 @@
@@ -20,9 +20,10 @@ public record ResolvableProfile(Optional<String> name, Optional<UUID> id, Proper
instance -> instance.group(
ExtraCodecs.PLAYER_NAME.optionalFieldOf("name").forGetter(ResolvableProfile::name),
UUIDUtil.CODEC.optionalFieldOf("id").forGetter(ResolvableProfile::id),
@@ -12,7 +20,7 @@
);
public static final Codec<ResolvableProfile> CODEC = Codec.withAlternative(
FULL_CODEC, ExtraCodecs.PLAYER_NAME, name -> new ResolvableProfile(Optional.of(name), Optional.empty(), new PropertyMap())
@@ -49,7 +_,7 @@
@@ -49,7 +50,7 @@ public record ResolvableProfile(Optional<String> name, Optional<UUID> id, Proper
if (this.isResolved()) {
return CompletableFuture.completedFuture(this);
} else {

View File

@@ -1,6 +1,14 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/world/item/crafting/RecipeManager.java b/net/minecraft/world/item/crafting/RecipeManager.java
index 84c4322168fda64109d421e2daf6e80c39f8876d..b857e811b4b7a25eaec6dceaae5528d2ec0a1c45 100644
--- a/net/minecraft/world/item/crafting/RecipeManager.java
+++ b/net/minecraft/world/item/crafting/RecipeManager.java
@@ -87,7 +_,26 @@
@@ -87,7 +87,26 @@ public class RecipeManager extends SimplePreparableReloadListener<RecipeMap> imp
LOGGER.info("Loaded {} recipes", object.values().size());
}
@@ -27,7 +35,7 @@
List<SelectableRecipe.SingleInputEntry<StonecutterRecipe>> list = new ArrayList<>();
List<RecipeManager.IngredientCollector> list1 = RECIPE_PROPERTY_SETS.entrySet()
.stream()
@@ -147,7 +_,10 @@
@@ -147,7 +166,10 @@ public class RecipeManager extends SimplePreparableReloadListener<RecipeMap> imp
}
public <I extends RecipeInput, T extends Recipe<I>> Optional<RecipeHolder<T>> getRecipeFor(RecipeType<T> recipeType, I input, Level level) {
@@ -39,7 +47,7 @@
}
public Optional<RecipeHolder<?>> byKey(ResourceKey<Recipe<?>> key) {
@@ -184,6 +_,7 @@
@@ -184,6 +206,7 @@ public class RecipeManager extends SimplePreparableReloadListener<RecipeMap> imp
@Nullable
public RecipeManager.ServerDisplayInfo getRecipeFromDisplay(RecipeDisplayId display) {
@@ -47,11 +55,10 @@
return this.allDisplays.get(display.index());
}
@@ -199,6 +_,22 @@
Recipe<?> recipe1 = Recipe.CODEC.parse(registries.createSerializationContext(JsonOps.INSTANCE), json).getOrThrow(JsonParseException::new);
@@ -200,6 +223,22 @@ public class RecipeManager extends SimplePreparableReloadListener<RecipeMap> imp
return new RecipeHolder<>(recipe, recipe1);
}
+
+ // CraftBukkit start
+ public boolean removeRecipe(ResourceKey<Recipe<?>> mcKey) {
+ boolean removed = this.recipes.removeRecipe((ResourceKey<Recipe<RecipeInput>>) (ResourceKey) mcKey); // Paper - generic fix
@@ -67,6 +74,7 @@
+ this.finalizeRecipeLoading();
+ }
+ // CraftBukkit end
+
public static <I extends RecipeInput, T extends Recipe<I>> RecipeManager.CachedCheck<I, T> createCheck(final RecipeType<T> recipeType) {
return new RecipeManager.CachedCheck<I, T>() {
@Nullable

View File

@@ -1,6 +1,14 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/world/level/BaseSpawner.java b/net/minecraft/world/level/BaseSpawner.java
index 8431477838095d7ff9289ad2f00f1dd32df31246..650ebce14d618076cec2066d134d2ae51a87076a 100644
--- a/net/minecraft/world/level/BaseSpawner.java
+++ b/net/minecraft/world/level/BaseSpawner.java
@@ -46,13 +_,15 @@
@@ -46,13 +46,15 @@ public abstract class BaseSpawner {
public int maxNearbyEntities = 6;
public int requiredPlayerRange = 16;
public int spawnRange = 4;
@@ -17,7 +25,7 @@
}
public void clientTick(Level level, BlockPos pos) {
@@ -75,13 +_,19 @@
@@ -75,13 +77,19 @@ public abstract class BaseSpawner {
}
public void serverTick(ServerLevel serverLevel, BlockPos pos) {
@@ -39,7 +47,7 @@
} else {
boolean flag = false;
RandomSource random = serverLevel.getRandom();
@@ -118,6 +_,21 @@
@@ -118,6 +126,21 @@ public abstract class BaseSpawner {
continue;
}
@@ -61,7 +69,7 @@
Entity entity = EntityType.loadEntityRecursive(entityToSpawn, serverLevel, EntitySpawnReason.SPAWNER, entity1 -> {
entity1.snapTo(vec3.x, vec3.y, vec3.z, entity1.getYRot(), entity1.getXRot());
return entity1;
@@ -138,6 +_,7 @@
@@ -138,6 +161,7 @@ public abstract class BaseSpawner {
return;
}
@@ -69,7 +77,7 @@
entity.snapTo(entity.getX(), entity.getY(), entity.getZ(), random.nextFloat() * 360.0F, 0.0F);
if (entity instanceof Mob mob) {
if (nextSpawnData.getCustomSpawnRules().isEmpty() && !mob.checkSpawnRules(serverLevel, EntitySpawnReason.SPAWNER)
@@ -152,9 +_,22 @@
@@ -152,9 +176,22 @@ public abstract class BaseSpawner {
}
nextSpawnData.getEquipment().ifPresent(mob::equip);
@@ -93,7 +101,7 @@
this.delay(serverLevel, pos);
return;
}
@@ -165,7 +_,7 @@
@@ -165,7 +202,7 @@ public abstract class BaseSpawner {
((Mob)entity).spawnAnim();
}
@@ -102,7 +110,7 @@
}
}
@@ -189,12 +_,14 @@
@@ -189,12 +226,14 @@ public abstract class BaseSpawner {
}
public void load(@Nullable Level level, BlockPos pos, CompoundTag tag) {
@@ -121,7 +129,7 @@
this.spawnCount = tag.getIntOr("SpawnCount", 4);
this.maxNearbyEntities = tag.getIntOr("MaxNearbyEntities", 6);
this.requiredPlayerRange = tag.getIntOr("RequiredPlayerRange", 16);
@@ -203,9 +_,19 @@
@@ -203,9 +242,19 @@ public abstract class BaseSpawner {
}
public CompoundTag save(CompoundTag tag) {

View File

@@ -1,6 +1,14 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/world/level/GameRules.java b/net/minecraft/world/level/GameRules.java
index cd6b2cd0bba4fd9be4b37745f4beabee8b87505f..02bc5d83b92a594ec519f0a02b0517fdb4b9e954 100644
--- a/net/minecraft/world/level/GameRules.java
+++ b/net/minecraft/world/level/GameRules.java
@@ -34,6 +_,14 @@
@@ -34,6 +34,14 @@ import net.minecraft.world.flag.FeatureFlags;
import org.slf4j.Logger;
public class GameRules {
@@ -15,7 +23,7 @@
public static final int DEFAULT_RANDOM_TICK_SPEED = 3;
static final Logger LOGGER = LogUtils.getLogger();
public static final Map<GameRules.Key<?>, GameRules.Type<?>> GAME_RULE_TYPES = Maps.newTreeMap(Comparator.comparing(entry -> entry.id));
@@ -86,10 +_,10 @@
@@ -86,10 +94,10 @@ public class GameRules {
"sendCommandFeedback", GameRules.Category.CHAT, GameRules.BooleanValue.create(true)
);
public static final GameRules.Key<GameRules.BooleanValue> RULE_REDUCEDDEBUGINFO = register(
@@ -28,7 +36,7 @@
serverPlayer.connection.send(new ClientboundEntityEventPacket(serverPlayer, b));
}
})
@@ -113,8 +_,8 @@
@@ -113,8 +121,8 @@ public class GameRules {
"doWeatherCycle", GameRules.Category.UPDATES, GameRules.BooleanValue.create(true)
);
public static final GameRules.Key<GameRules.BooleanValue> RULE_LIMITED_CRAFTING = register(
@@ -39,7 +47,7 @@
serverPlayer.connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.LIMITED_CRAFTING, value.get() ? 1.0F : 0.0F));
}
})
@@ -138,8 +_,8 @@
@@ -138,8 +146,8 @@ public class GameRules {
"doInsomnia", GameRules.Category.SPAWNING, GameRules.BooleanValue.create(true)
);
public static final GameRules.Key<GameRules.BooleanValue> RULE_DO_IMMEDIATE_RESPAWN = register(
@@ -50,7 +58,7 @@
serverPlayer.connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.IMMEDIATE_RESPAWN, value.get() ? 1.0F : 0.0F));
}
})
@@ -210,11 +_,11 @@
@@ -210,11 +218,11 @@ public class GameRules {
public static final GameRules.Key<GameRules.IntegerValue> RULE_MINECART_MAX_SPEED = register(
"minecartMaxSpeed",
GameRules.Category.MISC,
@@ -65,7 +73,7 @@
serverLevel.setDefaultSpawnPos(serverLevel.getSharedSpawnPos(), serverLevel.getSharedSpawnAngle());
})
);
@@ -223,6 +_,7 @@
@@ -223,6 +231,7 @@ public class GameRules {
);
private final Map<GameRules.Key<?>, GameRules.Value<?>> rules;
private final FeatureFlagSet enabledFeatures;
@@ -73,7 +81,7 @@
public static <T extends GameRules.Value<T>> GameRules.Type<T> getType(GameRules.Key<T> key) {
return (GameRules.Type<T>)GAME_RULE_TYPES.get(key);
@@ -270,10 +_,21 @@
@@ -270,10 +279,21 @@ public class GameRules {
private GameRules(Map<GameRules.Key<?>, GameRules.Value<?>> rules, FeatureFlagSet enabledFeatures) {
this.rules = rules;
this.enabledFeatures = enabledFeatures;
@@ -96,7 +104,7 @@
if (value == null) {
throw new IllegalArgumentException("Tried to access invalid game rule");
} else {
@@ -314,13 +_,13 @@
@@ -314,13 +334,13 @@ public class GameRules {
}
}
@@ -114,7 +122,7 @@
}
public boolean getBoolean(GameRules.Key<GameRules.BooleanValue> key) {
@@ -334,7 +_,7 @@
@@ -334,7 +354,7 @@ public class GameRules {
public static class BooleanValue extends GameRules.Value<GameRules.BooleanValue> {
private boolean value;
@@ -123,7 +131,7 @@
return new GameRules.Type<>(
BoolArgumentType::bool,
type -> new GameRules.BooleanValue(type, defaultValue),
@@ -355,17 +_,21 @@
@@ -355,17 +375,21 @@ public class GameRules {
}
@Override
@@ -149,7 +157,7 @@
}
@Override
@@ -394,9 +_,9 @@
@@ -394,9 +418,9 @@ public class GameRules {
}
@Override
@@ -161,7 +169,7 @@
}
}
@@ -434,7 +_,7 @@
@@ -434,7 +458,7 @@ public class GameRules {
public static class IntegerValue extends GameRules.Value<GameRules.IntegerValue> {
private int value;
@@ -170,7 +178,7 @@
return new GameRules.Type<>(
IntegerArgumentType::integer,
type -> new GameRules.IntegerValue(type, defaultValue),
@@ -446,7 +_,7 @@
@@ -446,7 +470,7 @@ public class GameRules {
}
static GameRules.Type<GameRules.IntegerValue> create(
@@ -179,7 +187,7 @@
) {
return new GameRules.Type<>(
() -> IntegerArgumentType.integer(min, max),
@@ -468,17 +_,21 @@
@@ -468,17 +492,21 @@ public class GameRules {
}
@Override
@@ -205,7 +213,7 @@
}
@Override
@@ -529,13 +_,17 @@
@@ -529,13 +557,17 @@ public class GameRules {
}
@Override
@@ -225,7 +233,7 @@
final String id;
private final GameRules.Category category;
@@ -575,7 +_,7 @@
@@ -575,7 +607,7 @@ public class GameRules {
public static class Type<T extends GameRules.Value<T>> {
final Supplier<ArgumentType<?>> argument;
private final Function<GameRules.Type<T>, T> constructor;
@@ -234,7 +242,7 @@
private final GameRules.VisitorCaller<T> visitorCaller;
final Class<T> valueClass;
final FeatureFlagSet requiredFeatures;
@@ -583,7 +_,7 @@
@@ -583,7 +615,7 @@ public class GameRules {
Type(
Supplier<ArgumentType<?>> argument,
Function<GameRules.Type<T>, T> constructor,
@@ -243,7 +251,7 @@
GameRules.VisitorCaller<T> visitorCaller,
Class<T> valueClass,
FeatureFlagSet requiredFeatures
@@ -611,6 +_,12 @@
@@ -611,6 +643,12 @@ public class GameRules {
public FeatureFlagSet requiredFeatures() {
return this.requiredFeatures;
}
@@ -256,7 +264,7 @@
}
public abstract static class Value<T extends GameRules.Value<T>> {
@@ -620,16 +_,16 @@
@@ -620,16 +658,16 @@ public class GameRules {
this.type = type;
}
@@ -280,7 +288,7 @@
}
}
@@ -648,7 +_,7 @@
@@ -648,7 +686,7 @@ public class GameRules {
protected abstract T copy();

View File

@@ -1,6 +1,14 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/world/level/block/LavaCauldronBlock.java b/net/minecraft/world/level/block/LavaCauldronBlock.java
index fc5ef2c2cf2a2a373645ba8b8d8f9c8c6062ef13..81867acc1af474df1b221cbd3854316030032049 100644
--- a/net/minecraft/world/level/block/LavaCauldronBlock.java
+++ b/net/minecraft/world/level/block/LavaCauldronBlock.java
@@ -33,9 +_,10 @@
@@ -33,9 +33,10 @@ public class LavaCauldronBlock extends AbstractCauldronBlock {
@Override
protected void entityInside(BlockState state, Level level, BlockPos pos, Entity entity, InsideBlockEffectApplier effectApplier) {

View File

@@ -1,6 +1,14 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/world/level/block/LayeredCauldronBlock.java b/net/minecraft/world/level/block/LayeredCauldronBlock.java
index 81c06eb72424cdb8c80337b531ce33fd4f17b785..0dce5f44bf809317ad42d246d1a9555594b272ee 100644
--- a/net/minecraft/world/level/block/LayeredCauldronBlock.java
+++ b/net/minecraft/world/level/block/LayeredCauldronBlock.java
@@ -62,35 +_,67 @@
@@ -62,35 +62,67 @@ public class LayeredCauldronBlock extends AbstractCauldronBlock {
@Override
protected void entityInside(BlockState state, Level level, BlockPos pos, Entity entity, InsideBlockEffectApplier effectApplier) {
@@ -42,15 +50,14 @@
BlockState blockState = i == 0 ? Blocks.CAULDRON.defaultBlockState() : state.setValue(LEVEL, i);
- level.setBlockAndUpdate(pos, blockState);
- level.gameEvent(GameEvent.BLOCK_CHANGE, pos, GameEvent.Context.of(blockState));
- }
+ return changeLevel(level, pos, blockState, entity, reason); // Paper
+ }
+ // CraftBukkit start
+ // Paper start - Call CauldronLevelChangeEvent
+ public static boolean changeLevel(Level level, BlockPos pos, BlockState newBlock, @javax.annotation.Nullable Entity entity, org.bukkit.event.block.CauldronLevelChangeEvent.ChangeReason reason) { // Paper - entity is nullable
+ return changeLevel(level, pos, newBlock, entity, reason, true);
+ }
+
}
+ public static boolean changeLevel(Level level, BlockPos pos, BlockState newBlock, @javax.annotation.Nullable Entity entity, org.bukkit.event.block.CauldronLevelChangeEvent.ChangeReason reason, boolean sendGameEvent) { // Paper - entity is nullable
+ // Paper end - Call CauldronLevelChangeEvent
+ org.bukkit.craftbukkit.block.CraftBlockState newState = org.bukkit.craftbukkit.block.CraftBlockStates.getBlockState(level, pos);
@@ -68,7 +75,7 @@
+ return true;
+ }
+ // CraftBukkit end
+
@Override
public void handlePrecipitation(BlockState state, Level level, BlockPos pos, Biome.Precipitation precipitation) {
if (CauldronBlock.shouldHandlePrecipitation(level, precipitation) && state.getValue(LEVEL) != 3 && precipitation == this.precipitationType) {
@@ -79,7 +86,7 @@
}
}
@@ -108,8 +_,11 @@
@@ -108,8 +140,11 @@ public class LayeredCauldronBlock extends AbstractCauldronBlock {
protected void receiveStalactiteDrip(BlockState state, Level level, BlockPos pos, Fluid fluid) {
if (!this.isFull(state)) {
BlockState blockState = state.setValue(LEVEL, state.getValue(LEVEL) + 1);

View File

@@ -1,6 +1,14 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/world/level/block/SculkSpreader.java b/net/minecraft/world/level/block/SculkSpreader.java
index 174592afa95942b2537bd42b0e80ac9028f152f1..416d877c1de1ef57a4f9774767f4d21eb21a33f1 100644
--- a/net/minecraft/world/level/block/SculkSpreader.java
+++ b/net/minecraft/world/level/block/SculkSpreader.java
@@ -45,6 +_,7 @@
@@ -45,6 +45,7 @@ public class SculkSpreader {
private final int chargeDecayRate;
private final int additionalDecayRate;
private List<SculkSpreader.ChargeCursor> cursors = new ArrayList<>();
@@ -8,7 +16,7 @@
public SculkSpreader(
boolean isWorldGeneration, TagKey<Block> replaceableBlocks, int growthSpawnCoat, int noGrowthRadius, int chargeDecayRate, int additionalDecayRate
@@ -100,7 +_,7 @@
@@ -100,7 +101,7 @@ public class SculkSpreader {
public void load(CompoundTag tag) {
this.cursors.clear();
@@ -17,7 +25,7 @@
}
public void save(CompoundTag tag) {
@@ -110,13 +_,24 @@
@@ -110,13 +111,24 @@ public class SculkSpreader {
public void addCursors(BlockPos pos, int charge) {
while (charge > 0) {
int min = Math.min(charge, 1000);

View File

@@ -1,6 +1,14 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/world/level/block/SignBlock.java b/net/minecraft/world/level/block/SignBlock.java
index a953931210d3f970351ce2f09996164bfc1e7d72..a06896de4401f184e8c5cc8bad829e6412eaff22 100644
--- a/net/minecraft/world/level/block/SignBlock.java
+++ b/net/minecraft/world/level/block/SignBlock.java
@@ -133,7 +_,7 @@
@@ -133,7 +133,7 @@ public abstract class SignBlock extends BaseEntityBlock implements SimpleWaterlo
} else if (!this.otherPlayerIsEditingSign(player, signBlockEntity)
&& player.mayBuild()
&& this.hasEditableText(player, signBlockEntity, isFacingFrontText)) {
@@ -9,7 +17,7 @@
return InteractionResult.SUCCESS_SERVER;
} else {
return InteractionResult.PASS;
@@ -175,7 +_,34 @@
@@ -175,7 +175,34 @@ public abstract class SignBlock extends BaseEntityBlock implements SimpleWaterlo
return woodType;
}
@@ -44,7 +52,7 @@
signEntity.setAllowedPlayerEditor(player.getUUID());
player.openTextEdit(signEntity, isFrontText);
}
@@ -188,6 +_,6 @@
@@ -188,6 +215,6 @@ public abstract class SignBlock extends BaseEntityBlock implements SimpleWaterlo
@Nullable
@Override
public <T extends BlockEntity> BlockEntityTicker<T> getTicker(Level level, BlockState state, BlockEntityType<T> blockEntityType) {

View File

@@ -1,6 +1,14 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java b/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
index 94a12d41fe7831c0a0723aa5747daa6832f5487b..c5b3b5e5f621f8db152aa190374ae0fe567d6828 100644
--- a/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
+++ b/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
@@ -104,11 +_,49 @@
@@ -104,12 +104,50 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
};
public final Reference2IntOpenHashMap<ResourceKey<Recipe<?>>> recipesUsed = new Reference2IntOpenHashMap<>();
private final RecipeManager.CachedCheck<SingleRecipeInput, ? extends AbstractCookingRecipe> quickCheck;
@@ -10,10 +18,9 @@
protected AbstractFurnaceBlockEntity(BlockEntityType<?> type, BlockPos pos, BlockState blockState, RecipeType<? extends AbstractCookingRecipe> recipeType) {
super(type, pos, blockState);
this.quickCheck = RecipeManager.createCheck(recipeType);
- }
+ this.recipeType = recipeType; // Paper - cook speed multiplier API
+ }
+
}
+ // CraftBukkit start - add fields and methods
+ private int maxStack = MAX_STACK;
+ public List<org.bukkit.entity.HumanEntity> transaction = new java.util.ArrayList<>();
@@ -48,10 +55,11 @@
+ this.maxStack = size;
+ }
+ // CraftBukkit end
+
private boolean isLit() {
return this.litTimeRemaining > 0;
@@ -125,6 +_,7 @@
}
@@ -125,6 +163,7 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
this.litTotalTime = tag.getShortOr("lit_total_time", (short)0);
this.recipesUsed.clear();
this.recipesUsed.putAll(tag.read("RecipesUsed", RECIPES_USED_CODEC).orElse(Map.of()));
@@ -59,7 +67,7 @@
}
@Override
@@ -134,6 +_,7 @@
@@ -134,6 +173,7 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
tag.putShort("cooking_total_time", (short)this.cookingTotalTime);
tag.putShort("lit_time_remaining", (short)this.litTimeRemaining);
tag.putShort("lit_total_time", (short)this.litTotalTime);
@@ -67,7 +75,7 @@
ContainerHelper.saveAllItems(tag, this.items, registries);
tag.store("RecipesUsed", RECIPES_USED_CODEC, this.recipesUsed);
}
@@ -160,11 +_,22 @@
@@ -160,11 +200,22 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
int maxStackSize = furnace.getMaxStackSize();
if (!furnace.isLit() && canBurn(level.registryAccess(), recipeHolder, singleRecipeInput, furnace.items, maxStackSize)) {
@@ -93,7 +101,7 @@
Item item = itemStack.getItem();
itemStack.shrink(1);
if (itemStack.isEmpty()) {
@@ -175,11 +_,28 @@
@@ -175,11 +226,28 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
}
if (furnace.isLit() && canBurn(level.registryAccess(), recipeHolder, singleRecipeInput, furnace.items, maxStackSize)) {
@@ -125,7 +133,7 @@
furnace.setRecipeUsed(recipeHolder);
}
@@ -233,17 +_,47 @@
@@ -233,17 +301,47 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
@Nullable RecipeHolder<? extends AbstractCookingRecipe> recipe,
SingleRecipeInput recipeInput,
NonNullList<ItemStack> items,
@@ -177,7 +185,7 @@
if (itemStack.is(Blocks.WET_SPONGE.asItem()) && !items.get(1).isEmpty() && items.get(1).is(Items.BUCKET)) {
items.set(1, new ItemStack(Items.WATER_BUCKET));
@@ -260,9 +_,16 @@
@@ -260,9 +358,16 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
return fuelValues.burnDuration(stack);
}
@@ -196,7 +204,7 @@
}
@Override
@@ -306,7 +_,7 @@
@@ -306,7 +411,7 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
this.items.set(index, stack);
stack.limitSize(this.getMaxStackSize(stack));
if (index == 0 && !flag && this.level instanceof ServerLevel serverLevel) {
@@ -205,7 +213,7 @@
this.cookingTimer = 0;
this.setChanged();
}
@@ -342,8 +_,8 @@
@@ -342,8 +447,8 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
public void awardUsedRecipes(Player player, List<ItemStack> items) {
}
@@ -216,7 +224,7 @@
player.awardRecipes(recipesToAwardAndPopExperience);
for (RecipeHolder<?> recipeHolder : recipesToAwardAndPopExperience) {
@@ -356,30 +_,60 @@
@@ -356,30 +461,60 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
}
public List<RecipeHolder<?>> getRecipesToAwardAndPopExperience(ServerLevel level, Vec3 popVec) {

View File

@@ -1,6 +1,14 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/world/level/block/entity/BannerBlockEntity.java b/net/minecraft/world/level/block/entity/BannerBlockEntity.java
index b61584c533ccb8340c6bd8ad0dbfc3a68600e6cc..8d409e6e768ef6294f41684bc6549b638ac1d7bc 100644
--- a/net/minecraft/world/level/block/entity/BannerBlockEntity.java
+++ b/net/minecraft/world/level/block/entity/BannerBlockEntity.java
@@ -52,7 +_,7 @@
@@ -52,7 +52,7 @@ public class BannerBlockEntity extends BlockEntity implements Nameable {
protected void saveAdditional(CompoundTag tag, HolderLookup.Provider registries) {
super.saveAdditional(tag, registries);
RegistryOps<Tag> registryOps = registries.createSerializationContext(NbtOps.INSTANCE);
@@ -9,7 +17,7 @@
tag.store("patterns", BannerPatternLayers.CODEC, registryOps, this.patterns);
}
@@ -64,7 +_,7 @@
@@ -64,7 +64,7 @@ public class BannerBlockEntity extends BlockEntity implements Nameable {
super.loadAdditional(tag, registries);
this.name = parseCustomNameSafe(tag.get("CustomName"), registries);
RegistryOps<Tag> registryOps = registries.createSerializationContext(NbtOps.INSTANCE);
@@ -18,7 +26,7 @@
}
@Override
@@ -72,9 +_,18 @@
@@ -72,9 +72,18 @@ public class BannerBlockEntity extends BlockEntity implements Nameable {
return ClientboundBlockEntityDataPacket.create(this);
}
@@ -37,7 +45,7 @@
}
public BannerPatternLayers getPatterns() {
@@ -94,7 +_,7 @@
@@ -94,7 +103,7 @@ public class BannerBlockEntity extends BlockEntity implements Nameable {
@Override
protected void applyImplicitComponents(DataComponentGetter componentGetter) {
super.applyImplicitComponents(componentGetter);
@@ -46,7 +54,7 @@
this.name = componentGetter.get(DataComponents.CUSTOM_NAME);
}
@@ -110,4 +_,13 @@
@@ -110,4 +119,13 @@ public class BannerBlockEntity extends BlockEntity implements Nameable {
tag.remove("patterns");
tag.remove("CustomName");
}

View File

@@ -1,6 +1,14 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/world/level/block/entity/BeaconBlockEntity.java b/net/minecraft/world/level/block/entity/BeaconBlockEntity.java
index 0c7d0c29ae61c3e9d1c068f27bb84a0d71eb6d17..b77cdbf3e8cf0e9d66c9e5288ebae38c79dae1fe 100644
--- a/net/minecraft/world/level/block/entity/BeaconBlockEntity.java
+++ b/net/minecraft/world/level/block/entity/BeaconBlockEntity.java
@@ -109,6 +_,53 @@
@@ -109,6 +109,53 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider, Name
return 3;
}
};
@@ -54,7 +62,7 @@
@Nullable
static Holder<MobEffect> filterEffect(@Nullable Holder<MobEffect> effect) {
@@ -166,17 +_,26 @@
@@ -166,17 +213,26 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider, Name
blockEntity.lastCheckY++;
}
@@ -83,7 +91,7 @@
if (blockEntity.lastCheckY >= height) {
blockEntity.lastCheckY = level.getMinY() - 1;
@@ -227,35 +_,100 @@
@@ -227,35 +283,100 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider, Name
@Override
public void setRemoved() {
@@ -117,32 +125,28 @@
- if (beaconLevel >= 4 && Objects.equals(primaryEffect, secondaryEffect)) {
- i = 1;
- }
-
- int i1 = (9 + beaconLevel * 2) * 20;
- AABB aabb = new AABB(pos).inflate(d).expandTowards(0.0, level.getHeight(), 0.0);
- List<Player> entitiesOfClass = level.getEntitiesOfClass(Player.class, aabb);
-
- for (Player player : entitiesOfClass) {
- player.addEffect(new MobEffectInstance(primaryEffect, i1, i, true, true));
- }
-
- if (beaconLevel >= 4 && !Objects.equals(primaryEffect, secondaryEffect) && secondaryEffect != null) {
- for (Player player : entitiesOfClass) {
- player.addEffect(new MobEffectInstance(secondaryEffect, i1, 0, true, true));
+ double d = computeBeaconRange(beaconLevel); // Paper - diff out applyEffects logic components - see below
+ int i = computeEffectAmplifier(beaconLevel, primaryEffect, secondaryEffect); // Paper - diff out applyEffects logic components - see below
+
+ int i1 = computeEffectDuration(beaconLevel); // Paper - diff out applyEffects logic components - see below
+ List<Player> entitiesOfClass = getHumansInRange(level, pos, beaconLevel, blockEntity); // Paper - diff out applyEffects logic components - see below
+
- int i1 = (9 + beaconLevel * 2) * 20;
- AABB aabb = new AABB(pos).inflate(d).expandTowards(0.0, level.getHeight(), 0.0);
- List<Player> entitiesOfClass = level.getEntitiesOfClass(Player.class, aabb);
+ applyEffectsAndCallEvent(level, pos, entitiesOfClass, new MobEffectInstance(primaryEffect, i1, i, true, true), true); // Paper - BeaconEffectEvent
+
- for (Player player : entitiesOfClass) {
- player.addEffect(new MobEffectInstance(primaryEffect, i1, i, true, true));
+ if (hasSecondaryEffect(beaconLevel, primaryEffect, secondaryEffect)) { // Paper - diff out applyEffects logic components - see below
+ applyEffectsAndCallEvent(level, pos, entitiesOfClass, new MobEffectInstance(secondaryEffect, i1, 0, true, true), false); // Paper - BeaconEffectEvent
}
+ }
+ }
+ }
+
- if (beaconLevel >= 4 && !Objects.equals(primaryEffect, secondaryEffect) && secondaryEffect != null) {
- for (Player player : entitiesOfClass) {
- player.addEffect(new MobEffectInstance(secondaryEffect, i1, 0, true, true));
+ // Paper start - diff out applyEffects logic components
+ // Generally smarter than spigot trying to split the logic up, as that diff is giant.
+ private static int computeEffectDuration(final int beaconLevel) {
@@ -177,7 +181,6 @@
}
}
}
- }
+ return list;
+ }
+
@@ -197,12 +200,12 @@
+ if (!event.callEvent()) continue;
+ player.addEffect(org.bukkit.craftbukkit.potion.CraftPotionUtil.fromBukkit(event.getEffect()), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.BEACON);
+ }
+ }
}
+ // Paper end - BeaconEffectEvent
public static void playSound(Level level, BlockPos pos, SoundEvent sound) {
level.playSound(null, pos, sound, SoundSource.BLOCKS, 1.0F, 1.0F);
@@ -284,7 +_,7 @@
@@ -284,7 +405,7 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider, Name
@Nullable
private static Holder<MobEffect> loadEffect(CompoundTag tag, String key) {
@@ -211,7 +214,7 @@
}
@Override
@@ -292,8 +_,10 @@
@@ -292,8 +413,10 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider, Name
super.loadAdditional(tag, registries);
this.primaryPower = loadEffect(tag, "primary_effect");
this.secondaryPower = loadEffect(tag, "secondary_effect");
@@ -222,7 +225,7 @@
}
@Override
@@ -304,6 +_,7 @@
@@ -304,6 +427,7 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider, Name
tag.putInt("Levels", this.levels);
tag.storeNullable("CustomName", ComponentSerialization.CODEC, registries.createSerializationContext(NbtOps.INSTANCE), this.name);
this.lockKey.addToTag(tag, registries);
@@ -230,7 +233,7 @@
}
public void setCustomName(@Nullable Component name) {
@@ -319,7 +_,7 @@
@@ -319,7 +443,7 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider, Name
@Nullable
@Override
public AbstractContainerMenu createMenu(int containerId, Inventory playerInventory, Player player) {

View File

@@ -1,6 +1,14 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java b/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java
index ac4e5cb2eac9e8d7759f836a7e757d3f843d8e54..331eb5416307378162e39e20192ba06a047b70ea 100644
--- a/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java
+++ b/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java
@@ -79,6 +_,7 @@
@@ -79,6 +79,7 @@ public class BeehiveBlockEntity extends BlockEntity {
private List<BeehiveBlockEntity.BeeData> stored = Lists.newArrayList();
@Nullable
public BlockPos savedFlowerPos;
@@ -8,7 +16,7 @@
public BeehiveBlockEntity(BlockPos pos, BlockState blockState) {
super(BlockEntityType.BEEHIVE, pos, blockState);
@@ -112,7 +_,7 @@
@@ -112,7 +113,7 @@ public class BeehiveBlockEntity extends BlockEntity {
}
public boolean isFull() {
@@ -17,7 +25,7 @@
}
public void emptyAllLivingFromHive(@Nullable Player player, BlockState state, BeehiveBlockEntity.BeeReleaseStatus releaseStatus) {
@@ -121,7 +_,7 @@
@@ -121,7 +122,7 @@ public class BeehiveBlockEntity extends BlockEntity {
for (Entity entity : list) {
if (entity instanceof Bee bee && player.position().distanceToSqr(entity.position()) <= 16.0) {
if (!this.isSedated()) {
@@ -26,7 +34,7 @@
} else {
bee.setStayOutOfHiveCountdown(400);
}
@@ -131,8 +_,14 @@
@@ -131,8 +132,14 @@ public class BeehiveBlockEntity extends BlockEntity {
}
private List<Entity> releaseAllOccupants(BlockState state, BeehiveBlockEntity.BeeReleaseStatus releaseStatus) {
@@ -42,7 +50,7 @@
if (!list.isEmpty()) {
super.setChanged();
}
@@ -145,6 +_,11 @@
@@ -145,6 +152,11 @@ public class BeehiveBlockEntity extends BlockEntity {
return this.stored.size();
}
@@ -54,7 +62,7 @@
public static int getHoneyLevel(BlockState state) {
return state.getValue(BeehiveBlock.HONEY_LEVEL);
}
@@ -155,7 +_,16 @@
@@ -155,7 +167,16 @@ public class BeehiveBlockEntity extends BlockEntity {
}
public void addOccupant(Bee bee) {
@@ -72,7 +80,7 @@
bee.stopRiding();
bee.ejectPassengers();
bee.dropLeash();
@@ -180,7 +_,7 @@
@@ -180,7 +201,7 @@ public class BeehiveBlockEntity extends BlockEntity {
this.level.gameEvent(GameEvent.BLOCK_CHANGE, blockPos, GameEvent.Context.of(bee, this.getBlockState()));
}
@@ -81,7 +89,7 @@
super.setChanged();
}
}
@@ -198,7 +_,21 @@
@@ -198,7 +219,21 @@ public class BeehiveBlockEntity extends BlockEntity {
BeehiveBlockEntity.BeeReleaseStatus releaseStatus,
@Nullable BlockPos storedFlowerPos
) {
@@ -104,7 +112,7 @@
return false;
} else {
Direction direction = state.getValue(BeehiveBlock.FACING);
@@ -209,6 +_,17 @@
@@ -209,6 +244,17 @@ public class BeehiveBlockEntity extends BlockEntity {
} else {
Entity entity = occupant.createEntity(level, pos);
if (entity != null) {
@@ -122,7 +130,7 @@
if (entity instanceof Bee bee) {
if (storedFlowerPos != null && !bee.hasSavedFlowerPos() && level.random.nextFloat() < 0.9F) {
bee.setSavedFlowerPos(storedFlowerPos);
@@ -224,7 +_,13 @@
@@ -224,7 +270,13 @@ public class BeehiveBlockEntity extends BlockEntity {
i--;
}
@@ -137,7 +145,7 @@
}
}
}
@@ -233,17 +_,19 @@
@@ -233,17 +285,19 @@ public class BeehiveBlockEntity extends BlockEntity {
storedInHives.add(bee);
}
@@ -158,7 +166,7 @@
} else {
return false;
}
@@ -269,6 +_,11 @@
@@ -269,6 +323,11 @@ public class BeehiveBlockEntity extends BlockEntity {
flag = true;
iterator.remove();
}
@@ -170,7 +178,7 @@
}
}
@@ -292,9 +_,10 @@
@@ -292,9 +351,10 @@ public class BeehiveBlockEntity extends BlockEntity {
@Override
protected void loadAdditional(CompoundTag tag, HolderLookup.Provider registries) {
super.loadAdditional(tag, registries);
@@ -182,7 +190,7 @@
}
@Override
@@ -302,12 +_,13 @@
@@ -302,12 +362,13 @@ public class BeehiveBlockEntity extends BlockEntity {
super.saveAdditional(tag, registries);
tag.store("bees", BeehiveBlockEntity.Occupant.LIST_CODEC, this.getBees());
tag.storeNullable("flower_pos", BlockPos.CODEC, this.savedFlowerPos);
@@ -197,7 +205,7 @@
List<BeehiveBlockEntity.Occupant> list = componentGetter.getOrDefault(DataComponents.BEES, Bees.EMPTY).bees();
list.forEach(this::storeBee);
}
@@ -330,15 +_,18 @@
@@ -330,15 +391,18 @@ public class BeehiveBlockEntity extends BlockEntity {
static class BeeData {
private final BeehiveBlockEntity.Occupant occupant;
@@ -217,7 +225,7 @@
}
public BeehiveBlockEntity.Occupant toOccupant() {
@@ -409,6 +_,7 @@
@@ -409,6 +473,7 @@ public class BeehiveBlockEntity extends BlockEntity {
}
private static void setBeeReleaseData(int ticksInHive, Bee bee) {
@@ -225,7 +233,7 @@
int age = bee.getAge();
if (age < 0) {
bee.setAge(Math.min(0, age + ticksInHive));
@@ -417,6 +_,7 @@
@@ -417,6 +482,7 @@ public class BeehiveBlockEntity extends BlockEntity {
}
bee.setInLoveTime(Math.max(0, bee.getInLoveTime() - ticksInHive));

View File

@@ -1,6 +1,14 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/world/level/block/entity/BlockEntity.java b/net/minecraft/world/level/block/entity/BlockEntity.java
index 5113299200d6bb538977c525754aae95d266bdf7..7783ff94e5183737d01c75c521b70b4fbd8c34a6 100644
--- a/net/minecraft/world/level/block/entity/BlockEntity.java
+++ b/net/minecraft/world/level/block/entity/BlockEntity.java
@@ -33,6 +_,10 @@
@@ -33,6 +33,10 @@ import net.minecraft.world.level.block.state.BlockState;
import org.slf4j.Logger;
public abstract class BlockEntity {
@@ -11,7 +19,7 @@
private static final Codec<BlockEntityType<?>> TYPE_CODEC = BuiltInRegistries.BLOCK_ENTITY_TYPE.byNameCodec();
private static final Logger LOGGER = LogUtils.getLogger();
private final BlockEntityType<?> type;
@@ -48,6 +_,7 @@
@@ -48,6 +52,7 @@ public abstract class BlockEntity {
this.worldPosition = pos.immutable();
this.validateBlockState(blockState);
this.blockState = blockState;
@@ -19,7 +27,7 @@
}
private void validateBlockState(BlockState state) {
@@ -64,6 +_,7 @@
@@ -64,6 +69,7 @@ public abstract class BlockEntity {
int intOr = tag.getIntOr("x", 0);
int intOr1 = tag.getIntOr("y", 0);
int intOr2 = tag.getIntOr("z", 0);
@@ -27,7 +35,7 @@
int sectionPosCoord = SectionPos.blockToSectionCoord(intOr);
int sectionPosCoord1 = SectionPos.blockToSectionCoord(intOr2);
if (sectionPosCoord != chunkPos.x || sectionPosCoord1 != chunkPos.z) {
@@ -71,6 +_,7 @@
@@ -71,6 +77,7 @@ public abstract class BlockEntity {
intOr = chunkPos.getBlockX(SectionPos.sectionRelative(intOr));
intOr2 = chunkPos.getBlockZ(SectionPos.sectionRelative(intOr2));
}
@@ -35,7 +43,7 @@
return new BlockPos(intOr, intOr1, intOr2);
}
@@ -89,6 +_,14 @@
@@ -89,6 +96,14 @@ public abstract class BlockEntity {
}
protected void loadAdditional(CompoundTag tag, HolderLookup.Provider registries) {
@@ -50,7 +58,7 @@
}
public final void loadWithComponents(CompoundTag tag, HolderLookup.Provider registries) {
@@ -120,12 +_,22 @@
@@ -120,12 +135,22 @@ public abstract class BlockEntity {
CompoundTag compoundTag = new CompoundTag();
this.saveAdditional(compoundTag, registries);
compoundTag.store(BlockEntity.ComponentHelper.COMPONENTS_CODEC, registries.createSerializationContext(NbtOps.INSTANCE), this.components);
@@ -73,7 +81,7 @@
return compoundTag;
}
@@ -260,6 +_,12 @@
@@ -260,6 +285,12 @@ public abstract class BlockEntity {
}
public final void applyComponents(DataComponentMap components, DataComponentPatch patch) {
@@ -86,7 +94,7 @@
final Set<DataComponentType<?>> set = new HashSet<>();
set.add(DataComponents.BLOCK_ENTITY_DATA);
set.add(DataComponents.BLOCK_STATE);
@@ -280,6 +_,10 @@
@@ -280,6 +311,10 @@ public abstract class BlockEntity {
});
DataComponentPatch dataComponentPatch = patch.forget(set::contains);
this.components = dataComponentPatch.split().added();
@@ -97,11 +105,10 @@
}
protected void collectImplicitComponents(DataComponentMap.Builder components) {
@@ -313,6 +_,28 @@
.resultOrPartial(string -> LOGGER.warn("Failed to parse custom name, discarding: {}", string))
@@ -314,6 +349,28 @@ public abstract class BlockEntity {
.orElse(null);
}
+
+ // CraftBukkit start - add method
+ public org.bukkit.inventory.InventoryHolder getOwner() {
+ return getOwner(true);
@@ -123,6 +130,7 @@
+ }
+ // Paper end - Sanitize sent data
+
+
static class ComponentHelper {
public static final MapCodec<DataComponentMap> COMPONENTS_CODEC = DataComponentMap.CODEC.optionalFieldOf("components", DataComponentMap.EMPTY);

View File

@@ -1,6 +1,14 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/world/level/block/entity/CampfireBlockEntity.java b/net/minecraft/world/level/block/entity/CampfireBlockEntity.java
index aa06834e2f586b80db1cf963005f1415f957c758..780145efef0388c2c316ece0bffd8782256d2ac5 100644
--- a/net/minecraft/world/level/block/entity/CampfireBlockEntity.java
+++ b/net/minecraft/world/level/block/entity/CampfireBlockEntity.java
@@ -38,6 +_,7 @@
@@ -38,6 +38,7 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable {
private final NonNullList<ItemStack> items = NonNullList.withSize(4, ItemStack.EMPTY);
public final int[] cookingProgress = new int[4];
public final int[] cookingTime = new int[4];
@@ -8,7 +16,7 @@
public CampfireBlockEntity(BlockPos pos, BlockState blockState) {
super(BlockEntityType.CAMPFIRE, pos, blockState);
@@ -56,14 +_,44 @@
@@ -56,14 +57,44 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable {
ItemStack itemStack = campfire.items.get(i);
if (!itemStack.isEmpty()) {
flag = true;
@@ -55,7 +63,7 @@
campfire.items.set(i, ItemStack.EMPTY);
level.sendBlockUpdated(pos, state, state, 3);
level.gameEvent(GameEvent.BLOCK_CHANGE, pos, GameEvent.Context.of(state));
@@ -135,6 +_,16 @@
@@ -135,6 +166,16 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable {
.ifPresentOrElse(
ints -> System.arraycopy(ints, 0, this.cookingTime, 0, Math.min(this.cookingTime.length, ints.length)), () -> Arrays.fill(this.cookingTime, 0)
);
@@ -72,7 +80,7 @@
}
@Override
@@ -143,6 +_,13 @@
@@ -143,6 +184,13 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable {
ContainerHelper.saveAllItems(tag, this.items, true, registries);
tag.putIntArray("CookingTimes", this.cookingProgress);
tag.putIntArray("CookingTotalTimes", this.cookingTime);
@@ -86,7 +94,7 @@
}
@Override
@@ -167,7 +_,15 @@
@@ -167,7 +215,15 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable {
return false;
}

View File

@@ -1,6 +1,14 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/world/level/block/entity/ConduitBlockEntity.java b/net/minecraft/world/level/block/entity/ConduitBlockEntity.java
index 0b5e7dd0987b9892f3cddb02930254fc559b64d0..2f07a23a6151a4dfb28ddc0ab38ec2abefcdd27c 100644
--- a/net/minecraft/world/level/block/entity/ConduitBlockEntity.java
+++ b/net/minecraft/world/level/block/entity/ConduitBlockEntity.java
@@ -165,8 +_,20 @@
@@ -165,8 +165,20 @@ public class ConduitBlockEntity extends BlockEntity {
}
private static void applyEffects(Level level, BlockPos pos, List<BlockPos> positions) {
@@ -21,7 +29,7 @@
int x = pos.getX();
int y = pos.getY();
int z = pos.getZ();
@@ -175,13 +_,19 @@
@@ -175,13 +187,19 @@ public class ConduitBlockEntity extends BlockEntity {
if (!entitiesOfClass.isEmpty()) {
for (Player player : entitiesOfClass) {
if (pos.closerThan(player.blockPosition(), i) && player.isInWaterOrRain()) {
@@ -42,7 +50,7 @@
LivingEntity livingEntity = blockEntity.destroyTarget;
int size = positions.size();
if (size < 42) {
@@ -200,7 +_,8 @@
@@ -200,7 +218,8 @@ public class ConduitBlockEntity extends BlockEntity {
blockEntity.destroyTarget = null;
}
@@ -52,7 +60,7 @@
level.playSound(
null,
blockEntity.destroyTarget.getX(),
@@ -211,7 +_,6 @@
@@ -211,7 +230,6 @@ public class ConduitBlockEntity extends BlockEntity {
1.0F,
1.0F
);

View File

@@ -1,6 +1,14 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/world/level/block/entity/DecoratedPotBlockEntity.java b/net/minecraft/world/level/block/entity/DecoratedPotBlockEntity.java
index 5a160a0eaddab38d281c2a4f732619b43b6afa3e..25bf19ccbd920538dba82fa20de214f374b8c3f2 100644
--- a/net/minecraft/world/level/block/entity/DecoratedPotBlockEntity.java
+++ b/net/minecraft/world/level/block/entity/DecoratedPotBlockEntity.java
@@ -24,6 +_,48 @@
@@ -24,6 +24,48 @@ import net.minecraft.world.level.storage.loot.LootTable;
import net.minecraft.world.ticks.ContainerSingleItem;
public class DecoratedPotBlockEntity extends BlockEntity implements RandomizableContainer, ContainerSingleItem.BlockContainerSingleItem {
@@ -49,7 +57,7 @@
public static final String TAG_SHERDS = "sherds";
public static final String TAG_ITEM = "item";
public static final int EVENT_POT_WOBBLES = 1;
@@ -48,8 +_,8 @@
@@ -48,8 +90,8 @@ public class DecoratedPotBlockEntity extends BlockEntity implements Randomizable
tag.store("sherds", PotDecorations.CODEC, this.decorations);
}
@@ -60,7 +68,7 @@
}
}
@@ -72,7 +_,14 @@
@@ -72,7 +114,14 @@ public class DecoratedPotBlockEntity extends BlockEntity implements Randomizable
@Override
public CompoundTag getUpdateTag(HolderLookup.Provider registries) {

View File

@@ -1,6 +1,14 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/world/level/block/entity/SculkSensorBlockEntity.java b/net/minecraft/world/level/block/entity/SculkSensorBlockEntity.java
index 431a9a4e6eef97579e3bb58d4c0dbff7e9c410dd..26d2205fe7c1322f52e7d162e1be9dc23349f3b6 100644
--- a/net/minecraft/world/level/block/entity/SculkSensorBlockEntity.java
+++ b/net/minecraft/world/level/block/entity/SculkSensorBlockEntity.java
@@ -24,6 +_,7 @@
@@ -24,6 +24,7 @@ public class SculkSensorBlockEntity extends BlockEntity implements GameEventList
private final VibrationSystem.Listener vibrationListener;
private final VibrationSystem.User vibrationUser;
public int lastVibrationFrequency = 0;
@@ -8,7 +16,7 @@
protected SculkSensorBlockEntity(BlockEntityType<?> type, BlockPos pos, BlockState blockState) {
super(type, pos, blockState);
@@ -46,15 +_,23 @@
@@ -46,15 +47,23 @@ public class SculkSensorBlockEntity extends BlockEntity implements GameEventList
this.lastVibrationFrequency = tag.getIntOr("last_vibration_frequency", 0);
RegistryOps<Tag> registryOps = registries.createSerializationContext(NbtOps.INSTANCE);
this.vibrationData = tag.read("listener", VibrationSystem.Data.CODEC, registryOps).orElseGet(VibrationSystem.Data::new);
@@ -22,9 +30,8 @@
tag.putInt("last_vibration_frequency", this.lastVibrationFrequency);
RegistryOps<Tag> registryOps = registries.createSerializationContext(NbtOps.INSTANCE);
tag.store("listener", VibrationSystem.Data.CODEC, registryOps, this.vibrationData);
- }
+ this.saveRangeOverride(tag); // Paper - Configurable sculk sensor listener range
+ }
}
+ // Paper start - Configurable sculk sensor listener range
+ protected void saveRangeOverride(CompoundTag tag) {
+ if (this.rangeOverride != null && this.rangeOverride != VibrationUser.LISTENER_RANGE) tag.putInt(PAPER_LISTENER_RANGE_NBT_KEY, this.rangeOverride); // only save if it's different from the default
@@ -33,7 +40,7 @@
@Override
public VibrationSystem.Data getVibrationData() {
@@ -91,6 +_,7 @@
@@ -91,6 +100,7 @@ public class SculkSensorBlockEntity extends BlockEntity implements GameEventList
@Override
public int getListenerRadius() {

View File

@@ -1,6 +1,14 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/world/level/block/entity/SignBlockEntity.java b/net/minecraft/world/level/block/entity/SignBlockEntity.java
index 7ccf4c771872c852ad548d7995757671737ba423..8f87248a77c2083541105cfd1da1bc87bd122ba4 100644
--- a/net/minecraft/world/level/block/entity/SignBlockEntity.java
+++ b/net/minecraft/world/level/block/entity/SignBlockEntity.java
@@ -58,10 +_,15 @@
@@ -58,10 +58,15 @@ public class SignBlockEntity extends BlockEntity {
}
public boolean isFacingFrontText(Player player) {
@@ -18,7 +26,7 @@
float yRotationDegrees = signBlock.getYRotationDegrees(this.getBlockState());
float f = (float)(Mth.atan2(d1, d) * 180.0F / (float)Math.PI) - 90.0F;
return Mth.degreesDifferenceAbs(yRotationDegrees, f) <= 90.0F;
@@ -131,11 +_,13 @@
@@ -131,11 +136,13 @@ public class SignBlockEntity extends BlockEntity {
public void updateSignText(Player player, boolean isFrontText, List<FilteredText> filteredText) {
if (!this.isWaxed() && player.getUUID().equals(this.getPlayerWhoMayEdit()) && this.level != null) {
@@ -33,7 +41,7 @@
}
}
@@ -144,18 +_,40 @@
@@ -144,19 +151,41 @@ public class SignBlockEntity extends BlockEntity {
return this.setText(updater.apply(text), isFrontText);
}
@@ -53,7 +61,7 @@
);
}
}
+
+ // CraftBukkit start
+ org.bukkit.entity.Player apiPlayer = ((net.minecraft.server.level.ServerPlayer) player).getBukkitEntity();
+ List<net.kyori.adventure.text.Component> lines = new java.util.ArrayList<>(); // Paper - adventure
@@ -74,10 +82,11 @@
+ }
+ }
+ // CraftBukkit end
+
return text;
}
@@ -193,8 +_,24 @@
@@ -193,8 +222,24 @@ public class SignBlockEntity extends BlockEntity {
for (Component component : this.getText(frontText).getMessages(player.isTextFilteringEnabled())) {
Style style = component.getStyle();
@@ -104,7 +113,7 @@
flag = true;
}
}
@@ -202,10 +_,55 @@
@@ -202,10 +247,55 @@ public class SignBlockEntity extends BlockEntity {
return flag;
}
@@ -162,7 +171,7 @@
}
@Override
@@ -224,12 +_,17 @@
@@ -224,12 +314,17 @@ public class SignBlockEntity extends BlockEntity {
@Nullable
public UUID getPlayerWhoMayEdit() {

View File

@@ -1,6 +1,14 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/world/level/block/entity/TestBlockEntity.java b/net/minecraft/world/level/block/entity/TestBlockEntity.java
index 09ba8ecc0af8da4ec95080d6502bf1734616eebc..b97db8a9883a5680eb55238536da0a15e382253a 100644
--- a/net/minecraft/world/level/block/entity/TestBlockEntity.java
+++ b/net/minecraft/world/level/block/entity/TestBlockEntity.java
@@ -36,6 +_,7 @@
@@ -36,6 +36,7 @@ public class TestBlockEntity extends BlockEntity {
@Override
public void loadAdditional(CompoundTag tag, HolderLookup.Provider registries) {

View File

@@ -1,6 +1,14 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/world/level/block/entity/TestInstanceBlockEntity.java b/net/minecraft/world/level/block/entity/TestInstanceBlockEntity.java
index 01698814938eda15b8cf66e271aa42a4b272deac..4ec8b523bce215454045e2c082a09e6b22afa37b 100644
--- a/net/minecraft/world/level/block/entity/TestInstanceBlockEntity.java
+++ b/net/minecraft/world/level/block/entity/TestInstanceBlockEntity.java
@@ -157,6 +_,7 @@
@@ -157,6 +157,7 @@ public class TestInstanceBlockEntity extends BlockEntity implements BeaconBeamOw
@Override
protected void loadAdditional(CompoundTag tag, HolderLookup.Provider registries) {
@@ -8,7 +16,7 @@
Tag tag1 = tag.get("data");
if (tag1 != null) {
TestInstanceBlockEntity.Data.CODEC.parse(NbtOps.INSTANCE, tag1).ifSuccess(this::set);
@@ -320,7 +_,7 @@
@@ -320,7 +321,7 @@ public class TestInstanceBlockEntity extends BlockEntity implements BeaconBeamOw
}
private void removeEntities() {

View File

@@ -1,6 +1,14 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/world/level/block/entity/trialspawner/TrialSpawner.java b/net/minecraft/world/level/block/entity/trialspawner/TrialSpawner.java
index d0a5a5de539c80dbb7a684dc2fb845e3d5e602bd..8073911c2119864685d8fcd56d4f11fd0c340808 100644
--- a/net/minecraft/world/level/block/entity/trialspawner/TrialSpawner.java
+++ b/net/minecraft/world/level/block/entity/trialspawner/TrialSpawner.java
@@ -238,7 +_,14 @@
@@ -238,7 +238,14 @@ public final class TrialSpawner {
nextSpawnData.getEquipment().ifPresent(mob::equip);
}
@@ -16,7 +24,7 @@
return Optional.empty();
} else {
TrialSpawner.FlameParticle flameParticle = this.isOminous ? TrialSpawner.FlameParticle.OMINOUS : TrialSpawner.FlameParticle.NORMAL;
@@ -258,6 +_,19 @@
@@ -258,6 +265,19 @@ public final class TrialSpawner {
LootParams lootParams = new LootParams.Builder(level).create(LootContextParamSets.EMPTY);
ObjectArrayList<ItemStack> randomItems = lootTable1.getRandomItems(lootParams);
if (!randomItems.isEmpty()) {

View File

@@ -1,6 +1,14 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/world/level/block/entity/trialspawner/TrialSpawnerData.java b/net/minecraft/world/level/block/entity/trialspawner/TrialSpawnerData.java
index 11db32434437d3e69724d196ab89a9df5aaadeff..f46427af9c55668d1504ae0e4f50179cbe85b0ca 100644
--- a/net/minecraft/world/level/block/entity/trialspawner/TrialSpawnerData.java
+++ b/net/minecraft/world/level/block/entity/trialspawner/TrialSpawnerData.java
@@ -197,7 +_,7 @@
@@ -197,7 +197,7 @@ public class TrialSpawnerData {
mob.dropPreservedEquipment(level);
}

View File

@@ -1,6 +1,14 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/world/level/chunk/status/ChunkStatusTasks.java b/net/minecraft/world/level/chunk/status/ChunkStatusTasks.java
index 78dca709b9cbae5fd8360ae2cf40eaa4d6b90c48..dc9c612b245275900ae43f7a45e7be755853207c 100644
--- a/net/minecraft/world/level/chunk/status/ChunkStatusTasks.java
+++ b/net/minecraft/world/level/chunk/status/ChunkStatusTasks.java
@@ -35,7 +_,7 @@
@@ -35,7 +35,7 @@ public class ChunkStatusTasks {
WorldGenContext worldGenContext, ChunkStep step, StaticCache2D<GenerationChunkHolder> cache, ChunkAccess chunk
) {
ServerLevel serverLevel = worldGenContext.level();
@@ -9,13 +17,11 @@
worldGenContext.generator()
.createStructures(
serverLevel.registryAccess(),
@@ -198,7 +_,58 @@
@@ -198,7 +198,58 @@ public class ChunkStatusTasks {
public static void postLoadProtoChunk(ServerLevel level, List<CompoundTag> entityTags) {
if (!entityTags.isEmpty()) {
- level.addWorldGenChunkEntities(EntityType.loadEntitiesRecursive(entityTags, level, EntitySpawnReason.LOAD));
- }
- }
+ // CraftBukkit start - these are spawned serialized (DefinedStructure) and we don't call an add event below at the moment due to ordering complexities
+ level.addWorldGenChunkEntities(EntityType.loadEntitiesRecursive(entityTags, level, EntitySpawnReason.LOAD).filter((entity) -> {
+ boolean needsRemoval = false;
@@ -66,8 +72,8 @@
+ default:
+ break;
+ }
+ }
}
+ return false;
+ }
}
+ // Paper end - duplicate uuid resolving
}

View File

@@ -1,6 +1,14 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/world/level/entity/PersistentEntitySectionManager.java b/net/minecraft/world/level/entity/PersistentEntitySectionManager.java
index 54c2093b114661834d9cc856be16439bec8bb7a0..3d9af34c6eb4ac4fb07ccd8709066cc58a36186a 100644
--- a/net/minecraft/world/level/entity/PersistentEntitySectionManager.java
+++ b/net/minecraft/world/level/entity/PersistentEntitySectionManager.java
@@ -52,6 +_,16 @@
@@ -52,6 +52,16 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A
this.entityGetter = new LevelEntityGetterAdapter<>(this.visibleEntityStorage, this.sectionStorage);
}
@@ -17,7 +25,7 @@
void removeSectionIfEmpty(long sectionKey, EntitySection<T> section) {
if (section.isEmpty()) {
this.sectionStorage.remove(sectionKey);
@@ -59,6 +_,7 @@
@@ -59,6 +69,7 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A
}
private boolean addEntityUuid(T entity) {
@@ -25,7 +33,7 @@
if (!this.knownUuids.add(entity.getUUID())) {
LOGGER.warn("UUID of added entity already exists: {}", entity);
return false;
@@ -72,6 +_,17 @@
@@ -72,6 +83,17 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A
}
private boolean addEntity(T entity, boolean worldGenSpawned) {
@@ -43,7 +51,7 @@
if (!this.addEntityUuid(entity)) {
return false;
} else {
@@ -113,19 +_,23 @@
@@ -113,19 +135,23 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A
}
void startTicking(T entity) {
@@ -67,7 +75,7 @@
this.callbacks.onTrackingEnd(entity);
this.visibleEntityStorage.remove(entity);
}
@@ -136,6 +_,7 @@
@@ -136,6 +162,7 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A
}
public void updateChunkStatus(ChunkPos pos, Visibility visibility) {
@@ -75,7 +83,7 @@
long packedChunkPos = pos.toLong();
if (visibility == Visibility.HIDDEN) {
this.chunkVisibility.remove(packedChunkPos);
@@ -169,6 +_,7 @@
@@ -169,6 +196,7 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A
}
public void ensureChunkQueuedForLoad(long chunkPosValue) {
@@ -83,7 +91,7 @@
PersistentEntitySectionManager.ChunkLoadStatus chunkLoadStatus = this.chunkLoadStatuses.get(chunkPosValue);
if (chunkLoadStatus == PersistentEntitySectionManager.ChunkLoadStatus.FRESH) {
this.requestChunkLoad(chunkPosValue);
@@ -176,6 +_,11 @@
@@ -176,6 +204,11 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A
}
private boolean storeChunkSections(long chunkPosValue, Consumer<T> entityAction) {
@@ -95,7 +103,7 @@
PersistentEntitySectionManager.ChunkLoadStatus chunkLoadStatus = this.chunkLoadStatuses.get(chunkPosValue);
if (chunkLoadStatus == PersistentEntitySectionManager.ChunkLoadStatus.PENDING) {
return false;
@@ -186,6 +_,7 @@
@@ -186,6 +219,7 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A
.collect(Collectors.toList());
if (list.isEmpty()) {
if (chunkLoadStatus == PersistentEntitySectionManager.ChunkLoadStatus.LOADED) {
@@ -103,7 +111,7 @@
this.permanentStorage.storeEntities(new ChunkEntities<>(new ChunkPos(chunkPosValue), ImmutableList.of()));
}
@@ -194,6 +_,7 @@
@@ -194,6 +228,7 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A
this.requestChunkLoad(chunkPosValue);
return false;
} else {
@@ -111,7 +119,7 @@
this.permanentStorage.storeEntities(new ChunkEntities<>(new ChunkPos(chunkPosValue), list));
list.forEach(entityAction);
return true;
@@ -202,6 +_,7 @@
@@ -202,6 +237,7 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A
}
private void requestChunkLoad(long chunkPosValue) {
@@ -119,7 +127,7 @@
this.chunkLoadStatuses.put(chunkPosValue, PersistentEntitySectionManager.ChunkLoadStatus.PENDING);
ChunkPos chunkPos = new ChunkPos(chunkPosValue);
this.permanentStorage.loadEntities(chunkPos).thenAccept(this.loadingInbox::add).exceptionally(throwable -> {
@@ -211,7 +_,8 @@
@@ -211,7 +247,8 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A
}
private boolean processChunkUnload(long chunkPosValue) {
@@ -129,7 +137,7 @@
if (!flag) {
return false;
} else {
@@ -221,7 +_,7 @@
@@ -221,7 +258,7 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A
}
private void unloadEntity(EntityAccess entity) {
@@ -138,7 +146,7 @@
entity.setLevelCallback(EntityInLevelCallback.NULL);
}
@@ -231,14 +_,20 @@
@@ -231,14 +268,20 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A
}
private void processPendingLoads() {
@@ -159,7 +167,7 @@
this.processPendingLoads();
this.processUnloads();
}
@@ -256,6 +_,7 @@
@@ -256,6 +299,7 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A
}
public void autoSave() {
@@ -167,7 +175,7 @@
this.getAllChunksToSave().forEach(packedChunkPos -> {
boolean flag = this.chunkVisibility.get(packedChunkPos) == Visibility.HIDDEN;
if (flag) {
@@ -267,6 +_,7 @@
@@ -267,6 +311,7 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A
}
public void saveAll() {
@@ -175,7 +183,7 @@
LongSet allChunksToSave = this.getAllChunksToSave();
while (!allChunksToSave.isEmpty()) {
@@ -283,7 +_,13 @@
@@ -283,7 +328,13 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A
@Override
public void close() throws IOException {
@@ -190,7 +198,7 @@
this.permanentStorage.close();
}
@@ -384,6 +_,7 @@
@@ -384,6 +435,7 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A
BlockPos blockPos = this.entity.blockPosition();
long packedSectionPos = SectionPos.asLong(blockPos);
if (packedSectionPos != this.currentSectionKey) {
@@ -198,7 +206,7 @@
Visibility status = this.currentSection.getStatus();
if (!this.currentSection.remove(this.entity)) {
PersistentEntitySectionManager.LOGGER
@@ -431,6 +_,7 @@
@@ -431,6 +483,7 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A
@Override
public void onRemove(Entity.RemovalReason reason) {

View File

@@ -1,6 +1,14 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java b/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java
index b7965fd610b90f5674aae3571ab9a35e29d3d4f5..bb8b5ca9044ecb33687e7f20cfb0acbf55f887c7 100644
--- a/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java
+++ b/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java
@@ -73,6 +_,10 @@
@@ -73,6 +73,10 @@ public class StructureTemplate {
public final List<StructureTemplate.StructureEntityInfo> entityInfoList = Lists.newArrayList();
private Vec3i size = Vec3i.ZERO;
private String author = "?";
@@ -11,7 +19,7 @@
public Vec3i getSize() {
return this.size;
@@ -247,6 +_,19 @@
@@ -247,6 +251,19 @@ public class StructureTemplate {
if (this.palettes.isEmpty()) {
return false;
} else {
@@ -31,7 +39,7 @@
List<StructureTemplate.StructureBlockInfo> list = settings.getRandomPalette(this.palettes, offset).blocks();
if ((!list.isEmpty() || !settings.isIgnoreEntities() && !this.entityInfoList.isEmpty())
&& this.size.getX() >= 1
@@ -272,6 +_,21 @@
@@ -272,6 +289,21 @@ public class StructureTemplate {
serverLevel.setBlock(blockPos, Blocks.BARRIER.defaultBlockState(), 820);
}
@@ -53,7 +61,7 @@
if (serverLevel.setBlock(blockPos, blockState, flags)) {
i = Math.min(i, blockPos.getX());
i1 = Math.min(i1, blockPos.getY());
@@ -283,7 +_,7 @@
@@ -283,7 +315,7 @@ public class StructureTemplate {
if (structureBlockInfo.nbt != null) {
BlockEntity blockEntity = serverLevel.getBlockEntity(blockPos);
if (blockEntity != null) {
@@ -62,7 +70,7 @@
structureBlockInfo.nbt.putLong("LootTableSeed", random.nextLong());
}
@@ -366,7 +_,11 @@
@@ -366,7 +398,11 @@ public class StructureTemplate {
if (pair1.getSecond() != null) {
BlockEntity blockEntity = serverLevel.getBlockEntity(blockPos4);
if (blockEntity != null) {
@@ -75,7 +83,7 @@
}
}
}
@@ -374,7 +_,7 @@
@@ -374,7 +410,7 @@ public class StructureTemplate {
if (!settings.isIgnoreEntities()) {
this.placeEntities(
@@ -84,7 +92,7 @@
offset,
settings.getMirror(),
settings.getRotation(),
@@ -488,14 +_,17 @@
@@ -488,14 +524,17 @@ public class StructureTemplate {
);
}
}
@@ -107,7 +115,7 @@
}
public Vec3i getSize(Rotation rotation) {
@@ -688,6 +_,11 @@
@@ -688,6 +727,11 @@ public class StructureTemplate {
tag.put("entities", listTag3);
tag.put("size", this.newIntegerList(this.size.getX(), this.size.getY(), this.size.getZ()));
@@ -119,7 +127,7 @@
return NbtUtils.addCurrentDataVersion(tag);
}
@@ -718,6 +_,11 @@
@@ -718,6 +762,11 @@ public class StructureTemplate {
.ifPresent(compoundTag1 -> this.entityInfoList.add(new StructureTemplate.StructureEntityInfo(vec3, blockPos, compoundTag1)));
}
);
@@ -131,7 +139,7 @@
}
private void loadPalette(HolderGetter<Block> blockGetter, ListTag paletteTag, ListTag blocksTag) {
@@ -817,7 +_,7 @@
@@ -817,7 +866,7 @@ public class StructureTemplate {
public static final class Palette {
private final List<StructureTemplate.StructureBlockInfo> blocks;

View File

@@ -1,6 +1,14 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/world/level/portal/TeleportTransition.java b/net/minecraft/world/level/portal/TeleportTransition.java
index d86dfd1b12d9b0fb816834934108ceba2da8e951..de028b984d737bf8ca2f235887c8cd053cd44241 100644
--- a/net/minecraft/world/level/portal/TeleportTransition.java
+++ b/net/minecraft/world/level/portal/TeleportTransition.java
@@ -19,15 +_,34 @@
@@ -19,15 +19,34 @@ public record TeleportTransition(
boolean asPassenger,
Set<Relative> relatives,
TeleportTransition.PostTeleportTransition postTeleportTransition
@@ -36,7 +44,7 @@
}
public TeleportTransition(
@@ -39,11 +_,30 @@
@@ -39,11 +58,30 @@ public record TeleportTransition(
Set<Relative> relatives,
TeleportTransition.PostTeleportTransition postTeleportTransition
) {
@@ -69,7 +77,7 @@
}
private static void playPortalSound(Entity entity) {
@@ -57,7 +_,7 @@
@@ -57,7 +95,7 @@ public record TeleportTransition(
}
public static TeleportTransition missingRespawnBlock(ServerLevel level, Entity entity, TeleportTransition.PostTeleportTransition postTeleportTransition) {

View File

@@ -1,6 +1,14 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/world/level/storage/PlayerDataStorage.java b/net/minecraft/world/level/storage/PlayerDataStorage.java
index cd6cf2da514a1128c8761c99aa9ddd13ceca9073..ab9282c04c1996b037567d07f95e2b150bcfcd38 100644
--- a/net/minecraft/world/level/storage/PlayerDataStorage.java
+++ b/net/minecraft/world/level/storage/PlayerDataStorage.java
@@ -31,6 +_,7 @@
@@ -31,6 +31,7 @@ public class PlayerDataStorage {
}
public void save(Player player) {
@@ -8,7 +16,7 @@
try {
CompoundTag compoundTag = player.saveWithoutId(new CompoundTag());
Path path = this.playerDir.toPath();
@@ -40,30 +_,46 @@
@@ -40,30 +41,46 @@ public class PlayerDataStorage {
Path path3 = path.resolve(player.getStringUUID() + ".dat_old");
Util.safeReplaceFile(path2, path1, path3);
} catch (Exception var7) {
@@ -64,7 +72,7 @@
}
}
@@ -71,16 +_,40 @@
@@ -71,16 +88,40 @@ public class PlayerDataStorage {
}
public Optional<CompoundTag> load(Player player) {

View File

@@ -1,6 +1,14 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/world/level/storage/loot/LootDataType.java b/net/minecraft/world/level/storage/loot/LootDataType.java
index 066354a668f8b4741db9290662d9639b18552ea3..51a1a82f6ce68c56c7437fae40172e65cb517d0d 100644
--- a/net/minecraft/world/level/storage/loot/LootDataType.java
+++ b/net/minecraft/world/level/storage/loot/LootDataType.java
@@ -31,9 +_,14 @@
@@ -31,9 +31,14 @@ public record LootDataType<T>(ResourceKey<Registry<T>> registryKey, Codec<T> cod
}
private static LootDataType.Validator<LootTable> createLootTableValidator() {

Some files were not shown because too many files have changed in this diff Show More