aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-vineflower/net/minecraft/server/Bootstrap.java.patch
blob: f9bb5c82b893422c5baf97988bbd5836c7b28441 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
--- a/net/minecraft/server/Bootstrap.java
+++ b/net/minecraft/server/Bootstrap.java
@@ -16,7 +16,9 @@
 import net.minecraft.core.dispenser.DispenseItemBehavior;
 import net.minecraft.core.registries.BuiltInRegistries;
 import net.minecraft.locale.Language;
-import net.minecraft.resources.ResourceLocation;
+import net.minecraft.util.datafix.fixes.BlockStateData;
+import net.minecraft.util.datafix.fixes.ItemIdFix;
+import net.minecraft.util.datafix.fixes.ItemSpawnEggFix;
 import net.minecraft.world.effect.MobEffect;
 import net.minecraft.world.entity.EntityType;
 import net.minecraft.world.entity.ai.attributes.Attribute;
@@ -32,15 +34,36 @@
 import org.slf4j.Logger;
 
 public class Bootstrap {
+
     public static final PrintStream STDOUT = System.out;
     private static volatile boolean isBootstrapped;
     private static final Logger LOGGER = LogUtils.getLogger();
     public static final AtomicLong bootstrapDuration = new AtomicLong(-1L);
 
+    public Bootstrap() {}
+
     public static void bootStrap() {
-        if (!isBootstrapped) {
-            isBootstrapped = true;
+        if (!Bootstrap.isBootstrapped) {
+            // CraftBukkit start
+            String name = Bootstrap.class.getSimpleName();
+            switch (name) {
+                case "DispenserRegistry":
+                    break;
+                case "Bootstrap":
+                    System.err.println("***************************************************************************");
+                    System.err.println("*** WARNING: This server jar may only be used for development purposes. ***");
+                    System.err.println("***************************************************************************");
+                    break;
+                default:
+                    System.err.println("**********************************************************************");
+                    System.err.println("*** WARNING: This server jar is unsupported, use at your own risk. ***");
+                    System.err.println("**********************************************************************");
+                    break;
+            }
+            // CraftBukkit end
+            Bootstrap.isBootstrapped = true;
             Instant instant = Instant.now();
+
             if (BuiltInRegistries.REGISTRY.keySet().isEmpty()) {
                 throw new IllegalStateException("Unable to load registries");
             } else {
@@ -56,68 +79,147 @@
                     BuiltInRegistries.bootStrap();
                     CreativeModeTabs.validate();
                     wrapStreams();
-                    bootstrapDuration.set(Duration.between(instant, Instant.now()).toMillis());
+                    Bootstrap.bootstrapDuration.set(Duration.between(instant, Instant.now()).toMillis());
                 }
+                // CraftBukkit start - easier than fixing the decompile
+                BlockStateData.register(1008, "{Name:'minecraft:oak_sign',Properties:{rotation:'0'}}", "{Name:'minecraft:standing_sign',Properties:{rotation:'0'}}");
+                BlockStateData.register(1009, "{Name:'minecraft:oak_sign',Properties:{rotation:'1'}}", "{Name:'minecraft:standing_sign',Properties:{rotation:'1'}}");
+                BlockStateData.register(1010, "{Name:'minecraft:oak_sign',Properties:{rotation:'2'}}", "{Name:'minecraft:standing_sign',Properties:{rotation:'2'}}");
+                BlockStateData.register(1011, "{Name:'minecraft:oak_sign',Properties:{rotation:'3'}}", "{Name:'minecraft:standing_sign',Properties:{rotation:'3'}}");
+                BlockStateData.register(1012, "{Name:'minecraft:oak_sign',Properties:{rotation:'4'}}", "{Name:'minecraft:standing_sign',Properties:{rotation:'4'}}");
+                BlockStateData.register(1013, "{Name:'minecraft:oak_sign',Properties:{rotation:'5'}}", "{Name:'minecraft:standing_sign',Properties:{rotation:'5'}}");
+                BlockStateData.register(1014, "{Name:'minecraft:oak_sign',Properties:{rotation:'6'}}", "{Name:'minecraft:standing_sign',Properties:{rotation:'6'}}");
+                BlockStateData.register(1015, "{Name:'minecraft:oak_sign',Properties:{rotation:'7'}}", "{Name:'minecraft:standing_sign',Properties:{rotation:'7'}}");
+                BlockStateData.register(1016, "{Name:'minecraft:oak_sign',Properties:{rotation:'8'}}", "{Name:'minecraft:standing_sign',Properties:{rotation:'8'}}");
+                BlockStateData.register(1017, "{Name:'minecraft:oak_sign',Properties:{rotation:'9'}}", "{Name:'minecraft:standing_sign',Properties:{rotation:'9'}}");
+                BlockStateData.register(1018, "{Name:'minecraft:oak_sign',Properties:{rotation:'10'}}", "{Name:'minecraft:standing_sign',Properties:{rotation:'10'}}");
+                BlockStateData.register(1019, "{Name:'minecraft:oak_sign',Properties:{rotation:'11'}}", "{Name:'minecraft:standing_sign',Properties:{rotation:'11'}}");
+                BlockStateData.register(1020, "{Name:'minecraft:oak_sign',Properties:{rotation:'12'}}", "{Name:'minecraft:standing_sign',Properties:{rotation:'12'}}");
+                BlockStateData.register(1021, "{Name:'minecraft:oak_sign',Properties:{rotation:'13'}}", "{Name:'minecraft:standing_sign',Properties:{rotation:'13'}}");
+                BlockStateData.register(1022, "{Name:'minecraft:oak_sign',Properties:{rotation:'14'}}", "{Name:'minecraft:standing_sign',Properties:{rotation:'14'}}");
+                BlockStateData.register(1023, "{Name:'minecraft:oak_sign',Properties:{rotation:'15'}}", "{Name:'minecraft:standing_sign',Properties:{rotation:'15'}}");
+                ItemIdFix.ITEM_NAMES.put(323, "minecraft:oak_sign");
+
+                BlockStateData.register(1440, "{Name:\'minecraft:portal\',Properties:{axis:\'x\'}}", new String[]{"{Name:\'minecraft:portal\',Properties:{axis:\'x\'}}"});
+
+                ItemIdFix.ITEM_NAMES.put(409, "minecraft:prismarine_shard");
+                ItemIdFix.ITEM_NAMES.put(410, "minecraft:prismarine_crystals");
+                ItemIdFix.ITEM_NAMES.put(411, "minecraft:rabbit");
+                ItemIdFix.ITEM_NAMES.put(412, "minecraft:cooked_rabbit");
+                ItemIdFix.ITEM_NAMES.put(413, "minecraft:rabbit_stew");
+                ItemIdFix.ITEM_NAMES.put(414, "minecraft:rabbit_foot");
+                ItemIdFix.ITEM_NAMES.put(415, "minecraft:rabbit_hide");
+                ItemIdFix.ITEM_NAMES.put(416, "minecraft:armor_stand");
+
+                ItemIdFix.ITEM_NAMES.put(423, "minecraft:mutton");
+                ItemIdFix.ITEM_NAMES.put(424, "minecraft:cooked_mutton");
+                ItemIdFix.ITEM_NAMES.put(425, "minecraft:banner");
+                ItemIdFix.ITEM_NAMES.put(426, "minecraft:end_crystal");
+                ItemIdFix.ITEM_NAMES.put(427, "minecraft:spruce_door");
+                ItemIdFix.ITEM_NAMES.put(428, "minecraft:birch_door");
+                ItemIdFix.ITEM_NAMES.put(429, "minecraft:jungle_door");
+                ItemIdFix.ITEM_NAMES.put(430, "minecraft:acacia_door");
+                ItemIdFix.ITEM_NAMES.put(431, "minecraft:dark_oak_door");
+                ItemIdFix.ITEM_NAMES.put(432, "minecraft:chorus_fruit");
+                ItemIdFix.ITEM_NAMES.put(433, "minecraft:chorus_fruit_popped");
+                ItemIdFix.ITEM_NAMES.put(434, "minecraft:beetroot");
+                ItemIdFix.ITEM_NAMES.put(435, "minecraft:beetroot_seeds");
+                ItemIdFix.ITEM_NAMES.put(436, "minecraft:beetroot_soup");
+                ItemIdFix.ITEM_NAMES.put(437, "minecraft:dragon_breath");
+                ItemIdFix.ITEM_NAMES.put(438, "minecraft:splash_potion");
+                ItemIdFix.ITEM_NAMES.put(439, "minecraft:spectral_arrow");
+                ItemIdFix.ITEM_NAMES.put(440, "minecraft:tipped_arrow");
+                ItemIdFix.ITEM_NAMES.put(441, "minecraft:lingering_potion");
+                ItemIdFix.ITEM_NAMES.put(442, "minecraft:shield");
+                ItemIdFix.ITEM_NAMES.put(443, "minecraft:elytra");
+                ItemIdFix.ITEM_NAMES.put(444, "minecraft:spruce_boat");
+                ItemIdFix.ITEM_NAMES.put(445, "minecraft:birch_boat");
+                ItemIdFix.ITEM_NAMES.put(446, "minecraft:jungle_boat");
+                ItemIdFix.ITEM_NAMES.put(447, "minecraft:acacia_boat");
+                ItemIdFix.ITEM_NAMES.put(448, "minecraft:dark_oak_boat");
+                ItemIdFix.ITEM_NAMES.put(449, "minecraft:totem_of_undying");
+                ItemIdFix.ITEM_NAMES.put(450, "minecraft:shulker_shell");
+                ItemIdFix.ITEM_NAMES.put(452, "minecraft:iron_nugget");
+                ItemIdFix.ITEM_NAMES.put(453, "minecraft:knowledge_book");
+
+                ItemSpawnEggFix.ID_TO_ENTITY[23] = "Arrow";
+                // CraftBukkit end
             }
         }
     }
 
     private static <T> void checkTranslations(Iterable<T> objects, Function<T, String> objectToKeyFunction, Set<String> translationSet) {
-        Language instance = Language.getInstance();
-        objects.forEach(object -> {
-            String string = objectToKeyFunction.apply((T)object);
-            if (!instance.has(string)) {
-                translationSet.add(string);
+        Language localelanguage = Language.getInstance();
+
+        objects.forEach((object) -> {
+            String s = (String) objectToKeyFunction.apply(object);
+
+            if (!localelanguage.has(s)) {
+                translationSet.add(s);
             }
+
         });
     }
 
     private static void checkGameruleTranslations(final Set<String> translations) {
-        final Language instance = Language.getInstance();
+        final Language localelanguage = Language.getInstance();
+
         GameRules.visitGameRuleTypes(new GameRules.GameRuleTypeVisitor() {
             @Override
             public <T extends GameRules.Value<T>> void visit(GameRules.Key<T> key, GameRules.Type<T> type) {
-                if (!instance.has(key.getDescriptionId())) {
+                if (!localelanguage.has(key.getDescriptionId())) {
                     translations.add(key.getId());
                 }
+
             }
         });
     }
 
     public static Set<String> getMissingTranslations() {
-        Set<String> set = new TreeSet<>();
+        Set<String> set = new TreeSet();
+
         checkTranslations(BuiltInRegistries.ATTRIBUTE, Attribute::getDescriptionId, set);
         checkTranslations(BuiltInRegistries.ENTITY_TYPE, EntityType::getDescriptionId, set);
         checkTranslations(BuiltInRegistries.MOB_EFFECT, MobEffect::getDescriptionId, set);
         checkTranslations(BuiltInRegistries.ITEM, Item::getDescriptionId, set);
         checkTranslations(BuiltInRegistries.ENCHANTMENT, Enchantment::getDescriptionId, set);
         checkTranslations(BuiltInRegistries.BLOCK, Block::getDescriptionId, set);
-        checkTranslations(BuiltInRegistries.CUSTOM_STAT, resourceLocation -> "stat." + resourceLocation.toString().replace(':', '.'), set);
+        checkTranslations(BuiltInRegistries.CUSTOM_STAT, (minecraftkey) -> {
+            String s = minecraftkey.toString();
+
+            return "stat." + s.replace(':', '.');
+        }, set);
         checkGameruleTranslations(set);
         return set;
     }
 
     public static void checkBootstrapCalled(Supplier<String> callSite) {
-        if (!isBootstrapped) {
+        if (!Bootstrap.isBootstrapped) {
             throw createBootstrapException(callSite);
         }
     }
 
     private static RuntimeException createBootstrapException(Supplier<String> callSite) {
         try {
-            String string = callSite.get();
-            return new IllegalArgumentException("Not bootstrapped (called from " + string + ")");
-        } catch (Exception var3) {
-            RuntimeException runtimeException = new IllegalArgumentException("Not bootstrapped (failed to resolve location)");
-            runtimeException.addSuppressed(var3);
-            return runtimeException;
+            String s = (String) callSite.get();
+
+            return new IllegalArgumentException("Not bootstrapped (called from " + s + ")");
+        } catch (Exception exception) {
+            IllegalArgumentException illegalargumentexception = new IllegalArgumentException("Not bootstrapped (failed to resolve location)");
+
+            illegalargumentexception.addSuppressed(exception);
+            return illegalargumentexception;
         }
     }
 
     public static void validate() {
-        checkBootstrapCalled(() -> "validate");
+        checkBootstrapCalled(() -> {
+            return "validate";
+        });
         if (SharedConstants.IS_RUNNING_IN_IDE) {
-            getMissingTranslations().forEach(string -> LOGGER.error("Missing translations: {}", string));
+            getMissingTranslations().forEach((s) -> {
+                Bootstrap.LOGGER.error("Missing translations: {}", s);
+            });
             Commands.validate();
         }
 
@@ -125,16 +227,17 @@
     }
 
     private static void wrapStreams() {
-        if (LOGGER.isDebugEnabled()) {
+        if (Bootstrap.LOGGER.isDebugEnabled()) {
             System.setErr(new DebugLoggedPrintStream("STDERR", System.err));
-            System.setOut(new DebugLoggedPrintStream("STDOUT", STDOUT));
+            System.setOut(new DebugLoggedPrintStream("STDOUT", Bootstrap.STDOUT));
         } else {
             System.setErr(new LoggedPrintStream("STDERR", System.err));
-            System.setOut(new LoggedPrintStream("STDOUT", STDOUT));
+            System.setOut(new LoggedPrintStream("STDOUT", Bootstrap.STDOUT));
         }
+
     }
 
     public static void realStdoutPrintln(String message) {
-        STDOUT.println(message);
+        Bootstrap.STDOUT.println(message);
     }
 }