From 0524364f570345285e0fc7de361cf3b94e49ef7d Mon Sep 17 00:00:00 2001 From: Lixfel Date: Sat, 26 Dec 2020 23:49:53 +0100 Subject: [PATCH] Removing dataFixer initialisation --- .../Disable_legacy_data_conversation.patch | 82 +++++++++++++++++++ .../Dont_write_unwritable_json_files.patch | 18 ++++ 2 files changed, 100 insertions(+) create mode 100644 SteamWar-Patches/Disable_legacy_data_conversation.patch create mode 100644 SteamWar-Patches/Dont_write_unwritable_json_files.patch diff --git a/SteamWar-Patches/Disable_legacy_data_conversation.patch b/SteamWar-Patches/Disable_legacy_data_conversation.patch new file mode 100644 index 0000000..2e03805 --- /dev/null +++ b/SteamWar-Patches/Disable_legacy_data_conversation.patch @@ -0,0 +1,82 @@ +Index: src/main/java/net/minecraft/server/DataConverterRegistry.java +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/src/main/java/net/minecraft/server/DataConverterRegistry.java b/src/main/java/net/minecraft/server/DataConverterRegistry.java +--- a/src/main/java/net/minecraft/server/DataConverterRegistry.java (revision ec1b4311cebfd9bc35a5f84f56df46cf7319649a) ++++ b/src/main/java/net/minecraft/server/DataConverterRegistry.java (date 1609015897972) +@@ -1,26 +1,63 @@ + package net.minecraft.server; + + import com.google.common.collect.ImmutableMap; +-import com.mojang.datafixers.DSL; +-import com.mojang.datafixers.DataFixer; +-import com.mojang.datafixers.DataFixerBuilder; +-import com.mojang.datafixers.Typed; ++import com.google.common.collect.Maps; ++import com.mojang.datafixers.*; + import com.mojang.datafixers.schemas.Schema; ++import com.mojang.datafixers.types.DynamicOps; ++import com.mojang.datafixers.types.Type; ++import com.mojang.datafixers.types.templates.TypeTemplate; ++import com.mojang.datafixers.util.Pair; ++ ++import java.util.Map; + import java.util.Objects; ++import java.util.Optional; + import java.util.function.BiFunction; ++import java.util.function.Supplier; + + public class DataConverterRegistry { + + private static final BiFunction a = Schema::new; + private static final BiFunction b = DataConverterSchemaNamed::new; +- private static final DataFixer c = b(); ++ private static final DataFixer c = new DataFixer() { ++ @Override ++ public Dynamic update(DSL.TypeReference typeReference, Dynamic dynamic, int i, int i1) { ++ return dynamic; ++ } ++ ++ @Override ++ public Schema getSchema(int i) { ++ return new Schema(i, null){ ++ @Override ++ public void registerTypes(Schema schema, Map> entityTypes, Map> blockEntityTypes) {} ++ ++ @Override ++ public Map> registerEntities(Schema schema) { ++ return Maps.newHashMap(); ++ } ++ ++ @Override ++ public Map> registerBlockEntities(Schema schema) { ++ return Maps.newHashMap(); ++ } + +- private static DataFixer b() { +- DataFixerBuilder datafixerbuilder = new DataFixerBuilder(SharedConstants.getGameVersion().getWorldVersion()); ++ @Override ++ protected Map> buildTypes() { ++ return Maps.newHashMap(); ++ } + +- a(datafixerbuilder); +- return datafixerbuilder.build(SystemUtils.e()); +- } ++ @Override ++ public Type getType(DSL.TypeReference type) { ++ return null; ++ } ++ ++ @Override ++ public Type getChoiceType(DSL.TypeReference type, String choiceName) { ++ return null; ++ } ++ }; ++ } ++ }; + + public static DataFixer a() { + return DataConverterRegistry.c; diff --git a/SteamWar-Patches/Dont_write_unwritable_json_files.patch b/SteamWar-Patches/Dont_write_unwritable_json_files.patch new file mode 100644 index 0000000..a2c8436 --- /dev/null +++ b/SteamWar-Patches/Dont_write_unwritable_json_files.patch @@ -0,0 +1,18 @@ +Index: src/main/java/net/minecraft/server/JsonList.java +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/src/main/java/net/minecraft/server/JsonList.java b/src/main/java/net/minecraft/server/JsonList.java +--- a/src/main/java/net/minecraft/server/JsonList.java (revision ec1b4311cebfd9bc35a5f84f56df46cf7319649a) ++++ b/src/main/java/net/minecraft/server/JsonList.java (date 1609013366119) +@@ -156,6 +156,9 @@ + } + + public void save() throws IOException { ++ if(!this.c.canWrite()) ++ return; ++ + Collection collection = this.d.values(); + String s = this.b.toJson(collection); + BufferedWriter bufferedwriter = null;