Compare commits

...

8 Commits

Author SHA1 Message Date
Jake Potrebic 4c53acedce
fix exact choice recipes 2024-04-26 15:25:20 -07:00
Jake Potrebic 882ea0a430
fix adventure translations 2024-04-26 15:08:39 -07:00
Jason Penilla e856d17ec5
Update paper plugin check in PluginRemapper 2024-04-26 14:31:53 -07:00
Jake Potrebic 19ac9d43ce
remove no longer needed patches and fix tests 2024-04-26 14:29:21 -07:00
Jason Penilla 1bc278b125
Update patched spigot decompiler to fix inconsistency based on processing order 2024-04-26 11:45:56 -07:00
Jake Potrebic 44e68c301a
fix some more issues 2024-04-26 11:39:20 -07:00
Jake Potrebic cc81668863
fix some issues on the todo list 2024-04-26 09:22:55 -07:00
Jake Potrebic f6fae41cdf
fix chat_type issue 2024-04-26 08:33:00 -07:00
151 changed files with 666 additions and 624 deletions

View File

@ -72,7 +72,7 @@ dependencies {
paramMappings("net.fabricmc:yarn:1.20.5+build.1:mergedv2")
remapper("net.fabricmc:tiny-remapper:0.10.1:fat")
decompiler("org.vineflower:vineflower:1.10.1")
spigotDecompiler("io.papermc:patched-spigot-fernflower:0.1+build.12")
spigotDecompiler("io.papermc:patched-spigot-fernflower:0.1+build.13")
paperclip("io.papermc:paperclip:3.0.3")
}

View File

@ -115,7 +115,7 @@ index 0000000000000000000000000000000000000000..a02a02aa0c87e0f0ed9e509e4dcab015
+}
diff --git a/src/main/java/com/destroystokyo/paper/MaterialTags.java b/src/main/java/com/destroystokyo/paper/MaterialTags.java
new file mode 100644
index 0000000000000000000000000000000000000000..6dc176b694ff4f50ca4b665c3cf82212cf21f16f
index 0000000000000000000000000000000000000000..be212b4fbeabab32a4dab6ae554768c368efaa88
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/MaterialTags.java
@@ -0,0 +1,717 @@
@ -438,7 +438,7 @@ index 0000000000000000000000000000000000000000..6dc176b694ff4f50ca4b665c3cf82212
+ */
+ public static final MaterialSetTag SPAWN_EGGS = new MaterialSetTag(keyFor("spawn_eggs"))
+ .endsWith("_SPAWN_EGG")
+ .ensureSize("SPAWN_EGGS", 78).lock();
+ .ensureSize("SPAWN_EGGS", 80).lock();
+
+ /**
+ * Covers all colors of stained glass.

View File

@ -6,7 +6,7 @@ Subject: [PATCH] Add missing effects
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
diff --git a/src/main/java/org/bukkit/Effect.java b/src/main/java/org/bukkit/Effect.java
index fd9cf25f2fdef5ee3b7143f27e5f43dfe3f21a38..2d50f5e3f95e280ae5741514d5eba6440d9966ce 100644
index fd9cf25f2fdef5ee3b7143f27e5f43dfe3f21a38..88e93da6021b90a3351df17d95adc4d9277578f8 100644
--- a/src/main/java/org/bukkit/Effect.java
+++ b/src/main/java/org/bukkit/Effect.java
@@ -131,9 +131,9 @@ public enum Effect {
@ -21,7 +21,17 @@ index fd9cf25f2fdef5ee3b7143f27e5f43dfe3f21a38..2d50f5e3f95e280ae5741514d5eba644
* additional info.
*/
POTION_BREAK(2002, Type.VISUAL, Color.class),
@@ -336,21 +336,146 @@ public enum Effect {
@@ -177,7 +177,9 @@ public enum Effect {
/**
* Particles displayed when a villager grows a plant, data
* is the number of particles
+ * @deprecated partially replaced by {@link #BEE_GROWTH}
*/
+ @Deprecated(forRemoval = true, since = "1.20.5") // Paper
VILLAGER_PLANT_GROW(2005, Type.VISUAL, Integer.class),
/**
* The sound/particles used by the enderdragon's breath
@@ -336,21 +338,197 @@ public enum Effect {
* block.
*/
OXIDISED_COPPER_SCRAPE(3005, Type.VISUAL),
@ -128,6 +138,21 @@ index fd9cf25f2fdef5ee3b7143f27e5f43dfe3f21a38..2d50f5e3f95e280ae5741514d5eba644
+ */
+ SHOOT_WHITE_SMOKE(2010, Type.VISUAL, BlockFace.class),
+
+ /**
+ * {@link Integer} param is the number of particles
+ */
+ BEE_GROWTH(2011, Type.VISUAL, Integer.class),
+
+ /**
+ * {@link Integer} param is the number of particles
+ */
+ TURTLE_EGG_PLACEMENT(2012, Type.VISUAL, Integer.class),
+
+ /**
+ * {@link Integer} param is relative to the number of particles
+ */
+ SMASH_ATTACK(2013, Type.VISUAL, Integer.class),
+
+ PARTICLES_SCULK_CHARGE(3006, Type.VISUAL, Integer.class),
+
+ PARTICLES_SCULK_SHRIEK(3007, Type.SOUND),
@ -136,11 +161,18 @@ index fd9cf25f2fdef5ee3b7143f27e5f43dfe3f21a38..2d50f5e3f95e280ae5741514d5eba644
+
+ PARTICLES_EGG_CRACK(3009, Type.VISUAL),
+
+ @Deprecated(forRemoval = true, since = "1.20.5")
+ GUST_DUST(3010, Type.VISUAL),
+
+ TRIAL_SPAWNER_SPAWN(3011, Type.VISUAL),
+ /**
+ * {@link Boolean} param is true for "ominous" vaults
+ */
+ TRIAL_SPAWNER_SPAWN(3011, Type.VISUAL, Boolean.class),
+
+ TRIAL_SPAWNER_SPAWN_MOB_AT(3012, Type.VISUAL),
+ /**
+ * {@link Boolean} param is true for "ominous" vaults
+ */
+ TRIAL_SPAWNER_SPAWN_MOB_AT(3012, Type.VISUAL, Boolean.class),
+
+ /**
+ * {@link Integer} param is the number of players
@ -148,6 +180,35 @@ index fd9cf25f2fdef5ee3b7143f27e5f43dfe3f21a38..2d50f5e3f95e280ae5741514d5eba644
+ TRIAL_SPAWNER_DETECT_PLAYER(3013, Type.VISUAL, Integer.class),
+
+ TRIAL_SPAWNER_EJECT_ITEM(3014, Type.VISUAL),
+
+ /**
+ * {@link Boolean} param is true for "ominous" vaults
+ */
+ VAULT_ACTIVATE(3015, Type.VISUAL, Boolean.class),
+
+ /**
+ * {@link Boolean} param is true for "ominous" vaults
+ */
+ VAULT_DEACTIVATE(3016, Type.VISUAL, Boolean.class),
+
+ VAULT_EJECT_ITEM(3017, Type.VISUAL),
+
+ SPAWN_COBWEB(3018, Type.VISUAL),
+
+ /**
+ * {@link Integer} param is the number of players
+ */
+ TRIAL_SPAWNER_DETECT_PLAYER_OMINOUS(3019, Type.VISUAL, Integer.class),
+
+ /**
+ * {@link Boolean} param is true for changing to "ominous"
+ */
+ TRIAL_SPAWNER_BECOME_OMINOUS(3020, Type.VISUAL, Boolean.class),
+
+ /**
+ * {@link Boolean} param is true for "ominous" vaults
+ */
+ TRIAL_SPAWNER_SPAWN_ITEM(3021, Type.VISUAL, Boolean.class)
;
+ private static final org.apache.logging.log4j.Logger LOGGER = org.apache.logging.log4j.LogManager.getLogger();
+ // Paper end
@ -172,7 +233,7 @@ index fd9cf25f2fdef5ee3b7143f27e5f43dfe3f21a38..2d50f5e3f95e280ae5741514d5eba644
}
/**
@@ -366,8 +491,10 @@ public enum Effect {
@@ -366,8 +544,10 @@ public enum Effect {
/**
* @return The type of the effect.
@ -183,24 +244,25 @@ index fd9cf25f2fdef5ee3b7143f27e5f43dfe3f21a38..2d50f5e3f95e280ae5741514d5eba644
public Type getType() {
return this.type;
}
@@ -378,8 +505,15 @@ public enum Effect {
@@ -378,9 +558,16 @@ public enum Effect {
*/
@Nullable
public Class<?> getData() {
- return this.data;
+ return this.data == null ? null : this.data.get(0); // Paper
+ }
+
}
+ // Paper start - support deprecated data types
+ @org.jetbrains.annotations.ApiStatus.Internal
+ public boolean isApplicable(Object obj) {
+ return this.data != null && com.google.common.collect.Iterables.any(this.data, aClass -> aClass.isAssignableFrom(obj.getClass()));
}
+ }
+ // Paper end - support deprecated data types
+
/**
* Gets the Effect associated with the given ID.
@@ -396,12 +530,26 @@ public enum Effect {
*
@@ -396,12 +583,26 @@ public enum Effect {
static {
for (Effect effect : values()) {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Replace ItemFlag.HIDE_POTION_EFFECTS
diff --git a/src/main/java/org/bukkit/inventory/ItemFlag.java b/src/main/java/org/bukkit/inventory/ItemFlag.java
index 1b3580d1861af402396121805715e4087b3bc587..7174b843b7deac023637c6c112cf30a567969971 100644
index 1b3580d1861af402396121805715e4087b3bc587..a435f6c8947e4ac50b8c04f37b107055970937dd 100644
--- a/src/main/java/org/bukkit/inventory/ItemFlag.java
+++ b/src/main/java/org/bukkit/inventory/ItemFlag.java
@@ -38,4 +38,26 @@ public enum ItemFlag {
@@ -38,4 +38,27 @@ public enum ItemFlag {
* Setting to show/hide armor trim from armor.
*/
HIDE_ARMOR_TRIM;
@ -30,6 +30,7 @@ index 1b3580d1861af402396121805715e4087b3bc587..7174b843b7deac023637c6c112cf30a5
+ * <li>Shulker box contents</li>
+ * <li>Spawner descriptions</li>
+ * </ul>
+ * @deprecated use {@link #HIDE_ADDITIONAL_TOOLTIP}
+ */
+ @Deprecated
+ public static final ItemFlag HIDE_ITEM_SPECIFICS = HIDE_ADDITIONAL_TOOLTIP;

View File

@ -98,7 +98,7 @@ index 14fc03563daea531314c7ceba56dbb47884010ee..fcf95958ef659c7aa8e28026961fa1d6
}
diff --git a/src/main/java/net/minecraft/server/packs/repository/ServerPacksSource.java b/src/main/java/net/minecraft/server/packs/repository/ServerPacksSource.java
index a5e8713bc0fefae455b666ebf13c9529e7ba94e6..407254c779c8291543873fe4e94c5f94981a81eb 100644
index a5e8713bc0fefae455b666ebf13c9529e7ba94e6..def8ed40ef732b512a07fe50449c77a860b97462 100644
--- a/src/main/java/net/minecraft/server/packs/repository/ServerPacksSource.java
+++ b/src/main/java/net/minecraft/server/packs/repository/ServerPacksSource.java
@@ -48,7 +48,7 @@ public class ServerPacksSource extends BuiltInPackSource {
@ -110,6 +110,52 @@ index a5e8713bc0fefae455b666ebf13c9529e7ba94e6..407254c779c8291543873fe4e94c5f94
.applyDevelopmentConfig()
.pushJarResources()
.build(VANILLA_PACK_INFO);
@@ -68,7 +68,15 @@ public class ServerPacksSource extends BuiltInPackSource {
@Nullable
@Override
protected Pack createBuiltinPack(String fileName, Pack.ResourcesSupplier packFactory, Component displayName) {
- return Pack.readMetaAndCreate(createBuiltInPackLocation(fileName, displayName), packFactory, PackType.SERVER_DATA, FEATURE_SELECTION_CONFIG);
+ // Paper start - custom built-in pack
+ final PackLocationInfo info;
+ if ("paper".equals(fileName)) {
+ info = new PackLocationInfo(fileName, displayName, PackSource.BUILT_IN, Optional.empty());
+ } else {
+ info = createBuiltInPackLocation(fileName, displayName);
+ }
+ return Pack.readMetaAndCreate(info, packFactory, PackType.SERVER_DATA, FEATURE_SELECTION_CONFIG);
+ // Paper end - custom built-in pack
}
public static PackRepository createPackRepository(Path dataPacksPath, DirectoryValidator symlinkFinder) {
diff --git a/src/main/java/net/minecraft/world/level/DataPackConfig.java b/src/main/java/net/minecraft/world/level/DataPackConfig.java
index 3338a2423275ffff000a61d49167bb631bac3e32..72b5095b286009e95c7cbc0a579d3527d4b88866 100644
--- a/src/main/java/net/minecraft/world/level/DataPackConfig.java
+++ b/src/main/java/net/minecraft/world/level/DataPackConfig.java
@@ -9,8 +9,8 @@ public class DataPackConfig {
public static final DataPackConfig DEFAULT = new DataPackConfig(ImmutableList.of("vanilla"), ImmutableList.of());
public static final Codec<DataPackConfig> CODEC = RecordCodecBuilder.create(
instance -> instance.group(
- Codec.STRING.listOf().fieldOf("Enabled").forGetter(settings -> settings.enabled),
- Codec.STRING.listOf().fieldOf("Disabled").forGetter(settings -> settings.disabled)
+ Codec.STRING.listOf().validate(DataPackConfig::ensureEnabled).fieldOf("Enabled").forGetter(settings -> settings.enabled), // Paper - ensure "paper" is always enabled
+ Codec.STRING.listOf().validate(DataPackConfig::ensureNotDisabled).fieldOf("Disabled").forGetter(settings -> settings.disabled) // Paper - ensure "paper" is always enabled
)
.apply(instance, DataPackConfig::new)
);
@@ -29,4 +29,13 @@ public class DataPackConfig {
public List<String> getDisabled() {
return this.disabled;
}
+ // Paper start - ensure "paper" datapack is always enabled
+ private static com.mojang.serialization.DataResult<List<String>> ensureEnabled(final List<String> enabled) {
+ return com.mojang.serialization.DataResult.success(enabled.contains("paper") ? enabled: io.papermc.paper.util.MCUtil.copyListAndAdd(enabled, "paper"));
+ }
+
+ private static com.mojang.serialization.DataResult<List<String>> ensureNotDisabled(final List<String> disabled) {
+ return com.mojang.serialization.DataResult.success(io.papermc.paper.util.MCUtil.copyListAndRemoveIf(disabled, "paper"::equals));
+ }
+ // Paper end - ensure "paper" datapack is always enabled
}
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
index 5595eb892fa868508c45448942da65d7c11d49fd..4b8602b168f9dd386aa72b4e5d189c441c93542e 100644
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
@ -139,6 +185,18 @@ index 93046379d0cefd5d3236fc59e698809acdc18f80..774556a62eb240da42e84db4502e2ed4
diff --git a/src/main/resources/data/.paperassetsroot b/src/main/resources/data/.paperassetsroot
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/src/main/resources/data/minecraft/datapacks/paper/pack.mcmeta b/src/main/resources/data/minecraft/datapacks/paper/pack.mcmeta
new file mode 100644
index 0000000000000000000000000000000000000000..288fbe68c6053f40e72f0feedef0ae0fed10fa67
--- /dev/null
+++ b/src/main/resources/data/minecraft/datapacks/paper/pack.mcmeta
@@ -0,0 +1,6 @@
+{
+ "pack": {
+ "description": "Built-in Paper Datapack",
+ "pack_format": 41
+ }
+}
diff --git a/src/test/java/org/bukkit/support/AbstractTestingBase.java b/src/test/java/org/bukkit/support/AbstractTestingBase.java
index 1bdf0b2b8f8e6dace403695fece80ebb3dc9e039..544307fe34cbcfa286a7d7b30900ebea127d189e 100644
--- a/src/test/java/org/bukkit/support/AbstractTestingBase.java

View File

@ -482,10 +482,10 @@ index 0000000000000000000000000000000000000000..c01b4393439838976965823298f12e47
+}
diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
new file mode 100644
index 0000000000000000000000000000000000000000..a8268886d4a039975b6fed94b8dc325a8270f5fd
index 0000000000000000000000000000000000000000..4a34a49f12b106976ba19436f96f74ebb068249c
--- /dev/null
+++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
@@ -0,0 +1,313 @@
@@ -0,0 +1,311 @@
+package io.papermc.paper.configuration;
+
+import co.aikar.timings.MinecraftTimings;
@ -646,8 +646,6 @@ index 0000000000000000000000000000000000000000..a8268886d4a039975b6fed94b8dc325a
+ public boolean performUsernameValidation = true;
+ @Comment("This setting controls if players should be able to create headless pistons.")
+ public boolean allowHeadlessPistons = false;
+ @Comment("This setting controls if grindstones should be able to output overstacked items (such as cursed books).")
+ public boolean allowGrindstoneOverstacking = false;
+ @Comment("This setting controls what compression format is used for region files.")
+ public CompressionFormat compressionFormat = CompressionFormat.ZLIB;
+
@ -1310,10 +1308,10 @@ index 0000000000000000000000000000000000000000..fa1c0aee8c3a4d0868482cf5c703bbfd
+}
diff --git a/src/main/java/io/papermc/paper/configuration/RemovedConfigurations.java b/src/main/java/io/papermc/paper/configuration/RemovedConfigurations.java
new file mode 100644
index 0000000000000000000000000000000000000000..351fbbc577556ebbd62222615801a96b7c115822
index 0000000000000000000000000000000000000000..ede22142ef70bbdc6ede22ff4a13ed69fbce4915
--- /dev/null
+++ b/src/main/java/io/papermc/paper/configuration/RemovedConfigurations.java
@@ -0,0 +1,78 @@
@@ -0,0 +1,80 @@
+package io.papermc.paper.configuration;
+
+import org.spongepowered.configurate.NodePath;
@ -1367,7 +1365,8 @@ index 0000000000000000000000000000000000000000..351fbbc577556ebbd62222615801a96b
+ path("tnt-explosion-volume"),
+ path("entities", "spawning", "despawn-ranges", "soft"),
+ path("entities", "spawning", "despawn-ranges", "hard"),
+ path("fixes", "fix-curing-zombie-villager-discount-exploit")
+ path("fixes", "fix-curing-zombie-villager-discount-exploit"),
+ path("entities", "mob-effects", "undead-immune-to-certain-effects")
+ };
+
+ NodePath[] REMOVED_GLOBAL_PATHS = {
@ -1388,16 +1387,17 @@ index 0000000000000000000000000000000000000000..351fbbc577556ebbd62222615801a96b
+ path("baby-zombie-movement-speed"),
+ path("limit-player-interactions"),
+ path("warnWhenSettingExcessiveVelocity"),
+ path("logging", "use-rgb-for-named-text-colors")
+ path("logging", "use-rgb-for-named-text-colors"),
+ path("unsupported-settings", "allow-grindstone-overstacking")
+ };
+
+}
diff --git a/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java b/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java
new file mode 100644
index 0000000000000000000000000000000000000000..d3fdf62912d190f8b468b77230a927023c361074
index 0000000000000000000000000000000000000000..bfc10ae8e09ac07b969a38eecddfab1e3c308f5a
--- /dev/null
+++ b/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java
@@ -0,0 +1,554 @@
@@ -0,0 +1,553 @@
+package io.papermc.paper.configuration;
+
+import com.google.common.collect.HashBasedTable;
@ -1539,7 +1539,6 @@ index 0000000000000000000000000000000000000000..d3fdf62912d190f8b468b77230a92702
+ public MobEffects mobEffects;
+
+ public class MobEffects extends ConfigurationPart {
+ public boolean undeadImmuneToCertainEffects = true;
+ public boolean spidersImmuneToPoisonEffect = true;
+ public ImmuneToWitherEffect immuneToWitherEffect;
+

View File

@ -84,3 +84,16 @@ index 661a6274a800ca9b91bdb809d026972d23c3b263..ea72dcb064a35bc6245bc5c94d592efe
}
public static <T> SortedArraySet<T> create(Comparator<T> comparator) {
diff --git a/src/main/java/net/minecraft/world/entity/monster/Pillager.java b/src/main/java/net/minecraft/world/entity/monster/Pillager.java
index 328888db50c7ef7cae8305a6aa19d1af9a8c880d..ac411202c0029052a962b51b015da191b124de5f 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Pillager.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Pillager.java
@@ -62,7 +62,7 @@ public class Pillager extends AbstractIllager implements CrossbowAttackMob, Inve
protected void registerGoals() {
super.registerGoals();
this.goalSelector.addGoal(0, new FloatGoal(this));
- this.goalSelector.addGoal(2, new Raider.HoldGroundAttackGoal(this, this, 10.0F));
+ this.goalSelector.addGoal(2, new Raider.HoldGroundAttackGoal(this, 10.0F)); // Paper - decomp fix
this.goalSelector.addGoal(3, new RangedCrossbowAttackGoal<>(this, 1.0D, 8.0F));
this.goalSelector.addGoal(8, new RandomStrollGoal(this, 0.6D));
this.goalSelector.addGoal(9, new LookAtPlayerGoal(this, Player.class, 15.0F, 1.0F));

View File

@ -120,6 +120,18 @@ index 1e3ca7ca98abfd5be233a7eeb6dad201776d2d6a..9ec50bbb262b25fea157ae48e8395f5c
this.acceptsAll(Main.asList("nogui"), "Disables the graphical console");
this.acceptsAll(Main.asList("nojline"), "Disables jline and emulates the vanilla console");
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaMap.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaMap.java
index 6b34a8d33faa49ffa9082995e67af10d3cb38c03..f0c817e27a602740bc979b2ebaec3917e1906d74 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaMap.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaMap.java
@@ -127,6 +127,7 @@ class CraftMetaMap extends CraftMetaItem implements MapMeta {
@Override
public int getMapId() {
+ Preconditions.checkState(this.hasMapView(), "Item does not have map associated - check hasMapView() first!"); // Paper - more friendly message
return this.mapId;
}
diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
index 905adf97c0d1f0d1c774a6835a5dffcfea884e58..c017ce2ca1bc535795c958a2e509af2adf88efa9 100644
--- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java

View File

@ -14,7 +14,7 @@ Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
diff --git a/src/main/java/io/papermc/paper/adventure/AdventureCodecs.java b/src/main/java/io/papermc/paper/adventure/AdventureCodecs.java
new file mode 100644
index 0000000000000000000000000000000000000000..afd658635d1243770ecd96d3f274e3c24175b1e1
index 0000000000000000000000000000000000000000..8dcedc5f4d4453fd942787dbcb9c757274ec7715
--- /dev/null
+++ b/src/main/java/io/papermc/paper/adventure/AdventureCodecs.java
@@ -0,0 +1,446 @@
@ -143,7 +143,7 @@ index 0000000000000000000000000000000000000000..afd658635d1243770ecd96d3f274e3c2
+
+ static Codec<HoverEvent.ShowItem> showItemCodec(final Codec<Component> componentCodec) {
+ return net.minecraft.network.chat.HoverEvent.ItemStackInfo.CODEC.xmap(isi -> {
+ @Subst("key") final String typeKey = isi.item.unwrapKey().orElseThrow().toString();
+ @Subst("key") final String typeKey = isi.item.unwrapKey().orElseThrow().location().toString();
+ return HoverEvent.ShowItem.showItem(Key.key(typeKey), isi.count, PaperAdventure.asAdventure(isi.getItemStack().getComponentsPatch()));
+ }, si -> {
+ final Item itemType = BuiltInRegistries.ITEM.get(PaperAdventure.asVanilla(si.item()));
@ -466,10 +466,10 @@ index 0000000000000000000000000000000000000000..afd658635d1243770ecd96d3f274e3c2
+}
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..4b01e1249276a26aa82eb2d70f4b1223a7c8008f
index 0000000000000000000000000000000000000000..c9d787f4e66f152b557229fdb1d9a3ac83a7d71f
--- /dev/null
+++ b/src/main/java/io/papermc/paper/adventure/AdventureComponent.java
@@ -0,0 +1,78 @@
@@ -0,0 +1,88 @@
+package io.papermc.paper.adventure;
+
+import java.util.List;
@ -547,6 +547,16 @@ index 0000000000000000000000000000000000000000..4b01e1249276a26aa82eb2d70f4b1223
+ public Component adventure$component() {
+ return this.adventure;
+ }
+
+ @Override
+ public int hashCode() {
+ return this.deepConverted().hashCode();
+ }
+
+ @Override
+ public boolean equals(final Object obj) {
+ return this.deepConverted().equals(obj);
+ }
+}
diff --git a/src/main/java/io/papermc/paper/adventure/BossBarImplementationImpl.java b/src/main/java/io/papermc/paper/adventure/BossBarImplementationImpl.java
new file mode 100644
@ -2200,18 +2210,26 @@ index d120fff432d9c4fc7a35ddffdc4186459e45e950..676a1499747b07151547913087515726
}
}
diff --git a/src/main/java/net/minecraft/network/FriendlyByteBuf.java b/src/main/java/net/minecraft/network/FriendlyByteBuf.java
index a7419bcb0954f0adbf7ce2d1e9738e690c265f4d..6ad38756cbc532b18de0793c784b9c7f2a10a88f 100644
index a7419bcb0954f0adbf7ce2d1e9738e690c265f4d..aafeb9c61ddba6a8671f0238eda47b227619f1af 100644
--- a/src/main/java/net/minecraft/network/FriendlyByteBuf.java
+++ b/src/main/java/net/minecraft/network/FriendlyByteBuf.java
@@ -72,6 +72,7 @@ public class FriendlyByteBuf extends ByteBuf {
public static final int DEFAULT_NBT_QUOTA = 2097152;
private final ByteBuf source;
+ public java.util.Locale adventure$locale; // Paper - track player's locale for server-side translations
+ @Nullable public final java.util.Locale adventure$locale; // Paper - track player's locale for server-side translations
public static final short MAX_STRING_LENGTH = Short.MAX_VALUE;
public static final int MAX_COMPONENT_STRING_LENGTH = 262144;
private static final int PUBLIC_KEY_SIZE = 256;
@@ -120,11 +121,16 @@ public class FriendlyByteBuf extends ByteBuf {
@@ -80,6 +81,7 @@ public class FriendlyByteBuf extends ByteBuf {
private static final Gson GSON = new Gson();
public FriendlyByteBuf(ByteBuf parent) {
+ this.adventure$locale = PacketEncoder.ADVENTURE_LOCALE.get(); // Paper - track player's locale for server-side translations
this.source = parent;
}
@@ -120,11 +122,16 @@ public class FriendlyByteBuf extends ByteBuf {
}
public <T> void writeJsonWithCodec(Codec<T> codec, T value) {
@ -2230,17 +2248,22 @@ index a7419bcb0954f0adbf7ce2d1e9738e690c265f4d..6ad38756cbc532b18de0793c784b9c7f
public static <T> IntFunction<T> limitValue(IntFunction<T> applier, int max) {
diff --git a/src/main/java/net/minecraft/network/PacketEncoder.java b/src/main/java/net/minecraft/network/PacketEncoder.java
index a58f67973b4ed986065860263c7a42214640520d..15783d102208f6ab824ac50ed7969204b80a22c9 100644
index a58f67973b4ed986065860263c7a42214640520d..046bfc212b640de174b300e7a05cc30bb3cac93e 100644
--- a/src/main/java/net/minecraft/network/PacketEncoder.java
+++ b/src/main/java/net/minecraft/network/PacketEncoder.java
@@ -20,6 +20,7 @@ public class PacketEncoder<T extends PacketListener> extends MessageToByteEncode
@@ -17,10 +17,12 @@ public class PacketEncoder<T extends PacketListener> extends MessageToByteEncode
this.protocolInfo = state;
}
+ static final ThreadLocal<java.util.Locale> ADVENTURE_LOCALE = ThreadLocal.withInitial(() -> null); // Paper - adventure; set player's locale
protected void encode(ChannelHandlerContext channelHandlerContext, Packet<T> packet, ByteBuf byteBuf) throws Exception {
PacketType<? extends Packet<? super T>> packetType = packet.type();
+ if (byteBuf instanceof FriendlyByteBuf friendlyByteBuf) friendlyByteBuf.adventure$locale = channelHandlerContext.channel().attr(io.papermc.paper.adventure.PaperAdventure.LOCALE_ATTRIBUTE).get(); // Paper - adventure; set player's locale
try {
+ ADVENTURE_LOCALE.set(channelHandlerContext.channel().attr(io.papermc.paper.adventure.PaperAdventure.LOCALE_ATTRIBUTE).get()); // Paper - adventure; set player's locale
this.protocolInfo.codec().encode(byteBuf, packet);
int i = byteBuf.readableBytes();
if (LOGGER.isDebugEnabled()) {
diff --git a/src/main/java/net/minecraft/network/chat/ChatDecorator.java b/src/main/java/net/minecraft/network/chat/ChatDecorator.java
index e4624d696dcf0ddb6d42a80701dfc47ec6877540..6b8dc1eb490098cc14673c9ab0aa16fe3471325b 100644
--- a/src/main/java/net/minecraft/network/chat/ChatDecorator.java
@ -2395,6 +2418,22 @@ index 739ef5fb6f4fa37382153ba6a308ca3b451e6b05..7c3154af5d7732037c0ee965f6f8b894
public static final Codec<MessageSignature> CODEC = ExtraCodecs.BASE64_STRING.xmap(MessageSignature::new, MessageSignature::bytes);
public static final int BYTES = 256;
diff --git a/src/main/java/net/minecraft/network/chat/MutableComponent.java b/src/main/java/net/minecraft/network/chat/MutableComponent.java
index 1ce6b84e0d0bb708ced06955cd62281369b5fd4f..82e2a02336da4ee8cfd84bc82b143f8b9dbcf449 100644
--- a/src/main/java/net/minecraft/network/chat/MutableComponent.java
+++ b/src/main/java/net/minecraft/network/chat/MutableComponent.java
@@ -94,6 +94,11 @@ public class MutableComponent implements Component {
@Override
public boolean equals(Object object) {
+ // Paper start - make AdventureComponent equivalent
+ if (object instanceof io.papermc.paper.adventure.AdventureComponent adventureComponent) {
+ object = adventureComponent.deepConverted();
+ }
+ // Paper end - make AdventureComponent equivalent
return this == object
|| object instanceof MutableComponent mutableComponent
&& this.contents.equals(mutableComponent.contents)
diff --git a/src/main/java/net/minecraft/network/chat/OutgoingChatMessage.java b/src/main/java/net/minecraft/network/chat/OutgoingChatMessage.java
index e2def0ca552343143e495736d533b3334686fd62..c87b708c368713a23a10ad97704575ee4df27891 100644
--- a/src/main/java/net/minecraft/network/chat/OutgoingChatMessage.java
@ -3208,27 +3247,25 @@ index ed54c81a3269360acce674aa4e1d54ccb2461841..c9c849534c3998cfcab7ddcb12a71ccb
}
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
index 2b8b220bf1e132b230abe14770da53de84db9818..7ca60db3a639e68456933f8e5af900dc4aade575 100644
index 2b8b220bf1e132b230abe14770da53de84db9818..96da768f55ad835a1a55bf359f0d7278bc232304 100644
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
@@ -164,7 +164,16 @@ public final class ItemStack implements DataComponentHolder {
return ItemStack.EMPTY;
} else {
Holder<Item> holder = (Holder) ITEM_STREAM_CODEC.decode(registryfriendlybytebuf); // CraftBukkit - decompile error
- DataComponentPatch datacomponentpatch = (DataComponentPatch) DataComponentPatch.STREAM_CODEC.decode(registryfriendlybytebuf);
@@ -186,7 +186,15 @@ public final class ItemStack implements DataComponentHolder {
CraftItemStack.setItemMeta(itemstack, CraftItemStack.getItemMeta(itemstack));
// Spigot end
ITEM_STREAM_CODEC.encode(registryfriendlybytebuf, itemstack.getItemHolder()); // CraftBukkit - decompile error
+ // Paper start - adventure; conditionally render translatable components
+ DataComponentPatch datacomponentpatch;
+ boolean prev = net.minecraft.network.chat.ComponentSerialization.DONT_RENDER_TRANSLATABLES.get();
+ try {
+ net.minecraft.network.chat.ComponentSerialization.DONT_RENDER_TRANSLATABLES.set(true);
+ datacomponentpatch = (DataComponentPatch) DataComponentPatch.STREAM_CODEC.decode(registryfriendlybytebuf);
+ net.minecraft.network.chat.ComponentSerialization.DONT_RENDER_TRANSLATABLES.set(true);
DataComponentPatch.STREAM_CODEC.encode(registryfriendlybytebuf, itemstack.components.asPatch());
+ } finally {
+ net.minecraft.network.chat.ComponentSerialization.DONT_RENDER_TRANSLATABLES.set(prev);
+ }
+ // Paper end - adventure; conditionally render translatable components
// CraftBukkit start
ItemStack itemstack = new ItemStack(holder, i, datacomponentpatch);
}
}
};
diff --git a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java
index 8ec376f453ac1f4c9423483f5ae1625b295858c7..e535fb3b5194b8412c0c26c0799340916c7542eb 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java
@ -5638,11 +5675,11 @@ index 0000000000000000000000000000000000000000..28d777610b52ba74f808bf3245d73b83
+++ b/src/main/resources/META-INF/services/net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer$Provider
@@ -0,0 +1 @@
+io.papermc.paper.adventure.providers.PlainTextComponentSerializerProviderImpl
diff --git a/src/main/resources/data/paper/chat_type/raw.json b/src/main/resources/data/paper/chat_type/raw.json
diff --git a/src/main/resources/data/minecraft/datapacks/paper/data/paper/chat_type/raw.json b/src/main/resources/data/minecraft/datapacks/paper/data/paper/chat_type/raw.json
new file mode 100644
index 0000000000000000000000000000000000000000..3aedd0bbc97edacc1ebf71264b310e55aaaa5cb3
--- /dev/null
+++ b/src/main/resources/data/paper/chat_type/raw.json
+++ b/src/main/resources/data/minecraft/datapacks/paper/data/paper/chat_type/raw.json
@@ -0,0 +1,14 @@
+{
+ "chat": {

View File

@ -366,14 +366,15 @@ index 0000000000000000000000000000000000000000..3a5bb5d2a45654385ca0bc15c81ef953
+}
diff --git a/src/main/java/io/papermc/paper/pluginremap/PluginRemapper.java b/src/main/java/io/papermc/paper/pluginremap/PluginRemapper.java
new file mode 100644
index 0000000000000000000000000000000000000000..5408015a25d5e3d2149976e428c9d4be470de2ba
index 0000000000000000000000000000000000000000..06dbaf0c77333f4d0d8ac462edd52097237505c0
--- /dev/null
+++ b/src/main/java/io/papermc/paper/pluginremap/PluginRemapper.java
@@ -0,0 +1,369 @@
@@ -0,0 +1,370 @@
+package io.papermc.paper.pluginremap;
+
+import com.google.common.util.concurrent.ThreadFactoryBuilder;
+import com.mojang.logging.LogUtils;
+import io.papermc.paper.plugin.provider.type.PluginFileType;
+import io.papermc.paper.util.AtomicFiles;
+import io.papermc.paper.util.MappingEnvironment;
+import io.papermc.paper.util.concurrent.ScalingThreadPool;
@ -557,8 +558,8 @@ index 0000000000000000000000000000000000000000..5408015a25d5e3d2149976e428c9d4be
+ final long start = System.currentTimeMillis();
+ final IMappingFile reversed = mappings.reverse();
+ if (DEBUG_LOGGING) {
+ LOGGER.info("Done reversing mappings in {}ms.", System.currentTimeMillis() - start);
+ }
+ LOGGER.info("Done reversing mappings in {}ms.", System.currentTimeMillis() - start);
+ }
+ return reversed;
+ }
+
@ -615,30 +616,30 @@ index 0000000000000000000000000000000000000000..5408015a25d5e3d2149976e428c9d4be
+
+ try (final FileSystem fs = FileSystems.newFileSystem(inputFile, new HashMap<>())) {
+ // Leave dummy files if no remapping is required, so that we can check if they exist without copying the whole file
+ /*if (Files.exists(fs.getPath(PluginFileType.PAPER_PLUGIN_YML))) { // TODO Uncomment on release
+ final Path manifestPath = fs.getPath("META-INF/MANIFEST.MF");
+ final @Nullable String ns;
+ if (Files.exists(manifestPath)) {
+ final Manifest manifest;
+ try (final InputStream in = new BufferedInputStream(Files.newInputStream(manifestPath))) {
+ manifest = new Manifest(in);
+ }
+ ns = manifest.getMainAttributes().getValue(InsertManifestAttribute.PAPERWEIGHT_NAMESPACE_MANIFEST_KEY);
+ } else {
+ ns = null;
+ }
+ if (ns != null && (ns.equals(InsertManifestAttribute.MOJANG_NAMESPACE) || ns.equals(InsertManifestAttribute.MOJANG_PLUS_YARN_NAMESPACE))) {
+ if (DEBUG_LOGGING) {
+ LOGGER.info("Plugin '{}' is a Paper plugin, no remapping necessary.", inputFile);
+ LOGGER.info("Plugin '{}' is already Mojang mapped.", inputFile);
+ }
+ index.skip(inputFile);
+ return CompletableFuture.completedFuture(inputFile);
+ } else {*/
+ // Check for paperweight mojang mapped marker
+ final Path manifestPath = fs.getPath("META-INF/MANIFEST.MF");
+ if (Files.exists(manifestPath)) {
+ final Manifest manifest;
+ try (final InputStream in = new BufferedInputStream(Files.newInputStream(manifestPath))) {
+ manifest = new Manifest(in);
+ }
+ final String ns = manifest.getMainAttributes().getValue(InsertManifestAttribute.PAPERWEIGHT_NAMESPACE_MANIFEST_KEY);
+ if (ns != null && (ns.equals(InsertManifestAttribute.MOJANG_NAMESPACE) || ns.equals(InsertManifestAttribute.MOJANG_PLUS_YARN_NAMESPACE))) {
+ if (DEBUG_LOGGING) {
+ LOGGER.info("Plugin '{}' is already Mojang mapped.", inputFile);
+ }
+ index.skip(inputFile);
+ return CompletableFuture.completedFuture(inputFile);
+ }
+ } else if (ns == null && Files.exists(fs.getPath(PluginFileType.PAPER_PLUGIN_YML))) {
+ if (DEBUG_LOGGING) {
+ LOGGER.info("Plugin '{}' is a Paper plugin with no namespace specified.", inputFile);
+ }
+ //}
+ index.skip(inputFile);
+ return CompletableFuture.completedFuture(inputFile);
+ }
+ } catch (final IOException ex) {
+ throw new RuntimeException("Failed to open plugin jar " + inputFile, ex);
+ }

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Remove unnecessary itemmeta handling
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
index 7ca60db3a639e68456933f8e5af900dc4aade575..836a9bb57fa6e916ed8a24c35426c6432f73be88 100644
index 96da768f55ad835a1a55bf359f0d7278bc232304..aca1e4ef1593c5a506a37349274cd81b1dc81ea8 100644
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
@@ -177,7 +177,7 @@ public final class ItemStack implements DataComponentHolder {
@@ -168,7 +168,7 @@ public final class ItemStack implements DataComponentHolder {
// CraftBukkit start
ItemStack itemstack = new ItemStack(holder, i, datacomponentpatch);
@ -17,7 +17,7 @@ index 7ca60db3a639e68456933f8e5af900dc4aade575..836a9bb57fa6e916ed8a24c35426c643
CraftItemStack.setItemMeta(itemstack, CraftItemStack.getItemMeta(itemstack));
}
return itemstack;
@@ -192,7 +192,7 @@ public final class ItemStack implements DataComponentHolder {
@@ -183,7 +183,7 @@ public final class ItemStack implements DataComponentHolder {
registryfriendlybytebuf.writeVarInt(itemstack.getCount());
// Spigot start - filter
itemstack = itemstack.copy();
@ -25,4 +25,4 @@ index 7ca60db3a639e68456933f8e5af900dc4aade575..836a9bb57fa6e916ed8a24c35426c643
+ // CraftItemStack.setItemMeta(itemstack, CraftItemStack.getItemMeta(itemstack)); // Paper - This is no longer with raw NBT being handled in metadata
// Spigot end
ITEM_STREAM_CODEC.encode(registryfriendlybytebuf, itemstack.getItemHolder()); // CraftBukkit - decompile error
DataComponentPatch.STREAM_CODEC.encode(registryfriendlybytebuf, itemstack.components.asPatch());
// Paper start - adventure; conditionally render translatable components

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Allow chests to be placed with NBT data
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
index 836a9bb57fa6e916ed8a24c35426c6432f73be88..72ce219546306fc50da37468f37cec8e6bf551fe 100644
index aca1e4ef1593c5a506a37349274cd81b1dc81ea8..c834212d0e6a09c0f73abeb545b60dec26e726a5 100644
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
@@ -470,6 +470,7 @@ public final class ItemStack implements DataComponentHolder {
@@ -469,6 +469,7 @@ public final class ItemStack implements DataComponentHolder {
enuminteractionresult = InteractionResult.FAIL; // cancel placement
// PAIL: Remove this when MC-99075 fixed
placeEvent.getPlayer().updateInventory();

View File

@ -5,10 +5,10 @@ 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 72ce219546306fc50da37468f37cec8e6bf551fe..d95272b1765368a4cd968fa566ad68844dced4c8 100644
index c834212d0e6a09c0f73abeb545b60dec26e726a5..db78a1948df2f8a5bce37a7566e9af9cd7c8b485 100644
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
@@ -502,7 +502,7 @@ public final class ItemStack implements DataComponentHolder {
@@ -501,7 +501,7 @@ public final class ItemStack implements DataComponentHolder {
net.minecraft.world.level.block.state.BlockState block = world.getBlockState(newblockposition);
if (!(block.getBlock() instanceof BaseEntityBlock)) { // Containers get placed automatically

View File

@ -5,7 +5,8 @@ Subject: [PATCH] Add methods to get translation keys
== AT ==
public org.bukkit.craftbukkit.inventory.CraftMetaFirework
public org.bukkit.craftbukkit.inventory.CraftMetaFirework getNBT(Lorg/bukkit/FireworkEffect$Type;)I
public org.bukkit.craftbukkit.inventory.CraftMetaFirework power
public org.bukkit.craftbukkit.inventory.CraftMetaFirework getNBT(Lorg/bukkit/FireworkEffect$Type;)Lnet/minecraft/world/item/component/FireworkExplosion$Shape;
Co-authored-by: MeFisto94 <MeFisto94@users.noreply.github.com>
@ -40,8 +41,21 @@ index d839a0edf31f6803e5813b28a23fa17e20916b2c..bb8a3e670924ebcce48669c5dce57e2d
// Paper end
@Override
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaFirework.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaFirework.java
index ebdb19d7ee0460d50c082b0a41b3a6a57a3534ee..b444bd26d6c3def3494d3cc0520e462408272be3 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaFirework.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaFirework.java
@@ -111,7 +111,7 @@ class CraftMetaFirework extends CraftMetaItem implements FireworkMeta {
return new FireworkExplosion(CraftMetaFirework.getNBT(effect.getType()), colors, fadeColors, effect.hasTrail(), effect.hasFlicker());
}
- static FireworkExplosion.Shape getNBT(Type type) {
+ public static FireworkExplosion.Shape getNBT(Type type) { // Paper - package-private -> public
switch (type) {
case BALL:
return FireworkExplosion.Shape.SMALL_BALL;
diff --git a/src/test/java/io/papermc/paper/world/TranslationKeyTest.java b/src/test/java/io/papermc/paper/world/TranslationKeyTest.java
index 7f8b6462d2a1bbd39a870d2543bebc135f7eb45b..dbd1dc4453bd26fb6116b62f6ccbf69e92e09fc4 100644
index 7f8b6462d2a1bbd39a870d2543bebc135f7eb45b..441e8fbd548e425ca9b0dfd69d08f7b83081888c 100644
--- a/src/test/java/io/papermc/paper/world/TranslationKeyTest.java
+++ b/src/test/java/io/papermc/paper/world/TranslationKeyTest.java
@@ -1,12 +1,27 @@
@ -73,7 +87,7 @@ index 7f8b6462d2a1bbd39a870d2543bebc135f7eb45b..dbd1dc4453bd26fb6116b62f6ccbf69e
@Test
public void testChatVisibilityKeys() {
@@ -15,4 +30,67 @@ public class TranslationKeyTest {
@@ -15,4 +30,69 @@ public class TranslationKeyTest {
Assertions.assertEquals(ChatVisiblity.valueOf(chatVisibility.name()).getKey(), chatVisibility.translationKey(), chatVisibility + "'s translation key doesn't match");
}
}
@ -101,8 +115,10 @@ index 7f8b6462d2a1bbd39a870d2543bebc135f7eb45b..dbd1dc4453bd26fb6116b62f6ccbf69e
+
+ @Test
+ public void testFireworkEffectType() {
+ for (FireworkEffect.Type type : FireworkEffect.Type.values()) {
+ Assertions.assertEquals(net.minecraft.world.item.FireworkRocketItem.Shape.byId(org.bukkit.craftbukkit.inventory.CraftMetaFirework.getNBT(type)).getName(), org.bukkit.FireworkEffect.Type.NAMES.key(type), "translation key mismatch for " + type);
+ for (final FireworkEffect.Type type : FireworkEffect.Type.values()) {
+ final net.minecraft.world.item.component.FireworkExplosion.Shape nmsType = org.bukkit.craftbukkit.inventory.CraftMetaFirework.getNBT(type);
+ Assertions.assertTrue(nmsType.getName().getContents() instanceof TranslatableContents, "contents aren't translatable");
+ Assertions.assertEquals(((TranslatableContents) nmsType.getName().getContents()).getKey(), type.translationKey(), "translation key mismatch for " + type);
+ }
+ }
+

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Add missing default perms for commands
diff --git a/src/main/java/org/bukkit/craftbukkit/util/permissions/CommandPermissions.java b/src/main/java/org/bukkit/craftbukkit/util/permissions/CommandPermissions.java
index a9ea2e38e4673686c9994a58c94ad19e59fd423c..dd95b3bfe59f2bb635afe92317288efcd2986326 100644
index a9ea2e38e4673686c9994a58c94ad19e59fd423c..52649f82351ab4f675c3cc3cd6640956b0f76b91 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/permissions/CommandPermissions.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/permissions/CommandPermissions.java
@@ -24,13 +24,74 @@ public final class CommandPermissions {
@@ -24,13 +24,75 @@ public final class CommandPermissions {
DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "stop", "Allows the user to stop the server", PermissionDefault.OP, commands);
DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "list", "Allows the user to list all online players", PermissionDefault.OP, commands);
DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "gamemode", "Allows the user to change the gamemode of another player", PermissionDefault.OP, commands);
@ -75,6 +75,7 @@ index a9ea2e38e4673686c9994a58c94ad19e59fd423c..dd95b3bfe59f2bb635afe92317288efc
+ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "time", "Allows the user to change or query the world's game time", PermissionDefault.OP, commands);
+ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "tick", "Allows the user to control the tick rate of the server", PermissionDefault.OP, commands);
+ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "title", "Allows the user to manage screen titles", PermissionDefault.OP, commands);
+ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "transfer", "Allows the user to transfer to another server", PermissionDefault.OP, commands);
+ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "weather", "Allows the user to set the weather", PermissionDefault.OP, commands);
+ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "whitelist", "Allows the user to manage the server whitelist", PermissionDefault.OP, commands);
+ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "worldborder", "Allows the user to manage the world border", PermissionDefault.OP, commands);
@ -87,7 +88,7 @@ index a9ea2e38e4673686c9994a58c94ad19e59fd423c..dd95b3bfe59f2bb635afe92317288efc
diff --git a/src/test/java/io/papermc/paper/permissions/MinecraftCommandPermissionsTest.java b/src/test/java/io/papermc/paper/permissions/MinecraftCommandPermissionsTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..afeb4271fffb7546209f1e651214065187c88302
index 0000000000000000000000000000000000000000..ca71c688b37ce2c8b712a4f9216cf872c8edf78e
--- /dev/null
+++ b/src/test/java/io/papermc/paper/permissions/MinecraftCommandPermissionsTest.java
@@ -0,0 +1,82 @@
@ -132,7 +133,7 @@ index 0000000000000000000000000000000000000000..afeb4271fffb7546209f1e6512140651
+ CraftDefaultPermissions.registerCorePermissions();
+ Set<String> perms = collectMinecraftCommandPerms();
+
+ Commands commands = new Commands(Commands.CommandSelection.DEDICATED, CommandBuildContext.configurable(AbstractTestingBase.REGISTRY_CUSTOM, FeatureFlags.VANILLA_SET));
+ Commands commands = new Commands(Commands.CommandSelection.DEDICATED, CommandBuildContext.simple(AbstractTestingBase.REGISTRY_CUSTOM, FeatureFlags.VANILLA_SET));
+ RootCommandNode<CommandSourceStack> root = commands.getDispatcher().getRoot();
+ Set<String> missing = new LinkedHashSet<>();
+ Set<String> foundPerms = new HashSet<>();

View File

@ -33,7 +33,7 @@ index c0592a85a1a0781b83232533b9ca1b30b116eb98..125ed63d8ae812284cd452b4387fd0d6
/**
diff --git a/src/test/java/io/papermc/paper/inventory/ItemRarityTest.java b/src/test/java/io/papermc/paper/inventory/ItemRarityTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..d310f86c57e4521ad7666d3f738f53ac83d221f2
index 0000000000000000000000000000000000000000..8086e6a754cb94ce15428ac0cdbaa43590beb9fe
--- /dev/null
+++ b/src/test/java/io/papermc/paper/inventory/ItemRarityTest.java
@@ -0,0 +1,24 @@
@ -57,7 +57,7 @@ index 0000000000000000000000000000000000000000..d310f86c57e4521ad7666d3f738f53ac
+ @Test
+ public void testRarityFormatting() {
+ for (Rarity nmsRarity : Rarity.values()) {
+ assertEquals(nmsRarity.color, PaperAdventure.asVanilla(ItemRarity.values()[nmsRarity.ordinal()].color), "rarity formatting is mis-matched");
+ assertEquals(nmsRarity.color(), PaperAdventure.asVanilla(ItemRarity.values()[nmsRarity.ordinal()].color), "rarity formatting is mis-matched");
+ }
+ }
+}

View File

@ -85,43 +85,3 @@ index bb8a3e670924ebcce48669c5dce57e2df03fad77..bb45dde0fd91796d5fd83a5fd20f5f1d
// Paper end
@Override
diff --git a/src/test/java/io/papermc/paper/entity/EntityCategoryTest.java b/src/test/java/io/papermc/paper/entity/EntityCategoryTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..4ee48ef89f0e31a7bda4b04453fca8177874f540
--- /dev/null
+++ b/src/test/java/io/papermc/paper/entity/EntityCategoryTest.java
@@ -0,0 +1,34 @@
+package io.papermc.paper.entity;
+
+import com.google.common.base.Joiner;
+import com.google.common.collect.Maps;
+import com.google.common.collect.Sets;
+import net.minecraft.world.entity.MobType;
+import org.bukkit.craftbukkit.entity.CraftLivingEntity;
+import org.bukkit.entity.EntityCategory;
+import org.junit.jupiter.api.Test;
+
+import java.lang.reflect.Field;
+import java.util.Map;
+import java.util.Set;
+
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+public class EntityCategoryTest {
+
+ @Test
+ public void test() throws IllegalAccessException {
+
+ Map<MobType, String> enumMonsterTypeFieldMap = Maps.newHashMap();
+ for (Field field : MobType.class.getDeclaredFields()) {
+ if (field.getType() == MobType.class) {
+ enumMonsterTypeFieldMap.put( (MobType) field.get(null), field.getName());
+ }
+ }
+
+ for (EntityCategory entityCategory : EntityCategory.values()) {
+ enumMonsterTypeFieldMap.remove(CraftLivingEntity.fromBukkitEntityCategory(entityCategory));
+ }
+ assertTrue(enumMonsterTypeFieldMap.size() == 0, MobType.class.getName() + " instance(s): " + Joiner.on(", ").join(enumMonsterTypeFieldMap.values()) + " do not have bukkit equivalents");
+ }
+}

View File

@ -4,6 +4,32 @@ Date: Sun, 20 Jun 2021 21:55:59 -0700
Subject: [PATCH] Fix PlayerDropItemEvent using wrong item
diff --git a/src/main/java/net/minecraft/server/commands/GiveCommand.java b/src/main/java/net/minecraft/server/commands/GiveCommand.java
index c81fd3e1108fb0a02f9240263404af2b968c8494..0d9de4c61c7b26a6ff37c12fde629161fd0c3d5a 100644
--- a/src/main/java/net/minecraft/server/commands/GiveCommand.java
+++ b/src/main/java/net/minecraft/server/commands/GiveCommand.java
@@ -38,6 +38,7 @@ public class GiveCommand {
private static int giveItem(CommandSourceStack source, ItemInput item, Collection<ServerPlayer> targets, int count) throws CommandSyntaxException {
ItemStack itemstack = item.createItemStack(1, false);
+ final Component displayName = itemstack.getDisplayName(); // Paper - get display name early
int j = itemstack.getMaxStackSize();
int k = j * 100;
@@ -79,11 +80,11 @@ public class GiveCommand {
if (targets.size() == 1) {
source.sendSuccess(() -> {
- return Component.translatable("commands.give.success.single", count, itemstack.getDisplayName(), ((ServerPlayer) targets.iterator().next()).getDisplayName());
+ return Component.translatable("commands.give.success.single", count, displayName, ((ServerPlayer) targets.iterator().next()).getDisplayName()); // Paper - use cached display name
}, true);
} else {
source.sendSuccess(() -> {
- return Component.translatable("commands.give.success.single", count, itemstack.getDisplayName(), targets.size());
+ return Component.translatable("commands.give.success.single", count, displayName, targets.size()); // Paper - use cached display name
}, true);
}
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 50c6b668a8e915081007dfd9c9fc1aae179e16c9..a9130dd3097c31d91baaf1405a369881393d42d5 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Add EntityDamageItemEvent
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
index d95272b1765368a4cd968fa566ad68844dced4c8..081d0241692078516a4554ccbda17f4539dc5ed6 100644
index db78a1948df2f8a5bce37a7566e9af9cd7c8b485..87208b14b3f31f372c1d5f4b759f4ced8cc992c9 100644
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
@@ -648,7 +648,7 @@ public final class ItemStack implements DataComponentHolder {
@@ -647,7 +647,7 @@ public final class ItemStack implements DataComponentHolder {
return (Integer) this.getOrDefault(DataComponents.MAX_DAMAGE, 0);
}
@ -17,7 +17,7 @@ index d95272b1765368a4cd968fa566ad68844dced4c8..081d0241692078516a4554ccbda17f45
if (this.isDamageableItem()) {
int j;
@@ -664,8 +664,8 @@ public final class ItemStack implements DataComponentHolder {
@@ -663,8 +663,8 @@ public final class ItemStack implements DataComponentHolder {
amount -= k;
// CraftBukkit start
@ -28,7 +28,7 @@ index d95272b1765368a4cd968fa566ad68844dced4c8..081d0241692078516a4554ccbda17f45
event.getPlayer().getServer().getPluginManager().callEvent(event);
if (amount != event.getDamage() || event.isCancelled()) {
@@ -676,6 +676,14 @@ public final class ItemStack implements DataComponentHolder {
@@ -675,6 +675,14 @@ public final class ItemStack implements DataComponentHolder {
}
amount = event.getDamage();
@ -43,7 +43,7 @@ index d95272b1765368a4cd968fa566ad68844dced4c8..081d0241692078516a4554ccbda17f45
}
// CraftBukkit end
if (amount <= 0) {
@@ -683,8 +691,8 @@ public final class ItemStack implements DataComponentHolder {
@@ -682,8 +690,8 @@ public final class ItemStack implements DataComponentHolder {
}
}
@ -54,7 +54,7 @@ index d95272b1765368a4cd968fa566ad68844dced4c8..081d0241692078516a4554ccbda17f45
}
j = this.getDamageValue() + amount;
@@ -717,7 +725,7 @@ public final class ItemStack implements DataComponentHolder {
@@ -716,7 +724,7 @@ public final class ItemStack implements DataComponentHolder {
entityplayer = null;
}

View File

@ -8,10 +8,10 @@ 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 081d0241692078516a4554ccbda17f4539dc5ed6..8f4ca2479bf185cb2409d1da20dfc7de0f0ce550 100644
index 87208b14b3f31f372c1d5f4b759f4ced8cc992c9..db94bbbd7f93afef46586e6314ebc666b7e6087c 100644
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
@@ -402,7 +402,7 @@ public final class ItemStack implements DataComponentHolder {
@@ -401,7 +401,7 @@ public final class ItemStack implements DataComponentHolder {
int oldCount = this.getCount();
ServerLevel world = (ServerLevel) context.getLevel();
@ -20,7 +20,7 @@ index 081d0241692078516a4554ccbda17f4539dc5ed6..8f4ca2479bf185cb2409d1da20dfc7de
world.captureBlockStates = true;
// special case bonemeal
if (item == Items.BONE_MEAL) {
@@ -462,7 +462,7 @@ public final class ItemStack implements DataComponentHolder {
@@ -461,7 +461,7 @@ public final class ItemStack implements DataComponentHolder {
world.capturedBlockStates.clear();
if (blocks.size() > 1) {
placeEvent = org.bukkit.craftbukkit.event.CraftEventFactory.callBlockMultiPlaceEvent(world, entityhuman, enumhand, blocks, blockposition.getX(), blockposition.getY(), blockposition.getZ());

View File

@ -32,14 +32,23 @@ index 0000000000000000000000000000000000000000..7ea357ac2f3a93db4ebdf24b5072be7d
+ }
+}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index ea442883eda28e5673cef9470145d5c40ac66159..79f7e0fb2f1aa6af441c6e09d2c443d7d4bb47ef 100644
index ea442883eda28e5673cef9470145d5c40ac66159..25ce1b9dbaa77e2c8541d995a2c28f894cee9d38 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -291,7 +291,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
private final StructureTemplateManager structureTemplateManager;
private final ServerTickRateManager tickRateManager;
protected WorldData worldData;
- private final PotionBrewing potionBrewing;
+ public PotionBrewing potionBrewing; // Paper - private -> public (remove final)
private volatile boolean isSaving;
// CraftBukkit start
@@ -2141,6 +2141,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.worldData.setDataConfiguration(worlddataconfiguration);
this.resources.managers.updateRegistryTags();
+ this.potionBrewing.reload(this.worldData.enabledFeatures()); // Paper - Custom Potion Mixes
+ this.potionBrewing = this.potionBrewing.reload(this.worldData.enabledFeatures()); // Paper - Custom Potion Mixes
this.getPlayerList().saveAll();
this.getPlayerList().reloadResources();
this.functionManager.replaceLibrary(this.resources.managers.getFunctionLibrary());
@ -57,7 +66,7 @@ index 8be4e04df480faaa3aac516012709e9ff852f8a5..5dceffcb6883db128ea41561ed8a8ba4
}
diff --git a/src/main/java/net/minecraft/world/item/alchemy/PotionBrewing.java b/src/main/java/net/minecraft/world/item/alchemy/PotionBrewing.java
index 50e81e3babd331077eda8daa769eb2b3f99e8ca2..45b1a0346c7b0a541b336e2a89f825bf58d993f8 100644
index 50e81e3babd331077eda8daa769eb2b3f99e8ca2..3469ddcf70a75e2bbfa7fcfc210f316038897bb5 100644
--- a/src/main/java/net/minecraft/world/item/alchemy/PotionBrewing.java
+++ b/src/main/java/net/minecraft/world/item/alchemy/PotionBrewing.java
@@ -19,6 +19,7 @@ public class PotionBrewing {
@ -103,7 +112,7 @@ index 50e81e3babd331077eda8daa769eb2b3f99e8ca2..45b1a0346c7b0a541b336e2a89f825bf
for (PotionBrewing.Mix<Item> mix : this.containerMixes) {
if (input.is(mix.from) && mix.ingredient.test(ingredient)) {
return PotionContents.createItemStack(mix.to.value(), optional.get());
@@ -190,6 +203,54 @@ public class PotionBrewing {
@@ -190,6 +203,50 @@ public class PotionBrewing {
builder.addMix(Potions.SLOW_FALLING, Items.REDSTONE, Potions.LONG_SLOW_FALLING);
}
@ -146,12 +155,8 @@ index 50e81e3babd331077eda8daa769eb2b3f99e8ca2..45b1a0346c7b0a541b336e2a89f825bf
+ return CUSTOM_MIXES.remove(key) != null;
+ }
+
+ public void reload(FeatureFlagSet flags) {
+ potionMixes.clear();
+ containerMixes.clear();
+ containers.clear();
+ CUSTOM_MIXES.clear();
+ bootstrap(flags);
+ public PotionBrewing reload(FeatureFlagSet flags) {
+ return bootstrap(flags);
+ }
+ // Paper end - Custom Potion Mixes
+
@ -220,7 +225,7 @@ index 139dff90561ac6c51954c6289918a07aeea13a1b..6ba29875d78ede4aa7978ff689e588f7
if (bukkit == null) {
diff --git a/src/main/java/org/bukkit/craftbukkit/potion/CraftPotionBrewer.java b/src/main/java/org/bukkit/craftbukkit/potion/CraftPotionBrewer.java
new file mode 100644
index 0000000000000000000000000000000000000000..5c08be880b81ce8627e7679942f273a948bed934
index 0000000000000000000000000000000000000000..bb47c776cf1d92ef85a5a10d1c42f120457d21c1
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/potion/CraftPotionBrewer.java
@@ -0,0 +1,66 @@
@ -286,7 +291,7 @@ index 0000000000000000000000000000000000000000..5c08be880b81ce8627e7679942f273a9
+
+ @Override
+ public void resetPotionMixes() {
+ this.minecraftServer.potionBrewing().reload(this.minecraftServer.getWorldData().enabledFeatures());
+ this.minecraftServer.potionBrewing = this.minecraftServer.potionBrewing().reload(this.minecraftServer.getWorldData().enabledFeatures());
+ }
+ // Paper end
+}

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Expand PlayerItemDamageEvent
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
index 8f4ca2479bf185cb2409d1da20dfc7de0f0ce550..179932c624912a39d6c4e53187ba9f9c23df42e5 100644
index db94bbbd7f93afef46586e6314ebc666b7e6087c..9d43c37e345689d5e4c6cfcb00ab2b4da01eef56 100644
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
@@ -662,10 +662,11 @@ public final class ItemStack implements DataComponentHolder {
@@ -661,10 +661,11 @@ public final class ItemStack implements DataComponentHolder {
}
}

View File

@ -17,7 +17,7 @@ index 3bd13975934e8f61b41c4c08b73ead6e0f45ffac..bcf4e77ed17fa35d509b33568793a382
if (this.isPassenger() && this.getVehicle().isRemoved()) {
this.stopRiding();
diff --git a/src/main/java/net/minecraft/world/entity/NeutralMob.java b/src/main/java/net/minecraft/world/entity/NeutralMob.java
index 7bb01b28b07bf2b31897cc5ab1f44fc0387958bb..a0d0a3330bb43807172fde1ee21644380517b40c 100644
index 7bb01b28b07bf2b31897cc5ab1f44fc0387958bb..1bc49da1c4cc12966ca414152b3ddf7f850c7d44 100644
--- a/src/main/java/net/minecraft/world/entity/NeutralMob.java
+++ b/src/main/java/net/minecraft/world/entity/NeutralMob.java
@@ -42,24 +42,11 @@ public interface NeutralMob {
@ -67,12 +67,12 @@ index 7bb01b28b07bf2b31897cc5ab1f44fc0387958bb..a0d0a3330bb43807172fde1ee2164438
+
+ if (entity != null) {
+ if (entity instanceof Mob mob) {
+ this.setTarget(mob);
+ this.setTarget(mob, org.bukkit.event.entity.EntityTargetEvent.TargetReason.TARGET_ATTACKED_ENTITY, true);
+ this.setLastHurtByMob(mob);
+ }
+
+ if (entity instanceof Player player) {
+ this.setTarget(player);
+ this.setTarget(player, org.bukkit.event.entity.EntityTargetEvent.TargetReason.TARGET_ATTACKED_ENTITY, true);
+ this.setLastHurtByPlayer(player);
+ }
+ }

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 79f7e0fb2f1aa6af441c6e09d2c443d7d4bb47ef..00457548d43e1d2143d1f6027593a1178f02564a 100644
index 25ce1b9dbaa77e2c8541d995a2c28f894cee9d38..928798903a70a641626dd74faf2c2e628db28d0f 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -314,6 +314,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 00457548d43e1d2143d1f6027593a1178f02564a..9416daa3edef2d9bb780fe3b2aa210d92a300cf1 100644
index 928798903a70a641626dd74faf2c2e628db28d0f..09979881d186ab43a0f738e273c3bbc2865e3997 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1235,6 +1235,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa

View File

@ -22,10 +22,10 @@ is actually processed, this is honestly really just exposed for the misnomers or
who just wanna ensure that this won't grow over a specific size if chat gets stupidly active
diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
index a8268886d4a039975b6fed94b8dc325a8270f5fd..0b283171294eca65a898ddd9ab1b7295ad183b0d 100644
index 4a34a49f12b106976ba19436f96f74ebb068249c..d12fd313730c44dcec3c73fcd8c99c0c84f46743 100644
--- a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
+++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
@@ -287,7 +287,18 @@ public class GlobalConfiguration extends ConfigurationPart {
@@ -285,7 +285,18 @@ public class GlobalConfiguration extends ConfigurationPart {
@PostProcess
private void postProcess() {

View File

@ -47,7 +47,7 @@ index fd2a5c829899d45641a5b5d30116f4f368953c15..f57679d88cd015caa8996d44b486da69
this.disconnect(Component.translatable("multiplayer.disconnect.server_shutdown"));
} catch (ClassCastException classcastexception) {
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 9416daa3edef2d9bb780fe3b2aa210d92a300cf1..f12165838f77ae83437f5770faeac1e46b326e98 100644
index 09979881d186ab43a0f738e273c3bbc2865e3997..434c354eaaa3d17fdfe8ff61d6802e3bff5704cf 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -2074,7 +2074,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa

View File

@ -22,10 +22,10 @@ index 7d76cdc59984b156628273c8357485eb10046007..7180996027f70aef7afe32fb2adfce64
itemstack.consume(1, entityhuman);
return InteractionResult.sidedSuccess(world.isClientSide);
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
index 179932c624912a39d6c4e53187ba9f9c23df42e5..144bcbcfc44d0c3467f30046889e225afc42e781 100644
index 9d43c37e345689d5e4c6cfcb00ab2b4da01eef56..be2a229903efe80d318e2b94911fa10ed8134690 100644
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
@@ -516,13 +516,7 @@ public final class ItemStack implements DataComponentHolder {
@@ -515,13 +515,7 @@ public final class ItemStack implements DataComponentHolder {
if (tileentity instanceof JukeboxBlockEntity) {
JukeboxBlockEntity tileentityjukebox = (JukeboxBlockEntity) tileentity;

View File

@ -5,10 +5,10 @@ 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 144bcbcfc44d0c3467f30046889e225afc42e781..a11bb28b2b85057418d80db33c2568218ef8db99 100644
index be2a229903efe80d318e2b94911fa10ed8134690..83976d1b9e6f9fe696f58526cbab9b0f607f3bdc 100644
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
@@ -567,7 +567,11 @@ public final class ItemStack implements DataComponentHolder {
@@ -566,7 +566,11 @@ public final class ItemStack implements DataComponentHolder {
// SPIGOT-1288 - play sound stripped from ItemBlock
if (this.item instanceof BlockItem) {

View File

@ -5,10 +5,10 @@ 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 a11bb28b2b85057418d80db33c2568218ef8db99..b00cf6f02bf1e85dbbbbb5b5c1201c643385576f 100644
index 83976d1b9e6f9fe696f58526cbab9b0f607f3bdc..05b4762c9a8ceb2faf21efe534ba609b6e76a968 100644
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
@@ -546,7 +546,7 @@ public final class ItemStack implements DataComponentHolder {
@@ -545,7 +545,7 @@ public final class ItemStack implements DataComponentHolder {
try {
if (world.getBlockEntity(SignItem.openSign) instanceof SignBlockEntity tileentitysign) {
if (world.getBlockState(SignItem.openSign).getBlock() instanceof SignBlock blocksign) {

View File

@ -1148,7 +1148,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 f12165838f77ae83437f5770faeac1e46b326e98..1d8c63a5a0b05340396a9f7ba079eb7fceda03e2 100644
index 434c354eaaa3d17fdfe8ff61d6802e3bff5704cf..3c3383b00dc76c6d0ffd9b2a6a8cf97ec00f91be 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1554,6 +1554,20 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa

View File

@ -17,10 +17,10 @@ index 5bbadc890a72f1cb22c6881ebcc163b0c06a367a..4fa838bf97ede6e1c893ba64f53aa7af
}
}
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
index b00cf6f02bf1e85dbbbbb5b5c1201c643385576f..fb85a7da9da8063c2b781377f62e7db34c467859 100644
index 05b4762c9a8ceb2faf21efe534ba609b6e76a968..6f5e5c5b4af7e16f4a7c5429208fc85014f9e302 100644
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
@@ -446,6 +446,7 @@ public final class ItemStack implements DataComponentHolder {
@@ -445,6 +445,7 @@ public final class ItemStack implements DataComponentHolder {
for (CraftBlockState blockstate : blocks) {
// SPIGOT-7572 - Move fix for SPIGOT-7248 to CapturedBlockState, to allow bees in bee nest
CapturedBlockState.setBlockState(blockstate);

View File

@ -9,19 +9,25 @@ upstream. Until then, this test and these fixes
should address all the known issues with them
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftEffect.java b/src/main/java/org/bukkit/craftbukkit/CraftEffect.java
index 71733f918ed84b9879ac1b142ef6205c5e768a9c..7ee13c0a0cd12979c7f8cc2e403baf9300fd61c8 100644
index 71733f918ed84b9879ac1b142ef6205c5e768a9c..c856384019eff2f2d0bb831ebe1ccb0fb9210782 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftEffect.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftEffect.java
@@ -15,6 +15,8 @@ public class CraftEffect {
@@ -15,6 +15,14 @@ public class CraftEffect {
public static <T> int getDataValue(Effect effect, T data) {
int datavalue;
switch (effect) {
+ case PARTICLES_SCULK_CHARGE: // Paper - add missing effects
+ case TRIAL_SPAWNER_DETECT_PLAYER: // Paper - add missing effects
+ // Paper start - add missing effects
+ case PARTICLES_SCULK_CHARGE:
+ case TRIAL_SPAWNER_DETECT_PLAYER:
+ case BEE_GROWTH:
+ case TURTLE_EGG_PLACEMENT:
+ case SMASH_ATTACK:
+ case TRIAL_SPAWNER_DETECT_PLAYER_OMINOUS:
+ // Paper end - add missing effects
case VILLAGER_PLANT_GROW:
datavalue = (Integer) data;
break;
@@ -26,6 +28,13 @@ public class CraftEffect {
@@ -26,6 +34,13 @@ public class CraftEffect {
Preconditions.checkArgument(data == Material.AIR || ((Material) data).isRecord(), "Invalid record type for Material %s!", data);
datavalue = Item.getId(CraftItemType.bukkitToMinecraft((Material) data));
break;
@ -35,7 +41,7 @@ index 71733f918ed84b9879ac1b142ef6205c5e768a9c..7ee13c0a0cd12979c7f8cc2e403baf93
case SMOKE:
switch ((BlockFace) data) {
case DOWN:
@@ -57,8 +66,15 @@ public class CraftEffect {
@@ -57,10 +72,25 @@ public class CraftEffect {
}
break;
case STEP_SOUND:
@ -50,7 +56,17 @@ index 71733f918ed84b9879ac1b142ef6205c5e768a9c..7ee13c0a0cd12979c7f8cc2e403baf93
+ // Paper end
break;
case COMPOSTER_FILL_ATTEMPT:
+ // Paper start - add missing effects
+ case TRIAL_SPAWNER_SPAWN:
+ case TRIAL_SPAWNER_SPAWN_MOB_AT:
+ case VAULT_ACTIVATE:
+ case VAULT_DEACTIVATE:
+ case TRIAL_SPAWNER_BECOME_OMINOUS:
+ case TRIAL_SPAWNER_SPAWN_ITEM:
+ // Paper end - add missing effects
datavalue = ((Boolean) data) ? 1 : 0;
break;
case BONE_MEAL_USE:
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 0c5c67480e16333641f4ebc89d892f7a0e2387fd..18c1cceb9e8b2873b24134a9e012633616634aae 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@ -79,24 +95,28 @@ index 1c264135c34117407bfbb2d230e2ea1f9ebd0671..463b24fd34f76632b590ad659676ba49
Preconditions.checkArgument(effect.getData() == null || effect == Effect.ELECTRIC_SPARK, "Wrong kind of data for the %s effect", effect);
diff --git a/src/test/java/org/bukkit/EffectTest.java b/src/test/java/org/bukkit/EffectTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..875eacc2e5776901ba8593d0183844db2571f71b
index 0000000000000000000000000000000000000000..eaccc9a154ff2f498d765a2932b6f3edb449f4f7
--- /dev/null
+++ b/src/test/java/org/bukkit/EffectTest.java
@@ -0,0 +1,64 @@
@@ -0,0 +1,79 @@
+package org.bukkit;
+
+import com.google.common.base.Joiner;
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import net.minecraft.world.level.block.LevelEvent;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
+
+public class EffectTest {
+
@ -125,12 +145,17 @@ index 0000000000000000000000000000000000000000..875eacc2e5776901ba8593d0183844db
+ }
+ }
+
+ final Set<Integer> missingEvents = new HashSet<>();
+ for (final Integer event : collectNmsLevelEvents()) {
+ assertNotNull(toId.get(event), "missing API Effect: " + event);
+ if (toId.get(event) == null) {
+ missingEvents.add(event);
+ }
+ }
+ if (!missingEvents.isEmpty()) {
+ fail("Missing API Effects:\n" + Joiner.on("\n").join(missingEvents));
+ }
+ }
+
+ @SuppressWarnings("deprecation")
+ @Test
+ public void checkNoExtraApi() throws ReflectiveOperationException {
+ Map<Integer, Effect> toId = new HashMap<>();
@ -142,8 +167,14 @@ index 0000000000000000000000000000000000000000..875eacc2e5776901ba8593d0183844db
+ }
+
+ final List<Integer> nmsEvents = collectNmsLevelEvents();
+ final Set<Effect> extraApiEffects = new HashSet<>();
+ for (final Map.Entry<Integer, Effect> entry : toId.entrySet()) {
+ assertTrue(nmsEvents.contains(entry.getKey()), "Extra API Effect: " + entry.getValue());
+ if (!nmsEvents.contains(entry.getKey())) {
+ extraApiEffects.add(entry.getValue());
+ }
+ }
+ if (!extraApiEffects.isEmpty()) {
+ fail("Extra API Effects:\n" + Joiner.on("\n").join(extraApiEffects));
+ }
+ }
+}

View File

@ -1,58 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Shane Freeder <theboyetronic@gmail.com>
Date: Sat, 4 Nov 2023 18:39:18 -0400
Subject: [PATCH] Add MaterialTagsTest
diff --git a/src/test/java/io/papermc/paper/inventory/item/MaterialTagsTest.java b/src/test/java/io/papermc/paper/inventory/item/MaterialTagsTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..3f2734eae2053b4b8fccd7149178699e36ce8b78
--- /dev/null
+++ b/src/test/java/io/papermc/paper/inventory/item/MaterialTagsTest.java
@@ -0,0 +1,46 @@
+package io.papermc.paper.inventory.item;
+
+import com.destroystokyo.paper.MaterialTags;
+import it.unimi.dsi.fastutil.objects.ObjectArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+import net.minecraft.core.registries.BuiltInRegistries;
+import net.minecraft.world.item.Item;
+import net.minecraft.world.item.enchantment.EnchantmentCategory;
+import org.bukkit.craftbukkit.util.CraftMagicNumbers;
+import org.bukkit.support.AbstractTestingBase;
+import org.jetbrains.annotations.NotNull;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
+
+public class MaterialTagsTest extends AbstractTestingBase {
+
+ private final static EnchantmentCategory[] ENCHANTMENT_CATEGORIES = EnchantmentCategory.values();
+
+ @ParameterizedTest
+ @MethodSource("items")
+ public void testEnchantables(@NotNull final Item item) {
+ final List<EnchantmentCategory> enchantableCategories = new ObjectArrayList<>();
+ for (final EnchantmentCategory enchantmentCategory : ENCHANTMENT_CATEGORIES) {
+ if (enchantmentCategory.canEnchant(item)) enchantableCategories.add(enchantmentCategory);
+ }
+
+ final boolean taggedAsEnchantable = MaterialTags.ENCHANTABLE.isTagged(CraftMagicNumbers.getMaterial(item));
+ final boolean requiresTagByInternals = !enchantableCategories.isEmpty();
+ Assertions.assertEquals(
+ requiresTagByInternals,
+ taggedAsEnchantable,
+ () -> "%s matches enchantment categories [%s] but was tagged by material tags as enchantable: %s".formatted(
+ item.getDescriptionId(),
+ enchantableCategories.stream().map(Enum::name).collect(Collectors.joining(", ")),
+ taggedAsEnchantable
+ )
+ );
+ }
+
+ private static Stream<Item> items() {
+ return BuiltInRegistries.ITEM.stream();
+ }
+}

View File

@ -149,10 +149,10 @@ index 6d494b80ae002aea00afa44adf83dad1ae5bbbc1..49557d6f22c5725c663a231deab019d4
return false;
}
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
index fb85a7da9da8063c2b781377f62e7db34c467859..2d2b436cae5693051df14e5777d385d38d5f4dd6 100644
index 6f5e5c5b4af7e16f4a7c5429208fc85014f9e302..fef96852bd95ad24d1e0daff17c3e117524efc69 100644
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
@@ -480,10 +480,12 @@ public final class ItemStack implements DataComponentHolder {
@@ -479,10 +479,12 @@ public final class ItemStack implements DataComponentHolder {
world.preventPoiUpdated = false;
// Brute force all possible updates

View File

@ -232,6 +232,44 @@ index 2de1a2f666da9db1832907e1651dbff948e37252..5c2ed3c39c8eb850f3be1e2ea5b5a7ea
}
}
diff --git a/src/main/java/net/minecraft/world/entity/monster/Bogged.java b/src/main/java/net/minecraft/world/entity/monster/Bogged.java
index 9c0bfddd479eef688d2509ad700371c3c860ff1a..754eb747179d9318bc5a3883e5622cc400c4e06c 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Bogged.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Bogged.java
@@ -135,6 +135,11 @@ public class Bogged extends AbstractSkeleton implements Shearable {
}
private void spawnShearedMushrooms() {
+ // Paper start - shear drops API
+ this.generateShearedMushrooms(this::spawnAtLocation);
+ }
+ private void generateShearedMushrooms(java.util.function.Consumer<ItemStack> stackConsumer) {
+ // Paper end - shear drops API
if (this.level() instanceof ServerLevel serverLevel && serverLevel.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) {
LootTable lootTable = serverLevel.getServer().reloadableRegistries().getLootTable(BuiltInLootTables.BOGGED_SHEAR);
LootParams lootParams = new LootParams.Builder(serverLevel)
@@ -143,11 +148,20 @@ public class Bogged extends AbstractSkeleton implements Shearable {
.create(LootContextParamSets.SHEARING);
for (ItemStack itemStack : lootTable.getRandomItems(lootParams)) {
- this.spawnAtLocation(itemStack);
+ stackConsumer.accept(itemStack); // Paper
}
}
}
+ // Paper start - shear drops API
+ @Override
+ public java.util.List<ItemStack> generateDefaultDrops() {
+ final java.util.List<ItemStack> drops = new java.util.ArrayList<>();
+ this.generateShearedMushrooms(drops::add);
+ return drops;
+ }
+ // Paper end - shear drops API
+
@Override
public boolean readyForShearing() {
return !this.isSheared() && this.isAlive();
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index 822bfebc779646dde655239ac217bad011a9eee4..444287fea080182df533198f5c659533de86c5dc 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java

View File

@ -17,7 +17,7 @@ index c01b4393439838976965823298f12e4762e72eff..218bf89fd7583d6db9f64754c4db8fcc
node = loader.load();
this.verifyGlobalConfigVersion(node);
diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
index 0b283171294eca65a898ddd9ab1b7295ad183b0d..481cfe3a291196c0391c2ec8560e566e0e1e2fb8 100644
index d12fd313730c44dcec3c73fcd8c99c0c84f46743..5f59e733c00de9c0f5692b3b3c092a050a9f409f 100644
--- a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
+++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
@@ -25,6 +25,7 @@ public class GlobalConfiguration extends ConfigurationPart {
@ -29,7 +29,7 @@ index 0b283171294eca65a898ddd9ab1b7295ad183b0d..481cfe3a291196c0391c2ec8560e566e
return instance;
}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 1d8c63a5a0b05340396a9f7ba079eb7fceda03e2..325ba58a1c79fd928ac22d8f1ef93605357300d2 100644
index 3c3383b00dc76c6d0ffd9b2a6a8cf97ec00f91be..881679270a344f1a4d70c3c47871a495af202109 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1132,6 +1132,16 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa

View File

@ -91,7 +91,7 @@ index 9cc81bcccbf1141f66fedada1359b7c0dfa8e22a..5c5b64bd058684520fa175bfd10622ff
public String toString() {
return "CraftMushroomCow";
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSuspiciousStew.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSuspiciousStew.java
index 8fc3cd507d333d2bdea759d7c102a56e88ad5f5a..4825edab85c7969e96018eb9ff47ef0fb3703c69 100644
index 8fc3cd507d333d2bdea759d7c102a56e88ad5f5a..14e944b4e83b80e0fc6d81e346cc305ab00561c5 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSuspiciousStew.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSuspiciousStew.java
@@ -22,7 +22,7 @@ public class CraftMetaSuspiciousStew extends CraftMetaItem implements Suspicious
@ -132,7 +132,7 @@ index 8fc3cd507d333d2bdea759d7c102a56e88ad5f5a..4825edab85c7969e96018eb9ff47ef0f
}
return ImmutableList.of();
}
@@ -120,27 +120,46 @@ public class CraftMetaSuspiciousStew extends CraftMetaItem implements Suspicious
@@ -120,27 +120,47 @@ public class CraftMetaSuspiciousStew extends CraftMetaItem implements Suspicious
@Override
public boolean addCustomEffect(PotionEffect effect, boolean overwrite) {
Preconditions.checkArgument(effect != null, "Potion effect cannot be null");
@ -141,52 +141,61 @@ index 8fc3cd507d333d2bdea759d7c102a56e88ad5f5a..4825edab85c7969e96018eb9ff47ef0f
- int index = this.indexOfEffect(effect.getType());
- if (index != -1) {
- if (overwrite) {
- PotionEffect old = this.customEffects.get(index);
- if (old.getDuration() == effect.getDuration()) {
+ // Paper start - add overloads to use suspicious effect entry to mushroom cow and suspicious stew meta
+ @Override
+ public boolean addCustomEffect(final io.papermc.paper.potion.SuspiciousEffectEntry suspiciousEffectEntry, final boolean overwrite) {
+ Preconditions.checkArgument(suspiciousEffectEntry != null, "Suspicious effect entry cannot be null");
+ final List<io.papermc.paper.potion.SuspiciousEffectEntry> matchingEffects = this.customEffects.stream().filter(
+ entry -> entry.effect() == suspiciousEffectEntry.effect()
+ ).toList();
+ if (!matchingEffects.isEmpty()) {
if (overwrite) {
- PotionEffect old = this.customEffects.get(index);
- if (old.getDuration() == effect.getDuration()) {
+ boolean foundMatchingDuration = false;
+ boolean mutated = false;
+ for (final io.papermc.paper.potion.SuspiciousEffectEntry matchingEffect : matchingEffects) {
+ if (matchingEffect.duration() != suspiciousEffectEntry.duration()) {
+ this.customEffects.remove(suspiciousEffectEntry);
+ mutated = true;
+ } else {
+ foundMatchingDuration = true;
+ if (this.hasCustomEffects()) {
+ final List<io.papermc.paper.potion.SuspiciousEffectEntry> matchingEffects = this.customEffects.stream().filter(
+ entry -> entry.effect() == suspiciousEffectEntry.effect()
+ ).toList();
+ if (!matchingEffects.isEmpty()) {
+ if (overwrite) {
+ boolean foundMatchingDuration = false;
+ boolean mutated = false;
+ for (final io.papermc.paper.potion.SuspiciousEffectEntry matchingEffect : matchingEffects) {
+ if (matchingEffect.duration() != suspiciousEffectEntry.duration()) {
+ this.customEffects.remove(suspiciousEffectEntry);
+ mutated = true;
+ } else {
+ foundMatchingDuration = true;
+ }
+ }
+ }
+ if (foundMatchingDuration && !mutated) {
+ if (foundMatchingDuration && !mutated) {
+ return false;
+ } else if (!foundMatchingDuration) {
+ this.customEffects.add(suspiciousEffectEntry);
+ }
+ return true;
+ } else {
return false;
+ } else if (!foundMatchingDuration) {
+ this.customEffects.add(suspiciousEffectEntry);
}
- this.customEffects.set(index, effect);
return true;
- return true;
- } else {
+ } else {
return false;
}
} else {
if (this.customEffects == null) {
this.customEffects = new ArrayList<>();
- return false;
}
- } else {
- if (this.customEffects == null) {
- this.customEffects = new ArrayList<>();
- }
- this.customEffects.add(effect);
+ this.customEffects.add(suspiciousEffectEntry);
return true;
- return true;
}
+ if (this.customEffects == null) {
+ this.customEffects = new ArrayList<>();
+ }
+ this.customEffects.add(suspiciousEffectEntry);
+ return true;
}
+ // Paper end - add overloads to use suspicious effect entry to mushroom cow and suspicious stew meta
@Override
public boolean removeCustomEffect(PotionEffectType type) {
@@ -151,10 +170,12 @@ public class CraftMetaSuspiciousStew extends CraftMetaItem implements Suspicious
@@ -151,10 +171,12 @@ public class CraftMetaSuspiciousStew extends CraftMetaItem implements Suspicious
}
boolean changed = false;
@ -202,7 +211,7 @@ index 8fc3cd507d333d2bdea759d7c102a56e88ad5f5a..4825edab85c7969e96018eb9ff47ef0f
iterator.remove();
changed = true;
}
@@ -177,7 +198,7 @@ public class CraftMetaSuspiciousStew extends CraftMetaItem implements Suspicious
@@ -177,7 +199,7 @@ public class CraftMetaSuspiciousStew extends CraftMetaItem implements Suspicious
}
for (int i = 0; i < this.customEffects.size(); i++) {
@ -211,7 +220,7 @@ index 8fc3cd507d333d2bdea759d7c102a56e88ad5f5a..4825edab85c7969e96018eb9ff47ef0f
return i;
}
}
@@ -222,7 +243,7 @@ public class CraftMetaSuspiciousStew extends CraftMetaItem implements Suspicious
@@ -222,7 +244,7 @@ public class CraftMetaSuspiciousStew extends CraftMetaItem implements Suspicious
super.serialize(builder);
if (this.hasCustomEffects()) {

View File

@ -14605,7 +14605,7 @@ index 0000000000000000000000000000000000000000..962d3cae6340fc11607b59355e291629
+
+}
diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
index 481cfe3a291196c0391c2ec8560e566e0e1e2fb8..30fe1c0645a07d663b08c0f988a1ab3a750bf7c4 100644
index 5f59e733c00de9c0f5692b3b3c092a050a9f409f..b8a89bf8a7a0ef25f00ccc0e84ca64f4524fdc3e 100644
--- a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
+++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
@@ -29,6 +29,45 @@ public class GlobalConfiguration extends ConfigurationPart {
@ -14676,7 +14676,7 @@ index 481cfe3a291196c0391c2ec8560e566e0e1e2fb8..30fe1c0645a07d663b08c0f988a1ab3a
public UnsupportedSettings unsupportedSettings;
public class UnsupportedSettings extends ConfigurationPart {
@@ -203,7 +227,7 @@ public class GlobalConfiguration extends ConfigurationPart {
@@ -201,7 +225,7 @@ public class GlobalConfiguration extends ConfigurationPart {
@PostProcess
private void postProcess() {
@ -15684,7 +15684,7 @@ index c33f85b570f159ab465b5a10a8044a81f2797f43..244a19ecd0234fa1d7a6ecfea2075159
DedicatedServer dedicatedserver1 = new DedicatedServer(optionset, worldLoader.get(), thread, convertable_conversionsession, resourcepackrepository, worldstem, dedicatedserversettings, DataFixers.getDataFixer(), services, LoggerChunkProgressListener::createFromGameruleRadius);
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 325ba58a1c79fd928ac22d8f1ef93605357300d2..498fc4ab46eac994f2a65c79eebddca2813f0b65 100644
index 881679270a344f1a4d70c3c47871a495af202109..40708dfd84dc21bc5e047d9fb3b092cb854a8041 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -318,7 +318,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa

View File

@ -5,7 +5,7 @@ Subject: [PATCH] incremental chunk and player saving
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 498fc4ab46eac994f2a65c79eebddca2813f0b65..4bb0cf4d4eb0b648062c40a8347298002256d39e 100644
index 40708dfd84dc21bc5e047d9fb3b092cb854a8041..7f3359745089584448b8f32f0570cf86b73076c7 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -916,7 +916,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa

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