Minor patch changes
This commit is contained in:
parent
c946526ab1
commit
5052a4515e
|
@ -6,7 +6,7 @@ Subject: [PATCH] remove null possibility for getServer singleton
|
|||
to stop IDE complaining about potential NPE
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 032ba4071f7562cd0c0bf3f2de46130692544ef0..681121909bdf81d5a05670f0b0150f6276d00281 100644
|
||||
index 032ba4071f7562cd0c0bf3f2de46130692544ef0..d3da5327f7826d10428c9fa8b9848fdb06afd04f 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -179,6 +179,7 @@ import co.aikar.timings.MinecraftTimings; // Paper
|
||||
|
@ -25,9 +25,11 @@ index 032ba4071f7562cd0c0bf3f2de46130692544ef0..681121909bdf81d5a05670f0b0150f62
|
|||
this.metricsRecorder = InactiveMetricsRecorder.INSTANCE;
|
||||
this.profiler = this.metricsRecorder.getProfiler();
|
||||
this.onMetricsRecordingStopped = (methodprofilerresults) -> {
|
||||
@@ -2272,7 +2274,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -2270,9 +2272,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
return false;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
- @Deprecated
|
||||
public static MinecraftServer getServer() {
|
||||
- return (Bukkit.getServer() instanceof CraftServer) ? ((CraftServer) Bukkit.getServer()).getServer() : null;
|
||||
+ return SERVER; // Paper
|
||||
|
|
|
@ -9,7 +9,7 @@ modified in order to prevent merge conflicts when Spigot changes/disables the wa
|
|||
and to provide some level of hint without being disruptive.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/Bootstrap.java b/src/main/java/net/minecraft/server/Bootstrap.java
|
||||
index e359919de57f97d18667df1b2f1bf54a19a49c2f..813bf8974d0c565f8f4ba255902276156288c0f1 100644
|
||||
index e359919de57f97d18667df1b2f1bf54a19a49c2f..c5822637e48fad4ca4e8cf210431b5eafbf5abb1 100644
|
||||
--- a/src/main/java/net/minecraft/server/Bootstrap.java
|
||||
+++ b/src/main/java/net/minecraft/server/Bootstrap.java
|
||||
@@ -46,7 +46,7 @@ public class Bootstrap {
|
||||
|
@ -17,7 +17,7 @@ index e359919de57f97d18667df1b2f1bf54a19a49c2f..813bf8974d0c565f8f4ba25590227615
|
|||
if (!Bootstrap.isBootstrapped) {
|
||||
// CraftBukkit start
|
||||
- String name = Bootstrap.class.getSimpleName();
|
||||
+ /*String name = Bootstrap.class.getSimpleName(); // Paper - actually, I don't think this class should ever have been called DispenserRegistry, that's a stupid name, bootstrap is waaay better
|
||||
+ /*String name = Bootstrap.class.getSimpleName(); // Paper
|
||||
switch (name) {
|
||||
case "DispenserRegistry":
|
||||
break;
|
||||
|
|
|
@ -1,118 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Tue, 22 Nov 2016 00:40:42 -0500
|
||||
Subject: [PATCH] Fix client rendering skulls from same user
|
||||
|
||||
See: https://github.com/PaperMC/Paper/issues/1304
|
||||
|
||||
Changes the UUID sent to client to be based on either
|
||||
the texture payload, or random.
|
||||
|
||||
This allows the client to render multiple skull textures from the same user,
|
||||
for when different skins were used when skull was made.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/network/FriendlyByteBuf.java b/src/main/java/net/minecraft/network/FriendlyByteBuf.java
|
||||
index 70631b3fe080320dfea0d1a4deb23e87448da250..9bffc37939586bcca0ae3d1c4aa3b0b96ad2b20d 100644
|
||||
--- a/src/main/java/net/minecraft/network/FriendlyByteBuf.java
|
||||
+++ b/src/main/java/net/minecraft/network/FriendlyByteBuf.java
|
||||
@@ -579,9 +579,18 @@ public class FriendlyByteBuf extends ByteBuf {
|
||||
if (item.canBeDepleted() || item.shouldOverrideMultiplayerNbt()) {
|
||||
// Spigot start - filter
|
||||
stack = stack.copy();
|
||||
- CraftItemStack.setItemMeta(stack, CraftItemStack.getItemMeta(stack));
|
||||
+ // CraftItemStack.setItemMeta(stack, CraftItemStack.getItemMeta(stack)); // Paper - This is no longer needed due to NBT being supported
|
||||
// Spigot end
|
||||
nbttagcompound = stack.getTag();
|
||||
+ // Paper start
|
||||
+ if (nbttagcompound != null && nbttagcompound.contains("SkullOwner", 10)) {
|
||||
+ CompoundTag owner = nbttagcompound.getCompound("SkullOwner");
|
||||
+ if (owner.hasUUID("Id")) {
|
||||
+ nbttagcompound.putUUID("SkullOwnerOrig", owner.getUUID("Id"));
|
||||
+ net.minecraft.world.level.block.entity.SkullBlockEntity.sanitizeUUID(owner);
|
||||
+ }
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
||||
|
||||
this.writeNbt(nbttagcompound);
|
||||
@@ -601,7 +610,16 @@ public class FriendlyByteBuf extends ByteBuf {
|
||||
itemstack.setTag(this.readNbt());
|
||||
// CraftBukkit start
|
||||
if (itemstack.getTag() != null) {
|
||||
- CraftItemStack.setItemMeta(itemstack, CraftItemStack.getItemMeta(itemstack));
|
||||
+ // Paper start - Fix skulls of same owner - restore orig ID since we changed it on send to client
|
||||
+ if (itemstack.tag.contains("SkullOwnerOrig")) {
|
||||
+ CompoundTag owner = itemstack.tag.getCompound("SkullOwner");
|
||||
+ if (itemstack.tag.contains("SkullOwnerOrig")) {
|
||||
+ owner.tags.put("Id", itemstack.tag.tags.get("SkullOwnerOrig"));
|
||||
+ itemstack.tag.remove("SkullOwnerOrig");
|
||||
+ }
|
||||
+ }
|
||||
+ // Paper end
|
||||
+ // CraftItemStack.setItemMeta(itemstack, CraftItemStack.getItemMeta(itemstack)); // Paper - This is no longer needed due to NBT being supported
|
||||
}
|
||||
// CraftBukkit end
|
||||
return itemstack;
|
||||
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java
|
||||
index cc2f53fba1e5f6b6d4d31081ddaca1ace70abf99..56cc2169077fed1fe820d08dc14b3add63289add 100644
|
||||
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java
|
||||
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java
|
||||
@@ -151,6 +151,7 @@ public class ClientboundLevelChunkPacketData {
|
||||
static ClientboundLevelChunkPacketData.BlockEntityInfo create(BlockEntity blockEntity) {
|
||||
CompoundTag compoundTag = blockEntity.getUpdateTag();
|
||||
BlockPos blockPos = blockEntity.getBlockPos();
|
||||
+ if (blockEntity instanceof net.minecraft.world.level.block.entity.SkullBlockEntity) { net.minecraft.world.level.block.entity.SkullBlockEntity.sanitizeTileEntityUUID(compoundTag); } // Paper
|
||||
int i = SectionPos.sectionRelative(blockPos.getX()) << 4 | SectionPos.sectionRelative(blockPos.getZ());
|
||||
return new ClientboundLevelChunkPacketData.BlockEntityInfo(i, blockPos.getY(), blockEntity.getType(), compoundTag.isEmpty() ? null : compoundTag);
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java
|
||||
index 0c7e29b589ab106013d979a20edc415b4b32a677..170f051d820ee1add1b61a20dbd1f18f758717dc 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java
|
||||
@@ -11,6 +11,7 @@ import javax.annotation.Nullable;
|
||||
import net.minecraft.Util;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
+import net.minecraft.nbt.ListTag;
|
||||
import net.minecraft.nbt.NbtUtils;
|
||||
import net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket;
|
||||
import net.minecraft.server.Services;
|
||||
@@ -94,9 +95,37 @@ public class SkullBlockEntity extends BlockEntity {
|
||||
|
||||
@Override
|
||||
public ClientboundBlockEntityDataPacket getUpdatePacket() {
|
||||
- return ClientboundBlockEntityDataPacket.create(this);
|
||||
+ return ClientboundBlockEntityDataPacket.create(this, e -> sanitizeTileEntityUUID(e.getUpdateTag())); // Paper
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ public static CompoundTag sanitizeTileEntityUUID(CompoundTag cmp) {
|
||||
+ CompoundTag owner = cmp.getCompound("Owner");
|
||||
+ if (!owner.isEmpty()) {
|
||||
+ sanitizeUUID(owner);
|
||||
+ }
|
||||
+ return cmp;
|
||||
+ }
|
||||
+
|
||||
+ public static void sanitizeUUID(CompoundTag owner) {
|
||||
+ CompoundTag properties = owner.getCompound("Properties");
|
||||
+ ListTag list = null;
|
||||
+ if (!properties.isEmpty()) {
|
||||
+ list = properties.getList("textures", 10);
|
||||
+ }
|
||||
+
|
||||
+ if (list != null && !list.isEmpty()) {
|
||||
+ String textures = ((CompoundTag)list.get(0)).getString("Value");
|
||||
+ if (textures != null && textures.length() > 3) {
|
||||
+ UUID uuid = UUID.nameUUIDFromBytes(textures.getBytes());
|
||||
+ owner.putUUID("Id", uuid);
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+ owner.putUUID("Id", UUID.randomUUID());
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
@Override
|
||||
public CompoundTag getUpdateTag() {
|
||||
return this.saveWithoutMetadata();
|
|
@ -0,0 +1,28 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Tue, 22 Nov 2016 00:40:42 -0500
|
||||
Subject: [PATCH] Remove unnecessary itemmeta handling
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/network/FriendlyByteBuf.java b/src/main/java/net/minecraft/network/FriendlyByteBuf.java
|
||||
index 70631b3fe080320dfea0d1a4deb23e87448da250..35377576ed182814051c11f902e02e8e921e84e3 100644
|
||||
--- a/src/main/java/net/minecraft/network/FriendlyByteBuf.java
|
||||
+++ b/src/main/java/net/minecraft/network/FriendlyByteBuf.java
|
||||
@@ -579,7 +579,7 @@ public class FriendlyByteBuf extends ByteBuf {
|
||||
if (item.canBeDepleted() || item.shouldOverrideMultiplayerNbt()) {
|
||||
// Spigot start - filter
|
||||
stack = stack.copy();
|
||||
- CraftItemStack.setItemMeta(stack, CraftItemStack.getItemMeta(stack));
|
||||
+ // CraftItemStack.setItemMeta(stack, CraftItemStack.getItemMeta(stack)); // Paper - This is no longer with raw NBT being handled in metadata
|
||||
// Spigot end
|
||||
nbttagcompound = stack.getTag();
|
||||
}
|
||||
@@ -600,7 +600,7 @@ public class FriendlyByteBuf extends ByteBuf {
|
||||
|
||||
itemstack.setTag(this.readNbt());
|
||||
// CraftBukkit start
|
||||
- if (itemstack.getTag() != null) {
|
||||
+ if (false && itemstack.getTag() != null) { // Paper - This is no longer needed with raw NBT being handled in metadata
|
||||
CraftItemStack.setItemMeta(itemstack, CraftItemStack.getItemMeta(itemstack));
|
||||
}
|
||||
// CraftBukkit end
|
|
@ -110,7 +110,7 @@ index 0000000000000000000000000000000000000000..874f0c2a071994c2145848886caa385e
|
|||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java
|
||||
index 2e5718d720744967c5f2ba13805aad53a1dec593..61a26e9312b1a2d0b582778a178f73dbf702039b 100644
|
||||
index 5626a772908f7956a30a82ca73929b05c19f7268..1db8a3e4b547a3c78ae2df2e4dadb871eb80aa5d 100644
|
||||
--- a/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java
|
||||
+++ b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java
|
||||
@@ -1,5 +1,6 @@
|
||||
|
@ -129,7 +129,7 @@ index 2e5718d720744967c5f2ba13805aad53a1dec593..61a26e9312b1a2d0b582778a178f73db
|
|||
|
||||
public static void registerCommands(final MinecraftServer server) {
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index bf97a9be49a8a187004ceb302db59c31f12e3e1b..7de1368bcde500ba133282537270fbdfd9c9d54b 100644
|
||||
index 8de56cabd8fdc68e136d41c4d172f3574e21e57a..f69ed252f55623ee5cba6ac9d28096c2cc92ea04 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -234,6 +234,11 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
|
@ -157,7 +157,7 @@ index bf97a9be49a8a187004ceb302db59c31f12e3e1b..7de1368bcde500ba133282537270fbdf
|
|||
this.frameTimer.logFrameDuration(i1 - i);
|
||||
this.profiler.pop();
|
||||
org.spigotmc.WatchdogThread.tick(); // Spigot
|
||||
@@ -2495,4 +2506,30 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -2494,4 +2505,30 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
public static record ServerResourcePackInfo(String url, String hash, boolean isRequired, @Nullable Component prompt) {
|
||||
|
||||
}
|
||||
|
|
|
@ -50,10 +50,10 @@ index b9cdfe42d9a8015b0ddc0cedd9dba4064ce8682d..25e7d076ce6180c6cbbca89cb905404c
|
|||
}, this.executor).whenCompleteAsync((optional, throwable) -> {
|
||||
consumer.accept(optional);
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java
|
||||
index 170f051d820ee1add1b61a20dbd1f18f758717dc..c1703a67a615f563dab4fb442a6df7082229af57 100644
|
||||
index 0c7e29b589ab106013d979a20edc415b4b32a677..c5d5d90d10b30f30d1262367b3d75df43fbdb231 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java
|
||||
@@ -149,7 +149,7 @@ public class SkullBlockEntity extends BlockEntity {
|
||||
@@ -120,7 +120,7 @@ public class SkullBlockEntity extends BlockEntity {
|
||||
public static void updateGameprofile(@Nullable GameProfile owner, Consumer<GameProfile> callback) {
|
||||
if (owner != null && !StringUtil.isNullOrEmpty(owner.getName()) && (!owner.isComplete() || !owner.getProperties().containsKey("textures")) && profileCache != null && sessionService != null) {
|
||||
profileCache.getAsync(owner.getName(), (profile) -> {
|
||||
|
|
|
@ -19,7 +19,7 @@ index 3b717a6a1be16f780923e7ae3269462d3d082615..8563c66834b0b9e77bca42e4f916d82a
|
|||
|
||||
private MinecraftTimings() {}
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 93631f0a59781b8310f7bf66c0ed4781b833ef79..17efe9e0a17672b815c64491dbca70b7519b6aca 100644
|
||||
index b1a0f0b1bed05fbea5d21157317d08dd92ec78f0..6f078f69f4da1bd988f02156351c481b6da04b55 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -1302,6 +1302,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
|
@ -30,7 +30,7 @@ index 93631f0a59781b8310f7bf66c0ed4781b833ef79..17efe9e0a17672b815c64491dbca70b7
|
|||
return true;
|
||||
} else {
|
||||
if (this.haveTime()) {
|
||||
@@ -2624,4 +2625,74 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -2623,4 +2624,74 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
}
|
||||
}
|
||||
// Paper end
|
||||
|
@ -126,7 +126,7 @@ index 438406936633b9c67d21b26527c3d1654118c744..2de322ffc2eedae9efe39f9b771c447d
|
|||
}
|
||||
// Paper start - optimise chunk tick iteration
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index 5518dc58647aae68b31dbe059cdbc669cfa73112..0b3c4e43d5d9b13c963b1802cd85f099b4274c8c 100644
|
||||
index 645a90cf1b98848186383472765716948ab2cd3e..c0340d8147e676a1e9d650902ef2dfe700e25d97 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -209,6 +209,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
|
|
|
@ -8,10 +8,10 @@ also adds 'Paper.debugInvalidSkullProfiles' system property which can be
|
|||
set to 'true' for extra debug info (trace of updateGameprofile caller).
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java
|
||||
index c1703a67a615f563dab4fb442a6df7082229af57..4613a343d3ca5f76992f2bd1e55bdc0833abcab6 100644
|
||||
index c5d5d90d10b30f30d1262367b3d75df43fbdb231..e017020b7630f54c506d93ab0504c6f3299fc80b 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java
|
||||
@@ -143,13 +143,28 @@ public class SkullBlockEntity extends BlockEntity {
|
||||
@@ -114,13 +114,28 @@ public class SkullBlockEntity extends BlockEntity {
|
||||
updateGameprofile(this.owner, (owner) -> {
|
||||
this.owner = owner;
|
||||
this.setChanged();
|
||||
|
@ -40,7 +40,7 @@ index c1703a67a615f563dab4fb442a6df7082229af57..4613a343d3ca5f76992f2bd1e55bdc08
|
|||
Util.ifElse(profile, (profilex) -> {
|
||||
Property property = Iterables.getFirst(profilex.getProperties().get("textures"), (Property)null);
|
||||
if (property == null) {
|
||||
@@ -166,6 +181,20 @@ public class SkullBlockEntity extends BlockEntity {
|
||||
@@ -137,6 +152,20 @@ public class SkullBlockEntity extends BlockEntity {
|
||||
callback.accept(owner);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -18,12 +18,12 @@ index 12d7cb0eb485987d245454fa2d9fef67ea7e9c76..b1e326cf4f7fe447f81b588dcb0eda9a
|
|||
|
||||
public static ClientboundBlockEntityDataPacket create(BlockEntity blockEntity) {
|
||||
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java
|
||||
index e902b437ee089907b34ae30c0a6bdf1d42e1e674..88a68a3e176b1cf0b514093b5089a1cba8ad7e06 100644
|
||||
index 23d76eb74a88610472aa0288559efbaa5cd916dc..6c30f3bf85ec0e0dfbae1b5ed192b43b1dbd48be 100644
|
||||
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java
|
||||
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java
|
||||
@@ -183,6 +183,7 @@ public class ClientboundLevelChunkPacketData {
|
||||
@@ -182,6 +182,7 @@ public class ClientboundLevelChunkPacketData {
|
||||
CompoundTag compoundTag = blockEntity.getUpdateTag();
|
||||
BlockPos blockPos = blockEntity.getBlockPos();
|
||||
if (blockEntity instanceof net.minecraft.world.level.block.entity.SkullBlockEntity) { net.minecraft.world.level.block.entity.SkullBlockEntity.sanitizeTileEntityUUID(compoundTag); } // Paper
|
||||
int i = SectionPos.sectionRelative(blockPos.getX()) << 4 | SectionPos.sectionRelative(blockPos.getZ());
|
||||
+ blockEntity.sanitizeSentNbt(compoundTag); // Paper - Sanitize sent data
|
||||
return new ClientboundLevelChunkPacketData.BlockEntityInfo(i, blockPos.getY(), blockEntity.getType(), compoundTag.isEmpty() ? null : compoundTag);
|
||||
|
|
Loading…
Reference in New Issue