fix more compile errors

This commit is contained in:
Jake Potrebic 2023-03-14 16:10:18 -07:00
parent e277e6a990
commit 8b4edb6f19
22 changed files with 90 additions and 71 deletions

View File

@ -1238,14 +1238,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ * Gets the number of ticks that this hopper minecart cannot pickup items up for. + * Gets the number of ticks that this hopper minecart cannot pickup items up for.
+ * + *
+ * @return ticks left on cooldown + * @return ticks left on cooldown
+ * @deprecated Hopper minecarts don't have cooldowns anymore
+ */ + */
+ @Deprecated(forRemoval = true)
+ int getPickupCooldown(); + int getPickupCooldown();
+ +
+ /** + /**
+ * Sets the number of ticks that this hopper minecart cannot pickup items for. + * Sets the number of ticks that this hopper minecart cannot pickup items for.
+ * + *
+ * @param cooldown cooldown length in ticks + * @param cooldown cooldown length in ticks
+ * @deprecated Hopper minecarts don't have cooldowns anymore
+ */ + */
+ @Deprecated(forRemoval = true)
+ void setPickupCooldown(int cooldown); + void setPickupCooldown(int cooldown);
+ // Paper end + // Paper end
} }

View File

@ -243,10 +243,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper start - Teleport API + // Paper start - Teleport API
+ @org.jetbrains.annotations.ApiStatus.Experimental + @org.jetbrains.annotations.ApiStatus.Experimental
+ public PlayerTeleportEvent(@NotNull final Player player, @NotNull final Location from, @Nullable final Location to, @NotNull final TeleportCause cause, boolean dismounted, @NotNull java.util.Set<io.papermc.paper.entity.TeleportFlag.@NotNull Relative> teleportFlagSet) { + public PlayerTeleportEvent(@NotNull final Player player, @NotNull final Location from, @Nullable final Location to, @NotNull final TeleportCause cause, @NotNull java.util.Set<io.papermc.paper.entity.TeleportFlag.@NotNull Relative> teleportFlagSet) {
+ super(player, from, to); + super(player, from, to);
+
+ this.dismounted = dismounted;
+ this.teleportFlagSet = teleportFlagSet; + this.teleportFlagSet = teleportFlagSet;
+ this.cause = cause; + this.cause = cause;
+ } + }
@ -264,8 +262,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ * Gets if the player will be dismounted in this teleportation. + * Gets if the player will be dismounted in this teleportation.
+ * + *
+ * @return dismounted or not + * @return dismounted or not
+ * @deprecated dismounting on tp is no longer controlled by the server
+ */ + */
+ @org.jetbrains.annotations.ApiStatus.Experimental + @Deprecated(forRemoval = true)
+ public boolean willDismountPlayer() { + public boolean willDismountPlayer() {
+ return this.dismounted; + return this.dismounted;
+ } + }

View File

@ -4,19 +4,6 @@ Date: Sun, 8 Aug 2021 19:56:02 +0200
Subject: [PATCH] Add CompostItemEvent and EntityCompostItemEvent Subject: [PATCH] Add CompostItemEvent and EntityCompostItemEvent
diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/WorkAtComposter.java b/src/main/java/net/minecraft/world/entity/ai/behavior/WorkAtComposter.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/ai/behavior/WorkAtComposter.java
+++ b/src/main/java/net/minecraft/world/entity/ai/behavior/WorkAtComposter.java
@@ -0,0 +0,0 @@ public class WorkAtComposter extends WorkAtPoi {
i -= p;
for(int q = 0; q < p; ++q) {
- blockState = ComposterBlock.insertItem(entity, blockState, world, itemStack, blockPos);
+ blockState = ComposterBlock.insertItem(entity, blockState, world, itemStack, blockPos, entity); // Paper
if (blockState.getValue(ComposterBlock.LEVEL) == 7) {
this.spawnComposterFillEffects(world, composterState, blockPos, blockState);
return;
diff --git a/src/main/java/net/minecraft/world/level/block/ComposterBlock.java b/src/main/java/net/minecraft/world/level/block/ComposterBlock.java diff --git a/src/main/java/net/minecraft/world/level/block/ComposterBlock.java b/src/main/java/net/minecraft/world/level/block/ComposterBlock.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/block/ComposterBlock.java --- a/src/main/java/net/minecraft/world/level/block/ComposterBlock.java

View File

@ -51,7 +51,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
super.slotsChanged(inventory); super.slotsChanged(inventory);
if (inventory == this.inputSlots) { if (inventory == this.inputSlots) {
this.createResult(); this.createResult();
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareResultEvent(this, RESULT_SLOT); // Paper + org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareResultEvent(this, this instanceof SmithingMenu ? 3 : 2); // Paper
} }
} }

View File

@ -163,7 +163,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper end + // Paper end
String playerName = ServerLoginPacketListenerImpl.this.gameProfile.getName(); String playerName = ServerLoginPacketListenerImpl.this.gameProfile.getName();
java.net.InetAddress address = ((java.net.InetSocketAddress) ServerLoginPacketListenerImpl.this.connection.getRemoteAddress()).getAddress(); java.net.InetAddress address = ((java.net.InetSocketAddress) ServerLoginPacketListenerImpl.this.connection.getRemoteAddress()).getAddress();
java.net.InetAddress rawAddress = ((java.net.InetSocketAddress) connection.getRawAddress()).getAddress(); // Paper java.net.InetAddress rawAddress = ((java.net.InetSocketAddress) connection.channel.remoteAddress()).getAddress(); // Paper
@@ -0,0 +0,0 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener, @@ -0,0 +0,0 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
// Spigot end // Spigot end

View File

@ -21,6 +21,27 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
// org.bukkit.craftbukkit.block.data.CraftLightable // org.bukkit.craftbukkit.block.data.CraftLightable
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftCherryLeaves.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftCherryLeaves.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftCherryLeaves.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftCherryLeaves.java
@@ -0,0 +0,0 @@ public final class CraftCherryLeaves extends org.bukkit.craftbukkit.block.data.C
public void setWaterlogged(boolean waterlogged) {
set(CraftCherryLeaves.WATERLOGGED, waterlogged);
}
+
+ // Paper start
+ @Override
+ public int getMaximumDistance() {
+ return getMax(DISTANCE);
+ }
+
+ @Override
+ public int getMinimumDistance() {
+ return getMin(DISTANCE);
+ }
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftComposter.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftComposter.java diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftComposter.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftComposter.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftComposter.java --- a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftComposter.java

View File

@ -12,7 +12,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public void fireEvents() throws Exception { public void fireEvents() throws Exception {
String playerName = ServerLoginPacketListenerImpl.this.gameProfile.getName(); String playerName = ServerLoginPacketListenerImpl.this.gameProfile.getName();
java.net.InetAddress address = ((java.net.InetSocketAddress) ServerLoginPacketListenerImpl.this.connection.getRemoteAddress()).getAddress(); java.net.InetAddress address = ((java.net.InetSocketAddress) ServerLoginPacketListenerImpl.this.connection.getRemoteAddress()).getAddress();
+ java.net.InetAddress rawAddress = ((java.net.InetSocketAddress) connection.getRawAddress()).getAddress(); // Paper + java.net.InetAddress rawAddress = ((java.net.InetSocketAddress) connection.channel.remoteAddress()).getAddress(); // Paper
java.util.UUID uniqueId = ServerLoginPacketListenerImpl.this.gameProfile.getId(); java.util.UUID uniqueId = ServerLoginPacketListenerImpl.this.gameProfile.getId();
final org.bukkit.craftbukkit.CraftServer server = ServerLoginPacketListenerImpl.this.server.server; final org.bukkit.craftbukkit.CraftServer server = ServerLoginPacketListenerImpl.this.server.server;

View File

@ -120,7 +120,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+import net.kyori.adventure.text.minimessage.MiniMessage; +import net.kyori.adventure.text.minimessage.MiniMessage;
+import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder; +import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
+import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver; +import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
+import net.minecraft.Util; +import net.minecraft.Optionull;
+import net.minecraft.commands.CommandSourceStack; +import net.minecraft.commands.CommandSourceStack;
+import net.minecraft.network.chat.ChatDecorator; +import net.minecraft.network.chat.ChatDecorator;
+import net.minecraft.server.MinecraftServer; +import net.minecraft.server.MinecraftServer;
@ -194,7 +194,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } + }
+ +
+ private ChatDecorator.Result processModern(final ChatDecorator.Result input) { + private ChatDecorator.Result processModern(final ChatDecorator.Result input) {
+ final @Nullable CraftPlayer player = Util.mapNullable(this.player, ServerPlayer::getBukkitEntity); + final @Nullable CraftPlayer player = Optionull.map(this.player, ServerPlayer::getBukkitEntity);
+ +
+ final Component initialResult = input.message().component(); + final Component initialResult = input.message().component();
+ final AsyncChatDecorateEvent event; + final AsyncChatDecorateEvent event;
@ -280,6 +280,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+import net.kyori.adventure.audience.ForwardingAudience; +import net.kyori.adventure.audience.ForwardingAudience;
+import net.kyori.adventure.key.Key; +import net.kyori.adventure.key.Key;
+import net.kyori.adventure.text.Component; +import net.kyori.adventure.text.Component;
+import net.minecraft.Optionull;
+import net.minecraft.Util; +import net.minecraft.Util;
+import net.minecraft.core.registries.Registries; +import net.minecraft.core.registries.Registries;
+import net.minecraft.network.chat.ChatDecorator; +import net.minecraft.network.chat.ChatDecorator;
@ -551,7 +552,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ if (acceptsNative(viewer)) { + if (acceptsNative(viewer)) {
+ this.sendNative(viewer, chatType, msgFunction); + this.sendNative(viewer, chatType, msgFunction);
+ } else { + } else {
+ final net.minecraft.network.chat.@Nullable Component unsigned = Util.mapNullable(msgFunction, f -> f.apply(viewer)); + final net.minecraft.network.chat.@Nullable Component unsigned = Optionull.map(msgFunction, f -> f.apply(viewer));
+ final PlayerChatMessage msg = unsigned == null ? ChatProcessor.this.message : ChatProcessor.this.message.withUnsignedContent(unsigned); + final PlayerChatMessage msg = unsigned == null ? ChatProcessor.this.message : ChatProcessor.this.message.withUnsignedContent(unsigned);
+ viewer.sendMessage(msg.adventureView(), this.adventure(chatType)); + viewer.sendMessage(msg.adventureView(), this.adventure(chatType));
+ } + }
@ -601,7 +602,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ if (viewer instanceof ConsoleCommandSender) { + if (viewer instanceof ConsoleCommandSender) {
+ this.sendToServer(chatType, msgFunction); + this.sendToServer(chatType, msgFunction);
+ } else if (viewer instanceof CraftPlayer craftPlayer) { + } else if (viewer instanceof CraftPlayer craftPlayer) {
+ craftPlayer.getHandle().sendChatMessage(ChatProcessor.this.outgoing, ChatProcessor.this.player.shouldFilterMessageTo(craftPlayer.getHandle()), chatType, Util.mapNullable(msgFunction, f -> f.apply(viewer))); + craftPlayer.getHandle().sendChatMessage(ChatProcessor.this.outgoing, ChatProcessor.this.player.shouldFilterMessageTo(craftPlayer.getHandle()), chatType, Optionull.map(msgFunction, f -> f.apply(viewer)));
+ } else if (viewer instanceof ForwardingAudience.Single single) { + } else if (viewer instanceof ForwardingAudience.Single single) {
+ this.sendNative(single.audience(), chatType, msgFunction); + this.sendNative(single.audience(), chatType, msgFunction);
+ } else { + } else {

View File

@ -27,7 +27,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ this.getJumpControl().tick(); + this.getJumpControl().tick();
+ } + }
+ if (this.isSensitiveToWater() && isInWaterRainOrBubble()) { + if (this.isSensitiveToWater() && isInWaterRainOrBubble()) {
+ hurt(DamageSource.DROWN, 1.0F); + hurt(this.damageSources().drown(), 1.0F);
+ } + }
+ return; + return;
+ } + }

View File

@ -144,7 +144,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ this.getHandle().setPodium(null); + this.getHandle().setPodium(null);
+ } else { + } else {
+ org.apache.commons.lang.Validate.isTrue(location.getWorld() == null || location.getWorld().equals(getWorld()), "You cannot set a podium in a different world to where the dragon is"); + org.apache.commons.lang.Validate.isTrue(location.getWorld() == null || location.getWorld().equals(getWorld()), "You cannot set a podium in a different world to where the dragon is");
+ this.getHandle().setPodium(new net.minecraft.core.BlockPos(location.getX(), location.getY(), location.getZ())); + this.getHandle().setPodium(io.papermc.paper.util.MCUtil.toBlockPos(location));
+ } + }
+ } + }
+ // Paper end + // Paper end

View File

@ -17,7 +17,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
} }
+ // Paper start + // Paper start
+ private static final int CURRENT_DATA_VERSION = SharedConstants.getCurrentVersion().getDataVersion().getVersion(); + private static final int CURRENT_DATA_VERSION = net.minecraft.SharedConstants.getCurrentVersion().getDataVersion().getVersion();
+ private static final boolean JUST_CORRUPT_IT = Boolean.getBoolean("Paper.ignoreWorldDataVersion"); + private static final boolean JUST_CORRUPT_IT = Boolean.getBoolean("Paper.ignoreWorldDataVersion");
+ // Paper end + // Paper end
public static InProgressChunkHolder loadChunk(ServerLevel world, PoiManager poiStorage, ChunkPos chunkPos, CompoundTag nbt, boolean distinguish) { public static InProgressChunkHolder loadChunk(ServerLevel world, PoiManager poiStorage, ChunkPos chunkPos, CompoundTag nbt, boolean distinguish) {

View File

@ -67,7 +67,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@Nullable @Nullable
private Advancement lastSelectedTab; private Advancement lastSelectedTab;
private boolean isFirstPacket = true; private boolean isFirstPacket = true;
+ public final Map<net.minecraft.advancements.critereon.SimpleCriterionTrigger, Set<CriterionTrigger.Listener>> criterionData = Maps.newIdentityHashMap(); // Paper - fix advancement data player leakage + public final Map<net.minecraft.advancements.critereon.SimpleCriterionTrigger, Set<CriterionTrigger.Listener>> criterionData = new java.util.IdentityHashMap<>(); // Paper - fix advancement data player leakage
public PlayerAdvancements(DataFixer dataFixer, PlayerList playerManager, ServerAdvancementManager advancementLoader, Path filePath, ServerPlayer owner) { public PlayerAdvancements(DataFixer dataFixer, PlayerList playerManager, ServerAdvancementManager advancementLoader, Path filePath, ServerPlayer owner) {
this.dataFixer = dataFixer; this.dataFixer = dataFixer;

View File

@ -72,24 +72,29 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+import com.google.common.base.Strings; +import com.google.common.base.Strings;
+import com.mojang.authlib.GameProfile; +import com.mojang.authlib.GameProfile;
+import io.papermc.paper.adventure.AdventureComponent; +import io.papermc.paper.adventure.AdventureComponent;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List; +import java.util.List;
+import java.util.Optional;
+import java.util.UUID; +import java.util.UUID;
+import javax.annotation.Nonnull; +import javax.annotation.Nonnull;
+import net.minecraft.network.Connection; +import net.minecraft.network.Connection;
+import net.minecraft.network.chat.Component;
+import net.minecraft.network.protocol.status.ClientboundStatusResponsePacket; +import net.minecraft.network.protocol.status.ClientboundStatusResponsePacket;
+import net.minecraft.network.protocol.status.ServerStatus; +import net.minecraft.network.protocol.status.ServerStatus;
+import net.minecraft.server.MinecraftServer; +import net.minecraft.server.MinecraftServer;
+import org.bukkit.craftbukkit.util.CraftIconCache;
+ +
+public final class StandardPaperServerListPingEventImpl extends PaperServerListPingEventImpl { +public final class StandardPaperServerListPingEventImpl extends PaperServerListPingEventImpl {
+ +
+ private static final GameProfile[] EMPTY_PROFILES = new GameProfile[0]; + // private static final GameProfile[] EMPTY_PROFILES = new GameProfile[0];
+ private static final UUID FAKE_UUID = new UUID(0, 0); + private static final UUID FAKE_UUID = new UUID(0, 0);
+ +
+ private GameProfile[] originalSample; + private List<GameProfile> originalSample;
+ +
+ private StandardPaperServerListPingEventImpl(MinecraftServer server, Connection networkManager, ServerStatus ping) { + private StandardPaperServerListPingEventImpl(MinecraftServer server, Connection networkManager, ServerStatus ping) {
+ super(server, new PaperStatusClient(networkManager), ping.getVersion() != null ? ping.getVersion().getProtocol() : -1, server.server.getServerIcon()); + super(server, new PaperStatusClient(networkManager), ping.version().map(ServerStatus.Version::protocol).orElse(-1), server.server.getServerIcon());
+ this.originalSample = ping.getPlayers() == null ? null : ping.getPlayers().getSample(); // GH-1473 - pre-tick race condition NPE + this.originalSample = ping.players().map(ServerStatus.Players::sample).orElse(null); // GH-1473 - pre-tick race condition NPE
+ } + }
+ +
+ @Nonnull + @Nonnull
@ -107,18 +112,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ return sample; + return sample;
+ } + }
+ +
+ private GameProfile[] getPlayerSampleHandle() { + private List<GameProfile> getPlayerSampleHandle() {
+ if (this.originalSample != null) { + if (this.originalSample != null) {
+ return this.originalSample; + return this.originalSample;
+ } + }
+ +
+ List<PlayerProfile> entries = super.getPlayerSample(); + List<PlayerProfile> entries = super.getPlayerSample();
+ if (entries.isEmpty()) { + if (entries.isEmpty()) {
+ return EMPTY_PROFILES; + return Collections.emptyList();
+ } + }
+ +
+ GameProfile[] profiles = new GameProfile[entries.size()]; + final List<GameProfile> profiles = new ArrayList<>();
+ for (int i = 0; i < profiles.length; i++) { + for (PlayerProfile profile : entries) {
+ /* + /*
+ * Avoid null UUIDs/names since that will make the response invalid + * Avoid null UUIDs/names since that will make the response invalid
+ * on the client. + * on the client.
@ -126,19 +131,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ * This can be used to create custom lines in the player list that do not + * This can be used to create custom lines in the player list that do not
+ * refer to a specific player. + * refer to a specific player.
+ */ + */
+
+ PlayerProfile profile = entries.get(i);
+ if (profile.getId() != null && profile.getName() != null) { + if (profile.getId() != null && profile.getName() != null) {
+ profiles[i] = CraftPlayerProfile.asAuthlib(profile); + profiles.add(CraftPlayerProfile.asAuthlib(profile));
+ } else { + } else {
+ profiles[i] = new GameProfile(MoreObjects.firstNonNull(profile.getId(), FAKE_UUID), Strings.nullToEmpty(profile.getName())); + profiles.add(new GameProfile(MoreObjects.firstNonNull(profile.getId(), FAKE_UUID), Strings.nullToEmpty(profile.getName())));
+ } + }
+ } + }
+
+ return profiles; + return profiles;
+ } + }
+ +
+ @SuppressWarnings("deprecation")
+ public static void processRequest(MinecraftServer server, Connection networkManager) { + public static void processRequest(MinecraftServer server, Connection networkManager) {
+ StandardPaperServerListPingEventImpl event = new StandardPaperServerListPingEventImpl(server, networkManager, server.getStatus()); + StandardPaperServerListPingEventImpl event = new StandardPaperServerListPingEventImpl(server, networkManager, server.getStatus());
+ server.server.getPluginManager().callEvent(event); + server.server.getPluginManager().callEvent(event);
@ -150,24 +151,29 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } + }
+ +
+ // Setup response + // Setup response
+ ServerStatus ping = new ServerStatus();
+ +
+ // Description + // Description
+ ping.setDescription(new AdventureComponent(event.motd())); + final Component description = new AdventureComponent(event.motd());
+ +
+ // Players + // Players
+ final Optional<ServerStatus.Players> players;
+ if (!event.shouldHidePlayers()) { + if (!event.shouldHidePlayers()) {
+ ping.setPlayers(new ServerStatus.Players(event.getMaxPlayers(), event.getNumPlayers())); + players = Optional.of(new ServerStatus.Players(event.getMaxPlayers(), event.getNumPlayers(), event.getPlayerSampleHandle()));
+ ping.getPlayers().setSample(event.getPlayerSampleHandle()); + } else {
+ players = Optional.empty();
+ } + }
+ +
+ // Version + // Version
+ ping.setVersion(new ServerStatus.Version(event.getVersion(), event.getProtocolVersion())); + final ServerStatus.Version version = new ServerStatus.Version(event.getVersion(), event.getProtocolVersion());
+ +
+ // Favicon + // Favicon
+ final Optional<ServerStatus.Favicon> favicon;
+ if (event.getServerIcon() != null) { + if (event.getServerIcon() != null) {
+ ping.setFavicon(event.getServerIcon().getData()); + favicon = Optional.of(new ServerStatus.Favicon(((CraftIconCache) event.getServerIcon()).value));
+ } else {
+ favicon = Optional.empty();
+ } + }
+ final ServerStatus ping = new ServerStatus(description, players, Optional.of(version), favicon, server.enforceSecureProfile());
+ +
+ // Send response + // Send response
+ networkManager.send(new ClientboundStatusResponsePacket(ping)); + networkManager.send(new ClientboundStatusResponsePacket(ping));
@ -215,7 +221,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.connection.send(new ClientboundStatusResponsePacket(ping)); this.connection.send(new ClientboundStatusResponsePacket(ping));
// CraftBukkit end // CraftBukkit end
+ */ + */
+ com.destroystokyo.paper.network.StandardPaperServerListPingEventImpl.processRequest(this.server, this.connection); + com.destroystokyo.paper.network.StandardPaperServerListPingEventImpl.processRequest(MinecraftServer.getServer(), this.connection);
+ // Paper end + // Paper end
} }
} }

View File

@ -719,6 +719,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public CraftLootable(World world, T tileEntity) { public CraftLootable(World world, T tileEntity) {
super(world, tileEntity); super(world, tileEntity);
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftSuspiciousSand.java b/src/main/java/org/bukkit/craftbukkit/block/CraftSuspiciousSand.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftSuspiciousSand.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftSuspiciousSand.java
@@ -0,0 +0,0 @@ public class CraftSuspiciousSand extends CraftBlockEntityState<SuspiciousSandBlo
this.setLootTable(this.getLootTable(), seed);
}
- private void setLootTable(LootTable table, long seed) {
+ public void setLootTable(LootTable table, long seed) { // Paper - change visibility since it overrides a public method
ResourceLocation key = (table == null) ? null : CraftNamespacedKey.toMinecraft(table.getKey());
getSnapshot().setLootTable(key, seed);
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftChestBoat.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftChestBoat.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftChestBoat.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftChestBoat.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftChestBoat.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftChestBoat.java

View File

@ -779,12 +779,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ +
+ @Override + @Override
+ public int getPickupCooldown() { + public int getPickupCooldown() {
+ return this.getHandle().cooldownTime; + throw new UnsupportedOperationException("Hopper minecarts don't have cooldowns");
+ } + }
+ +
+ @Override + @Override
+ public void setPickupCooldown(int cooldown) { + public void setPickupCooldown(int cooldown) {
+ this.getHandle().setCooldown(cooldown); + throw new UnsupportedOperationException("Hopper minecarts don't have cooldowns");
+ } + }
+ // Paper end + // Paper end
} }

View File

@ -17,10 +17,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- PlayerTeleportEvent event = new PlayerTeleportEvent(player, from.clone(), to.clone(), cause); - PlayerTeleportEvent event = new PlayerTeleportEvent(player, from.clone(), to.clone(), cause);
+ // Paper start - Teleport API + // Paper start - Teleport API
+ Set<io.papermc.paper.entity.TeleportFlag.Relative> relativeFlags = java.util.EnumSet.noneOf(io.papermc.paper.entity.TeleportFlag.Relative.class); + Set<io.papermc.paper.entity.TeleportFlag.Relative> relativeFlags = java.util.EnumSet.noneOf(io.papermc.paper.entity.TeleportFlag.Relative.class);
+ for (net.minecraft.network.protocol.game.ClientboundPlayerPositionPacket.RelativeArgument relativeArgument : set) { + for (RelativeMovement relativeArgument : set) {
+ relativeFlags.add(org.bukkit.craftbukkit.entity.CraftPlayer.toApiRelativeFlag(relativeArgument)); + relativeFlags.add(org.bukkit.craftbukkit.entity.CraftPlayer.toApiRelativeFlag(relativeArgument));
+ } + }
+ PlayerTeleportEvent event = new PlayerTeleportEvent(player, from.clone(), to.clone(), cause, flag, java.util.Set.copyOf(relativeFlags)); + PlayerTeleportEvent event = new PlayerTeleportEvent(player, from.clone(), to.clone(), cause, java.util.Set.copyOf(relativeFlags));
+ // Paper end + // Paper end
this.cserver.getPluginManager().callEvent(event); this.cserver.getPluginManager().callEvent(event);

View File

@ -20,7 +20,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ +
+ @Override + @Override
+ public Location locateNearestBiome(Location origin, Biome biome, int radius, int step) { + public Location locateNearestBiome(Location origin, Biome biome, int radius, int step) {
+ BlockPos originPos = new BlockPos(origin.getX(), origin.getY(), origin.getZ()); + BlockPos originPos = io.papermc.paper.util.MCUtil.toBlockPos(origin);
+ Pair<BlockPos, Holder<net.minecraft.world.level.biome.Biome>> pair = getHandle().findClosestBiome3d(holder -> holder.is(CraftNamespacedKey.toMinecraft(biome.getKey())), originPos, radius, step, step); + Pair<BlockPos, Holder<net.minecraft.world.level.biome.Biome>> pair = getHandle().findClosestBiome3d(holder -> holder.is(CraftNamespacedKey.toMinecraft(biome.getKey())), originPos, radius, step, step);
+ if (pair == null) { + if (pair == null) {
+ return null; + return null;
@ -92,7 +92,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } + }
+ +
+ public static net.minecraft.core.BlockPos toBlockPos(org.bukkit.util.Vector bukkit) { + public static net.minecraft.core.BlockPos toBlockPos(org.bukkit.util.Vector bukkit) {
+ return new net.minecraft.core.BlockPos(bukkit.getX(), bukkit.getY(), bukkit.getZ()); + return net.minecraft.core.BlockPos.containing(bukkit.getX(), bukkit.getY(), bukkit.getZ());
+ } + }
+ // Paper end + // Paper end
} }

View File

@ -43,7 +43,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
CraftItemStack result = CraftItemStack.asCraftMirror(this.result); CraftItemStack result = CraftItemStack.asCraftMirror(this.result);
- CraftSmithingRecipe recipe = new CraftSmithingRecipe(CraftNamespacedKey.fromMinecraft(this.id), result, CraftRecipe.toBukkit(this.base), CraftRecipe.toBukkit(this.addition)); - CraftSmithingRecipe recipe = new CraftSmithingRecipe(CraftNamespacedKey.fromMinecraft(this.id), result, CraftRecipe.toBukkit(this.base), CraftRecipe.toBukkit(this.addition));
+ CraftSmithingRecipe recipe = new CraftSmithingRecipe(CraftNamespacedKey.fromMinecraft(this.id), result, CraftRecipe.toBukkit(this.base), CraftRecipe.toBukkit(this.addition), this.copyNbt); // Paper + CraftSmithingRecipe recipe = new CraftSmithingRecipe(CraftNamespacedKey.fromMinecraft(this.id), result, CraftRecipe.toBukkit(this.base), CraftRecipe.toBukkit(this.addition), this.copyNBT); // Paper
return recipe; return recipe;
} }

View File

@ -136,7 +136,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ for (ServerPlayer player : players) { + for (ServerPlayer player : players) {
+ CraftPlayer bukkitPlayer = player.getBukkitEntity(); + CraftPlayer bukkitPlayer = player.getBukkitEntity();
+ if (bukkitPlayer.canSee(this)) { + if (bukkitPlayer.canSee(this)) {
+ bukkitPlayer.trackAndShowEntity(self); + bukkitPlayer.trackAndShowEntity(self.getBukkitEntity());
+ } + }
+ } + }
+ // Refresh misc player things AFTER sending game profile + // Refresh misc player things AFTER sending game profile

View File

@ -23142,7 +23142,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- Dynamic<T> dynamic2 = this.type.update(this.fixerUpper, dynamic, j, k); - Dynamic<T> dynamic2 = this.type.update(this.fixerUpper, dynamic, j, k);
+ // Paper start - route to new converter system + // Paper start - route to new converter system
+ Dynamic<T> dynamic2; + Dynamic<T> dynamic2;
+ if (this.type.getType() == net.minecraft.util.datafix.fixes.References.POI_CHUNK) { + if (this.type == net.minecraft.util.datafix.DataFixTypes.POI_CHUNK) {
+ dynamic2 = new Dynamic<>(dynamic.getOps(), (T)ca.spottedleaf.dataconverter.minecraft.MCDataConverter.convertTag(ca.spottedleaf.dataconverter.minecraft.datatypes.MCTypeRegistry.POI_CHUNK, (CompoundTag)dynamic.getValue(), j, k)); + dynamic2 = new Dynamic<>(dynamic.getOps(), (T)ca.spottedleaf.dataconverter.minecraft.MCDataConverter.convertTag(ca.spottedleaf.dataconverter.minecraft.datatypes.MCTypeRegistry.POI_CHUNK, (CompoundTag)dynamic.getValue(), j, k));
+ } else { + } else {
+ dynamic2 = this.type.update(this.fixerUpper, dynamic, j, k); + dynamic2 = this.type.update(this.fixerUpper, dynamic, j, k);

View File

@ -58,16 +58,3 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
player.sentListPacket = true; player.sentListPacket = true;
player.supressTrackerForLogin = false; // Paper player.supressTrackerForLogin = false; // Paper
((ServerLevel)player.level).getChunkSource().chunkMap.addEntity(player); // Paper - track entity now ((ServerLevel)player.level).getChunkSource().chunkMap.addEntity(player); // Paper - track entity now
diff --git a/src/main/java/net/minecraft/world/damagesource/DamageSources.java b/src/main/java/net/minecraft/world/damagesource/DamageSources.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/damagesource/DamageSources.java
+++ b/src/main/java/net/minecraft/world/damagesource/DamageSources.java
@@ -0,0 +0,0 @@ public class DamageSources {
public DamageSource sonicBoom(Entity attacker) {
return this.source(DamageTypes.SONIC_BOOM, attacker);
}
-
- public DamageSource badRespawnPointExplosion(Vec3 position) {
- return new DamageSource(this.damageTypes.getHolderOrThrow(DamageTypes.BAD_RESPAWN_POINT), position);
- }
}

View File

@ -13,6 +13,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
// Paper end // Paper end
+ // Paper start + // Paper start
+ @Override
+ public boolean isDeeplySleeping() { + public boolean isDeeplySleeping() {
+ return getHandle().isSleepingLongEnough(); + return getHandle().isSleepingLongEnough();
+ } + }