fix more compile issues

This commit is contained in:
Jake Potrebic 2023-12-06 10:07:47 -08:00
parent 0dee538a62
commit a364b7e88b
No known key found for this signature in database
GPG key ID: 27CC63F7CBC866C7
21 changed files with 34 additions and 40 deletions

View file

@ -8,7 +8,7 @@ Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
diff --git a/src/main/java/io/papermc/paper/adventure/AdventureComponent.java b/src/main/java/io/papermc/paper/adventure/AdventureComponent.java
new file mode 100644
index 0000000000000000000000000000000000000000..3246049fd557951d971ef40112a411c12aec205c
index 0000000000000000000000000000000000000000..fbf7804f8e02fc76cadae661083dbcc5b1c21881
--- /dev/null
+++ b/src/main/java/io/papermc/paper/adventure/AdventureComponent.java
@@ -0,0 +1,90 @@
@ -26,7 +26,7 @@ index 0000000000000000000000000000000000000000..3246049fd557951d971ef40112a411c1
+import net.minecraft.network.chat.ComponentContents;
+import net.minecraft.network.chat.MutableComponent;
+import net.minecraft.network.chat.Style;
+import net.minecraft.network.chat.contents.LiteralContents;
+import net.minecraft.network.chat.contents.PlainTextContents;
+import net.minecraft.util.FormattedCharSequence;
+import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
+import org.jetbrains.annotations.Nullable;
@ -60,7 +60,7 @@ index 0000000000000000000000000000000000000000..3246049fd557951d971ef40112a411c1
+ @Override
+ public ComponentContents getContents() {
+ if (this.adventure instanceof TextComponent) {
+ return new LiteralContents(((TextComponent) this.adventure).content());
+ return PlainTextContents.create(((TextComponent) this.adventure).content());
+ } else {
+ return this.deepConverted().getContents();
+ }

View file

@ -5,7 +5,7 @@ Subject: [PATCH] Update itemstack legacy name and lore
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
index 19e8d10727fc4838cd8261dfec92f3828ea5b09f..b5080861a4aa34a95618bcee7723bd3ec34b09c4 100644
index 19e8d10727fc4838cd8261dfec92f3828ea5b09f..e9df7ea1228603ee3ebf515b6419f668cbe3aef7 100644
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
@@ -195,6 +195,44 @@ public final class ItemStack {
@ -44,9 +44,9 @@ index 19e8d10727fc4838cd8261dfec92f3828ea5b09f..b5080861a4aa34a95618bcee7723bd3e
+
+ private net.minecraft.nbt.StringTag convert(String json) {
+ Component component = Component.Serializer.fromJson(json);
+ if (component.getContents() instanceof net.minecraft.network.chat.contents.LiteralContents literalContents && literalContents.text().contains("\u00A7") && component.getSiblings().isEmpty()) {
+ if (component.getContents() instanceof final net.minecraft.network.chat.contents.PlainTextContents plainTextContents && plainTextContents.text().contains("\u00A7") && component.getSiblings().isEmpty()) {
+ // Only convert if the root component is a single comp with legacy in it, don't convert already normal components
+ component = org.bukkit.craftbukkit.util.CraftChatMessage.fromString(literalContents.text())[0];
+ component = org.bukkit.craftbukkit.util.CraftChatMessage.fromString(plainTextContents.text())[0];
+ }
+ return net.minecraft.nbt.StringTag.valueOf(org.bukkit.craftbukkit.util.CraftChatMessage.toJSON(component));
+ }

View file

@ -5,7 +5,7 @@ Subject: [PATCH] PortalCreateEvent needs to know its entity
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
index b5080861a4aa34a95618bcee7723bd3ec34b09c4..385b7e907c535a153d86fbec11eb3070edf66dd4 100644
index e9df7ea1228603ee3ebf515b6419f668cbe3aef7..0dfa1ca78f747b2ea7e6b9f59d4561daad8bfcc8 100644
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
@@ -478,7 +478,7 @@ public final class ItemStack {

View file

@ -5,7 +5,7 @@ Subject: [PATCH] Added EntityDamageItemEvent
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
index 385b7e907c535a153d86fbec11eb3070edf66dd4..87b65caa8abf15317ad158e96548553a3c062e07 100644
index 0dfa1ca78f747b2ea7e6b9f59d4561daad8bfcc8..368837172f87ac45e1d58e9905b4693cc0804328 100644
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
@@ -622,7 +622,7 @@ public final class ItemStack {

View file

@ -10,7 +10,7 @@ Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
diff --git a/src/main/java/io/papermc/paper/advancement/PaperAdvancementDisplay.java b/src/main/java/io/papermc/paper/advancement/PaperAdvancementDisplay.java
new file mode 100644
index 0000000000000000000000000000000000000000..1705f65d897114dd0813f6d366124cefafcb450e
index 0000000000000000000000000000000000000000..adac21ce6db3ff7a56dbcd6bffc02143c2db4046
--- /dev/null
+++ b/src/main/java/io/papermc/paper/advancement/PaperAdvancementDisplay.java
@@ -0,0 +1,69 @@
@ -19,8 +19,8 @@ index 0000000000000000000000000000000000000000..1705f65d897114dd0813f6d366124cef
+import io.papermc.paper.adventure.PaperAdventure;
+import net.kyori.adventure.text.Component;
+import net.minecraft.advancements.Advancement;
+import net.minecraft.advancements.AdvancementType;
+import net.minecraft.advancements.DisplayInfo;
+import net.minecraft.advancements.FrameType;
+import org.bukkit.NamespacedKey;
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
+import org.bukkit.craftbukkit.util.CraftNamespacedKey;
@ -32,7 +32,7 @@ index 0000000000000000000000000000000000000000..1705f65d897114dd0813f6d366124cef
+
+ @Override
+ public @NotNull Frame frame() {
+ return asPaperFrame(this.handle.getFrame());
+ return asPaperFrame(this.handle.getType());
+ }
+
+ @Override
@ -67,7 +67,7 @@ index 0000000000000000000000000000000000000000..1705f65d897114dd0813f6d366124cef
+
+ @Override
+ public @Nullable NamespacedKey backgroundPath() {
+ return this.handle.getBackground() == null ? null : CraftNamespacedKey.fromMinecraft(this.handle.getBackground());
+ return this.handle.getBackground().map(CraftNamespacedKey::fromMinecraft).orElse(null);
+ }
+
+ @Override
@ -75,7 +75,7 @@ index 0000000000000000000000000000000000000000..1705f65d897114dd0813f6d366124cef
+ return PaperAdventure.asAdventure(Advancement.decorateName(java.util.Objects.requireNonNull(this.handle, "cannot build display name for null handle, invalid state")));
+ }
+
+ public static @NotNull Frame asPaperFrame(@NotNull FrameType frameType) {
+ public static @NotNull Frame asPaperFrame(final @NotNull AdvancementType frameType) {
+ return switch (frameType) {
+ case TASK -> Frame.TASK;
+ case CHALLENGE -> Frame.CHALLENGE;

View file

@ -5,21 +5,16 @@ Subject: [PATCH] More PotionEffectType API
diff --git a/src/main/java/org/bukkit/craftbukkit/potion/CraftPotionEffectType.java b/src/main/java/org/bukkit/craftbukkit/potion/CraftPotionEffectType.java
index 7055a051759bf01dd76cc53b74fe1e65c521403e..5f1fd633e10e3480d736a31ada7adb6194b8c3a3 100644
index 7055a051759bf01dd76cc53b74fe1e65c521403e..a1a386b09f477056bb2f764ec414782ba61460ea 100644
--- a/src/main/java/org/bukkit/craftbukkit/potion/CraftPotionEffectType.java
+++ b/src/main/java/org/bukkit/craftbukkit/potion/CraftPotionEffectType.java
@@ -139,4 +139,51 @@ public class CraftPotionEffectType extends PotionEffectType {
@@ -139,4 +139,46 @@ public class CraftPotionEffectType extends PotionEffectType {
return ((CraftPotionEffectType) bukkit).getHandle();
}
+
+ // Paper start
+ @Override
+ public org.bukkit.NamespacedKey getKey() {
+ return org.bukkit.craftbukkit.util.CraftNamespacedKey.fromMinecraft(net.minecraft.core.registries.BuiltInRegistries.MOB_EFFECT.getKey(this.handle));
+ }
+
+ @Override
+ public java.util.Map<org.bukkit.attribute.Attribute, org.bukkit.attribute.AttributeModifier> getEffectAttributes() {
+ // re-create map each time because a nms MobEffect can have its attributes modified
+ final java.util.Map<org.bukkit.attribute.Attribute, org.bukkit.attribute.AttributeModifier> attributeMap = new java.util.HashMap<>();

View file

@ -8,7 +8,7 @@ snow bucket didn't revert grass that became snowy because of the
placement.
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
index 87b65caa8abf15317ad158e96548553a3c062e07..2848a373e5f719e3ecf7468c129d2ddc58808484 100644
index 368837172f87ac45e1d58e9905b4693cc0804328..b7d8684968051f7af5462fe98d39fbebe3e96fd7 100644
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
@@ -379,7 +379,7 @@ public final class ItemStack {

View file

@ -9,10 +9,10 @@ This might result in chunks loading far slower in the nether,
for example.
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index bc181f3f59eef3f2f3645e3facb37d5e4a605d34..3b6b421c0749d676fe48a49a569f5a6013576730 100644
index bc181f3f59eef3f2f3645e3facb37d5e4a605d34..8f375cc054f6c15537eca4927ea5cb0eb6a93b67 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1422,19 +1422,20 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1422,6 +1422,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.executeMidTickTasks(); // Paper - execute chunk tasks mid tick
return true;
} else {
@ -20,9 +20,8 @@ index bc181f3f59eef3f2f3645e3facb37d5e4a605d34..3b6b421c0749d676fe48a49a569f5a60
if (this.tickRateManager.isSprinting() || this.haveTime()) {
Iterator iterator = this.getAllLevels().iterator();
while (iterator.hasNext()) {
- ServerLevel worldserver = (ServerLevel) iterator.next();
+ WorldServer worldserver = (WorldServer) iterator.next();
@@ -1429,12 +1430,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
ServerLevel worldserver = (ServerLevel) iterator.next();
if (worldserver.getChunkSource().pollTask()) {
- return true;

View file

@ -10,7 +10,7 @@ just looking at the LevelStem key, look at the DimensionType key which
is one level below that. Defaults to off to keep vanilla behavior.
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 3b6b421c0749d676fe48a49a569f5a6013576730..195f92a2f407c187f315f5f3cc075c6c7283ada3 100644
index 8f375cc054f6c15537eca4927ea5cb0eb6a93b67..abd20b1bbda4177a3f3be8abf3977866780a9b67 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -623,7 +623,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa

View file

@ -7,7 +7,7 @@ Some parts of legacy conversion will need the overworld
to get the legacy structure data storage
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 195f92a2f407c187f315f5f3cc075c6c7283ada3..752e2b122c41e513aee590699c6d4624bbbfc12a 100644
index abd20b1bbda4177a3f3be8abf3977866780a9b67..330a7921849a4b3ab0d7ef156af4880ef602d5eb 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -635,9 +635,10 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa

View file

@ -32,7 +32,7 @@ index 0000000000000000000000000000000000000000..7ea357ac2f3a93db4ebdf24b5072be7d
+ }
+}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 752e2b122c41e513aee590699c6d4624bbbfc12a..fe0a9bd0161ec6098a5f295322cc0c8d51e3ab10 100644
index 330a7921849a4b3ab0d7ef156af4880ef602d5eb..3da647154516ded20fd18ee4baa7242e73ab91e8 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -2227,6 +2227,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa

View file

@ -5,7 +5,7 @@ Subject: [PATCH] Add pre-unbreaking amount to PlayerItemDamageEvent
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
index 2848a373e5f719e3ecf7468c129d2ddc58808484..784fa09e7bba8b4997960f4804b90d38aaa0f247 100644
index b7d8684968051f7af5462fe98d39fbebe3e96fd7..3904c9d3ffde11320306f7c5c01ec2b8b0dfbaf9 100644
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
@@ -638,10 +638,11 @@ public final class ItemStack {

View file

@ -7,7 +7,7 @@ There are no plans to support creating worlds while worlds are
being ticked themselvess.
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index fe0a9bd0161ec6098a5f295322cc0c8d51e3ab10..84ba0e4235dde7da392bb5548358b218fb2f8bdf 100644
index 3da647154516ded20fd18ee4baa7242e73ab91e8..5b39e4a6b39e73cfe5645d80cd823e582ade6bc2 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -310,6 +310,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa

View file

@ -37,7 +37,7 @@ index 0000000000000000000000000000000000000000..c1d3bac79bb8b4796c013ff4472f75dc
+ }
+}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 84ba0e4235dde7da392bb5548358b218fb2f8bdf..04cdfbe1d892a7f49a3c1451be5ceb2ce8c7c23a 100644
index 5b39e4a6b39e73cfe5645d80cd823e582ade6bc2..a2961f1453e3805879941c709ab74a608285db42 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1026,6 +1026,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa

View file

@ -50,7 +50,7 @@ index 0000000000000000000000000000000000000000..5c42823726e70ce6c9d0121d07431548
+ }
+}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 04cdfbe1d892a7f49a3c1451be5ceb2ce8c7c23a..9c2f9a2cee29c69e18ccfaf64a50c7efc8ad3d81 100644
index a2961f1453e3805879941c709ab74a608285db42..50316da08ae259dcc0d02c28081a352f09d1a19a 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1678,6 +1678,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@ -62,7 +62,7 @@ index 04cdfbe1d892a7f49a3c1451be5ceb2ce8c7c23a..9c2f9a2cee29c69e18ccfaf64a50c7ef
this.profiler.push(() -> {
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
index 784fa09e7bba8b4997960f4804b90d38aaa0f247..dac6a4c3715b8b85180bffad8495247fa56d4650 100644
index 3904c9d3ffde11320306f7c5c01ec2b8b0dfbaf9..26d00500831d07f2ef48da89770b3ece2cdc846b 100644
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
@@ -749,10 +749,16 @@ public final class ItemStack {

View file

@ -5,7 +5,7 @@ Subject: [PATCH] Fix beehives generating from using bonemeal
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
index dac6a4c3715b8b85180bffad8495247fa56d4650..cf10350530683c2294e4892ac7239559f0aa4c32 100644
index 26d00500831d07f2ef48da89770b3ece2cdc846b..0822300eaf771d70f887d91a160115eaa7e3ec89 100644
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
@@ -422,6 +422,7 @@ public final class ItemStack {

View file

@ -22,7 +22,7 @@ index e581dc10f3c805f7f8b6e4c842092609e7e1a0f8..6819cea2858f0035a4fbf3671612d43f
if ((entityhuman == null || !entityhuman.getAbilities().instabuild) && itemstack != ItemStack.EMPTY) { // CraftBukkit
itemstack.shrink(1);
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
index cf10350530683c2294e4892ac7239559f0aa4c32..345b6a54e62eba5a12134c74a0eeb9b92ca27500 100644
index 0822300eaf771d70f887d91a160115eaa7e3ec89..11173571f3589d4301a2528db96718c0fd81efed 100644
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
@@ -493,13 +493,7 @@ public final class ItemStack {

View file

@ -5,7 +5,7 @@ Subject: [PATCH] Fix spigot sound playing for BlockItem ItemStacks
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
index 345b6a54e62eba5a12134c74a0eeb9b92ca27500..ef2f9cae4b06a020f0b9209b69316733df055438 100644
index 11173571f3589d4301a2528db96718c0fd81efed..e1de186632baa6ee58a071aabf8967b9095f9aa1 100644
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
@@ -544,7 +544,11 @@ public final class ItemStack {

View file

@ -5,7 +5,7 @@ Subject: [PATCH] Add event for player editing sign
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
index ef2f9cae4b06a020f0b9209b69316733df055438..d4df53d022eb58cf43d787ed84bd94fdf1684d69 100644
index e1de186632baa6ee58a071aabf8967b9095f9aa1..db523ded8132f2010391c9f909319d0ae042a741 100644
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
@@ -523,7 +523,7 @@ public final class ItemStack {

View file

@ -1121,7 +1121,7 @@ index 0000000000000000000000000000000000000000..d306f911757a4d556c82c0070d4837db
+ }
+}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 9c2f9a2cee29c69e18ccfaf64a50c7efc8ad3d81..e7bcb076788cefa94b70e455bef1f9653cec6415 100644
index 50316da08ae259dcc0d02c28081a352f09d1a19a..a8f9f4e23575cb58045f9d8efe011a60a51dbd7a 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1635,6 +1635,20 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa

View file

@ -17,7 +17,7 @@ index 105bb94b844c5ee85b53aca95360e7b2caf374cc..e6ac20a38f31bb0cd6b8840b2518f699
}
}
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
index d4df53d022eb58cf43d787ed84bd94fdf1684d69..c4228284145c27f6fe995bd1875d3f17f4786ddd 100644
index db523ded8132f2010391c9f909319d0ae042a741..852727221d5cb8bcc14c57664622c13d8d03c159 100644
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
@@ -422,6 +422,7 @@ public final class ItemStack {