fix chat_type issue

This commit is contained in:
Jake Potrebic 2024-04-26 08:33:00 -07:00
parent 00dac83d67
commit f6fae41cdf
No known key found for this signature in database
GPG Key ID: ECE0B3C133C016C5
15 changed files with 91 additions and 28 deletions

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

@ -5638,11 +5638,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

@ -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

@ -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

@ -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

@ -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

@ -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

@ -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

View File

@ -71,7 +71,7 @@ index bcb6a3b3cd17ce5db9aaf6bd3ec7a0ec1b44b979..4f3cc14d48690bb183d09bb7a5ba1e23
cause = cause.getCause();
}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 4bb0cf4d4eb0b648062c40a8347298002256d39e..affc74c4650ce03aeb723619b63035d539958a8e 100644
index 7f3359745089584448b8f32f0570cf86b73076c7..101c465397176d873f7a7871c84c8fb5a9897b0b 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -303,7 +303,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@ -219,7 +219,7 @@ index 4bb0cf4d4eb0b648062c40a8347298002256d39e..affc74c4650ce03aeb723619b63035d5
@@ -2178,7 +2234,15 @@ 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();
+ // Paper start
+ if (Thread.currentThread() != this.serverThread) {

View File

@ -19,7 +19,7 @@ index 6b3cde6d4d1e63bec01f502f2027ee9fddac08aa..46449728f69ee7d4f78470f8da23c055
private MinecraftTimings() {}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index affc74c4650ce03aeb723619b63035d539958a8e..88549de2768149885c4eabbaaa71a38341453aed 100644
index 101c465397176d873f7a7871c84c8fb5a9897b0b..81d0a0c79958a137ac8bc703eb97f30cd10864e3 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1414,8 +1414,79 @@ 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 88549de2768149885c4eabbaaa71a38341453aed..1adcbfb16ea1fe3378cde7c53e8868840eade963 100644
index 81d0a0c79958a137ac8bc703eb97f30cd10864e3..b12f69931e5b247c42bb4e56bcf1ef24deddfe2e 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1756,6 +1756,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa

View File

@ -8,7 +8,7 @@ Areas affected by lag comepnsation:
- Eating food items
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 1adcbfb16ea1fe3378cde7c53e8868840eade963..5f3b35f0dbd9e78ad18ef5cf7be1a807beffeaf1 100644
index b12f69931e5b247c42bb4e56bcf1ef24deddfe2e..40551f2bb4e5511d1feefe87244905f1ee84b511 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -318,6 +318,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa

View File

@ -280,7 +280,7 @@ index 244a19ecd0234fa1d7a6ecfea20751595688605d..5443013060b62e3bfcc51cddca96d1c0
Main.LOGGER.info("Forcing world upgrade! {}", session.getLevelId()); // CraftBukkit
WorldUpgrader worldupgrader = new WorldUpgrader(session, dataFixer, dynamicRegistryManager, eraseCache, recreateRegionFiles);
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 5f3b35f0dbd9e78ad18ef5cf7be1a807beffeaf1..b2d558d21ec22577c31543b79527bde3daa1b871 100644
index 40551f2bb4e5511d1feefe87244905f1ee84b511..1c19ee8106e7a08ab1043376ffe6d8e40d3d8f76 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -599,11 +599,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa