13
0
geforkt von Mirrors/Paper
Dieser Commit ist enthalten in:
Nassim Jahnke 2023-03-14 19:05:23 +01:00
Ursprung 7936e7a615
Commit 15ade6f446
34 geänderte Dateien mit 123 neuen und 127 gelöschten Zeilen

Datei anzeigen

@ -8,3 +8,5 @@
# To import classes from the vanilla Minecraft jar use `minecraft` as the artifactId: # To import classes from the vanilla Minecraft jar use `minecraft` as the artifactId:
# minecraft net.minecraft.world.level.entity.LevelEntityGetterAdapter # minecraft net.minecraft.world.level.entity.LevelEntityGetterAdapter
# minecraft net/minecraft/world/level/entity/LevelEntityGetter.java # minecraft net/minecraft/world/level/entity/LevelEntityGetter.java
minecraft net.minecraft.WorldVersion

Datei anzeigen

@ -5,7 +5,7 @@ plugins {
java java
`maven-publish` `maven-publish`
id("com.github.johnrengelman.shadow") version "8.1.0" apply false id("com.github.johnrengelman.shadow") version "8.1.0" apply false
id("io.papermc.paperweight.core") version "1.5.2" id("io.papermc.paperweight.core") version "1.5.3"
} }
allprojects { allprojects {

Datei anzeigen

@ -8,7 +8,7 @@ diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/n
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java --- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -0,0 +0,0 @@ public abstract class Mob extends LivingEntity { @@ -0,0 +0,0 @@ public abstract class Mob extends LivingEntity implements Targeting {
if (entityhuman != null) { if (entityhuman != null) {
double d0 = entityhuman.distanceToSqr((Entity) this); double d0 = entityhuman.distanceToSqr((Entity) this);

Datei anzeigen

@ -1589,11 +1589,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public class PacketEncoder extends MessageToByteEncoder<Packet<?>> { @@ -0,0 +0,0 @@ public class PacketEncoder extends MessageToByteEncoder<Packet<?>> {
} else { } else {
FriendlyByteBuf friendlyByteBuf = new FriendlyByteBuf(byteBuf); FriendlyByteBuf friendlyByteBuf = new FriendlyByteBuf(byteBuf);
friendlyByteBuf.writeVarInt(integer); friendlyByteBuf.writeVarInt(i);
+ friendlyByteBuf.adventure$locale = channelHandlerContext.channel().attr(PaperAdventure.LOCALE_ATTRIBUTE).get(); // Paper + friendlyByteBuf.adventure$locale = channelHandlerContext.channel().attr(PaperAdventure.LOCALE_ATTRIBUTE).get(); // Paper
try { try {
int i = friendlyByteBuf.writerIndex(); int j = friendlyByteBuf.writerIndex();
diff --git a/src/main/java/net/minecraft/network/chat/ChatDecorator.java b/src/main/java/net/minecraft/network/chat/ChatDecorator.java diff --git a/src/main/java/net/minecraft/network/chat/ChatDecorator.java b/src/main/java/net/minecraft/network/chat/ChatDecorator.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/network/chat/ChatDecorator.java --- a/src/main/java/net/minecraft/network/chat/ChatDecorator.java
@ -2274,14 +2274,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.broadcastChatMessage(playerchatmessage1); this.broadcastChatMessage(playerchatmessage1);
}, this.server.chatExecutor); // CraftBukkit - async chat }, this.server.chatExecutor); // CraftBukkit - async chat
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
this.disconnect(Component.translatable("multiplayer.disconnect.out_of_order_chat"));
return Optional.empty();
} else if (this.player.isRemoved() || this.player.getChatVisibility() == ChatVisiblity.HIDDEN) { // CraftBukkit - dead men tell no tales
- this.send(new ClientboundSystemChatPacket(Component.translatable("chat.disabled.options").withStyle(ChatFormatting.RED), false));
+ this.send(new ClientboundSystemChatPacket(PaperAdventure.asAdventure(Component.translatable("chat.disabled.options").withStyle(ChatFormatting.RED)), false)); // Paper - Adventure
return Optional.empty();
} else {
Optional<LastSeenMessages> optional = this.unpackAndApplyLastSeen(acknowledgment); Optional<LastSeenMessages> optional = this.unpackAndApplyLastSeen(acknowledgment);
if (this.player.isRemoved() || this.player.getChatVisibility() == ChatVisiblity.HIDDEN) { // CraftBukkit - dead men tell no tales
- this.send(new ClientboundSystemChatPacket(Component.translatable("chat.disabled.options").withStyle(ChatFormatting.RED), false));
+ this.send(new ClientboundSystemChatPacket(PaperAdventure.asAdventure(Component.translatable("chat.disabled.options").withStyle(ChatFormatting.RED)), false)); // Paper - Adventure
return Optional.empty();
} else {
this.player.resetLastActionTime();
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
this.handleCommand(s); this.handleCommand(s);
} else if (this.player.getChatVisibility() == ChatVisiblity.SYSTEM) { } else if (this.player.getChatVisibility() == ChatVisiblity.SYSTEM) {
@ -2379,8 +2379,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
CraftIconCache icon = server.server.getServerIcon(); CraftIconCache icon = server.server.getServerIcon();
ServerListPingEvent() { ServerListPingEvent() {
- super(connection.hostname, ((InetSocketAddress) ServerStatusPacketListenerImpl.this.connection.getRemoteAddress()).getAddress(), ServerStatusPacketListenerImpl.this.server.getMotd(), ServerStatusPacketListenerImpl.this.server.getPlayerList().getMaxPlayers()); - super(connection.hostname, ((InetSocketAddress) ServerStatusPacketListenerImpl.this.connection.getRemoteAddress()).getAddress(), server.getMotd(), server.getPlayerList().getMaxPlayers());
+ super(connection.hostname, ((InetSocketAddress) ServerStatusPacketListenerImpl.this.connection.getRemoteAddress()).getAddress(), ServerStatusPacketListenerImpl.this.server.server.motd(), ServerStatusPacketListenerImpl.this.server.getPlayerList().getMaxPlayers()); // Paper - Adventure + super(connection.hostname, ((InetSocketAddress) ServerStatusPacketListenerImpl.this.connection.getRemoteAddress()).getAddress(), server.server.motd(), server.getPlayerList().getMaxPlayers()); // Paper - Adventure
} }
@Override @Override
@ -2404,7 +2404,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ Component joinMessage = ichatmutablecomponent; // Paper - Adventure + Component joinMessage = ichatmutablecomponent; // Paper - Adventure
playerconnection.teleport(player.getX(), player.getY(), player.getZ(), player.getYRot(), player.getXRot()); playerconnection.teleport(player.getX(), player.getY(), player.getZ(), player.getYRot(), player.getXRot());
player.sendServerStatus(this.server.getStatus()); ServerStatus serverping = this.server.getStatus();
@@ -0,0 +0,0 @@ public abstract class PlayerList { @@ -0,0 +0,0 @@ public abstract class PlayerList {
// Ensure that player inventory is populated with its viewer // Ensure that player inventory is populated with its viewer
player.containerMenu.transferTo(player.containerMenu, bukkitPlayer); player.containerMenu.transferTo(player.containerMenu, bukkitPlayer);
@ -2413,7 +2413,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ PlayerJoinEvent playerJoinEvent = new PlayerJoinEvent(bukkitPlayer, PaperAdventure.asAdventure(ichatmutablecomponent)); // Paper - Adventure + PlayerJoinEvent playerJoinEvent = new PlayerJoinEvent(bukkitPlayer, PaperAdventure.asAdventure(ichatmutablecomponent)); // Paper - Adventure
this.cserver.getPluginManager().callEvent(playerJoinEvent); this.cserver.getPluginManager().callEvent(playerJoinEvent);
if (!player.connection.connection.isConnected()) { if (!player.connection.isAcceptingMessages()) {
return; return;
} }

Datei anzeigen

@ -8,7 +8,7 @@ diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/n
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java --- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -0,0 +0,0 @@ public abstract class Mob extends LivingEntity { @@ -0,0 +0,0 @@ public abstract class Mob extends LivingEntity implements Targeting {
private final BodyRotationControl bodyRotationControl; private final BodyRotationControl bodyRotationControl;
protected PathNavigation navigation; protected PathNavigation navigation;
public GoalSelector goalSelector; public GoalSelector goalSelector;
@ -16,7 +16,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public GoalSelector targetSelector; public GoalSelector targetSelector;
@Nullable @Nullable
private LivingEntity target; private LivingEntity target;
@@ -0,0 +0,0 @@ public abstract class Mob extends LivingEntity { @@ -0,0 +0,0 @@ public abstract class Mob extends LivingEntity implements Targeting {
@Override @Override
protected final void serverAiStep() { protected final void serverAiStep() {
++this.noActionTime; ++this.noActionTime;

Datei anzeigen

@ -20,7 +20,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ implementation("org.ow2.asm:asm-commons:9.4") // Paper - ASM event executor generation + implementation("org.ow2.asm:asm-commons:9.4") // Paper - ASM event executor generation
implementation("commons-lang:commons-lang:2.6") implementation("commons-lang:commons-lang:2.6")
runtimeOnly("org.xerial:sqlite-jdbc:3.36.0.3") runtimeOnly("org.xerial:sqlite-jdbc:3.36.0.3")
runtimeOnly("mysql:mysql-connector-java:8.0.29") runtimeOnly("com.mysql:mysql-connector-j:8.0.32")
@@ -0,0 +0,0 @@ dependencies { @@ -0,0 +0,0 @@ dependencies {
testImplementation("junit:junit:4.13.2") testImplementation("junit:junit:4.13.2")
@ -29,7 +29,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ implementation("io.netty:netty-all:4.1.87.Final"); // Paper - Bump netty + implementation("io.netty:netty-all:4.1.87.Final"); // Paper - Bump netty
} }
val craftbukkitPackageVersion = "1_19_R2" // Paper val craftbukkitPackageVersion = "1_19_R3" // Paper
@@ -0,0 +0,0 @@ tasks.jar { @@ -0,0 +0,0 @@ tasks.jar {
val gitHash = git("rev-parse", "--short=7", "HEAD").getText().trim() val gitHash = git("rev-parse", "--short=7", "HEAD").getText().trim()
val implementationVersion = System.getenv("BUILD_NUMBER") ?: "\"$gitHash\"" val implementationVersion = System.getenv("BUILD_NUMBER") ?: "\"$gitHash\""
@ -78,7 +78,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ Date buildDate = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss Z").parse(Main.class.getPackage().getImplementationVendor()); // Paper + Date buildDate = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss Z").parse(Main.class.getPackage().getImplementationVendor()); // Paper
Calendar deadline = Calendar.getInstance(); Calendar deadline = Calendar.getInstance();
deadline.add(Calendar.DAY_OF_YEAR, -28); deadline.add(Calendar.DAY_OF_YEAR, -3);
diff --git a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java diff --git a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java --- a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java

Datei anzeigen

@ -38,9 +38,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@Override @Override
- protected void addPassenger(Entity passenger) { - protected void addPassenger(Entity passenger) {
+ protected boolean addPassenger(Entity passenger) { // Paper - fix upstream - throw new IllegalStateException("Should never addPassenger without checking couldAcceptPassenger()");
passenger.stopRiding(); + protected boolean addPassenger(Entity passenger) { // Paper - fix return type
+ return false; // Paper - fix upstream + return false; // Paper
} }
@Override @Override

Datei anzeigen

@ -31,7 +31,7 @@ diff --git a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java b/src/
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java --- a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
+++ b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java +++ b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
@@ -0,0 +0,0 @@ public class PrimedTnt extends Entity { @@ -0,0 +0,0 @@ public class PrimedTnt extends Entity implements TraceableEntity {
} }
this.move(MoverType.SELF, this.getDeltaMovement()); this.move(MoverType.SELF, this.getDeltaMovement());

Datei anzeigen

@ -116,7 +116,7 @@ diff --git a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java b/src/
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java --- a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
+++ b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java +++ b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
@@ -0,0 +0,0 @@ public class PrimedTnt extends Entity { @@ -0,0 +0,0 @@ public class PrimedTnt extends Entity implements TraceableEntity {
@Override @Override
protected void readAdditionalSaveData(CompoundTag nbt) { protected void readAdditionalSaveData(CompoundTag nbt) {
this.setFuse(nbt.getShort("Fuse")); this.setFuse(nbt.getShort("Fuse"));

Datei anzeigen

@ -52,19 +52,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
return registry; return registry;
} }
diff --git a/src/main/java/net/minecraft/nbt/NbtUtils.java b/src/main/java/net/minecraft/nbt/NbtUtils.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/nbt/NbtUtils.java
+++ b/src/main/java/net/minecraft/nbt/NbtUtils.java
@@ -0,0 +0,0 @@ public final class NbtUtils {
}
public static CompoundTag update(DataFixer fixer, DataFixTypes fixTypes, CompoundTag compound, int oldVersion, int targetVersion) {
- return fixer.update(fixTypes.getType(), new Dynamic<>(NbtOps.INSTANCE, compound), oldVersion, targetVersion).getValue();
+ return (CompoundTag) fixer.update(fixTypes.getType(), new Dynamic<>(NbtOps.INSTANCE, compound), oldVersion, targetVersion).getValue(); // Paper - decompile fix
}
public static Component toPrettyComponent(Tag element) {
diff --git a/src/main/java/net/minecraft/network/chat/ComponentUtils.java b/src/main/java/net/minecraft/network/chat/ComponentUtils.java diff --git a/src/main/java/net/minecraft/network/chat/ComponentUtils.java b/src/main/java/net/minecraft/network/chat/ComponentUtils.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/network/chat/ComponentUtils.java --- a/src/main/java/net/minecraft/network/chat/ComponentUtils.java
@ -74,8 +61,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (string instanceof TranslatableContents) { if (string instanceof TranslatableContents) {
TranslatableContents translatableContents = (TranslatableContents)string; TranslatableContents translatableContents = (TranslatableContents)string;
- String string = translatableContents.getKey(); - String string = translatableContents.getKey();
- return Language.getInstance().has(string); String string2 = translatableContents.getFallback();
+ return Language.getInstance().has(translatableContents.getKey()); // Paper - decompile fix - return string2 != null || Language.getInstance().has(string);
+ return string2 != null || Language.getInstance().has(translatableContents.getKey()); // Paper - decompile fix
} }
} }

Datei anzeigen

@ -5446,6 +5446,22 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
} }
public static long getEpochMillis() { public static long getEpochMillis() {
diff --git a/src/main/java/net/minecraft/WorldVersion.java b/src/main/java/net/minecraft/WorldVersion.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/WorldVersion.java
+++ b/src/main/java/net/minecraft/WorldVersion.java
@@ -0,0 +0,0 @@ import net.minecraft.world.level.storage.DataVersion;
public interface WorldVersion {
DataVersion getDataVersion();
+ // Paper start
+ default int getWorldVersion() {
+ return this.getDataVersion().getVersion();
+ }
+ // Paper end
String getId();
diff --git a/src/main/java/net/minecraft/core/BlockPos.java b/src/main/java/net/minecraft/core/BlockPos.java diff --git a/src/main/java/net/minecraft/core/BlockPos.java b/src/main/java/net/minecraft/core/BlockPos.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/core/BlockPos.java --- a/src/main/java/net/minecraft/core/BlockPos.java
@ -5495,11 +5511,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/network/PacketEncoder.java --- a/src/main/java/net/minecraft/network/PacketEncoder.java
+++ b/src/main/java/net/minecraft/network/PacketEncoder.java +++ b/src/main/java/net/minecraft/network/PacketEncoder.java
@@ -0,0 +0,0 @@ public class PacketEncoder extends MessageToByteEncoder<Packet<?>> { @@ -0,0 +0,0 @@ public class PacketEncoder extends MessageToByteEncoder<Packet<?>> {
JvmProfiler.INSTANCE.onPacketSent(k, integer, channelHandlerContext.channel().remoteAddress(), j); JvmProfiler.INSTANCE.onPacketSent(l, i, channelHandlerContext.channel().remoteAddress(), k);
} }
} catch (Throwable var10) { } catch (Throwable var10) {
- LOGGER.error("Error receiving packet {}", integer, var10); - LOGGER.error("Error receiving packet {}", i, var10);
+ LOGGER.error("Packet encoding of packet ID {} threw (skippable? {})", integer, packet.isSkippable(), var10); // Paper - Give proper error message + LOGGER.error("Packet encoding of packet ID {} threw (skippable? {})", i, packet.isSkippable(), var10); // Paper - Give proper error message
if (packet.isSkippable()) { if (packet.isSkippable()) {
throw new SkipPacketException(var10); throw new SkipPacketException(var10);
} else { } else {
@ -5540,7 +5556,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- -
+ io.papermc.paper.util.CachedLists.reset(); // Paper + io.papermc.paper.util.CachedLists.reset(); // Paper
this.profiler.push("tallying"); this.profiler.push("tallying");
long l = this.tickTimes[this.tickCount % 100] = Util.getNanos() - i; long j = this.tickTimes[this.tickCount % 100] = Util.getNanos() - i;
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
try { try {
@ -6526,7 +6542,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ +
// Add env and gen to constructor, IWorldDataServer -> WorldDataServer // Add env and gen to constructor, IWorldDataServer -> WorldDataServer
public ServerLevel(MinecraftServer minecraftserver, Executor executor, LevelStorageSource.LevelStorageAccess convertable_conversionsession, PrimaryLevelData iworlddataserver, ResourceKey<Level> resourcekey, LevelStem worlddimension, ChunkProgressListener worldloadlistener, boolean flag, long i, List<CustomSpawner> list, boolean flag1, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider) { public ServerLevel(MinecraftServer minecraftserver, Executor executor, LevelStorageSource.LevelStorageAccess convertable_conversionsession, PrimaryLevelData iworlddataserver, ResourceKey<Level> resourcekey, LevelStem worlddimension, ChunkProgressListener worldloadlistener, boolean flag, long i, List<CustomSpawner> list, boolean flag1, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider) {
// Holder holder = worlddimension.type(); // CraftBukkit - decompile error // IRegistryCustom.Dimension iregistrycustom_dimension = minecraftserver.registryAccess(); // CraftBukkit - decompile error
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
@ -6541,7 +6557,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public ServerPlayer(MinecraftServer server, ServerLevel world, GameProfile profile) { public ServerPlayer(MinecraftServer server, ServerLevel world, GameProfile profile) {
super(world, world.getSharedSpawnPos(), world.getSharedSpawnAngle(), profile); super(world, world.getSharedSpawnPos(), world.getSharedSpawnAngle(), profile);
@@ -0,0 +0,0 @@ public class ServerPlayer extends Player { @@ -0,0 +0,0 @@ public class ServerPlayer extends Player {
this.maxUpStep = 1.0F; this.setMaxUpStep(1.0F);
this.fudgeSpawnLocation(world); this.fudgeSpawnLocation(world);
+ this.cachedSingleHashSet = new com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<>(this); // Paper + this.cachedSingleHashSet = new com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<>(this); // Paper
@ -6642,7 +6658,7 @@ diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/ma
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity { @@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity implements Attackable {
public boolean collides = true; public boolean collides = true;
public Set<UUID> collidableExemptions = new HashSet<>(); public Set<UUID> collidableExemptions = new HashSet<>();
public boolean bukkitPickUpLoot; public boolean bukkitPickUpLoot;
@ -6654,7 +6670,7 @@ diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/n
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java --- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -0,0 +0,0 @@ public abstract class Mob extends LivingEntity { @@ -0,0 +0,0 @@ public abstract class Mob extends LivingEntity implements Targeting {
return this.target; return this.target;
} }

Datei anzeigen

@ -24,7 +24,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ implementation("org.spongepowered:configurate-yaml:4.1.2") // Paper - config files + implementation("org.spongepowered:configurate-yaml:4.1.2") // Paper - config files
implementation("commons-lang:commons-lang:2.6") implementation("commons-lang:commons-lang:2.6")
runtimeOnly("org.xerial:sqlite-jdbc:3.36.0.3") runtimeOnly("org.xerial:sqlite-jdbc:3.36.0.3")
runtimeOnly("mysql:mysql-connector-java:8.0.29") runtimeOnly("com.mysql:mysql-connector-j:8.0.32")
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
@ -4417,17 +4417,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/Main.java --- a/src/main/java/net/minecraft/server/Main.java
+++ b/src/main/java/net/minecraft/server/Main.java +++ b/src/main/java/net/minecraft/server/Main.java
@@ -0,0 +0,0 @@ public class Main { @@ -0,0 +0,0 @@ public class Main {
DedicatedServerSettings dedicatedserversettings = new DedicatedServerSettings(optionset); // CraftBukkit - CLI argument support
dedicatedserversettings.forceSave(); dedicatedserversettings.forceSave();
Path path2 = Paths.get("eula.txt");
Eula eula = new Eula(path2);
+ // Paper start - load config files for access below if needed + // Paper start - load config files for access below if needed
+ org.bukkit.configuration.file.YamlConfiguration bukkitConfiguration = io.papermc.paper.configuration.PaperConfigurations.loadLegacyConfigFile((File) optionset.valueOf("bukkit-settings")); + org.bukkit.configuration.file.YamlConfiguration bukkitConfiguration = io.papermc.paper.configuration.PaperConfigurations.loadLegacyConfigFile((File) optionset.valueOf("bukkit-settings"));
+ org.bukkit.configuration.file.YamlConfiguration spigotConfiguration = io.papermc.paper.configuration.PaperConfigurations.loadLegacyConfigFile((File) optionset.valueOf("spigot-settings")); + org.bukkit.configuration.file.YamlConfiguration spigotConfiguration = io.papermc.paper.configuration.PaperConfigurations.loadLegacyConfigFile((File) optionset.valueOf("spigot-settings"));
+ // Paper end + // Paper end
+
Path path1 = Paths.get("eula.txt");
Eula eula = new Eula(path1);
if (optionset.has("initSettings")) { // CraftBukkit
// CraftBukkit start - SPIGOT-5761: Create bukkit.yml and commands.yml if not present
@@ -0,0 +0,0 @@ public class Main { @@ -0,0 +0,0 @@ public class Main {
} }
@ -4527,11 +4526,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -0,0 +0,0 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -0,0 +0,0 @@ public class ServerLevel extends Level implements WorldGenLevel {
public ServerLevel(MinecraftServer minecraftserver, Executor executor, LevelStorageSource.LevelStorageAccess convertable_conversionsession, PrimaryLevelData iworlddataserver, ResourceKey<Level> resourcekey, LevelStem worlddimension, ChunkProgressListener worldloadlistener, boolean flag, long i, List<CustomSpawner> list, boolean flag1, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider) {
// Holder holder = worlddimension.type(); // CraftBukkit - decompile error // Holder holder = worlddimension.type(); // CraftBukkit - decompile error
// Objects.requireNonNull(minecraftserver); // CraftBukkit - decompile error // Objects.requireNonNull(minecraftserver); // CraftBukkit - decompile error
- super(iworlddataserver, resourcekey, worlddimension.type(), minecraftserver::getProfiler, false, flag, i, minecraftserver.getMaxChainedNeighborUpdates(), gen, biomeProvider, env); - super(iworlddataserver, resourcekey, minecraftserver.registryAccess(), worlddimension.type(), minecraftserver::getProfiler, false, flag, i, minecraftserver.getMaxChainedNeighborUpdates(), gen, biomeProvider, env);
+ super(iworlddataserver, resourcekey, worlddimension.type(), minecraftserver::getProfiler, false, flag, i, minecraftserver.getMaxChainedNeighborUpdates(), gen, biomeProvider, env, spigotConfig -> minecraftserver.paperConfigurations.createWorldConfig(io.papermc.paper.configuration.PaperConfigurations.createWorldContextMap(convertable_conversionsession.levelDirectory.path(), iworlddataserver.getLevelName(), resourcekey.location(), spigotConfig))); // Paper + super(iworlddataserver, resourcekey, minecraftserver.registryAccess(), worlddimension.type(), minecraftserver::getProfiler, false, flag, i, minecraftserver.getMaxChainedNeighborUpdates(), gen, biomeProvider, env, spigotConfig -> minecraftserver.paperConfigurations.createWorldConfig(io.papermc.paper.configuration.PaperConfigurations.createWorldContextMap(convertable_conversionsession.levelDirectory.path(), iworlddataserver.getLevelName(), resourcekey.location(), spigotConfig))); // Paper
this.pvpMode = minecraftserver.isPvpAllowed(); this.pvpMode = minecraftserver.isPvpAllowed();
this.convertable = convertable_conversionsession; this.convertable = convertable_conversionsession;
this.uuid = WorldUUID.getUUID(convertable_conversionsession.levelDirectory.path().toFile()); this.uuid = WorldUUID.getUUID(convertable_conversionsession.levelDirectory.path().toFile());
@ -4556,8 +4555,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public abstract ResourceKey<LevelStem> getTypeKey(); public abstract ResourceKey<LevelStem> getTypeKey();
- protected Level(WritableLevelData worlddatamutable, ResourceKey<Level> resourcekey, Holder<DimensionType> holder, Supplier<ProfilerFiller> supplier, boolean flag, boolean flag1, long i, int j, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env) { - protected Level(WritableLevelData worlddatamutable, ResourceKey<Level> resourcekey, RegistryAccess iregistrycustom, Holder<DimensionType> holder, Supplier<ProfilerFiller> supplier, boolean flag, boolean flag1, long i, int j, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env) {
+ protected Level(WritableLevelData worlddatamutable, ResourceKey<Level> resourcekey, Holder<DimensionType> holder, Supplier<ProfilerFiller> supplier, boolean flag, boolean flag1, long i, int j, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env, java.util.function.Function<org.spigotmc.SpigotWorldConfig, io.papermc.paper.configuration.WorldConfiguration> paperWorldConfigCreator) { // Paper + protected Level(WritableLevelData worlddatamutable, ResourceKey<Level> resourcekey, RegistryAccess iregistrycustom, Holder<DimensionType> holder, Supplier<ProfilerFiller> supplier, boolean flag, boolean flag1, long i, int j, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env, java.util.function.Function<org.spigotmc.SpigotWorldConfig, io.papermc.paper.configuration.WorldConfiguration> paperWorldConfigCreator) { // Paper
this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName()); // Spigot this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName()); // Spigot
+ this.paperConfig = paperWorldConfigCreator.apply(this.spigotConfig); // Paper + this.paperConfig = paperWorldConfigCreator.apply(this.spigotConfig); // Paper
this.generator = gen; this.generator = gen;

Datei anzeigen

@ -24,7 +24,7 @@ diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/n
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java --- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -0,0 +0,0 @@ public abstract class Mob extends LivingEntity { @@ -0,0 +0,0 @@ public abstract class Mob extends LivingEntity implements Targeting {
if (this.level.getDifficulty() == Difficulty.PEACEFUL && this.shouldDespawnInPeaceful()) { if (this.level.getDifficulty() == Difficulty.PEACEFUL && this.shouldDespawnInPeaceful()) {
this.discard(); this.discard();
} else if (!this.isPersistenceRequired() && !this.requiresCustomPersistence()) { } else if (!this.isPersistenceRequired() && !this.requiresCustomPersistence()) {
@ -77,9 +77,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/world/entity/player/Player.java --- a/src/main/java/net/minecraft/world/entity/player/Player.java
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java +++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -0,0 +0,0 @@ public abstract class Player extends LivingEntity { @@ -0,0 +0,0 @@ public abstract class Player extends LivingEntity {
private Optional<GlobalPos> lastDeathLocation;
@Nullable @Nullable
public FishingHook fishing; public FishingHook fishing;
protected float hurtDir;
+ // Paper start + // Paper start
+ public boolean affectsSpawning = true; + public boolean affectsSpawning = true;
+ // Paper end + // Paper end

Datei anzeigen

@ -41,21 +41,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
} }
} }
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
LevelChunk chunk1;
if (chunk instanceof LevelChunk) {
- LevelChunk chunk1 = (LevelChunk) chunk;
-
- chunk1 = chunk1;
+ chunk1 = (LevelChunk) chunk; // Paper - remap fix
} else {
chunk1 = this.level.getChunk(chunkcoordintpair.x, chunkcoordintpair.z);
}
diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/BehaviorUtils.java b/src/main/java/net/minecraft/world/entity/ai/behavior/BehaviorUtils.java diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/BehaviorUtils.java b/src/main/java/net/minecraft/world/entity/ai/behavior/BehaviorUtils.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/ai/behavior/BehaviorUtils.java --- a/src/main/java/net/minecraft/world/entity/ai/behavior/BehaviorUtils.java

Datei anzeigen

@ -13471,7 +13471,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public static ChunkStatus getStatus(int level) { public static ChunkStatus getStatus(int level) {
return level < 33 ? ChunkStatus.FULL : ChunkStatus.getStatusAroundFullChunk(level - 33); return level < 33 ? ChunkStatus.FULL : ChunkStatus.getStatusAroundFullChunk(level - 33);
@@ -0,0 +0,0 @@ public class ChunkHolder { @@ -0,0 +0,0 @@ public class ChunkHolder {
return ChunkHolder.FULL_CHUNK_STATUSES[Mth.clamp(33 - distance + 1, (int) 0, ChunkHolder.FULL_CHUNK_STATUSES.length - 1)]; return ChunkHolder.FULL_CHUNK_STATUSES[Mth.clamp(33 - distance + 1, 0, ChunkHolder.FULL_CHUNK_STATUSES.length - 1)];
} }
- public boolean wasAccessibleSinceLastSave() { - public boolean wasAccessibleSinceLastSave() {
@ -14311,7 +14311,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } + }
+ // Paper end - replace player loader system + // Paper end - replace player loader system
public void setViewDistance(int watchDistance) { public void setViewDistance(int watchDistance) {
int j = Mth.clamp(watchDistance + 1, (int) 3, (int) 33); int j = Mth.clamp(watchDistance + 1, 3, 33);
@@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
int k = this.viewDistance; int k = this.viewDistance;
@ -17286,8 +17286,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- } - }
- -
- }); - });
- CompoundTag compoundTag = new CompoundTag(); - CompoundTag compoundTag = NbtUtils.addCurrentDataVersion(new CompoundTag());
- compoundTag.putInt("DataVersion", SharedConstants.getCurrentVersion().getWorldVersion());
- compoundTag.put("Entities", listTag); - compoundTag.put("Entities", listTag);
- writeChunkPos(compoundTag, chunkPos); - writeChunkPos(compoundTag, chunkPos);
- this.worker.store(chunkPos, compoundTag).exceptionally((ex) -> { - this.worker.store(chunkPos, compoundTag).exceptionally((ex) -> {
@ -17321,6 +17320,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ if (!force && entities.isEmpty()) { + if (!force && entities.isEmpty()) {
+ return null; + return null;
+ } + }
+
+ ListTag listTag = new ListTag(); + ListTag listTag = new ListTag();
+ entities.forEach((entity) -> { // diff here: use entities parameter + entities.forEach((entity) -> { // diff here: use entities parameter
+ CompoundTag compoundTag = new CompoundTag(); + CompoundTag compoundTag = new CompoundTag();
@ -17329,10 +17329,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } + }
+ +
+ }); + });
+ CompoundTag compoundTag = new CompoundTag(); + CompoundTag compoundTag = NbtUtils.addCurrentDataVersion(new CompoundTag());
+ compoundTag.putInt("DataVersion", SharedConstants.getCurrentVersion().getWorldVersion());
+ compoundTag.put("Entities", listTag); + compoundTag.put("Entities", listTag);
+ writeChunkPos(compoundTag, chunkPos); + writeChunkPos(compoundTag, chunkPos);
+ // Paper - remove worker usage
+ +
+ return !force && listTag.isEmpty() ? null : compoundTag; + return !force && listTag.isEmpty() ? null : compoundTag;
+ } + }
@ -17347,10 +17347,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- private CompoundTag upgradeChunkTag(CompoundTag chunkNbt) { - private CompoundTag upgradeChunkTag(CompoundTag chunkNbt) {
+ public static CompoundTag upgradeChunkTag(CompoundTag chunkNbt) { // Paper - public and static + public static CompoundTag upgradeChunkTag(CompoundTag chunkNbt) { // Paper - public and static
int i = getVersion(chunkNbt); int i = NbtUtils.getDataVersion(chunkNbt, -1);
return ca.spottedleaf.dataconverter.minecraft.MCDataConverter.convertTag(ca.spottedleaf.dataconverter.minecraft.datatypes.MCTypeRegistry.ENTITY_CHUNK, chunkNbt, i, SharedConstants.getCurrentVersion().getWorldVersion()); // Paper - route to new converter system return ca.spottedleaf.dataconverter.minecraft.MCDataConverter.convertTag(ca.spottedleaf.dataconverter.minecraft.datatypes.MCTypeRegistry.ENTITY_CHUNK, chunkNbt, i, net.minecraft.SharedConstants.getCurrentVersion().getWorldVersion()); // Paper - route to new converter system
} }
@@ -0,0 +0,0 @@ public class EntityStorage implements EntityPersistentStorage<Entity> {
@Override @Override
public void close() throws IOException { public void close() throws IOException {

Datei anzeigen

@ -22841,7 +22841,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
// CraftBukkit end // CraftBukkit end
if (i < 1493) { if (i < 1493) {
- nbttagcompound = NbtUtils.update(this.fixerUpper, DataFixTypes.CHUNK, nbttagcompound, i, 1493); - nbttagcompound = DataFixTypes.CHUNK.update(this.fixerUpper, nbttagcompound, i, 1493);
+ ca.spottedleaf.dataconverter.minecraft.MCDataConverter.convertTag(ca.spottedleaf.dataconverter.minecraft.datatypes.MCTypeRegistry.CHUNK, nbttagcompound, i, 1493); // Paper - replace chunk converter + ca.spottedleaf.dataconverter.minecraft.MCDataConverter.convertTag(ca.spottedleaf.dataconverter.minecraft.datatypes.MCTypeRegistry.CHUNK, nbttagcompound, i, 1493); // Paper - replace chunk converter
if (nbttagcompound.getCompound("Level").getBoolean("hasLegacyStructureData")) { if (nbttagcompound.getCompound("Level").getBoolean("hasLegacyStructureData")) {
LegacyStructureDataHandler persistentstructurelegacy = this.getLegacyStructureHandler(resourcekey, supplier); LegacyStructureDataHandler persistentstructurelegacy = this.getLegacyStructureHandler(resourcekey, supplier);
@ -22850,10 +22850,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
// Spigot end // Spigot end
ChunkStorage.injectDatafixingContext(nbttagcompound, resourcekey, optional); ChunkStorage.injectDatafixingContext(nbttagcompound, resourcekey, optional);
- nbttagcompound = NbtUtils.update(this.fixerUpper, DataFixTypes.CHUNK, nbttagcompound, Math.max(1493, i)); - nbttagcompound = DataFixTypes.CHUNK.updateToCurrentVersion(this.fixerUpper, nbttagcompound, Math.max(1493, i));
+ nbttagcompound = ca.spottedleaf.dataconverter.minecraft.MCDataConverter.convertTag(ca.spottedleaf.dataconverter.minecraft.datatypes.MCTypeRegistry.CHUNK, nbttagcompound, Math.max(1493, i), SharedConstants.getCurrentVersion().getWorldVersion()); // Paper - replace chunk converter + nbttagcompound = ca.spottedleaf.dataconverter.minecraft.MCDataConverter.convertTag(ca.spottedleaf.dataconverter.minecraft.datatypes.MCTypeRegistry.CHUNK, nbttagcompound, Math.max(1493, i), SharedConstants.getCurrentVersion().getWorldVersion()); // Paper - replace chunk converter
if (i < SharedConstants.getCurrentVersion().getWorldVersion()) { if (i < SharedConstants.getCurrentVersion().getDataVersion().getVersion()) {
nbttagcompound.putInt("DataVersion", SharedConstants.getCurrentVersion().getWorldVersion()); NbtUtils.addCurrentDataVersion(nbttagcompound);
} }
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/EntityStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/EntityStorage.java diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/EntityStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/EntityStorage.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
@ -22862,27 +22862,27 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public class EntityStorage implements EntityPersistentStorage<Entity> { @@ -0,0 +0,0 @@ public class EntityStorage implements EntityPersistentStorage<Entity> {
private CompoundTag upgradeChunkTag(CompoundTag chunkNbt) { private CompoundTag upgradeChunkTag(CompoundTag chunkNbt) {
int i = getVersion(chunkNbt); int i = NbtUtils.getDataVersion(chunkNbt, -1);
- return NbtUtils.update(this.fixerUpper, DataFixTypes.ENTITY_CHUNK, chunkNbt, i); - return DataFixTypes.ENTITY_CHUNK.updateToCurrentVersion(this.fixerUpper, chunkNbt, i);
+ return ca.spottedleaf.dataconverter.minecraft.MCDataConverter.convertTag(ca.spottedleaf.dataconverter.minecraft.datatypes.MCTypeRegistry.ENTITY_CHUNK, chunkNbt, i, SharedConstants.getCurrentVersion().getWorldVersion()); // Paper - route to new converter system + return ca.spottedleaf.dataconverter.minecraft.MCDataConverter.convertTag(ca.spottedleaf.dataconverter.minecraft.datatypes.MCTypeRegistry.ENTITY_CHUNK, chunkNbt, i, net.minecraft.SharedConstants.getCurrentVersion().getWorldVersion()); // Paper - route to new converter system
} }
public static int getVersion(CompoundTag chunkNbt) { @Override
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java --- a/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java
@@ -0,0 +0,0 @@ public class SectionStorage<R> implements AutoCloseable { @@ -0,0 +0,0 @@ public class SectionStorage<R> implements AutoCloseable {
int j = getVersion(dynamic); int j = getVersion(dynamic);
int k = SharedConstants.getCurrentVersion().getWorldVersion(); int k = SharedConstants.getCurrentVersion().getDataVersion().getVersion();
boolean bl = j != k; boolean bl = j != k;
- Dynamic<T> dynamic2 = this.fixerUpper.update(this.type.getType(), 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.getType() == net.minecraft.util.datafix.fixes.References.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.fixerUpper.update(this.type.getType(), dynamic, j, k); + dynamic2 = this.type.update(this.fixerUpper, dynamic, j, k);
+ } + }
+ // Paper end - route to new converter system + // Paper end - route to new converter system
OptionalDynamic<T> optionalDynamic = dynamic2.get("Sections"); OptionalDynamic<T> optionalDynamic = dynamic2.get("Sections");
@ -22896,7 +22896,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
CompoundTag compoundTag2; CompoundTag compoundTag2;
try { try {
- compoundTag2 = NbtUtils.update(this.fixerUpper, DataFixTypes.CHUNK, compoundTag, i); - compoundTag2 = DataFixTypes.CHUNK.updateToCurrentVersion(this.fixerUpper, compoundTag, i);
+ compoundTag2 = ca.spottedleaf.dataconverter.minecraft.MCDataConverter.convertTag(ca.spottedleaf.dataconverter.minecraft.datatypes.MCTypeRegistry.CHUNK, compoundTag, i, net.minecraft.SharedConstants.getCurrentVersion().getWorldVersion()); // Paper - replace chunk converter + compoundTag2 = ca.spottedleaf.dataconverter.minecraft.MCDataConverter.convertTag(ca.spottedleaf.dataconverter.minecraft.datatypes.MCTypeRegistry.CHUNK, compoundTag, i, net.minecraft.SharedConstants.getCurrentVersion().getWorldVersion()); // Paper - replace chunk converter
} catch (Exception var12) { } catch (Exception var12) {
LOGGER.warn("Failed to partially datafix chunk {}", pos, var12); LOGGER.warn("Failed to partially datafix chunk {}", pos, var12);
@ -22907,9 +22907,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+++ b/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java +++ b/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java
@@ -0,0 +0,0 @@ public class PlayerDataStorage { @@ -0,0 +0,0 @@ public class PlayerDataStorage {
// CraftBukkit end // CraftBukkit end
int i = nbttagcompound.contains("DataVersion", 3) ? nbttagcompound.getInt("DataVersion") : -1; int i = NbtUtils.getDataVersion(nbttagcompound, -1);
- player.load(NbtUtils.update(this.fixerUpper, DataFixTypes.PLAYER, nbttagcompound, i)); - player.load(DataFixTypes.PLAYER.updateToCurrentVersion(this.fixerUpper, nbttagcompound, i));
+ player.load(ca.spottedleaf.dataconverter.minecraft.MCDataConverter.convertTag(ca.spottedleaf.dataconverter.minecraft.datatypes.MCTypeRegistry.PLAYER, nbttagcompound, i, net.minecraft.SharedConstants.getCurrentVersion().getWorldVersion())); // Paper - replace player converter + player.load(ca.spottedleaf.dataconverter.minecraft.MCDataConverter.convertTag(ca.spottedleaf.dataconverter.minecraft.datatypes.MCTypeRegistry.PLAYER, nbttagcompound, i, net.minecraft.SharedConstants.getCurrentVersion().getWorldVersion())); // Paper - replace player converter
} }

Datei anzeigen

@ -36,7 +36,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/org/bukkit/craftbukkit/Main.java --- a/src/main/java/org/bukkit/craftbukkit/Main.java
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java
@@ -0,0 +0,0 @@ public class Main { @@ -0,0 +0,0 @@ public class Main {
deadline.add(Calendar.DAY_OF_YEAR, -28); deadline.add(Calendar.DAY_OF_YEAR, -3);
if (buildDate.before(deadline.getTime())) { if (buildDate.before(deadline.getTime())) {
System.err.println("*** Error, this build is outdated ***"); System.err.println("*** Error, this build is outdated ***");
- System.err.println("*** Please download a new build as per instructions from https://www.spigotmc.org/go/outdated-spigot ***"); - System.err.println("*** Please download a new build as per instructions from https://www.spigotmc.org/go/outdated-spigot ***");

Datei anzeigen

@ -4825,7 +4825,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java +++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
@@ -0,0 +0,0 @@ public abstract class BlockBehaviour implements FeatureElement { @@ -0,0 +0,0 @@ public abstract class BlockBehaviour implements FeatureElement {
this.emissiveRendering = blockbase_info.emissiveRendering; this.emissiveRendering = blockbase_info.emissiveRendering;
this.offsetType = (BlockBehaviour.OffsetType) blockbase_info.offsetType.apply(this.asState()); this.offsetFunction = blockbase_info.offsetFunction;
this.spawnParticlesOnBreak = blockbase_info.spawnParticlesOnBreak; this.spawnParticlesOnBreak = blockbase_info.spawnParticlesOnBreak;
+ this.conditionallyFullOpaque = this.isOpaque() & this.isTransparentOnSomeFaces(); // Paper + this.conditionallyFullOpaque = this.isOpaque() & this.isTransparentOnSomeFaces(); // Paper
} }
@ -5215,7 +5215,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ ca.spottedleaf.starlight.common.light.SWMRNibbleArray[] skyNibbles = chunk.getSkyNibbles(); + ca.spottedleaf.starlight.common.light.SWMRNibbleArray[] skyNibbles = chunk.getSkyNibbles();
+ // Paper end - rewrite light impl + // Paper end - rewrite light impl
ChunkPos chunkcoordintpair = chunk.getPos(); ChunkPos chunkcoordintpair = chunk.getPos();
CompoundTag nbttagcompound = new CompoundTag(); CompoundTag nbttagcompound = NbtUtils.addCurrentDataVersion(new CompoundTag());
@@ -0,0 +0,0 @@ public class ChunkSerializer { @@ -0,0 +0,0 @@ public class ChunkSerializer {
for (int i = lightenginethreaded.getMinLightSection(); i < lightenginethreaded.getMaxLightSection(); ++i) { for (int i = lightenginethreaded.getMinLightSection(); i < lightenginethreaded.getMaxLightSection(); ++i) {

Datei anzeigen

@ -15,7 +15,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ testImplementation("org.mockito:mockito-core:4.9.0") // Paper - switch to mockito + testImplementation("org.mockito:mockito-core:4.9.0") // Paper - switch to mockito
implementation("commons-lang:commons-lang:2.6") implementation("commons-lang:commons-lang:2.6")
runtimeOnly("org.xerial:sqlite-jdbc:3.36.0.3") runtimeOnly("org.xerial:sqlite-jdbc:3.36.0.3")
runtimeOnly("mysql:mysql-connector-java:8.0.29") runtimeOnly("com.mysql:mysql-connector-j:8.0.32")
diff --git a/src/test/java/io/papermc/paper/testing/DummyServer.java b/src/test/java/io/papermc/paper/testing/DummyServer.java diff --git a/src/test/java/io/papermc/paper/testing/DummyServer.java b/src/test/java/io/papermc/paper/testing/DummyServer.java
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000

Datei anzeigen

@ -721,7 +721,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public class PacketUtils { @@ -0,0 +0,0 @@ public class PacketUtils {
engine.executeIfPossible(() -> { engine.executeIfPossible(() -> {
if (MinecraftServer.getServer().hasStopped() || (listener instanceof ServerGamePacketListenerImpl && ((ServerGamePacketListenerImpl) listener).processedDisconnect)) return; // CraftBukkit, MC-142590 if (MinecraftServer.getServer().hasStopped() || (listener instanceof ServerGamePacketListenerImpl && ((ServerGamePacketListenerImpl) listener).processedDisconnect)) return; // CraftBukkit, MC-142590
if (listener.getConnection().isConnected()) { if (listener.isAcceptingMessages()) {
- try { - try {
+ co.aikar.timings.Timing timing = co.aikar.timings.MinecraftTimings.getPacketTiming(packet); // Paper - timings + co.aikar.timings.Timing timing = co.aikar.timings.MinecraftTimings.getPacketTiming(packet); // Paper - timings
+ try (co.aikar.timings.Timing ignored = timing.startTiming()) { // Paper - timings + try (co.aikar.timings.Timing ignored = timing.startTiming()) { // Paper - timings
@ -821,10 +821,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } + }
+ // Paper end + // Paper end
this.profiler.push("tallying"); this.profiler.push("tallying");
long l = this.tickTimes[this.tickCount % 100] = Util.getNanos() - i; long j = this.tickTimes[this.tickCount % 100] = Util.getNanos() - i;
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.frameTimer.logFrameDuration(i1 - i); this.frameTimer.logFrameDuration(k - i);
this.profiler.pop(); this.profiler.pop();
org.spigotmc.WatchdogThread.tick(); // Spigot org.spigotmc.WatchdogThread.tick(); // Spigot
- SpigotTimings.serverTickTimer.stopTiming(); // Spigot - SpigotTimings.serverTickTimer.stopTiming(); // Spigot
@ -832,6 +832,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ co.aikar.timings.TimingsManager.FULL_SERVER_TICK.stopTiming(); // Paper + co.aikar.timings.TimingsManager.FULL_SERVER_TICK.stopTiming(); // Paper
} }
private ServerStatus buildServerStatus() {
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
public void tickChildren(BooleanSupplier shouldKeepTicking) { public void tickChildren(BooleanSupplier shouldKeepTicking) {
- SpigotTimings.schedulerTimer.startTiming(); // Spigot - SpigotTimings.schedulerTimer.startTiming(); // Spigot
+ MinecraftTimings.bukkitSchedulerTimer.startTiming(); // Spigot // Paper + MinecraftTimings.bukkitSchedulerTimer.startTiming(); // Spigot // Paper
@ -1421,9 +1425,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
-import org.bukkit.craftbukkit.SpigotTimings; // Spigot -import org.bukkit.craftbukkit.SpigotTimings; // Spigot
+import co.aikar.timings.MinecraftTimings; // Paper +import co.aikar.timings.MinecraftTimings; // Paper
public abstract class LivingEntity extends Entity { public abstract class LivingEntity extends Entity implements Attackable {
@@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity { @@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity implements Attackable {
@Override @Override
public void tick() { public void tick() {
@ -1431,7 +1435,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
super.tick(); super.tick();
this.updatingUsingItem(); this.updatingUsingItem();
this.updateSwimAmount(); this.updateSwimAmount();
@@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity { @@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity implements Attackable {
} }
if (!this.isRemoved()) { if (!this.isRemoved()) {
@ -1441,7 +1445,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
} }
double d0 = this.getX() - this.xo; double d0 = this.getX() - this.xo;
@@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity { @@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity implements Attackable {
if (this.isSleeping()) { if (this.isSleeping()) {
this.setXRot(0.0F); this.setXRot(0.0F);
} }
@ -1450,7 +1454,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
} }
public void detectEquipmentUpdates() { public void detectEquipmentUpdates() {
@@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity { @@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity implements Attackable {
this.setDeltaMovement(d4, d5, d6); this.setDeltaMovement(d4, d5, d6);
this.level.getProfiler().push("ai"); this.level.getProfiler().push("ai");
@ -1458,7 +1462,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (this.isImmobile()) { if (this.isImmobile()) {
this.jumping = false; this.jumping = false;
this.xxa = 0.0F; this.xxa = 0.0F;
@@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity { @@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity implements Attackable {
this.serverAiStep(); this.serverAiStep();
this.level.getProfiler().pop(); this.level.getProfiler().pop();
} }
@ -1466,19 +1470,23 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.level.getProfiler().pop(); this.level.getProfiler().pop();
this.level.getProfiler().push("jump"); this.level.getProfiler().push("jump");
@@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity { @@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity implements Attackable {
this.updateFallFlying(); LivingEntity entityliving = this.getControllingPassenger();
AABB axisalignedbb = this.getBoundingBox(); Vec3 vec3d1 = new Vec3((double) this.xxa, (double) this.yya, (double) this.zza);
- SpigotTimings.timerEntityAIMove.startTiming(); // Spigot - SpigotTimings.timerEntityAIMove.startTiming(); // Spigot
+ // SpigotTimings.timerEntityAIMove.startTiming(); // Spigot // Paper + //SpigotTimings.timerEntityAIMove.startTiming(); // Spigot // Paper
this.travel(new Vec3((double) this.xxa, (double) this.yya, (double) this.zza)); if (entityliving != null && this.isAlive()) {
this.travelRidden(entityliving, vec3d1);
} else {
this.travel(vec3d1);
}
- SpigotTimings.timerEntityAIMove.stopTiming(); // Spigot - SpigotTimings.timerEntityAIMove.stopTiming(); // Spigot
+ // SpigotTimings.timerEntityAIMove.stopTiming(); // Spigot // Paper + //SpigotTimings.timerEntityAIMove.stopTiming(); // Spigot // Paper
this.level.getProfiler().pop(); this.level.getProfiler().pop();
this.level.getProfiler().push("freezing"); this.level.getProfiler().push("freezing");
boolean flag1 = this.getType().is(EntityTypeTags.FREEZE_HURTS_EXTRA_TYPES); @@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity {
this.checkAutoSpinAttack(axisalignedbb, this.getBoundingBox()); this.checkAutoSpinAttack(axisalignedbb, this.getBoundingBox());
} }
@ -1487,7 +1495,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- SpigotTimings.timerEntityAICollision.stopTiming(); // Spigot - SpigotTimings.timerEntityAICollision.stopTiming(); // Spigot
this.level.getProfiler().pop(); this.level.getProfiler().pop();
if (!this.level.isClientSide && this.isSensitiveToWater() && this.isInWaterRainOrBubble()) { if (!this.level.isClientSide && this.isSensitiveToWater() && this.isInWaterRainOrBubble()) {
this.hurt(DamageSource.DROWN, 1.0F); this.hurt(this.damageSources().drown(), 1.0F);
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/Level.java --- a/src/main/java/net/minecraft/world/level/Level.java
@ -2012,14 +2020,13 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftIconCache.java b/src
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftIconCache.java --- a/src/main/java/org/bukkit/craftbukkit/util/CraftIconCache.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftIconCache.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftIconCache.java
@@ -0,0 +0,0 @@ import org.bukkit.util.CachedServerIcon; @@ -0,0 +0,0 @@ public class CraftIconCache implements CachedServerIcon {
public class CraftIconCache implements CachedServerIcon { public CraftIconCache(final byte[] value) {
public final String value;
+ public String getData() { return value; } // Paper
public CraftIconCache(final String value) {
this.value = value; this.value = value;
} }
+
+ public String getData() { return "data:image/png;base64," + new String(java.util.Base64.getEncoder().encode(value), java.nio.charset.StandardCharsets.UTF_8); } // Paper
}
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java