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 group=io.papermc.paper
version=1.21.5-R0.1-SNAPSHOT version=1.21.6-R0.1-SNAPSHOT
mcVersion=1.21.5 mcVersion=1.21.6-pre1
# Set to true while updating Minecraft version # Set to true while updating Minecraft version
updatingMinecraft=true updatingMinecraft=true

View File

@@ -15,7 +15,7 @@ plugins {
val paperMavenPublicUrl = "https://repo.papermc.io/repository/maven-public/" val paperMavenPublicUrl = "https://repo.papermc.io/repository/maven-public/"
dependencies { 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") paperclip("io.papermc:paperclip:3.0.3")
testRuntimeOnly("org.junit.platform:junit-platform-launcher") testRuntimeOnly("org.junit.platform:junit-platform-launcher")
} }
@@ -24,9 +24,9 @@ paperweight {
minecraftVersion = providers.gradleProperty("mcVersion") minecraftVersion = providers.gradleProperty("mcVersion")
gitFilePatches = false gitFilePatches = false
//updatingMinecraft { updatingMinecraft {
// oldPaperCommit = "f4f275519f7c1fbe9db173b7144a4fe81440e365" oldPaperCommit = "a033e3b9ef78cfe85be807ac3fd1dd956274d4db"
//} }
spigot { spigot {
buildDataRef = "702e1a0a5072b2c4082371d5228cb30525687efc" 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 --- a/net/minecraft/commands/CommandSourceStack.java
+++ b/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.Vec2;
import net.minecraft.world.phys.Vec3; 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_PLAYER = new SimpleCommandExceptionType(Component.translatable("permissions.requires.player"));
public static final SimpleCommandExceptionType ERROR_NOT_ENTITY = new SimpleCommandExceptionType(Component.translatable("permissions.requires.entity")); public static final SimpleCommandExceptionType ERROR_NOT_ENTITY = new SimpleCommandExceptionType(Component.translatable("permissions.requires.entity"));
public final CommandSource source; public final CommandSource source;
@@ -63,6 +_,8 @@ @@ -63,6 +63,8 @@ public class CommandSourceStack implements ExecutionCommandSource<CommandSourceS
private final Vec2 rotation; private final Vec2 rotation;
private final CommandSigningContext signingContext; private final CommandSigningContext signingContext;
private final TaskChainer chatMessageChainer; private final TaskChainer chatMessageChainer;
@@ -18,7 +26,7 @@
public CommandSourceStack( public CommandSourceStack(
CommandSource source, CommandSource source,
@@ -188,6 +_,30 @@ @@ -188,6 +190,30 @@ public class CommandSourceStack implements ExecutionCommandSource<CommandSourceS
); );
} }
@@ -49,7 +57,7 @@
public CommandSourceStack withRotation(Vec2 rotation) { public CommandSourceStack withRotation(Vec2 rotation) {
return this.rotation.equals(rotation) return this.rotation.equals(rotation)
? this ? this
@@ -391,9 +_,44 @@ @@ -391,9 +417,44 @@ public class CommandSourceStack implements ExecutionCommandSource<CommandSourceS
@Override @Override
public boolean hasPermission(int level) { public boolean hasPermission(int level) {
@@ -94,7 +102,7 @@
public Vec3 getPosition() { public Vec3 getPosition() {
return this.worldPosition; 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); Component component = Component.translatable("chat.type.admin", this.getDisplayName(), message).withStyle(ChatFormatting.GRAY, ChatFormatting.ITALIC);
if (this.server.getGameRules().getBoolean(GameRules.RULE_SENDCOMMANDFEEDBACK)) { if (this.server.getGameRules().getBoolean(GameRules.RULE_SENDCOMMANDFEEDBACK)) {
for (ServerPlayer serverPlayer : this.server.getPlayerList().getPlayers()) { 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 @Override
public Collection<String> getOnlinePlayerNames() { public Collection<String> getOnlinePlayerNames() {
@@ -132,7 +140,7 @@
} }
@Override @Override
@@ -597,4 +_,16 @@ @@ -597,4 +663,16 @@ public class CommandSourceStack implements ExecutionCommandSource<CommandSourceS
public boolean isSilent() { public boolean isSilent() {
return this.silent; 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 --- a/net/minecraft/commands/Commands.java
+++ b/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<>(); private final CommandDispatcher<CommandSourceStack> dispatcher = new CommandDispatcher<>();
public Commands(Commands.CommandSelection selection, CommandBuildContext context) { public Commands(Commands.CommandSelection selection, CommandBuildContext context) {
@@ -12,7 +20,7 @@
AdvancementCommands.register(this.dispatcher); AdvancementCommands.register(this.dispatcher);
AttributeCommand.register(this.dispatcher, context); AttributeCommand.register(this.dispatcher, context);
ExecuteCommand.register(this.dispatcher, context); ExecuteCommand.register(this.dispatcher, context);
@@ -251,6 +_,40 @@ @@ -251,6 +256,40 @@ public class Commands {
PublishCommand.register(this.dispatcher); PublishCommand.register(this.dispatcher);
} }
@@ -53,7 +61,7 @@
this.dispatcher.setConsumer(ExecutionCommandSource.resultConsumer()); this.dispatcher.setConsumer(ExecutionCommandSource.resultConsumer());
} }
@@ -260,15 +_,58 @@ @@ -260,15 +299,58 @@ public class Commands {
return new ParseResults<>(commandContextBuilder, parseResults.getReader(), parseResults.getExceptions()); return new ParseResults<>(commandContextBuilder, parseResults.getReader(), parseResults.getExceptions());
} }
@@ -114,7 +122,7 @@
try { try {
if (contextChain != null) { if (contextChain != null) {
@@ -280,9 +_,10 @@ @@ -280,9 +362,10 @@ public class Commands {
); );
} }
} catch (Exception var12) { } catch (Exception var12) {
@@ -127,7 +135,7 @@
StackTraceElement[] stackTrace = var12.getStackTrace(); StackTraceElement[] stackTrace = var12.getStackTrace();
for (int i = 0; i < Math.min(stackTrace.length, 3); i++) { for (int i = 0; i < Math.min(stackTrace.length, 3); i++) {
@@ -308,18 +_,22 @@ @@ -308,18 +391,22 @@ public class Commands {
} }
@Nullable @Nullable
@@ -153,7 +161,7 @@
if (min > 10) { if (min > 10) {
mutableComponent.append(CommonComponents.ELLIPSIS); 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)); mutableComponent.append(Component.translatable("command.context.here").withStyle(ChatFormatting.RED, ChatFormatting.ITALIC));
@@ -172,7 +180,7 @@
} }
return null; return null;
@@ -359,26 +_,121 @@ @@ -359,26 +456,121 @@ public class Commands {
} }
public void sendCommands(ServerPlayer player) { 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.wrappedCached != null && commandNode.wrappedCached.apiCommandMeta != null && commandNode.wrappedCached.apiCommandMeta.serverSideOnly()) continue; // Paper
if (commandNode.canUse(source)) { if (commandNode.canUse(source)) {
ArgumentBuilder<SharedSuggestionProvider, ?> argumentBuilder = (ArgumentBuilder) commandNode.createBuilder(); ArgumentBuilder<SharedSuggestionProvider, ?> argumentBuilder = (ArgumentBuilder) commandNode.createBuilder();
- argumentBuilder.requires(suggestions -> true);
- if (argumentBuilder.getCommand() != null) {
- argumentBuilder.executes(commandContext -> 0);
+ // Paper start + // Paper start
+ /* + /*
+ Because of how commands can be yeeted right left and center due to bad bukkit practices + Because of how commands can be yeeted right left and center due to bad bukkit practices
@@ -288,19 +299,16 @@
+ } + }
+ +
+ argumentBuilder = builder; + argumentBuilder = builder;
+ } }
+ // Paper end + // Paper end
argumentBuilder.requires(suggestions -> true); + argumentBuilder.requires(suggestions -> true);
- if (argumentBuilder.getCommand() != null) {
- argumentBuilder.executes(commandContext -> 0);
- }
+ // Paper - don't replace Command instance on suggestion node + // Paper - don't replace Command instance on suggestion node
+ // we want the exact command instance to be used for equality checks + // we want the exact command instance to be used for equality checks
+ // when assigning serialization ids to each command node + // when assigning serialization ids to each command node
if (argumentBuilder instanceof RequiredArgumentBuilder requiredArgumentBuilder if (argumentBuilder instanceof RequiredArgumentBuilder requiredArgumentBuilder
&& requiredArgumentBuilder.getSuggestionsProvider() != null) { && requiredArgumentBuilder.getSuggestionsProvider() != null) {
@@ -393,7 +_,7 @@ @@ -393,7 +585,7 @@ public class Commands {
commandNodeToSuggestionNode.put(commandNode, commandNode1); commandNodeToSuggestionNode.put(commandNode, commandNode1);
rootSuggestion.addChild(commandNode1); rootSuggestion.addChild(commandNode1);
if (!commandNode.getChildren().isEmpty()) { 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 --- a/net/minecraft/commands/arguments/selector/EntitySelector.java
+++ b/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 { 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 --- a/net/minecraft/commands/arguments/selector/EntitySelectorParser.java
+++ b/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) { public static <S> boolean allowSelectors(S suggestionProvider) {
@@ -12,7 +20,7 @@
return suggestionProvider instanceof SharedSuggestionProvider sharedSuggestionProvider && sharedSuggestionProvider.hasPermission(2); 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; this.suggestions = this::suggestSelector;
if (!this.reader.canRead()) { if (!this.reader.canRead()) {
throw ERROR_MISSING_SELECTOR_TYPE.createWithContext(this.reader); throw ERROR_MISSING_SELECTOR_TYPE.createWithContext(this.reader);
@@ -467,6 +_,12 @@ @@ -467,6 +474,12 @@ public class EntitySelectorParser {
} }
public EntitySelector parse() throws CommandSyntaxException { public EntitySelector parse() throws CommandSyntaxException {
@@ -38,7 +46,7 @@
this.startPosition = this.reader.getCursor(); this.startPosition = this.reader.getCursor();
this.suggestions = this::suggestNameOrSelector; this.suggestions = this::suggestNameOrSelector;
if (this.reader.canRead() && this.reader.peek() == '@') { if (this.reader.canRead() && this.reader.peek() == '@') {
@@ -475,7 +_,7 @@ @@ -475,7 +488,7 @@ public class EntitySelectorParser {
} }
this.reader.skip(); 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 --- a/net/minecraft/core/dispenser/ShearsDispenseItemBehavior.java
+++ b/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 @Override
protected ItemStack execute(BlockSource blockSource, ItemStack item) { protected ItemStack execute(BlockSource blockSource, ItemStack item) {
ServerLevel serverLevel = blockSource.level(); ServerLevel serverLevel = blockSource.level();
@@ -32,7 +40,7 @@
if (this.isSuccess()) { if (this.isSuccess()) {
item.hurtAndBreak(1, serverLevel, null, item1 -> {}); item.hurtAndBreak(1, serverLevel, null, item1 -> {});
} }
@@ -50,10 +_,18 @@ @@ -50,10 +71,18 @@ public class ShearsDispenseItemBehavior extends OptionalDispenseItemBehavior {
return false; 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 --- a/net/minecraft/nbt/CompoundTag.java
+++ b/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 { private static CompoundTag loadCompound(DataInput input, NbtAccounter nbtAccounter) throws IOException {
nbtAccounter.accountBytes(48L); nbtAccounter.accountBytes(48L);
@@ -9,7 +17,7 @@
byte b; byte b;
while ((b = input.readByte()) != 0) { while ((b = input.readByte()) != 0) {
@@ -171,7 +_,7 @@ @@ -171,7 +171,7 @@ public final class CompoundTag implements Tag {
} }
public CompoundTag() { public CompoundTag() {
@@ -18,7 +26,7 @@
} }
@Override @Override
@@ -402,9 +_,16 @@ @@ -402,9 +402,16 @@ public final class CompoundTag implements Tag {
@Override @Override
public CompoundTag copy() { public CompoundTag copy() {
@@ -38,7 +46,7 @@
} }
@Override @Override
@@ -525,22 +_,47 @@ @@ -525,22 +532,47 @@ public final class CompoundTag implements Tag {
this.merge((CompoundTag)mapCodec.encoder().encodeStart(ops, data).getOrThrow()); 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 --- a/net/minecraft/network/protocol/login/ClientboundLoginDisconnectPacket.java
+++ b/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) { 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 --- a/net/minecraft/server/Main.java
+++ b/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" reason = "System.out needed before bootstrap"
) )
@DontObfuscate @DontObfuscate
@@ -12,7 +20,7 @@
OptionParser optionParser = new OptionParser(); OptionParser optionParser = new OptionParser();
OptionSpec<Void> optionSpec = optionParser.accepts("nogui"); OptionSpec<Void> optionSpec = optionParser.accepts("nogui");
OptionSpec<Void> optionSpec1 = optionParser.accepts("initSettings", "Initializes 'server.properties' and 'eula.txt', then quits"); 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); optionParser.printHelpOn(System.err);
return; return;
} }
@@ -116,7 +124,7 @@
Dynamic<?> dataTag; Dynamic<?> dataTag;
if (levelStorageAccess.hasWorldData()) { if (levelStorageAccess.hasWorldData()) {
LevelSummary summary; LevelSummary summary;
@@ -169,12 +_,33 @@ @@ -169,12 +224,33 @@ public class Main {
} }
Dynamic<?> dynamic = dataTag; Dynamic<?> dynamic = dataTag;
@@ -151,7 +159,7 @@
WorldStem worldStem; WorldStem worldStem;
try { try {
@@ -183,6 +_,7 @@ @@ -183,6 +259,7 @@ public class Main {
executor -> WorldLoader.load( executor -> WorldLoader.load(
initConfig, initConfig,
context -> { context -> {
@@ -159,7 +167,7 @@
Registry<LevelStem> registry = context.datapackDimensions().lookupOrThrow(Registries.LEVEL_STEM); Registry<LevelStem> registry = context.datapackDimensions().lookupOrThrow(Registries.LEVEL_STEM);
if (dynamic != null) { if (dynamic != null) {
LevelDataAndDimensions levelDataAndDimensions = LevelStorageSource.getLevelDataAndDimensions( LevelDataAndDimensions levelDataAndDimensions = LevelStorageSource.getLevelDataAndDimensions(
@@ -196,7 +_,7 @@ @@ -196,7 +273,7 @@ public class Main {
LevelSettings levelSettings; LevelSettings levelSettings;
WorldOptions worldOptions; WorldOptions worldOptions;
WorldDimensions worldDimensions; WorldDimensions worldDimensions;
@@ -168,7 +176,7 @@
levelSettings = MinecraftServer.DEMO_SETTINGS; levelSettings = MinecraftServer.DEMO_SETTINGS;
worldOptions = WorldOptions.DEMO_OPTIONS; worldOptions = WorldOptions.DEMO_OPTIONS;
worldDimensions = WorldPresets.createNormalWorldDimensions(context.datapackWorldgen()); worldDimensions = WorldPresets.createNormalWorldDimensions(context.datapackWorldgen());
@@ -211,7 +_,7 @@ @@ -211,7 +288,7 @@ public class Main {
new GameRules(context.dataConfiguration().enabledFeatures()), new GameRules(context.dataConfiguration().enabledFeatures()),
context.dataConfiguration() context.dataConfiguration()
); );
@@ -177,7 +185,7 @@
worldDimensions = properties.createDimensions(context.datapackWorldgen()); worldDimensions = properties.createDimensions(context.datapackWorldgen());
} }
@@ -237,6 +_,7 @@ @@ -237,6 +314,7 @@ public class Main {
return; return;
} }
@@ -185,7 +193,7 @@
RegistryAccess.Frozen frozen = worldStem.registries().compositeAccess(); RegistryAccess.Frozen frozen = worldStem.registries().compositeAccess();
WorldData worldData = worldStem.worldData(); WorldData worldData = worldStem.worldData();
boolean hasOptionSpec1 = optionSet.has(optionSpec6); boolean hasOptionSpec1 = optionSet.has(optionSpec6);
@@ -245,9 +_,13 @@ @@ -245,9 +323,13 @@ public class Main {
} }
levelStorageAccess.saveDataTag(frozen, worldData); levelStorageAccess.saveDataTag(frozen, worldData);
@@ -199,7 +207,7 @@
thread1, thread1,
levelStorageAccess, levelStorageAccess,
packRepository, packRepository,
@@ -257,17 +_,34 @@ @@ -257,17 +339,34 @@ public class Main {
services, services,
LoggerChunkProgressListener::createFromGameruleRadius LoggerChunkProgressListener::createFromGameruleRadius
); );
@@ -236,7 +244,7 @@
Thread thread = new Thread("Server Shutdown Thread") { Thread thread = new Thread("Server Shutdown Thread") {
@Override @Override
public void run() { public void run() {
@@ -276,6 +_,7 @@ @@ -276,6 +375,7 @@ public class Main {
}; };
thread.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(LOGGER)); thread.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(LOGGER));
Runtime.getRuntime().addShutdownHook(thread); Runtime.getRuntime().addShutdownHook(thread);
@@ -244,7 +252,7 @@
} catch (Exception var42) { } catch (Exception var42) {
LOGGER.error(LogUtils.FATAL_MARKER, "Failed to start the minecraft server", (Throwable)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, RegistryAccess registryAccess,
boolean recreateRegionFiles 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 --- a/net/minecraft/server/PlayerAdvancements.java
+++ b/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 { public class PlayerAdvancements {
private static final Logger LOGGER = LogUtils.getLogger(); private static final Logger LOGGER = LogUtils.getLogger();
@@ -9,7 +17,7 @@
private final PlayerList playerList; private final PlayerList playerList;
private final Path playerSavePath; private final Path playerSavePath;
private AdvancementTree tree; private AdvancementTree tree;
@@ -60,6 +_,7 @@ @@ -60,6 +60,7 @@ public class PlayerAdvancements {
private AdvancementHolder lastSelectedTab; private AdvancementHolder lastSelectedTab;
private boolean isFirstPacket = true; private boolean isFirstPacket = true;
private final Codec<PlayerAdvancements.Data> codec; private final Codec<PlayerAdvancements.Data> codec;
@@ -17,7 +25,7 @@
public PlayerAdvancements(DataFixer dataFixer, PlayerList playerList, ServerAdvancementManager manager, Path playerSavePath, ServerPlayer player) { public PlayerAdvancements(DataFixer dataFixer, PlayerList playerList, ServerAdvancementManager manager, Path playerSavePath, ServerPlayer player) {
this.playerList = playerList; this.playerList = playerList;
@@ -128,6 +_,7 @@ @@ -128,6 +129,7 @@ public class PlayerAdvancements {
} }
public void save() { public void save() {
@@ -25,7 +33,7 @@
JsonElement jsonElement = this.codec.encodeStart(JsonOps.INSTANCE, this.asData()).getOrThrow(); JsonElement jsonElement = this.codec.encodeStart(JsonOps.INSTANCE, this.asData()).getOrThrow();
try { try {
@@ -145,6 +_,7 @@ @@ -145,6 +147,7 @@ public class PlayerAdvancements {
data.forEach((path, progress) -> { data.forEach((path, progress) -> {
AdvancementHolder advancementHolder = advancementManager.get(path); AdvancementHolder advancementHolder = advancementManager.get(path);
if (advancementHolder == null) { if (advancementHolder == null) {
@@ -33,7 +41,7 @@
LOGGER.warn("Ignored advancement '{}' in progress file {} - it doesn't exist anymore?", path, this.playerSavePath); LOGGER.warn("Ignored advancement '{}' in progress file {} - it doesn't exist anymore?", path, this.playerSavePath);
} else { } else {
this.startProgress(advancementHolder, progress); this.startProgress(advancementHolder, progress);
@@ -169,14 +_,31 @@ @@ -169,14 +172,31 @@ public class PlayerAdvancements {
AdvancementProgress orStartProgress = this.getOrStartProgress(advancement); AdvancementProgress orStartProgress = this.getOrStartProgress(advancement);
boolean isDone = orStartProgress.isDone(); boolean isDone = orStartProgress.isDone();
if (orStartProgress.grantProgress(criterionKey)) { 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) { public void flushDirty(ServerPlayer player, boolean showAdvancements) {
if (this.isFirstPacket || !this.rootsToUpdate.isEmpty() || !this.progressChanged.isEmpty()) { if (this.isFirstPacket || !this.rootsToUpdate.isEmpty() || !this.progressChanged.isEmpty()) {
Map<ResourceLocation, AdvancementProgress> map = new HashMap<>(); 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 --- a/net/minecraft/server/ServerScoreboard.java
+++ b/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) { protected void onScoreChanged(ScoreHolder scoreHolder, Objective objective, Score score) {
super.onScoreChanged(scoreHolder, objective, score); super.onScoreChanged(scoreHolder, objective, score);
if (this.trackedObjectives.contains(objective)) { if (this.trackedObjectives.contains(objective)) {
@@ -11,7 +19,7 @@
new ClientboundSetScorePacket( new ClientboundSetScorePacket(
scoreHolder.getScoreboardName(), scoreHolder.getScoreboardName(),
objective.getName(), objective.getName(),
@@ -68,7 +_,7 @@ @@ -68,7 +66,7 @@ public class ServerScoreboard extends Scoreboard {
@Override @Override
public void onPlayerRemoved(ScoreHolder scoreHolder) { public void onPlayerRemoved(ScoreHolder scoreHolder) {
super.onPlayerRemoved(scoreHolder); super.onPlayerRemoved(scoreHolder);
@@ -20,7 +28,7 @@
this.setDirty(); this.setDirty();
} }
@@ -76,7 +_,7 @@ @@ -76,7 +74,7 @@ public class ServerScoreboard extends Scoreboard {
public void onPlayerScoreRemoved(ScoreHolder scoreHolder, Objective objective) { public void onPlayerScoreRemoved(ScoreHolder scoreHolder, Objective objective) {
super.onPlayerScoreRemoved(scoreHolder, objective); super.onPlayerScoreRemoved(scoreHolder, objective);
if (this.trackedObjectives.contains(objective)) { if (this.trackedObjectives.contains(objective)) {
@@ -29,7 +37,7 @@
} }
this.setDirty(); this.setDirty();
@@ -88,7 +_,7 @@ @@ -88,7 +86,7 @@ public class ServerScoreboard extends Scoreboard {
super.setDisplayObjective(slot, objective); super.setDisplayObjective(slot, objective);
if (displayObjective != objective && displayObjective != null) { if (displayObjective != objective && displayObjective != null) {
if (this.getObjectiveDisplaySlotCount(displayObjective) > 0) { if (this.getObjectiveDisplaySlotCount(displayObjective) > 0) {
@@ -38,7 +46,7 @@
} else { } else {
this.stopTrackingObjective(displayObjective); this.stopTrackingObjective(displayObjective);
} }
@@ -96,7 +_,7 @@ @@ -96,7 +94,7 @@ public class ServerScoreboard extends Scoreboard {
if (objective != null) { if (objective != null) {
if (this.trackedObjectives.contains(objective)) { if (this.trackedObjectives.contains(objective)) {
@@ -47,27 +55,21 @@
} else { } else {
this.startTrackingObjective(objective); this.startTrackingObjective(objective);
} }
@@ -108,24 +_,50 @@ @@ -108,9 +106,7 @@ public class ServerScoreboard extends Scoreboard {
@Override @Override
public boolean addPlayerToTeam(String playerName, PlayerTeam team) { public boolean addPlayerToTeam(String playerName, PlayerTeam team) {
if (super.addPlayerToTeam(playerName, team)) { if (super.addPlayerToTeam(playerName, team)) {
- this.server - this.server
- .getPlayerList() - .getPlayerList()
- .broadcastAll(ClientboundSetPlayerTeamPacket.createPlayerPacket(team, playerName, ClientboundSetPlayerTeamPacket.Action.ADD)); - .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.broadcastAll(ClientboundSetPlayerTeamPacket.createPlayerPacket(team, playerName, ClientboundSetPlayerTeamPacket.Action.ADD)); // CraftBukkit
+ this.setDirty(); this.setDirty();
+ return true; return true;
+ } else { } else {
+ return false; @@ -118,15 +114,43 @@ public class ServerScoreboard extends Scoreboard {
+ } }
+ } }
+
+ // Paper start - Multiple Entries with Scoreboards + // Paper start - Multiple Entries with Scoreboards
+ public boolean addPlayersToTeam(java.util.Collection<String> players, PlayerTeam team) { + public boolean addPlayersToTeam(java.util.Collection<String> players, PlayerTeam team) {
+ boolean anyAdded = false; + boolean anyAdded = false;
@@ -86,19 +88,17 @@
+ } + }
+ } + }
+ // Paper end - Multiple Entries with Scoreboards + // Paper end - Multiple Entries with Scoreboards
+
@Override @Override
public void removePlayerFromTeam(String username, PlayerTeam playerTeam) { public void removePlayerFromTeam(String username, PlayerTeam playerTeam) {
super.removePlayerFromTeam(username, playerTeam); super.removePlayerFromTeam(username, playerTeam);
- this.server - this.server
- .getPlayerList() - .getPlayerList()
- .broadcastAll(ClientboundSetPlayerTeamPacket.createPlayerPacket(playerTeam, username, ClientboundSetPlayerTeamPacket.Action.REMOVE)); - .broadcastAll(ClientboundSetPlayerTeamPacket.createPlayerPacket(playerTeam, username, ClientboundSetPlayerTeamPacket.Action.REMOVE));
- this.setDirty();
- }
+ this.broadcastAll(ClientboundSetPlayerTeamPacket.createPlayerPacket(playerTeam, username, ClientboundSetPlayerTeamPacket.Action.REMOVE)); // CraftBukkit + this.broadcastAll(ClientboundSetPlayerTeamPacket.createPlayerPacket(playerTeam, username, ClientboundSetPlayerTeamPacket.Action.REMOVE)); // CraftBukkit
+ this.setDirty(); this.setDirty();
+ } }
+
+ // Paper start - Multiple Entries with Scoreboards + // Paper start - Multiple Entries with Scoreboards
+ public void removePlayersFromTeam(java.util.Collection<String> players, PlayerTeam team) { + public void removePlayersFromTeam(java.util.Collection<String> players, PlayerTeam team) {
+ for (String playerName : players) { + for (String playerName : players) {
@@ -109,10 +109,11 @@
+ this.setDirty(); + this.setDirty();
+ } + }
+ // Paper end - Multiple Entries with Scoreboards + // Paper end - Multiple Entries with Scoreboards
+
@Override @Override
public void onObjectiveAdded(Objective objective) { 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) { public void onObjectiveChanged(Objective objective) {
super.onObjectiveChanged(objective); super.onObjectiveChanged(objective);
if (this.trackedObjectives.contains(objective)) { if (this.trackedObjectives.contains(objective)) {
@@ -121,7 +122,7 @@
} }
this.setDirty(); this.setDirty();
@@ -156,21 +_,21 @@ @@ -156,21 +180,21 @@ public class ServerScoreboard extends Scoreboard {
@Override @Override
public void onTeamAdded(PlayerTeam playerTeam) { public void onTeamAdded(PlayerTeam playerTeam) {
super.onTeamAdded(playerTeam); super.onTeamAdded(playerTeam);
@@ -146,7 +147,7 @@
this.setDirty(); this.setDirty();
} }
@@ -213,6 +_,7 @@ @@ -213,6 +237,7 @@ public class ServerScoreboard extends Scoreboard {
List<Packet<?>> startTrackingPackets = this.getStartTrackingPackets(objective); List<Packet<?>> startTrackingPackets = this.getStartTrackingPackets(objective);
for (ServerPlayer serverPlayer : this.server.getPlayerList().getPlayers()) { for (ServerPlayer serverPlayer : this.server.getPlayerList().getPlayers()) {
@@ -154,7 +155,7 @@
for (Packet<?> packet : startTrackingPackets) { for (Packet<?> packet : startTrackingPackets) {
serverPlayer.connection.send(packet); serverPlayer.connection.send(packet);
} }
@@ -238,6 +_,7 @@ @@ -238,6 +263,7 @@ public class ServerScoreboard extends Scoreboard {
List<Packet<?>> stopTrackingPackets = this.getStopTrackingPackets(objective); List<Packet<?>> stopTrackingPackets = this.getStopTrackingPackets(objective);
for (ServerPlayer serverPlayer : this.server.getPlayerList().getPlayers()) { for (ServerPlayer serverPlayer : this.server.getPlayerList().getPlayers()) {
@@ -162,11 +163,10 @@
for (Packet<?> packet : stopTrackingPackets) { for (Packet<?> packet : stopTrackingPackets) {
serverPlayer.connection.send(packet); serverPlayer.connection.send(packet);
} }
@@ -269,6 +_,16 @@ @@ -270,6 +296,16 @@ public class ServerScoreboard extends Scoreboard {
scoreboardSaveData.loadFrom(data);
return scoreboardSaveData; return scoreboardSaveData;
} }
+
+ // CraftBukkit start - Send to players + // CraftBukkit start - Send to players
+ private void broadcastAll(Packet<?> packet) { + private void broadcastAll(Packet<?> packet) {
+ for (ServerPlayer serverPlayer : this.server.getPlayerList().players) { + for (ServerPlayer serverPlayer : this.server.getPlayerList().players) {
@@ -176,6 +176,7 @@
+ } + }
+ } + }
+ // CraftBukkit end + // CraftBukkit end
+
public static enum Method { public static enum Method {
CHANGE, 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 --- a/net/minecraft/server/commands/GameModeCommand.java
+++ b/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; int i = 0;
for (ServerPlayer serverPlayer : players) { 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 --- a/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/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(); static final Logger LOGGER = LogUtils.getLogger();
private static final int CONVERSION_RETRY_DELAY_MS = 5000; private static final int CONVERSION_RETRY_DELAY_MS = 5000;
private static final int CONVERSION_RETRIES = 2; private static final int CONVERSION_RETRIES = 2;
@@ -13,7 +21,7 @@
@Nullable @Nullable
private RconThread rconThread; private RconThread rconThread;
public DedicatedServerSettings settings; public DedicatedServerSettings settings;
@@ -81,6 +_,7 @@ @@ -81,6 +81,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
public ServerLinks serverLinks; public ServerLinks serverLinks;
public DedicatedServer( public DedicatedServer(
@@ -21,7 +29,7 @@
Thread serverThread, Thread serverThread,
LevelStorageSource.LevelStorageAccess storageSource, LevelStorageSource.LevelStorageAccess storageSource,
PackRepository packRepository, PackRepository packRepository,
@@ -90,9 +_,9 @@ @@ -90,9 +91,9 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
Services services, Services services,
ChunkProgressListenerFactory progressListenerFactory ChunkProgressListenerFactory progressListenerFactory
) { ) {
@@ -33,7 +41,7 @@
this.serverTextFilter = ServerTextFilter.createFromConfig(settings.getProperties()); this.serverTextFilter = ServerTextFilter.createFromConfig(settings.getProperties());
this.serverLinks = createServerLinks(settings); 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") { Thread thread = new Thread("Server console handler") {
@Override @Override
public void run() { public void run() {
@@ -44,7 +52,7 @@
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in, StandardCharsets.UTF_8)); BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in, StandardCharsets.UTF_8));
String string1; String string1;
@@ -111,17 +_,41 @@ @@ -111,17 +116,41 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
} }
} catch (IOException var4) { } catch (IOException var4) {
DedicatedServer.LOGGER.error("Exception handling console input", (Throwable)var4); DedicatedServer.LOGGER.error("Exception handling console input", (Throwable)var4);
@@ -88,7 +96,7 @@
LOGGER.info("Loading properties"); LOGGER.info("Loading properties");
DedicatedServerProperties properties = this.settings.getProperties(); DedicatedServerProperties properties = this.settings.getProperties();
if (this.isSingleplayer()) { if (this.isSingleplayer()) {
@@ -132,13 +_,51 @@ @@ -132,13 +161,51 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
this.setLocalIp(properties.serverIp); this.setLocalIp(properties.serverIp);
} }
@@ -141,7 +149,7 @@
InetAddress inetAddress = null; InetAddress inetAddress = null;
if (!this.getLocalIp().isEmpty()) { if (!this.getLocalIp().isEmpty()) {
inetAddress = InetAddress.getByName(this.getLocalIp()); inetAddress = InetAddress.getByName(this.getLocalIp());
@@ -147,36 +_,61 @@ @@ -147,36 +214,61 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
if (this.getPort() < 0) { if (this.getPort() < 0) {
this.setPort(properties.serverPort); this.setPort(properties.serverPort);
} }
@@ -208,7 +216,7 @@
this.debugSampleSubscriptionTracker = new DebugSampleSubscriptionTracker(this.getPlayerList()); this.debugSampleSubscriptionTracker = new DebugSampleSubscriptionTracker(this.getPlayerList());
this.tickTimeLogger = new RemoteSampleLogger( this.tickTimeLogger = new RemoteSampleLogger(
TpsDebugDimensions.values().length, this.debugSampleSubscriptionTracker, RemoteDebugSampleType.TICK_TIME 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); SkullBlockEntity.setup(this.services, this);
GameProfileCache.setUsesAuthentication(this.usesAuthentication()); GameProfileCache.setUsesAuthentication(this.usesAuthentication());
LOGGER.info("Preparing level \"{}\"", this.getLevelIdName()); LOGGER.info("Preparing level \"{}\"", this.getLevelIdName());
@@ -224,7 +232,7 @@
} }
if (properties.enableQuery) { if (properties.enableQuery) {
@@ -203,7 +_,7 @@ @@ -203,7 +295,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
this.rconThread = RconThread.create(this); this.rconThread = RconThread.create(this);
} }
@@ -233,7 +241,7 @@
Thread thread1 = new Thread(new ServerWatchdog(this)); Thread thread1 = new Thread(new ServerWatchdog(this));
thread1.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandlerWithName(LOGGER)); thread1.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandlerWithName(LOGGER));
thread1.setName("Server Watchdog"); thread1.setName("Server Watchdog");
@@ -220,6 +_,12 @@ @@ -220,6 +312,12 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
} }
} }
@@ -246,7 +254,7 @@
@Override @Override
public boolean isSpawningMonsters() { public boolean isSpawningMonsters() {
return this.settings.getProperties().spawnMonsters && super.isSpawningMonsters(); return this.settings.getProperties().spawnMonsters && super.isSpawningMonsters();
@@ -232,7 +_,7 @@ @@ -232,7 +330,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
@Override @Override
public void forceDifficulty() { public void forceDifficulty() {
@@ -255,7 +263,7 @@
} }
@Override @Override
@@ -271,12 +_,15 @@ @@ -271,12 +369,15 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
} }
if (this.rconThread != null) { if (this.rconThread != null) {
@@ -273,7 +281,7 @@
} }
@Override @Override
@@ -291,13 +_,23 @@ @@ -291,13 +392,23 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
} }
public void handleConsoleInput(String msg, CommandSourceStack source) { 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 @Override
public boolean enforceSecureProfile() { public boolean enforceSecureProfile() {
DedicatedServerProperties properties = this.getProperties(); DedicatedServerProperties properties = this.getProperties();
@@ -314,7 +322,7 @@
} }
@Override @Override
@@ -515,14 +_,54 @@ @@ -515,14 +630,54 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
@Override @Override
public String getPluginNames() { public String getPluginNames() {
@@ -373,7 +381,7 @@
} }
public void storeUsingWhiteList(boolean isStoreUsingWhiteList) { public void storeUsingWhiteList(boolean isStoreUsingWhiteList) {
@@ -532,7 +_,7 @@ @@ -532,7 +687,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
@Override @Override
public void stopServer() { public void stopServer() {
super.stopServer(); super.stopServer();
@@ -382,7 +390,7 @@
SkullBlockEntity.clear(); 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 --- a/net/minecraft/server/level/ServerEntity.java
+++ b/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 Vec3 lastSentMovement;
private int tickCount; private int tickCount;
private int teleportDelay; private int teleportDelay;
@@ -14,7 +22,7 @@
public ServerEntity( public ServerEntity(
ServerLevel level, ServerLevel level,
@@ -81,8 +_,12 @@ @@ -81,8 +82,12 @@ public class ServerEntity {
int updateInterval, int updateInterval,
boolean trackDelta, boolean trackDelta,
Consumer<Packet<?>> broadcast, Consumer<Packet<?>> broadcast,
@@ -28,7 +36,7 @@
this.level = level; this.level = level;
this.broadcast = broadcast; this.broadcast = broadcast;
this.entity = entity; this.entity = entity;
@@ -103,16 +_,22 @@ @@ -103,16 +108,22 @@ public class ServerEntity {
if (!passengers.equals(this.lastPassengers)) { if (!passengers.equals(this.lastPassengers)) {
List<UUID> list = this.mountedOrDismounted(passengers).map(Entity::getUUID).toList(); List<UUID> list = this.mountedOrDismounted(passengers).map(Entity::getUUID).toList();
this.broadcastWithIgnore.accept(new ClientboundSetPassengersPacket(this.entity), list); this.broadcastWithIgnore.accept(new ClientboundSetPassengersPacket(this.entity), list);
@@ -55,7 +63,7 @@
savedData.tickCarriedBy(serverPlayer, item); savedData.tickCarriedBy(serverPlayer, item);
Packet<?> updatePacket = savedData.getUpdatePacket(mapId, serverPlayer); Packet<?> updatePacket = savedData.getUpdatePacket(mapId, serverPlayer);
if (updatePacket != null) { if (updatePacket != null) {
@@ -145,7 +_,13 @@ @@ -145,7 +156,13 @@ public class ServerEntity {
} else { } else {
this.teleportDelay++; this.teleportDelay++;
Vec3 vec3 = this.entity.trackingPosition(); Vec3 vec3 = this.entity.trackingPosition();
@@ -70,7 +78,7 @@
Packet<?> packet = null; Packet<?> packet = null;
boolean flag2 = flag1 || this.tickCount % 60 == 0; boolean flag2 = flag1 || this.tickCount % 60 == 0;
boolean flag3 = false; boolean flag3 = false;
@@ -223,6 +_,25 @@ @@ -223,6 +240,25 @@ public class ServerEntity {
this.tickCount++; this.tickCount++;
if (this.entity.hurtMarked) { if (this.entity.hurtMarked) {
@@ -96,7 +104,7 @@
this.entity.hurtMarked = false; this.entity.hurtMarked = false;
this.broadcastAndSend(new ClientboundSetEntityMotionPacket(this.entity)); 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) { public void sendPairingData(ServerPlayer player, Consumer<Packet<ClientGamePacketListener>> consumer) {
if (this.entity.isRemoved()) { if (this.entity.isRemoved()) {
@@ -108,7 +116,7 @@
} }
Packet<ClientGamePacketListener> addEntityPacket = this.entity.getAddEntityPacket(this); Packet<ClientGamePacketListener> addEntityPacket = this.entity.getAddEntityPacket(this);
@@ -292,6 +_,12 @@ @@ -292,6 +331,12 @@ public class ServerEntity {
boolean flag = this.trackDelta; boolean flag = this.trackDelta;
if (this.entity instanceof LivingEntity) { if (this.entity instanceof LivingEntity) {
Collection<AttributeInstance> syncableAttributes = ((LivingEntity)this.entity).getAttributes().getSyncableAttributes(); Collection<AttributeInstance> syncableAttributes = ((LivingEntity)this.entity).getAttributes().getSyncableAttributes();
@@ -121,7 +129,7 @@
if (!syncableAttributes.isEmpty()) { if (!syncableAttributes.isEmpty()) {
consumer.accept(new ClientboundUpdateAttributesPacket(this.entity.getId(), syncableAttributes)); consumer.accept(new ClientboundUpdateAttributesPacket(this.entity.getId(), syncableAttributes));
} }
@@ -316,8 +_,9 @@ @@ -316,8 +361,9 @@ public class ServerEntity {
} }
if (!list.isEmpty()) { if (!list.isEmpty()) {
@@ -132,7 +140,7 @@
} }
if (!this.entity.getPassengers().isEmpty()) { if (!this.entity.getPassengers().isEmpty()) {
@@ -364,6 +_,11 @@ @@ -364,6 +410,11 @@ public class ServerEntity {
if (this.entity instanceof LivingEntity) { if (this.entity instanceof LivingEntity) {
Set<AttributeInstance> attributesToSync = ((LivingEntity)this.entity).getAttributes().getAttributesToSync(); Set<AttributeInstance> attributesToSync = ((LivingEntity)this.entity).getAttributes().getAttributesToSync();
if (!attributesToSync.isEmpty()) { 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 --- a/net/minecraft/server/level/ServerLevel.java
+++ b/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(); final List<ServerPlayer> players = Lists.newArrayList();
public final ServerChunkCache chunkSource; public final ServerChunkCache chunkSource;
private final MinecraftServer server; private final MinecraftServer server;
@@ -9,7 +17,7 @@
private int lastSpawnChunkRadius; private int lastSpawnChunkRadius;
final EntityTickList entityTickList = new EntityTickList(); final EntityTickList entityTickList = new EntityTickList();
public final PersistentEntitySectionManager<Entity> entityManager; 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 boolean tickTime;
private final RandomSequences randomSequences; private final RandomSequences randomSequences;
@@ -142,7 +150,7 @@
ResourceKey<Level> dimension, ResourceKey<Level> dimension,
LevelStem levelStem, LevelStem levelStem,
ChunkProgressListener progressListener, ChunkProgressListener progressListener,
@@ -217,14 +_,38 @@ @@ -217,14 +337,38 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
long biomeZoomSeed, long biomeZoomSeed,
List<CustomSpawner> customSpawners, List<CustomSpawner> customSpawners,
boolean tickTime, boolean tickTime,
@@ -183,7 +191,7 @@
boolean flag = server.forceSynchronousWrites(); boolean flag = server.forceSynchronousWrites();
DataFixer fixerUpper = server.getFixerUpper(); DataFixer fixerUpper = server.getFixerUpper();
EntityPersistentStorage<Entity> entityPersistentStorage = new EntityStorage( EntityPersistentStorage<Entity> entityPersistentStorage = new EntityStorage(
@@ -246,8 +_,8 @@ @@ -246,8 +390,8 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
server.getStructureManager(), server.getStructureManager(),
dispatcher, dispatcher,
chunkGenerator, chunkGenerator,
@@ -194,7 +202,7 @@
flag, flag,
progressListener, progressListener,
this.entityManager::updateChunkStatus, this.entityManager::updateChunkStatus,
@@ -268,7 +_,7 @@ @@ -268,7 +412,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
this.chunkSource.chunkScanner(), this.chunkSource.chunkScanner(),
this.registryAccess(), this.registryAccess(),
server.getStructureManager(), server.getStructureManager(),
@@ -203,7 +211,7 @@
chunkGenerator, chunkGenerator,
this.chunkSource.randomState(), this.chunkSource.randomState(),
this, this,
@@ -276,9 +_,9 @@ @@ -276,9 +420,9 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
seed, seed,
fixerUpper fixerUpper
); );
@@ -216,11 +224,10 @@
} else { } else {
this.dragonFight = null; this.dragonFight = null;
} }
@@ -286,7 +_,15 @@ @@ -286,7 +430,15 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
this.sleepStatus = new SleepStatus(); this.sleepStatus = new SleepStatus();
this.gameEventDispatcher = new GameEventDispatcher(this); this.gameEventDispatcher = new GameEventDispatcher(this);
this.randomSequences = Objects.requireNonNullElseGet(randomSequences, () -> this.getDataStorage().computeIfAbsent(RandomSequences.TYPE)); this.randomSequences = Objects.requireNonNullElseGet(randomSequences, () -> this.getDataStorage().computeIfAbsent(RandomSequences.TYPE));
- }
+ this.getCraftServer().addWorld(this.getWorld()); // CraftBukkit + this.getCraftServer().addWorld(this.getWorld()); // CraftBukkit
+ } + }
+ +
@@ -228,12 +235,12 @@
+ @Override + @Override
+ public boolean hasChunk(int chunkX, int chunkZ) { + public boolean hasChunk(int chunkX, int chunkZ) {
+ return this.getChunkSource().getChunkAtIfLoadedImmediately(chunkX, chunkZ) != null; + return this.getChunkSource().getChunkAtIfLoadedImmediately(chunkX, chunkZ) != null;
+ } }
+ // Paper end + // Paper end
@Deprecated @Deprecated
@VisibleForTesting @VisibleForTesting
@@ -298,8 +_,8 @@ @@ -298,8 +450,8 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
this.serverLevelData.setClearWeatherTime(clearTime); this.serverLevelData.setClearWeatherTime(clearTime);
this.serverLevelData.setRainTime(weatherTime); this.serverLevelData.setRainTime(weatherTime);
this.serverLevelData.setThunderTime(weatherTime); this.serverLevelData.setThunderTime(weatherTime);
@@ -244,7 +251,7 @@
} }
@Override @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); int _int = this.getGameRules().getInt(GameRules.RULE_PLAYERS_SLEEPING_PERCENTAGE);
if (this.sleepStatus.areEnoughSleeping(_int) && this.sleepStatus.areEnoughDeepSleeping(_int, this.players)) { 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()) { if (this.getGameRules().getBoolean(GameRules.RULE_WEATHER_CYCLE) && this.isRaining()) {
this.resetWeatherCycle(); this.resetWeatherCycle();
} }
@@ -346,9 +_,9 @@ @@ -346,9 +511,9 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
if (!this.isDebug() && runsNormally) { if (!this.isDebug() && runsNormally) {
long l = this.getGameTime(); long l = this.getGameTime();
profilerFiller.push("blockTicks"); profilerFiller.push("blockTicks");
@@ -285,7 +292,7 @@
profilerFiller.pop(); profilerFiller.pop();
} }
@@ -366,7 +_,7 @@ @@ -366,7 +531,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
this.handlingTick = false; this.handlingTick = false;
profilerFiller.pop(); profilerFiller.pop();
@@ -294,7 +301,7 @@
if (flag) { if (flag) {
this.resetEmptyTime(); this.resetEmptyTime();
} }
@@ -455,11 +_,13 @@ @@ -455,11 +620,13 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
ProfilerFiller profilerFiller = Profiler.get(); ProfilerFiller profilerFiller = Profiler.get();
profilerFiller.push("iceandsnow"); profilerFiller.push("iceandsnow");
@@ -308,7 +315,7 @@
profilerFiller.popPush("tickBlocks"); profilerFiller.popPush("tickBlocks");
if (randomTickSpeed > 0) { if (randomTickSpeed > 0) {
@@ -502,12 +_,12 @@ @@ -502,12 +669,12 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
int minBlockZ = pos.getMinBlockZ(); int minBlockZ = pos.getMinBlockZ();
ProfilerFiller profilerFiller = Profiler.get(); ProfilerFiller profilerFiller = Profiler.get();
profilerFiller.push("thunder"); profilerFiller.push("thunder");
@@ -323,7 +330,7 @@
&& !this.getBlockState(blockPos.below()).is(Blocks.LIGHTNING_ROD); && !this.getBlockState(blockPos.below()).is(Blocks.LIGHTNING_ROD);
if (flag) { if (flag) {
SkeletonHorse skeletonHorse = EntityType.SKELETON_HORSE.create(this, EntitySpawnReason.EVENT); 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.setTrap(true);
skeletonHorse.setAge(0); skeletonHorse.setAge(0);
skeletonHorse.setPos(blockPos.getX(), blockPos.getY(), blockPos.getZ()); 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) { if (lightningBolt != null) {
lightningBolt.snapTo(Vec3.atBottomCenterOf(blockPos)); lightningBolt.snapTo(Vec3.atBottomCenterOf(blockPos));
lightningBolt.setVisualOnly(flag); 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(); BlockPos blockPos1 = heightmapPos.below();
Biome biome = this.getBiome(heightmapPos).value(); Biome biome = this.getBiome(heightmapPos).value();
if (biome.shouldFreeze(this, blockPos1)) { if (biome.shouldFreeze(this, blockPos1)) {
@@ -350,7 +357,7 @@
} }
if (this.isRaining()) { if (this.isRaining()) {
@@ -549,10 +_,10 @@ @@ -549,10 +716,10 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
if (layersValue < Math.min(_int, 8)) { if (layersValue < Math.min(_int, 8)) {
BlockState blockState1 = blockState.setValue(SnowLayerBlock.LAYERS, layersValue + 1); BlockState blockState1 = blockState.setValue(SnowLayerBlock.LAYERS, layersValue + 1);
Block.pushEntitiesUp(blockState, blockState1, this, heightmapPos); 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) { protected BlockPos findLightningTargetAround(BlockPos pos) {
@@ -376,7 +383,7 @@
BlockPos heightmapPos = this.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, pos); BlockPos heightmapPos = this.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, pos);
Optional<BlockPos> optional = this.findLightningRod(heightmapPos); Optional<BlockPos> optional = this.findLightningRod(heightmapPos);
if (optional.isPresent()) { if (optional.isPresent()) {
@@ -584,11 +_,12 @@ @@ -584,11 +757,12 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
} else { } else {
AABB aabb = AABB.encapsulatingFullBlocks(heightmapPos, heightmapPos.atY(this.getMaxY() + 1)).inflate(3.0); AABB aabb = AABB.encapsulatingFullBlocks(heightmapPos, heightmapPos.atY(this.getMaxY() + 1)).inflate(3.0);
List<LivingEntity> entitiesOfClass = this.getEntitiesOfClass( List<LivingEntity> entitiesOfClass = this.getEntitiesOfClass(
@@ -390,7 +397,7 @@
if (heightmapPos.getY() == this.getMinY() - 1) { if (heightmapPos.getY() == this.getMinY() - 1) {
heightmapPos = heightmapPos.above(2); 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.setThunderTime(thunderTime);
this.serverLevelData.setRainTime(rainTime); this.serverLevelData.setRainTime(rainTime);
this.serverLevelData.setClearWeatherTime(clearWeatherTime); this.serverLevelData.setClearWeatherTime(clearWeatherTime);
@@ -401,7 +408,7 @@
} }
this.oThunderLevel = this.thunderLevel; 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); this.rainLevel = Mth.clamp(this.rainLevel, 0.0F, 1.0F);
} }
@@ -409,7 +416,7 @@
if (this.oRainLevel != this.rainLevel) { if (this.oRainLevel != this.rainLevel) {
this.server this.server
.getPlayerList() .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.RAIN_LEVEL_CHANGE, this.rainLevel));
this.server.getPlayerList().broadcastAll(new ClientboundGameEventPacket(ClientboundGameEventPacket.THUNDER_LEVEL_CHANGE, this.thunderLevel)); this.server.getPlayerList().broadcastAll(new ClientboundGameEventPacket(ClientboundGameEventPacket.THUNDER_LEVEL_CHANGE, this.thunderLevel));
} }
@@ -461,7 +468,7 @@
} }
public void resetEmptyTime() { 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) { 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)) { } else if (passengerEntity instanceof Player || this.entityTickList.contains(passengerEntity)) {
passengerEntity.setOldPosAndRot(); passengerEntity.setOldPosAndRot();
passengerEntity.tickCount++; passengerEntity.tickCount++;
@@ -521,7 +528,7 @@
profilerFiller.pop(); profilerFiller.pop();
for (Entity entity : passengerEntity.getPassengers()) { 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) { public void save(@Nullable ProgressListener progress, boolean flush, boolean skipSave) {
ServerChunkCache chunkSource = this.getChunkSource(); ServerChunkCache chunkSource = this.getChunkSource();
if (!skipSave) { if (!skipSave) {
@@ -529,7 +536,7 @@
if (progress != null) { if (progress != null) {
progress.progressStartNoAbort(Component.translatable("menu.savingLevel")); progress.progressStartNoAbort(Component.translatable("menu.savingLevel"));
} }
@@ -804,11 +_,19 @@ @@ -804,11 +1043,19 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
this.entityManager.autoSave(); this.entityManager.autoSave();
} }
} }
@@ -550,7 +557,7 @@
} }
DimensionDataStorage dataStorage = this.getChunkSource().getDataStorage(); DimensionDataStorage dataStorage = this.getChunkSource().getDataStorage();
@@ -873,18 +_,40 @@ @@ -873,18 +1120,40 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
@Override @Override
public boolean addFreshEntity(Entity entity) { 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); this.entityManager.addNewEntity(player);
} }
@@ -668,15 +675,14 @@
public void removePlayerImmediately(ServerPlayer player, Entity.RemovalReason reason) { public void removePlayerImmediately(ServerPlayer player, Entity.RemovalReason reason) {
- player.remove(reason); - player.remove(reason);
- }
+ player.remove(reason, null); // CraftBukkit - add Bukkit remove cause + player.remove(reason, null); // CraftBukkit - add Bukkit remove cause
+ } + }
+ +
+ // CraftBukkit start + // CraftBukkit start
+ public boolean strikeLightning(Entity entitylightning) { + public boolean strikeLightning(Entity entitylightning) {
+ return this.strikeLightning(entitylightning, org.bukkit.event.weather.LightningStrikeEvent.Cause.UNKNOWN); + return this.strikeLightning(entitylightning, org.bukkit.event.weather.LightningStrikeEvent.Cause.UNKNOWN);
+ } }
+
+ public boolean strikeLightning(Entity entitylightning, org.bukkit.event.weather.LightningStrikeEvent.Cause cause) { + 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); + 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); + return this.addFreshEntity(entitylightning);
+ } + }
+ // CraftBukkit end + // CraftBukkit end
+
@Override @Override
public void destroyBlockProgress(int breakerId, BlockPos pos, int progress) { public void destroyBlockProgress(int breakerId, BlockPos pos, int progress) {
+ // CraftBukkit start + // CraftBukkit start
@@ -719,7 +725,7 @@
if (d * d + d1 * d1 + d2 * d2 < 1024.0) { if (d * d + d1 * d1 + d2 * d2 < 1024.0) {
serverPlayer.connection.send(new ClientboundBlockDestructionPacket(breakerId, pos, progress)); 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.getX(),
pos.getY(), pos.getY(),
pos.getZ(), pos.getZ(),
@@ -728,7 +734,7 @@
this.dimension(), this.dimension(),
new ClientboundLevelEventPacket(type, pos, data, false) new ClientboundLevelEventPacket(type, pos, data, false)
); );
@@ -1027,6 +_,11 @@ @@ -1027,6 +1375,11 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
@Override @Override
public void gameEvent(Holder<GameEvent> gameEvent, Vec3 pos, GameEvent.Context context) { public void gameEvent(Holder<GameEvent> gameEvent, Vec3 pos, GameEvent.Context context) {
@@ -740,7 +746,7 @@
this.gameEventDispatcher.post(gameEvent, pos, context); 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.getChunkSource().blockChanged(pos);
this.pathTypesByPosCache.invalidate(pos); this.pathTypesByPosCache.invalidate(pos);
@@ -769,7 +775,7 @@
try { try {
this.isUpdatingNavigations = true; this.isUpdatingNavigations = true;
@@ -1061,15 +_,23 @@ @@ -1061,15 +1425,23 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
this.isUpdatingNavigations = false; this.isUpdatingNavigations = false;
} }
} }
@@ -793,7 +799,7 @@
this.neighborUpdater.updateNeighborsAtExceptFromFacing(pos, block, null, orientation); this.neighborUpdater.updateNeighborsAtExceptFromFacing(pos, block, null, orientation);
} }
@@ -1118,6 +_,42 @@ @@ -1118,6 +1490,42 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
ParticleOptions largeExplosionParticles, ParticleOptions largeExplosionParticles,
Holder<SoundEvent> explosionSound Holder<SoundEvent> explosionSound
) { ) {
@@ -836,7 +842,7 @@
Explosion.BlockInteraction blockInteraction = switch (explosionInteraction) { Explosion.BlockInteraction blockInteraction = switch (explosionInteraction) {
case NONE -> Explosion.BlockInteraction.KEEP; case NONE -> Explosion.BlockInteraction.KEEP;
case BLOCK -> this.getDestroyType(GameRules.RULE_BLOCK_EXPLOSION_DROP_DECAY); 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; : Explosion.BlockInteraction.KEEP;
case TNT -> this.getDestroyType(GameRules.RULE_TNT_EXPLOSION_DROP_DECAY); case TNT -> this.getDestroyType(GameRules.RULE_TNT_EXPLOSION_DROP_DECAY);
case TRIGGER -> Explosion.BlockInteraction.TRIGGER_BLOCK; case TRIGGER -> Explosion.BlockInteraction.TRIGGER_BLOCK;
@@ -854,7 +860,7 @@
ParticleOptions particleOptions = serverExplosion.isSmall() ? smallExplosionParticles : largeExplosionParticles; ParticleOptions particleOptions = serverExplosion.isSmall() ? smallExplosionParticles : largeExplosionParticles;
for (ServerPlayer serverPlayer : this.players) { 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)); serverPlayer.connection.send(new ClientboundExplodePacket(vec3, optional, particleOptions, explosionSound));
} }
} }
@@ -863,7 +869,7 @@
} }
private Explosion.BlockInteraction getDestroyType(GameRules.Key<GameRules.BooleanValue> decayGameRule) { 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( public <T extends ParticleOptions> int sendParticles(
T type, double posX, double posY, double posZ, int particleCount, double xOffset, double yOffset, double zOffset, double speed 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( public <T extends ParticleOptions> int sendParticles(
@@ -1224,13 +_,49 @@ @@ -1224,13 +1641,49 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
double zOffset, double zOffset,
double speed double speed
) { ) {
@@ -924,7 +930,7 @@
if (this.sendParticles(serverPlayer, overrideLimiter, posX, posY, posZ, clientboundLevelParticlesPacket)) { if (this.sendParticles(serverPlayer, overrideLimiter, posX, posY, posZ, clientboundLevelParticlesPacket)) {
i++; i++;
} }
@@ -1293,7 +_,7 @@ @@ -1293,7 +1746,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
@Nullable @Nullable
public BlockPos findNearestMapStructure(TagKey<Structure> structureTag, BlockPos pos, int radius, boolean skipExistingChunks) { public BlockPos findNearestMapStructure(TagKey<Structure> structureTag, BlockPos pos, int radius, boolean skipExistingChunks) {
@@ -933,7 +939,7 @@
return null; return null;
} else { } else {
Optional<HolderSet.Named<Structure>> optional = this.registryAccess().lookupOrThrow(Registries.STRUCTURE).get(structureTag); 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 @Nullable
@Override @Override
public MapItemSavedData getMapData(MapId mapId) { public MapItemSavedData getMapData(MapId mapId) {
@@ -971,7 +977,7 @@
this.getServer().overworld().getDataStorage().set(MapItemSavedData.type(mapId), data); 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(); BlockPos spawnPos = this.levelData.getSpawnPos();
float spawnAngle = this.levelData.getSpawnAngle(); float spawnAngle = this.levelData.getSpawnAngle();
if (!spawnPos.equals(pos) || spawnAngle != angle) { if (!spawnPos.equals(pos) || spawnAngle != angle) {
@@ -1001,7 +1007,7 @@
} }
this.lastSpawnChunkRadius = i; this.lastSpawnChunkRadius = i;
@@ -1400,6 +_,11 @@ @@ -1400,6 +1889,11 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
DebugPackets.sendPoiRemovedPacket(this, blockPos); DebugPackets.sendPoiRemovedPacket(this, blockPos);
})); }));
optional1.ifPresent(holder -> this.getServer().execute(() -> { optional1.ifPresent(holder -> this.getServer().execute(() -> {
@@ -1013,7 +1019,7 @@
this.getPoiManager().add(blockPos, (Holder<PoiType>)holder); this.getPoiManager().add(blockPos, (Holder<PoiType>)holder);
DebugPackets.sendPoiAddedPacket(this, blockPos); DebugPackets.sendPoiAddedPacket(this, blockPos);
})); }));
@@ -1552,12 +_,12 @@ @@ -1552,12 +2046,12 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
} }
public boolean isFlat() { public boolean isFlat() {
@@ -1028,7 +1034,7 @@
} }
@Nullable @Nullable
@@ -1608,6 +_,7 @@ @@ -1608,6 +2102,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
@Override @Override
public LevelEntityGetter<Entity> getEntities() { public LevelEntityGetter<Entity> getEntities() {
@@ -1036,7 +1042,7 @@
return this.entityManager.getEntityGetter(); return this.entityManager.getEntityGetter();
} }
@@ -1697,6 +_,28 @@ @@ -1697,6 +2192,28 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
return this.serverLevelData.getGameRules(); return this.serverLevelData.getGameRules();
} }
@@ -1065,7 +1071,7 @@
@Override @Override
public CrashReportCategory fillReportDetails(CrashReport report) { public CrashReportCategory fillReportDetails(CrashReport report) {
CrashReportCategory crashReportCategory = super.fillReportDetails(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> { final class EntityCallbacks implements LevelCallback<Entity> {
@Override @Override
public void onCreated(Entity entity) { public void onCreated(Entity entity) {
@@ -1073,7 +1079,7 @@
} }
@Override @Override
@@ -1721,24 +_,32 @@ @@ -1721,24 +2239,32 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
@Override @Override
public void onTickingStart(Entity entity) { public void onTickingStart(Entity entity) {
@@ -1108,7 +1114,7 @@
String string = "onTrackingStart called during navigation iteration"; String string = "onTrackingStart called during navigation iteration";
Util.logAndPauseIfInIde( Util.logAndPauseIfInIde(
"onTrackingStart called during navigation iteration", new IllegalStateException("onTrackingStart called during navigation iteration") "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); entity.updateDynamicGameEventListener(DynamicGameEventListener::add);
@@ -1161,7 +1167,7 @@
ServerLevel.this.getChunkSource().removeEntity(entity); ServerLevel.this.getChunkSource().removeEntity(entity);
if (entity instanceof ServerPlayer serverPlayer) { if (entity instanceof ServerPlayer serverPlayer) {
ServerLevel.this.players.remove(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) { if (entity instanceof Mob mob) {
@@ -1170,7 +1176,7 @@
String string = "onTrackingStart called during navigation iteration"; String string = "onTrackingStart called during navigation iteration";
Util.logAndPauseIfInIde( Util.logAndPauseIfInIde(
"onTrackingStart called during navigation iteration", new IllegalStateException("onTrackingStart called during navigation iteration") "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); entity.updateDynamicGameEventListener(DynamicGameEventListener::remove);
@@ -1186,7 +1192,7 @@
} }
@Override @Override
@@ -1790,4 +_,24 @@ @@ -1790,4 +2367,24 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
entity.updateDynamicGameEventListener(DynamicGameEventListener::move); 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 --- a/net/minecraft/server/level/ServerPlayer.java
+++ b/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.ClientboundHurtAnimationPacket;
import net.minecraft.network.protocol.game.ClientboundMerchantOffersPacket; import net.minecraft.network.protocol.game.ClientboundMerchantOffersPacket;
import net.minecraft.network.protocol.game.ClientboundOpenBookPacket; import net.minecraft.network.protocol.game.ClientboundOpenBookPacket;
@@ -8,7 +16,7 @@
import net.minecraft.network.protocol.game.ClientboundOpenSignEditorPacket; import net.minecraft.network.protocol.game.ClientboundOpenSignEditorPacket;
import net.minecraft.network.protocol.game.ClientboundPlayerAbilitiesPacket; import net.minecraft.network.protocol.game.ClientboundPlayerAbilitiesPacket;
import net.minecraft.network.protocol.game.ClientboundPlayerCombatEndPacket; import net.minecraft.network.protocol.game.ClientboundPlayerCombatEndPacket;
@@ -235,7 +_,8 @@ @@ -235,7 +234,8 @@ public class ServerPlayer extends Player {
private int levitationStartTime; private int levitationStartTime;
private boolean disconnected; private boolean disconnected;
private int requestedViewDistance = 2; private int requestedViewDistance = 2;
@@ -18,7 +26,7 @@
@Nullable @Nullable
private Vec3 startingToFallPosition; private Vec3 startingToFallPosition;
@Nullable @Nullable
@@ -281,6 +_,13 @@ @@ -281,6 +281,13 @@ public class ServerPlayer extends Player {
} }
} }
@@ -32,7 +40,7 @@
@Override @Override
public void sendSlotChange(AbstractContainerMenu container, int slot, ItemStack itemStack) { public void sendSlotChange(AbstractContainerMenu container, int slot, ItemStack itemStack) {
ServerPlayer.this.connection.send(new ClientboundContainerSetSlotPacket(container.containerId, container.incrementStateId(), slot, 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 @Override
public void dataChanged(AbstractContainerMenu containerMenu, int dataSlotIndex, int value) { 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) { public void sendSystemMessage(Component component) {
ServerPlayer.this.sendSystemMessage(component); ServerPlayer.this.sendSystemMessage(component);
} }
@@ -109,7 +117,7 @@
public ServerPlayer(MinecraftServer server, ServerLevel level, GameProfile gameProfile, ClientInformation clientInformation) { public ServerPlayer(MinecraftServer server, ServerLevel level, GameProfile gameProfile, ClientInformation clientInformation) {
super(level, level.getSharedSpawnPos(), level.getSharedSpawnAngle(), gameProfile); super(level, level.getSharedSpawnPos(), level.getSharedSpawnAngle(), gameProfile);
@@ -356,16 +_,22 @@ @@ -356,16 +423,22 @@ public class ServerPlayer extends Player {
this.server = server; this.server = server;
this.stats = server.getPlayerList().getPlayerStats(this); this.stats = server.getPlayerList().getPlayerStats(this);
this.advancements = server.getPlayerList().getPlayerAdvancements(this); this.advancements = server.getPlayerList().getPlayerAdvancements(this);
@@ -135,7 +143,7 @@
int max = Math.max(0, this.server.getSpawnRadius(level)); int max = Math.max(0, this.server.getSpawnRadius(level));
int floor = Mth.floor(level.getWorldBorder().getDistanceToBorder(pos.getX(), pos.getZ())); int floor = Mth.floor(level.getWorldBorder().getDistanceToBorder(pos.getX(), pos.getZ()));
if (floor < max) { 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.enteredNetherPosition = compound.read("entered_nether_pos", Vec3.CODEC).orElse(null);
this.seenCredits = compound.getBooleanOr("seenCredits", false); this.seenCredits = compound.getBooleanOr("seenCredits", false);
this.recipeBook.fromNbt(compound.getCompoundOrEmpty("recipeBook"), key -> this.server.getRecipeManager().byKey(key).isPresent()); this.recipeBook.fromNbt(compound.getCompoundOrEmpty("recipeBook"), key -> this.server.getRecipeManager().byKey(key).isPresent());
@@ -143,7 +151,7 @@
if (this.isSleeping()) { if (this.isSleeping()) {
this.stopSleeping(); this.stopSleeping();
} }
@@ -459,12 +_,24 @@ @@ -459,12 +533,24 @@ public class ServerPlayer extends Player {
compound.putBoolean("spawn_extra_particles_on_fall", this.spawnExtraParticlesOnFall); compound.putBoolean("spawn_extra_particles_on_fall", this.spawnExtraParticlesOnFall);
compound.storeNullable("raid_omen_position", BlockPos.CODEC, this.raidOmenPosition); compound.storeNullable("raid_omen_position", BlockPos.CODEC, this.raidOmenPosition);
this.saveEnderPearls(compound); this.saveEnderPearls(compound);
@@ -169,7 +177,7 @@
CompoundTag compoundTag = new CompoundTag(); CompoundTag compoundTag = new CompoundTag();
CompoundTag compoundTag1 = new CompoundTag(); CompoundTag compoundTag1 = new CompoundTag();
rootVehicle.save(compoundTag1); rootVehicle.save(compoundTag1);
@@ -479,7 +_,7 @@ @@ -479,7 +565,7 @@ public class ServerPlayer extends Player {
if (!compound.isEmpty()) { if (!compound.isEmpty()) {
ServerLevel serverLevel = this.serverLevel(); ServerLevel serverLevel = this.serverLevel();
Entity entity = EntityType.loadEntityRecursive( Entity entity = EntityType.loadEntityRecursive(
@@ -178,7 +186,7 @@
); );
if (entity != null) { if (entity != null) {
UUID uuid = compound.get().read("Attach", UUIDUtil.CODEC).orElse(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()) { if (!this.isPassenger()) {
LOGGER.warn("Couldn't reattach entity to player"); 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(); ListTag listTag = new ListTag();
for (ThrownEnderpearl thrownEnderpearl : this.enderPearls) { for (ThrownEnderpearl thrownEnderpearl : this.enderPearls) {
@@ -199,7 +207,7 @@
if (thrownEnderpearl.isRemoved()) { if (thrownEnderpearl.isRemoved()) {
LOGGER.warn("Trying to save removed ender pearl, skipping"); LOGGER.warn("Trying to save removed ender pearl, skipping");
} else { } else {
@@ -546,6 +_,16 @@ @@ -546,6 +633,16 @@ public class ServerPlayer extends Player {
} }
} }
@@ -216,7 +224,7 @@
public void setExperiencePoints(int experiencePoints) { public void setExperiencePoints(int experiencePoints) {
float f = this.getXpNeededForNextLevel(); float f = this.getXpNeededForNextLevel();
float f1 = (f - 1.0F) / f; float f1 = (f - 1.0F) / f;
@@ -603,6 +_,11 @@ @@ -603,6 +700,11 @@ public class ServerPlayer extends Player {
@Override @Override
public void tick() { public void tick() {
@@ -228,7 +236,7 @@
this.tickClientLoadTimeout(); this.tickClientLoadTimeout();
this.gameMode.tick(); this.gameMode.tick();
this.wardenSpawnTracker.tick(); this.wardenSpawnTracker.tick();
@@ -610,9 +_,14 @@ @@ -610,9 +712,14 @@ public class ServerPlayer extends Player {
this.invulnerableTime--; this.invulnerableTime--;
} }
@@ -246,7 +254,7 @@
this.containerMenu = this.inventoryMenu; this.containerMenu = this.inventoryMenu;
} }
@@ -662,7 +_,7 @@ @@ -662,7 +769,7 @@ public class ServerPlayer extends Player {
public void doTick() { public void doTick() {
try { try {
@@ -255,7 +263,7 @@
super.tick(); super.tick();
} }
@@ -676,7 +_,7 @@ @@ -676,7 +783,7 @@ public class ServerPlayer extends Player {
if (this.getHealth() != this.lastSentHealth if (this.getHealth() != this.lastSentHealth
|| this.lastSentFood != this.foodData.getFoodLevel() || this.lastSentFood != this.foodData.getFoodLevel()
|| this.foodData.getSaturationLevel() == 0.0F != this.lastFoodSaturationZero) { || this.foodData.getSaturationLevel() == 0.0F != this.lastFoodSaturationZero) {
@@ -264,7 +272,7 @@
this.lastSentHealth = this.getHealth(); this.lastSentHealth = this.getHealth();
this.lastSentFood = this.foodData.getFoodLevel(); this.lastSentFood = this.foodData.getFoodLevel();
this.lastFoodSaturationZero = this.foodData.getSaturationLevel() == 0.0F; 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)); this.updateScoreForCriteria(ObjectiveCriteria.EXPERIENCE, Mth.ceil((float)this.lastRecordedExperience));
} }
@@ -277,7 +285,7 @@
if (this.experienceLevel != this.lastRecordedLevel) { if (this.experienceLevel != this.lastRecordedLevel) {
this.lastRecordedLevel = this.experienceLevel; this.lastRecordedLevel = this.experienceLevel;
this.updateScoreForCriteria(ObjectiveCriteria.LEVEL, Mth.ceil((float)this.lastRecordedLevel)); 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) { if (this.tickCount % 20 == 0) {
CriteriaTriggers.LOCATION.trigger(this); CriteriaTriggers.LOCATION.trigger(this);
} }
@@ -299,7 +307,7 @@
} catch (Throwable var4) { } catch (Throwable var4) {
CrashReport crashReport = CrashReport.forThrowable(var4, "Ticking player"); CrashReport crashReport = CrashReport.forThrowable(var4, "Ticking player");
CrashReportCategory crashReportCategory = crashReport.addCategory("Player being ticked"); 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.level().getDifficulty() == Difficulty.PEACEFUL && this.serverLevel().getGameRules().getBoolean(GameRules.RULE_NATURAL_REGENERATION)) {
if (this.tickCount % 20 == 0) { if (this.tickCount % 20 == 0) {
if (this.getHealth() < this.getMaxHealth()) { if (this.getHealth() < this.getMaxHealth()) {
@@ -308,22 +316,20 @@
} }
float saturationLevel = this.foodData.getSaturationLevel(); float saturationLevel = this.foodData.getSaturationLevel();
@@ -793,15 +_,36 @@ @@ -793,15 +921,36 @@ public class ServerPlayer extends Player {
} }
private void updateScoreForCriteria(ObjectiveCriteria criteria, int points) { private void updateScoreForCriteria(ObjectiveCriteria criteria, int points) {
- this.getScoreboard().forAllObjectives(criteria, this, score -> score.set(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 - @Override
- public void die(DamageSource cause) { - public void die(DamageSource cause) {
- this.gameEvent(GameEvent.ENTITY_DIE); - this.gameEvent(GameEvent.ENTITY_DIE);
- boolean _boolean = this.serverLevel().getGameRules().getBoolean(GameRules.RULE_SHOWDEATHMESSAGES); - boolean _boolean = this.serverLevel().getGameRules().getBoolean(GameRules.RULE_SHOWDEATHMESSAGES);
- if (_boolean) { - if (_boolean) {
- Component deathMessage = this.getCombatTracker().getDeathMessage(); - 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 + // Paper start - PlayerDeathEvent#getItemsToKeep
+ private static boolean shouldKeepDeathEventItem( + private static boolean shouldKeepDeathEventItem(
+ final org.bukkit.event.entity.PlayerDeathEvent event, + final org.bukkit.event.entity.PlayerDeathEvent event,
@@ -354,7 +360,7 @@
this.connection this.connection
.send( .send(
new ClientboundPlayerCombatKillPacket(this.getId(), deathMessage), 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(); Team team = this.getTeam();
if (team == null || team.getDeathMessageVisibility() == Team.Visibility.ALWAYS) { if (team == null || team.getDeathMessageVisibility() == Team.Visibility.ALWAYS) {
this.server.getPlayerList().broadcastSystemMessage(deathMessage, false); this.server.getPlayerList().broadcastSystemMessage(deathMessage, false);
@@ -827,7 +_,7 @@ @@ -827,7 +1035,7 @@ public class ServerPlayer extends Player {
this.server.getPlayerList().broadcastSystemToAllExceptTeam(this, deathMessage); this.server.getPlayerList().broadcastSystemToAllExceptTeam(this, deathMessage);
} }
} else { } else {
@@ -429,7 +435,7 @@
} }
this.removeEntitiesOnShoulder(); this.removeEntitiesOnShoulder();
@@ -835,11 +_,35 @@ @@ -835,11 +1043,35 @@ public class ServerPlayer extends Player {
this.tellNeutralMobsThatIDied(); this.tellNeutralMobsThatIDied();
} }
@@ -468,7 +474,7 @@
LivingEntity killCredit = this.getKillCredit(); LivingEntity killCredit = this.getKillCredit();
if (killCredit != null) { if (killCredit != null) {
this.awardStat(Stats.ENTITY_KILLED_BY.get(killCredit.getType())); 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) { public void awardKillScore(Entity entity, DamageSource damageSource) {
if (entity != this) { if (entity != this) {
super.awardKillScore(entity, damageSource); super.awardKillScore(entity, damageSource);
@@ -481,7 +487,7 @@
} else { } else {
this.awardStat(Stats.MOB_KILLS); this.awardStat(Stats.MOB_KILLS);
} }
@@ -891,7 +_,7 @@ @@ -891,7 +1123,7 @@ public class ServerPlayer extends Player {
if (playersTeam != null) { if (playersTeam != null) {
int id = playersTeam.getColor().getId(); int id = playersTeam.getColor().getId();
if (id >= 0 && id < crtieria.length) { if (id >= 0 && id < crtieria.length) {
@@ -490,7 +496,7 @@
} }
} }
} }
@@ -902,9 +_,20 @@ @@ -902,9 +1134,20 @@ public class ServerPlayer extends Player {
return false; return false;
} else { } else {
Entity entity = damageSource.getEntity(); Entity entity = damageSource.getEntity();
@@ -513,7 +519,7 @@
} }
} }
@@ -914,23 +_,77 @@ @@ -914,23 +1157,77 @@ public class ServerPlayer extends Player {
} }
private boolean isPvpAllowed() { private boolean isPvpAllowed() {
@@ -546,7 +552,6 @@
} }
} else { } else {
- return new TeleportTransition(this.server.overworld(), this, postTeleportTransition); - return new TeleportTransition(this.server.overworld(), this, postTeleportTransition);
- }
+ teleportTransition = new TeleportTransition(this.server.overworld(), this, postTeleportTransition); // CraftBukkit + teleportTransition = new TeleportTransition(this.server.overworld(), this, postTeleportTransition); // CraftBukkit
+ } + }
+ // CraftBukkit start + // CraftBukkit start
@@ -576,7 +581,7 @@
+ // Spigot start + // Spigot start
+ if (this.connection.isDisconnected()) { + if (this.connection.isDisconnected()) {
+ return null; + return null;
+ } }
+ // Spigot end + // Spigot end
+ +
+ location = respawnEvent.getRespawnLocation(); + location = respawnEvent.getRespawnLocation();
@@ -597,7 +602,7 @@
} }
public static Optional<ServerPlayer.RespawnPosAngle> findRespawnAndUseSpawnBlock( 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); level.setBlock(blockPos, blockState.setValue(RespawnAnchorBlock.CHARGE, blockState.getValue(RespawnAnchorBlock.CHARGE) - 1), 3);
} }
@@ -610,7 +615,7 @@
} else if (!flag) { } else if (!flag) {
return Optional.empty(); return Optional.empty();
} else { } else {
@@ -958,7 +_,7 @@ @@ -958,7 +1255,7 @@ public class ServerPlayer extends Player {
BlockState blockState1 = level.getBlockState(blockPos.above()); BlockState blockState1 = level.getBlockState(blockPos.above());
boolean isPossibleToRespawnInThis1 = blockState1.getBlock().isPossibleToRespawnInThis(blockState1); boolean isPossibleToRespawnInThis1 = blockState1.getBlock().isPossibleToRespawnInThis(blockState1);
return isPossibleToRespawnInThis && isPossibleToRespawnInThis1 return isPossibleToRespawnInThis && isPossibleToRespawnInThis1
@@ -619,7 +624,7 @@
: Optional.empty(); : Optional.empty();
} }
} }
@@ -976,6 +_,7 @@ @@ -976,6 +1273,7 @@ public class ServerPlayer extends Player {
@Nullable @Nullable
@Override @Override
public ServerPlayer teleport(TeleportTransition teleportTransition) { public ServerPlayer teleport(TeleportTransition teleportTransition) {
@@ -627,7 +632,7 @@
if (this.isRemoved()) { if (this.isRemoved()) {
return null; return null;
} else { } else {
@@ -985,17 +_,52 @@ @@ -985,17 +1283,52 @@ public class ServerPlayer extends Player {
ServerLevel level = teleportTransition.newLevel(); ServerLevel level = teleportTransition.newLevel();
ServerLevel serverLevel = this.serverLevel(); ServerLevel serverLevel = this.serverLevel();
@@ -683,7 +688,7 @@
this.isChangingDimension = true; this.isChangingDimension = true;
LevelData levelData = level.getLevelData(); LevelData levelData = level.getLevelData();
this.connection.send(new ClientboundRespawnPacket(this.createCommonSpawnInfo(level), (byte)3)); 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); playerList.sendPlayerPermissionLevel(this);
serverLevel.removePlayerImmediately(this, Entity.RemovalReason.CHANGED_DIMENSION); serverLevel.removePlayerImmediately(this, Entity.RemovalReason.CHANGED_DIMENSION);
this.unsetRemoved(); this.unsetRemoved();
@@ -716,7 +721,7 @@
this.connection.resetPosition(); this.connection.resetPosition();
level.addDuringTeleport(this); level.addDuringTeleport(this);
profilerFiller.pop(); profilerFiller.pop();
@@ -1027,10 +_,39 @@ @@ -1027,11 +1374,40 @@ public class ServerPlayer extends Player {
this.lastSentExp = -1; this.lastSentExp = -1;
this.lastSentHealth = -1.0F; this.lastSentHealth = -1.0F;
this.lastSentFood = -1; this.lastSentFood = -1;
@@ -735,7 +740,7 @@
} }
} }
} }
+
+ // CraftBukkit start + // CraftBukkit start
+ @Override + @Override
+ public @Nullable org.bukkit.craftbukkit.event.CraftPortalEvent callPortalEvent( + public @Nullable org.bukkit.craftbukkit.event.CraftPortalEvent callPortalEvent(
@@ -753,10 +758,11 @@
+ return new org.bukkit.craftbukkit.event.CraftPortalEvent(event); + return new org.bukkit.craftbukkit.event.CraftPortalEvent(event);
+ } + }
+ // CraftBukkit end + // CraftBukkit end
+
@Override @Override
public void forceSetRotation(float yRot, float xRot) { 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) { public void triggerDimensionChangeTriggers(ServerLevel level) {
ResourceKey<Level> resourceKey = level.dimension(); ResourceKey<Level> resourceKey = level.dimension();
ResourceKey<Level> resourceKey1 = this.level().dimension(); ResourceKey<Level> resourceKey1 = this.level().dimension();
@@ -786,7 +792,7 @@
this.enteredNetherPosition = null; this.enteredNetherPosition = null;
} }
} }
@@ -1061,19 +_,18 @@ @@ -1061,19 +1451,18 @@ public class ServerPlayer extends Player {
this.containerMenu.broadcastChanges(); this.containerMenu.broadcastChanges();
} }
@@ -810,7 +816,7 @@
if (this.level().isBrightOutside()) { if (this.level().isBrightOutside()) {
return Either.left(Player.BedSleepingProblem.NOT_POSSIBLE_NOW); return Either.left(Player.BedSleepingProblem.NOT_POSSIBLE_NOW);
} else { } else {
@@ -1092,7 +_,34 @@ @@ -1092,7 +1481,34 @@ public class ServerPlayer extends Player {
} }
} }
@@ -846,7 +852,7 @@
this.awardStat(Stats.SLEEP_IN_BED); this.awardStat(Stats.SLEEP_IN_BED);
CriteriaTriggers.SLEPT_IN_BED.trigger(this); CriteriaTriggers.SLEPT_IN_BED.trigger(this);
}); });
@@ -1128,21 +_,29 @@ @@ -1128,21 +1544,29 @@ public class ServerPlayer extends Player {
@Override @Override
public void stopSleepInBed(boolean wakeImmediately, boolean updateLevelForSleepingPlayers) { public void stopSleepInBed(boolean wakeImmediately, boolean updateLevelForSleepingPlayers) {
@@ -879,7 +885,7 @@
} }
@Override @Override
@@ -1185,8 +_,9 @@ @@ -1185,8 +1609,9 @@ public class ServerPlayer extends Player {
this.connection.send(new ClientboundOpenSignEditorPacket(signEntity.getBlockPos(), isFrontText)); this.connection.send(new ClientboundOpenSignEditorPacket(signEntity.getBlockPos(), isFrontText));
} }
@@ -890,7 +896,7 @@
} }
@Override @Override
@@ -1194,12 +_,39 @@ @@ -1194,12 +1619,39 @@ public class ServerPlayer extends Player {
if (menu == null) { if (menu == null) {
return OptionalInt.empty(); return OptionalInt.empty();
} else { } else {
@@ -931,7 +937,7 @@
if (abstractContainerMenu == null) { if (abstractContainerMenu == null) {
if (this.isSpectator()) { if (this.isSpectator()) {
this.displayClientMessage(Component.translatable("container.spectatorCantOpen").withStyle(ChatFormatting.RED), true); 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(); return OptionalInt.empty();
} else { } else {
@@ -948,7 +954,7 @@
return OptionalInt.of(this.containerCounter); return OptionalInt.of(this.containerCounter);
} }
} }
@@ -1223,14 +_,25 @@ @@ -1223,14 +1679,25 @@ public class ServerPlayer extends Player {
@Override @Override
public void openHorseInventory(AbstractHorse horse, Container inventory) { public void openHorseInventory(AbstractHorse horse, Container inventory) {
@@ -977,7 +983,7 @@
this.initMenu(this.containerMenu); this.initMenu(this.containerMenu);
} }
@@ -1252,10 +_,30 @@ @@ -1252,10 +1719,30 @@ public class ServerPlayer extends Player {
@Override @Override
public void closeContainer() { public void closeContainer() {
@@ -1008,7 +1014,7 @@
@Override @Override
public void doCloseContainer() { public void doCloseContainer() {
this.containerMenu.removed(this); 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); int rounded = Math.round((float)Math.sqrt(dx * dx + dy * dy + dz * dz) * 100.0F);
if (rounded > 0) { if (rounded > 0) {
this.awardStat(Stats.SWIM_ONE_CM, rounded); this.awardStat(Stats.SWIM_ONE_CM, rounded);
@@ -1031,7 +1037,7 @@
} }
} else if (this.onClimbable()) { } else if (this.onClimbable()) {
if (dy > 0.0) { if (dy > 0.0) {
@@ -1301,13 +_,13 @@ @@ -1301,13 +1788,13 @@ public class ServerPlayer extends Player {
if (rounded > 0) { if (rounded > 0) {
if (this.isSprinting()) { if (this.isSprinting()) {
this.awardStat(Stats.SPRINT_ONE_CM, rounded); this.awardStat(Stats.SPRINT_ONE_CM, rounded);
@@ -1048,7 +1054,7 @@
} }
} }
} else if (this.isFallFlying()) { } else if (this.isFallFlying()) {
@@ -1347,13 +_,13 @@ @@ -1347,13 +1834,13 @@ public class ServerPlayer extends Player {
@Override @Override
public void awardStat(Stat<?> stat, int amount) { public void awardStat(Stat<?> stat, int amount) {
this.stats.increment(this, stat, amount); this.stats.increment(this, stat, amount);
@@ -1064,7 +1070,7 @@
} }
@Override @Override
@@ -1384,9 +_,9 @@ @@ -1384,9 +1871,9 @@ public class ServerPlayer extends Player {
super.jumpFromGround(); super.jumpFromGround();
this.awardStat(Stats.JUMP); this.awardStat(Stats.JUMP);
if (this.isSprinting()) { if (this.isSprinting()) {
@@ -1076,7 +1082,7 @@
} }
} }
@@ -1399,6 +_,13 @@ @@ -1399,6 +1886,13 @@ public class ServerPlayer extends Player {
public void disconnect() { public void disconnect() {
this.disconnected = true; this.disconnected = true;
this.ejectPassengers(); this.ejectPassengers();
@@ -1090,7 +1096,7 @@
if (this.isSleeping()) { if (this.isSleeping()) {
this.stopSleepInBed(true, false); this.stopSleepInBed(true, false);
} }
@@ -1410,6 +_,7 @@ @@ -1410,6 +1904,7 @@ public class ServerPlayer extends Player {
public void resetSentInfo() { public void resetSentInfo() {
this.lastSentHealth = -1.0E8F; this.lastSentHealth = -1.0E8F;
@@ -1098,7 +1104,7 @@
} }
@Override @Override
@@ -1444,12 +_,12 @@ @@ -1444,12 +1939,12 @@ public class ServerPlayer extends Player {
this.onUpdateAbilities(); this.onUpdateAbilities();
if (keepEverything) { if (keepEverything) {
this.getAttributes().assignBaseValues(that.getAttributes()); this.getAttributes().assignBaseValues(that.getAttributes());
@@ -1113,7 +1119,7 @@
} }
this.getInventory().replaceWith(that.getInventory()); this.getInventory().replaceWith(that.getInventory());
@@ -1460,7 +_,7 @@ @@ -1460,7 +1955,7 @@ public class ServerPlayer extends Player {
this.portalProcess = that.portalProcess; this.portalProcess = that.portalProcess;
} else { } else {
this.getAttributes().assignBaseValues(that.getAttributes()); this.getAttributes().assignBaseValues(that.getAttributes());
@@ -1122,7 +1128,7 @@
if (this.serverLevel().getGameRules().getBoolean(GameRules.RULE_KEEPINVENTORY) || that.isSpectator()) { if (this.serverLevel().getGameRules().getBoolean(GameRules.RULE_KEEPINVENTORY) || that.isSpectator()) {
this.getInventory().replaceWith(that.getInventory()); this.getInventory().replaceWith(that.getInventory());
this.experienceLevel = that.experienceLevel; this.experienceLevel = that.experienceLevel;
@@ -1476,7 +_,7 @@ @@ -1476,7 +1971,7 @@ public class ServerPlayer extends Player {
this.lastSentExp = -1; this.lastSentExp = -1;
this.lastSentHealth = -1.0F; this.lastSentHealth = -1.0F;
this.lastSentFood = -1; this.lastSentFood = -1;
@@ -1131,7 +1137,7 @@
this.seenCredits = that.seenCredits; this.seenCredits = that.seenCredits;
this.enteredNetherPosition = that.enteredNetherPosition; this.enteredNetherPosition = that.enteredNetherPosition;
this.chunkTrackingView = that.chunkTrackingView; this.chunkTrackingView = that.chunkTrackingView;
@@ -1529,7 +_,7 @@ @@ -1529,7 +2024,7 @@ public class ServerPlayer extends Player {
} }
@Override @Override
@@ -1140,7 +1146,7 @@
if (this.isSleeping()) { if (this.isSleeping()) {
this.stopSleepInBed(true, true); this.stopSleepInBed(true, true);
} }
@@ -1538,7 +_,7 @@ @@ -1538,7 +2033,7 @@ public class ServerPlayer extends Player {
this.setCamera(this); this.setCamera(this);
} }
@@ -1149,7 +1155,7 @@
if (flag) { if (flag) {
this.setYHeadRot(relativeMovements.contains(Relative.Y_ROT) ? this.getYHeadRot() + yaw : yaw); 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) { public boolean setGameMode(GameType gameMode) {
@@ -1169,7 +1175,7 @@
} else { } else {
this.connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.CHANGE_GAME_MODE, gameMode.getId())); this.connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.CHANGE_GAME_MODE, gameMode.getId()));
if (gameMode == GameType.SPECTATOR) { if (gameMode == GameType.SPECTATOR) {
@@ -1593,7 +_,7 @@ @@ -1593,7 +2096,7 @@ public class ServerPlayer extends Player {
this.onUpdateAbilities(); this.onUpdateAbilities();
this.updateEffectVisibility(); 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) { 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) { public void updateOptions(ClientInformation clientInformation) {
@@ -1236,7 +1242,7 @@
this.requestedViewDistance = clientInformation.viewDistance(); this.requestedViewDistance = clientInformation.viewDistance();
this.chatVisibility = clientInformation.chatVisibility(); this.chatVisibility = clientInformation.chatVisibility();
this.canChatColor = clientInformation.chatColors(); this.canChatColor = clientInformation.chatColors();
@@ -1747,8 +_,23 @@ @@ -1747,8 +2290,23 @@ public class ServerPlayer extends Player {
Entity camera = this.getCamera(); Entity camera = this.getCamera();
this.camera = (Entity)(entityToSpectate == null ? this : entityToSpectate); this.camera = (Entity)(entityToSpectate == null ? this : entityToSpectate);
if (camera != this.camera) { if (camera != this.camera) {
@@ -1261,7 +1267,7 @@
} }
if (entityToSpectate != null) { if (entityToSpectate != null) {
@@ -1782,11 +_,11 @@ @@ -1782,11 +2340,11 @@ public class ServerPlayer extends Player {
@Nullable @Nullable
public Component getTabListDisplayName() { public Component getTabListDisplayName() {
@@ -1275,7 +1281,7 @@
} }
@Override @Override
@@ -1817,11 +_,56 @@ @@ -1817,11 +2375,56 @@ public class ServerPlayer extends Player {
} }
public void setRespawnPosition(@Nullable ServerPlayer.RespawnConfig respawnConfig, boolean displayInChat) { public void setRespawnPosition(@Nullable ServerPlayer.RespawnConfig respawnConfig, boolean displayInChat) {
@@ -1334,7 +1340,7 @@
} }
public SectionPos getLastSectionPos() { public SectionPos getLastSectionPos() {
@@ -1851,16 +_,23 @@ @@ -1851,16 +2454,23 @@ public class ServerPlayer extends Player {
} }
@Override @Override
@@ -1362,7 +1368,7 @@
return itemEntity; return itemEntity;
} }
@@ -1888,6 +_,16 @@ @@ -1888,6 +2498,16 @@ public class ServerPlayer extends Player {
} }
public void loadGameTypes(@Nullable CompoundTag tag) { public void loadGameTypes(@Nullable CompoundTag tag) {
@@ -1379,7 +1385,7 @@
this.gameMode this.gameMode
.setGameModeForPlayer(this.calculateGameModeForNewPlayer(readPlayerMode(tag, "playerGameType")), readPlayerMode(tag, "previousPlayerGameType")); .setGameModeForPlayer(this.calculateGameModeForNewPlayer(readPlayerMode(tag, "playerGameType")), readPlayerMode(tag, "previousPlayerGameType"));
} }
@@ -1989,8 +_,14 @@ @@ -1989,8 +2609,14 @@ public class ServerPlayer extends Player {
@Override @Override
public void removeVehicle() { public void removeVehicle() {
@@ -1395,7 +1401,7 @@
if (vehicle instanceof LivingEntity livingEntity) { if (vehicle instanceof LivingEntity livingEntity) {
for (MobEffectInstance mobEffectInstance : livingEntity.getActiveEffects()) { for (MobEffectInstance mobEffectInstance : livingEntity.getActiveEffects()) {
this.connection.send(new ClientboundRemoveMobEffectPacket(vehicle.getId(), mobEffectInstance.getEffect())); 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) { public static long placeEnderPearlTicket(ServerLevel level, ChunkPos pos) {
@@ -1404,7 +1410,7 @@
return TicketType.ENDER_PEARL.timeout(); 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) { 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); 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 --- a/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
+++ b/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 net.minecraft.util.profiling.Profiler;
import org.slf4j.Logger; import org.slf4j.Logger;
@@ -39,13 +47,12 @@
this.keepAliveTime = Util.getMillis(); this.keepAliveTime = Util.getMillis();
this.latency = cookie.latency(); this.latency = cookie.latency();
this.transferred = cookie.transferred(); this.transferred = cookie.transferred();
- }
+ // CraftBukkit start - add fields and methods + // CraftBukkit start - add fields and methods
+ this.player = player; + this.player = player;
+ this.player.transferCookieConnection = this; + this.player.transferCookieConnection = this;
+ this.cserver = server.server; + this.cserver = server.server;
+ } }
+
+ public org.bukkit.craftbukkit.entity.CraftPlayer getCraftPlayer() { + public org.bukkit.craftbukkit.entity.CraftPlayer getCraftPlayer() {
+ return this.player.getBukkitEntity(); + return this.player.getBukkitEntity();
+ } + }
@@ -70,10 +77,11 @@
+ this.disconnect(reason, cause); // Paper - kick event causes + this.disconnect(reason, cause); // Paper - kick event causes
+ } + }
+ // CraftBukkit end + // CraftBukkit end
+
private void close() { private void close() {
if (!this.closed) { if (!this.closed) {
@@ -61,6 +_,12 @@ this.closedListenerTime = Util.getMillis();
@@ -61,6 +98,12 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
@Override @Override
public void onDisconnect(DisconnectionDetails details) { public void onDisconnect(DisconnectionDetails details) {
@@ -86,7 +94,7 @@
if (this.isSingleplayerOwner()) { if (this.isSingleplayerOwner()) {
LOGGER.info("Stopping singleplayer server as player logged out"); LOGGER.info("Stopping singleplayer server as player logged out");
this.server.halt(false); 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.latency = (this.latency * 3 + i) / 4;
this.keepAlivePending = false; this.keepAlivePending = false;
} else if (!this.isSingleplayerOwner()) { } 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) { public void handlePong(ServerboundPongPacket packet) {
} }
@@ -104,7 +112,6 @@
+ +
@Override @Override
public void handleCustomPayload(ServerboundCustomPayloadPacket packet) { public void handleCustomPayload(ServerboundCustomPayloadPacket packet) {
- }
+ // Paper start + // Paper start
+ if (packet.payload() instanceof net.minecraft.network.protocol.common.custom.BrandPayload(String brand)) { + if (packet.payload() instanceof net.minecraft.network.protocol.common.custom.BrandPayload(String brand)) {
+ this.player.clientBrandName = brand; + this.player.clientBrandName = brand;
@@ -165,7 +172,7 @@
+ +
+ public final boolean isDisconnected() { + public final boolean isDisconnected() {
+ return (!this.player.joining && !this.connection.isConnected()) || this.processedDisconnect; // Paper - Fix duplication bugs + return (!this.player.joining && !this.connection.isConnected()) || this.processedDisconnect; // Paper - Fix duplication bugs
+ } }
+ // Paper end + // Paper end
@Override @Override
@@ -174,9 +181,8 @@
if (packet.action() == ServerboundResourcePackPacket.Action.DECLINED && this.server.isResourcePackRequired()) { if (packet.action() == ServerboundResourcePackPacket.Action.DECLINED && this.server.isResourcePackRequired()) {
LOGGER.info("Disconnecting {} due to resource pack {} rejection", this.playerProfile().getName(), packet.id()); 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"));
- }
+ this.disconnect(Component.translatable("multiplayer.requiredTexturePrompt.disconnect"), org.bukkit.event.player.PlayerKickEvent.Cause.RESOURCE_PACK_REJECTION); // Paper - kick event cause + 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 + // Paper start - adventure pack callbacks
+ // call the callbacks before the previously-existing event so the event has final say + // call the callbacks before the previously-existing event so the event has final say
+ final net.kyori.adventure.resource.ResourcePackCallback callback; + final net.kyori.adventure.resource.ResourcePackCallback callback;
@@ -225,7 +231,7 @@
} else if (this.checkIfClosed(millis)) { } else if (this.checkIfClosed(millis)) {
this.keepAlivePending = true; this.keepAlivePending = true;
this.keepAliveTime = millis; this.keepAliveTime = millis;
@@ -126,7 +_,7 @@ @@ -126,7 +262,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
private boolean checkIfClosed(long time) { private boolean checkIfClosed(long time) {
if (this.closed) { if (this.closed) {
if (time - this.closedListenerTime >= 15000L) { if (time - this.closedListenerTime >= 15000L) {
@@ -234,7 +240,7 @@
} }
return false; return false;
@@ -149,6 +_,13 @@ @@ -149,6 +285,13 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
} }
public void send(Packet<?> packet, @Nullable PacketSendListener listener) { public void send(Packet<?> packet, @Nullable PacketSendListener listener) {
@@ -248,7 +254,7 @@
if (packet.isTerminal()) { if (packet.isTerminal()) {
this.close(); 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 + @Deprecated @io.papermc.paper.annotation.DoNotUse // Paper - kick event causes
public void disconnect(Component reason) { public void disconnect(Component reason) {
- this.disconnect(new DisconnectionDetails(reason)); - this.disconnect(new DisconnectionDetails(reason));
- }
-
- public void disconnect(DisconnectionDetails disconnectionDetails) {
+ // Paper start - kick event causes + // Paper start - kick event causes
+ this.disconnect(reason, org.bukkit.event.player.PlayerKickEvent.Cause.UNKNOWN); + this.disconnect(reason, org.bukkit.event.player.PlayerKickEvent.Cause.UNKNOWN);
+ } + }
@@ -324,8 +327,9 @@
+ +
+ // Send the possibly modified leave message + // 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 + 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 + private void disconnect0(DisconnectionDetails disconnectionDetails, @Nullable net.kyori.adventure.text.Component leaveMessage) { // Paper - use kick event leave message
+ // CraftBukkit end + // CraftBukkit end
+ this.player.quitReason = org.bukkit.event.player.PlayerQuitEvent.QuitReason.KICKED; // Paper - Add API for quit reason + this.player.quitReason = org.bukkit.event.player.PlayerQuitEvent.QuitReason.KICKED; // Paper - Add API for quit reason
@@ -334,11 +338,9 @@
new ClientboundDisconnectPacket(disconnectionDetails.reason()), new ClientboundDisconnectPacket(disconnectionDetails.reason()),
PacketSendListener.thenRun(() -> this.connection.disconnect(disconnectionDetails)) 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.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 + // CraftBukkit - Don't wait
+ this.server.scheduleOnMain(this.connection::handleDisconnection); // Paper + this.server.scheduleOnMain(this.connection::handleDisconnection); // Paper
+ } + }
@@ -366,7 +368,7 @@
+ ServerCommonPacketListenerImpl.this.connection.enableAutoRead(); + ServerCommonPacketListenerImpl.this.connection.enableAutoRead();
+ } + }
+ }); + });
+ } }
+ // Paper end - add proper async disconnect + // Paper end - add proper async disconnect
protected boolean isSingleplayerOwner() { 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 --- a/net/minecraft/server/network/ServerConfigurationPacketListenerImpl.java
+++ b/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 @Nullable
private SynchronizeRegistriesTask synchronizeRegistriesTask; private SynchronizeRegistriesTask synchronizeRegistriesTask;
@@ -13,7 +21,7 @@
this.gameProfile = cookie.gameProfile(); this.gameProfile = cookie.gameProfile();
this.clientInformation = cookie.clientInformation(); this.clientInformation = cookie.clientInformation();
} }
@@ -61,6 +_,11 @@ @@ -61,6 +63,11 @@ public class ServerConfigurationPacketListenerImpl extends ServerCommonPacketLis
@Override @Override
public void onDisconnect(DisconnectionDetails details) { public void onDisconnect(DisconnectionDetails details) {
@@ -25,7 +33,7 @@
LOGGER.info("{} lost connection: {}", this.gameProfile, details.reason().getString()); LOGGER.info("{} lost connection: {}", this.gameProfile, details.reason().getString());
super.onDisconnect(details); super.onDisconnect(details);
} }
@@ -73,6 +_,12 @@ @@ -73,6 +80,12 @@ public class ServerConfigurationPacketListenerImpl extends ServerCommonPacketLis
public void startConfiguration() { public void startConfiguration() {
this.send(new ClientboundCustomPayloadPacket(new BrandPayload(this.server.getServerModName()))); this.send(new ClientboundCustomPayloadPacket(new BrandPayload(this.server.getServerModName())));
ServerLinks serverLinks = this.server.serverLinks(); ServerLinks serverLinks = this.server.serverLinks();
@@ -38,7 +46,7 @@
if (!serverLinks.isEmpty()) { if (!serverLinks.isEmpty()) {
this.send(new ClientboundServerLinksPacket(serverLinks.untrust())); this.send(new ClientboundServerLinksPacket(serverLinks.untrust()));
} }
@@ -105,6 +_,7 @@ @@ -105,6 +118,7 @@ public class ServerConfigurationPacketListenerImpl extends ServerCommonPacketLis
@Override @Override
public void handleClientInformation(ServerboundClientInformationPacket packet) { public void handleClientInformation(ServerboundClientInformationPacket packet) {
this.clientInformation = packet.information(); this.clientInformation = packet.information();
@@ -46,7 +54,7 @@
} }
@Override @Override
@@ -139,16 +_,21 @@ @@ -139,16 +153,21 @@ public class ServerConfigurationPacketListenerImpl extends ServerCommonPacketLis
return; 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 --- a/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/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 net.minecraft.world.phys.shapes.VoxelShape;
import org.slf4j.Logger; import org.slf4j.Logger;
@@ -40,7 +48,7 @@
public class ServerGamePacketListenerImpl public class ServerGamePacketListenerImpl
extends ServerCommonPacketListenerImpl extends ServerCommonPacketListenerImpl
implements GameProtocols.Context, implements GameProtocols.Context,
@@ -222,7 +_,9 @@ @@ -222,7 +255,9 @@ public class ServerGamePacketListenerImpl
private int tickCount; private int tickCount;
private int ackBlockChangesUpTo = -1; private int ackBlockChangesUpTo = -1;
private final TickThrottler chatSpamThrottler = new TickThrottler(20, 200); private final TickThrottler chatSpamThrottler = new TickThrottler(20, 200);
@@ -50,7 +58,7 @@
private double firstGoodX; private double firstGoodX;
private double firstGoodY; private double firstGoodY;
private double firstGoodZ; private double firstGoodZ;
@@ -248,23 +_,42 @@ @@ -248,23 +283,42 @@ public class ServerGamePacketListenerImpl
private int receivedMovePacketCount; private int receivedMovePacketCount;
private int knownMovePacketCount; private int knownMovePacketCount;
private boolean receivedMovementThisTick; private boolean receivedMovementThisTick;
@@ -95,7 +103,7 @@
} }
@Override @Override
@@ -284,8 +_,8 @@ @@ -284,8 +338,8 @@ public class ServerGamePacketListenerImpl
this.knownMovePacketCount = this.receivedMovePacketCount; this.knownMovePacketCount = this.receivedMovePacketCount;
if (this.clientIsFloating && !this.player.isSleeping() && !this.player.isPassenger() && !this.player.isDeadOrDying()) { if (this.clientIsFloating && !this.player.isSleeping() && !this.player.isPassenger() && !this.player.isDeadOrDying()) {
if (++this.aboveGroundTickCount > this.getMaximumFlyingTicks(this.player)) { if (++this.aboveGroundTickCount > this.getMaximumFlyingTicks(this.player)) {
@@ -106,7 +114,7 @@
return; return;
} }
} else { } else {
@@ -303,8 +_,8 @@ @@ -303,8 +357,8 @@ public class ServerGamePacketListenerImpl
this.vehicleLastGoodZ = this.lastVehicle.getZ(); this.vehicleLastGoodZ = this.lastVehicle.getZ();
if (this.clientVehicleIsFloating && this.lastVehicle.getControllingPassenger() == this.player) { if (this.clientVehicleIsFloating && this.lastVehicle.getControllingPassenger() == this.player) {
if (++this.aboveGroundVehicleTickCount > this.getMaximumFlyingTicks(this.lastVehicle)) { if (++this.aboveGroundVehicleTickCount > this.getMaximumFlyingTicks(this.lastVehicle)) {
@@ -117,7 +125,7 @@
return; return;
} }
} else { } else {
@@ -320,11 +_,20 @@ @@ -320,11 +374,20 @@ public class ServerGamePacketListenerImpl
this.keepConnectionAlive(); this.keepConnectionAlive();
this.chatSpamThrottler.tick(); this.chatSpamThrottler.tick();
this.dropSpamThrottler.tick(); this.dropSpamThrottler.tick();
@@ -127,7 +135,6 @@
&& this.server.getPlayerIdleTimeout() > 0 && this.server.getPlayerIdleTimeout() > 0
- && Util.getMillis() - this.player.getLastActionTime() > this.server.getPlayerIdleTimeout() * 1000L * 60L) { - && Util.getMillis() - this.player.getLastActionTime() > this.server.getPlayerIdleTimeout() * 1000L * 60L) {
- this.disconnect(Component.translatable("multiplayer.disconnect.idling")); - 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 + && 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.player.resetLastActionTime(); // CraftBukkit - SPIGOT-854
+ this.disconnect(Component.translatable("multiplayer.disconnect.idling"), org.bukkit.event.player.PlayerKickEvent.Cause.IDLING); // Paper - kick event cause + 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()) { + if (!this.hasLoggedExpiry && this.chatSession != null && this.chatSession.profilePublicKey().data().hasExpired()) {
+ LOGGER.info("Player profile key for {} has expired!", this.player.getName().getString()); + LOGGER.info("Player profile key for {} has expired!", this.player.getName().getString());
+ this.hasLoggedExpiry = true; + this.hasLoggedExpiry = true;
+ } }
+ // Paper end - Prevent causing expired keys from impacting new joins + // Paper end - Prevent causing expired keys from impacting new joins
} }
private int getMaximumFlyingTicks(Entity entity) { private int getMaximumFlyingTicks(Entity entity) {
@@ -384,6 +_,12 @@ @@ -384,6 +447,12 @@ public class ServerGamePacketListenerImpl
@Override @Override
public void handlePlayerInput(ServerboundPlayerInputPacket packet) { public void handlePlayerInput(ServerboundPlayerInputPacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
@@ -154,7 +161,7 @@
this.player.setLastClientInput(packet.input()); this.player.setLastClientInput(packet.input());
} }
@@ -403,17 +_,29 @@ @@ -403,17 +472,29 @@ public class ServerGamePacketListenerImpl
public void handleMoveVehicle(ServerboundMoveVehiclePacket packet) { public void handleMoveVehicle(ServerboundMoveVehiclePacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
if (containsInvalidValues(packet.position().x(), packet.position().y(), packet.position().z(), packet.yRot(), packet.xRot())) { 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 f = Mth.wrapDegrees(packet.yRot());
float f1 = Mth.wrapDegrees(packet.xRot()); float f1 = Mth.wrapDegrees(packet.xRot());
double d3 = d - this.vehicleFirstGoodX; double d3 = d - this.vehicleFirstGoodX;
@@ -421,7 +_,52 @@ @@ -421,7 +502,52 @@ public class ServerGamePacketListenerImpl
double d5 = d2 - this.vehicleFirstGoodZ; double d5 = d2 - this.vehicleFirstGoodZ;
double d6 = rootVehicle.getDeltaMovement().lengthSqr(); double d6 = rootVehicle.getDeltaMovement().lengthSqr();
double d7 = d3 * d3 + d4 * d4 + d5 * d5; double d7 = d3 * d3 + d4 * d4 + d5 * d5;
@@ -242,7 +249,7 @@
LOGGER.warn( LOGGER.warn(
"{} (vehicle of {}) moved too quickly! {},{},{}", rootVehicle.getName().getString(), this.player.getName().getString(), d3, d4, d5 "{} (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)); boolean flag = serverLevel.noCollision(rootVehicle, rootVehicle.getBoundingBox().deflate(0.0625));
@@ -262,7 +269,7 @@
d3 = d - rootVehicle.getX(); d3 = d - rootVehicle.getX();
d4 = d1 - rootVehicle.getY(); d4 = d1 - rootVehicle.getY();
if (d4 > -0.5 || d4 < 0.5) { if (d4 > -0.5 || d4 < 0.5) {
@@ -448,27 +_,80 @@ @@ -448,27 +575,80 @@ public class ServerGamePacketListenerImpl
d5 = d2 - rootVehicle.getZ(); d5 = d2 - rootVehicle.getZ();
d7 = d3 * d3 + d4 * d4 + d5 * d5; d7 = d3 * d3 + d4 * d4 + d5 * d5;
boolean flag2 = false; boolean flag2 = false;
@@ -345,7 +352,7 @@
&& !flag1 && !flag1
&& !this.server.isFlightAllowed() && !this.server.isFlightAllowed()
&& !rootVehicle.isNoGravity() && !rootVehicle.isNoGravity()
@@ -491,12 +_,12 @@ @@ -491,12 +671,12 @@ public class ServerGamePacketListenerImpl
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
if (packet.getId() == this.awaitingTeleport) { if (packet.getId() == this.awaitingTeleport) {
if (this.awaitingPositionFromClient == null) { if (this.awaitingPositionFromClient == null) {
@@ -360,7 +367,7 @@
this.awaitingPositionFromClient.x, this.awaitingPositionFromClient.x,
this.awaitingPositionFromClient.y, this.awaitingPositionFromClient.y,
this.awaitingPositionFromClient.z, this.awaitingPositionFromClient.z,
@@ -508,12 +_,20 @@ @@ -508,12 +688,20 @@ public class ServerGamePacketListenerImpl
this.lastGoodZ = this.awaitingPositionFromClient.z; this.lastGoodZ = this.awaitingPositionFromClient.z;
this.player.hasChangedDimension(); this.player.hasChangedDimension();
this.awaitingPositionFromClient = null; this.awaitingPositionFromClient = null;
@@ -381,7 +388,7 @@
this.player.setClientLoaded(true); this.player.setClientLoaded(true);
} }
@@ -535,6 +_,7 @@ @@ -535,6 +723,7 @@ public class ServerGamePacketListenerImpl
@Override @Override
public void handleRecipeBookChangeSettingsPacket(ServerboundRecipeBookChangeSettingsPacket packet) { public void handleRecipeBookChangeSettingsPacket(ServerboundRecipeBookChangeSettingsPacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
@@ -389,7 +396,7 @@
this.player.getRecipeBook().setBookSetting(packet.getBookType(), packet.isOpen(), packet.isFiltering()); 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()); PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
if (!this.server.isCommandBlockEnabled()) { if (!this.server.isCommandBlockEnabled()) {
this.player.sendSystemMessage(Component.translatable("advMode.notEnabled")); this.player.sendSystemMessage(Component.translatable("advMode.notEnabled"));
@@ -514,7 +521,7 @@
this.player.sendSystemMessage(Component.translatable("advMode.notAllowed")); this.player.sendSystemMessage(Component.translatable("advMode.notAllowed"));
} else { } else {
BaseCommandBlock baseCommandBlock = null; BaseCommandBlock baseCommandBlock = null;
@@ -633,7 +_,7 @@ @@ -633,7 +907,7 @@ public class ServerGamePacketListenerImpl
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
if (!this.server.isCommandBlockEnabled()) { if (!this.server.isCommandBlockEnabled()) {
this.player.sendSystemMessage(Component.translatable("advMode.notEnabled")); this.player.sendSystemMessage(Component.translatable("advMode.notEnabled"));
@@ -523,7 +530,7 @@
this.player.sendSystemMessage(Component.translatable("advMode.notAllowed")); this.player.sendSystemMessage(Component.translatable("advMode.notAllowed"));
} else { } else {
BaseCommandBlock commandBlock = packet.getCommandBlock(this.player.level()); BaseCommandBlock commandBlock = packet.getCommandBlock(this.player.level());
@@ -661,11 +_,11 @@ @@ -661,11 +935,11 @@ public class ServerGamePacketListenerImpl
boolean flag = this.player.hasInfiniteMaterials() && packet.includeData(); boolean flag = this.player.hasInfiniteMaterials() && packet.includeData();
ItemStack cloneItemStack = blockState.getCloneItemStack(serverLevel, blockPos, flag); ItemStack cloneItemStack = blockState.getCloneItemStack(serverLevel, blockPos, flag);
if (!cloneItemStack.isEmpty()) { 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)) { if (entityOrPart != null && this.player.canInteractWithEntity(entityOrPart, 3.0)) {
ItemStack pickResult = entityOrPart.getPickResult(); ItemStack pickResult = entityOrPart.getPickResult();
if (pickResult != null && !pickResult.isEmpty()) { 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()); PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
int item = packet.getItem(); int item = packet.getItem();
if (this.player.containerMenu instanceof MerchantMenu merchantMenu) { if (this.player.containerMenu instanceof MerchantMenu merchantMenu) {
@@ -598,7 +605,7 @@
if (!merchantMenu.stillValid(this.player)) { if (!merchantMenu.stillValid(this.player)) {
LOGGER.debug("Player {} interacted with invalid menu {}", this.player, merchantMenu); LOGGER.debug("Player {} interacted with invalid menu {}", this.player, merchantMenu);
return; return;
@@ -899,6 +_,51 @@ @@ -899,6 +1193,51 @@ public class ServerGamePacketListenerImpl
@Override @Override
public void handleEditBook(ServerboundEditBookPacket packet) { public void handleEditBook(ServerboundEditBookPacket packet) {
@@ -650,7 +657,7 @@
int slot = packet.slot(); int slot = packet.slot();
if (Inventory.isHotbarSlot(slot) || slot == 40) { if (Inventory.isHotbarSlot(slot) || slot == 40) {
List<String> list = Lists.newArrayList(); List<String> list = Lists.newArrayList();
@@ -913,10 +_,14 @@ @@ -913,10 +1252,14 @@ public class ServerGamePacketListenerImpl
} }
private void updateBookContents(List<FilteredText> pages, int index) { 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, DataComponents.WRITTEN_BOOK_CONTENT,
new WrittenBookContent(this.filterableFromOutgoing(title), this.player.getName().getString(), 0, list, true) 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) { public void handleMovePlayer(ServerboundMovePlayerPacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); 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))) { 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 x = this.player.getX();
double y = this.player.getY(); double y = this.player.getY();
double z = this.player.getZ(); double z = this.player.getZ();
@@ -1003,6 +_,16 @@ @@ -1003,6 +1355,16 @@ public class ServerGamePacketListenerImpl
double d5 = d2 - this.firstGoodZ; double d5 = d2 - this.firstGoodZ;
double d6 = this.player.getDeltaMovement().lengthSqr(); double d6 = this.player.getDeltaMovement().lengthSqr();
double d7 = d3 * d3 + d4 * d4 + d5 * d5; double d7 = d3 * d3 + d4 * d4 + d5 * d5;
@@ -736,7 +743,7 @@
if (this.player.isSleeping()) { if (this.player.isSleeping()) {
if (d7 > 1.0) { if (d7 > 1.0) {
this.teleport(this.player.getX(), this.player.getY(), this.player.getZ(), f, f1); 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()) { if (serverLevel.tickRateManager().runsNormally()) {
this.receivedMovePacketCount++; this.receivedMovePacketCount++;
int i = this.receivedMovePacketCount - this.knownMovePacketCount; int i = this.receivedMovePacketCount - this.knownMovePacketCount;
@@ -857,7 +864,7 @@
d3 = d - this.player.getX(); d3 = d - this.player.getX();
d4 = d1 - this.player.getY(); d4 = d1 - this.player.getY();
if (d4 > -0.5 || d4 < 0.5) { if (d4 > -0.5 || d4 < 0.5) {
@@ -1050,23 +_,104 @@ @@ -1050,23 +1485,104 @@ public class ServerGamePacketListenerImpl
d5 = d2 - this.player.getZ(); d5 = d2 - this.player.getZ();
d7 = d3 * d3 + d4 * d4 + d5 * d5; d7 = d3 * d3 + d4 * d4 + d5 * d5;
@@ -878,15 +885,13 @@
+ if (event.getLogWarning()) + if (event.getLogWarning())
+ // Paper end + // Paper end
LOGGER.warn("{} moved wrongly!", this.player.getName().getString()); LOGGER.warn("{} moved wrongly!", this.player.getName().getString());
- } + } // Paper
- }
- if (this.player.noPhysics - if (this.player.noPhysics
- || this.player.isSleeping() - || this.player.isSleeping()
- || (!flag2 || !serverLevel.noCollision(this.player, boundingBox)) - || (!flag2 || !serverLevel.noCollision(this.player, boundingBox))
- && !this.isPlayerCollidingWithAnythingNew(serverLevel, boundingBox, d, d1, d2)) { - && !this.isPlayerCollidingWithAnythingNew(serverLevel, boundingBox, d, d1, d2)) {
+ } // Paper
+ }
+
+ // Paper start - Add fail move event + // 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)); + boolean teleportBack = !this.player.noPhysics && !this.player.isSleeping() && (movedWrongly && serverLevel.noCollision(this.player, boundingBox) || this.isPlayerCollidingWithAnythingNew(serverLevel, boundingBox, d, d1, d2));
+ if (teleportBack) { + if (teleportBack) {
@@ -972,7 +977,7 @@
&& !flag1 && !flag1
&& !this.player.isSpectator() && !this.player.isSpectator()
&& !this.server.isFlightAllowed() && !this.server.isFlightAllowed()
@@ -1098,7 +_,7 @@ @@ -1098,7 +1614,7 @@ public class ServerGamePacketListenerImpl
this.lastGoodY = this.player.getY(); this.lastGoodY = this.player.getY();
this.lastGoodZ = this.player.getZ(); this.lastGoodZ = this.player.getZ();
} else { } else {
@@ -981,7 +986,7 @@
this.player.doCheckFallDamage(this.player.getX() - x, this.player.getY() - y, this.player.getZ() - z, packet.isOnGround()); this.player.doCheckFallDamage(this.player.getX() - x, this.player.getY() - y, this.player.getZ() - z, packet.isOnGround());
this.player.removeLatestMovementRecordingBatch(); this.player.removeLatestMovementRecordingBatch();
} }
@@ -1134,6 +_,7 @@ @@ -1134,6 +1650,7 @@ public class ServerGamePacketListenerImpl
this.player.getXRot() this.player.getXRot()
); );
} }
@@ -989,7 +994,7 @@
return true; return true;
} else { } else {
@@ -1157,10 +_,77 @@ @@ -1157,10 +1674,77 @@ public class ServerGamePacketListenerImpl
} }
public void teleport(double x, double y, double z, float yaw, float pitch) { public void teleport(double x, double y, double z, float yaw, float pitch) {
@@ -1068,7 +1073,7 @@
this.awaitingTeleportTime = this.tickCount; this.awaitingTeleportTime = this.tickCount;
if (++this.awaitingTeleport == Integer.MAX_VALUE) { if (++this.awaitingTeleport == Integer.MAX_VALUE) {
this.awaitingTeleport = 0; this.awaitingTeleport = 0;
@@ -1168,12 +_,20 @@ @@ -1168,12 +1752,20 @@ public class ServerGamePacketListenerImpl
this.player.teleportSetPosition(posMoveRotation, relatives); this.player.teleportSetPosition(posMoveRotation, relatives);
this.awaitingPositionFromClient = this.player.position(); this.awaitingPositionFromClient = this.player.position();
@@ -1089,7 +1094,7 @@
if (this.player.hasClientLoaded()) { if (this.player.hasClientLoaded()) {
BlockPos pos = packet.getPos(); BlockPos pos = packet.getPos();
this.player.resetLastActionTime(); this.player.resetLastActionTime();
@@ -1182,32 +_,95 @@ @@ -1182,32 +1774,95 @@ public class ServerGamePacketListenerImpl
case SWAP_ITEM_WITH_OFFHAND: case SWAP_ITEM_WITH_OFFHAND:
if (!this.player.isSpectator()) { if (!this.player.isSpectator()) {
ItemStack itemInHand = this.player.getItemInHand(InteractionHand.OFF_HAND); ItemStack itemInHand = this.player.getItemInHand(InteractionHand.OFF_HAND);
@@ -1188,7 +1193,7 @@
return; return;
default: default:
throw new IllegalArgumentException("Invalid player action"); throw new IllegalArgumentException("Invalid player action");
@@ -1224,9 +_,31 @@ @@ -1224,9 +1879,31 @@ public class ServerGamePacketListenerImpl
} }
} }
@@ -1220,7 +1225,7 @@
if (this.player.hasClientLoaded()) { if (this.player.hasClientLoaded()) {
this.player.connection.ackBlockChangesUpTo(packet.getSequence()); this.player.connection.ackBlockChangesUpTo(packet.getSequence());
ServerLevel serverLevel = this.player.serverLevel(); ServerLevel serverLevel = this.player.serverLevel();
@@ -1235,6 +_,11 @@ @@ -1235,6 +1912,11 @@ public class ServerGamePacketListenerImpl
if (itemInHand.isItemEnabled(serverLevel.enabledFeatures())) { if (itemInHand.isItemEnabled(serverLevel.enabledFeatures())) {
BlockHitResult hitResult = packet.getHitResult(); BlockHitResult hitResult = packet.getHitResult();
Vec3 location = hitResult.getLocation(); Vec3 location = hitResult.getLocation();
@@ -1232,7 +1237,7 @@
BlockPos blockPos = hitResult.getBlockPos(); BlockPos blockPos = hitResult.getBlockPos();
if (this.player.canInteractWithBlock(blockPos, 1.0)) { if (this.player.canInteractWithBlock(blockPos, 1.0)) {
Vec3 vec3 = location.subtract(Vec3.atCenterOf(blockPos)); Vec3 vec3 = location.subtract(Vec3.atCenterOf(blockPos));
@@ -1244,7 +_,8 @@ @@ -1244,7 +1926,8 @@ public class ServerGamePacketListenerImpl
this.player.resetLastActionTime(); this.player.resetLastActionTime();
int maxY = this.player.level().getMaxY(); int maxY = this.player.level().getMaxY();
if (blockPos.getY() <= maxY) { if (blockPos.getY() <= maxY) {
@@ -1242,7 +1247,7 @@
InteractionResult interactionResult = this.player.gameMode.useItemOn(this.player, serverLevel, itemInHand, hand, hitResult); InteractionResult interactionResult = this.player.gameMode.useItemOn(this.player, serverLevel, itemInHand, hand, hitResult);
if (interactionResult.consumesAction()) { if (interactionResult.consumesAction()) {
CriteriaTriggers.ANY_BLOCK_USE.trigger(this.player, hitResult.getBlockPos(), itemInHand.copy()); 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); Component component = Component.translatable("build.tooHigh", maxY).withStyle(ChatFormatting.RED);
this.player.sendSystemMessage(component, true); this.player.sendSystemMessage(component, true);
} else if (interactionResult instanceof InteractionResult.Success success } else if (interactionResult instanceof InteractionResult.Success success
@@ -1255,7 +1260,7 @@
} else { } else {
Component component1 = Component.translatable("build.tooHigh", maxY).withStyle(ChatFormatting.RED); Component component1 = Component.translatable("build.tooHigh", maxY).withStyle(ChatFormatting.RED);
this.player.sendSystemMessage(component1, true); 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));
this.player.connection.send(new ClientboundBlockUpdatePacket(serverLevel, blockPos.relative(direction))); 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 @Override
public void handleUseItem(ServerboundUseItemPacket packet) { public void handleUseItem(ServerboundUseItemPacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
@@ -1279,7 +1284,7 @@
if (this.player.hasClientLoaded()) { if (this.player.hasClientLoaded()) {
this.ackBlockChangesUpTo(packet.getSequence()); this.ackBlockChangesUpTo(packet.getSequence());
ServerLevel serverLevel = this.player.serverLevel(); ServerLevel serverLevel = this.player.serverLevel();
@@ -1297,6 +_,48 @@ @@ -1297,6 +1976,48 @@ public class ServerGamePacketListenerImpl
this.player.absSnapRotationTo(f, f1); this.player.absSnapRotationTo(f, f1);
} }
@@ -1328,7 +1333,7 @@
if (this.player.gameMode.useItem(this.player, serverLevel, itemInHand, hand) instanceof InteractionResult.Success success if (this.player.gameMode.useItem(this.player, serverLevel, itemInHand, hand) instanceof InteractionResult.Success success
&& success.swingSource() == InteractionResult.SwingSource.SERVER) { && success.swingSource() == InteractionResult.SwingSource.SERVER) {
this.player.swing(hand, true); this.player.swing(hand, true);
@@ -1312,7 +_,7 @@ @@ -1312,7 +2033,7 @@ public class ServerGamePacketListenerImpl
for (ServerLevel serverLevel : this.server.getAllLevels()) { for (ServerLevel serverLevel : this.server.getAllLevels()) {
Entity entity = packet.getEntity(serverLevel); Entity entity = packet.getEntity(serverLevel);
if (entity != null) { if (entity != null) {
@@ -1337,7 +1342,7 @@
return; return;
} }
} }
@@ -1329,24 +_,54 @@ @@ -1329,24 +2050,54 @@ public class ServerGamePacketListenerImpl
@Override @Override
public void onDisconnect(DisconnectionDetails details) { public void onDisconnect(DisconnectionDetails details) {
@@ -1395,7 +1400,7 @@
throw new IllegalArgumentException("Expected packet sequence nr >= 0"); throw new IllegalArgumentException("Expected packet sequence nr >= 0");
} else { } else {
this.ackBlockChangesUpTo = Math.max(sequence, this.ackBlockChangesUpTo); this.ackBlockChangesUpTo = Math.max(sequence, this.ackBlockChangesUpTo);
@@ -1356,20 +_,38 @@ @@ -1356,20 +2107,38 @@ public class ServerGamePacketListenerImpl
@Override @Override
public void handleSetCarriedItem(ServerboundSetCarriedItemPacket packet) { public void handleSetCarriedItem(ServerboundSetCarriedItemPacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
@@ -1434,7 +1439,7 @@
Optional<LastSeenMessages> optional = this.unpackAndApplyLastSeen(packet.lastSeenMessages()); Optional<LastSeenMessages> optional = this.unpackAndApplyLastSeen(packet.lastSeenMessages());
if (!optional.isEmpty()) { if (!optional.isEmpty()) {
this.tryHandleChat(packet.message(), () -> { this.tryHandleChat(packet.message(), () -> {
@@ -1381,25 +_,45 @@ @@ -1381,25 +2150,45 @@ public class ServerGamePacketListenerImpl
return; return;
} }
@@ -1487,7 +1492,7 @@
ParseResults<CommandSourceStack> parseResults = this.parseCommand(command); ParseResults<CommandSourceStack> parseResults = this.parseCommand(command);
if (this.server.enforceSecureProfile() && SignableCommand.hasSignableArguments(parseResults)) { if (this.server.enforceSecureProfile() && SignableCommand.hasSignableArguments(parseResults)) {
LOGGER.error( LOGGER.error(
@@ -1416,28 +_,57 @@ @@ -1416,28 +2205,57 @@ public class ServerGamePacketListenerImpl
Optional<LastSeenMessages> optional = this.unpackAndApplyLastSeen(packet.lastSeenMessages()); Optional<LastSeenMessages> optional = this.unpackAndApplyLastSeen(packet.lastSeenMessages());
if (!optional.isEmpty()) { if (!optional.isEmpty()) {
this.tryHandleChat(packet.command(), () -> { this.tryHandleChat(packet.command(), () -> {
@@ -1548,7 +1553,7 @@
} }
private void handleMessageDecodeFailure(SignedMessageChain.DecodeException exception) { private void handleMessageDecodeFailure(SignedMessageChain.DecodeException exception) {
@@ -1501,14 +_,20 @@ @@ -1501,14 +2319,20 @@ public class ServerGamePacketListenerImpl
return dispatcher.parse(command, this.player.createCommandSourceStack()); 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); var10000 = Optional.of(lastSeenMessages);
} catch (LastSeenMessagesValidator.ValidationException var5) { } catch (LastSeenMessagesValidator.ValidationException var5) {
LOGGER.error("Failed to validate message acknowledgements from {}: {}", this.player.getName().getString(), var5.getMessage()); LOGGER.error("Failed to validate message acknowledgements from {}: {}", this.player.getName().getString(), var5.getMessage());
@@ -1582,7 +1587,7 @@
return Optional.empty(); return Optional.empty();
} }
@@ -1538,22 +_,81 @@ @@ -1538,22 +2362,81 @@ public class ServerGamePacketListenerImpl
return false; return false;
} }
@@ -1670,7 +1675,7 @@
} }
} }
@@ -1564,7 +_,7 @@ @@ -1564,7 +2447,7 @@ public class ServerGamePacketListenerImpl
this.lastSeenMessages.applyOffset(packet.offset()); this.lastSeenMessages.applyOffset(packet.offset());
} catch (LastSeenMessagesValidator.ValidationException var5) { } catch (LastSeenMessagesValidator.ValidationException var5) {
LOGGER.error("Failed to validate message acknowledgement offset from {}: {}", this.player.getName().getString(), var5.getMessage()); 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 @Override
public void handleAnimate(ServerboundSwingPacket packet) { public void handleAnimate(ServerboundSwingPacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
@@ -1720,7 +1725,7 @@
this.player.swing(packet.getHand()); this.player.swing(packet.getHand());
} }
@@ -1580,10 +_,41 @@ @@ -1580,10 +2496,41 @@ public class ServerGamePacketListenerImpl
public void handlePlayerCommand(ServerboundPlayerCommandPacket packet) { public void handlePlayerCommand(ServerboundPlayerCommandPacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
if (this.player.hasClientLoaded()) { if (this.player.hasClientLoaded()) {
@@ -1762,7 +1767,7 @@
break; break;
case RELEASE_SHIFT_KEY: case RELEASE_SHIFT_KEY:
this.player.setShiftKeyDown(false); this.player.setShiftKeyDown(false);
@@ -1630,6 +_,14 @@ @@ -1630,6 +2577,14 @@ public class ServerGamePacketListenerImpl
} }
public void sendPlayerChatMessage(PlayerChatMessage chatMessage, ChatType.Bound boundType) { public void sendPlayerChatMessage(PlayerChatMessage chatMessage, ChatType.Bound boundType) {
@@ -1777,7 +1782,7 @@
this.send( this.send(
new ClientboundPlayerChatPacket( new ClientboundPlayerChatPacket(
this.nextChatIndex++, this.nextChatIndex++,
@@ -1652,9 +_,11 @@ @@ -1652,9 +2607,11 @@ public class ServerGamePacketListenerImpl
} }
if (i > 4096) { if (i > 4096) {
@@ -1790,7 +1795,7 @@
} }
public void sendDisguisedChatMessage(Component message, ChatType.Bound boundType) { public void sendDisguisedChatMessage(Component message, ChatType.Bound boundType) {
@@ -1665,6 +_,17 @@ @@ -1665,6 +2622,17 @@ public class ServerGamePacketListenerImpl
return this.connection.getRemoteAddress(); return this.connection.getRemoteAddress();
} }
@@ -1808,7 +1813,7 @@
public void switchToConfig() { public void switchToConfig() {
this.waitingForSwitchToConfig = true; this.waitingForSwitchToConfig = true;
this.removePlayerFromWorld(); this.removePlayerFromWorld();
@@ -1680,9 +_,16 @@ @@ -1680,9 +2648,16 @@ public class ServerGamePacketListenerImpl
@Override @Override
public void handleInteract(ServerboundInteractPacket packet) { public void handleInteract(ServerboundInteractPacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
@@ -1825,7 +1830,7 @@
this.player.resetLastActionTime(); this.player.resetLastActionTime();
this.player.setShiftKeyDown(packet.isUsingSecondaryAction()); this.player.setShiftKeyDown(packet.isUsingSecondaryAction());
if (target != null) { if (target != null) {
@@ -1691,16 +_,58 @@ @@ -1691,16 +2666,58 @@ public class ServerGamePacketListenerImpl
} }
AABB boundingBox = target.getBoundingBox(); AABB boundingBox = target.getBoundingBox();
@@ -1889,7 +1894,7 @@
ItemStack itemStack1 = success.wasItemInteraction() ? itemStack : ItemStack.EMPTY; ItemStack itemStack1 = success.wasItemInteraction() ? itemStack : ItemStack.EMPTY;
CriteriaTriggers.PLAYER_INTERACTED_WITH_ENTITY.trigger(ServerGamePacketListenerImpl.this.player, itemStack1, target); CriteriaTriggers.PLAYER_INTERACTED_WITH_ENTITY.trigger(ServerGamePacketListenerImpl.this.player, itemStack1, target);
if (success.swingSource() == InteractionResult.SwingSource.SERVER) { if (success.swingSource() == InteractionResult.SwingSource.SERVER) {
@@ -1712,13 +_,13 @@ @@ -1712,13 +2729,13 @@ public class ServerGamePacketListenerImpl
@Override @Override
public void onInteraction(InteractionHand hand) { public void onInteraction(InteractionHand hand) {
@@ -1905,7 +1910,7 @@
); );
} }
@@ -1726,14 +_,19 @@ @@ -1726,14 +2743,19 @@ public class ServerGamePacketListenerImpl
public void onAttack() { public void onAttack() {
if (!(target instanceof ItemEntity) if (!(target instanceof ItemEntity)
&& !(target instanceof ExperienceOrb) && !(target instanceof ExperienceOrb)
@@ -1927,7 +1932,7 @@
ServerGamePacketListenerImpl.LOGGER ServerGamePacketListenerImpl.LOGGER
.warn("Player {} tried to attack an invalid entity", ServerGamePacketListenerImpl.this.player.getName().getString()); .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: case PERFORM_RESPAWN:
if (this.player.wonGame) { if (this.player.wonGame) {
this.player.wonGame = false; this.player.wonGame = false;
@@ -1964,7 +1969,7 @@
this.resetPosition(); this.resetPosition();
CriteriaTriggers.CHANGED_DIMENSION.trigger(this.player, Level.END, Level.OVERWORLD); CriteriaTriggers.CHANGED_DIMENSION.trigger(this.player, Level.END, Level.OVERWORLD);
} else { } else {
@@ -1762,11 +_,11 @@ @@ -1762,11 +2805,11 @@ public class ServerGamePacketListenerImpl
return; return;
} }
@@ -1979,7 +1984,7 @@
} }
} }
break; break;
@@ -1777,16 +_,28 @@ @@ -1777,16 +2820,28 @@ public class ServerGamePacketListenerImpl
@Override @Override
public void handleContainerClose(ServerboundContainerClosePacket packet) { public void handleContainerClose(ServerboundContainerClosePacket packet) {
@@ -2010,7 +2015,7 @@
this.player.containerMenu.sendAllDataToRemote(); this.player.containerMenu.sendAllDataToRemote();
} else if (!this.player.containerMenu.stillValid(this.player)) { } else if (!this.player.containerMenu.stillValid(this.player)) {
LOGGER.debug("Player {} interacted with invalid menu {}", this.player, this.player.containerMenu); LOGGER.debug("Player {} interacted with invalid menu {}", this.player, this.player.containerMenu);
@@ -1799,7 +_,340 @@ @@ -1799,7 +2854,340 @@ public class ServerGamePacketListenerImpl
} else { } else {
boolean flag = packet.stateId() != this.player.containerMenu.getStateId(); boolean flag = packet.stateId() != this.player.containerMenu.getStateId();
this.player.containerMenu.suppressRemoteUpdates(); this.player.containerMenu.suppressRemoteUpdates();
@@ -2352,7 +2357,7 @@
for (Entry<HashedStack> entry : Int2ObjectMaps.fastIterable(packet.changedSlots())) { for (Entry<HashedStack> entry : Int2ObjectMaps.fastIterable(packet.changedSlots())) {
this.player.containerMenu.setRemoteSlotUnsafe(entry.getIntKey(), entry.getValue()); this.player.containerMenu.setRemoteSlotUnsafe(entry.getIntKey(), entry.getValue());
@@ -1812,6 +_,7 @@ @@ -1812,6 +3200,7 @@ public class ServerGamePacketListenerImpl
} else { } else {
this.player.containerMenu.broadcastChanges(); this.player.containerMenu.broadcastChanges();
} }
@@ -2360,7 +2365,7 @@
} }
} }
} }
@@ -1819,6 +_,14 @@ @@ -1819,6 +3208,14 @@ public class ServerGamePacketListenerImpl
@Override @Override
public void handlePlaceRecipe(ServerboundPlaceRecipePacket packet) { public void handlePlaceRecipe(ServerboundPlaceRecipePacket packet) {
@@ -2375,7 +2380,7 @@
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
this.player.resetLastActionTime(); this.player.resetLastActionTime();
if (!this.player.isSpectator() && this.player.containerMenu.containerId == packet.containerId()) { if (!this.player.isSpectator() && this.player.containerMenu.containerId == packet.containerId()) {
@@ -1835,9 +_,44 @@ @@ -1835,9 +3232,44 @@ public class ServerGamePacketListenerImpl
return; return;
} }
@@ -2421,7 +2426,7 @@
if (postPlaceAction == RecipeBookMenu.PostPlaceAction.PLACE_GHOST_RECIPE) { if (postPlaceAction == RecipeBookMenu.PostPlaceAction.PLACE_GHOST_RECIPE) {
this.player this.player
.connection .connection
@@ -1853,6 +_,7 @@ @@ -1853,6 +3285,7 @@ public class ServerGamePacketListenerImpl
@Override @Override
public void handleContainerButtonClick(ServerboundContainerButtonClickPacket packet) { public void handleContainerButtonClick(ServerboundContainerButtonClickPacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
@@ -2429,7 +2434,7 @@
this.player.resetLastActionTime(); this.player.resetLastActionTime();
if (this.player.containerMenu.containerId == packet.containerId() && !this.player.isSpectator()) { if (this.player.containerMenu.containerId == packet.containerId() && !this.player.isSpectator()) {
if (!this.player.containerMenu.stillValid(this.player)) { if (!this.player.containerMenu.stillValid(this.player)) {
@@ -1862,6 +_,7 @@ @@ -1862,6 +3295,7 @@ public class ServerGamePacketListenerImpl
if (flag) { if (flag) {
this.player.containerMenu.broadcastChanges(); 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 flag1 = packet.slotNum() >= 1 && packet.slotNum() <= 45;
boolean flag2 = itemStack.isEmpty() || itemStack.getCount() <= itemStack.getMaxStackSize(); boolean flag2 = itemStack.isEmpty() || itemStack.getCount() <= itemStack.getMaxStackSize();
@@ -2486,7 +2491,7 @@
} else if (flag && flag2) { } else if (flag && flag2) {
if (this.dropSpamThrottler.isUnderThreshold()) { if (this.dropSpamThrottler.isUnderThreshold()) {
this.dropSpamThrottler.increment(); this.dropSpamThrottler.increment();
@@ -1895,15 +_,38 @@ @@ -1895,15 +3367,38 @@ public class ServerGamePacketListenerImpl
@Override @Override
public void handleSignUpdate(ServerboundSignUpdatePacket packet) { public void handleSignUpdate(ServerboundSignUpdatePacket packet) {
@@ -2526,7 +2531,7 @@
if (!(serverLevel.getBlockEntity(pos) instanceof SignBlockEntity signBlockEntity)) { if (!(serverLevel.getBlockEntity(pos) instanceof SignBlockEntity signBlockEntity)) {
return; return;
} }
@@ -1915,14 +_,32 @@ @@ -1915,14 +3410,32 @@ public class ServerGamePacketListenerImpl
@Override @Override
public void handlePlayerAbilities(ServerboundPlayerAbilitiesPacket packet) { public void handlePlayerAbilities(ServerboundPlayerAbilitiesPacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
@@ -2560,7 +2565,7 @@
if (this.player.isModelPartShown(PlayerModelPart.HAT) != isModelPartShown) { if (this.player.isModelPartShown(PlayerModelPart.HAT) != isModelPartShown) {
this.server.getPlayerList().broadcastAll(new ClientboundPlayerInfoUpdatePacket(ClientboundPlayerInfoUpdatePacket.Action.UPDATE_HAT, this.player)); 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) { public void handleChangeDifficulty(ServerboundChangeDifficultyPacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
if (this.player.hasPermissions(2) || this.isSingleplayerOwner()) { 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(); ProfilePublicKey.Data data2 = data.profilePublicKey();
if (!Objects.equals(data1, data2)) { if (!Objects.equals(data1, data2)) {
if (data1 != null && data2.expiresAt().isBefore(data1.expiresAt())) { if (data1 != null && data2.expiresAt().isBefore(data1.expiresAt())) {
@@ -2578,7 +2583,7 @@
} else { } else {
try { try {
SignatureValidator profileKeySignatureValidator = this.server.getProfileKeySignatureValidator(); SignatureValidator profileKeySignatureValidator = this.server.getProfileKeySignatureValidator();
@@ -1963,8 +_,8 @@ @@ -1963,8 +3476,8 @@ public class ServerGamePacketListenerImpl
this.resetPlayerChatState(data.validate(this.player.getGameProfile(), profileKeySignatureValidator)); this.resetPlayerChatState(data.validate(this.player.getGameProfile(), profileKeySignatureValidator));
} catch (ProfilePublicKey.ValidationException var6) { } catch (ProfilePublicKey.ValidationException var6) {
@@ -2589,7 +2594,7 @@
} }
} }
} }
@@ -1978,7 +_,7 @@ @@ -1978,7 +3491,7 @@ public class ServerGamePacketListenerImpl
this.connection this.connection
.setupInboundProtocol( .setupInboundProtocol(
ConfigurationProtocols.SERVERBOUND, ConfigurationProtocols.SERVERBOUND,
@@ -2598,7 +2603,7 @@
); );
} }
} }
@@ -1997,27 +_,32 @@ @@ -1997,27 +3510,32 @@ public class ServerGamePacketListenerImpl
private void resetPlayerChatState(RemoteChatSession chatSession) { private void resetPlayerChatState(RemoteChatSession chatSession) {
this.chatSession = chatSession; this.chatSession = chatSession;
@@ -2632,7 +2637,7 @@
if (!this.receivedMovementThisTick) { if (!this.receivedMovementThisTick) {
this.player.setKnownMovement(Vec3.ZERO); this.player.setKnownMovement(Vec3.ZERO);
} }
@@ -2048,4 +_,17 @@ @@ -2048,4 +3566,17 @@ public class ServerGamePacketListenerImpl
interface EntityInteraction { interface EntityInteraction {
InteractionResult run(ServerPlayer player, Entity entity, InteractionHand hand); 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 --- a/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
+++ b/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 { public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketListener {
private static final Component IGNORE_STATUS_REASON = Component.translatable("disconnect.ignoring_status_request"); private static final Component IGNORE_STATUS_REASON = Component.translatable("disconnect.ignoring_status_request");
@@ -21,7 +29,7 @@
public ServerHandshakePacketListenerImpl(MinecraftServer server, Connection connection) { public ServerHandshakePacketListenerImpl(MinecraftServer server, Connection connection) {
this.server = server; this.server = server;
this.connection = connection; this.connection = connection;
@@ -24,6 +_,7 @@ @@ -24,6 +35,7 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL
@Override @Override
public void handleIntention(ClientIntentionPacket packet) { public void handleIntention(ClientIntentionPacket packet) {
@@ -29,7 +37,7 @@
switch (packet.intention()) { switch (packet.intention()) {
case LOGIN: case LOGIN:
this.beginLogin(packet, false); this.beginLogin(packet, false);
@@ -50,22 +_,118 @@ @@ -50,22 +62,118 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL
default: default:
throw new UnsupportedOperationException("Invalid intention " + packet.intention()); 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 --- a/net/minecraft/server/players/PlayerList.java
+++ b/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 int SEND_PLAYER_INFO_INTERVAL = 600;
private static final SimpleDateFormat BAN_DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd 'at' HH:mm:ss z"); private static final SimpleDateFormat BAN_DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd 'at' HH:mm:ss z");
private final MinecraftServer server; private final MinecraftServer server;
@@ -20,7 +28,7 @@
public final PlayerDataStorage playerIo; public final PlayerDataStorage playerIo;
private boolean doWhiteList; private boolean doWhiteList;
private final LayeredRegistryAccess<RegistryLayer> registries; private final LayeredRegistryAccess<RegistryLayer> registries;
@@ -130,14 +_,26 @@ @@ -130,14 +132,26 @@ public abstract class PlayerList {
private static final boolean ALLOW_LOGOUTIVATOR = false; private static final boolean ALLOW_LOGOUTIVATOR = false;
private int sendAllPlayerInfoIn; private int sendAllPlayerInfoIn;
@@ -47,7 +55,7 @@
GameProfile gameProfile = player.getGameProfile(); GameProfile gameProfile = player.getGameProfile();
GameProfileCache profileCache = this.server.getProfileCache(); GameProfileCache profileCache = this.server.getProfileCache();
String string; String string;
@@ -150,30 +_,94 @@ @@ -150,30 +164,94 @@ public abstract class PlayerList {
} }
Optional<CompoundTag> optional = this.load(player); Optional<CompoundTag> optional = this.load(player);
@@ -154,7 +162,7 @@
LevelData levelData = serverLevel.getLevelData(); LevelData levelData = serverLevel.getLevelData();
player.loadGameTypes(optional.orElse(null)); player.loadGameTypes(optional.orElse(null));
ServerGamePacketListenerImpl serverGamePacketListenerImpl = new ServerGamePacketListenerImpl(this.server, connection, player, cookie); ServerGamePacketListenerImpl serverGamePacketListenerImpl = new ServerGamePacketListenerImpl(this.server, connection, player, cookie);
@@ -191,8 +_,8 @@ @@ -191,8 +269,8 @@ public abstract class PlayerList {
levelData.isHardcore(), levelData.isHardcore(),
this.server.levelKeys(), this.server.levelKeys(),
this.getMaxPlayers(), this.getMaxPlayers(),
@@ -165,7 +173,7 @@
_boolean1, _boolean1,
!_boolean, !_boolean,
_boolean2, _boolean2,
@@ -200,6 +_,7 @@ @@ -200,6 +278,7 @@ public abstract class PlayerList {
this.server.enforceSecureProfile() this.server.enforceSecureProfile()
) )
); );
@@ -173,7 +181,7 @@
serverGamePacketListenerImpl.send(new ClientboundChangeDifficultyPacket(levelData.getDifficulty(), levelData.isDifficultyLocked())); serverGamePacketListenerImpl.send(new ClientboundChangeDifficultyPacket(levelData.getDifficulty(), levelData.isDifficultyLocked()));
serverGamePacketListenerImpl.send(new ClientboundPlayerAbilitiesPacket(player.getAbilities())); serverGamePacketListenerImpl.send(new ClientboundPlayerAbilitiesPacket(player.getAbilities()));
serverGamePacketListenerImpl.send(new ClientboundSetHeldSlotPacket(player.getInventory().getSelectedSlot())); 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); mutableComponent = Component.translatable("multiplayer.player.joined.renamed", player.getDisplayName(), string);
} }
@@ -299,7 +307,7 @@
} }
public void updateEntireScoreboard(ServerScoreboard scoreboard, ServerPlayer player) { public void updateEntireScoreboard(ServerScoreboard scoreboard, ServerPlayer player) {
@@ -261,30 +_,31 @@ @@ -261,30 +433,31 @@ public abstract class PlayerList {
} }
public void addWorldborderListener(ServerLevel level) { public void addWorldborderListener(ServerLevel level) {
@@ -336,7 +344,7 @@
} }
@Override @Override
@@ -312,56 +_,156 @@ @@ -312,56 +485,156 @@ public abstract class PlayerList {
} }
protected void save(ServerPlayer player) { protected void save(ServerPlayer player) {
@@ -440,15 +448,13 @@
this.playersByUUID.remove(uuid); this.playersByUUID.remove(uuid);
- this.stats.remove(uuid); - this.stats.remove(uuid);
- this.advancements.remove(uuid); - this.advancements.remove(uuid);
- }
-
- this.broadcastAll(new ClientboundPlayerInfoRemovePacket(List.of(player.getUUID())));
+ // CraftBukkit start + // CraftBukkit start
+ // this.stats.remove(uuid); + // this.stats.remove(uuid);
+ // this.advancements.remove(uuid); + // this.advancements.remove(uuid);
+ // CraftBukkit end + // CraftBukkit end
+ } }
+
- this.broadcastAll(new ClientboundPlayerInfoRemovePacket(List.of(player.getUUID())));
+ // CraftBukkit start + // CraftBukkit start
+ // this.broadcastAll(new ClientboundPlayerInfoRemovePacket(List.of(player.getUUID()))); + // this.broadcastAll(new ClientboundPlayerInfoRemovePacket(List.of(player.getUUID())));
+ ClientboundPlayerInfoRemovePacket packet = 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()); MutableComponent mutableComponent = Component.translatable("multiplayer.disconnect.banned.reason", userBanListEntry.getReason());
if (userBanListEntry.getExpires() != null) { if (userBanListEntry.getExpires() != null) {
mutableComponent.append( mutableComponent.append(
@@ -369,10 +_,12 @@ @@ -369,10 +642,12 @@ public abstract class PlayerList {
); );
} }
@@ -524,7 +530,7 @@
IpBanListEntry ipBanListEntry = this.ipBans.get(socketAddress); IpBanListEntry ipBanListEntry = this.ipBans.get(socketAddress);
MutableComponent mutableComponent = Component.translatable("multiplayer.disconnect.banned_ip.reason", ipBanListEntry.getReason()); MutableComponent mutableComponent = Component.translatable("multiplayer.disconnect.banned_ip.reason", ipBanListEntry.getReason());
if (ipBanListEntry.getExpires() != null) { 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) - return this.players.size() >= this.maxPlayers && !this.canBypassPlayerLimit(gameProfile)
- ? Component.translatable("multiplayer.disconnect.server_full") - ? Component.translatable("multiplayer.disconnect.server_full")
- : null; - : 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) { - public ServerPlayer getPlayerForLogin(GameProfile gameProfile, ClientInformation clientInformation) {
- return new ServerPlayer(this.server, this.server.overworld(), gameProfile, 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) { - public boolean disconnectAllPlayersWithProfile(GameProfile gameProfile) {
- UUID id = gameProfile.getId(); - UUID id = gameProfile.getId();
- Set<ServerPlayer> set = Sets.newIdentityHashSet(); - Set<ServerPlayer> set = Sets.newIdentityHashSet();
@@ -549,13 +572,8 @@
- for (ServerPlayer serverPlayer : this.players) { - for (ServerPlayer serverPlayer : this.players) {
- if (serverPlayer.getUUID().equals(id)) { - if (serverPlayer.getUUID().equals(id)) {
- set.add(serverPlayer); - 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()); - ServerPlayer serverPlayer1 = this.playersByUUID.get(gameProfile.getId());
- if (serverPlayer1 != null) { - if (serverPlayer1 != null) {
@@ -565,26 +583,6 @@
- for (ServerPlayer serverPlayer2 : set) { - for (ServerPlayer serverPlayer2 : set) {
- serverPlayer2.connection.disconnect(DUPLICATE_LOGIN_DISCONNECT_MESSAGE); - 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 + public boolean disconnectAllPlayersWithProfile(GameProfile gameProfile, ServerPlayer player) { // CraftBukkit - added ServerPlayer
+ // CraftBukkit start - Moved up + // CraftBukkit start - Moved up
+ // UUID id = gameProfile.getId(); + // UUID id = gameProfile.getId();
@@ -609,12 +607,14 @@
+ return player == null; + return player == null;
+ // CraftBukkit end + // CraftBukkit end
+ } + }
+
- return !set.isEmpty();
+ // CraftBukkit start + // CraftBukkit start
+ public ServerPlayer respawn(ServerPlayer player, boolean keepInventory, Entity.RemovalReason reason, @Nullable org.bukkit.event.player.PlayerRespawnEvent.RespawnReason eventReason) { + 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); + 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) { + 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 + player.stopRiding(); // CraftBukkit
this.players.remove(player); this.players.remove(player);
@@ -697,7 +697,7 @@
serverPlayer.connection.send(new ClientboundSetDefaultSpawnPositionPacket(level.getSharedSpawnPos(), level.getSharedSpawnAngle())); serverPlayer.connection.send(new ClientboundSetDefaultSpawnPositionPacket(level.getSharedSpawnPos(), level.getSharedSpawnAngle()));
serverPlayer.connection.send(new ClientboundChangeDifficultyPacket(levelData.getDifficulty(), levelData.isDifficultyLocked())); serverPlayer.connection.send(new ClientboundChangeDifficultyPacket(levelData.getDifficulty(), levelData.isDifficultyLocked()));
serverPlayer.connection serverPlayer.connection
@@ -451,10 +_,13 @@ @@ -451,10 +788,13 @@ public abstract class PlayerList {
this.sendActivePlayerEffects(serverPlayer); this.sendActivePlayerEffects(serverPlayer);
this.sendLevelInfo(serverPlayer, level); this.sendLevelInfo(serverPlayer, level);
this.sendPlayerPermissionLevel(serverPlayer); this.sendPlayerPermissionLevel(serverPlayer);
@@ -715,7 +715,7 @@
serverPlayer.setHealth(serverPlayer.getHealth()); serverPlayer.setHealth(serverPlayer.getHealth());
ServerPlayer.RespawnConfig respawnConfig = serverPlayer.getRespawnConfig(); ServerPlayer.RespawnConfig respawnConfig = serverPlayer.getRespawnConfig();
if (!keepInventory && respawnConfig != null) { if (!keepInventory && respawnConfig != null) {
@@ -477,8 +_,52 @@ @@ -477,8 +817,52 @@ public abstract class PlayerList {
) )
); );
} }
@@ -768,7 +768,7 @@
return serverPlayer; return serverPlayer;
} }
@@ -488,24 +_,59 @@ @@ -488,24 +872,59 @@ public abstract class PlayerList {
} }
public void sendActiveEffects(LivingEntity entity, ServerGamePacketListenerImpl connection) { public void sendActiveEffects(LivingEntity entity, ServerGamePacketListenerImpl connection) {
@@ -831,7 +831,7 @@
public void broadcastAll(Packet<?> packet) { public void broadcastAll(Packet<?> packet) {
for (ServerPlayer serverPlayer : this.players) { for (ServerPlayer serverPlayer : this.players) {
serverPlayer.connection.send(packet); serverPlayer.connection.send(packet);
@@ -581,6 +_,12 @@ @@ -581,6 +1000,12 @@ public abstract class PlayerList {
} }
private void sendPlayerPermissionLevel(ServerPlayer player, int permLevel) { private void sendPlayerPermissionLevel(ServerPlayer player, int permLevel) {
@@ -844,7 +844,7 @@
if (player.connection != null) { if (player.connection != null) {
byte b; byte b;
if (permLevel <= 0) { if (permLevel <= 0) {
@@ -594,11 +_,33 @@ @@ -594,11 +1019,33 @@ public abstract class PlayerList {
player.connection.send(new ClientboundEntityEventPacket(player, b)); player.connection.send(new ClientboundEntityEventPacket(player, b));
} }
@@ -879,7 +879,7 @@
} }
public boolean isOp(GameProfile profile) { public boolean isOp(GameProfile profile) {
@@ -609,21 +_,17 @@ @@ -609,21 +1056,17 @@ public abstract class PlayerList {
@Nullable @Nullable
public ServerPlayer getPlayerByName(String username) { public ServerPlayer getPlayerByName(String username) {
@@ -907,7 +907,7 @@
if (serverPlayer != except && serverPlayer.level().dimension() == dimension) { if (serverPlayer != except && serverPlayer.level().dimension() == dimension) {
double d = x - serverPlayer.getX(); double d = x - serverPlayer.getX();
double d1 = y - serverPlayer.getY(); double d1 = y - serverPlayer.getY();
@@ -636,9 +_,11 @@ @@ -636,9 +1079,11 @@ public abstract class PlayerList {
} }
public void saveAll() { public void saveAll() {
@@ -919,7 +919,7 @@
} }
public UserWhiteList getWhiteList() { public UserWhiteList getWhiteList() {
@@ -661,14 +_,18 @@ @@ -661,14 +1106,18 @@ public abstract class PlayerList {
} }
public void sendLevelInfo(ServerPlayer player, ServerLevel level) { public void sendLevelInfo(ServerPlayer player, ServerLevel level) {
@@ -942,7 +942,7 @@
} }
player.connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.LEVEL_CHUNKS_LOAD_START, 0.0F)); 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) { public void sendAllPlayerInfo(ServerPlayer player) {
player.inventoryMenu.sendAllDataToRemote(); player.inventoryMenu.sendAllDataToRemote();
@@ -965,7 +965,7 @@
} }
public int getPlayerCount() { public int getPlayerCount() {
@@ -694,6 +_,7 @@ @@ -694,6 +1156,7 @@ public abstract class PlayerList {
} }
public void setUsingWhiteList(boolean whitelistEnabled) { public void setUsingWhiteList(boolean whitelistEnabled) {
@@ -973,14 +973,12 @@
this.doWhiteList = whitelistEnabled; this.doWhiteList = whitelistEnabled;
} }
@@ -731,10 +_,35 @@ @@ -731,11 +1194,36 @@ public abstract class PlayerList {
} }
public void removeAll() { public void removeAll() {
- for (int i = 0; i < this.players.size(); i++) { - for (int i = 0; i < this.players.size(); i++) {
- this.players.get(i).connection.disconnect(Component.translatable("multiplayer.disconnect.server_shutdown")); - this.players.get(i).connection.disconnect(Component.translatable("multiplayer.disconnect.server_shutdown"));
- }
- }
+ // Paper start - Extract method to allow for restarting flag + // Paper start - Extract method to allow for restarting flag
+ this.removeAll(false); + this.removeAll(false);
+ } + }
@@ -991,7 +989,7 @@
+ for (ServerPlayer player : this.players) { + 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) + 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 + 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 + // CraftBukkit end
+ +
+ // Paper start - Configurable player collision; Remove collideRule team if it exists + // Paper start - Configurable player collision; Remove collideRule team if it exists
@@ -1001,8 +999,8 @@
+ if (team != null) scoreboard.removePlayerTeam(team); + if (team != null) scoreboard.removePlayerTeam(team);
+ } + }
+ // Paper end - Configurable player collision + // Paper end - Configurable player collision
+ } }
+
+ // CraftBukkit start + // CraftBukkit start
+ public void broadcastMessage(Component[] iChatBaseComponents) { + public void broadcastMessage(Component[] iChatBaseComponents) {
+ for (Component component : iChatBaseComponents) { + for (Component component : iChatBaseComponents) {
@@ -1010,10 +1008,11 @@
+ } + }
+ } + }
+ // CraftBukkit end + // CraftBukkit end
+
public void broadcastSystemMessage(Component message, boolean bypassHiddenChat) { public void broadcastSystemMessage(Component message, boolean bypassHiddenChat) {
this.broadcastSystemMessage(message, serverPlayer -> message, 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) { public void broadcastChatMessage(PlayerChatMessage message, ServerPlayer sender, ChatType.Bound boundChatType) {
@@ -1056,7 +1055,7 @@
flag1 |= flag2 && message.isFullyFiltered(); flag1 |= flag2 && message.isFullyFiltered();
} }
@@ -782,14 +_,21 @@ @@ -782,14 +1289,21 @@ public abstract class PlayerList {
return message.hasSignature() && !message.hasExpiredServer(Instant.now()); return message.hasSignature() && !message.hasExpiredServer(Instant.now());
} }
@@ -1082,7 +1081,7 @@
Path path = file2.toPath(); Path path = file2.toPath();
if (FileUtil.isPathNormalized(path) && FileUtil.isPathPortable(path) && path.startsWith(file.getPath()) && file2.isFile()) { if (FileUtil.isPathNormalized(path) && FileUtil.isPathPortable(path) && path.startsWith(file.getPath()) && file2.isFile()) {
file2.renameTo(file1); file2.renameTo(file1);
@@ -797,7 +_,7 @@ @@ -797,7 +1311,7 @@ public abstract class PlayerList {
} }
serverStatsCounter = new ServerStatsCounter(this.server, file1); serverStatsCounter = new ServerStatsCounter(this.server, file1);
@@ -1091,7 +1090,7 @@
} }
return serverStatsCounter; return serverStatsCounter;
@@ -805,11 +_,11 @@ @@ -805,11 +1319,11 @@ public abstract class PlayerList {
public PlayerAdvancements getPlayerAdvancements(ServerPlayer player) { public PlayerAdvancements getPlayerAdvancements(ServerPlayer player) {
UUID uuid = player.getUUID(); UUID uuid = player.getUUID();
@@ -1105,7 +1104,7 @@
} }
playerAdvancements.setPlayer(player); playerAdvancements.setPlayer(player);
@@ -852,11 +_,34 @@ @@ -852,11 +1366,34 @@ public abstract class PlayerList {
} }
public void reloadResources() { 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 --- a/net/minecraft/util/datafix/fixes/RaidRenamesDataFix.java
+++ b/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("PostRaidTicks", "post_raid_ticks")
.renameField("TotalHealth", "total_health") .renameField("TotalHealth", "total_health")
.renameField("NumGroups", "group_count") .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 --- a/net/minecraft/world/RandomizableContainer.java
+++ b/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); void setLootTable(@Nullable ResourceKey<LootTable> lootTable);
@@ -9,7 +17,7 @@
this.setLootTable(lootTable); this.setLootTable(lootTable);
this.setLootTableSeed(seed); this.setLootTableSeed(seed);
} }
@@ -49,8 +_,9 @@ @@ -49,8 +49,9 @@ public interface RandomizableContainer extends Container {
default boolean tryLoadLootTable(CompoundTag tag) { default boolean tryLoadLootTable(CompoundTag tag) {
ResourceKey<LootTable> resourceKey = tag.read("LootTable", LootTable.KEY_CODEC).orElse(null); ResourceKey<LootTable> resourceKey = tag.read("LootTable", LootTable.KEY_CODEC).orElse(null);
this.setLootTable(resourceKey); this.setLootTable(resourceKey);
@@ -20,7 +28,7 @@
} }
default boolean trySaveLootTable(CompoundTag tag) { default boolean trySaveLootTable(CompoundTag tag) {
@@ -59,26 +_,42 @@ @@ -59,26 +60,42 @@ public interface RandomizableContainer extends Container {
return false; return false;
} else { } else {
tag.store("LootTable", LootTable.KEY_CODEC, lootTable); 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)); LootParams.Builder builder = new LootParams.Builder((ServerLevel)level).withParameter(LootContextParams.ORIGIN, Vec3.atCenterOf(blockPos));
if (player != null) { if (player != null) {
builder.withLuck(player.getLuck()).withParameter(LootContextParams.THIS_ENTITY, player); 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()); 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 --- a/net/minecraft/world/entity/AgeableMob.java
+++ b/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 age = 0;
protected int forcedAge = 0; protected int forcedAge = 0;
protected int forcedAgeTimer; protected int forcedAgeTimer;
@@ -8,7 +16,7 @@
protected AgeableMob(EntityType<? extends AgeableMob> entityType, Level level) { protected AgeableMob(EntityType<? extends AgeableMob> entityType, Level level) {
super(entityType, level); super(entityType, level);
@@ -68,13 +_,15 @@ @@ -68,13 +69,15 @@ public abstract class AgeableMob extends PathfinderMob {
} }
public void ageUp(int amount, boolean forced) { public void ageUp(int amount, boolean forced) {
@@ -25,7 +33,7 @@
this.setAge(age); this.setAge(age);
if (forced) { if (forced) {
this.forcedAge += i1; this.forcedAge += i1;
@@ -106,6 +_,7 @@ @@ -106,6 +109,7 @@ public abstract class AgeableMob extends PathfinderMob {
super.addAdditionalSaveData(compound); super.addAdditionalSaveData(compound);
compound.putInt("Age", this.getAge()); compound.putInt("Age", this.getAge());
compound.putInt("ForcedAge", this.forcedAge); compound.putInt("ForcedAge", this.forcedAge);
@@ -33,7 +41,7 @@
} }
@Override @Override
@@ -113,6 +_,7 @@ @@ -113,6 +117,7 @@ public abstract class AgeableMob extends PathfinderMob {
super.readAdditionalSaveData(compound); super.readAdditionalSaveData(compound);
this.setAge(compound.getIntOr("Age", 0)); this.setAge(compound.getIntOr("Age", 0));
this.forcedAge = compound.getIntOr("ForcedAge", 0); this.forcedAge = compound.getIntOr("ForcedAge", 0);
@@ -41,7 +49,7 @@
} }
@Override @Override
@@ -127,7 +_,7 @@ @@ -127,7 +132,7 @@ public abstract class AgeableMob extends PathfinderMob {
@Override @Override
public void aiStep() { public void aiStep() {
super.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 --- a/net/minecraft/world/entity/AreaEffectCloud.java
+++ b/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 radiusOnUse = 0.0F;
public float radiusPerTick = 0.0F; public float radiusPerTick = 0.0F;
@Nullable @Nullable
@@ -9,7 +17,7 @@
@Nullable @Nullable
public UUID ownerUUID; public UUID ownerUUID;
@@ -193,7 +_,7 @@ @@ -193,7 +193,7 @@ public class AreaEffectCloud extends Entity implements TraceableEntity {
private void serverTick(ServerLevel level) { private void serverTick(ServerLevel level) {
if (this.duration != -1 && this.tickCount >= this.waitTime + this.duration) { if (this.duration != -1 && this.tickCount >= this.waitTime + this.duration) {
@@ -18,7 +26,7 @@
} else { } else {
boolean isWaiting = this.isWaiting(); boolean isWaiting = this.isWaiting();
boolean flag = this.tickCount < this.waitTime; 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) { if (this.radiusPerTick != 0.0F) {
radius += this.radiusPerTick; radius += this.radiusPerTick;
if (radius < 0.5F) { if (radius < 0.5F) {
@@ -27,7 +35,7 @@
return; return;
} }
@@ -222,6 +_,7 @@ @@ -222,6 +222,7 @@ public class AreaEffectCloud extends Entity implements TraceableEntity {
this.potionContents.forEachEffect(list::add, this.potionDurationScale); this.potionContents.forEachEffect(list::add, this.potionDurationScale);
List<LivingEntity> entitiesOfClass = this.level().getEntitiesOfClass(LivingEntity.class, this.getBoundingBox()); List<LivingEntity> entitiesOfClass = this.level().getEntitiesOfClass(LivingEntity.class, this.getBoundingBox());
if (!entitiesOfClass.isEmpty()) { if (!entitiesOfClass.isEmpty()) {
@@ -35,7 +43,7 @@
for (LivingEntity livingEntity : entitiesOfClass) { for (LivingEntity livingEntity : entitiesOfClass) {
if (!this.victims.containsKey(livingEntity) if (!this.victims.containsKey(livingEntity)
&& livingEntity.isAffectedByPotions() && livingEntity.isAffectedByPotions()
@@ -230,6 +_,17 @@ @@ -230,6 +231,17 @@ public class AreaEffectCloud extends Entity implements TraceableEntity {
double d1 = livingEntity.getZ() - this.getZ(); double d1 = livingEntity.getZ() - this.getZ();
double d2 = d * d + d1 * d1; double d2 = d * d + d1 * d1;
if (d2 <= radius * radius) { if (d2 <= radius * radius) {
@@ -53,7 +61,7 @@
this.victims.put(livingEntity, this.tickCount + this.reapplicationDelay); this.victims.put(livingEntity, this.tickCount + this.reapplicationDelay);
for (MobEffectInstance mobEffectInstance : list) { for (MobEffectInstance mobEffectInstance : list) {
@@ -238,14 +_,14 @@ @@ -238,14 +250,14 @@ public class AreaEffectCloud extends Entity implements TraceableEntity {
.value() .value()
.applyInstantenousEffect(level, this, this.getOwner(), livingEntity, mobEffectInstance.getAmplifier(), 0.5); .applyInstantenousEffect(level, this, this.getOwner(), livingEntity, mobEffectInstance.getAmplifier(), 0.5);
} else { } else {
@@ -70,7 +78,7 @@
return; return;
} }
@@ -255,7 +_,7 @@ @@ -255,7 +267,7 @@ public class AreaEffectCloud extends Entity implements TraceableEntity {
if (this.durationOnUse != 0 && this.duration != -1) { if (this.durationOnUse != 0 && this.duration != -1) {
this.duration = this.duration + this.durationOnUse; this.duration = this.duration + this.durationOnUse;
if (this.duration <= 0) { 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 --- a/net/minecraft/world/entity/Entity.java
+++ b/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; import org.jetbrains.annotations.Contract;
public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess, ScoreHolder, DataComponentGetter { 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 ID_TAG = "id";
public static final String PASSENGERS_TAG = "Passengers"; public static final String PASSENGERS_TAG = "Passengers";
private static final String DATA_TAG = "data"; 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 yOld;
public double zOld; public double zOld;
public boolean noPhysics; public boolean noPhysics;
@@ -117,7 +125,7 @@
public int tickCount; public int tickCount;
private int remainingFireTicks = -this.getFireImmuneTicks(); private int remainingFireTicks = -this.getFireImmuneTicks();
public boolean wasTouchingWater; 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 UUID uuid = Mth.createInsecureUUID(this.random);
protected String stringUUID = this.uuid.toString(); protected String stringUUID = this.uuid.toString();
private boolean hasGlowingTag; private boolean hasGlowingTag;
@@ -126,7 +134,7 @@
private final double[] pistonDeltas = new double[]{0.0, 0.0, 0.0}; private final double[] pistonDeltas = new double[]{0.0, 0.0, 0.0};
private long pistonDeltasGameTime; private long pistonDeltasGameTime;
private EntityDimensions dimensions; private EntityDimensions dimensions;
@@ -251,7 +_,7 @@ @@ -251,7 +352,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
private boolean onGroundNoBlocks = false; private boolean onGroundNoBlocks = false;
private float crystalSoundIntensity; private float crystalSoundIntensity;
private int lastCrystalSoundPlayTick; private int lastCrystalSoundPlayTick;
@@ -135,7 +143,7 @@
@Nullable @Nullable
private BlockState inBlockState = null; private BlockState inBlockState = null;
private final List<List<Entity.Movement>> movementThisTick = new ObjectArrayList<>(); 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 LongSet visitedBlocks = new LongOpenHashSet();
private final InsideBlockEffectApplier.StepBasedCollector insideEffectCollector = new InsideBlockEffectApplier.StepBasedCollector(); private final InsideBlockEffectApplier.StepBasedCollector insideEffectCollector = new InsideBlockEffectApplier.StepBasedCollector();
private CustomData customData = CustomData.EMPTY; private CustomData customData = CustomData.EMPTY;
@@ -177,7 +185,7 @@
public Entity(EntityType<?> entityType, Level level) { public Entity(EntityType<?> entityType, Level level) {
this.type = entityType; this.type = entityType;
@@ -280,6 +_,7 @@ @@ -280,6 +416,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
this.entityData = builder.build(); this.entityData = builder.build();
this.setPos(0.0, 0.0, 0.0); this.setPos(0.0, 0.0, 0.0);
this.eyeHeight = this.dimensions.eyeHeight(); this.eyeHeight = this.dimensions.eyeHeight();
@@ -185,7 +193,7 @@
} }
public boolean isColliding(BlockPos pos, BlockState state) { 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; return team != null && team.getColor().getColor() != null ? team.getColor().getColor() : 16777215;
} }
@@ -198,7 +206,7 @@
public boolean isSpectator() { public boolean isSpectator() {
return false; return false;
} }
@@ -332,7 +_,7 @@ @@ -332,7 +475,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
} }
public boolean addTag(String tag) { public boolean addTag(String tag) {
@@ -207,7 +215,7 @@
} }
public boolean removeTag(String tag) { 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) { public void kill(ServerLevel level) {
@@ -228,7 +236,7 @@
} }
protected abstract void defineSynchedData(SynchedEntityData.Builder builder); 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; return this.entityData;
} }
@@ -277,7 +285,7 @@
@Override @Override
public boolean equals(Object object) { public boolean equals(Object object) {
return object instanceof Entity && ((Entity)object).id == this.id; 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) { public void remove(Entity.RemovalReason reason) {
@@ -292,7 +300,7 @@
} }
public void onClientRemoval() { public void onClientRemoval() {
@@ -375,6 +_,15 @@ @@ -375,6 +572,15 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
} }
public void setPose(Pose pose) { public void setPose(Pose pose) {
@@ -308,7 +316,7 @@
this.entityData.set(DATA_POSE, pose); 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) { public void setRot(float yRot, float xRot) {
@@ -341,7 +349,7 @@
this.setYRot(yRot % 360.0F); this.setYRot(yRot % 360.0F);
this.setXRot(xRot % 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) { public void setPos(double x, double y, double z) {
@@ -352,7 +360,7 @@
} }
protected final AABB makeBoundingBox() { protected final AABB makeBoundingBox() {
@@ -438,12 +_,28 @@ @@ -438,12 +670,28 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
} }
public void tick() { public void tick() {
@@ -381,7 +389,7 @@
this.inBlockState = null; this.inBlockState = null;
if (this.isPassenger() && this.getVehicle().isRemoved()) { if (this.isPassenger() && this.getVehicle().isRemoved()) {
this.stopRiding(); this.stopRiding();
@@ -453,7 +_,7 @@ @@ -453,7 +701,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
this.boardingCooldown--; this.boardingCooldown--;
} }
@@ -390,7 +398,7 @@
if (this.canSpawnSprintParticle()) { if (this.canSpawnSprintParticle()) {
this.spawnSprintParticle(); this.spawnSprintParticle();
} }
@@ -484,6 +_,10 @@ @@ -484,6 +732,10 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
if (this.isInLava()) { if (this.isInLava()) {
this.fallDistance *= 0.5; this.fallDistance *= 0.5;
@@ -401,7 +409,7 @@
} }
this.checkBelowWorld(); this.checkBelowWorld();
@@ -500,11 +_,16 @@ @@ -500,11 +752,16 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
} }
public void setSharedFlagOnFire(boolean isOnFire) { public void setSharedFlagOnFire(boolean isOnFire) {
@@ -420,7 +428,7 @@
this.onBelowWorld(); this.onBelowWorld();
} }
} }
@@ -532,15 +_,41 @@ @@ -532,15 +789,41 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
} }
public void lavaIgnite() { public void lavaIgnite() {
@@ -464,7 +472,7 @@
&& this.shouldPlayLavaHurtSound() && this.shouldPlayLavaHurtSound()
&& !this.isSilent()) { && !this.isSilent()) {
serverLevel.playSound( serverLevel.playSound(
@@ -555,6 +_,20 @@ @@ -555,6 +838,20 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
} }
public final void igniteForSeconds(float seconds) { public final void igniteForSeconds(float seconds) {
@@ -485,7 +493,7 @@
this.igniteForTicks(Mth.floor(seconds * 20.0F)); 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() { protected void onBelowWorld() {
@@ -494,7 +502,7 @@
} }
public boolean isFree(double x, double y, double z) { 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; return this.onGround;
} }
@@ -523,7 +531,7 @@
if (this.noPhysics) { if (this.noPhysics) {
this.setPos(this.getX() + movement.x, this.getY() + movement.y, this.getZ() + movement.z); this.setPos(this.getX() + movement.x, this.getY() + movement.y, this.getZ() + movement.z);
} else { } else {
@@ -721,6 +_,27 @@ @@ -721,6 +1039,27 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
block.updateEntityMovementAfterFallOn(this.level(), this); block.updateEntityMovementAfterFallOn(this.level(), this);
} }
} }
@@ -551,7 +559,7 @@
if (!this.level().isClientSide() || this.isLocalInstanceAuthoritative()) { if (!this.level().isClientSide() || this.isLocalInstanceAuthoritative()) {
Entity.MovementEmission movementEmission = this.getMovementEmission(); Entity.MovementEmission movementEmission = this.getMovementEmission();
@@ -734,6 +_,13 @@ @@ -734,6 +1073,13 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
profilerFiller.pop(); profilerFiller.pop();
} }
} }
@@ -565,7 +573,7 @@
} }
private void applyMovementEmissionAndPlaySound(Entity.MovementEmission movementEmission, Vec3 movement, BlockPos pos, BlockState state) { 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) { protected BlockPos getOnPos(float yOffset) {
@@ -574,7 +582,7 @@
BlockPos blockPos = this.mainSupportingBlockPos.get(); BlockPos blockPos = this.mainSupportingBlockPos.get();
if (!(yOffset > 1.0E-5F)) { if (!(yOffset > 1.0E-5F)) {
return blockPos; 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()); || this.collidedWithShapeMovingFrom(vec3, vec31, entityInsideCollisionShape.move(new Vec3(pos)).toAabbs());
if (flag) { if (flag) {
try { try {
@@ -583,7 +591,7 @@
blockState.entityInside(this.level(), pos, this, stepBasedCollector); blockState.entityInside(this.level(), pos, this, stepBasedCollector);
this.onInsideBlock(blockState); this.onInsideBlock(blockState);
} catch (Throwable var14) { } 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); boolean flag1 = this.collidedWithFluid(blockState.getFluidState(), pos, vec3, vec31);
if (flag1) { if (flag1) {
@@ -592,7 +600,7 @@
blockState.getFluidState().entityInside(this.level(), pos, this, stepBasedCollector); 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.setXRot(Mth.clamp(xRot, -90.0F, 90.0F) % 360.0F);
this.yRotO = this.getYRot(); this.yRotO = this.getYRot();
this.xRotO = this.getXRot(); this.xRotO = this.getXRot();
@@ -600,7 +608,7 @@
} }
public void absSnapTo(double x, double y, double z) { 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.yo = y;
this.zo = d1; this.zo = d1;
this.setPos(d, y, d1); this.setPos(d, y, d1);
@@ -608,7 +616,7 @@
} }
public void snapTo(Vec3 pos) { 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) { public void snapTo(double x, double y, double z, float yRot, float xRot) {
@@ -628,7 +636,7 @@
} }
public final void setOldPosAndRot() { public final void setOldPosAndRot() {
@@ -1618,6 +_,7 @@ @@ -1618,6 +1974,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
public void push(Entity entity) { public void push(Entity entity) {
if (!this.isPassengerOfSameVehicle(entity)) { if (!this.isPassengerOfSameVehicle(entity)) {
if (!entity.noPhysics && !this.noPhysics) { if (!entity.noPhysics && !this.noPhysics) {
@@ -636,7 +644,7 @@
double d = entity.getX() - this.getX(); double d = entity.getX() - this.getX();
double d1 = entity.getZ() - this.getZ(); double d1 = entity.getZ() - this.getZ();
double max = Mth.absMax(d, d1); 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) { public void push(double x, double y, double z) {
@@ -659,7 +667,7 @@
this.hasImpulse = true; this.hasImpulse = true;
} }
@@ -1758,8 +_,20 @@ @@ -1758,9 +2129,21 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
} }
public boolean isPushable() { public boolean isPushable() {
@@ -671,16 +679,17 @@
+ // Paper end - Climbing should not bypass cramming gamerule + // Paper end - Climbing should not bypass cramming gamerule
return false; return false;
} }
+
+ // CraftBukkit start - collidable API + // CraftBukkit start - collidable API
+ public boolean canCollideWithBukkit(Entity entity) { + public boolean canCollideWithBukkit(Entity entity) {
+ return this.isPushable(); + return this.isPushable();
+ } + }
+ // CraftBukkit end + // CraftBukkit end
+
public void awardKillScore(Entity entity, DamageSource damageSource) { public void awardKillScore(Entity entity, DamageSource damageSource) {
if (entity instanceof ServerPlayer) { 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) { public boolean saveAsPassenger(CompoundTag compound) {
@@ -708,7 +717,7 @@
return true; return true;
} }
} }
@@ -1805,14 +_,35 @@ @@ -1805,14 +2196,35 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
} }
public CompoundTag saveWithoutId(CompoundTag compound) { public CompoundTag saveWithoutId(CompoundTag compound) {
@@ -744,7 +753,7 @@
compound.store("Rotation", Vec2.CODEC, new Vec2(this.getYRot(), this.getXRot())); compound.store("Rotation", Vec2.CODEC, new Vec2(this.getYRot(), this.getXRot()));
compound.putDouble("fall_distance", this.fallDistance); compound.putDouble("fall_distance", this.fallDistance);
compound.putShort("Fire", (short)this.remainingFireTicks); 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("OnGround", this.onGround());
compound.putBoolean("Invulnerable", this.invulnerable); compound.putBoolean("Invulnerable", this.invulnerable);
compound.putInt("PortalCooldown", this.portalCooldown); compound.putInt("PortalCooldown", this.portalCooldown);
@@ -775,7 +784,7 @@
Component customName = this.getCustomName(); Component customName = this.getCustomName();
if (customName != null) { if (customName != null) {
RegistryOps<Tag> registryOps = this.registryAccess().createSerializationContext(NbtOps.INSTANCE); 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()); compound.putInt("TicksFrozen", this.getTicksFrozen());
} }
@@ -790,7 +799,7 @@
if (!this.tags.isEmpty()) { if (!this.tags.isEmpty()) {
compound.store("Tags", TAG_LIST_CODEC, List.copyOf(this.tags)); 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); compound.store("data", CustomData.CODEC, this.customData);
} }
@@ -806,7 +815,7 @@
listTag.add(compoundTag); listTag.add(compoundTag);
} }
} }
@@ -1876,6 +_,33 @@ @@ -1876,6 +2313,33 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
} }
} }
@@ -840,7 +849,7 @@
return compound; return compound;
} catch (Throwable var8) { } catch (Throwable var8) {
CrashReport crashReport = CrashReport.forThrowable(var8, "Saving entity NBT"); 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) { public void load(CompoundTag compound) {
try { try {
Vec3 vec3 = compound.read("Pos", Vec3.CODEC).orElse(Vec3.ZERO); Vec3 vec3 = compound.read("Pos", Vec3.CODEC).orElse(Vec3.ZERO);
@@ -849,7 +858,7 @@
Vec2 vec2 = compound.read("Rotation", Vec2.CODEC).orElse(Vec2.ZERO); 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.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; 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.setNoGravity(compound.getBooleanOr("NoGravity", false));
this.setGlowingTag(compound.getBooleanOr("Glowing", false)); this.setGlowingTag(compound.getBooleanOr("Glowing", false));
this.setTicksFrozen(compound.getIntOr("TicksFrozen", 0)); this.setTicksFrozen(compound.getIntOr("TicksFrozen", 0));
@@ -871,7 +880,7 @@
this.customData = compound.read("data", CustomData.CODEC).orElse(CustomData.EMPTY); this.customData = compound.read("data", CustomData.CODEC).orElse(CustomData.EMPTY);
this.tags.clear(); this.tags.clear();
compound.read("Tags", TAG_LIST_CODEC).ifPresent(this.tags::addAll); 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 { } else {
throw new IllegalStateException("Entity has invalid rotation"); throw new IllegalStateException("Entity has invalid rotation");
} }
@@ -939,7 +948,7 @@
} catch (Throwable var8) { } catch (Throwable var8) {
CrashReport crashReport = CrashReport.forThrowable(var8, "Loading entity NBT"); CrashReport crashReport = CrashReport.forThrowable(var8, "Loading entity NBT");
CrashReportCategory crashReportCategory = crashReport.addCategory("Entity being loaded"); CrashReportCategory crashReportCategory = crashReport.addCategory("Entity being loaded");
@@ -1946,10 +_,21 @@ @@ -1946,11 +2484,22 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@Nullable @Nullable
public final String getEncodeId() { public final String getEncodeId() {
@@ -951,19 +960,19 @@
EntityType<?> type = this.getType(); EntityType<?> type = this.getType();
ResourceLocation key = EntityType.getKey(type); ResourceLocation key = EntityType.getKey(type);
- return type.canSerialize() && key != null ? key.toString() : null; - return type.canSerialize() && key != null ? key.toString() : null;
- }
+ return (type.canSerialize() || includeNonSaveable) && key != null ? key.toString() : null; // Paper - Raw entity serialization API + return (type.canSerialize() || includeNonSaveable) && key != null ? key.toString() : null; // Paper - Raw entity serialization API
+ } }
+
+ // CraftBukkit start - allow excluding certain data when saving + // CraftBukkit start - allow excluding certain data when saving
+ protected void addAdditionalSaveData(CompoundTag tag, boolean includeAll) { + protected void addAdditionalSaveData(CompoundTag tag, boolean includeAll) {
+ this.addAdditionalSaveData(tag); + this.addAdditionalSaveData(tag);
+ } + }
+ // CraftBukkit end + // CraftBukkit end
+
protected abstract void readAdditionalSaveData(CompoundTag tag); 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 @Nullable
public ItemEntity spawnAtLocation(ServerLevel level, ItemStack stack, float yOffset) { public ItemEntity spawnAtLocation(ServerLevel level, ItemStack stack, float yOffset) {
@@ -1028,7 +1037,7 @@
level.addFreshEntity(itemEntity); level.addFreshEntity(itemEntity);
return 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 (this.isAlive() && this instanceof Leashable leashable) {
if (leashable.getLeashHolder() == player) { if (leashable.getLeashHolder() == player) {
if (!this.level().isClientSide()) { if (!this.level().isClientSide()) {
@@ -1046,7 +1055,7 @@
leashable.removeLeash(); leashable.removeLeash();
} else { } else {
leashable.dropLeash(); leashable.dropLeash();
@@ -2023,6 +_,13 @@ @@ -2023,6 +2633,13 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
ItemStack itemInHand = player.getItemInHand(hand); ItemStack itemInHand = player.getItemInHand(hand);
if (itemInHand.is(Items.LEAD) && leashable.canHaveALeashAttachedToIt()) { if (itemInHand.is(Items.LEAD) && leashable.canHaveALeashAttachedToIt()) {
if (!this.level().isClientSide()) { if (!this.level().isClientSide()) {
@@ -1060,7 +1069,7 @@
leashable.setLeashedTo(player, true); 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) { public boolean startRiding(Entity vehicle, boolean force) {
@@ -1074,7 +1083,7 @@
return false; return false;
} else { } else {
for (Entity entity = vehicle; entity.vehicle != null; entity = entity.vehicle) { 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)) { if (force || this.canRide(vehicle) && vehicle.canAddPassenger(this)) {
@@ -1102,7 +1111,7 @@
if (this.isPassenger()) { if (this.isPassenger()) {
this.stopRiding(); this.stopRiding();
} }
@@ -2138,15 +_,26 @@ @@ -2138,15 +2776,26 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
} }
public void removeVehicle() { public void removeVehicle() {
@@ -1131,7 +1140,7 @@
} }
protected void addPassenger(Entity passenger) { 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) { if (this.passengers.size() == 1 && this.passengers.get(0) == passenger) {
this.passengers = ImmutableList.of(); this.passengers = ImmutableList.of();
} else { } else {
@@ -2183,6 +_,7 @@ @@ -2183,6 +2865,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
passenger.boardingCooldown = 60; passenger.boardingCooldown = 60;
this.gameEvent(GameEvent.ENTITY_DISMOUNT, passenger); this.gameEvent(GameEvent.ENTITY_DISMOUNT, passenger);
} }
@@ -1184,7 +1193,7 @@
} }
protected boolean canAddPassenger(Entity passenger) { 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); TeleportTransition portalDestination = this.portalProcess.getPortalDestination(serverLevel, this);
if (portalDestination != null) { if (portalDestination != null) {
ServerLevel level = portalDestination.newLevel(); ServerLevel level = portalDestination.newLevel();
@@ -1195,7 +1204,7 @@
this.teleport(portalDestination); this.teleport(portalDestination);
} }
} }
@@ -2348,7 +_,7 @@ @@ -2348,7 +3031,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
} }
public boolean isCrouching() { public boolean isCrouching() {
@@ -1204,7 +1213,7 @@
} }
public boolean isSprinting() { public boolean isSprinting() {
@@ -2364,7 +_,7 @@ @@ -2364,7 +3047,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
} }
public boolean isVisuallySwimming() { public boolean isVisuallySwimming() {
@@ -1213,7 +1222,7 @@
} }
public boolean isVisuallyCrawling() { public boolean isVisuallyCrawling() {
@@ -2372,6 +_,13 @@ @@ -2372,6 +3055,13 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
} }
public void setSwimming(boolean swimming) { public void setSwimming(boolean swimming) {
@@ -1227,7 +1236,7 @@
this.setSharedFlag(4, swimming); this.setSharedFlag(4, swimming);
} }
@@ -2410,6 +_,7 @@ @@ -2410,6 +3100,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@Nullable @Nullable
public PlayerTeam getTeam() { public PlayerTeam getTeam() {
@@ -1235,7 +1244,7 @@
return this.level().getScoreboard().getPlayersTeam(this.getScoreboardName()); 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) { public void setInvisible(boolean invisible) {
@@ -1248,7 +1257,7 @@
} }
public boolean getSharedFlag(int flag) { public boolean getSharedFlag(int flag) {
@@ -2443,7 +_,7 @@ @@ -2443,7 +3138,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
} }
public int getMaxAirSupply() { public int getMaxAirSupply() {
@@ -1257,7 +1266,7 @@
} }
public int getAirSupply() { public int getAirSupply() {
@@ -2451,10 +_,22 @@ @@ -2451,10 +3146,22 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
} }
public void setAirSupply(int air) { public void setAirSupply(int air) {
@@ -1281,7 +1290,7 @@
this.setTicksFrozen(0); 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) { public void thunderHit(ServerLevel level, LightningBolt lightning) {
this.setRemainingFireTicks(this.remainingFireTicks + 1); this.setRemainingFireTicks(this.remainingFireTicks + 1);
@@ -1292,9 +1301,6 @@
+ // CraftBukkit end + // CraftBukkit end
if (this.remainingFireTicks == 0) { if (this.remainingFireTicks == 0) {
- this.igniteForSeconds(8.0F); - this.igniteForSeconds(8.0F);
- }
-
- this.hurtServer(level, this.damageSources().lightningBolt(), 5.0F);
+ // CraftBukkit start - Call a combust event when lightning strikes + // 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); + org.bukkit.event.entity.EntityCombustByEntityEvent entityCombustEvent = new org.bukkit.event.entity.EntityCombustByEntityEvent(stormBukkitEntity, thisBukkitEntity, 8.0F);
+ pluginManager.callEvent(entityCombustEvent); + pluginManager.callEvent(entityCombustEvent);
@@ -1306,8 +1312,9 @@
+ // Paper end - fix EntityCombustEvent cancellation + // Paper end - fix EntityCombustEvent cancellation
+ } + }
+ // CraftBukkit end + // CraftBukkit end
+ } }
+
- this.hurtServer(level, this.damageSources().lightningBolt(), 5.0F);
+ // CraftBukkit start + // CraftBukkit start
+ if (thisBukkitEntity instanceof org.bukkit.entity.Hanging) { + 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); + 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) { 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 return this.removalReason != null
? String.format( ? String.format(
Locale.ROOT, 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) { public void restoreFrom(Entity entity) {
@@ -1377,7 +1384,7 @@
CompoundTag compoundTag = entity.saveWithoutId(new CompoundTag()); CompoundTag compoundTag = entity.saveWithoutId(new CompoundTag());
compoundTag.remove("Dimension"); compoundTag.remove("Dimension");
this.load(compoundTag); this.load(compoundTag);
@@ -2693,7 +_,56 @@ @@ -2693,7 +3443,56 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@Nullable @Nullable
public Entity teleport(TeleportTransition teleportTransition) { public Entity teleport(TeleportTransition teleportTransition) {
@@ -1434,7 +1441,7 @@
ServerLevel level = teleportTransition.newLevel(); ServerLevel level = teleportTransition.newLevel();
boolean flag = level.dimension() != serverLevel.dimension(); boolean flag = level.dimension() != serverLevel.dimension();
if (!teleportTransition.asPassenger()) { if (!teleportTransition.asPassenger()) {
@@ -2742,10 +_,15 @@ @@ -2742,10 +3541,15 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
profilerFiller.pop(); profilerFiller.pop();
return null; return null;
} else { } else {
@@ -1451,7 +1458,7 @@
for (Entity entity2 : list) { for (Entity entity2 : list) {
entity2.startRiding(entityx, true); entity2.startRiding(entityx, true);
@@ -2818,9 +_,17 @@ @@ -2818,9 +3622,17 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
} }
protected void removeAfterChangingDimensions() { 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())); return PortalShape.getRelativePosition(portal, axis, this.position(), this.getDimensions(this.getPose()));
} }
@@ -1510,7 +1517,7 @@
if (fromLevel.dimension() == Level.END && toLevel.dimension() == Level.OVERWORLD) { if (fromLevel.dimension() == Level.END && toLevel.dimension() == Level.OVERWORLD) {
for (Entity entity : this.getPassengers()) { for (Entity entity : this.getPassengers()) {
if (entity instanceof ServerPlayer serverPlayer && !serverPlayer.seenCredits) { 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); return this.entityData.get(DATA_CUSTOM_NAME_VISIBLE);
} }
@@ -1527,7 +1534,7 @@
return entity != null; return entity != null;
} }
@@ -3055,7 +_,26 @@ @@ -3055,7 +3899,26 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
} }
public final void setBoundingBox(AABB bb) { public final void setBoundingBox(AABB bb) {
@@ -1555,7 +1562,7 @@
} }
public final float getEyeHeight(Pose pose) { 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) { public void stopSeenByPlayer(ServerPlayer serverPlayer) {
@@ -1568,7 +1575,7 @@
} }
public float rotate(Rotation transformRotation) { public float rotate(Rotation transformRotation) {
@@ -3132,7 +_,7 @@ @@ -3132,7 +4001,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
} }
@Nullable @Nullable
@@ -1577,7 +1584,7 @@
return null; return null;
} }
@@ -3164,21 +_,32 @@ @@ -3164,21 +4033,32 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
} }
private Stream<Entity> getIndirectPassengersStream() { private Stream<Entity> getIndirectPassengersStream() {
@@ -1611,7 +1618,7 @@
} }
public int countPlayerPassengers() { public int countPlayerPassengers() {
@@ -3186,6 +_,7 @@ @@ -3186,6 +4066,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
} }
public boolean hasExactlyOnePlayerPassenger() { public boolean hasExactlyOnePlayerPassenger() {
@@ -1619,7 +1626,7 @@
return this.countPlayerPassengers() == 1; return this.countPlayerPassengers() == 1;
} }
@@ -3268,9 +_,38 @@ @@ -3268,9 +4149,38 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
return 1; 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); vec3 = vec3.add(flow);
i++; 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) { public void setDeltaMovement(Vec3 deltaMovement) {
@@ -1681,7 +1688,7 @@
} }
public void addDeltaMovement(Vec3 addend) { 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); return this.getZ((2.0 * this.random.nextDouble() - 1.0) * scale);
} }
@@ -1727,7 +1734,7 @@
int floor = Mth.floor(x); int floor = Mth.floor(x);
int floor1 = Mth.floor(y); int floor1 = Mth.floor(y);
int floor2 = Mth.floor(z); int floor2 = Mth.floor(z);
@@ -3504,6 +_,12 @@ @@ -3504,6 +4457,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
this.levelCallback.onMove(); this.levelCallback.onMove();
} }
@@ -1740,7 +1747,7 @@
} }
public void checkDespawn() { public void checkDespawn() {
@@ -3543,6 +_,12 @@ @@ -3543,6 +4502,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
return this.getTicksFrozen() > 0; return this.getTicksFrozen() > 0;
} }
@@ -1753,7 +1760,7 @@
public float getYRot() { public float getYRot() {
return this.yRot; return this.yRot;
} }
@@ -3593,7 +_,9 @@ @@ -3593,7 +4558,9 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
} }
@Override @Override
@@ -1764,7 +1771,7 @@
if (this.removalReason == null) { if (this.removalReason == null) {
this.removalReason = removalReason; this.removalReason = removalReason;
} }
@@ -3605,12 +_,28 @@ @@ -3605,12 +4572,28 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
this.getPassengers().forEach(Entity::stopRiding); this.getPassengers().forEach(Entity::stopRiding);
this.levelCallback.onRemove(removalReason); this.levelCallback.onRemove(removalReason);
this.onRemoval(removalReason); this.onRemoval(removalReason);
@@ -1793,7 +1800,7 @@
@Override @Override
public void setLevelCallback(EntityInLevelCallback levelCallback) { public void setLevelCallback(EntityInLevelCallback levelCallback) {
this.levelCallback = levelCallback; this.levelCallback = levelCallback;
@@ -3780,4 +_,14 @@ @@ -3780,4 +4763,14 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
return this.save; 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 --- a/net/minecraft/world/entity/EntitySelector.java
+++ b/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> 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_COLLIDED_WITH = NO_SPECTATORS.and(Entity::canBeCollidedWith);
public static final Predicate<Entity> CAN_BE_PICKED = NO_SPECTATORS.and(Entity::isPickable); public static final Predicate<Entity> CAN_BE_PICKED = NO_SPECTATORS.and(Entity::isPickable);
@@ -23,7 +31,7 @@
private EntitySelector() { private EntitySelector() {
} }
@@ -27,18 +_,24 @@ @@ -27,18 +43,24 @@ public final class EntitySelector {
} }
public static Predicate<Entity> pushableBy(Entity entity) { 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 --- a/net/minecraft/world/entity/EntityType.java
+++ b/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() .fireImmune()
.sized(6.0F, 0.5F) .sized(6.0F, 0.5F)
.clientTrackingRange(10) .clientTrackingRange(10)
@@ -9,7 +17,7 @@
); );
public static final EntityType<Armadillo> ARMADILLO = register( 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) "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 shouldOffsetY,
boolean shouldOffsetYMore boolean shouldOffsetYMore
) { ) {
@@ -32,7 +40,7 @@
Consumer<T> consumer; Consumer<T> consumer;
if (spawnedFrom != null) { if (spawnedFrom != null) {
consumer = createDefaultStackConfig(level, spawnedFrom, owner); consumer = createDefaultStackConfig(level, spawnedFrom, owner);
@@ -1152,7 +_,7 @@ @@ -1152,7 +1168,7 @@ public class EntityType<T extends Entity> implements FeatureElement, EntityTypeT
consumer = entity -> {}; consumer = entity -> {};
} }
@@ -41,7 +49,7 @@
} }
public static <T extends Entity> Consumer<T> createDefaultStackConfig(Level level, ItemStack stack, @Nullable LivingEntity owner) { 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) { 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); CustomData customData = stack.getOrDefault(DataComponents.ENTITY_DATA, CustomData.EMPTY);
@@ -101,7 +109,7 @@
if (entity instanceof Mob mob) { if (entity instanceof Mob mob) {
mob.playAmbientSound(); mob.playAmbientSound();
} }
@@ -1237,6 +_,15 @@ @@ -1237,6 +1290,15 @@ public class EntityType<T extends Entity> implements FeatureElement, EntityTypeT
if (level.isClientSide if (level.isClientSide
|| !entity.getType().onlyOpCanSetNbt() || !entity.getType().onlyOpCanSetNbt()
|| owner instanceof Player player && server.getPlayerList().isOp(player.getGameProfile())) { || owner instanceof Player player && server.getPlayerList().isOp(player.getGameProfile())) {
@@ -117,7 +125,7 @@
customData.loadInto(entity); 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) { 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 --- a/net/minecraft/world/entity/ExperienceOrb.java
+++ b/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 @Nullable
private Player followingPlayer; private Player followingPlayer;
private final InterpolationHandler interpolation = new InterpolationHandler(this); private final InterpolationHandler interpolation = new InterpolationHandler(this);
-
+ // Paper start + // Paper start
+ @Nullable + @Nullable
+ public java.util.UUID sourceEntityId; + public java.util.UUID sourceEntityId;
@@ -17,7 +24,7 @@
+ if (expData.isEmpty()) { + if (expData.isEmpty()) {
+ return; + return;
+ } + }
+
+ this.sourceEntityId = expData.read("source", net.minecraft.core.UUIDUtil.CODEC).orElse(null); + this.sourceEntityId = expData.read("source", net.minecraft.core.UUIDUtil.CODEC).orElse(null);
+ this.triggerEntityId = expData.read("trigger", net.minecraft.core.UUIDUtil.CODEC).orElse(null); + this.triggerEntityId = expData.read("trigger", net.minecraft.core.UUIDUtil.CODEC).orElse(null);
+ expData.getString("reason").ifPresent(reason -> { + expData.getString("reason").ifPresent(reason -> {
@@ -56,7 +63,7 @@
this.setPos(x, y, z); this.setPos(x, y, z);
if (!this.level().isClientSide) { if (!this.level().isClientSide) {
this.setYRot((float)(this.random.nextDouble() * 360.0)); this.setYRot((float)(this.random.nextDouble() * 360.0));
@@ -119,12 +_,13 @@ @@ -119,12 +164,13 @@ public class ExperienceOrb extends Entity {
this.age++; this.age++;
if (this.age >= 6000) { if (this.age >= 6000) {
@@ -71,7 +78,7 @@
if (this.followingPlayer == null || this.followingPlayer.isSpectator() || this.followingPlayer.distanceToSqr(this) > 64.0) { if (this.followingPlayer == null || this.followingPlayer.isSpectator() || this.followingPlayer.distanceToSqr(this) > 64.0) {
Player nearestPlayer = this.level().getNearestPlayer(this, 8.0); Player nearestPlayer = this.level().getNearestPlayer(this, 8.0);
if (nearestPlayer != null && !nearestPlayer.isSpectator() && !nearestPlayer.isDeadOrDying()) { 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( Vec3 vec3 = new Vec3(
this.followingPlayer.getX() - this.getX(), this.followingPlayer.getX() - this.getX(),
this.followingPlayer.getY() + this.followingPlayer.getEyeHeight() / 2.0 - this.getY(), 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) { 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)); List<ExperienceOrb> entities = level.getEntities(EntityTypeTest.forClass(ExperienceOrb.class), aabb, orb -> canMerge(orb, randomInt, amount));
if (!entities.isEmpty()) { if (!entities.isEmpty()) {
ExperienceOrb experienceOrb = entities.get(0); 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) { private static boolean canMerge(ExperienceOrb orb, int amount, int other) {
@@ -150,7 +157,7 @@
} }
private void setUnderwaterMovement() { private void setUnderwaterMovement() {
@@ -220,7 +_,7 @@ @@ -220,7 +299,7 @@ public class ExperienceOrb extends Entity {
this.markHurt(); this.markHurt();
this.health = (int)(this.health - amount); this.health = (int)(this.health - amount);
if (this.health <= 0) { if (this.health <= 0) {
@@ -159,7 +166,7 @@
} }
return true; return true;
@@ -231,32 +_,34 @@ @@ -231,32 +310,34 @@ public class ExperienceOrb extends Entity {
public void addAdditionalSaveData(CompoundTag compound) { public void addAdditionalSaveData(CompoundTag compound) {
compound.putShort("Health", (short)this.health); compound.putShort("Health", (short)this.health);
compound.putShort("Age", (short)this.age); 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(); ItemStack itemStack = randomItemWith.get().itemStack();
int i = EnchantmentHelper.modifyDurabilityToRepairFromXp(player.serverLevel(), itemStack, value); int i = EnchantmentHelper.modifyDurabilityToRepairFromXp(player.serverLevel(), itemStack, value);
int min = Math.min(i, itemStack.getDamageValue()); int min = Math.min(i, itemStack.getDamageValue());
@@ -221,7 +228,7 @@
if (i1 > 0) { if (i1 > 0) {
return this.repairPlayerItems(player, i1); return this.repairPlayerItems(player, i1);
} }
@@ -318,6 +_,24 @@ @@ -318,6 +409,24 @@ public class ExperienceOrb extends Entity {
} }
public static int getExperienceValue(int expValue) { 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 --- a/net/minecraft/world/entity/Leashable.java
+++ b/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) { default void writeLeashData(CompoundTag tag, @Nullable Leashable.LeashData leashData) {
@@ -12,7 +20,7 @@
tag.storeNullable("leash", Leashable.LeashData.CODEC, leashData); tag.storeNullable("leash", Leashable.LeashData.CODEC, leashData);
} }
@@ -75,7 +_,9 @@ @@ -75,7 +80,9 @@ public interface Leashable {
} }
if (entity.tickCount > 100) { if (entity.tickCount > 100) {
@@ -22,7 +30,7 @@
entity.setLeashData(null); entity.setLeashData(null);
} }
} }
@@ -99,7 +_,9 @@ @@ -99,7 +106,9 @@ public interface Leashable {
entity.onLeashRemoved(); entity.onLeashRemoved();
if (entity.level() instanceof ServerLevel serverLevel) { if (entity.level() instanceof ServerLevel serverLevel) {
if (dropItem) { if (dropItem) {
@@ -32,7 +40,7 @@
} }
if (broadcastPacket) { if (broadcastPacket) {
@@ -117,7 +_,15 @@ @@ -117,7 +126,15 @@ public interface Leashable {
if (leashData != null && leashData.leashHolder != null) { if (leashData != null && leashData.leashHolder != null) {
if (!entity.isAlive() || !leashData.leashHolder.isAlive()) { if (!entity.isAlive() || !leashData.leashHolder.isAlive()) {
@@ -49,7 +57,7 @@
entity.dropLeash(); entity.dropLeash();
} else { } else {
entity.removeLeash(); entity.removeLeash();
@@ -131,7 +_,7 @@ @@ -131,7 +148,7 @@ public interface Leashable {
return; return;
} }
@@ -58,7 +66,7 @@
entity.leashTooFarBehaviour(); entity.leashTooFarBehaviour();
} else if (f > 6.0) { } else if (f > 6.0) {
entity.elasticRangeLeashBehaviour(leashHolder, f); entity.elasticRangeLeashBehaviour(leashHolder, f);
@@ -148,7 +_,21 @@ @@ -148,7 +165,21 @@ public interface Leashable {
} }
default void leashTooFarBehaviour() { 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 --- a/net/minecraft/world/entity/LivingEntity.java
+++ b/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.jetbrains.annotations.Contract;
import org.slf4j.Logger; import org.slf4j.Logger;
@@ -18,7 +26,7 @@
public abstract class LivingEntity extends Entity implements Attackable { public abstract class LivingEntity extends Entity implements Attackable {
private static final Logger LOGGER = LogUtils.getLogger(); private static final Logger LOGGER = LogUtils.getLogger();
private static final String TAG_ACTIVE_EFFECTS = "active_effects"; 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 EquipmentSlot.class
); );
protected final EntityEquipment equipment; protected final EntityEquipment equipment;
@@ -45,7 +53,7 @@
this.equipment = this.createEquipment(); this.equipment = this.createEquipment();
this.blocksBuilding = true; this.blocksBuilding = true;
this.reapplyPosition(); 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); double d1 = Math.min(0.2F + d / 15.0, 2.5);
int i = (int)(150.0 * d1); 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++; this.deathTime++;
if (this.deathTime >= 20 && !this.level().isClientSide() && !this.isRemoved()) { if (this.deathTime >= 20 && !this.level().isClientSide() && !this.isRemoved()) {
this.level().broadcastEntityEvent(this, (byte)60); 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() { public boolean shouldDiscardFriction() {
@@ -78,7 +86,7 @@
} }
public void setDiscardFriction(boolean discardFriction) { 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) { public void onEquipItem(EquipmentSlot slot, ItemStack oldItem, ItemStack newItem) {
@@ -95,7 +103,7 @@
this.level() this.level()
.playSeededSound( .playSeededSound(
null, null,
@@ -682,12 +_,12 @@ @@ -682,12 +718,12 @@ public abstract class LivingEntity extends Entity implements Attackable {
} }
@Override @Override
@@ -110,7 +118,7 @@
this.brain.clearMemories(); this.brain.clearMemories();
} }
@@ -696,11 +_,17 @@ @@ -696,11 +732,17 @@ public abstract class LivingEntity extends Entity implements Attackable {
mobEffectInstance.onMobRemoved(level, this, removalReason); mobEffectInstance.onMobRemoved(level, this, removalReason);
} }
@@ -128,14 +136,13 @@
compound.putFloat("Health", this.getHealth()); compound.putFloat("Health", this.getHealth());
compound.putShort("HurtTime", (short)this.hurtTime); compound.putShort("HurtTime", (short)this.hurtTime);
compound.putInt("HurtByTimestamp", this.lastHurtByMobTimestamp); 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 + // 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) { + public final ItemEntity drop(ItemStack stack, boolean randomizeMotion, boolean includeThrower) {
+ return this.drop(stack, randomizeMotion, includeThrower, true, null); + return this.drop(stack, randomizeMotion, includeThrower, true, null);
+ } + }
@@ -146,7 +153,7 @@
if (stack.isEmpty()) { if (stack.isEmpty()) {
return null; return null;
} else if (this.level().isClientSide) { } else if (this.level().isClientSide) {
@@ -741,6 +_,31 @@ @@ -741,6 +790,31 @@ public abstract class LivingEntity extends Entity implements Attackable {
} else { } else {
ItemEntity itemEntity = this.createItemStackToDrop(stack, randomizeMotion, includeThrower); ItemEntity itemEntity = this.createItemStackToDrop(stack, randomizeMotion, includeThrower);
if (itemEntity != null) { if (itemEntity != null) {
@@ -178,7 +185,7 @@
this.level().addFreshEntity(itemEntity); this.level().addFreshEntity(itemEntity);
} }
@@ -750,7 +_,22 @@ @@ -750,7 +824,22 @@ public abstract class LivingEntity extends Entity implements Attackable {
@Override @Override
public void readAdditionalSaveData(CompoundTag compound) { public void readAdditionalSaveData(CompoundTag compound) {
@@ -202,7 +209,7 @@
if (this.level() != null && !this.level().isClientSide) { if (this.level() != null && !this.level().isClientSide) {
compound.getList("attributes").ifPresent(this.getAttributes()::load); 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); this.activeEffects.put(mobEffectInstance.getEffect(), mobEffectInstance);
} }
@@ -214,7 +221,7 @@
this.setHealth(compound.getFloatOr("Health", this.getMaxHealth())); this.setHealth(compound.getFloatOr("Health", this.getMaxHealth()));
this.hurtTime = compound.getShortOr("HurtTime", (short)0); this.hurtTime = compound.getShortOr("HurtTime", (short)0);
this.deathTime = compound.getShortOr("DeathTime", (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 -> { compound.getString("Team").ifPresent(string -> {
Scoreboard scoreboard = this.level().getScoreboard(); Scoreboard scoreboard = this.level().getScoreboard();
PlayerTeam playerTeam = scoreboard.getPlayerTeam(string); PlayerTeam playerTeam = scoreboard.getPlayerTeam(string);
@@ -222,7 +229,7 @@
boolean flag = playerTeam != null && scoreboard.addPlayerToTeam(this.getStringUUID(), playerTeam); boolean flag = playerTeam != null && scoreboard.addPlayerToTeam(this.getStringUUID(), playerTeam);
if (!flag) { if (!flag) {
LOGGER.warn("Unable to add mob to team \"{}\" (that team probably doesn't exist)", string); 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)); this.setSharedFlag(7, compound.getBooleanOr("FallFlying", false));
compound.read("sleeping_pos", BlockPos.CODEC).ifPresentOrElse(blockPos -> { compound.read("sleeping_pos", BlockPos.CODEC).ifPresentOrElse(blockPos -> {
@@ -236,7 +243,7 @@
}, this::clearSleepingPos); }, this::clearSleepingPos);
compound.getCompound("Brain").ifPresent(compoundTag -> this.brain = this.makeBrain(new Dynamic<>(NbtOps.INSTANCE, compoundTag))); compound.getCompound("Brain").ifPresent(compoundTag -> this.brain = this.makeBrain(new Dynamic<>(NbtOps.INSTANCE, compoundTag)));
this.lastHurtByPlayer = EntityReference.read(compound, "last_hurt_by_player"); 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)); this.equipment.setAll(compound.read("equipment", EntityEquipment.CODEC, registryOps).orElseGet(EntityEquipment::new));
} }
@@ -281,7 +288,7 @@
iterator.remove(); iterator.remove();
this.onEffectsRemoved(List.of(mobEffectInstance)); this.onEffectsRemoved(List.of(mobEffectInstance));
} else if (mobEffectInstance.getDuration() % 600 == 0) { } else if (mobEffectInstance.getDuration() % 600 == 0) {
@@ -809,6 +_,17 @@ @@ -809,6 +935,17 @@ public abstract class LivingEntity extends Entity implements Attackable {
} catch (ConcurrentModificationException var6) { } catch (ConcurrentModificationException var6) {
} }
@@ -299,7 +306,7 @@
if (this.effectsDirty) { if (this.effectsDirty) {
this.updateInvisibilityStatus(); this.updateInvisibilityStatus();
this.updateGlowingStatus(); this.updateGlowingStatus();
@@ -916,15 +_,33 @@ @@ -916,15 +1053,33 @@ public abstract class LivingEntity extends Entity implements Attackable {
} }
public boolean removeAllEffects() { 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) { public final boolean addEffect(MobEffectInstance effectInstance) {
@@ -397,7 +404,7 @@
this.onEffectUpdated(mobEffectInstance, true, entity); this.onEffectUpdated(mobEffectInstance, true, entity);
flag = true; flag = true;
} }
@@ -1004,11 +_,37 @@ @@ -1004,11 +1195,37 @@ public abstract class LivingEntity extends Entity implements Attackable {
@Nullable @Nullable
public final MobEffectInstance removeEffectNoUpdate(Holder<MobEffect> effect) { public final MobEffectInstance removeEffectNoUpdate(Holder<MobEffect> effect) {
@@ -436,7 +443,7 @@
if (mobEffectInstance != null) { if (mobEffectInstance != null) {
this.onEffectsRemoved(List.of(mobEffectInstance)); this.onEffectsRemoved(List.of(mobEffectInstance));
return true; return true;
@@ -1092,17 +_,62 @@ @@ -1092,17 +1309,62 @@ public abstract class LivingEntity extends Entity implements Attackable {
} }
public void heal(float healAmount) { public void heal(float healAmount) {
@@ -500,7 +507,7 @@
this.entityData.set(DATA_HEALTH_ID, Mth.clamp(health, 0.0F, this.getMaxHealth())); 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) { public boolean hurtServer(ServerLevel level, DamageSource damageSource, float amount) {
if (this.isInvulnerableTo(level, damageSource)) { if (this.isInvulnerableTo(level, damageSource)) {
return false; return false;
@@ -509,7 +516,7 @@
return false; return false;
} else if (damageSource.is(DamageTypeTags.IS_FIRE) && this.hasEffect(MobEffects.FIRE_RESISTANCE)) { } else if (damageSource.is(DamageTypeTags.IS_FIRE) && this.hasEffect(MobEffects.FIRE_RESISTANCE)) {
return false; return false;
@@ -1128,35 +_,59 @@ @@ -1128,35 +1390,59 @@ public abstract class LivingEntity extends Entity implements Attackable {
amount = 0.0F; amount = 0.0F;
} }
@@ -577,7 +584,7 @@
this.hurtDuration = 10; this.hurtDuration = 10;
this.hurtTime = this.hurtDuration; this.hurtTime = this.hurtDuration;
} }
@@ -1171,7 +_,7 @@ @@ -1171,7 +1457,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
level.broadcastDamageEvent(this, damageSource); level.broadcastDamageEvent(this, damageSource);
} }
@@ -586,7 +593,7 @@
this.markHurt(); this.markHurt();
} }
@@ -1186,8 +_,16 @@ @@ -1186,8 +1472,16 @@ public abstract class LivingEntity extends Entity implements Attackable {
d = damageSource.getSourcePosition().x() - this.getX(); d = damageSource.getSourcePosition().x() - this.getX();
d1 = damageSource.getSourcePosition().z() - this.getZ(); d1 = damageSource.getSourcePosition().z() - this.getZ();
} }
@@ -604,7 +611,7 @@
if (!flag) { if (!flag) {
this.indicateDamage(d, d1); this.indicateDamage(d, d1);
} }
@@ -1196,19 +_,19 @@ @@ -1196,19 +1490,19 @@ public abstract class LivingEntity extends Entity implements Attackable {
if (this.isDeadOrDying()) { if (this.isDeadOrDying()) {
if (!this.checkTotemDeathProtection(damageSource)) { if (!this.checkTotemDeathProtection(damageSource)) {
@@ -629,7 +636,7 @@
if (flag2) { if (flag2) {
this.lastDamageSource = damageSource; this.lastDamageSource = damageSource;
this.lastDamageStamp = this.level().getGameTime(); 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) { public float applyItemBlocking(ServerLevel level, DamageSource damageSource, float damageAmount) {
@@ -642,7 +649,7 @@
if (damageAmount <= 0.0F) { if (damageAmount <= 0.0F) {
return 0.0F; return 0.0F;
} else { } else {
@@ -1258,10 +_,12 @@ @@ -1258,10 +1558,12 @@ public abstract class LivingEntity extends Entity implements Attackable {
} }
float f = blocksAttacks.resolveBlockedDamage(damageSource, damageAmount, acos); float f = blocksAttacks.resolveBlockedDamage(damageSource, damageAmount, acos);
@@ -656,7 +663,7 @@
return f; 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) { public void playSecondaryHurtSound(DamageSource damageSource) {
if (damageSource.is(DamageTypes.THORNS)) { if (damageSource.is(DamageTypes.THORNS)) {
SoundSource soundSource = this instanceof Player ? SoundSource.PLAYERS : SoundSource.HOSTILE; 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); return EntityReference.get(this.lastHurtByPlayer, this.level(), Player.class);
} }
@@ -742,7 +749,7 @@
} }
private boolean checkTotemDeathProtection(DamageSource damageSource) { private boolean checkTotemDeathProtection(DamageSource damageSource) {
@@ -1319,18 +_,39 @@ @@ -1319,18 +1686,39 @@ public abstract class LivingEntity extends Entity implements Attackable {
ItemStack itemStack = null; ItemStack itemStack = null;
DeathProtection deathProtection = null; DeathProtection deathProtection = null;
@@ -756,11 +763,14 @@
if (deathProtection != null) { if (deathProtection != null) {
+ hand = interactionHand; // CraftBukkit + hand = interactionHand; // CraftBukkit
itemStack = itemInHand.copy(); itemStack = itemInHand.copy();
- itemInHand.shrink(1);
+ // itemInHand.shrink(1); // CraftBukkit + // 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 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); + final EntityResurrectEvent event = new EntityResurrectEvent((org.bukkit.entity.LivingEntity) this.getBukkitEntity(), handSlot);
+ event.setCancelled(itemStack == null); + event.setCancelled(itemStack == null);
@@ -770,13 +780,7 @@
+ deathProtection = null; + deathProtection = null;
+ } else { + } else {
+ if (!itemInHand.isEmpty() && itemStack != null) { // Paper - only reduce item if actual totem was found + if (!itemInHand.isEmpty() && itemStack != null) { // Paper - only reduce item if actual totem was found
itemInHand.shrink(1); + itemInHand.shrink(1);
- break;
- }
- }
-
- if (itemStack != null) {
- if (this instanceof ServerPlayer serverPlayer) {
+ } + }
+ // Paper start - fix NPE when pre-cancelled EntityResurrectEvent is uncancelled + // 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 + // 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())); serverPlayer.awardStat(Stats.ITEM_USED.get(itemStack.getItem()));
CriteriaTriggers.USED_TOTEM.trigger(serverPlayer, itemStack); CriteriaTriggers.USED_TOTEM.trigger(serverPlayer, itemStack);
this.gameEvent(GameEvent.ITEM_INTERACT_FINISH); 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) { if (!this.isRemoved() && !this.dead) {
Entity entity = damageSource.getEntity(); Entity entity = damageSource.getEntity();
LivingEntity killCredit = this.getKillCredit(); LivingEntity killCredit = this.getKillCredit();
@@ -797,7 +801,7 @@
if (killCredit != null) { if (killCredit != null) {
killCredit.awardKillScore(this, damageSource); 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()) { if (!this.level().isClientSide && this.hasCustomName()) {
@@ -936,7 +940,6 @@
|| this.lastHurtByPlayerMemoryTime > 0 && this.shouldDropExperience() && level.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT) || this.lastHurtByPlayerMemoryTime > 0 && this.shouldDropExperience() && level.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)
)) { )) {
- ExperienceOrb.award(level, this.position(), this.getExperienceReward(level, entity)); - ExperienceOrb.award(level, this.position(), this.getExperienceReward(level, entity));
- }
+ return this.getExperienceReward(level, entity); // CraftBukkit + return this.getExperienceReward(level, entity); // CraftBukkit
+ } + }
+ return 0; // 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 + 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 + 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; + this.expToDrop = 0;
+ } }
+ // CraftBukkit end + // CraftBukkit end
} }
protected void dropCustomDeathLoot(ServerLevel level, DamageSource damageSource, boolean recentlyHit) { 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) { public void knockback(double strength, double x, double z) {
@@ -969,7 +972,7 @@
Vec3 deltaMovement = this.getDeltaMovement(); Vec3 deltaMovement = this.getDeltaMovement();
while (x * x + z * z < 1.0E-5F) { 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); 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 @Override
public boolean isAlive() { public boolean isAlive() {
@@ -1002,7 +1005,7 @@
} }
public boolean isLookingAtMe(LivingEntity entity, double tolerance, boolean scaleByDistance, boolean visual, double... yValues) { 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); boolean flag = super.causeFallDamage(fallDistance, damageMultiplier, damageSource);
int i = this.calculateFallDamage(fallDistance, damageMultiplier); int i = this.calculateFallDamage(fallDistance, damageMultiplier);
if (i > 0) { if (i > 0) {
@@ -1018,7 +1021,7 @@
return true; return true;
} else { } else {
return flag; return flag;
@@ -1740,7 +_,7 @@ @@ -1740,7 +2223,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
protected float getDamageAfterArmorAbsorb(DamageSource damageSource, float damageAmount) { protected float getDamageAfterArmorAbsorb(DamageSource damageSource, float damageAmount) {
if (!damageSource.is(DamageTypeTags.BYPASSES_ARMOR)) { if (!damageSource.is(DamageTypeTags.BYPASSES_ARMOR)) {
@@ -1027,7 +1030,7 @@
damageAmount = CombatRules.getDamageAfterAbsorb( damageAmount = CombatRules.getDamageAfterAbsorb(
this, damageAmount, damageSource, this.getArmorValue(), (float)this.getAttributeValue(Attributes.ARMOR_TOUGHNESS) 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)) { if (damageSource.is(DamageTypeTags.BYPASSES_EFFECTS)) {
return damageAmount; return damageAmount;
} else { } else {
@@ -1037,7 +1040,7 @@
int i = (this.getEffect(MobEffects.RESISTANCE).getAmplifier() + 1) * 5; int i = (this.getEffect(MobEffects.RESISTANCE).getAmplifier() + 1) * 5;
int i1 = 25 - i; int i1 = 25 - i;
float f = damageAmount * i1; 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() { public CombatTracker getCombatTracker() {
@@ -1836,7 +_,17 @@ @@ -1836,7 +2497,17 @@ public abstract class LivingEntity extends Entity implements Attackable {
} }
public final void setArrowCount(int count) { public final void setArrowCount(int count) {
@@ -1268,7 +1271,7 @@
} }
public final int getStingerCount() { public final int getStingerCount() {
@@ -1991,7 +_,7 @@ @@ -1991,7 +2662,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
@Override @Override
protected void onBelowWorld() { protected void onBelowWorld() {
@@ -1277,15 +1280,14 @@
} }
protected void updateSwingTime() { 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) { public void setItemSlot(EquipmentSlot slot, ItemStack stack) {
- this.onEquipItem(slot, this.equipment.set(slot, stack), stack); - this.onEquipItem(slot, this.equipment.set(slot, stack), stack);
- }
+ // Paper start + // Paper start
+ this.setItemSlot(slot, stack, false); + this.setItemSlot(slot, stack, false);
+ } }
+ // CraftBukkit start + // CraftBukkit start
+ public void setItemSlot(EquipmentSlot slot, ItemStack stack, boolean silent) { + public void setItemSlot(EquipmentSlot slot, ItemStack stack, boolean silent) {
+ // Paper end + // Paper end
@@ -1295,7 +1297,7 @@
public float getArmorCoverPercentage() { public float getArmorCoverPercentage() {
int i = 0; 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; 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)); 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() { public void stopFallFlying() {
@@ -1334,7 +1336,7 @@
} }
private Vec3 updateFallFlyingMovement(Vec3 deltaMovement) { private Vec3 updateFallFlyingMovement(Vec3 deltaMovement) {
@@ -2454,7 +_,7 @@ @@ -2454,7 +3147,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
} }
protected float getFlyingSpeed() { protected float getFlyingSpeed() {
@@ -1343,7 +1345,7 @@
} }
public float getSpeed() { public float getSpeed() {
@@ -2538,37 +_,15 @@ @@ -2538,37 +3231,15 @@ public abstract class LivingEntity extends Entity implements Attackable {
profilerFiller.pop(); profilerFiller.pop();
profilerFiller.push("rangeChecks"); profilerFiller.push("rangeChecks");
@@ -1362,15 +1364,19 @@
- while (this.yBodyRot - this.yBodyRotO >= 180.0F) { - while (this.yBodyRot - this.yBodyRotO >= 180.0F) {
- this.yBodyRotO += 360.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) { - while (this.getXRot() - this.xRotO < -180.0F) {
- this.xRotO -= 360.0F; - this.xRotO -= 360.0F;
- } - }
- + this.yBodyRotO += Math.round((this.yBodyRot - this.yBodyRotO) / 360.0F) * 360.0F;
- while (this.getXRot() - this.xRotO >= 180.0F) { - while (this.getXRot() - this.xRotO >= 180.0F) {
- this.xRotO += 360.0F; - this.xRotO += 360.0F;
- } - }
- + this.xRotO += Math.round((this.getXRot() - this.xRotO) / 360.0F) * 360.0F;
- while (this.yHeadRot - this.yHeadRotO < -180.0F) { - while (this.yHeadRot - this.yHeadRotO < -180.0F) {
- this.yHeadRotO -= 360.0F; - this.yHeadRotO -= 360.0F;
- } - }
@@ -1378,19 +1384,12 @@
- while (this.yHeadRot - this.yHeadRotO >= 180.0F) { - while (this.yHeadRot - this.yHeadRotO >= 180.0F) {
- this.yHeadRotO += 360.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; + this.yHeadRotO += Math.round((this.yHeadRot - this.yHeadRotO) / 360.0F) * 360.0F;
+ // Paper end - stop large pitch and yaw changes from crashing the server + // Paper end - stop large pitch and yaw changes from crashing the server
profilerFiller.pop(); profilerFiller.pop();
if (this.isFallFlying()) { if (this.isFallFlying()) {
@@ -2598,16 +_,39 @@ @@ -2598,16 +3269,39 @@ public abstract class LivingEntity extends Entity implements Attackable {
@Nullable @Nullable
private Map<EquipmentSlot, ItemStack> collectEquipmentChanges() { private Map<EquipmentSlot, ItemStack> collectEquipmentChanges() {
Map<EquipmentSlot, ItemStack> map = null; Map<EquipmentSlot, ItemStack> map = null;
@@ -1430,7 +1429,7 @@
AttributeMap attributes = this.getAttributes(); AttributeMap attributes = this.getAttributes();
if (!itemStack.isEmpty()) { if (!itemStack.isEmpty()) {
this.stopLocationBasedEffects(itemStack, equipmentSlot, attributes); 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; return map;
@@ -2663,7 +_,7 @@ @@ -2663,7 +3359,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
list.add(Pair.of(equipmentSlot, itemStack1)); list.add(Pair.of(equipmentSlot, itemStack1));
this.lastEquipmentItems.put(equipmentSlot, itemStack1); this.lastEquipmentItems.put(equipmentSlot, itemStack1);
}); });
@@ -1448,7 +1447,7 @@
} }
protected void tickHeadTurn(float yBodyRot) { 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 (!flag || this.onGround() && !(fluidHeight > fluidJumpThreshold)) {
if (!this.isInLava() || this.onGround() && !(fluidHeight > fluidJumpThreshold)) { if (!this.isInLava() || this.onGround() && !(fluidHeight > fluidJumpThreshold)) {
if ((this.onGround() || flag && fluidHeight <= fluidJumpThreshold) && this.noJumpDelay == 0) { if ((this.onGround() || flag && fluidHeight <= fluidJumpThreshold) && this.noJumpDelay == 0) {
@@ -1459,7 +1458,7 @@
} }
} else { } else {
this.jumpInLiquid(FluidTags.LAVA); this.jumpInLiquid(FluidTags.LAVA);
@@ -2791,7 +_,7 @@ @@ -2791,7 +3489,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
profilerFiller.pop(); profilerFiller.pop();
if (this.level() instanceof ServerLevel serverLevel) { if (this.level() instanceof ServerLevel serverLevel) {
profilerFiller.push("freezing"); profilerFiller.push("freezing");
@@ -1468,7 +1467,7 @@
this.setTicksFrozen(Math.max(0, this.getTicksFrozen() - 2)); 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(); this.pushEntities();
profilerFiller.pop(); profilerFiller.pop();
@@ -1489,7 +1488,7 @@
if (this.level() instanceof ServerLevel serverLevel && this.isSensitiveToWater() && this.isInWaterOrRain()) { if (this.level() instanceof ServerLevel serverLevel && this.isSensitiveToWater() && this.isInWaterOrRain()) {
this.hurtServer(serverLevel, this.damageSources().drown(), 1.0F); 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(); this.checkSlowFallDistance();
if (!this.level().isClientSide) { if (!this.level().isClientSide) {
if (!this.canGlide()) { if (!this.canGlide()) {
@@ -1497,7 +1496,7 @@
this.setSharedFlag(7, false); this.setSharedFlag(7, false);
return; return;
} }
@@ -2869,10 +_,25 @@ @@ -2869,10 +3582,25 @@ public abstract class LivingEntity extends Entity implements Attackable {
} }
protected void pushEntities() { protected void pushEntities() {
@@ -1524,7 +1523,7 @@
if (_int > 0 && pushableEntities.size() > _int - 1 && this.random.nextInt(4) == 0) { if (_int > 0 && pushableEntities.size() > _int - 1 && this.random.nextInt(4) == 0) {
int i = 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); this.doPush(entity1);
} }
} }
@@ -2930,9 +_,16 @@ @@ -2930,9 +3667,16 @@ public abstract class LivingEntity extends Entity implements Attackable {
@Override @Override
public void stopRiding() { public void stopRiding() {
@@ -1560,7 +1559,7 @@
this.dismountVehicle(vehicle); this.dismountVehicle(vehicle);
} }
} }
@@ -2959,7 +_,7 @@ @@ -2959,7 +3703,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
} }
public void onItemPickup(ItemEntity itemEntity) { public void onItemPickup(ItemEntity itemEntity) {
@@ -1569,7 +1568,7 @@
if (owner instanceof ServerPlayer) { if (owner instanceof ServerPlayer) {
CriteriaTriggers.THROWN_ITEM_PICKED_UP_BY_ENTITY.trigger((ServerPlayer)owner, itemEntity.getItem(), this); 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() if (!entity.isRemoved()
&& !this.level().isClientSide && !this.level().isClientSide
&& (entity instanceof ItemEntity || entity instanceof AbstractArrow || entity instanceof ExperienceOrb)) { && (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 { } else {
Vec3 vec3 = new Vec3(this.getX(), this.getEyeY(), this.getZ()); Vec3 vec3 = new Vec3(this.getX(), this.getEyeY(), this.getZ());
Vec3 vec31 = new Vec3(entity.getX(), y, entity.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 @Override
public boolean isPickable() { public boolean isPickable() {
@@ -1600,10 +1599,9 @@
@Override @Override
public boolean isPushable() { public boolean isPushable() {
- return this.isAlive() && !this.isSpectator() && !this.onClimbable(); - return this.isAlive() && !this.isSpectator() && !this.onClimbable();
- }
+ return this.isCollidable(this.level().paperConfig().collisions.fixClimbingBypassingCrammingRule); + return this.isCollidable(this.level().paperConfig().collisions.fixClimbingBypassingCrammingRule);
+ } }
+
+ @Override + @Override
+ public boolean isCollidable(boolean ignoreClimbing) { + public boolean isCollidable(boolean ignoreClimbing) {
+ return this.isAlive() && !this.isSpectator() && (ignoreClimbing || !this.onClimbable()) && this.collides; // CraftBukkit + 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()); + return this.isPushable() && this.collides != this.collidableExemptions.contains(entity.getUUID());
+ } + }
+ // CraftBukkit end + // CraftBukkit end
+
@Override @Override
public float getYHeadRot() { 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) { public final void setAbsorptionAmount(float absorptionAmount) {
@@ -1628,7 +1627,7 @@
} }
protected void internalSetAbsorptionAmount(float absorptionAmount) { 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; return (this.entityData.get(DATA_LIVING_ENTITY_FLAGS) & 2) > 0 ? InteractionHand.OFF_HAND : InteractionHand.MAIN_HAND;
} }
@@ -1644,7 +1643,7 @@
private void updatingUsingItem() { private void updatingUsingItem() {
if (this.isUsingItem()) { if (this.isUsingItem()) {
if (ItemStack.isSameItem(this.getItemInHand(this.getUsedItemHand()), this.useItem)) { 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; return null;
} else { } else {
double d = this.getEyeY() - 0.3F; double d = this.getEyeY() - 0.3F;
@@ -1656,7 +1655,7 @@
ItemEntity itemEntity = new ItemEntity(this.level(), this.getX(), d, this.getZ(), stack); ItemEntity itemEntity = new ItemEntity(this.level(), this.getX(), d, this.getZ(), stack);
itemEntity.setPickUpDelay(40); itemEntity.setPickUpDelay(40);
if (includeThrower) { if (includeThrower) {
@@ -3115,7 +_,12 @@ @@ -3115,7 +3888,12 @@ public abstract class LivingEntity extends Entity implements Attackable {
protected void updateUsingItem(ItemStack usingItem) { protected void updateUsingItem(ItemStack usingItem) {
usingItem.onUseTick(this.level(), this, this.getUseItemRemainingTicks()); usingItem.onUseTick(this.level(), this, this.getUseItemRemainingTicks());
@@ -1670,7 +1669,7 @@
this.completeUsingItem(); this.completeUsingItem();
} }
} }
@@ -3141,10 +_,19 @@ @@ -3141,10 +3919,19 @@ public abstract class LivingEntity extends Entity implements Attackable {
} }
public void startUsingItem(InteractionHand hand) { public void startUsingItem(InteractionHand hand) {
@@ -1692,7 +1691,7 @@
if (!this.level().isClientSide) { if (!this.level().isClientSide) {
this.setLivingEntityFlag(1, true); this.setLivingEntityFlag(1, true);
this.setLivingEntityFlag(2, hand == InteractionHand.OFF_HAND); 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()) { } else if (!this.isUsingItem() && !this.useItem.isEmpty()) {
this.useItem = ItemStack.EMPTY; 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(); this.releaseUsingItem();
} else { } else {
if (!this.useItem.isEmpty() && this.isUsingItem()) { 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()); ItemStack itemInHand = this.getItemInHand(this.getUsedItemHand());
if (!this.useItem.isEmpty() && ItemStack.isSameItem(itemInHand, this.useItem)) { if (!this.useItem.isEmpty() && ItemStack.isSameItem(itemInHand, this.useItem)) {
this.useItem = itemInHand; this.useItem = itemInHand;
@@ -1763,7 +1762,7 @@
this.useItem.releaseUsing(this.level(), this, this.getUseItemRemainingTicks()); this.useItem.releaseUsing(this.level(), this, this.getUseItemRemainingTicks());
if (this.useItem.useOnRelease()) { if (this.useItem.useOnRelease()) {
this.updatingUsingItem(); this.updatingUsingItem();
@@ -3256,7 +_,10 @@ @@ -3256,7 +4084,10 @@ public abstract class LivingEntity extends Entity implements Attackable {
} }
this.useItem = ItemStack.EMPTY; this.useItem = ItemStack.EMPTY;
@@ -1775,7 +1774,7 @@
} }
public boolean isBlocking() { 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() { public boolean isSuppressingSlidingDownLadder() {
return this.isShiftKeyDown(); 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) { public boolean randomTeleport(double x, double y, double z, boolean broadcastTeleport) {
@@ -1849,7 +1848,7 @@
double x1 = this.getX(); double x1 = this.getX();
double y1 = this.getY(); double y1 = this.getY();
double z1 = this.getZ(); double z1 = this.getZ();
@@ -3320,16 +_,39 @@ @@ -3320,16 +4211,39 @@ public abstract class LivingEntity extends Entity implements Attackable {
} }
if (flag1) { if (flag1) {
@@ -1892,7 +1891,7 @@
} else { } else {
if (broadcastTeleport) { if (broadcastTeleport) {
level.broadcastEntityEvent(this, (byte)46); level.broadcastEntityEvent(this, (byte)46);
@@ -3339,7 +_,7 @@ @@ -3339,7 +4253,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
pathfinderMob.getNavigation().stop(); 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 --- a/net/minecraft/world/entity/Mob.java
+++ b/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.phys.AABB;
import net.minecraft.world.ticks.ContainerSingleItem; import net.minecraft.world.ticks.ContainerSingleItem;
@@ -15,7 +23,7 @@
public abstract class Mob extends LivingEntity implements EquipmentUser, Leashable, Targeting { 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 EntityDataAccessor<Byte> DATA_MOB_FLAGS_ID = SynchedEntityData.defineId(Mob.class, EntityDataSerializers.BYTE);
private static final int MOB_FLAG_NO_AI = 1; 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; private final BodyRotationControl bodyRotationControl;
protected PathNavigation navigation; protected PathNavigation navigation;
public GoalSelector goalSelector; public GoalSelector goalSelector;
@@ -23,7 +31,7 @@
public GoalSelector targetSelector; public GoalSelector targetSelector;
@Nullable @Nullable
private LivingEntity target; private LivingEntity target;
@@ -126,6 +_,7 @@ @@ -126,6 +135,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
private Leashable.LeashData leashData; private Leashable.LeashData leashData;
private BlockPos restrictCenter = BlockPos.ZERO; private BlockPos restrictCenter = BlockPos.ZERO;
private float restrictRadius = -1.0F; private float restrictRadius = -1.0F;
@@ -31,7 +39,7 @@
protected Mob(EntityType<? extends Mob> entityType, Level level) { protected Mob(EntityType<? extends Mob> entityType, Level level) {
super(entityType, 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() { 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) { public void setTarget(@Nullable LivingEntity target) {
@@ -84,7 +92,7 @@
} }
@Override @Override
@@ -358,13 +_,22 @@ @@ -358,13 +406,22 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
if (this.isNoAi()) { if (this.isNoAi()) {
compound.putBoolean("NoAI", this.isNoAi()); compound.putBoolean("NoAI", this.isNoAi());
} }
@@ -109,7 +117,7 @@
RegistryOps<Tag> registryOps = this.registryAccess().createSerializationContext(NbtOps.INSTANCE); RegistryOps<Tag> registryOps = this.registryAccess().createSerializationContext(NbtOps.INSTANCE);
this.dropChances = compound.read("drop_chances", DropChances.CODEC, registryOps).orElse(DropChances.DEFAULT); this.dropChances = compound.read("drop_chances", DropChances.CODEC, registryOps).orElse(DropChances.DEFAULT);
this.readLeashData(compound); 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.lootTable = compound.read("DeathLootTable", LootTable.KEY_CODEC);
this.lootTableSeed = compound.getLongOr("DeathLootTableSeed", 0L); this.lootTableSeed = compound.getLongOr("DeathLootTableSeed", 0L);
this.setNoAi(compound.getBooleanOr("NoAI", false)); this.setNoAi(compound.getBooleanOr("NoAI", false));
@@ -117,7 +125,7 @@
} }
@Override @Override
@@ -433,6 +_,11 @@ @@ -433,6 +491,11 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
&& !itemEntity.getItem().isEmpty() && !itemEntity.getItem().isEmpty()
&& !itemEntity.hasPickUpDelay() && !itemEntity.hasPickUpDelay()
&& this.wantsToPickUp(serverLevel, itemEntity.getItem())) { && this.wantsToPickUp(serverLevel, itemEntity.getItem())) {
@@ -129,7 +137,7 @@
this.pickUpItem(serverLevel, itemEntity); 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) { protected void pickUpItem(ServerLevel level, ItemEntity entity) {
ItemStack item = entity.getItem(); ItemStack item = entity.getItem();
@@ -156,7 +164,7 @@
EquipmentSlot equipmentSlotForItem = this.getEquipmentSlotForItem(stack); EquipmentSlot equipmentSlotForItem = this.getEquipmentSlotForItem(stack);
if (!this.isEquippableInSlot(stack, equipmentSlotForItem)) { if (!this.isEquippableInSlot(stack, equipmentSlotForItem)) {
return ItemStack.EMPTY; return ItemStack.EMPTY;
@@ -471,10 +_,18 @@ @@ -471,10 +540,18 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
canReplaceCurrentItem = itemBySlot.isEmpty(); canReplaceCurrentItem = itemBySlot.isEmpty();
} }
@@ -176,7 +184,7 @@
} }
ItemStack itemStack = equipmentSlotForItem.limit(stack); ItemStack itemStack = equipmentSlotForItem.limit(stack);
@@ -591,22 +_,29 @@ @@ -591,22 +668,29 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
@Override @Override
public void checkDespawn() { public void checkDespawn() {
if (this.level().getDifficulty() == Difficulty.PEACEFUL && this.shouldDespawnInPeaceful()) { if (this.level().getDifficulty() == Difficulty.PEACEFUL && this.shouldDespawnInPeaceful()) {
@@ -192,6 +200,12 @@
- if (d > i && this.removeWhenFarAway(d)) { - if (d > i && this.removeWhenFarAway(d)) {
- this.discard(); - 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 + // 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.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; + 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)) { + if (despawnRangePair.hard().shouldDespawn(shape, dxSqr, dySqr, dzSqr, dy) && this.removeWhenFarAway(distanceSquared)) {
+ this.discard(EntityRemoveEvent.Cause.DESPAWN); // CraftBukkit - add Bukkit remove cause + 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 (despawnRangePair.soft().shouldDespawn(shape, dxSqr, dySqr, dzSqr, dy)) {
+ if (this.noActionTime > 600 && this.random.nextInt(800) == 0 && this.removeWhenFarAway(distanceSquared)) { + if (this.noActionTime > 600 && this.random.nextInt(800) == 0 && this.removeWhenFarAway(distanceSquared)) {
+ this.discard(EntityRemoveEvent.Cause.DESPAWN); // CraftBukkit - add Bukkit remove cause + this.discard(EntityRemoveEvent.Cause.DESPAWN); // CraftBukkit - add Bukkit remove cause
@@ -219,7 +228,7 @@
this.noActionTime = 0; this.noActionTime = 0;
} }
} }
@@ -618,6 +_,15 @@ @@ -618,6 +702,15 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
@Override @Override
protected final void serverAiStep() { protected final void serverAiStep() {
this.noActionTime++; this.noActionTime++;
@@ -235,7 +244,7 @@
ProfilerFiller profilerFiller = Profiler.get(); ProfilerFiller profilerFiller = Profiler.get();
profilerFiller.push("sensing"); profilerFiller.push("sensing");
this.sensing.tick(); this.sensing.tick();
@@ -793,14 +_,69 @@ @@ -793,14 +886,69 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
public boolean stillValid(Player player) { public boolean stillValid(Player player) {
return player.getVehicle() == Mob.this || player.canInteractWithEntity(Mob.this, 4.0); return player.getVehicle() == Mob.this || player.canInteractWithEntity(Mob.this, 4.0);
} }
@@ -305,7 +314,7 @@
ItemStack itemBySlot = this.getItemBySlot(equipmentSlot); ItemStack itemBySlot = this.getItemBySlot(equipmentSlot);
float f = this.dropChances.byEquipment(equipmentSlot); float f = this.dropChances.byEquipment(equipmentSlot);
if (f != 0.0F) { if (f != 0.0F) {
@@ -820,7 +_,13 @@ @@ -820,7 +968,13 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
} }
this.spawnAtLocation(level, itemBySlot); 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); set.add(equipmentSlot);
} else if (this.dropChances.isPreserved(equipmentSlot)) { } else if (this.dropChances.isPreserved(equipmentSlot)) {
this.setItemSlot(equipmentSlot, ItemStack.EMPTY); 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( public <T extends Mob> T convertTo(
EntityType<T> entityType, ConversionParams conversionParams, EntitySpawnReason spawnReason, ConversionParams.AfterConversion<T> afterConversion EntityType<T> entityType, ConversionParams conversionParams, EntitySpawnReason spawnReason, ConversionParams.AfterConversion<T> afterConversion
) { ) {
@@ -351,7 +360,7 @@
if (this.isRemoved()) { if (this.isRemoved()) {
return null; return null;
} else { } else {
@@ -1130,13 +_,23 @@ @@ -1130,13 +1301,23 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
return null; return null;
} else { } else {
conversionParams.type().convert(this, mob, conversionParams); conversionParams.type().convert(this, mob, conversionParams);
@@ -378,7 +387,7 @@
} }
return mob; return mob;
@@ -1146,7 +_,18 @@ @@ -1146,7 +1327,18 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
@Nullable @Nullable
public <T extends Mob> T convertTo(EntityType<T> entityType, ConversionParams coversionParams, ConversionParams.AfterConversion<T> afterConversion) { public <T extends Mob> T convertTo(EntityType<T> entityType, ConversionParams coversionParams, ConversionParams.AfterConversion<T> afterConversion) {
@@ -398,7 +407,7 @@
} }
@Nullable @Nullable
@@ -1182,7 +_,17 @@ @@ -1182,7 +1374,17 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
public boolean startRiding(Entity entity, boolean force) { public boolean startRiding(Entity entity, boolean force) {
boolean flag = super.startRiding(entity, force); boolean flag = super.startRiding(entity, force);
if (flag && this.isLeashed()) { if (flag && this.isLeashed()) {
@@ -417,7 +426,7 @@
} }
return flag; return flag;
@@ -1270,7 +_,7 @@ @@ -1270,7 +1472,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
float knockback = this.getKnockback(source, damageSource); float knockback = this.getKnockback(source, damageSource);
if (knockback > 0.0F && source instanceof LivingEntity livingEntity) { if (knockback > 0.0F && source instanceof LivingEntity livingEntity) {
livingEntity.knockback( 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 --- a/net/minecraft/world/entity/TamableAnimal.java
+++ b/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); this.orderedToSit = compound.getBooleanOr("Sitting", false);
@@ -9,7 +17,7 @@
} }
@Override @Override
@@ -88,8 +_,16 @@ @@ -88,8 +88,16 @@ public abstract class TamableAnimal extends Animal implements OwnableEntity {
@Override @Override
public boolean handleLeashAtDistance(Entity leashHolder, float distance) { public boolean handleLeashAtDistance(Entity leashHolder, float distance) {
if (this.isInSittingPose()) { if (this.isInSittingPose()) {
@@ -28,7 +36,7 @@
} }
return false; return false;
@@ -148,6 +_,13 @@ @@ -148,6 +156,13 @@ public abstract class TamableAnimal extends Animal implements OwnableEntity {
} }
public void setInSittingPose(boolean sitting) { public void setInSittingPose(boolean sitting) {
@@ -42,7 +50,7 @@
byte b = this.entityData.get(DATA_FLAGS_ID); byte b = this.entityData.get(DATA_FLAGS_ID);
if (sitting) { if (sitting) {
this.entityData.set(DATA_FLAGS_ID, (byte)(b | 1)); 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 if (this.level() instanceof ServerLevel serverLevel
&& serverLevel.getGameRules().getBoolean(GameRules.RULE_SHOWDEATHMESSAGES) && serverLevel.getGameRules().getBoolean(GameRules.RULE_SHOWDEATHMESSAGES)
&& this.getOwner() instanceof ServerPlayer serverPlayer) { && this.getOwner() instanceof ServerPlayer serverPlayer) {
@@ -56,7 +64,7 @@
} }
super.die(cause); 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))) { if (!this.canTeleportTo(new BlockPos(x, y, z))) {
return false; return false;
} else { } 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 --- a/net/minecraft/world/entity/ai/behavior/BabyFollowAdult.java
+++ b/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()) { if (!mob.isBaby()) {
return false; return false;
} else { } 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 --- a/net/minecraft/world/entity/animal/Animal.java
+++ b/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; public int inLove = 0;
@Nullable @Nullable
public UUID loveCause; public UUID loveCause;
@@ -8,7 +16,7 @@
protected Animal(EntityType<? extends Animal> entityType, Level level) { protected Animal(EntityType<? extends Animal> entityType, Level level) {
super(entityType, level); super(entityType, level);
@@ -80,9 +_,13 @@ @@ -80,9 +81,13 @@ public abstract class Animal extends AgeableMob {
} }
@Override @Override
@@ -24,7 +32,7 @@
} }
@Override @Override
@@ -138,8 +_,9 @@ @@ -138,8 +143,9 @@ public abstract class Animal extends AgeableMob {
if (this.isFood(itemInHand)) { if (this.isFood(itemInHand)) {
int age = this.getAge(); int age = this.getAge();
if (!this.level().isClientSide && age == 0 && this.canFallInLove()) { if (!this.level().isClientSide && age == 0 && this.canFallInLove()) {
@@ -35,7 +43,7 @@
this.playEatingSound(); this.playEatingSound();
return InteractionResult.SUCCESS_SERVER; return InteractionResult.SUCCESS_SERVER;
} }
@@ -176,8 +_,23 @@ @@ -176,8 +182,23 @@ public abstract class Animal extends AgeableMob {
return this.inLove <= 0; return this.inLove <= 0;
} }
@@ -60,7 +68,7 @@
if (player != null) { if (player != null) {
this.loveCause = player.getUUID(); this.loveCause = player.getUUID();
} }
@@ -220,23 +_,45 @@ @@ -220,23 +241,45 @@ public abstract class Animal extends AgeableMob {
if (breedOffspring != null) { if (breedOffspring != null) {
breedOffspring.setBaby(true); breedOffspring.setBaby(true);
breedOffspring.snapTo(this.getX(), this.getY(), this.getZ(), 0.0F, 0.0F); 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 --- a/net/minecraft/world/entity/animal/Bee.java
+++ b/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; Bee.BeeGoToHiveGoal goToHiveGoal;
private Bee.BeeGoToKnownFlowerGoal goToKnownFlowerGoal; private Bee.BeeGoToKnownFlowerGoal goToKnownFlowerGoal;
private int underWaterTicks; private int underWaterTicks;
@@ -28,7 +36,7 @@
this.lookControl = new Bee.BeeLookControl(this); this.lookControl = new Bee.BeeLookControl(this);
this.setPathfindingMalus(PathType.DANGER_FIRE, -1.0F); this.setPathfindingMalus(PathType.DANGER_FIRE, -1.0F);
this.setPathfindingMalus(PathType.WATER, -1.0F); this.setPathfindingMalus(PathType.WATER, -1.0F);
@@ -195,9 +_,18 @@ @@ -195,9 +211,18 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
@Override @Override
public void addAdditionalSaveData(CompoundTag compound) { public void addAdditionalSaveData(CompoundTag compound) {
@@ -47,7 +55,7 @@
compound.putBoolean("HasNectar", this.hasNectar()); compound.putBoolean("HasNectar", this.hasNectar());
compound.putBoolean("HasStung", this.hasStung()); compound.putBoolean("HasStung", this.hasStung());
compound.putInt("TicksSincePollination", this.ticksWithoutNectarSinceExitingHive); compound.putInt("TicksSincePollination", this.ticksWithoutNectarSinceExitingHive);
@@ -235,7 +_,7 @@ @@ -235,7 +260,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
} }
if (i > 0) { 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) { if (this.hivePos == null) {
return null; return null;
} else { } 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) { public void setRolling(boolean isRolling) {
@@ -77,7 +85,7 @@
this.setFlag(2, isRolling); this.setFlag(2, isRolling);
} }
@@ -579,7 +_,7 @@ @@ -579,7 +609,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
if (beeInteractionEffect != null) { if (beeInteractionEffect != null) {
this.usePlayerItem(player, hand, itemInHand); this.usePlayerItem(player, hand, itemInHand);
if (!this.level().isClientSide) { if (!this.level().isClientSide) {
@@ -86,7 +94,7 @@
} }
return InteractionResult.SUCCESS; return InteractionResult.SUCCESS;
@@ -648,8 +_,9 @@ @@ -648,8 +678,9 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
if (this.isInvulnerableTo(level, damageSource)) { if (this.isInvulnerableTo(level, damageSource)) {
return false; return false;
} else { } else {
@@ -97,7 +105,7 @@
} }
} }
@@ -770,7 +_,7 @@ @@ -770,7 +801,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
@VisibleForDebug @VisibleForDebug
public class BeeGoToHiveGoal extends Bee.BaseBeeGoal { public class BeeGoToHiveGoal extends Bee.BaseBeeGoal {
public static final int MAX_TRAVELLING_TICKS = 2400; public static final int MAX_TRAVELLING_TICKS = 2400;
@@ -106,7 +114,7 @@
private static final int MAX_BLACKLISTED_TARGETS = 3; private static final int MAX_BLACKLISTED_TARGETS = 3;
final List<BlockPos> blacklistedTargets = Lists.newArrayList(); final List<BlockPos> blacklistedTargets = Lists.newArrayList();
@Nullable @Nullable
@@ -886,7 +_,7 @@ @@ -886,7 +917,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
public class BeeGoToKnownFlowerGoal extends Bee.BaseBeeGoal { public class BeeGoToKnownFlowerGoal extends Bee.BaseBeeGoal {
private static final int MAX_TRAVELLING_TICKS = 2400; private static final int MAX_TRAVELLING_TICKS = 2400;
@@ -115,7 +123,7 @@
BeeGoToKnownFlowerGoal() { BeeGoToKnownFlowerGoal() {
this.setFlags(EnumSet.of(Goal.Flag.MOVE)); 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().levelEvent(2011, blockPos, 15);
Bee.this.level().setBlockAndUpdate(blockPos, blockState1); Bee.this.level().setBlockAndUpdate(blockPos, blockState1);
Bee.this.incrementNumCropsGrownSincePollination(); Bee.this.incrementNumCropsGrownSincePollination();
@@ -1007,7 +_,7 @@ @@ -1007,7 +1038,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
@Override @Override
protected void alertOther(Mob mob, LivingEntity target) { protected void alertOther(Mob mob, LivingEntity target) {
if (mob instanceof Bee && this.mob.hasLineOfSight(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(); Bee.this.dropFlower();
this.pollinating = false; this.pollinating = false;
Bee.this.remainingCooldownBeforeLocatingNewFlower = 200; 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 --- a/net/minecraft/world/entity/animal/Fox.java
+++ b/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); compound.read("Trusted", TRUSTED_LIST_CODEC).orElse(List.of()).forEach(this::addTrustedEntity);
this.setSleeping(compound.getBooleanOr("Sleeping", false)); this.setSleeping(compound.getBooleanOr("Sleeping", false));
this.setVariant(compound.read("Type", Fox.Variant.CODEC).orElse(Fox.Variant.DEFAULT)); this.setVariant(compound.read("Type", Fox.Variant.CODEC).orElse(Fox.Variant.DEFAULT));
@@ -9,7 +17,7 @@
this.setIsCrouching(compound.getBooleanOr("Crouching", false)); this.setIsCrouching(compound.getBooleanOr("Crouching", false));
if (this.level() instanceof ServerLevel) { if (this.level() instanceof ServerLevel) {
this.setTargetGoals(); this.setTargetGoals();
@@ -446,6 +_,12 @@ @@ -446,6 +446,12 @@ public class Fox extends Animal {
} }
public void setSitting(boolean sitting) { public void setSitting(boolean sitting) {
@@ -22,7 +30,7 @@
this.setFlag(1, sitting); this.setFlag(1, sitting);
} }
@@ -505,19 +_,20 @@ @@ -505,19 +511,20 @@ public class Fox extends Animal {
itemEntity.setPickUpDelay(40); itemEntity.setPickUpDelay(40);
itemEntity.setThrower(this); itemEntity.setThrower(this);
this.playSound(SoundEvents.FOX_SPIT, 1.0F, 1.0F); this.playSound(SoundEvents.FOX_SPIT, 1.0F, 1.0F);
@@ -46,7 +54,7 @@
int count = item.getCount(); int count = item.getCount();
if (count > 1) { if (count > 1) {
this.dropItemStack(item.split(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.setItemSlot(EquipmentSlot.MAINHAND, item.split(1));
this.setGuaranteedDrop(EquipmentSlot.MAINHAND); this.setGuaranteedDrop(EquipmentSlot.MAINHAND);
this.take(entity, item.getCount()); this.take(entity, item.getCount());
@@ -55,7 +63,7 @@
this.ticksSinceEaten = 0; this.ticksSinceEaten = 0;
} }
} }
@@ -623,12 +_,12 @@ @@ -623,12 +630,12 @@ public class Fox extends Animal {
} }
@Override @Override
@@ -70,12 +78,10 @@
} }
void wakeUp() { void wakeUp() {
@@ -692,15 +_,33 @@ @@ -692,15 +699,33 @@ public class Fox extends Animal {
return this.getTrustedEntities().anyMatch(entityReference -> entityReference.matches(entity)); 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 + // Paper start - handle the bitten item separately like vanilla
+ @Override + @Override
+ protected boolean shouldSkipLoot(EquipmentSlot slot) { + protected boolean shouldSkipLoot(EquipmentSlot slot) {
@@ -83,7 +89,8 @@
+ } + }
+ // Paper end + // Paper end
+ +
+ @Override @Override
- protected void dropAllDeathLoot(ServerLevel level, DamageSource damageSource) {
+ // Paper start - Cancellable death event + // Paper start - Cancellable death event
+ protected org.bukkit.event.entity.EntityDeathEvent dropAllDeathLoot(ServerLevel level, DamageSource damageSource) { + protected org.bukkit.event.entity.EntityDeathEvent dropAllDeathLoot(ServerLevel level, DamageSource damageSource) {
ItemStack itemBySlot = this.getItemBySlot(EquipmentSlot.MAINHAND); ItemStack itemBySlot = this.getItemBySlot(EquipmentSlot.MAINHAND);
@@ -108,7 +115,7 @@
} }
public static boolean isPathClear(Fox fox, LivingEntity livingEntity) { public static boolean isPathClear(Fox fox, LivingEntity livingEntity) {
@@ -876,6 +_,19 @@ @@ -876,6 +901,19 @@ public class Fox extends Animal {
fox.addTrustedEntity(loveCause1); fox.addTrustedEntity(loveCause1);
} }
@@ -128,7 +135,7 @@
if (serverPlayer != null) { if (serverPlayer != null) {
serverPlayer.awardStat(Stats.ANIMALS_BRED); serverPlayer.awardStat(Stats.ANIMALS_BRED);
CriteriaTriggers.BRED_ANIMALS.trigger(serverPlayer, this.animal, this.partner, fox); 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.partner.setAge(6000);
this.animal.resetLove(); this.animal.resetLove();
this.partner.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) { private void pickSweetBerries(BlockState state) {
int ageValue = state.getValue(SweetBerryBushBlock.AGE); int ageValue = state.getValue(SweetBerryBushBlock.AGE);
state.setValue(SweetBerryBushBlock.AGE, 1); 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 --- a/net/minecraft/world/entity/animal/ShoulderRidingEntity.java
+++ b/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()); compoundTag.putString("id", this.getEncodeId());
this.saveWithoutId(compoundTag); this.saveWithoutId(compoundTag);
if (player.setEntityOnShoulder(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 --- a/net/minecraft/world/entity/animal/allay/Allay.java
+++ b/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 dancingAnimationTicks;
private float spinningAnimationTicks; private float spinningAnimationTicks;
private float spinningAnimationTicks0; private float spinningAnimationTicks0;
@@ -8,7 +16,7 @@
public Allay(EntityType<? extends Allay> entityType, Level level) { public Allay(EntityType<? extends Allay> entityType, Level level) {
super(entityType, level); super(entityType, level);
@@ -129,6 +_,12 @@ @@ -129,6 +130,12 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS
); );
} }
@@ -21,7 +29,7 @@
@Override @Override
protected Brain.Provider<Allay> brainProvider() { protected Brain.Provider<Allay> brainProvider() {
return Brain.provider(MEMORY_TYPES, SENSOR_TYPES); 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() { public void aiStep() {
super.aiStep(); super.aiStep();
if (!this.level().isClientSide && this.isAlive() && this.tickCount % 10 == 0) { if (!this.level().isClientSide && this.isAlive() && this.tickCount % 10 == 0) {
@@ -30,7 +38,7 @@
} }
if (this.isDancing() && this.shouldStopDancing() && this.tickCount % 20 == 0) { 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 itemInHand = player.getItemInHand(hand);
ItemStack itemInHand1 = this.getItemInHand(InteractionHand.MAIN_HAND); ItemStack itemInHand1 = this.getItemInHand(InteractionHand.MAIN_HAND);
if (this.isDancing() && itemInHand.is(ItemTags.DUPLICATES_ALLAYS) && this.canDuplicate()) { if (this.isDancing() && itemInHand.is(ItemTags.DUPLICATES_ALLAYS) && this.canDuplicate()) {
@@ -44,7 +52,7 @@
this.level().broadcastEntityEvent(this, (byte)18); this.level().broadcastEntityEvent(this, (byte)18);
this.level().playSound(player, this, SoundEvents.AMETHYST_BLOCK_CHIME, SoundSource.NEUTRAL, 2.0F, 1.0F); this.level().playSound(player, this, SoundEvents.AMETHYST_BLOCK_CHIME, SoundSource.NEUTRAL, 2.0F, 1.0F);
this.removeInteractionItem(player, itemInHand); this.removeInteractionItem(player, itemInHand);
@@ -421,6 +_,7 @@ @@ -421,6 +433,7 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS
} }
private boolean shouldStopDancing() { private boolean shouldStopDancing() {
@@ -52,7 +60,7 @@
return this.jukeboxPos == null return this.jukeboxPos == null
|| !this.jukeboxPos.closerToCenterThan(this.position(), GameEvent.JUKEBOX_PLAY.value().notificationRadius()) || !this.jukeboxPos.closerToCenterThan(this.position(), GameEvent.JUKEBOX_PLAY.value().notificationRadius())
|| !this.level().getBlockState(this.jukeboxPos).is(Blocks.JUKEBOX); || !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()); this.readInventoryFromTag(compound, this.registryAccess());
RegistryOps<Tag> registryOps = this.registryAccess().createSerializationContext(NbtOps.INSTANCE); RegistryOps<Tag> registryOps = this.registryAccess().createSerializationContext(NbtOps.INSTANCE);
this.vibrationData = compound.read("listener", VibrationSystem.Data.CODEC, registryOps).orElseGet(VibrationSystem.Data::new); this.vibrationData = compound.read("listener", VibrationSystem.Data.CODEC, registryOps).orElseGet(VibrationSystem.Data::new);
@@ -61,7 +69,7 @@
} }
@Override @Override
@@ -494,15 +_,17 @@ @@ -494,15 +507,17 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS
this.entityData.set(DATA_CAN_DUPLICATE, duplicationCooldown == 0L); 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 --- a/net/minecraft/world/entity/animal/frog/Tadpole.java
+++ b/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.BREED_TARGET,
MemoryModuleType.IS_PANICKING MemoryModuleType.IS_PANICKING
); );
@@ -8,7 +16,7 @@
public Tadpole(EntityType<? extends AbstractFish> entityType, Level level) { public Tadpole(EntityType<? extends AbstractFish> entityType, Level level) {
super(entityType, level); super(entityType, level);
@@ -114,7 +_,7 @@ @@ -114,7 +115,7 @@ public class Tadpole extends AbstractFish {
@Override @Override
public void aiStep() { public void aiStep() {
super.aiStep(); super.aiStep();
@@ -17,7 +25,7 @@
this.setAge(this.age + 1); this.setAge(this.age + 1);
} }
} }
@@ -123,12 +_,14 @@ @@ -123,12 +124,14 @@ public class Tadpole extends AbstractFish {
public void addAdditionalSaveData(CompoundTag compound) { public void addAdditionalSaveData(CompoundTag compound) {
super.addAdditionalSaveData(compound); super.addAdditionalSaveData(compound);
compound.putInt("Age", this.age); compound.putInt("Age", this.age);
@@ -32,7 +40,7 @@
} }
@Nullable @Nullable
@@ -178,13 +_,19 @@ @@ -178,13 +181,19 @@ public class Tadpole extends AbstractFish {
@Override @Override
public void saveToBucketTag(ItemStack stack) { public void saveToBucketTag(ItemStack stack) {
Bucketable.saveDefaultDataToBucketTag(this, stack); Bucketable.saveDefaultDataToBucketTag(this, stack);
@@ -53,7 +61,7 @@
} }
@Override @Override
@@ -216,6 +_,7 @@ @@ -216,6 +225,7 @@ public class Tadpole extends AbstractFish {
} }
private void ageUp(int offset) { private void ageUp(int offset) {
@@ -61,7 +69,7 @@
this.setAge(this.age + offset * 20); this.setAge(this.age + offset * 20);
} }
@@ -228,12 +_,17 @@ @@ -228,12 +238,17 @@ public class Tadpole extends AbstractFish {
private void ageUp() { private void ageUp() {
if (this.level() instanceof ServerLevel serverLevel) { 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 --- a/net/minecraft/world/entity/animal/horse/AbstractHorse.java
+++ b/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; protected int gallopSoundCounter;
@Nullable @Nullable
public EntityReference<LivingEntity> owner; public EntityReference<LivingEntity> owner;
@@ -8,7 +16,7 @@
protected AbstractHorse(EntityType<? extends AbstractHorse> entityType, Level level) { protected AbstractHorse(EntityType<? extends AbstractHorse> entityType, Level level) {
super(entityType, level); super(entityType, level);
@@ -250,7 +_,7 @@ @@ -250,7 +251,7 @@ public abstract class AbstractHorse extends Animal implements HasCustomInventory
} }
@Override @Override
@@ -17,7 +25,7 @@
return !this.isVehicle(); return !this.isVehicle();
} }
@@ -301,7 +_,7 @@ @@ -301,7 +302,7 @@ public abstract class AbstractHorse extends Animal implements HasCustomInventory
public void createInventory() { public void createInventory() {
SimpleContainer simpleContainer = this.inventory; SimpleContainer simpleContainer = this.inventory;
@@ -26,7 +34,7 @@
if (simpleContainer != null) { if (simpleContainer != null) {
int min = Math.min(simpleContainer.getContainerSize(), this.inventory.getContainerSize()); 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() { public int getMaxTemper() {
@@ -35,7 +43,7 @@
} }
@Override @Override
@@ -450,7 +_,7 @@ @@ -450,7 +451,7 @@ public abstract class AbstractHorse extends Animal implements HasCustomInventory
i1 = 5; i1 = 5;
if (!this.level().isClientSide && this.isTamed() && this.getAge() == 0 && !this.isInLove()) { if (!this.level().isClientSide && this.isTamed() && this.getAge() == 0 && !this.isInLove()) {
flag = true; flag = true;
@@ -44,7 +52,7 @@
} }
} else if (stack.is(Items.GOLDEN_APPLE) || stack.is(Items.ENCHANTED_GOLDEN_APPLE)) { } else if (stack.is(Items.GOLDEN_APPLE) || stack.is(Items.ENCHANTED_GOLDEN_APPLE)) {
f = 10.0F; f = 10.0F;
@@ -458,12 +_,12 @@ @@ -458,12 +459,12 @@ public abstract class AbstractHorse extends Animal implements HasCustomInventory
i1 = 10; i1 = 10;
if (!this.level().isClientSide && this.isTamed() && this.getAge() == 0 && !this.isInLove()) { if (!this.level().isClientSide && this.isTamed() && this.getAge() == 0 && !this.isInLove()) {
flag = true; flag = true;
@@ -59,7 +67,7 @@
flag = true; flag = true;
} }
@@ -534,7 +_,7 @@ @@ -534,7 +535,7 @@ public abstract class AbstractHorse extends Animal implements HasCustomInventory
super.aiStep(); super.aiStep();
if (this.level() instanceof ServerLevel serverLevel && this.isAlive()) { if (this.level() instanceof ServerLevel serverLevel && this.isAlive()) {
if (this.random.nextInt(900) == 0 && this.deathTime == 0) { if (this.random.nextInt(900) == 0 && this.deathTime == 0) {
@@ -68,7 +76,7 @@
} }
if (this.canEatGrass()) { if (this.canEatGrass()) {
@@ -637,6 +_,16 @@ @@ -637,6 +638,16 @@ public abstract class AbstractHorse extends Animal implements HasCustomInventory
} }
} }
@@ -85,7 +93,7 @@
@Override @Override
public InteractionResult mobInteract(Player player, InteractionHand hand) { public InteractionResult mobInteract(Player player, InteractionHand hand) {
if (this.isVehicle() || this.isBaby()) { if (this.isVehicle() || this.isBaby()) {
@@ -674,6 +_,12 @@ @@ -674,6 +685,12 @@ public abstract class AbstractHorse extends Animal implements HasCustomInventory
this.setFlag(16, eating); this.setFlag(16, eating);
} }
@@ -98,7 +106,7 @@
public void setStanding(boolean standing) { public void setStanding(boolean standing) {
if (standing) { if (standing) {
this.setEating(false); this.setEating(false);
@@ -785,6 +_,7 @@ @@ -785,6 +802,7 @@ public abstract class AbstractHorse extends Animal implements HasCustomInventory
if (this.owner != null) { if (this.owner != null) {
this.owner.store(compound, "Owner"); this.owner.store(compound, "Owner");
} }
@@ -106,7 +114,7 @@
} }
@Override @Override
@@ -795,6 +_,7 @@ @@ -795,6 +813,7 @@ public abstract class AbstractHorse extends Animal implements HasCustomInventory
this.setTemper(compound.getIntOr("Temper", 0)); this.setTemper(compound.getIntOr("Temper", 0));
this.setTamed(compound.getBooleanOr("Tame", false)); this.setTamed(compound.getBooleanOr("Tame", false));
this.owner = EntityReference.readWithOldOwnerConversion(compound, "Owner", this.level()); this.owner = EntityReference.readWithOldOwnerConversion(compound, "Owner", this.level());
@@ -114,7 +122,7 @@
} }
@Override @Override
@@ -883,6 +_,17 @@ @@ -883,6 +902,17 @@ public abstract class AbstractHorse extends Animal implements HasCustomInventory
@Override @Override
public void handleStartJump(int jumpPower) { 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 --- a/net/minecraft/world/entity/animal/wolf/Wolf.java
+++ b/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)) { if (this.isInvulnerableTo(level, damageSource)) {
return false; return false;
} else { } else {
@@ -22,7 +30,7 @@
ItemStack bodyArmorItem = this.getBodyArmorItem(); ItemStack bodyArmorItem = this.getBodyArmorItem();
int damageValue = bodyArmorItem.getDamageValue(); int damageValue = bodyArmorItem.getDamageValue();
int maxDamage = bodyArmorItem.getMaxDamage(); 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) { private boolean canArmorAbsorb(DamageSource damageSource) {
@@ -439,7 +_,7 @@ @@ -439,7 +442,7 @@ public class Wolf extends TamableAnimal implements NeutralMob {
protected void applyTamingSideEffects() { protected void applyTamingSideEffects() {
if (this.isTame()) { if (this.isTame()) {
this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(40.0); this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(40.0);
@@ -39,7 +47,7 @@
} else { } else {
this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(8.0); 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); this.usePlayerItem(player, hand, itemInHand);
FoodProperties foodProperties = itemInHand.get(DataComponents.FOOD); FoodProperties foodProperties = itemInHand.get(DataComponents.FOOD);
float f = foodProperties != null ? foodProperties.nutrition() : 1.0F; float f = foodProperties != null ? foodProperties.nutrition() : 1.0F;
@@ -48,7 +56,7 @@
return InteractionResult.SUCCESS; return InteractionResult.SUCCESS;
} }
@@ -492,7 +_,7 @@ @@ -492,7 +495,7 @@ public class Wolf extends TamableAnimal implements NeutralMob {
this.setOrderedToSit(!this.isOrderedToSit()); this.setOrderedToSit(!this.isOrderedToSit());
this.jumping = false; this.jumping = false;
this.navigation.stop(); this.navigation.stop();
@@ -57,7 +65,7 @@
return InteractionResult.SUCCESS.withoutItem(); return InteractionResult.SUCCESS.withoutItem();
} }
@@ -504,7 +_,9 @@ @@ -504,7 +507,9 @@ public class Wolf extends TamableAnimal implements NeutralMob {
ItemStack bodyArmorItem = this.getBodyArmorItem(); ItemStack bodyArmorItem = this.getBodyArmorItem();
this.setBodyArmorItem(ItemStack.EMPTY); this.setBodyArmorItem(ItemStack.EMPTY);
if (this.level() instanceof ServerLevel serverLevel) { if (this.level() instanceof ServerLevel serverLevel) {
@@ -67,7 +75,7 @@
} }
return InteractionResult.SUCCESS; return InteractionResult.SUCCESS;
@@ -512,6 +_,13 @@ @@ -512,6 +517,13 @@ public class Wolf extends TamableAnimal implements NeutralMob {
DyeColor dyeColor = dyeItem.getDyeColor(); DyeColor dyeColor = dyeItem.getDyeColor();
if (dyeColor != this.getCollarColor()) { if (dyeColor != this.getCollarColor()) {
@@ -81,7 +89,7 @@
this.setCollarColor(dyeColor); this.setCollarColor(dyeColor);
itemInHand.consume(1, player); itemInHand.consume(1, player);
return InteractionResult.SUCCESS; return InteractionResult.SUCCESS;
@@ -526,7 +_,7 @@ @@ -526,7 +538,7 @@ public class Wolf extends TamableAnimal implements NeutralMob {
} }
private void tryToTame(Player player) { 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 --- a/net/minecraft/world/entity/boss/enderdragon/EndCrystal.java
+++ b/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 EntityDataAccessor<Boolean> DATA_SHOW_BOTTOM = SynchedEntityData.defineId(EndCrystal.class, EntityDataSerializers.BOOLEAN);
private static final boolean DEFAULT_SHOW_BOTTOM = true; private static final boolean DEFAULT_SHOW_BOTTOM = true;
public int time; public int time;
@@ -8,17 +16,15 @@
public EndCrystal(EntityType<? extends EndCrystal> entityType, Level level) { public EndCrystal(EntityType<? extends EndCrystal> entityType, Level level) {
super(entityType, level); super(entityType, level);
@@ -56,21 +_,37 @@ @@ -56,21 +57,37 @@ public class EndCrystal extends Entity {
if (this.level() instanceof ServerLevel) { if (this.level() instanceof ServerLevel) {
BlockPos blockPos = this.blockPosition(); BlockPos blockPos = this.blockPosition();
if (((ServerLevel)this.level()).getDragonFight() != null && this.level().getBlockState(blockPos).isAir()) { if (((ServerLevel)this.level()).getDragonFight() != null && this.level().getBlockState(blockPos).isAir()) {
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(this.level(), blockPos, this).isCancelled()) { // Paper + if (!org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(this.level(), blockPos, this).isCancelled()) { // Paper
this.level().setBlockAndUpdate(blockPos, BaseFireBlock.getState(this.level(), blockPos)); this.level().setBlockAndUpdate(blockPos, BaseFireBlock.getState(this.level(), blockPos));
- }
- }
+ } // Paper + } // Paper
+ } }
+ } }
+ +
+ // Paper start - Fix invulnerable end crystals + // Paper start - Fix invulnerable end crystals
+ if (this.level().paperConfig().unsupportedSettings.fixInvulnerableEndCrystalExploit && this.generatedByDragonFight && this.isInvulnerable()) { + if (this.level().paperConfig().unsupportedSettings.fixInvulnerableEndCrystalExploit && this.generatedByDragonFight && this.isInvulnerable()) {
@@ -48,7 +54,7 @@
} }
@Override @Override
@@ -91,10 +_,24 @@ @@ -91,10 +108,24 @@ public class EndCrystal extends Entity {
return false; return false;
} else { } else {
if (!this.isRemoved()) { 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 --- a/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
+++ b/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 Node[] nodes = new Node[24];
private final int[] nodeAdjacency = new int[24]; private final int[] nodeAdjacency = new int[24];
private final BinaryHeap openSet = new BinaryHeap(); private final BinaryHeap openSet = new BinaryHeap();
@@ -11,7 +19,7 @@
public EnderDragon(EntityType<? extends EnderDragon> entityType, Level level) { public EnderDragon(EntityType<? extends EnderDragon> entityType, Level level) {
super(EntityType.ENDER_DRAGON, 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.setHealth(this.getMaxHealth());
this.noPhysics = true; this.noPhysics = true;
this.phaseManager = new EnderDragonPhaseManager(this); this.phaseManager = new EnderDragonPhaseManager(this);
@@ -19,7 +27,7 @@
} }
public void setDragonFight(EndDragonFight dragonFight) { 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); return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 200.0);
} }
@@ -39,7 +47,7 @@
@Override @Override
public boolean isFlapping() { public boolean isFlapping() {
float cos = Mth.cos(this.flapTime * (float) (Math.PI * 2)); 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(); Vec3 flyTargetLocation = currentPhase.getFlyTargetLocation();
@@ -48,7 +56,7 @@
double d = flyTargetLocation.x - this.getX(); double d = flyTargetLocation.x - this.getX();
double d1 = flyTargetLocation.y - this.getY(); double d1 = flyTargetLocation.y - this.getY();
double d2 = flyTargetLocation.z - this.getZ(); double d2 = flyTargetLocation.z - this.getZ();
@@ -366,7 +_,12 @@ @@ -366,7 +384,12 @@ public class EnderDragon extends Mob implements Enemy {
if (this.nearestCrystal.isRemoved()) { if (this.nearestCrystal.isRemoved()) {
this.nearestCrystal = null; this.nearestCrystal = null;
} else if (this.tickCount % 10 == 0 && this.getHealth() < this.getMaxHealth()) { } 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 d2 = entity.getX() - d;
double d3 = entity.getZ() - d1; double d3 = entity.getZ() - d1;
double max = Math.max(d2 * d2 + d3 * d3, 0.1); double max = Math.max(d2 * d2 + d3 * d3, 0.1);
@@ -71,7 +79,7 @@
if (!this.phaseManager.getCurrentPhase().isSitting() && livingEntity.getLastHurtByMobTimestamp() < entity.tickCount - 2) { if (!this.phaseManager.getCurrentPhase().isSitting() && livingEntity.getLastHurtByMobTimestamp() < entity.tickCount - 2) {
DamageSource damageSource = this.damageSources().mobAttack(this); DamageSource damageSource = this.damageSources().mobAttack(this);
entity.hurtServer(level, damageSource, 5.0F); 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); int floor5 = Mth.floor(box.maxZ);
boolean flag = false; boolean flag = false;
boolean flag1 = false; boolean flag1 = false;
@@ -79,7 +87,7 @@
for (int i = floor; i <= floor3; i++) { for (int i = floor; i <= floor3; i++) {
for (int i1 = floor1; i1 <= floor4; i1++) { 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); BlockState blockState = level.getBlockState(blockPos);
if (!blockState.isAir() && !blockState.is(BlockTags.DRAGON_TRANSPARENT)) { if (!blockState.isAir() && !blockState.is(BlockTags.DRAGON_TRANSPARENT)) {
if (level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) && !blockState.is(BlockTags.DRAGON_IMMUNE)) { if (level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) && !blockState.is(BlockTags.DRAGON_IMMUNE)) {
@@ -92,7 +100,7 @@
} else { } else {
flag = true; flag = true;
} }
@@ -446,6 +_,58 @@ @@ -446,6 +474,58 @@ public class EnderDragon extends Mob implements Enemy {
} }
} }
@@ -151,7 +159,7 @@
if (flag1) { if (flag1) {
BlockPos blockPos1 = new BlockPos( BlockPos blockPos1 = new BlockPos(
floor + this.random.nextInt(floor3 - floor + 1), floor + this.random.nextInt(floor3 - floor + 1),
@@ -503,7 +_,15 @@ @@ -503,7 +583,15 @@ public class EnderDragon extends Mob implements Enemy {
@Override @Override
public void kill(ServerLevel level) { public void kill(ServerLevel level) {
@@ -168,7 +176,7 @@
this.gameEvent(GameEvent.ENTITY_DIE); this.gameEvent(GameEvent.ENTITY_DIE);
if (this.dragonFight != null) { if (this.dragonFight != null) {
this.dragonFight.updateDragon(this); 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); 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) { if (this.dragonDeathTime == 200 && this.level() instanceof ServerLevel serverLevel1) {
@@ -232,7 +240,7 @@
this.gameEvent(GameEvent.ENTITY_DIE); this.gameEvent(GameEvent.ENTITY_DIE);
} }
} }
@@ -739,6 +_,7 @@ @@ -739,6 +850,7 @@ public class EnderDragon extends Mob implements Enemy {
super.addAdditionalSaveData(compound); super.addAdditionalSaveData(compound);
compound.putInt("DragonPhase", this.phaseManager.getCurrentPhase().getPhase().getId()); compound.putInt("DragonPhase", this.phaseManager.getCurrentPhase().getPhase().getId());
compound.putInt("DragonDeathTime", this.dragonDeathTime); compound.putInt("DragonDeathTime", this.dragonDeathTime);
@@ -240,7 +248,7 @@
} }
@Override @Override
@@ -746,6 +_,7 @@ @@ -746,6 +858,7 @@ public class EnderDragon extends Mob implements Enemy {
super.readAdditionalSaveData(compound); super.readAdditionalSaveData(compound);
compound.getInt("DragonPhase").ifPresent(integer -> this.phaseManager.setPhase(EnderDragonPhase.getById(integer))); compound.getInt("DragonPhase").ifPresent(integer -> this.phaseManager.setPhase(EnderDragonPhase.getById(integer)));
this.dragonDeathTime = compound.getIntOr("DragonDeathTime", 0); this.dragonDeathTime = compound.getIntOr("DragonDeathTime", 0);
@@ -248,7 +256,7 @@
} }
@Override @Override
@@ -786,7 +_,7 @@ @@ -786,7 +899,7 @@ public class EnderDragon extends Mob implements Enemy {
EnderDragonPhase<? extends DragonPhaseInstance> phase = currentPhase.getPhase(); EnderDragonPhase<? extends DragonPhaseInstance> phase = currentPhase.getPhase();
Vec3 viewVector; Vec3 viewVector;
if (phase == EnderDragonPhase.LANDING || phase == EnderDragonPhase.TAKEOFF) { 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 max = Math.max((float)Math.sqrt(heightmapPos.distToCenterSqr(this.position())) / 4.0F, 1.0F);
float f = 6.0F / max; float f = 6.0F / max;
float xRot = this.getXRot(); float xRot = this.getXRot();
@@ -874,4 +_,19 @@ @@ -874,4 +987,19 @@ public class EnderDragon extends Mob implements Enemy {
protected float sanitizeScale(float scale) { protected float sanitizeScale(float scale) {
return 1.0F; 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 --- a/net/minecraft/world/entity/decoration/ArmorStand.java
+++ b/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 rightArmPose = DEFAULT_RIGHT_ARM_POSE;
public Rotations leftLegPose = DEFAULT_LEFT_LEG_POSE; public Rotations leftLegPose = DEFAULT_LEFT_LEG_POSE;
public Rotations rightLegPose = DEFAULT_RIGHT_LEG_POSE; public Rotations rightLegPose = DEFAULT_RIGHT_LEG_POSE;
@@ -18,7 +26,7 @@
} }
public ArmorStand(Level level, double x, double y, double z) { 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); return createLivingAttributes().add(Attributes.STEP_HEIGHT, 0.0);
} }
@@ -32,7 +40,7 @@
@Override @Override
public void refreshDimensions() { public void refreshDimensions() {
double x = this.getX(); 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); return slot != EquipmentSlot.BODY && slot != EquipmentSlot.SADDLE && !this.isDisabled(slot);
} }
@@ -47,7 +55,7 @@
@Override @Override
public void addAdditionalSaveData(CompoundTag compound) { public void addAdditionalSaveData(CompoundTag compound) {
super.addAdditionalSaveData(compound); super.addAdditionalSaveData(compound);
@@ -150,6 +_,7 @@ @@ -150,6 +173,7 @@ public class ArmorStand extends LivingEntity {
} }
compound.put("Pose", this.writePose()); compound.put("Pose", this.writePose());
@@ -55,7 +63,7 @@
} }
@Override @Override
@@ -163,6 +_,12 @@ @@ -163,6 +187,12 @@ public class ArmorStand extends LivingEntity {
this.setMarker(compound.getBooleanOr("Marker", false)); this.setMarker(compound.getBooleanOr("Marker", false));
this.noPhysics = !this.hasPhysics(); this.noPhysics = !this.hasPhysics();
this.readPose(compound.getCompoundOrEmpty("Pose")); this.readPose(compound.getCompoundOrEmpty("Pose"));
@@ -68,7 +76,7 @@
} }
private void readPose(CompoundTag compound) { private void readPose(CompoundTag compound) {
@@ -204,7 +_,7 @@ @@ -204,7 +234,7 @@ public class ArmorStand extends LivingEntity {
} }
@Override @Override
@@ -77,7 +85,7 @@
return false; return false;
} }
@@ -214,6 +_,7 @@ @@ -214,6 +244,7 @@ public class ArmorStand extends LivingEntity {
@Override @Override
protected void pushEntities() { protected void pushEntities() {
@@ -85,7 +93,7 @@
for (Entity entity : this.level().getEntities(this, this.getBoundingBox(), RIDABLE_MINECARTS)) { for (Entity entity : this.level().getEntities(this, this.getBoundingBox(), RIDABLE_MINECARTS)) {
if (this.distanceToSqr(entity) <= 0.2) { if (this.distanceToSqr(entity) <= 0.2) {
entity.push(this); entity.push(this);
@@ -286,7 +_,25 @@ @@ -286,7 +317,25 @@ public class ArmorStand extends LivingEntity {
return false; return false;
} else if (itemBySlot.isEmpty() && (this.disabledSlots & 1 << slot.getFilterBit(16)) != 0) { } else if (itemBySlot.isEmpty() && (this.disabledSlots & 1 << slot.getFilterBit(16)) != 0) {
return false; return false;
@@ -112,7 +120,7 @@
this.setItemSlot(slot, stack.copyWithCount(1)); this.setItemSlot(slot, stack.copyWithCount(1));
return true; return true;
} else if (stack.isEmpty() || stack.getCount() <= 1) { } 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)); this.setItemSlot(slot, stack.split(1));
return true; return true;
} }
@@ -120,7 +128,7 @@
} }
@Override @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) { } else if (!level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) && damageSource.getEntity() instanceof Mob) {
return false; return false;
} else if (damageSource.is(DamageTypeTags.BYPASSES_INVULNERABILITY)) { } else if (damageSource.is(DamageTypeTags.BYPASSES_INVULNERABILITY)) {
@@ -157,7 +165,7 @@
if (this.isOnFire()) { if (this.isOnFire()) {
this.causeDamage(level, damageSource, 0.15F); this.causeDamage(level, damageSource, 0.15F);
} else { } else {
@@ -325,9 +_,19 @@ @@ -325,9 +392,19 @@ public class ArmorStand extends LivingEntity {
return false; return false;
} else if (damageSource.is(DamageTypeTags.BURNS_ARMOR_STANDS) && this.getHealth() > 0.5F) { } 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 isCanBreakArmorStand = damageSource.is(DamageTypeTags.CAN_BREAK_ARMOR_STAND);
boolean isAlwaysKillsArmorStands = damageSource.is(DamageTypeTags.ALWAYS_KILLS_ARMOR_STANDS); boolean isAlwaysKillsArmorStands = damageSource.is(DamageTypeTags.ALWAYS_KILLS_ARMOR_STANDS);
if (!isCanBreakArmorStand && !isAlwaysKillsArmorStands) { if (!isCanBreakArmorStand && !isAlwaysKillsArmorStands) {
@@ -337,7 +_,7 @@ @@ -337,7 +414,7 @@ public class ArmorStand extends LivingEntity {
} else if (damageSource.isCreativePlayer()) { } else if (damageSource.isCreativePlayer()) {
this.playBrokenSound(); this.playBrokenSound();
this.showBreakingParticles(); this.showBreakingParticles();
@@ -186,7 +194,7 @@
return true; return true;
} else { } else {
long gameTime = level.getGameTime(); long gameTime = level.getGameTime();
@@ -346,9 +_,9 @@ @@ -346,9 +423,9 @@ public class ArmorStand extends LivingEntity {
this.gameEvent(GameEvent.ENTITY_DAMAGE, damageSource.getEntity()); this.gameEvent(GameEvent.ENTITY_DAMAGE, damageSource.getEntity());
this.lastHit = gameTime; this.lastHit = gameTime;
} else { } else {
@@ -198,7 +206,7 @@
} }
return true; return true;
@@ -400,31 +_,42 @@ @@ -400,31 +477,42 @@ public class ArmorStand extends LivingEntity {
float health = this.getHealth(); float health = this.getHealth();
health -= damageAmount; health -= damageAmount;
if (health <= 0.5F) { if (health <= 0.5F) {
@@ -235,8 +243,6 @@
+ ItemStack itemStack = this.equipment.get(equipmentSlot); // Paper - move equipment removal past event call + ItemStack itemStack = this.equipment.get(equipmentSlot); // Paper - move equipment removal past event call
if (!itemStack.isEmpty()) { if (!itemStack.isEmpty()) {
- Block.popResource(this.level(), this.blockPosition().above(), itemStack); - 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} + 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()) { + if (!event.isCancelled()) {
+ for (EquipmentSlot equipmentSlot : EquipmentSlot.VALUES) { + for (EquipmentSlot equipmentSlot : EquipmentSlot.VALUES) {
+ this.equipment.set(equipmentSlot, ItemStack.EMPTY); + this.equipment.set(equipmentSlot, ItemStack.EMPTY);
+ } }
+ } }
+ return event; + return event;
+ // Paper end - move equipment removal past event call + // Paper end - move equipment removal past event call
} }
private void playBrokenSound() { private void playBrokenSound() {
@@ -458,7 +_,28 @@ @@ -458,7 +546,28 @@ public class ArmorStand extends LivingEntity {
@Override @Override
public void tick() { public void tick() {
@@ -281,7 +287,7 @@
Rotations rotations = this.entityData.get(DATA_HEAD_POSE); Rotations rotations = this.entityData.get(DATA_HEAD_POSE);
if (!this.headPose.equals(rotations)) { if (!this.headPose.equals(rotations)) {
this.setHeadPose(rotations); this.setHeadPose(rotations);
@@ -506,9 +_,32 @@ @@ -506,9 +615,32 @@ public class ArmorStand extends LivingEntity {
return this.isSmall(); return this.isSmall();
} }
@@ -315,7 +321,7 @@
this.gameEvent(GameEvent.ENTITY_DIE); this.gameEvent(GameEvent.ENTITY_DIE);
} }
@@ -572,31 +_,37 @@ @@ -572,31 +704,37 @@ public class ArmorStand extends LivingEntity {
public void setHeadPose(Rotations headPose) { public void setHeadPose(Rotations headPose) {
this.headPose = headPose; this.headPose = headPose;
this.entityData.set(DATA_HEAD_POSE, headPose); this.entityData.set(DATA_HEAD_POSE, headPose);
@@ -353,7 +359,7 @@
} }
public Rotations getHeadPose() { public Rotations getHeadPose() {
@@ -728,4 +_,13 @@ @@ -728,4 +866,13 @@ public class ArmorStand extends LivingEntity {
public boolean canBeSeenByAnyone() { public boolean canBeSeenByAnyone() {
return !this.isInvisible() && !this.isMarker(); 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 --- a/net/minecraft/world/entity/decoration/LeashFenceKnotEntity.java
+++ b/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) { for (Leashable leashable : list) {
if (leashable.getLeashHolder() == player) { if (leashable.getLeashHolder() == player) {
@@ -16,7 +24,7 @@
leashable.setLeashedTo(this, true); leashable.setLeashedTo(this, true);
flag = true; flag = true;
} }
@@ -88,14 +_,39 @@ @@ -88,14 +97,39 @@ public class LeashFenceKnotEntity extends BlockAttachedEntity {
boolean flag1 = false; boolean flag1 = false;
if (!flag) { 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 --- a/net/minecraft/world/entity/item/FallingBlockEntity.java
+++ b/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 CompoundTag blockData;
public boolean forceTickAfterTeleportToDuplicate; public boolean forceTickAfterTeleportToDuplicate;
protected static final EntityDataAccessor<BlockPos> DATA_START_POS = SynchedEntityData.defineId(FallingBlockEntity.class, EntityDataSerializers.BLOCK_POS); 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) { public FallingBlockEntity(EntityType<? extends FallingBlockEntity> entityType, Level level) {
super(entityType, level); super(entityType, level);
@@ -94,6 +_,7 @@ @@ -94,6 +95,7 @@ public class FallingBlockEntity extends Entity {
pos.getZ() + 0.5, pos.getZ() + 0.5,
blockState.hasProperty(BlockStateProperties.WATERLOGGED) ? blockState.setValue(BlockStateProperties.WATERLOGGED, false) : blockState blockState.hasProperty(BlockStateProperties.WATERLOGGED) ? blockState.setValue(BlockStateProperties.WATERLOGGED, false) : blockState
); );
@@ -16,7 +24,7 @@
level.setBlock(pos, blockState.getFluidState().createLegacyBlock(), 3); level.setBlock(pos, blockState.getFluidState().createLegacyBlock(), 3);
level.addFreshEntity(fallingBlockEntity); level.addFreshEntity(fallingBlockEntity);
return fallingBlockEntity; return fallingBlockEntity;
@@ -144,13 +_,22 @@ @@ -144,13 +146,22 @@ public class FallingBlockEntity extends Entity {
@Override @Override
public void tick() { public void tick() {
if (this.blockState.isAir()) { if (this.blockState.isAir()) {
@@ -40,7 +48,7 @@
this.handlePortal(); this.handlePortal();
if (this.level() instanceof ServerLevel serverLevel && (this.isAlive() || this.forceTickAfterTeleportToDuplicate)) { if (this.level() instanceof ServerLevel serverLevel && (this.isAlive() || this.forceTickAfterTeleportToDuplicate)) {
BlockPos blockPos = this.blockPosition(); BlockPos blockPos = this.blockPosition();
@@ -171,12 +_,12 @@ @@ -171,12 +182,12 @@ public class FallingBlockEntity extends Entity {
} }
if (!this.onGround() && !flag1) { if (!this.onGround() && !flag1) {
@@ -55,7 +63,7 @@
} }
} else { } else {
BlockState blockState = this.level().getBlockState(blockPos); 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); this.blockState = this.blockState.setValue(BlockStateProperties.WATERLOGGED, true);
} }
@@ -75,7 +83,7 @@
if (block instanceof Fallable) { if (block instanceof Fallable) {
((Fallable)block).onLand(this.level(), blockPos, this.blockState, blockState, this); ((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)) { } else if (this.dropItem && serverLevel.getGameRules().getBoolean(GameRules.RULE_DOENTITYDROPS)) {
@@ -98,7 +106,7 @@
this.callOnBrokenAfterFall(block, blockPos); this.callOnBrokenAfterFall(block, blockPos);
} }
} }
@@ -293,6 +_,7 @@ @@ -293,6 +310,7 @@ public class FallingBlockEntity extends Entity {
} }
compound.putBoolean("CancelDrop", this.cancelDrop); compound.putBoolean("CancelDrop", this.cancelDrop);
@@ -106,7 +114,7 @@
} }
@Override @Override
@@ -305,8 +_,9 @@ @@ -305,8 +323,9 @@ public class FallingBlockEntity extends Entity {
this.fallDamagePerDistance = compound.getFloatOr("FallHurtAmount", 0.0F); this.fallDamagePerDistance = compound.getFloatOr("FallHurtAmount", 0.0F);
this.fallDamageMax = compound.getIntOr("FallHurtMax", 40); this.fallDamageMax = compound.getIntOr("FallHurtMax", 40);
this.dropItem = compound.getBooleanOr("DropItem", true); this.dropItem = compound.getBooleanOr("DropItem", true);
@@ -117,7 +125,7 @@
} }
public void setHurtsEntities(float fallDamagePerDistance, int fallDamageMax) { 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(); ResourceKey<Level> resourceKey1 = this.level().dimension();
boolean flag = (resourceKey1 == Level.END || resourceKey == Level.END) && resourceKey1 != resourceKey; boolean flag = (resourceKey1 == Level.END || resourceKey == Level.END) && resourceKey1 != resourceKey;
Entity entity = super.teleport(teleportTransition); 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 --- a/net/minecraft/world/entity/item/ItemEntity.java
+++ b/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 @Nullable
public UUID target; public UUID target;
public final float bobOffs; public final float bobOffs;
@@ -10,7 +18,7 @@
public ItemEntity(EntityType<? extends ItemEntity> entityType, Level level) { public ItemEntity(EntityType<? extends ItemEntity> entityType, Level level) {
super(entityType, 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) { 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) { 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 @Override
public void tick() { public void tick() {
if (this.getItem().isEmpty()) { if (this.getItem().isEmpty()) {
@@ -33,7 +41,7 @@
} else { } else {
super.tick(); super.tick();
if (this.pickupDelay > 0 && this.pickupDelay != 32767) { 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; 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() { private void mergeWithNeighbours() {
if (this.isMergable()) { if (this.isMergable()) {
@@ -88,7 +96,7 @@
this.tryToMerge(itemEntity); this.tryToMerge(itemEntity);
if (this.isRemoved()) { if (this.isRemoved()) {
break; break;
@@ -231,7 +_,7 @@ @@ -231,7 +258,7 @@ public class ItemEntity extends Entity implements TraceableEntity {
private boolean isMergable() { private boolean isMergable() {
ItemStack item = this.getItem(); ItemStack item = this.getItem();
@@ -97,7 +105,7 @@
} }
private void tryToMerge(ItemEntity itemEntity) { 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) { 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)) { } else if (!this.getItem().canBeHurtBy(damageSource)) {
return false; return false;
} else { } else {
@@ -134,7 +142,7 @@
} }
return true; return true;
@@ -324,6 +_,11 @@ @@ -324,6 +361,11 @@ public class ItemEntity extends Entity implements TraceableEntity {
RegistryOps<Tag> registryOps = this.registryAccess().createSerializationContext(NbtOps.INSTANCE); RegistryOps<Tag> registryOps = this.registryAccess().createSerializationContext(NbtOps.INSTANCE);
compound.store("Item", ItemStack.CODEC, registryOps, this.getItem()); compound.store("Item", ItemStack.CODEC, registryOps, this.getItem());
} }
@@ -146,7 +154,7 @@
} }
@Override @Override
@@ -336,8 +_,19 @@ @@ -336,8 +378,19 @@ public class ItemEntity extends Entity implements TraceableEntity {
this.cachedThrower = null; this.cachedThrower = null;
RegistryOps<Tag> registryOps = this.registryAccess().createSerializationContext(NbtOps.INSTANCE); RegistryOps<Tag> registryOps = this.registryAccess().createSerializationContext(NbtOps.INSTANCE);
this.setItem(compound.read("Item", ItemStack.CODEC, registryOps).orElse(ItemStack.EMPTY)); 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(); ItemStack item = this.getItem();
Item item1 = item.getItem(); Item item1 = item.getItem();
int count = item.getCount(); int count = item.getCount();
@@ -242,7 +250,7 @@
item.setCount(count); item.setCount(count);
} }
@@ -388,6 +_,7 @@ @@ -388,6 +504,7 @@ public class ItemEntity extends Entity implements TraceableEntity {
public void setItem(ItemStack stack) { public void setItem(ItemStack stack) {
this.getEntityData().set(DATA_ITEM, stack); this.getEntityData().set(DATA_ITEM, stack);
@@ -250,7 +258,7 @@
} }
@Override @Override
@@ -441,7 +_,7 @@ @@ -441,7 +558,7 @@ public class ItemEntity extends Entity implements TraceableEntity {
public void makeFakeItem() { public void makeFakeItem() {
this.setNeverPickUp(); 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 --- a/net/minecraft/world/entity/monster/Creeper.java
+++ b/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 maxSwell = 30;
public int explosionRadius = 3; public int explosionRadius = 3;
private int droppedSkulls; private int droppedSkulls;
@@ -8,7 +16,7 @@
public Creeper(EntityType<? extends Creeper> entityType, Level level) { public Creeper(EntityType<? extends Creeper> entityType, Level level) {
super(entityType, level); super(entityType, level);
@@ -116,7 +_,7 @@ @@ -116,7 +117,7 @@ public class Creeper extends Monster {
this.maxSwell = compound.getShortOr("Fuse", (short)30); this.maxSwell = compound.getShortOr("Fuse", (short)30);
this.explosionRadius = compound.getByteOr("ExplosionRadius", (byte)3); this.explosionRadius = compound.getByteOr("ExplosionRadius", (byte)3);
if (compound.getBooleanOr("ignited", false)) { if (compound.getBooleanOr("ignited", false)) {
@@ -17,7 +25,7 @@
} }
} }
@@ -149,10 +_,11 @@ @@ -149,10 +150,11 @@ public class Creeper extends Monster {
} }
@Override @Override
@@ -31,7 +39,7 @@
} }
@Override @Override
@@ -199,9 +_,20 @@ @@ -199,9 +201,20 @@ public class Creeper extends Monster {
@Override @Override
public void thunderHit(ServerLevel level, LightningBolt lightning) { public void thunderHit(ServerLevel level, LightningBolt lightning) {
super.thunderHit(level, lightning); super.thunderHit(level, lightning);
@@ -52,7 +60,7 @@
@Override @Override
protected InteractionResult mobInteract(Player player, InteractionHand hand) { protected InteractionResult mobInteract(Player player, InteractionHand hand) {
ItemStack itemInHand = player.getItemInHand(hand); ItemStack itemInHand = player.getItemInHand(hand);
@@ -210,8 +_,9 @@ @@ -210,8 +223,9 @@ public class Creeper extends Monster {
this.level() this.level()
.playSound(player, this.getX(), this.getY(), this.getZ(), soundEvent, this.getSoundSource(), 1.0F, this.random.nextFloat() * 0.4F + 0.8F); .playSound(player, this.getX(), this.getY(), this.getZ(), soundEvent, this.getSoundSource(), 1.0F, this.random.nextFloat() * 0.4F + 0.8F);
if (!this.level().isClientSide) { if (!this.level().isClientSide) {
@@ -63,7 +71,7 @@
itemInHand.shrink(1); itemInHand.shrink(1);
} else { } else {
itemInHand.hurtAndBreak(1, player, getSlotForHand(hand)); itemInHand.hurtAndBreak(1, player, getSlotForHand(hand));
@@ -227,18 +_,29 @@ @@ -227,18 +241,29 @@ public class Creeper extends Monster {
public void explodeCreeper() { public void explodeCreeper() {
if (this.level() instanceof ServerLevel serverLevel) { if (this.level() instanceof ServerLevel serverLevel) {
float f = this.isPowered() ? 2.0F : 1.0F; float f = this.isPowered() ? 2.0F : 1.0F;
@@ -96,13 +104,11 @@
areaEffectCloud.setRadius(2.5F); areaEffectCloud.setRadius(2.5F);
areaEffectCloud.setRadiusOnUse(-0.5F); areaEffectCloud.setRadiusOnUse(-0.5F);
areaEffectCloud.setWaitTime(10); areaEffectCloud.setWaitTime(10);
@@ -250,16 +_,27 @@ @@ -250,16 +275,27 @@ public class Creeper extends Monster {
areaEffectCloud.addEffect(new MobEffectInstance(mobEffectInstance)); areaEffectCloud.addEffect(new MobEffectInstance(mobEffectInstance));
} }
- this.level().addFreshEntity(areaEffectCloud); - this.level().addFreshEntity(areaEffectCloud);
- }
- }
+ this.level().addFreshEntity(areaEffectCloud, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.EXPLOSION); // CraftBukkit + this.level().addFreshEntity(areaEffectCloud, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.EXPLOSION); // CraftBukkit
+ } + }
+ } + }
@@ -114,8 +120,8 @@
+ if (event.callEvent()) { + if (event.callEvent()) {
+ this.entityData.set(DATA_IS_IGNITED, event.isIgnited()); + this.entityData.set(DATA_IS_IGNITED, event.isIgnited());
+ } + }
+ } }
+ } }
+ // Paper end - Call CreeperIgniteEvent + // Paper end - Call CreeperIgniteEvent
public boolean isIgnited() { 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 --- a/net/minecraft/world/entity/monster/Phantom.java
+++ b/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 @Nullable
public BlockPos anchorPoint; public BlockPos anchorPoint;
Phantom.AttackPhase attackPhase = Phantom.AttackPhase.CIRCLE; Phantom.AttackPhase attackPhase = Phantom.AttackPhase.CIRCLE;
@@ -12,7 +20,7 @@
public Phantom(EntityType<? extends Phantom> entityType, Level level) { public Phantom(EntityType<? extends Phantom> entityType, Level level) {
super(entityType, level); super(entityType, level);
@@ -142,7 +_,7 @@ @@ -142,7 +147,7 @@ public class Phantom extends FlyingMob implements Enemy {
@Override @Override
public void aiStep() { public void aiStep() {
@@ -21,7 +29,7 @@
this.igniteForSeconds(8.0F); this.igniteForSeconds(8.0F);
} }
@@ -163,6 +_,10 @@ @@ -163,6 +168,10 @@ public class Phantom extends FlyingMob implements Enemy {
super.readAdditionalSaveData(compound); super.readAdditionalSaveData(compound);
this.anchorPoint = compound.read("anchor_pos", BlockPos.CODEC).orElse(null); this.anchorPoint = compound.read("anchor_pos", BlockPos.CODEC).orElse(null);
this.setPhantomSize(compound.getIntOr("size", 0)); this.setPhantomSize(compound.getIntOr("size", 0));
@@ -32,7 +40,7 @@
} }
@Override @Override
@@ -170,6 +_,10 @@ @@ -170,6 +179,10 @@ public class Phantom extends FlyingMob implements Enemy {
super.addAdditionalSaveData(compound); super.addAdditionalSaveData(compound);
compound.storeNullable("anchor_pos", BlockPos.CODEC, this.anchorPoint); compound.storeNullable("anchor_pos", BlockPos.CODEC, this.anchorPoint);
compound.putInt("size", this.getPhantomSize()); compound.putInt("size", this.getPhantomSize());
@@ -43,7 +51,7 @@
} }
@Override @Override
@@ -243,7 +_,8 @@ @@ -243,7 +256,8 @@ public class Phantom extends FlyingMob implements Enemy {
for (Player player : nearbyPlayers) { for (Player player : nearbyPlayers) {
if (Phantom.this.canAttack(serverLevel, player, TargetingConditions.DEFAULT)) { 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 --- a/net/minecraft/world/entity/monster/Slime.java
+++ b/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 squish;
public float oSquish; public float oSquish;
private boolean wasOnGround = false; private boolean wasOnGround = false;
@@ -8,7 +16,7 @@
public Slime(EntityType<? extends Slime> entityType, Level level) { public Slime(EntityType<? extends Slime> entityType, Level level) {
super(entityType, level); super(entityType, level);
@@ -111,6 +_,7 @@ @@ -111,6 +112,7 @@ public class Slime extends Mob implements Enemy {
super.addAdditionalSaveData(compound); super.addAdditionalSaveData(compound);
compound.putInt("Size", this.getSize() - 1); compound.putInt("Size", this.getSize() - 1);
compound.putBoolean("wasOnGround", this.wasOnGround); compound.putBoolean("wasOnGround", this.wasOnGround);
@@ -16,7 +24,7 @@
} }
@Override @Override
@@ -118,6 +_,7 @@ @@ -118,6 +120,7 @@ public class Slime extends Mob implements Enemy {
this.setSize(compound.getIntOr("Size", 0) + 1, false); this.setSize(compound.getIntOr("Size", 0) + 1, false);
super.readAdditionalSaveData(compound); super.readAdditionalSaveData(compound);
this.wasOnGround = compound.getBooleanOr("wasOnGround", false); this.wasOnGround = compound.getBooleanOr("wasOnGround", false);
@@ -24,7 +32,7 @@
} }
public boolean isTiny() { public boolean isTiny() {
@@ -197,7 +_,7 @@ @@ -197,7 +200,7 @@ public class Slime extends Mob implements Enemy {
} }
@Override @Override
@@ -33,7 +41,7 @@
int size = this.getSize(); int size = this.getSize();
if (!this.level().isClientSide && size > 1 && this.isDeadOrDying()) { if (!this.level().isClientSide && size > 1 && this.isDeadOrDying()) {
float width = this.getDimensions(this.getPose()).width(); 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 i = size / 2;
int i1 = 2 + this.random.nextInt(3); int i1 = 2 + this.random.nextInt(3);
PlayerTeam team = this.getTeam(); PlayerTeam team = this.getTeam();
@@ -57,7 +65,6 @@
mob.setSize(i, true); mob.setSize(i, true);
mob.snapTo(this.getX() + f1, this.getY() + 0.5, this.getZ() + f2, this.random.nextFloat() * 360.0F, 0.0F); mob.snapTo(this.getX() + f1, this.getY() + 0.5, this.getZ() + f2, this.random.nextFloat() * 360.0F, 0.0F);
- }); - });
- }
+ // CraftBukkit start + // CraftBukkit start
+ }, null, null); + }, null, null);
+ if (converted != null) { + if (converted != null) {
@@ -72,7 +79,7 @@
+ } + }
+ for (LivingEntity living : slimes) { + for (LivingEntity living : slimes) {
+ this.level().addFreshEntity(living, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SLIME_SPLIT); + this.level().addFreshEntity(living, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SLIME_SPLIT);
+ } }
+ // CraftBukkit end + // CraftBukkit end
} }
@@ -81,7 +88,7 @@
} }
@Override @Override
@@ -282,9 +_,13 @@ @@ -282,9 +310,13 @@ public class Slime extends Mob implements Enemy {
return checkMobSpawnRules(entityType, level, spawnReason, pos, random); return checkMobSpawnRules(entityType, level, spawnReason, pos, random);
} }
@@ -97,7 +104,7 @@
&& random.nextFloat() < 0.5F && random.nextFloat() < 0.5F
&& random.nextFloat() < level.getMoonBrightness() && random.nextFloat() < level.getMoonBrightness()
&& level.getMaxLocalRawBrightness(pos) <= random.nextInt(8)) { && 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); ChunkPos chunkPos = new ChunkPos(pos);
@@ -111,7 +118,7 @@
return checkMobSpawnRules(entityType, level, spawnReason, pos, random); 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()); return super.getDefaultDimensions(pose).scale(this.getSize());
} }
@@ -128,7 +135,7 @@
static class SlimeAttackGoal extends Goal { static class SlimeAttackGoal extends Goal {
private final Slime slime; private final Slime slime;
private int growTiredTimer; private int growTiredTimer;
@@ -368,7 +_,16 @@ @@ -368,7 +413,16 @@ public class Slime extends Mob implements Enemy {
@Override @Override
public boolean canUse() { public boolean canUse() {
LivingEntity target = this.slime.getTarget(); LivingEntity target = this.slime.getTarget();
@@ -146,7 +153,7 @@
} }
@Override @Override
@@ -380,7 +_,16 @@ @@ -380,7 +434,16 @@ public class Slime extends Mob implements Enemy {
@Override @Override
public boolean canContinueToUse() { public boolean canContinueToUse() {
LivingEntity target = this.slime.getTarget(); LivingEntity target = this.slime.getTarget();
@@ -164,7 +171,7 @@
} }
@Override @Override
@@ -399,6 +_,13 @@ @@ -399,6 +462,13 @@ public class Slime extends Mob implements Enemy {
slimeMoveControl.setDirection(this.slime.getYRot(), this.slime.isDealsDamage()); slimeMoveControl.setDirection(this.slime.getYRot(), this.slime.isDealsDamage());
} }
} }
@@ -178,7 +185,7 @@
} }
static class SlimeFloatGoal extends Goal { static class SlimeFloatGoal extends Goal {
@@ -412,7 +_,7 @@ @@ -412,7 +482,7 @@ public class Slime extends Mob implements Enemy {
@Override @Override
public boolean canUse() { public boolean canUse() {
@@ -187,7 +194,7 @@
} }
@Override @Override
@@ -442,7 +_,7 @@ @@ -442,7 +512,7 @@ public class Slime extends Mob implements Enemy {
@Override @Override
public boolean canUse() { public boolean canUse() {
@@ -196,7 +203,7 @@
} }
@Override @Override
@@ -520,7 +_,7 @@ @@ -520,7 +590,7 @@ public class Slime extends Mob implements Enemy {
@Override @Override
public boolean canUse() { public boolean canUse() {
@@ -205,7 +212,7 @@
&& (this.slime.onGround() || this.slime.isInWater() || this.slime.isInLava() || this.slime.hasEffect(MobEffects.LEVITATION)) && (this.slime.onGround() || this.slime.isInWater() || this.slime.isInLava() || this.slime.hasEffect(MobEffects.LEVITATION))
&& this.slime.getMoveControl() instanceof Slime.SlimeMoveControl; && this.slime.getMoveControl() instanceof Slime.SlimeMoveControl;
} }
@@ -530,6 +_,11 @@ @@ -530,6 +600,11 @@ public class Slime extends Mob implements Enemy {
if (--this.nextRandomizeTime <= 0) { if (--this.nextRandomizeTime <= 0) {
this.nextRandomizeTime = this.adjustedTickDelay(40 + this.slime.getRandom().nextInt(60)); this.nextRandomizeTime = this.adjustedTickDelay(40 + this.slime.getRandom().nextInt(60));
this.chosenDegrees = this.slime.getRandom().nextInt(360); 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 --- a/net/minecraft/world/entity/monster/Vex.java
+++ b/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 @Override
public void start() { public void start() {
@@ -9,7 +17,7 @@
super.start(); super.start();
} }
} }
@@ -345,7 +_,10 @@ @@ -345,7 +345,10 @@ public class Vex extends Monster implements TraceableEntity {
for (int i = 0; i < 3; i++) { 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); 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 --- a/net/minecraft/world/entity/monster/Zombie.java
+++ b/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 { public class Zombie extends Monster {
private static final ResourceLocation SPEED_MODIFIER_BABY_ID = ResourceLocation.withDefaultNamespace("baby"); 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 ResourceLocation REINFORCEMENT_CALLER_CHARGE_ID = ResourceLocation.withDefaultNamespace("reinforcement_caller_charge");
private static final AttributeModifier ZOMBIE_REINFORCEMENT_CALLEE_CHARGE = new AttributeModifier( private static final AttributeModifier ZOMBIE_REINFORCEMENT_CALLEE_CHARGE = new AttributeModifier(
ResourceLocation.withDefaultNamespace("reinforcement_callee_charge"), -0.05F, AttributeModifier.Operation.ADD_VALUE 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_BABY = false;
private static final boolean DEFAULT_CAN_BREAK_DOORS = false; private static final boolean DEFAULT_CAN_BREAK_DOORS = false;
private static final int DEFAULT_IN_WATER_TIME = 0; private static final int DEFAULT_IN_WATER_TIME = 0;
@@ -28,7 +36,7 @@
} }
public Zombie(Level level) { public Zombie(Level level) {
@@ -106,7 +_,7 @@ @@ -106,7 +106,7 @@ public class Zombie extends Monster {
@Override @Override
protected void registerGoals() { protected void registerGoals() {
@@ -37,7 +45,7 @@
this.goalSelector.addGoal(8, new LookAtPlayerGoal(this, Player.class, 8.0F)); this.goalSelector.addGoal(8, new LookAtPlayerGoal(this, Player.class, 8.0F));
this.goalSelector.addGoal(8, new RandomLookAroundGoal(this)); this.goalSelector.addGoal(8, new RandomLookAroundGoal(this));
this.addBehaviourGoals(); this.addBehaviourGoals();
@@ -118,7 +_,7 @@ @@ -118,7 +118,7 @@ public class Zombie extends Monster {
this.goalSelector.addGoal(7, new WaterAvoidingRandomStrollGoal(this, 1.0)); this.goalSelector.addGoal(7, new WaterAvoidingRandomStrollGoal(this, 1.0));
this.targetSelector.addGoal(1, new HurtByTargetGoal(this).setAlertOthers(ZombifiedPiglin.class)); this.targetSelector.addGoal(1, new HurtByTargetGoal(this).setAlertOthers(ZombifiedPiglin.class));
this.targetSelector.addGoal(2, new NearestAttackableTargetGoal<>(this, Player.class, true)); 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(3, new NearestAttackableTargetGoal<>(this, IronGolem.class, true));
this.targetSelector.addGoal(5, new NearestAttackableTargetGoal<>(this, Turtle.class, 10, true, false, Turtle.BABY_ON_LAND_SELECTOR)); 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 @Override
protected int getBaseExperienceReward(ServerLevel level) { protected int getBaseExperienceReward(ServerLevel level) {
@@ -64,7 +72,7 @@
} }
@Override @Override
@@ -184,9 +_,9 @@ @@ -184,9 +189,9 @@ public class Zombie extends Monster {
this.getEntityData().set(DATA_BABY_ID, childZombie); this.getEntityData().set(DATA_BABY_ID, childZombie);
if (this.level() != null && !this.level().isClientSide) { if (this.level() != null && !this.level().isClientSide) {
AttributeInstance attribute = this.getAttribute(Attributes.MOVEMENT_SPEED); 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(); super.aiStep();
} }
@@ -90,7 +98,7 @@
public void startUnderWaterConversion(int conversionTime) { public void startUnderWaterConversion(int conversionTime) {
this.conversionTime = conversionTime; this.conversionTime = conversionTime;
this.getEntityData().set(DATA_DROWNED_CONVERSION_ID, true); 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) { protected void convertToZombieType(EntityType<? extends Zombie> entityType) {
@@ -138,19 +146,19 @@
public boolean isSunSensitive() { public boolean isSunSensitive() {
- return true; - return true;
- }
+ return this.shouldBurnInDay; // Paper - Add more Zombie API + return this.shouldBurnInDay; // Paper - Add more Zombie API
+ } }
+
+ // Paper start - Add more Zombie API + // Paper start - Add more Zombie API
+ public void setShouldBurnInDay(boolean shouldBurnInDay) { + public void setShouldBurnInDay(boolean shouldBurnInDay) {
+ this.shouldBurnInDay = shouldBurnInDay; + this.shouldBurnInDay = shouldBurnInDay;
+ } + }
+ // Paper end - Add more Zombie API + // Paper end - Add more Zombie API
+
@Override @Override
public boolean hurtServer(ServerLevel level, DamageSource damageSource, float amount) { 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) if (SpawnPlacements.isSpawnPositionOk(type, level, blockPos)
&& SpawnPlacements.checkSpawnRules(type, level, EntitySpawnReason.REINFORCEMENT, blockPos, level.random)) { && SpawnPlacements.checkSpawnRules(type, level, EntitySpawnReason.REINFORCEMENT, blockPos, level.random)) {
zombie.setPos(i1, i2, i3); zombie.setPos(i1, i2, i3);
@@ -167,7 +175,7 @@
AttributeInstance attribute = this.getAttribute(Attributes.SPAWN_REINFORCEMENTS_CHANCE); AttributeInstance attribute = this.getAttribute(Attributes.SPAWN_REINFORCEMENTS_CHANCE);
AttributeModifier modifier = attribute.getModifier(REINFORCEMENT_CALLER_CHARGE_ID); AttributeModifier modifier = attribute.getModifier(REINFORCEMENT_CALLER_CHARGE_ID);
double d = modifier != null ? modifier.amount() : 0.0; double d = modifier != null ? modifier.amount() : 0.0;
@@ -356,7 +_,12 @@ @@ -356,7 +387,12 @@ public class Zombie extends Monster {
if (flag) { if (flag) {
float effectiveDifficulty = this.level().getCurrentDifficultyAt(this.blockPosition()).getEffectiveDifficulty(); float effectiveDifficulty = this.level().getCurrentDifficultyAt(this.blockPosition()).getEffectiveDifficulty();
if (this.getMainHandItem().isEmpty() && this.isOnFire() && this.random.nextFloat() < effectiveDifficulty * 0.3F) { 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.putBoolean("CanBreakDoors", this.canBreakDoors());
compound.putInt("InWaterTime", this.isInWater() ? this.inWaterTime : -1); compound.putInt("InWaterTime", this.isInWater() ? this.inWaterTime : -1);
compound.putInt("DrownedConversionTime", this.isUnderWaterConverting() ? this.conversionTime : -1); compound.putInt("DrownedConversionTime", this.isUnderWaterConverting() ? this.conversionTime : -1);
@@ -189,7 +197,7 @@
} }
@Override @Override
@@ -430,13 +_,15 @@ @@ -430,13 +467,15 @@ public class Zombie extends Monster {
} else { } else {
this.getEntityData().set(DATA_DROWNED_CONVERSION_ID, false); this.getEntityData().set(DATA_DROWNED_CONVERSION_ID, false);
} }
@@ -207,7 +215,7 @@
return flag; return flag;
} }
@@ -472,7 +_,7 @@ @@ -472,7 +511,7 @@ public class Zombie extends Monster {
spawnGroupData = super.finalizeSpawn(level, difficulty, spawnReason, spawnGroupData); spawnGroupData = super.finalizeSpawn(level, difficulty, spawnReason, spawnGroupData);
float specialMultiplier = difficulty.getSpecialMultiplier(); float specialMultiplier = difficulty.getSpecialMultiplier();
if (spawnReason != EntitySpawnReason.CONVERSION) { if (spawnReason != EntitySpawnReason.CONVERSION) {
@@ -216,7 +224,7 @@
} }
if (spawnGroupData == null) { if (spawnGroupData == null) {
@@ -499,7 +_,7 @@ @@ -499,7 +538,7 @@ public class Zombie extends Monster {
chicken1.finalizeSpawn(level, difficulty, EntitySpawnReason.JOCKEY, null); chicken1.finalizeSpawn(level, difficulty, EntitySpawnReason.JOCKEY, null);
chicken1.setChickenJockey(true); chicken1.setChickenJockey(true);
this.startRiding(chicken1); 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 --- a/net/minecraft/world/entity/monster/ZombieVillager.java
+++ b/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) { public void startConverting(@Nullable UUID conversionStarter, int villagerConversionTime) {
@@ -24,7 +32,7 @@
} }
@Override @Override
@@ -190,7 +_,7 @@ @@ -190,7 +198,7 @@ public class ZombieVillager extends Zombie implements VillagerDataHolder {
} }
private void finishConversion(ServerLevel level) { private void finishConversion(ServerLevel level) {
@@ -33,7 +41,7 @@
EntityType.VILLAGER, EntityType.VILLAGER,
ConversionParams.single(this, false, false), ConversionParams.single(this, false, false),
villager -> { 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.finalizeSpawn(level, level.getCurrentDifficultyAt(villager.blockPosition()), EntitySpawnReason.CONVERSION, null);
villager.refreshBrain(level); villager.refreshBrain(level);
if (this.conversionStarter != null) { 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 --- a/net/minecraft/world/entity/monster/piglin/Piglin.java
+++ b/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.ATE_RECENTLY,
MemoryModuleType.NEAREST_REPELLENT MemoryModuleType.NEAREST_REPELLENT
); );
@@ -13,7 +21,7 @@
public Piglin(EntityType<? extends AbstractPiglin> entityType, Level level) { public Piglin(EntityType<? extends AbstractPiglin> entityType, Level level) {
super(entityType, 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("IsBaby", this.isBaby());
compound.putBoolean("CannotHunt", this.cannotHunt); compound.putBoolean("CannotHunt", this.cannotHunt);
this.writeInventoryToTag(compound, this.registryAccess()); this.writeInventoryToTag(compound, this.registryAccess());
@@ -24,7 +32,7 @@
} }
@Override @Override
@@ -144,6 +_,10 @@ @@ -144,6 +154,10 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento
this.setBaby(compound.getBooleanOr("IsBaby", false)); this.setBaby(compound.getBooleanOr("IsBaby", false));
this.setCannotHunt(compound.getBooleanOr("CannotHunt", false)); this.setCannotHunt(compound.getBooleanOr("CannotHunt", false));
this.readInventoryFromTag(compound, this.registryAccess()); this.readInventoryFromTag(compound, this.registryAccess());
@@ -35,7 +43,7 @@
} }
@VisibleForDebug @VisibleForDebug
@@ -321,7 +_,9 @@ @@ -321,7 +335,9 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento
@Override @Override
protected void finishConversion(ServerLevel serverLevel) { protected void finishConversion(ServerLevel serverLevel) {
PiglinAi.cancelAdmiring(serverLevel, this); PiglinAi.cancelAdmiring(serverLevel, this);
@@ -45,7 +53,7 @@
super.finishConversion(serverLevel); super.finishConversion(serverLevel);
} }
@@ -397,7 +_,7 @@ @@ -397,7 +413,7 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento
} }
protected void holdInOffHand(ItemStack stack) { protected void holdInOffHand(ItemStack stack) {
@@ -54,7 +62,7 @@
this.setItemSlot(EquipmentSlot.OFFHAND, stack); this.setItemSlot(EquipmentSlot.OFFHAND, stack);
this.setGuaranteedDrop(EquipmentSlot.OFFHAND); this.setGuaranteedDrop(EquipmentSlot.OFFHAND);
} else { } else {
@@ -422,15 +_,15 @@ @@ -422,15 +438,15 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento
return false; return false;
} else { } else {
TagKey<Item> preferredWeaponType = this.getPreferredWeaponType(); 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 --- a/net/minecraft/world/entity/player/Player.java
+++ b/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 static final int DEFAULT_CURRENT_IMPULSE_CONTEXT_RESET_GRACE_TIME = 0;
private long timeEntitySatOnShoulder; private long timeEntitySatOnShoulder;
final Inventory inventory; final Inventory inventory;
@@ -9,7 +17,7 @@
public final InventoryMenu inventoryMenu; public final InventoryMenu inventoryMenu;
public AbstractContainerMenu containerMenu; public AbstractContainerMenu containerMenu;
protected FoodData foodData = new FoodData(); protected FoodData foodData = new FoodData();
@@ -208,6 +_,18 @@ @@ -208,6 +208,18 @@ public abstract class Player extends LivingEntity {
public Entity currentExplosionCause; public Entity currentExplosionCause;
private boolean ignoreFallDamageFromCurrentImpulse = false; private boolean ignoreFallDamageFromCurrentImpulse = false;
private int currentImpulseContextResetGraceTime = 0; private int currentImpulseContextResetGraceTime = 0;
@@ -28,7 +36,7 @@
public Player(Level level, BlockPos pos, float yRot, GameProfile gameProfile) { public Player(Level level, BlockPos pos, float yRot, GameProfile gameProfile) {
super(EntityType.PLAYER, level); super(EntityType.PLAYER, level);
@@ -276,6 +_,13 @@ @@ -276,6 +288,13 @@ public abstract class Player extends LivingEntity {
if (this.isSleeping()) { if (this.isSleeping()) {
this.sleepCounter++; this.sleepCounter++;
@@ -42,7 +50,7 @@
if (this.sleepCounter > 100) { if (this.sleepCounter > 100) {
this.sleepCounter = 100; this.sleepCounter = 100;
} }
@@ -293,7 +_,7 @@ @@ -293,7 +312,7 @@ public abstract class Player extends LivingEntity {
this.updateIsUnderwater(); this.updateIsUnderwater();
super.tick(); super.tick();
if (!this.level().isClientSide && this.containerMenu != null && !this.containerMenu.stillValid(this)) { if (!this.level().isClientSide && this.containerMenu != null && !this.containerMenu.stillValid(this)) {
@@ -51,7 +59,7 @@
this.containerMenu = this.inventoryMenu; this.containerMenu = this.inventoryMenu;
} }
@@ -380,7 +_,7 @@ @@ -380,7 +399,7 @@ public abstract class Player extends LivingEntity {
} }
private void turtleHelmetTick() { private void turtleHelmetTick() {
@@ -60,7 +68,7 @@
} }
private boolean isEquipped(Item item) { 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() { public void closeContainer() {
this.containerMenu = this.inventoryMenu; this.containerMenu = this.inventoryMenu;
} }
@@ -538,8 +_,14 @@ @@ -538,8 +569,14 @@ public abstract class Player extends LivingEntity {
public void rideTick() { public void rideTick() {
if (!this.level().isClientSide && this.wantsToStopRiding() && this.isPassenger()) { if (!this.level().isClientSide && this.wantsToStopRiding() && this.isPassenger()) {
this.stopRiding(); this.stopRiding();
@@ -96,7 +104,7 @@
super.rideTick(); super.rideTick();
this.oBob = this.bob; this.oBob = this.bob;
this.bob = 0.0F; this.bob = 0.0F;
@@ -598,6 +_,7 @@ @@ -598,6 +635,7 @@ public abstract class Player extends LivingEntity {
this.playShoulderEntityAmbientSound(this.getShoulderEntityLeft()); this.playShoulderEntityAmbientSound(this.getShoulderEntityLeft());
this.playShoulderEntityAmbientSound(this.getShoulderEntityRight()); this.playShoulderEntityAmbientSound(this.getShoulderEntityRight());
if (!this.level().isClientSide && (this.fallDistance > 0.5 || this.isInWater()) || this.abilities.flying || this.isSleeping() || this.isInPowderSnow) { if (!this.level().isClientSide && (this.fallDistance > 0.5 || this.isInWater()) || this.abilities.flying || this.isSleeping() || this.isInPowderSnow) {
@@ -104,7 +112,7 @@
this.removeEntitiesOnShoulder(); this.removeEntitiesOnShoulder();
} }
} }
@@ -841,10 +_,10 @@ @@ -841,10 +879,10 @@ public abstract class Player extends LivingEntity {
if (this.isDeadOrDying()) { if (this.isDeadOrDying()) {
return false; return false;
} else { } else {
@@ -117,7 +125,7 @@
} }
if (level.getDifficulty() == Difficulty.EASY) { 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; BlocksAttacks blocksAttacks = itemBlockingWith != null ? itemBlockingWith.get(DataComponents.BLOCKS_ATTACKS) : null;
float secondsToDisableBlocking = entity.getSecondsToDisableBlocking(); float secondsToDisableBlocking = entity.getSecondsToDisableBlocking();
if (secondsToDisableBlocking > 0.0F && blocksAttacks != null) { 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) { public boolean canHarmPlayer(Player other) {
@@ -175,7 +183,7 @@
} }
@Override @Override
@@ -894,7 +_,12 @@ @@ -894,7 +959,12 @@ public abstract class Player extends LivingEntity {
} }
@Override @Override
@@ -189,7 +197,7 @@
if (!this.isInvulnerableTo(level, damageSource)) { if (!this.isInvulnerableTo(level, damageSource)) {
amount = this.getDamageAfterArmorAbsorb(damageSource, amount); amount = this.getDamageAfterArmorAbsorb(damageSource, amount);
amount = this.getDamageAfterMagicAbsorb(damageSource, amount); amount = this.getDamageAfterMagicAbsorb(damageSource, amount);
@@ -906,7 +_,7 @@ @@ -906,7 +976,7 @@ public abstract class Player extends LivingEntity {
} }
if (var8 != 0.0F) { if (var8 != 0.0F) {
@@ -198,7 +206,7 @@
this.getCombatTracker().recordDamage(damageSource, var8); this.getCombatTracker().recordDamage(damageSource, var8);
this.setHealth(this.getHealth() - var8); this.setHealth(this.getHealth() - var8);
if (var8 < 3.4028235E37F) { if (var8 < 3.4028235E37F) {
@@ -916,6 +_,7 @@ @@ -916,6 +986,7 @@ public abstract class Player extends LivingEntity {
this.gameEvent(GameEvent.ENTITY_DAMAGE); this.gameEvent(GameEvent.ENTITY_DAMAGE);
} }
} }
@@ -206,7 +214,7 @@
} }
public boolean isTextFilteringEnabled() { public boolean isTextFilteringEnabled() {
@@ -997,13 +_,19 @@ @@ -997,13 +1068,19 @@ public abstract class Player extends LivingEntity {
@Override @Override
public void removeVehicle() { public void removeVehicle() {
@@ -228,7 +236,7 @@
} }
@Override @Override
@@ -1082,8 +_,17 @@ @@ -1082,8 +1159,17 @@ public abstract class Player extends LivingEntity {
} }
public void attack(Entity target) { public void attack(Entity target) {
@@ -248,7 +256,7 @@
float f = this.isAutoSpinAttack() ? this.autoSpinAttackDmg : (float)this.getAttributeValue(Attributes.ATTACK_DAMAGE); float f = this.isAutoSpinAttack() ? this.autoSpinAttackDmg : (float)this.getAttributeValue(Attributes.ATTACK_DAMAGE);
ItemStack weaponItem = this.getWeaponItem(); ItemStack weaponItem = this.getWeaponItem();
DamageSource damageSource = Optional.ofNullable(weaponItem.getItem().getDamageSource(this)).orElse(this.damageSources().playerAttack(this)); 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); float attackStrengthScale = this.getAttackStrengthScale(0.5F);
f *= 0.2F + attackStrengthScale * attackStrengthScale * 0.8F; f *= 0.2F + attackStrengthScale * attackStrengthScale * 0.8F;
f1 *= attackStrengthScale; f1 *= attackStrengthScale;
@@ -281,7 +289,7 @@
flag1 = true; flag1 = true;
} else { } else {
flag1 = false; flag1 = false;
@@ -1118,7 +_,9 @@ @@ -1118,7 +1211,9 @@ public abstract class Player extends LivingEntity {
&& !this.isPassenger() && !this.isPassenger()
&& target instanceof LivingEntity && target instanceof LivingEntity
&& !this.isSprinting(); && !this.isSprinting();
@@ -291,7 +299,7 @@
f *= 1.5F; f *= 1.5F;
} }
@@ -1145,17 +_,23 @@ @@ -1145,17 +1240,23 @@ public abstract class Player extends LivingEntity {
if (target instanceof LivingEntity livingEntity1) { if (target instanceof LivingEntity livingEntity1) {
livingEntity1.knockback( livingEntity1.knockback(
f4 * 0.5F, Mth.sin(this.getYRot() * (float) (Math.PI / 180.0)), -Mth.cos(this.getYRot() * (float) (Math.PI / 180.0)) 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) { if (flag3) {
@@ -1169,42 +_,59 @@ @@ -1169,42 +1270,59 @@ public abstract class Player extends LivingEntity {
&& !(livingEntity2 instanceof ArmorStand armorStand && armorStand.isMarker()) && !(livingEntity2 instanceof ArmorStand armorStand && armorStand.isMarker())
&& this.distanceToSqr(livingEntity2) < 9.0) { && this.distanceToSqr(livingEntity2) < 9.0) {
float f6 = this.getEnchantedDamage(livingEntity2, f5, damageSource) * attackStrengthScale; 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 @Override
@@ -412,7 +420,7 @@
this.inventoryMenu.removed(this); this.inventoryMenu.removed(this);
if (this.containerMenu != null && this.hasContainerOpen()) { if (this.containerMenu != null && this.hasContainerOpen()) {
this.doCloseContainer(); this.doCloseContainer();
@@ -1355,6 +_,12 @@ @@ -1355,6 +1474,12 @@ public abstract class Player extends LivingEntity {
} }
public Either<Player.BedSleepingProblem, Unit> startSleepInBed(BlockPos bedPos) { public Either<Player.BedSleepingProblem, Unit> startSleepInBed(BlockPos bedPos) {
@@ -425,7 +433,7 @@
this.startSleeping(bedPos); this.startSleeping(bedPos);
this.sleepCounter = 0; this.sleepCounter = 0;
return Either.right(Unit.INSTANCE); return Either.right(Unit.INSTANCE);
@@ -1466,7 +_,7 @@ @@ -1466,7 +1591,7 @@ public abstract class Player extends LivingEntity {
@Override @Override
public boolean causeFallDamage(double fallDistance, float damageMultiplier, DamageSource damageSource) { public boolean causeFallDamage(double fallDistance, float damageMultiplier, DamageSource damageSource) {
@@ -434,7 +442,7 @@
return false; return false;
} else { } else {
if (fallDistance >= 2.0) { if (fallDistance >= 2.0) {
@@ -1507,7 +_,15 @@ @@ -1507,7 +1632,15 @@ public abstract class Player extends LivingEntity {
} }
public void startFallFlying() { public void startFallFlying() {
@@ -451,7 +459,7 @@
} }
@Override @Override
@@ -1613,15 +_,35 @@ @@ -1613,15 +1746,35 @@ public abstract class Player extends LivingEntity {
public int getXpNeededForNextLevel() { public int getXpNeededForNextLevel() {
if (this.experienceLevel >= 30) { if (this.experienceLevel >= 30) {
return 112 + (this.experienceLevel - 30) * 9; 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() { public void removeEntitiesOnShoulder() {
if (this.timeEntitySatOnShoulder + 20L < this.level().getGameTime()) { if (this.timeEntitySatOnShoulder + 20L < this.level().getGameTime()) {
@@ -549,7 +557,7 @@
} }
@Nullable @Nullable
@@ -1926,17 +_,32 @@ @@ -1926,17 +2108,32 @@ public abstract class Player extends LivingEntity {
return ImmutableList.of(Pose.STANDING, Pose.CROUCHING, Pose.SWIMMING); return ImmutableList.of(Pose.STANDING, Pose.CROUCHING, Pose.SWIMMING);
} }
@@ -584,7 +592,7 @@
for (int i = 0; i < this.inventory.getContainerSize(); i++) { for (int i = 0; i < this.inventory.getContainerSize(); i++) {
ItemStack item = this.inventory.getItem(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; 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() { 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 --- a/net/minecraft/world/entity/projectile/AbstractThrownPotion.java
+++ b/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 @Override
protected void onHit(HitResult result) { protected void onHit(HitResult result) {
super.onHit(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 --- a/net/minecraft/world/entity/projectile/EyeOfEnder.java
+++ b/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) { public void signalTo(BlockPos pos) {
@@ -13,7 +21,7 @@
double d = pos.getX(); double d = pos.getX();
int y = pos.getY(); int y = pos.getY();
double d1 = pos.getZ(); double d1 = pos.getZ();
@@ -89,8 +_,10 @@ @@ -89,8 +95,10 @@ public class EyeOfEnder extends Entity implements ItemSupplier {
this.tz = d1; this.tz = d1;
} }
@@ -24,7 +32,7 @@
} }
@Override @Override
@@ -164,7 +_,7 @@ @@ -164,7 +172,7 @@ public class EyeOfEnder extends Entity implements ItemSupplier {
this.life++; this.life++;
if (this.life > 80 && !this.level().isClientSide) { if (this.life > 80 && !this.level().isClientSide) {
this.playSound(SoundEvents.ENDER_EYE_DEATH, 1.0F, 1.0F); 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 --- a/net/minecraft/world/entity/projectile/FireworkRocketEntity.java
+++ b/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; public int lifetime = 0;
@Nullable @Nullable
public LivingEntity attachedToEntity; public LivingEntity attachedToEntity;
@@ -8,7 +16,7 @@
public FireworkRocketEntity(EntityType<? extends FireworkRocketEntity> entityType, Level level) { public FireworkRocketEntity(EntityType<? extends FireworkRocketEntity> entityType, Level level) {
super(entityType, 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) { if (!this.noPhysics && this.isAlive() && hitResultOnMoveVector.getType() != HitResult.Type.MISS) {
@@ -17,7 +25,7 @@
this.hasImpulse = true; 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) { 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); level.broadcastEntityEvent(this, (byte)17);
this.gameEvent(GameEvent.EXPLODE, this.getOwner()); this.gameEvent(GameEvent.EXPLODE, this.getOwner());
this.dealExplosionDamage(level); 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()); BlockPos blockPos = new BlockPos(result.getBlockPos());
this.level().getBlockState(blockPos).entityInside(this.level(), blockPos, this, InsideBlockEffectApplier.NOOP); this.level().getBlockState(blockPos).entityInside(this.level(), blockPos, this, InsideBlockEffectApplier.NOOP);
if (this.level() instanceof ServerLevel serverLevel && this.hasExplosion()) { if (this.level() instanceof ServerLevel serverLevel && this.hasExplosion()) {
@@ -64,7 +72,7 @@
} }
super.onHitBlock(result); 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); RegistryOps<Tag> registryOps = this.registryAccess().createSerializationContext(NbtOps.INSTANCE);
compound.store("FireworksItem", ItemStack.CODEC, registryOps, this.getItem()); compound.store("FireworksItem", ItemStack.CODEC, registryOps, this.getItem());
compound.putBoolean("ShotAtAngle", this.entityData.get(DATA_SHOT_AT_ANGLE)); compound.putBoolean("ShotAtAngle", this.entityData.get(DATA_SHOT_AT_ANGLE));
@@ -72,7 +80,7 @@
} }
@Override @Override
@@ -296,6 +_,7 @@ @@ -296,6 +310,7 @@ public class FireworkRocketEntity extends Projectile implements ItemSupplier {
RegistryOps<Tag> registryOps = this.registryAccess().createSerializationContext(NbtOps.INSTANCE); 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_ID_FIREWORKS_ITEM, compound.read("FireworksItem", ItemStack.CODEC, registryOps).orElse(getDefaultItem()));
this.entityData.set(DATA_SHOT_AT_ANGLE, compound.getBooleanOr("ShotAtAngle", false)); 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 --- a/net/minecraft/world/entity/projectile/LargeFireball.java
+++ b/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) { public LargeFireball(EntityType<? extends LargeFireball> entityType, Level level) {
super(entityType, level); super(entityType, level);
@@ -14,7 +22,7 @@
} }
@Override @Override
@@ -31,8 +_,13 @@ @@ -31,8 +33,13 @@ public class LargeFireball extends Fireball {
super.onHit(result); super.onHit(result);
if (this.level() instanceof ServerLevel serverLevel) { if (this.level() instanceof ServerLevel serverLevel) {
boolean _boolean = serverLevel.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING); 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 @Override
public void readAdditionalSaveData(CompoundTag compound) { public void readAdditionalSaveData(CompoundTag compound) {
super.readAdditionalSaveData(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 --- a/net/minecraft/world/entity/projectile/Projectile.java
+++ b/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; public boolean hasBeenShot = false;
@Nullable @Nullable
private Entity lastDeflectedBy; private Entity lastDeflectedBy;
@@ -8,11 +16,10 @@
Projectile(EntityType<? extends Projectile> entityType, Level level) { Projectile(EntityType<? extends Projectile> entityType, Level level) {
super(entityType, level); super(entityType, level);
@@ -57,15 +_,36 @@ @@ -57,15 +58,36 @@ public abstract class Projectile extends Entity implements TraceableEntity {
this.ownerUUID = owner.getUUID(); this.ownerUUID = owner.getUUID();
this.cachedOwner = owner; this.cachedOwner = owner;
} }
- }
+ // Paper start - Refresh ProjectileSource for projectiles + // Paper start - Refresh ProjectileSource for projectiles
+ else { + else {
+ this.ownerUUID = null; + 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) { + if (this.cachedOwner != null && !this.cachedOwner.isRemoved() && this.projectileSource == null && this.cachedOwner.getBukkitEntity() instanceof org.bukkit.projectiles.ProjectileSource projSource) {
+ this.projectileSource = projSource; + this.projectileSource = projSource;
+ } + }
+ } }
+ // Paper end - Refresh ProjectileSource for projectiles + // Paper end - Refresh ProjectileSource for projectiles
@Nullable @Nullable
@@ -46,7 +53,7 @@
return this.cachedOwner; return this.cachedOwner;
} else { } else {
return null; return null;
@@ -98,6 +_,7 @@ @@ -98,6 +120,7 @@ public abstract class Projectile extends Entity implements TraceableEntity {
@Override @Override
protected void readAdditionalSaveData(CompoundTag compound) { protected void readAdditionalSaveData(CompoundTag compound) {
this.setOwnerThroughUUID(compound.read("Owner", UUIDUtil.CODEC).orElse(null)); this.setOwnerThroughUUID(compound.read("Owner", UUIDUtil.CODEC).orElse(null));
@@ -54,7 +61,7 @@
this.leftOwner = compound.getBooleanOr("LeftOwner", false); this.leftOwner = compound.getBooleanOr("LeftOwner", false);
this.hasBeenShot = compound.getBooleanOr("HasBeenShot", 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)); 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); this.shoot(f, f1, f2, velocity, inaccuracy);
Vec3 knownMovement = shooter.getKnownMovement(); Vec3 knownMovement = shooter.getKnownMovement();
@@ -69,7 +76,7 @@
} }
@Override @Override
@@ -193,7 +_,12 @@ @@ -193,7 +223,12 @@ public abstract class Projectile extends Entity implements TraceableEntity {
public static <T extends Projectile> T spawnProjectileFromRotation( public static <T extends Projectile> T spawnProjectileFromRotation(
Projectile.ProjectileFactory<T> factory, ServerLevel level, ItemStack spawnedFrom, LivingEntity owner, float z, float velocity, float innaccuracy 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), factory.create(level, owner, spawnedFrom),
level, level,
spawnedFrom, spawnedFrom,
@@ -218,7 +_,13 @@ @@ -218,7 +253,13 @@ public abstract class Projectile extends Entity implements TraceableEntity {
public static <T extends Projectile> T spawnProjectileUsingShoot( public static <T extends Projectile> T spawnProjectileUsingShoot(
T projectile, ServerLevel level, ItemStack spawnedFrom, double x, double y, double z, float velocity, float inaccuracy 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) { 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) { public static <T extends Projectile> T spawnProjectile(T projectile, ServerLevel level, ItemStack stack, Consumer<T> adapter) {
@@ -112,10 +119,9 @@
- level.addFreshEntity(projectile); - level.addFreshEntity(projectile);
- projectile.applyOnProjectileSpawned(level, stack); - projectile.applyOnProjectileSpawned(level, stack);
- return projectile; - return projectile;
- }
+ return new Delayed<>(projectile, level, stack); // Paper - delayed projectile spawning + return new Delayed<>(projectile, level, stack); // Paper - delayed projectile spawning
+ } }
+
+ // Paper start - delayed projectile spawning + // Paper start - delayed projectile spawning
+ public record Delayed<T extends Projectile>( + public record Delayed<T extends Projectile>(
+ T projectile, + T projectile,
@@ -146,10 +152,11 @@
+ } + }
+ } + }
+ // Paper end - delayed projectile spawning + // Paper end - delayed projectile spawning
+
public void applyOnProjectileSpawned(ServerLevel level, ItemStack spawnedFrom) { public void applyOnProjectileSpawned(ServerLevel level, ItemStack spawnedFrom) {
EnchantmentHelper.onProjectileSpawned(level, spawnedFrom, this, item -> {}); 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) { protected ProjectileDeflection hitTargetOrDeflectSelf(HitResult hitResult) {
if (hitResult.getType() == HitResult.Type.ENTITY) { if (hitResult.getType() == HitResult.Type.ENTITY) {
EntityHitResult entityHitResult = (EntityHitResult)hitResult; 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) { public boolean deflect(ProjectileDeflection deflection, @Nullable Entity entity, @Nullable Entity owner, boolean deflectedByPlayer) {
deflection.deflect(this, entity, this.random); deflection.deflect(this, entity, this.random);
if (!this.level().isClientSide) { if (!this.level().isClientSide) {
@@ -182,7 +189,7 @@
this.onDeflection(entity, deflectedByPlayer); this.onDeflection(entity, deflectedByPlayer);
} }
@@ -309,15 +_,35 @@ @@ -309,15 +402,35 @@ public abstract class Projectile extends Entity implements TraceableEntity {
} }
protected void onHitBlock(BlockHitResult result) { protected void onHitBlock(BlockHitResult result) {
@@ -218,7 +225,7 @@
return owner == null || this.leftOwner || !owner.isPassengerOfSameVehicle(target); 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) { 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 --- a/net/minecraft/world/entity/projectile/ShulkerBullet.java
+++ b/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.finalTarget = finalTarget;
this.currentMoveDirection = Direction.UP; this.currentMoveDirection = Direction.UP;
this.selectNextMoveDirection(axis); this.selectNextMoveDirection(axis);
- }
+ this.projectileSource = shooter.getBukkitLivingEntity(); // CraftBukkit + this.projectileSource = shooter.getBukkitLivingEntity(); // CraftBukkit
+ } }
+
+ // CraftBukkit start + // CraftBukkit start
+ @Nullable + @Nullable
+ public Entity getTarget() { + public Entity getTarget() {
@@ -20,10 +27,11 @@
+ this.selectNextMoveDirection(Direction.Axis.X); + this.selectNextMoveDirection(Direction.Axis.X);
+ } + }
+ // CraftBukkit end + // CraftBukkit end
+
@Override @Override
public SoundSource getSoundSource() { public SoundSource getSoundSource() {
@@ -180,7 +_,7 @@ return SoundSource.HOSTILE;
@@ -180,7 +194,7 @@ public class ShulkerBullet extends Projectile {
@Override @Override
public void checkDespawn() { public void checkDespawn() {
if (this.level().getDifficulty() == Difficulty.PEACEFUL) { 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) { if (hitResult != null && this.isAlive() && hitResult.getType() != HitResult.Type.MISS) {
@@ -41,7 +49,7 @@
} }
ProjectileUtil.rotateTowardsMovement(this, 0.5F); ProjectileUtil.rotateTowardsMovement(this, 0.5F);
@@ -299,7 +_,7 @@ @@ -299,7 +313,7 @@ public class ShulkerBullet extends Projectile {
} }
if (entity instanceof LivingEntity livingEntity1) { if (entity instanceof LivingEntity livingEntity1) {
@@ -50,7 +58,7 @@
} }
} }
} }
@@ -312,14 +_,20 @@ @@ -312,14 +326,20 @@ public class ShulkerBullet extends Projectile {
} }
private void destroy() { private void destroy() {
@@ -73,7 +81,7 @@
} }
@Override @Override
@@ -334,9 +_,14 @@ @@ -334,9 +354,14 @@ public class ShulkerBullet extends Projectile {
@Override @Override
public boolean hurtServer(ServerLevel level, DamageSource damageSource, float amount) { 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 --- a/net/minecraft/world/entity/projectile/ThrownEnderpearl.java
+++ b/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(); Vec3 vec3 = this.oldPosition();
if (owner instanceof ServerPlayer serverPlayer) { if (owner instanceof ServerPlayer serverPlayer) {
if (serverPlayer.connection.isAcceptingMessages()) { if (serverPlayer.connection.isAcceptingMessages()) {
@@ -20,7 +28,7 @@
} }
} }
@@ -134,15 +_,17 @@ @@ -134,15 +141,17 @@ public class ThrownEnderpearl extends ThrowableItemProjectile {
owner.setPortalCooldown(); owner.setPortalCooldown();
} }
@@ -44,7 +52,7 @@
} }
this.playSound(serverLevel, vec3); this.playSound(serverLevel, vec3);
@@ -158,9 +_,9 @@ @@ -158,9 +167,9 @@ public class ThrownEnderpearl extends ThrowableItemProjectile {
this.playSound(serverLevel, vec3); 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 if (owner instanceof ServerPlayer serverPlayer
&& !owner.isAlive() && !owner.isAlive()
&& serverPlayer.serverLevel().getGameRules().getBoolean(GameRules.RULE_ENDER_PEARLS_VANISH_ON_DEATH)) { && serverPlayer.serverLevel().getGameRules().getBoolean(GameRules.RULE_ENDER_PEARLS_VANISH_ON_DEATH)) {
@@ -65,7 +73,7 @@
} else { } else {
super.tick(); super.tick();
} }
@@ -208,7 +_,7 @@ @@ -208,7 +217,7 @@ public class ThrownEnderpearl extends ThrowableItemProjectile {
public Entity teleport(TeleportTransition teleportTransition) { public Entity teleport(TeleportTransition teleportTransition) {
Entity entity = super.teleport(teleportTransition); Entity entity = super.teleport(teleportTransition);
if (entity != null) { if (entity != null) {
@@ -74,7 +82,7 @@
} }
return entity; return entity;
@@ -216,7 +_,7 @@ @@ -216,7 +225,7 @@ public class ThrownEnderpearl extends ThrowableItemProjectile {
@Override @Override
public boolean canTeleport(Level fromLevel, Level toLevel) { 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 --- a/net/minecraft/world/entity/projectile/ThrownExperienceBottle.java
+++ b/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) { protected void onHit(HitResult result) {
super.onHit(result); super.onHit(result);
if (this.level() instanceof ServerLevel) { 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 --- a/net/minecraft/world/entity/projectile/ThrownLingeringPotion.java
+++ b/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 @Override
@@ -9,7 +17,7 @@
AreaEffectCloud areaEffectCloud = new AreaEffectCloud(this.level(), this.getX(), this.getY(), this.getZ()); AreaEffectCloud areaEffectCloud = new AreaEffectCloud(this.level(), this.getX(), this.getY(), this.getZ());
if (this.getOwner() instanceof LivingEntity livingEntity) { if (this.getOwner() instanceof LivingEntity livingEntity) {
areaEffectCloud.setOwner(livingEntity); areaEffectCloud.setOwner(livingEntity);
@@ -42,6 +_,15 @@ @@ -42,6 +42,15 @@ public class ThrownLingeringPotion extends AbstractThrownPotion {
areaEffectCloud.setWaitTime(10); areaEffectCloud.setWaitTime(10);
areaEffectCloud.setRadiusPerTick(-areaEffectCloud.getRadius() / areaEffectCloud.getDuration()); areaEffectCloud.setRadiusPerTick(-areaEffectCloud.getRadius() / areaEffectCloud.getDuration());
areaEffectCloud.applyComponentsFromItemStack(stack); 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 --- a/net/minecraft/world/entity/projectile/ThrownSplashPotion.java
+++ b/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 @Override
@@ -15,7 +23,7 @@
if (!entitiesOfClass.isEmpty()) { if (!entitiesOfClass.isEmpty()) {
Entity effectSource = this.getEffectSource(); Entity effectSource = this.getEffectSource();
@@ -50,12 +_,31 @@ @@ -50,12 +51,31 @@ public class ThrownSplashPotion extends AbstractThrownPotion {
double d = this.distanceToSqr(livingEntity); double d = this.distanceToSqr(livingEntity);
if (d < 16.0) { if (d < 16.0) {
double d1; double d1;
@@ -47,7 +55,7 @@
for (MobEffectInstance mobEffectInstance : allEffects) { for (MobEffectInstance mobEffectInstance : allEffects) {
Holder<MobEffect> effect = mobEffectInstance.getEffect(); Holder<MobEffect> effect = mobEffectInstance.getEffect();
if (effect.value().isInstantenous()) { if (effect.value().isInstantenous()) {
@@ -66,7 +_,7 @@ @@ -66,7 +86,7 @@ public class ThrownSplashPotion extends AbstractThrownPotion {
effect, i, mobEffectInstance.getAmplifier(), mobEffectInstance.isAmbient(), mobEffectInstance.isVisible() effect, i, mobEffectInstance.getAmplifier(), mobEffectInstance.isAmbient(), mobEffectInstance.isVisible()
); );
if (!mobEffectInstance1.endsWithin(20)) { 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 --- a/net/minecraft/world/entity/vehicle/AbstractMinecart.java
+++ b/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) { protected AbstractMinecart(EntityType<?> entityType, Level level) {
super(entityType, level); super(entityType, level);
@@ -153,11 +_,19 @@ @@ -153,11 +164,19 @@ public abstract class AbstractMinecart extends VehicleEntity {
@Override @Override
public boolean canCollideWith(Entity entity) { public boolean canCollideWith(Entity entity) {
@@ -40,7 +48,7 @@
return true; return true;
} }
@@ -258,6 +_,14 @@ @@ -258,6 +277,14 @@ public abstract class AbstractMinecart extends VehicleEntity {
@Override @Override
public void tick() { public void tick() {
@@ -55,7 +63,7 @@
if (this.getHurtTime() > 0) { if (this.getHurtTime() > 0) {
this.setHurtTime(this.getHurtTime() - 1); this.setHurtTime(this.getHurtTime() - 1);
} }
@@ -267,8 +_,20 @@ @@ -267,8 +294,20 @@ public abstract class AbstractMinecart extends VehicleEntity {
} }
this.checkBelowWorld(); this.checkBelowWorld();
@@ -77,7 +85,7 @@
this.updateInWaterStateAndDoFluidPushing(); this.updateInWaterStateAndDoFluidPushing();
if (this.isInLava()) { if (this.isInLava()) {
this.lavaIgnite(); this.lavaIgnite();
@@ -350,12 +_,16 @@ @@ -350,12 +389,16 @@ public abstract class AbstractMinecart extends VehicleEntity {
Vec3 deltaMovement = this.getDeltaMovement(); Vec3 deltaMovement = this.getDeltaMovement();
this.setDeltaMovement(Mth.clamp(deltaMovement.x, -maxSpeed, maxSpeed), deltaMovement.y, Mth.clamp(deltaMovement.z, -maxSpeed, maxSpeed)); this.setDeltaMovement(Mth.clamp(deltaMovement.x, -maxSpeed, maxSpeed), deltaMovement.y, Mth.clamp(deltaMovement.z, -maxSpeed, maxSpeed));
if (this.onGround()) { 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.setDisplayOffset(compound.getIntOr("DisplayOffset", this.getDefaultDisplayOffset()));
this.flipped = compound.getBooleanOr("FlippedRotation", false); this.flipped = compound.getBooleanOr("FlippedRotation", false);
this.firstTick = compound.getBooleanOr("HasTicked", false); this.firstTick = compound.getBooleanOr("HasTicked", false);
@@ -112,7 +120,7 @@
} }
@Override @Override
@@ -472,13 +_,27 @@ @@ -472,13 +524,27 @@ public abstract class AbstractMinecart extends VehicleEntity {
compound.putBoolean("FlippedRotation", this.flipped); compound.putBoolean("FlippedRotation", this.flipped);
compound.putBoolean("HasTicked", this.firstTick); compound.putBoolean("HasTicked", this.firstTick);
@@ -140,7 +148,7 @@
double d = entity.getX() - this.getX(); double d = entity.getX() - this.getX();
double d1 = entity.getZ() - this.getZ(); double d1 = entity.getZ() - this.getZ();
double d2 = d * d + d1 * d1; double d2 = d * d + d1 * d1;
@@ -587,4 +_,26 @@ @@ -587,4 +653,26 @@ public abstract class AbstractMinecart extends VehicleEntity {
public boolean isFurnace() { public boolean isFurnace() {
return false; 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 --- a/net/minecraft/world/entity/vehicle/ContainerEntity.java
+++ b/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) { default void addChestVehicleSaveData(CompoundTag tag, HolderLookup.Provider levelRegistry) {
if (this.getContainerLootTable() != null) { if (this.getContainerLootTable() != null) {
tag.putString("LootTable", this.getContainerLootTable().location().toString()); tag.putString("LootTable", this.getContainerLootTable().location().toString());
@@ -15,7 +23,7 @@
} }
default void readChestVehicleSaveData(CompoundTag tag, HolderLookup.Provider levelRegistry) { 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); ResourceKey<LootTable> resourceKey = tag.read("LootTable", LootTable.KEY_CODEC).orElse(null);
this.setContainerLootTable(resourceKey); this.setContainerLootTable(resourceKey);
this.setContainerLootTableSeed(tag.getLongOr("LootTableSeed", 0L)); this.setContainerLootTableSeed(tag.getLongOr("LootTableSeed", 0L));
@@ -29,7 +37,7 @@
ContainerHelper.loadAllItems(tag, this.getItemStacks(), levelRegistry); ContainerHelper.loadAllItems(tag, this.getItemStacks(), levelRegistry);
} }
} }
@@ -89,19 +_,27 @@ @@ -89,19 +94,27 @@ public interface ContainerEntity extends Container, MenuProvider {
} }
default InteractionResult interactWithContainerVehicle(Player player) { default InteractionResult interactWithContainerVehicle(Player player) {
@@ -60,7 +68,7 @@
LootParams.Builder builder = new LootParams.Builder((ServerLevel)this.level()).withParameter(LootContextParams.ORIGIN, this.position()); LootParams.Builder builder = new LootParams.Builder((ServerLevel)this.level()).withParameter(LootContextParams.ORIGIN, this.position());
if (player != null) { if (player != null) {
builder.withLuck(player.getLuck()).withParameter(LootContextParams.THIS_ENTITY, player); 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) { default boolean isChestVehicleStillValid(Player player) {
return !this.isRemoved() && player.canInteractWithEntity(this.getBoundingBox(), 4.0); 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 --- a/net/minecraft/world/inventory/AnvilMenu.java
+++ b/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 ADDITIONAL_SLOT_X_PLACEMENT = 76;
private static final int RESULT_SLOT_X_PLACEMENT = 134; private static final int RESULT_SLOT_X_PLACEMENT = 134;
private static final int SLOT_Y_PLACEMENT = 47; private static final int SLOT_Y_PLACEMENT = 47;
@@ -13,7 +21,7 @@
public AnvilMenu(int containerId, Inventory playerInventory) { public AnvilMenu(int containerId, Inventory playerInventory) {
this(containerId, playerInventory, ContainerLevelAccess.NULL); this(containerId, playerInventory, ContainerLevelAccess.NULL);
@@ -68,7 +_,7 @@ @@ -68,7 +74,7 @@ public class AnvilMenu extends ItemCombinerMenu {
@Override @Override
protected boolean mayPickup(Player player, boolean hasStack) { protected boolean mayPickup(Player player, boolean hasStack) {
@@ -22,7 +30,7 @@
} }
@Override @Override
@@ -89,12 +_,22 @@ @@ -89,12 +95,22 @@ public class AnvilMenu extends ItemCombinerMenu {
this.inputSlots.setItem(1, ItemStack.EMPTY); this.inputSlots.setItem(1, ItemStack.EMPTY);
} }
@@ -46,7 +54,7 @@
if (blockState1 == null) { if (blockState1 == null) {
level.removeBlock(blockPos, false); level.removeBlock(blockPos, false);
level.levelEvent(1029, blockPos, 0); level.levelEvent(1029, blockPos, 0);
@@ -127,8 +_,8 @@ @@ -127,8 +143,8 @@ public class AnvilMenu extends ItemCombinerMenu {
if (itemStack.isDamageableItem() && item.isValidRepairItem(item1)) { if (itemStack.isDamageableItem() && item.isValidRepairItem(item1)) {
int min = Math.min(itemStack.getDamageValue(), itemStack.getMaxDamage() / 4); int min = Math.min(itemStack.getDamageValue(), itemStack.getMaxDamage() / 4);
if (min <= 0) { if (min <= 0) {
@@ -57,7 +65,7 @@
return; return;
} }
@@ -143,8 +_,8 @@ @@ -143,8 +159,8 @@ public class AnvilMenu extends ItemCombinerMenu {
this.repairItemCountCost = i2; this.repairItemCountCost = i2;
} else { } else {
if (!hasStoredEnchantments && (!itemStack.is(item1.getItem()) || !itemStack.isDamageableItem())) { if (!hasStoredEnchantments && (!itemStack.is(item1.getItem()) || !itemStack.isDamageableItem())) {
@@ -68,7 +76,7 @@
return; return;
} }
@@ -190,7 +_,7 @@ @@ -190,7 +206,7 @@ public class AnvilMenu extends ItemCombinerMenu {
flag1 = true; flag1 = true;
} else { } else {
flag = true; flag = true;
@@ -77,7 +85,7 @@
intValue = enchantment.getMaxLevel(); intValue = enchantment.getMaxLevel();
} }
@@ -208,8 +_,8 @@ @@ -208,8 +224,8 @@ public class AnvilMenu extends ItemCombinerMenu {
} }
if (flag1 && !flag) { if (flag1 && !flag) {
@@ -88,7 +96,7 @@
return; return;
} }
} }
@@ -234,14 +_,16 @@ @@ -234,14 +250,16 @@ public class AnvilMenu extends ItemCombinerMenu {
} }
if (i1 == i && i1 > 0) { if (i1 == i && i1 > 0) {
@@ -108,7 +116,7 @@
itemStack = ItemStack.EMPTY; itemStack = ItemStack.EMPTY;
} }
@@ -259,12 +_,13 @@ @@ -259,12 +277,13 @@ public class AnvilMenu extends ItemCombinerMenu {
EnchantmentHelper.setEnchantments(itemStack, mutable.toImmutable()); EnchantmentHelper.setEnchantments(itemStack, mutable.toImmutable());
} }
@@ -125,7 +133,7 @@
} }
public static int calculateIncreasedRepairCost(int oldRepairCost) { public static int calculateIncreasedRepairCost(int oldRepairCost) {
@@ -285,6 +_,7 @@ @@ -285,6 +304,7 @@ public class AnvilMenu extends ItemCombinerMenu {
} }
this.createResult(); this.createResult();
@@ -133,7 +141,7 @@
return true; return true;
} else { } else {
return false; return false;
@@ -300,4 +_,19 @@ @@ -300,4 +320,19 @@ public class AnvilMenu extends ItemCombinerMenu {
public int getCost() { public int getCost() {
return this.cost.get(); 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 --- a/net/minecraft/world/item/FireworkRocketItem.java
+++ b/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(); ItemStack itemInHand = context.getItemInHand();
Vec3 clickLocation = context.getClickLocation(); Vec3 clickLocation = context.getClickLocation();
Direction clickedFace = context.getClickedFace(); Direction clickedFace = context.getClickedFace();
@@ -9,7 +17,7 @@
new FireworkRocketEntity( new FireworkRocketEntity(
level, level,
context.getPlayer(), context.getPlayer(),
@@ -39,9 +_,14 @@ @@ -39,9 +39,14 @@ public class FireworkRocketItem extends Item implements ProjectileItem {
itemInHand itemInHand
), ),
serverLevel, serverLevel,
@@ -26,7 +34,7 @@
} }
return InteractionResult.SUCCESS; return InteractionResult.SUCCESS;
@@ -52,9 +_,21 @@ @@ -52,9 +57,21 @@ public class FireworkRocketItem extends Item implements ProjectileItem {
if (player.isFallFlying()) { if (player.isFallFlying()) {
ItemStack itemInHand = player.getItemInHand(hand); ItemStack itemInHand = player.getItemInHand(hand);
if (level instanceof ServerLevel serverLevel) { 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 --- a/net/minecraft/world/item/LeadItem.java
+++ b/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)) { if (blockState.is(BlockTags.FENCES)) {
Player player = context.getPlayer(); Player player = context.getPlayer();
if (!level.isClientSide && player != null) { if (!level.isClientSide && player != null) {
@@ -47,7 +55,7 @@
leashable.setLeashedTo(leashFenceKnotEntity, true); 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)); level.gameEvent(GameEvent.BLOCK_ATTACH, pos, GameEvent.Context.of(player));
return InteractionResult.SUCCESS_SERVER; return InteractionResult.SUCCESS_SERVER;
} else { } else {
@@ -59,12 +67,13 @@
return InteractionResult.PASS; return InteractionResult.PASS;
} }
} }
+
+ // CraftBukkit start + // CraftBukkit start
+ public static InteractionResult bindPlayerMobs(Player player, Level world, BlockPos pos) { + public static InteractionResult bindPlayerMobs(Player player, Level world, BlockPos pos) {
+ return LeadItem.bindPlayerMobs(player, world, pos, net.minecraft.world.InteractionHand.MAIN_HAND); + return LeadItem.bindPlayerMobs(player, world, pos, net.minecraft.world.InteractionHand.MAIN_HAND);
+ } + }
+ // CraftBukkit end + // CraftBukkit end
+
public static List<Leashable> leashableInArea(Level level, BlockPos pos, Predicate<Leashable> predicate) { public static List<Leashable> leashableInArea(Level level, BlockPos pos, Predicate<Leashable> predicate) {
double d = 7.0; 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 --- a/net/minecraft/world/item/component/ResolvableProfile.java
+++ b/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( instance -> instance.group(
ExtraCodecs.PLAYER_NAME.optionalFieldOf("name").forGetter(ResolvableProfile::name), ExtraCodecs.PLAYER_NAME.optionalFieldOf("name").forGetter(ResolvableProfile::name),
UUIDUtil.CODEC.optionalFieldOf("id").forGetter(ResolvableProfile::id), UUIDUtil.CODEC.optionalFieldOf("id").forGetter(ResolvableProfile::id),
@@ -12,7 +20,7 @@
); );
public static final Codec<ResolvableProfile> CODEC = Codec.withAlternative( public static final Codec<ResolvableProfile> CODEC = Codec.withAlternative(
FULL_CODEC, ExtraCodecs.PLAYER_NAME, name -> new ResolvableProfile(Optional.of(name), Optional.empty(), new PropertyMap()) 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()) { if (this.isResolved()) {
return CompletableFuture.completedFuture(this); return CompletableFuture.completedFuture(this);
} else { } 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 --- a/net/minecraft/world/item/crafting/RecipeManager.java
+++ b/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()); LOGGER.info("Loaded {} recipes", object.values().size());
} }
@@ -27,7 +35,7 @@
List<SelectableRecipe.SingleInputEntry<StonecutterRecipe>> list = new ArrayList<>(); List<SelectableRecipe.SingleInputEntry<StonecutterRecipe>> list = new ArrayList<>();
List<RecipeManager.IngredientCollector> list1 = RECIPE_PROPERTY_SETS.entrySet() List<RecipeManager.IngredientCollector> list1 = RECIPE_PROPERTY_SETS.entrySet()
.stream() .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) { 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) { public Optional<RecipeHolder<?>> byKey(ResourceKey<Recipe<?>> key) {
@@ -184,6 +_,7 @@ @@ -184,6 +206,7 @@ public class RecipeManager extends SimplePreparableReloadListener<RecipeMap> imp
@Nullable @Nullable
public RecipeManager.ServerDisplayInfo getRecipeFromDisplay(RecipeDisplayId display) { public RecipeManager.ServerDisplayInfo getRecipeFromDisplay(RecipeDisplayId display) {
@@ -47,11 +55,10 @@
return this.allDisplays.get(display.index()); return this.allDisplays.get(display.index());
} }
@@ -199,6 +_,22 @@ @@ -200,6 +223,22 @@ public class RecipeManager extends SimplePreparableReloadListener<RecipeMap> imp
Recipe<?> recipe1 = Recipe.CODEC.parse(registries.createSerializationContext(JsonOps.INSTANCE), json).getOrThrow(JsonParseException::new);
return new RecipeHolder<>(recipe, recipe1); return new RecipeHolder<>(recipe, recipe1);
} }
+
+ // CraftBukkit start + // CraftBukkit start
+ public boolean removeRecipe(ResourceKey<Recipe<?>> mcKey) { + public boolean removeRecipe(ResourceKey<Recipe<?>> mcKey) {
+ boolean removed = this.recipes.removeRecipe((ResourceKey<Recipe<RecipeInput>>) (ResourceKey) mcKey); // Paper - generic fix + boolean removed = this.recipes.removeRecipe((ResourceKey<Recipe<RecipeInput>>) (ResourceKey) mcKey); // Paper - generic fix
@@ -67,6 +74,7 @@
+ this.finalizeRecipeLoading(); + this.finalizeRecipeLoading();
+ } + }
+ // CraftBukkit end + // CraftBukkit end
+
public static <I extends RecipeInput, T extends Recipe<I>> RecipeManager.CachedCheck<I, T> createCheck(final RecipeType<T> recipeType) { public static <I extends RecipeInput, T extends Recipe<I>> RecipeManager.CachedCheck<I, T> createCheck(final RecipeType<T> recipeType) {
return new RecipeManager.CachedCheck<I, T>() { 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 --- a/net/minecraft/world/level/BaseSpawner.java
+++ b/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 maxNearbyEntities = 6;
public int requiredPlayerRange = 16; public int requiredPlayerRange = 16;
public int spawnRange = 4; public int spawnRange = 4;
@@ -17,7 +25,7 @@
} }
public void clientTick(Level level, BlockPos pos) { 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) { public void serverTick(ServerLevel serverLevel, BlockPos pos) {
@@ -39,7 +47,7 @@
} else { } else {
boolean flag = false; boolean flag = false;
RandomSource random = serverLevel.getRandom(); RandomSource random = serverLevel.getRandom();
@@ -118,6 +_,21 @@ @@ -118,6 +126,21 @@ public abstract class BaseSpawner {
continue; continue;
} }
@@ -61,7 +69,7 @@
Entity entity = EntityType.loadEntityRecursive(entityToSpawn, serverLevel, EntitySpawnReason.SPAWNER, entity1 -> { Entity entity = EntityType.loadEntityRecursive(entityToSpawn, serverLevel, EntitySpawnReason.SPAWNER, entity1 -> {
entity1.snapTo(vec3.x, vec3.y, vec3.z, entity1.getYRot(), entity1.getXRot()); entity1.snapTo(vec3.x, vec3.y, vec3.z, entity1.getYRot(), entity1.getXRot());
return entity1; return entity1;
@@ -138,6 +_,7 @@ @@ -138,6 +161,7 @@ public abstract class BaseSpawner {
return; return;
} }
@@ -69,7 +77,7 @@
entity.snapTo(entity.getX(), entity.getY(), entity.getZ(), random.nextFloat() * 360.0F, 0.0F); entity.snapTo(entity.getX(), entity.getY(), entity.getZ(), random.nextFloat() * 360.0F, 0.0F);
if (entity instanceof Mob mob) { if (entity instanceof Mob mob) {
if (nextSpawnData.getCustomSpawnRules().isEmpty() && !mob.checkSpawnRules(serverLevel, EntitySpawnReason.SPAWNER) 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); nextSpawnData.getEquipment().ifPresent(mob::equip);
@@ -93,7 +101,7 @@
this.delay(serverLevel, pos); this.delay(serverLevel, pos);
return; return;
} }
@@ -165,7 +_,7 @@ @@ -165,7 +202,7 @@ public abstract class BaseSpawner {
((Mob)entity).spawnAnim(); ((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) { public void load(@Nullable Level level, BlockPos pos, CompoundTag tag) {
@@ -121,7 +129,7 @@
this.spawnCount = tag.getIntOr("SpawnCount", 4); this.spawnCount = tag.getIntOr("SpawnCount", 4);
this.maxNearbyEntities = tag.getIntOr("MaxNearbyEntities", 6); this.maxNearbyEntities = tag.getIntOr("MaxNearbyEntities", 6);
this.requiredPlayerRange = tag.getIntOr("RequiredPlayerRange", 16); this.requiredPlayerRange = tag.getIntOr("RequiredPlayerRange", 16);
@@ -203,9 +_,19 @@ @@ -203,9 +242,19 @@ public abstract class BaseSpawner {
} }
public CompoundTag save(CompoundTag tag) { 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 --- a/net/minecraft/world/level/GameRules.java
+++ b/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; import org.slf4j.Logger;
public class GameRules { public class GameRules {
@@ -15,7 +23,7 @@
public static final int DEFAULT_RANDOM_TICK_SPEED = 3; public static final int DEFAULT_RANDOM_TICK_SPEED = 3;
static final Logger LOGGER = LogUtils.getLogger(); static final Logger LOGGER = LogUtils.getLogger();
public static final Map<GameRules.Key<?>, GameRules.Type<?>> GAME_RULE_TYPES = Maps.newTreeMap(Comparator.comparing(entry -> entry.id)); 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) "sendCommandFeedback", GameRules.Category.CHAT, GameRules.BooleanValue.create(true)
); );
public static final GameRules.Key<GameRules.BooleanValue> RULE_REDUCEDDEBUGINFO = register( public static final GameRules.Key<GameRules.BooleanValue> RULE_REDUCEDDEBUGINFO = register(
@@ -28,7 +36,7 @@
serverPlayer.connection.send(new ClientboundEntityEventPacket(serverPlayer, b)); 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) "doWeatherCycle", GameRules.Category.UPDATES, GameRules.BooleanValue.create(true)
); );
public static final GameRules.Key<GameRules.BooleanValue> RULE_LIMITED_CRAFTING = register( 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)); 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) "doInsomnia", GameRules.Category.SPAWNING, GameRules.BooleanValue.create(true)
); );
public static final GameRules.Key<GameRules.BooleanValue> RULE_DO_IMMEDIATE_RESPAWN = register( 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)); 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( public static final GameRules.Key<GameRules.IntegerValue> RULE_MINECART_MAX_SPEED = register(
"minecartMaxSpeed", "minecartMaxSpeed",
GameRules.Category.MISC, GameRules.Category.MISC,
@@ -65,7 +73,7 @@
serverLevel.setDefaultSpawnPos(serverLevel.getSharedSpawnPos(), serverLevel.getSharedSpawnAngle()); 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 Map<GameRules.Key<?>, GameRules.Value<?>> rules;
private final FeatureFlagSet enabledFeatures; private final FeatureFlagSet enabledFeatures;
@@ -73,7 +81,7 @@
public static <T extends GameRules.Value<T>> GameRules.Type<T> getType(GameRules.Key<T> key) { public static <T extends GameRules.Value<T>> GameRules.Type<T> getType(GameRules.Key<T> key) {
return (GameRules.Type<T>)GAME_RULE_TYPES.get(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) { private GameRules(Map<GameRules.Key<?>, GameRules.Value<?>> rules, FeatureFlagSet enabledFeatures) {
this.rules = rules; this.rules = rules;
this.enabledFeatures = enabledFeatures; this.enabledFeatures = enabledFeatures;
@@ -96,7 +104,7 @@
if (value == null) { if (value == null) {
throw new IllegalArgumentException("Tried to access invalid game rule"); throw new IllegalArgumentException("Tried to access invalid game rule");
} else { } else {
@@ -314,13 +_,13 @@ @@ -314,13 +334,13 @@ public class GameRules {
} }
} }
@@ -114,7 +122,7 @@
} }
public boolean getBoolean(GameRules.Key<GameRules.BooleanValue> key) { 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> { public static class BooleanValue extends GameRules.Value<GameRules.BooleanValue> {
private boolean value; private boolean value;
@@ -123,7 +131,7 @@
return new GameRules.Type<>( return new GameRules.Type<>(
BoolArgumentType::bool, BoolArgumentType::bool,
type -> new GameRules.BooleanValue(type, defaultValue), type -> new GameRules.BooleanValue(type, defaultValue),
@@ -355,17 +_,21 @@ @@ -355,17 +375,21 @@ public class GameRules {
} }
@Override @Override
@@ -149,7 +157,7 @@
} }
@Override @Override
@@ -394,9 +_,9 @@ @@ -394,9 +418,9 @@ public class GameRules {
} }
@Override @Override
@@ -161,7 +169,7 @@
} }
} }
@@ -434,7 +_,7 @@ @@ -434,7 +458,7 @@ public class GameRules {
public static class IntegerValue extends GameRules.Value<GameRules.IntegerValue> { public static class IntegerValue extends GameRules.Value<GameRules.IntegerValue> {
private int value; private int value;
@@ -170,7 +178,7 @@
return new GameRules.Type<>( return new GameRules.Type<>(
IntegerArgumentType::integer, IntegerArgumentType::integer,
type -> new GameRules.IntegerValue(type, defaultValue), type -> new GameRules.IntegerValue(type, defaultValue),
@@ -446,7 +_,7 @@ @@ -446,7 +470,7 @@ public class GameRules {
} }
static GameRules.Type<GameRules.IntegerValue> create( static GameRules.Type<GameRules.IntegerValue> create(
@@ -179,7 +187,7 @@
) { ) {
return new GameRules.Type<>( return new GameRules.Type<>(
() -> IntegerArgumentType.integer(min, max), () -> IntegerArgumentType.integer(min, max),
@@ -468,17 +_,21 @@ @@ -468,17 +492,21 @@ public class GameRules {
} }
@Override @Override
@@ -205,7 +213,7 @@
} }
@Override @Override
@@ -529,13 +_,17 @@ @@ -529,13 +557,17 @@ public class GameRules {
} }
@Override @Override
@@ -225,7 +233,7 @@
final String id; final String id;
private final GameRules.Category category; private final GameRules.Category category;
@@ -575,7 +_,7 @@ @@ -575,7 +607,7 @@ public class GameRules {
public static class Type<T extends GameRules.Value<T>> { public static class Type<T extends GameRules.Value<T>> {
final Supplier<ArgumentType<?>> argument; final Supplier<ArgumentType<?>> argument;
private final Function<GameRules.Type<T>, T> constructor; private final Function<GameRules.Type<T>, T> constructor;
@@ -234,7 +242,7 @@
private final GameRules.VisitorCaller<T> visitorCaller; private final GameRules.VisitorCaller<T> visitorCaller;
final Class<T> valueClass; final Class<T> valueClass;
final FeatureFlagSet requiredFeatures; final FeatureFlagSet requiredFeatures;
@@ -583,7 +_,7 @@ @@ -583,7 +615,7 @@ public class GameRules {
Type( Type(
Supplier<ArgumentType<?>> argument, Supplier<ArgumentType<?>> argument,
Function<GameRules.Type<T>, T> constructor, Function<GameRules.Type<T>, T> constructor,
@@ -243,7 +251,7 @@
GameRules.VisitorCaller<T> visitorCaller, GameRules.VisitorCaller<T> visitorCaller,
Class<T> valueClass, Class<T> valueClass,
FeatureFlagSet requiredFeatures FeatureFlagSet requiredFeatures
@@ -611,6 +_,12 @@ @@ -611,6 +643,12 @@ public class GameRules {
public FeatureFlagSet requiredFeatures() { public FeatureFlagSet requiredFeatures() {
return this.requiredFeatures; return this.requiredFeatures;
} }
@@ -256,7 +264,7 @@
} }
public abstract static class Value<T extends GameRules.Value<T>> { public abstract static class Value<T extends GameRules.Value<T>> {
@@ -620,16 +_,16 @@ @@ -620,16 +658,16 @@ public class GameRules {
this.type = type; this.type = type;
} }
@@ -280,7 +288,7 @@
} }
} }
@@ -648,7 +_,7 @@ @@ -648,7 +686,7 @@ public class GameRules {
protected abstract T copy(); 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 --- a/net/minecraft/world/level/block/LavaCauldronBlock.java
+++ b/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 @Override
protected void entityInside(BlockState state, Level level, BlockPos pos, Entity entity, InsideBlockEffectApplier effectApplier) { 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 --- a/net/minecraft/world/level/block/LayeredCauldronBlock.java
+++ b/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 @Override
protected void entityInside(BlockState state, Level level, BlockPos pos, Entity entity, InsideBlockEffectApplier effectApplier) { 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); BlockState blockState = i == 0 ? Blocks.CAULDRON.defaultBlockState() : state.setValue(LEVEL, i);
- level.setBlockAndUpdate(pos, blockState); - level.setBlockAndUpdate(pos, blockState);
- level.gameEvent(GameEvent.BLOCK_CHANGE, pos, GameEvent.Context.of(blockState)); - level.gameEvent(GameEvent.BLOCK_CHANGE, pos, GameEvent.Context.of(blockState));
- }
+ return changeLevel(level, pos, blockState, entity, reason); // Paper + return changeLevel(level, pos, blockState, entity, reason); // Paper
+ } + }
+ // CraftBukkit start + // CraftBukkit start
+ // Paper start - Call CauldronLevelChangeEvent + // 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 + 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); + 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 + 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 + // Paper end - Call CauldronLevelChangeEvent
+ org.bukkit.craftbukkit.block.CraftBlockState newState = org.bukkit.craftbukkit.block.CraftBlockStates.getBlockState(level, pos); + org.bukkit.craftbukkit.block.CraftBlockState newState = org.bukkit.craftbukkit.block.CraftBlockStates.getBlockState(level, pos);
@@ -68,7 +75,7 @@
+ return true; + return true;
+ } + }
+ // CraftBukkit end + // CraftBukkit end
+
@Override @Override
public void handlePrecipitation(BlockState state, Level level, BlockPos pos, Biome.Precipitation precipitation) { public void handlePrecipitation(BlockState state, Level level, BlockPos pos, Biome.Precipitation precipitation) {
if (CauldronBlock.shouldHandlePrecipitation(level, precipitation) && state.getValue(LEVEL) != 3 && precipitation == this.precipitationType) { 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) { protected void receiveStalactiteDrip(BlockState state, Level level, BlockPos pos, Fluid fluid) {
if (!this.isFull(state)) { if (!this.isFull(state)) {
BlockState blockState = state.setValue(LEVEL, state.getValue(LEVEL) + 1); 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 --- a/net/minecraft/world/level/block/SculkSpreader.java
+++ b/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 chargeDecayRate;
private final int additionalDecayRate; private final int additionalDecayRate;
private List<SculkSpreader.ChargeCursor> cursors = new ArrayList<>(); private List<SculkSpreader.ChargeCursor> cursors = new ArrayList<>();
@@ -8,7 +16,7 @@
public SculkSpreader( public SculkSpreader(
boolean isWorldGeneration, TagKey<Block> replaceableBlocks, int growthSpawnCoat, int noGrowthRadius, int chargeDecayRate, int additionalDecayRate 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) { public void load(CompoundTag tag) {
this.cursors.clear(); this.cursors.clear();
@@ -17,7 +25,7 @@
} }
public void save(CompoundTag tag) { public void save(CompoundTag tag) {
@@ -110,13 +_,24 @@ @@ -110,13 +111,24 @@ public class SculkSpreader {
public void addCursors(BlockPos pos, int charge) { public void addCursors(BlockPos pos, int charge) {
while (charge > 0) { while (charge > 0) {
int min = Math.min(charge, 1000); 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 --- a/net/minecraft/world/level/block/SignBlock.java
+++ b/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) } else if (!this.otherPlayerIsEditingSign(player, signBlockEntity)
&& player.mayBuild() && player.mayBuild()
&& this.hasEditableText(player, signBlockEntity, isFacingFrontText)) { && this.hasEditableText(player, signBlockEntity, isFacingFrontText)) {
@@ -9,7 +17,7 @@
return InteractionResult.SUCCESS_SERVER; return InteractionResult.SUCCESS_SERVER;
} else { } else {
return InteractionResult.PASS; return InteractionResult.PASS;
@@ -175,7 +_,34 @@ @@ -175,7 +175,34 @@ public abstract class SignBlock extends BaseEntityBlock implements SimpleWaterlo
return woodType; return woodType;
} }
@@ -44,7 +52,7 @@
signEntity.setAllowedPlayerEditor(player.getUUID()); signEntity.setAllowedPlayerEditor(player.getUUID());
player.openTextEdit(signEntity, isFrontText); player.openTextEdit(signEntity, isFrontText);
} }
@@ -188,6 +_,6 @@ @@ -188,6 +215,6 @@ public abstract class SignBlock extends BaseEntityBlock implements SimpleWaterlo
@Nullable @Nullable
@Override @Override
public <T extends BlockEntity> BlockEntityTicker<T> getTicker(Level level, BlockState state, BlockEntityType<T> blockEntityType) { 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 --- a/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
+++ b/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<>(); public final Reference2IntOpenHashMap<ResourceKey<Recipe<?>>> recipesUsed = new Reference2IntOpenHashMap<>();
private final RecipeManager.CachedCheck<SingleRecipeInput, ? extends AbstractCookingRecipe> quickCheck; private final RecipeManager.CachedCheck<SingleRecipeInput, ? extends AbstractCookingRecipe> quickCheck;
@@ -10,10 +18,9 @@
protected AbstractFurnaceBlockEntity(BlockEntityType<?> type, BlockPos pos, BlockState blockState, RecipeType<? extends AbstractCookingRecipe> recipeType) { protected AbstractFurnaceBlockEntity(BlockEntityType<?> type, BlockPos pos, BlockState blockState, RecipeType<? extends AbstractCookingRecipe> recipeType) {
super(type, pos, blockState); super(type, pos, blockState);
this.quickCheck = RecipeManager.createCheck(recipeType); this.quickCheck = RecipeManager.createCheck(recipeType);
- }
+ this.recipeType = recipeType; // Paper - cook speed multiplier API + this.recipeType = recipeType; // Paper - cook speed multiplier API
+ } }
+
+ // CraftBukkit start - add fields and methods + // CraftBukkit start - add fields and methods
+ private int maxStack = MAX_STACK; + private int maxStack = MAX_STACK;
+ public List<org.bukkit.entity.HumanEntity> transaction = new java.util.ArrayList<>(); + public List<org.bukkit.entity.HumanEntity> transaction = new java.util.ArrayList<>();
@@ -48,10 +55,11 @@
+ this.maxStack = size; + this.maxStack = size;
+ } + }
+ // CraftBukkit end + // CraftBukkit end
+
private boolean isLit() { private boolean isLit() {
return this.litTimeRemaining > 0; 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.litTotalTime = tag.getShortOr("lit_total_time", (short)0);
this.recipesUsed.clear(); this.recipesUsed.clear();
this.recipesUsed.putAll(tag.read("RecipesUsed", RECIPES_USED_CODEC).orElse(Map.of())); this.recipesUsed.putAll(tag.read("RecipesUsed", RECIPES_USED_CODEC).orElse(Map.of()));
@@ -59,7 +67,7 @@
} }
@Override @Override
@@ -134,6 +_,7 @@ @@ -134,6 +173,7 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
tag.putShort("cooking_total_time", (short)this.cookingTotalTime); tag.putShort("cooking_total_time", (short)this.cookingTotalTime);
tag.putShort("lit_time_remaining", (short)this.litTimeRemaining); tag.putShort("lit_time_remaining", (short)this.litTimeRemaining);
tag.putShort("lit_total_time", (short)this.litTotalTime); tag.putShort("lit_total_time", (short)this.litTotalTime);
@@ -67,7 +75,7 @@
ContainerHelper.saveAllItems(tag, this.items, registries); ContainerHelper.saveAllItems(tag, this.items, registries);
tag.store("RecipesUsed", RECIPES_USED_CODEC, this.recipesUsed); 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(); int maxStackSize = furnace.getMaxStackSize();
if (!furnace.isLit() && canBurn(level.registryAccess(), recipeHolder, singleRecipeInput, furnace.items, maxStackSize)) { if (!furnace.isLit() && canBurn(level.registryAccess(), recipeHolder, singleRecipeInput, furnace.items, maxStackSize)) {
@@ -93,7 +101,7 @@
Item item = itemStack.getItem(); Item item = itemStack.getItem();
itemStack.shrink(1); itemStack.shrink(1);
if (itemStack.isEmpty()) { 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)) { if (furnace.isLit() && canBurn(level.registryAccess(), recipeHolder, singleRecipeInput, furnace.items, maxStackSize)) {
@@ -125,7 +133,7 @@
furnace.setRecipeUsed(recipeHolder); furnace.setRecipeUsed(recipeHolder);
} }
@@ -233,17 +_,47 @@ @@ -233,17 +301,47 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
@Nullable RecipeHolder<? extends AbstractCookingRecipe> recipe, @Nullable RecipeHolder<? extends AbstractCookingRecipe> recipe,
SingleRecipeInput recipeInput, SingleRecipeInput recipeInput,
NonNullList<ItemStack> items, NonNullList<ItemStack> items,
@@ -177,7 +185,7 @@
if (itemStack.is(Blocks.WET_SPONGE.asItem()) && !items.get(1).isEmpty() && items.get(1).is(Items.BUCKET)) { 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)); 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); return fuelValues.burnDuration(stack);
} }
@@ -196,7 +204,7 @@
} }
@Override @Override
@@ -306,7 +_,7 @@ @@ -306,7 +411,7 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
this.items.set(index, stack); this.items.set(index, stack);
stack.limitSize(this.getMaxStackSize(stack)); stack.limitSize(this.getMaxStackSize(stack));
if (index == 0 && !flag && this.level instanceof ServerLevel serverLevel) { if (index == 0 && !flag && this.level instanceof ServerLevel serverLevel) {
@@ -205,7 +213,7 @@
this.cookingTimer = 0; this.cookingTimer = 0;
this.setChanged(); this.setChanged();
} }
@@ -342,8 +_,8 @@ @@ -342,8 +447,8 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
public void awardUsedRecipes(Player player, List<ItemStack> items) { public void awardUsedRecipes(Player player, List<ItemStack> items) {
} }
@@ -216,7 +224,7 @@
player.awardRecipes(recipesToAwardAndPopExperience); player.awardRecipes(recipesToAwardAndPopExperience);
for (RecipeHolder<?> recipeHolder : 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) { 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 --- a/net/minecraft/world/level/block/entity/BannerBlockEntity.java
+++ b/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) { protected void saveAdditional(CompoundTag tag, HolderLookup.Provider registries) {
super.saveAdditional(tag, registries); super.saveAdditional(tag, registries);
RegistryOps<Tag> registryOps = registries.createSerializationContext(NbtOps.INSTANCE); RegistryOps<Tag> registryOps = registries.createSerializationContext(NbtOps.INSTANCE);
@@ -9,7 +17,7 @@
tag.store("patterns", BannerPatternLayers.CODEC, registryOps, this.patterns); 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); super.loadAdditional(tag, registries);
this.name = parseCustomNameSafe(tag.get("CustomName"), registries); this.name = parseCustomNameSafe(tag.get("CustomName"), registries);
RegistryOps<Tag> registryOps = registries.createSerializationContext(NbtOps.INSTANCE); RegistryOps<Tag> registryOps = registries.createSerializationContext(NbtOps.INSTANCE);
@@ -18,7 +26,7 @@
} }
@Override @Override
@@ -72,9 +_,18 @@ @@ -72,9 +72,18 @@ public class BannerBlockEntity extends BlockEntity implements Nameable {
return ClientboundBlockEntityDataPacket.create(this); return ClientboundBlockEntityDataPacket.create(this);
} }
@@ -37,7 +45,7 @@
} }
public BannerPatternLayers getPatterns() { public BannerPatternLayers getPatterns() {
@@ -94,7 +_,7 @@ @@ -94,7 +103,7 @@ public class BannerBlockEntity extends BlockEntity implements Nameable {
@Override @Override
protected void applyImplicitComponents(DataComponentGetter componentGetter) { protected void applyImplicitComponents(DataComponentGetter componentGetter) {
super.applyImplicitComponents(componentGetter); super.applyImplicitComponents(componentGetter);
@@ -46,7 +54,7 @@
this.name = componentGetter.get(DataComponents.CUSTOM_NAME); 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("patterns");
tag.remove("CustomName"); 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 --- a/net/minecraft/world/level/block/entity/BeaconBlockEntity.java
+++ b/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; return 3;
} }
}; };
@@ -54,7 +62,7 @@
@Nullable @Nullable
static Holder<MobEffect> filterEffect(@Nullable Holder<MobEffect> effect) { 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++; blockEntity.lastCheckY++;
} }
@@ -83,7 +91,7 @@
if (blockEntity.lastCheckY >= height) { if (blockEntity.lastCheckY >= height) {
blockEntity.lastCheckY = level.getMinY() - 1; blockEntity.lastCheckY = level.getMinY() - 1;
@@ -227,35 +_,100 @@ @@ -227,35 +283,100 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider, Name
@Override @Override
public void setRemoved() { public void setRemoved() {
@@ -117,32 +125,28 @@
- if (beaconLevel >= 4 && Objects.equals(primaryEffect, secondaryEffect)) { - if (beaconLevel >= 4 && Objects.equals(primaryEffect, secondaryEffect)) {
- i = 1; - 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 + 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 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 + 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 + 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 + 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 + 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 + 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 + // Paper start - diff out applyEffects logic components
+ // Generally smarter than spigot trying to split the logic up, as that diff is giant. + // Generally smarter than spigot trying to split the logic up, as that diff is giant.
+ private static int computeEffectDuration(final int beaconLevel) { + private static int computeEffectDuration(final int beaconLevel) {
@@ -177,7 +181,6 @@
} }
} }
} }
- }
+ return list; + return list;
+ } + }
+ +
@@ -197,12 +200,12 @@
+ if (!event.callEvent()) continue; + if (!event.callEvent()) continue;
+ player.addEffect(org.bukkit.craftbukkit.potion.CraftPotionUtil.fromBukkit(event.getEffect()), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.BEACON); + player.addEffect(org.bukkit.craftbukkit.potion.CraftPotionUtil.fromBukkit(event.getEffect()), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.BEACON);
+ } + }
+ } }
+ // Paper end - BeaconEffectEvent + // Paper end - BeaconEffectEvent
public static void playSound(Level level, BlockPos pos, SoundEvent sound) { public static void playSound(Level level, BlockPos pos, SoundEvent sound) {
level.playSound(null, pos, sound, SoundSource.BLOCKS, 1.0F, 1.0F); 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 @Nullable
private static Holder<MobEffect> loadEffect(CompoundTag tag, String key) { private static Holder<MobEffect> loadEffect(CompoundTag tag, String key) {
@@ -211,7 +214,7 @@
} }
@Override @Override
@@ -292,8 +_,10 @@ @@ -292,8 +413,10 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider, Name
super.loadAdditional(tag, registries); super.loadAdditional(tag, registries);
this.primaryPower = loadEffect(tag, "primary_effect"); this.primaryPower = loadEffect(tag, "primary_effect");
this.secondaryPower = loadEffect(tag, "secondary_effect"); this.secondaryPower = loadEffect(tag, "secondary_effect");
@@ -222,7 +225,7 @@
} }
@Override @Override
@@ -304,6 +_,7 @@ @@ -304,6 +427,7 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider, Name
tag.putInt("Levels", this.levels); tag.putInt("Levels", this.levels);
tag.storeNullable("CustomName", ComponentSerialization.CODEC, registries.createSerializationContext(NbtOps.INSTANCE), this.name); tag.storeNullable("CustomName", ComponentSerialization.CODEC, registries.createSerializationContext(NbtOps.INSTANCE), this.name);
this.lockKey.addToTag(tag, registries); this.lockKey.addToTag(tag, registries);
@@ -230,7 +233,7 @@
} }
public void setCustomName(@Nullable Component name) { public void setCustomName(@Nullable Component name) {
@@ -319,7 +_,7 @@ @@ -319,7 +443,7 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider, Name
@Nullable @Nullable
@Override @Override
public AbstractContainerMenu createMenu(int containerId, Inventory playerInventory, Player player) { 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 --- a/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java
+++ b/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(); private List<BeehiveBlockEntity.BeeData> stored = Lists.newArrayList();
@Nullable @Nullable
public BlockPos savedFlowerPos; public BlockPos savedFlowerPos;
@@ -8,7 +16,7 @@
public BeehiveBlockEntity(BlockPos pos, BlockState blockState) { public BeehiveBlockEntity(BlockPos pos, BlockState blockState) {
super(BlockEntityType.BEEHIVE, pos, blockState); super(BlockEntityType.BEEHIVE, pos, blockState);
@@ -112,7 +_,7 @@ @@ -112,7 +113,7 @@ public class BeehiveBlockEntity extends BlockEntity {
} }
public boolean isFull() { public boolean isFull() {
@@ -17,7 +25,7 @@
} }
public void emptyAllLivingFromHive(@Nullable Player player, BlockState state, BeehiveBlockEntity.BeeReleaseStatus releaseStatus) { 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) { for (Entity entity : list) {
if (entity instanceof Bee bee && player.position().distanceToSqr(entity.position()) <= 16.0) { if (entity instanceof Bee bee && player.position().distanceToSqr(entity.position()) <= 16.0) {
if (!this.isSedated()) { if (!this.isSedated()) {
@@ -26,7 +34,7 @@
} else { } else {
bee.setStayOutOfHiveCountdown(400); bee.setStayOutOfHiveCountdown(400);
} }
@@ -131,8 +_,14 @@ @@ -131,8 +132,14 @@ public class BeehiveBlockEntity extends BlockEntity {
} }
private List<Entity> releaseAllOccupants(BlockState state, BeehiveBlockEntity.BeeReleaseStatus releaseStatus) { private List<Entity> releaseAllOccupants(BlockState state, BeehiveBlockEntity.BeeReleaseStatus releaseStatus) {
@@ -42,7 +50,7 @@
if (!list.isEmpty()) { if (!list.isEmpty()) {
super.setChanged(); super.setChanged();
} }
@@ -145,6 +_,11 @@ @@ -145,6 +152,11 @@ public class BeehiveBlockEntity extends BlockEntity {
return this.stored.size(); return this.stored.size();
} }
@@ -54,7 +62,7 @@
public static int getHoneyLevel(BlockState state) { public static int getHoneyLevel(BlockState state) {
return state.getValue(BeehiveBlock.HONEY_LEVEL); return state.getValue(BeehiveBlock.HONEY_LEVEL);
} }
@@ -155,7 +_,16 @@ @@ -155,7 +167,16 @@ public class BeehiveBlockEntity extends BlockEntity {
} }
public void addOccupant(Bee bee) { public void addOccupant(Bee bee) {
@@ -72,7 +80,7 @@
bee.stopRiding(); bee.stopRiding();
bee.ejectPassengers(); bee.ejectPassengers();
bee.dropLeash(); 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())); this.level.gameEvent(GameEvent.BLOCK_CHANGE, blockPos, GameEvent.Context.of(bee, this.getBlockState()));
} }
@@ -81,7 +89,7 @@
super.setChanged(); super.setChanged();
} }
} }
@@ -198,7 +_,21 @@ @@ -198,7 +219,21 @@ public class BeehiveBlockEntity extends BlockEntity {
BeehiveBlockEntity.BeeReleaseStatus releaseStatus, BeehiveBlockEntity.BeeReleaseStatus releaseStatus,
@Nullable BlockPos storedFlowerPos @Nullable BlockPos storedFlowerPos
) { ) {
@@ -104,7 +112,7 @@
return false; return false;
} else { } else {
Direction direction = state.getValue(BeehiveBlock.FACING); Direction direction = state.getValue(BeehiveBlock.FACING);
@@ -209,6 +_,17 @@ @@ -209,6 +244,17 @@ public class BeehiveBlockEntity extends BlockEntity {
} else { } else {
Entity entity = occupant.createEntity(level, pos); Entity entity = occupant.createEntity(level, pos);
if (entity != null) { if (entity != null) {
@@ -122,7 +130,7 @@
if (entity instanceof Bee bee) { if (entity instanceof Bee bee) {
if (storedFlowerPos != null && !bee.hasSavedFlowerPos() && level.random.nextFloat() < 0.9F) { if (storedFlowerPos != null && !bee.hasSavedFlowerPos() && level.random.nextFloat() < 0.9F) {
bee.setSavedFlowerPos(storedFlowerPos); bee.setSavedFlowerPos(storedFlowerPos);
@@ -224,7 +_,13 @@ @@ -224,7 +270,13 @@ public class BeehiveBlockEntity extends BlockEntity {
i--; i--;
} }
@@ -137,7 +145,7 @@
} }
} }
} }
@@ -233,17 +_,19 @@ @@ -233,17 +285,19 @@ public class BeehiveBlockEntity extends BlockEntity {
storedInHives.add(bee); storedInHives.add(bee);
} }
@@ -158,7 +166,7 @@
} else { } else {
return false; return false;
} }
@@ -269,6 +_,11 @@ @@ -269,6 +323,11 @@ public class BeehiveBlockEntity extends BlockEntity {
flag = true; flag = true;
iterator.remove(); iterator.remove();
} }
@@ -170,7 +178,7 @@
} }
} }
@@ -292,9 +_,10 @@ @@ -292,9 +351,10 @@ public class BeehiveBlockEntity extends BlockEntity {
@Override @Override
protected void loadAdditional(CompoundTag tag, HolderLookup.Provider registries) { protected void loadAdditional(CompoundTag tag, HolderLookup.Provider registries) {
super.loadAdditional(tag, registries); super.loadAdditional(tag, registries);
@@ -182,7 +190,7 @@
} }
@Override @Override
@@ -302,12 +_,13 @@ @@ -302,12 +362,13 @@ public class BeehiveBlockEntity extends BlockEntity {
super.saveAdditional(tag, registries); super.saveAdditional(tag, registries);
tag.store("bees", BeehiveBlockEntity.Occupant.LIST_CODEC, this.getBees()); tag.store("bees", BeehiveBlockEntity.Occupant.LIST_CODEC, this.getBees());
tag.storeNullable("flower_pos", BlockPos.CODEC, this.savedFlowerPos); tag.storeNullable("flower_pos", BlockPos.CODEC, this.savedFlowerPos);
@@ -197,7 +205,7 @@
List<BeehiveBlockEntity.Occupant> list = componentGetter.getOrDefault(DataComponents.BEES, Bees.EMPTY).bees(); List<BeehiveBlockEntity.Occupant> list = componentGetter.getOrDefault(DataComponents.BEES, Bees.EMPTY).bees();
list.forEach(this::storeBee); list.forEach(this::storeBee);
} }
@@ -330,15 +_,18 @@ @@ -330,15 +391,18 @@ public class BeehiveBlockEntity extends BlockEntity {
static class BeeData { static class BeeData {
private final BeehiveBlockEntity.Occupant occupant; private final BeehiveBlockEntity.Occupant occupant;
@@ -217,7 +225,7 @@
} }
public BeehiveBlockEntity.Occupant toOccupant() { public BeehiveBlockEntity.Occupant toOccupant() {
@@ -409,6 +_,7 @@ @@ -409,6 +473,7 @@ public class BeehiveBlockEntity extends BlockEntity {
} }
private static void setBeeReleaseData(int ticksInHive, Bee bee) { private static void setBeeReleaseData(int ticksInHive, Bee bee) {
@@ -225,7 +233,7 @@
int age = bee.getAge(); int age = bee.getAge();
if (age < 0) { if (age < 0) {
bee.setAge(Math.min(0, age + ticksInHive)); 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)); 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 --- a/net/minecraft/world/level/block/entity/BlockEntity.java
+++ b/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; import org.slf4j.Logger;
public abstract class BlockEntity { public abstract class BlockEntity {
@@ -11,7 +19,7 @@
private static final Codec<BlockEntityType<?>> TYPE_CODEC = BuiltInRegistries.BLOCK_ENTITY_TYPE.byNameCodec(); private static final Codec<BlockEntityType<?>> TYPE_CODEC = BuiltInRegistries.BLOCK_ENTITY_TYPE.byNameCodec();
private static final Logger LOGGER = LogUtils.getLogger(); private static final Logger LOGGER = LogUtils.getLogger();
private final BlockEntityType<?> type; private final BlockEntityType<?> type;
@@ -48,6 +_,7 @@ @@ -48,6 +52,7 @@ public abstract class BlockEntity {
this.worldPosition = pos.immutable(); this.worldPosition = pos.immutable();
this.validateBlockState(blockState); this.validateBlockState(blockState);
this.blockState = blockState; this.blockState = blockState;
@@ -19,7 +27,7 @@
} }
private void validateBlockState(BlockState state) { private void validateBlockState(BlockState state) {
@@ -64,6 +_,7 @@ @@ -64,6 +69,7 @@ public abstract class BlockEntity {
int intOr = tag.getIntOr("x", 0); int intOr = tag.getIntOr("x", 0);
int intOr1 = tag.getIntOr("y", 0); int intOr1 = tag.getIntOr("y", 0);
int intOr2 = tag.getIntOr("z", 0); int intOr2 = tag.getIntOr("z", 0);
@@ -27,7 +35,7 @@
int sectionPosCoord = SectionPos.blockToSectionCoord(intOr); int sectionPosCoord = SectionPos.blockToSectionCoord(intOr);
int sectionPosCoord1 = SectionPos.blockToSectionCoord(intOr2); int sectionPosCoord1 = SectionPos.blockToSectionCoord(intOr2);
if (sectionPosCoord != chunkPos.x || sectionPosCoord1 != chunkPos.z) { if (sectionPosCoord != chunkPos.x || sectionPosCoord1 != chunkPos.z) {
@@ -71,6 +_,7 @@ @@ -71,6 +77,7 @@ public abstract class BlockEntity {
intOr = chunkPos.getBlockX(SectionPos.sectionRelative(intOr)); intOr = chunkPos.getBlockX(SectionPos.sectionRelative(intOr));
intOr2 = chunkPos.getBlockZ(SectionPos.sectionRelative(intOr2)); intOr2 = chunkPos.getBlockZ(SectionPos.sectionRelative(intOr2));
} }
@@ -35,7 +43,7 @@
return new BlockPos(intOr, intOr1, intOr2); 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) { protected void loadAdditional(CompoundTag tag, HolderLookup.Provider registries) {
@@ -50,7 +58,7 @@
} }
public final void loadWithComponents(CompoundTag tag, HolderLookup.Provider registries) { public final void loadWithComponents(CompoundTag tag, HolderLookup.Provider registries) {
@@ -120,12 +_,22 @@ @@ -120,12 +135,22 @@ public abstract class BlockEntity {
CompoundTag compoundTag = new CompoundTag(); CompoundTag compoundTag = new CompoundTag();
this.saveAdditional(compoundTag, registries); this.saveAdditional(compoundTag, registries);
compoundTag.store(BlockEntity.ComponentHelper.COMPONENTS_CODEC, registries.createSerializationContext(NbtOps.INSTANCE), this.components); compoundTag.store(BlockEntity.ComponentHelper.COMPONENTS_CODEC, registries.createSerializationContext(NbtOps.INSTANCE), this.components);
@@ -73,7 +81,7 @@
return compoundTag; return compoundTag;
} }
@@ -260,6 +_,12 @@ @@ -260,6 +285,12 @@ public abstract class BlockEntity {
} }
public final void applyComponents(DataComponentMap components, DataComponentPatch patch) { public final void applyComponents(DataComponentMap components, DataComponentPatch patch) {
@@ -86,7 +94,7 @@
final Set<DataComponentType<?>> set = new HashSet<>(); final Set<DataComponentType<?>> set = new HashSet<>();
set.add(DataComponents.BLOCK_ENTITY_DATA); set.add(DataComponents.BLOCK_ENTITY_DATA);
set.add(DataComponents.BLOCK_STATE); set.add(DataComponents.BLOCK_STATE);
@@ -280,6 +_,10 @@ @@ -280,6 +311,10 @@ public abstract class BlockEntity {
}); });
DataComponentPatch dataComponentPatch = patch.forget(set::contains); DataComponentPatch dataComponentPatch = patch.forget(set::contains);
this.components = dataComponentPatch.split().added(); this.components = dataComponentPatch.split().added();
@@ -97,11 +105,10 @@
} }
protected void collectImplicitComponents(DataComponentMap.Builder components) { protected void collectImplicitComponents(DataComponentMap.Builder components) {
@@ -313,6 +_,28 @@ @@ -314,6 +349,28 @@ public abstract class BlockEntity {
.resultOrPartial(string -> LOGGER.warn("Failed to parse custom name, discarding: {}", string))
.orElse(null); .orElse(null);
} }
+
+ // CraftBukkit start - add method + // CraftBukkit start - add method
+ public org.bukkit.inventory.InventoryHolder getOwner() { + public org.bukkit.inventory.InventoryHolder getOwner() {
+ return getOwner(true); + return getOwner(true);
@@ -123,6 +130,7 @@
+ } + }
+ // Paper end - Sanitize sent data + // Paper end - Sanitize sent data
+ +
+
static class ComponentHelper { static class ComponentHelper {
public static final MapCodec<DataComponentMap> COMPONENTS_CODEC = DataComponentMap.CODEC.optionalFieldOf("components", DataComponentMap.EMPTY); 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 --- a/net/minecraft/world/level/block/entity/CampfireBlockEntity.java
+++ b/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); private final NonNullList<ItemStack> items = NonNullList.withSize(4, ItemStack.EMPTY);
public final int[] cookingProgress = new int[4]; public final int[] cookingProgress = new int[4];
public final int[] cookingTime = new int[4]; public final int[] cookingTime = new int[4];
@@ -8,7 +16,7 @@
public CampfireBlockEntity(BlockPos pos, BlockState blockState) { public CampfireBlockEntity(BlockPos pos, BlockState blockState) {
super(BlockEntityType.CAMPFIRE, pos, 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); ItemStack itemStack = campfire.items.get(i);
if (!itemStack.isEmpty()) { if (!itemStack.isEmpty()) {
flag = true; flag = true;
@@ -55,7 +63,7 @@
campfire.items.set(i, ItemStack.EMPTY); campfire.items.set(i, ItemStack.EMPTY);
level.sendBlockUpdated(pos, state, state, 3); level.sendBlockUpdated(pos, state, state, 3);
level.gameEvent(GameEvent.BLOCK_CHANGE, pos, GameEvent.Context.of(state)); 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( .ifPresentOrElse(
ints -> System.arraycopy(ints, 0, this.cookingTime, 0, Math.min(this.cookingTime.length, ints.length)), () -> Arrays.fill(this.cookingTime, 0) 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 @Override
@@ -143,6 +_,13 @@ @@ -143,6 +184,13 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable {
ContainerHelper.saveAllItems(tag, this.items, true, registries); ContainerHelper.saveAllItems(tag, this.items, true, registries);
tag.putIntArray("CookingTimes", this.cookingProgress); tag.putIntArray("CookingTimes", this.cookingProgress);
tag.putIntArray("CookingTotalTimes", this.cookingTime); tag.putIntArray("CookingTotalTimes", this.cookingTime);
@@ -86,7 +94,7 @@
} }
@Override @Override
@@ -167,7 +_,15 @@ @@ -167,7 +215,15 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable {
return false; 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 --- a/net/minecraft/world/level/block/entity/ConduitBlockEntity.java
+++ b/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) { private static void applyEffects(Level level, BlockPos pos, List<BlockPos> positions) {
@@ -21,7 +29,7 @@
int x = pos.getX(); int x = pos.getX();
int y = pos.getY(); int y = pos.getY();
int z = pos.getZ(); int z = pos.getZ();
@@ -175,13 +_,19 @@ @@ -175,13 +187,19 @@ public class ConduitBlockEntity extends BlockEntity {
if (!entitiesOfClass.isEmpty()) { if (!entitiesOfClass.isEmpty()) {
for (Player player : entitiesOfClass) { for (Player player : entitiesOfClass) {
if (pos.closerThan(player.blockPosition(), i) && player.isInWaterOrRain()) { if (pos.closerThan(player.blockPosition(), i) && player.isInWaterOrRain()) {
@@ -42,7 +50,7 @@
LivingEntity livingEntity = blockEntity.destroyTarget; LivingEntity livingEntity = blockEntity.destroyTarget;
int size = positions.size(); int size = positions.size();
if (size < 42) { if (size < 42) {
@@ -200,7 +_,8 @@ @@ -200,7 +218,8 @@ public class ConduitBlockEntity extends BlockEntity {
blockEntity.destroyTarget = null; blockEntity.destroyTarget = null;
} }
@@ -52,7 +60,7 @@
level.playSound( level.playSound(
null, null,
blockEntity.destroyTarget.getX(), blockEntity.destroyTarget.getX(),
@@ -211,7 +_,6 @@ @@ -211,7 +230,6 @@ public class ConduitBlockEntity extends BlockEntity {
1.0F, 1.0F,
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 --- a/net/minecraft/world/level/block/entity/DecoratedPotBlockEntity.java
+++ b/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; import net.minecraft.world.ticks.ContainerSingleItem;
public class DecoratedPotBlockEntity extends BlockEntity implements RandomizableContainer, ContainerSingleItem.BlockContainerSingleItem { 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_SHERDS = "sherds";
public static final String TAG_ITEM = "item"; public static final String TAG_ITEM = "item";
public static final int EVENT_POT_WOBBLES = 1; 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); 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 @Override
public CompoundTag getUpdateTag(HolderLookup.Provider registries) { 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 --- a/net/minecraft/world/level/block/entity/SculkSensorBlockEntity.java
+++ b/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.Listener vibrationListener;
private final VibrationSystem.User vibrationUser; private final VibrationSystem.User vibrationUser;
public int lastVibrationFrequency = 0; public int lastVibrationFrequency = 0;
@@ -8,7 +16,7 @@
protected SculkSensorBlockEntity(BlockEntityType<?> type, BlockPos pos, BlockState blockState) { protected SculkSensorBlockEntity(BlockEntityType<?> type, BlockPos pos, BlockState blockState) {
super(type, pos, 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); this.lastVibrationFrequency = tag.getIntOr("last_vibration_frequency", 0);
RegistryOps<Tag> registryOps = registries.createSerializationContext(NbtOps.INSTANCE); RegistryOps<Tag> registryOps = registries.createSerializationContext(NbtOps.INSTANCE);
this.vibrationData = tag.read("listener", VibrationSystem.Data.CODEC, registryOps).orElseGet(VibrationSystem.Data::new); this.vibrationData = tag.read("listener", VibrationSystem.Data.CODEC, registryOps).orElseGet(VibrationSystem.Data::new);
@@ -22,9 +30,8 @@
tag.putInt("last_vibration_frequency", this.lastVibrationFrequency); tag.putInt("last_vibration_frequency", this.lastVibrationFrequency);
RegistryOps<Tag> registryOps = registries.createSerializationContext(NbtOps.INSTANCE); RegistryOps<Tag> registryOps = registries.createSerializationContext(NbtOps.INSTANCE);
tag.store("listener", VibrationSystem.Data.CODEC, registryOps, this.vibrationData); tag.store("listener", VibrationSystem.Data.CODEC, registryOps, this.vibrationData);
- }
+ this.saveRangeOverride(tag); // Paper - Configurable sculk sensor listener range + this.saveRangeOverride(tag); // Paper - Configurable sculk sensor listener range
+ } }
+ // Paper start - Configurable sculk sensor listener range + // Paper start - Configurable sculk sensor listener range
+ protected void saveRangeOverride(CompoundTag tag) { + 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 + 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 @Override
public VibrationSystem.Data getVibrationData() { public VibrationSystem.Data getVibrationData() {
@@ -91,6 +_,7 @@ @@ -91,6 +100,7 @@ public class SculkSensorBlockEntity extends BlockEntity implements GameEventList
@Override @Override
public int getListenerRadius() { 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 --- a/net/minecraft/world/level/block/entity/SignBlockEntity.java
+++ b/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) { public boolean isFacingFrontText(Player player) {
@@ -18,7 +26,7 @@
float yRotationDegrees = signBlock.getYRotationDegrees(this.getBlockState()); float yRotationDegrees = signBlock.getYRotationDegrees(this.getBlockState());
float f = (float)(Mth.atan2(d1, d) * 180.0F / (float)Math.PI) - 90.0F; float f = (float)(Mth.atan2(d1, d) * 180.0F / (float)Math.PI) - 90.0F;
return Mth.degreesDifferenceAbs(yRotationDegrees, f) <= 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) { public void updateSignText(Player player, boolean isFrontText, List<FilteredText> filteredText) {
if (!this.isWaxed() && player.getUUID().equals(this.getPlayerWhoMayEdit()) && this.level != null) { 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); return this.setText(updater.apply(text), isFrontText);
} }
@@ -53,7 +61,7 @@
); );
} }
} }
+
+ // CraftBukkit start + // CraftBukkit start
+ org.bukkit.entity.Player apiPlayer = ((net.minecraft.server.level.ServerPlayer) player).getBukkitEntity(); + 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 + List<net.kyori.adventure.text.Component> lines = new java.util.ArrayList<>(); // Paper - adventure
@@ -74,10 +82,11 @@
+ } + }
+ } + }
+ // CraftBukkit end + // CraftBukkit end
+
return text; return text;
} }
@@ -193,8 +_,24 @@
@@ -193,8 +222,24 @@ public class SignBlockEntity extends BlockEntity {
for (Component component : this.getText(frontText).getMessages(player.isTextFilteringEnabled())) { for (Component component : this.getText(frontText).getMessages(player.isTextFilteringEnabled())) {
Style style = component.getStyle(); Style style = component.getStyle();
@@ -104,7 +113,7 @@
flag = true; flag = true;
} }
} }
@@ -202,10 +_,55 @@ @@ -202,10 +247,55 @@ public class SignBlockEntity extends BlockEntity {
return flag; return flag;
} }
@@ -162,7 +171,7 @@
} }
@Override @Override
@@ -224,12 +_,17 @@ @@ -224,12 +314,17 @@ public class SignBlockEntity extends BlockEntity {
@Nullable @Nullable
public UUID getPlayerWhoMayEdit() { 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 --- a/net/minecraft/world/level/block/entity/TestBlockEntity.java
+++ b/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 @Override
public void loadAdditional(CompoundTag tag, HolderLookup.Provider registries) { 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 --- a/net/minecraft/world/level/block/entity/TestInstanceBlockEntity.java
+++ b/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 @Override
protected void loadAdditional(CompoundTag tag, HolderLookup.Provider registries) { protected void loadAdditional(CompoundTag tag, HolderLookup.Provider registries) {
@@ -8,7 +16,7 @@
Tag tag1 = tag.get("data"); Tag tag1 = tag.get("data");
if (tag1 != null) { if (tag1 != null) {
TestInstanceBlockEntity.Data.CODEC.parse(NbtOps.INSTANCE, tag1).ifSuccess(this::set); 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() { 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 --- a/net/minecraft/world/level/block/entity/trialspawner/TrialSpawner.java
+++ b/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); nextSpawnData.getEquipment().ifPresent(mob::equip);
} }
@@ -16,7 +24,7 @@
return Optional.empty(); return Optional.empty();
} else { } else {
TrialSpawner.FlameParticle flameParticle = this.isOminous ? TrialSpawner.FlameParticle.OMINOUS : TrialSpawner.FlameParticle.NORMAL; 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); LootParams lootParams = new LootParams.Builder(level).create(LootContextParamSets.EMPTY);
ObjectArrayList<ItemStack> randomItems = lootTable1.getRandomItems(lootParams); ObjectArrayList<ItemStack> randomItems = lootTable1.getRandomItems(lootParams);
if (!randomItems.isEmpty()) { 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 --- a/net/minecraft/world/level/block/entity/trialspawner/TrialSpawnerData.java
+++ b/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); 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 --- a/net/minecraft/world/level/chunk/status/ChunkStatusTasks.java
+++ b/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 WorldGenContext worldGenContext, ChunkStep step, StaticCache2D<GenerationChunkHolder> cache, ChunkAccess chunk
) { ) {
ServerLevel serverLevel = worldGenContext.level(); ServerLevel serverLevel = worldGenContext.level();
@@ -9,13 +17,11 @@
worldGenContext.generator() worldGenContext.generator()
.createStructures( .createStructures(
serverLevel.registryAccess(), serverLevel.registryAccess(),
@@ -198,7 +_,58 @@ @@ -198,7 +198,58 @@ public class ChunkStatusTasks {
public static void postLoadProtoChunk(ServerLevel level, List<CompoundTag> entityTags) { public static void postLoadProtoChunk(ServerLevel level, List<CompoundTag> entityTags) {
if (!entityTags.isEmpty()) { if (!entityTags.isEmpty()) {
- level.addWorldGenChunkEntities(EntityType.loadEntitiesRecursive(entityTags, level, EntitySpawnReason.LOAD)); - 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 + // 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) -> { + level.addWorldGenChunkEntities(EntityType.loadEntitiesRecursive(entityTags, level, EntitySpawnReason.LOAD).filter((entity) -> {
+ boolean needsRemoval = false; + boolean needsRemoval = false;
@@ -66,8 +72,8 @@
+ default: + default:
+ break; + break;
+ } + }
+ } }
+ return false; + return false;
+ } }
+ // Paper end - duplicate uuid resolving + // 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 --- a/net/minecraft/world/level/entity/PersistentEntitySectionManager.java
+++ b/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); this.entityGetter = new LevelEntityGetterAdapter<>(this.visibleEntityStorage, this.sectionStorage);
} }
@@ -17,7 +25,7 @@
void removeSectionIfEmpty(long sectionKey, EntitySection<T> section) { void removeSectionIfEmpty(long sectionKey, EntitySection<T> section) {
if (section.isEmpty()) { if (section.isEmpty()) {
this.sectionStorage.remove(sectionKey); this.sectionStorage.remove(sectionKey);
@@ -59,6 +_,7 @@ @@ -59,6 +69,7 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A
} }
private boolean addEntityUuid(T entity) { private boolean addEntityUuid(T entity) {
@@ -25,7 +33,7 @@
if (!this.knownUuids.add(entity.getUUID())) { if (!this.knownUuids.add(entity.getUUID())) {
LOGGER.warn("UUID of added entity already exists: {}", entity); LOGGER.warn("UUID of added entity already exists: {}", entity);
return false; return false;
@@ -72,6 +_,17 @@ @@ -72,6 +83,17 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A
} }
private boolean addEntity(T entity, boolean worldGenSpawned) { private boolean addEntity(T entity, boolean worldGenSpawned) {
@@ -43,7 +51,7 @@
if (!this.addEntityUuid(entity)) { if (!this.addEntityUuid(entity)) {
return false; return false;
} else { } else {
@@ -113,19 +_,23 @@ @@ -113,19 +135,23 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A
} }
void startTicking(T entity) { void startTicking(T entity) {
@@ -67,7 +75,7 @@
this.callbacks.onTrackingEnd(entity); this.callbacks.onTrackingEnd(entity);
this.visibleEntityStorage.remove(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) { public void updateChunkStatus(ChunkPos pos, Visibility visibility) {
@@ -75,7 +83,7 @@
long packedChunkPos = pos.toLong(); long packedChunkPos = pos.toLong();
if (visibility == Visibility.HIDDEN) { if (visibility == Visibility.HIDDEN) {
this.chunkVisibility.remove(packedChunkPos); this.chunkVisibility.remove(packedChunkPos);
@@ -169,6 +_,7 @@ @@ -169,6 +196,7 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A
} }
public void ensureChunkQueuedForLoad(long chunkPosValue) { public void ensureChunkQueuedForLoad(long chunkPosValue) {
@@ -83,7 +91,7 @@
PersistentEntitySectionManager.ChunkLoadStatus chunkLoadStatus = this.chunkLoadStatuses.get(chunkPosValue); PersistentEntitySectionManager.ChunkLoadStatus chunkLoadStatus = this.chunkLoadStatuses.get(chunkPosValue);
if (chunkLoadStatus == PersistentEntitySectionManager.ChunkLoadStatus.FRESH) { if (chunkLoadStatus == PersistentEntitySectionManager.ChunkLoadStatus.FRESH) {
this.requestChunkLoad(chunkPosValue); 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) { private boolean storeChunkSections(long chunkPosValue, Consumer<T> entityAction) {
@@ -95,7 +103,7 @@
PersistentEntitySectionManager.ChunkLoadStatus chunkLoadStatus = this.chunkLoadStatuses.get(chunkPosValue); PersistentEntitySectionManager.ChunkLoadStatus chunkLoadStatus = this.chunkLoadStatuses.get(chunkPosValue);
if (chunkLoadStatus == PersistentEntitySectionManager.ChunkLoadStatus.PENDING) { if (chunkLoadStatus == PersistentEntitySectionManager.ChunkLoadStatus.PENDING) {
return false; return false;
@@ -186,6 +_,7 @@ @@ -186,6 +219,7 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A
.collect(Collectors.toList()); .collect(Collectors.toList());
if (list.isEmpty()) { if (list.isEmpty()) {
if (chunkLoadStatus == PersistentEntitySectionManager.ChunkLoadStatus.LOADED) { if (chunkLoadStatus == PersistentEntitySectionManager.ChunkLoadStatus.LOADED) {
@@ -103,7 +111,7 @@
this.permanentStorage.storeEntities(new ChunkEntities<>(new ChunkPos(chunkPosValue), ImmutableList.of())); 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); this.requestChunkLoad(chunkPosValue);
return false; return false;
} else { } else {
@@ -111,7 +119,7 @@
this.permanentStorage.storeEntities(new ChunkEntities<>(new ChunkPos(chunkPosValue), list)); this.permanentStorage.storeEntities(new ChunkEntities<>(new ChunkPos(chunkPosValue), list));
list.forEach(entityAction); list.forEach(entityAction);
return true; return true;
@@ -202,6 +_,7 @@ @@ -202,6 +237,7 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A
} }
private void requestChunkLoad(long chunkPosValue) { private void requestChunkLoad(long chunkPosValue) {
@@ -119,7 +127,7 @@
this.chunkLoadStatuses.put(chunkPosValue, PersistentEntitySectionManager.ChunkLoadStatus.PENDING); this.chunkLoadStatuses.put(chunkPosValue, PersistentEntitySectionManager.ChunkLoadStatus.PENDING);
ChunkPos chunkPos = new ChunkPos(chunkPosValue); ChunkPos chunkPos = new ChunkPos(chunkPosValue);
this.permanentStorage.loadEntities(chunkPos).thenAccept(this.loadingInbox::add).exceptionally(throwable -> { 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) { private boolean processChunkUnload(long chunkPosValue) {
@@ -129,7 +137,7 @@
if (!flag) { if (!flag) {
return false; return false;
} else { } else {
@@ -221,7 +_,7 @@ @@ -221,7 +258,7 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A
} }
private void unloadEntity(EntityAccess entity) { private void unloadEntity(EntityAccess entity) {
@@ -138,7 +146,7 @@
entity.setLevelCallback(EntityInLevelCallback.NULL); entity.setLevelCallback(EntityInLevelCallback.NULL);
} }
@@ -231,14 +_,20 @@ @@ -231,14 +268,20 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A
} }
private void processPendingLoads() { private void processPendingLoads() {
@@ -159,7 +167,7 @@
this.processPendingLoads(); this.processPendingLoads();
this.processUnloads(); this.processUnloads();
} }
@@ -256,6 +_,7 @@ @@ -256,6 +299,7 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A
} }
public void autoSave() { public void autoSave() {
@@ -167,7 +175,7 @@
this.getAllChunksToSave().forEach(packedChunkPos -> { this.getAllChunksToSave().forEach(packedChunkPos -> {
boolean flag = this.chunkVisibility.get(packedChunkPos) == Visibility.HIDDEN; boolean flag = this.chunkVisibility.get(packedChunkPos) == Visibility.HIDDEN;
if (flag) { if (flag) {
@@ -267,6 +_,7 @@ @@ -267,6 +311,7 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A
} }
public void saveAll() { public void saveAll() {
@@ -175,7 +183,7 @@
LongSet allChunksToSave = this.getAllChunksToSave(); LongSet allChunksToSave = this.getAllChunksToSave();
while (!allChunksToSave.isEmpty()) { while (!allChunksToSave.isEmpty()) {
@@ -283,7 +_,13 @@ @@ -283,7 +328,13 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A
@Override @Override
public void close() throws IOException { public void close() throws IOException {
@@ -190,7 +198,7 @@
this.permanentStorage.close(); this.permanentStorage.close();
} }
@@ -384,6 +_,7 @@ @@ -384,6 +435,7 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A
BlockPos blockPos = this.entity.blockPosition(); BlockPos blockPos = this.entity.blockPosition();
long packedSectionPos = SectionPos.asLong(blockPos); long packedSectionPos = SectionPos.asLong(blockPos);
if (packedSectionPos != this.currentSectionKey) { if (packedSectionPos != this.currentSectionKey) {
@@ -198,7 +206,7 @@
Visibility status = this.currentSection.getStatus(); Visibility status = this.currentSection.getStatus();
if (!this.currentSection.remove(this.entity)) { if (!this.currentSection.remove(this.entity)) {
PersistentEntitySectionManager.LOGGER PersistentEntitySectionManager.LOGGER
@@ -431,6 +_,7 @@ @@ -431,6 +483,7 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A
@Override @Override
public void onRemove(Entity.RemovalReason reason) { 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 --- a/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java
+++ b/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(); public final List<StructureTemplate.StructureEntityInfo> entityInfoList = Lists.newArrayList();
private Vec3i size = Vec3i.ZERO; private Vec3i size = Vec3i.ZERO;
private String author = "?"; private String author = "?";
@@ -11,7 +19,7 @@
public Vec3i getSize() { public Vec3i getSize() {
return this.size; return this.size;
@@ -247,6 +_,19 @@ @@ -247,6 +251,19 @@ public class StructureTemplate {
if (this.palettes.isEmpty()) { if (this.palettes.isEmpty()) {
return false; return false;
} else { } else {
@@ -31,7 +39,7 @@
List<StructureTemplate.StructureBlockInfo> list = settings.getRandomPalette(this.palettes, offset).blocks(); List<StructureTemplate.StructureBlockInfo> list = settings.getRandomPalette(this.palettes, offset).blocks();
if ((!list.isEmpty() || !settings.isIgnoreEntities() && !this.entityInfoList.isEmpty()) if ((!list.isEmpty() || !settings.isIgnoreEntities() && !this.entityInfoList.isEmpty())
&& this.size.getX() >= 1 && this.size.getX() >= 1
@@ -272,6 +_,21 @@ @@ -272,6 +289,21 @@ public class StructureTemplate {
serverLevel.setBlock(blockPos, Blocks.BARRIER.defaultBlockState(), 820); serverLevel.setBlock(blockPos, Blocks.BARRIER.defaultBlockState(), 820);
} }
@@ -53,7 +61,7 @@
if (serverLevel.setBlock(blockPos, blockState, flags)) { if (serverLevel.setBlock(blockPos, blockState, flags)) {
i = Math.min(i, blockPos.getX()); i = Math.min(i, blockPos.getX());
i1 = Math.min(i1, blockPos.getY()); i1 = Math.min(i1, blockPos.getY());
@@ -283,7 +_,7 @@ @@ -283,7 +315,7 @@ public class StructureTemplate {
if (structureBlockInfo.nbt != null) { if (structureBlockInfo.nbt != null) {
BlockEntity blockEntity = serverLevel.getBlockEntity(blockPos); BlockEntity blockEntity = serverLevel.getBlockEntity(blockPos);
if (blockEntity != null) { if (blockEntity != null) {
@@ -62,7 +70,7 @@
structureBlockInfo.nbt.putLong("LootTableSeed", random.nextLong()); structureBlockInfo.nbt.putLong("LootTableSeed", random.nextLong());
} }
@@ -366,7 +_,11 @@ @@ -366,7 +398,11 @@ public class StructureTemplate {
if (pair1.getSecond() != null) { if (pair1.getSecond() != null) {
BlockEntity blockEntity = serverLevel.getBlockEntity(blockPos4); BlockEntity blockEntity = serverLevel.getBlockEntity(blockPos4);
if (blockEntity != null) { if (blockEntity != null) {
@@ -75,7 +83,7 @@
} }
} }
} }
@@ -374,7 +_,7 @@ @@ -374,7 +410,7 @@ public class StructureTemplate {
if (!settings.isIgnoreEntities()) { if (!settings.isIgnoreEntities()) {
this.placeEntities( this.placeEntities(
@@ -84,7 +92,7 @@
offset, offset,
settings.getMirror(), settings.getMirror(),
settings.getRotation(), settings.getRotation(),
@@ -488,14 +_,17 @@ @@ -488,14 +524,17 @@ public class StructureTemplate {
); );
} }
} }
@@ -107,7 +115,7 @@
} }
public Vec3i getSize(Rotation rotation) { public Vec3i getSize(Rotation rotation) {
@@ -688,6 +_,11 @@ @@ -688,6 +727,11 @@ public class StructureTemplate {
tag.put("entities", listTag3); tag.put("entities", listTag3);
tag.put("size", this.newIntegerList(this.size.getX(), this.size.getY(), this.size.getZ())); tag.put("size", this.newIntegerList(this.size.getX(), this.size.getY(), this.size.getZ()));
@@ -119,7 +127,7 @@
return NbtUtils.addCurrentDataVersion(tag); 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))); .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) { 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 { public static final class Palette {
private final List<StructureTemplate.StructureBlockInfo> blocks; 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 --- a/net/minecraft/world/level/portal/TeleportTransition.java
+++ b/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, boolean asPassenger,
Set<Relative> relatives, Set<Relative> relatives,
TeleportTransition.PostTeleportTransition postTeleportTransition TeleportTransition.PostTeleportTransition postTeleportTransition
@@ -36,7 +44,7 @@
} }
public TeleportTransition( public TeleportTransition(
@@ -39,11 +_,30 @@ @@ -39,11 +58,30 @@ public record TeleportTransition(
Set<Relative> relatives, Set<Relative> relatives,
TeleportTransition.PostTeleportTransition postTeleportTransition TeleportTransition.PostTeleportTransition postTeleportTransition
) { ) {
@@ -69,7 +77,7 @@
} }
private static void playPortalSound(Entity entity) { 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) { 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 --- a/net/minecraft/world/level/storage/PlayerDataStorage.java
+++ b/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) { public void save(Player player) {
@@ -8,7 +16,7 @@
try { try {
CompoundTag compoundTag = player.saveWithoutId(new CompoundTag()); CompoundTag compoundTag = player.saveWithoutId(new CompoundTag());
Path path = this.playerDir.toPath(); Path path = this.playerDir.toPath();
@@ -40,30 +_,46 @@ @@ -40,30 +41,46 @@ public class PlayerDataStorage {
Path path3 = path.resolve(player.getStringUUID() + ".dat_old"); Path path3 = path.resolve(player.getStringUUID() + ".dat_old");
Util.safeReplaceFile(path2, path1, path3); Util.safeReplaceFile(path2, path1, path3);
} catch (Exception var7) { } catch (Exception var7) {
@@ -64,7 +72,7 @@
} }
} }
@@ -71,16 +_,40 @@ @@ -71,16 +88,40 @@ public class PlayerDataStorage {
} }
public Optional<CompoundTag> load(Player player) { 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 --- a/net/minecraft/world/level/storage/loot/LootDataType.java
+++ b/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() { private static LootDataType.Validator<LootTable> createLootTableValidator() {

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