Fix compilation issues (#1530)

This commit is contained in:
Krakenied
2024-06-17 01:52:10 +02:00
committed by GitHub
parent 6e1147f1ac
commit c9917352de
306 changed files with 1065 additions and 1005 deletions

View File

@@ -157,7 +157,7 @@ index 24f6a158e4759aac3be8da4cf5e0d40bd295355b..6b7dbb570f8a698c87c6bce992d84d87
return InteractionResult.PASS;
}
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
index a08b58f67684f20a0eb5b65c7e201c60ee079c39..49243adbc25e5d1141c9cf8b4118d600862b3d17 100644
index 7cf5c1d883b62abea2d855136c6c3c95bdd6e73f..e355fa02cdb19cb9aaccb6ac35b936e44e506f64 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
@@ -489,6 +489,280 @@ public class PurpurWorldConfig {
@@ -271,17 +271,17 @@ index a08b58f67684f20a0eb5b65c7e201c60ee079c39..49243adbc25e5d1141c9cf8b4118d600
+ Map.entry("minecraft:crimson_stem", Map.of("into", "minecraft:stripped_crimson_stem", "drops", new HashMap<String, Double>())),
+ Map.entry("minecraft:crimson_hyphae", Map.of("into", "minecraft:stripped_crimson_hyphae", "drops", new HashMap<String, Double>())))
+ ).forEach((blockId, obj) -> {
+ Block block = BuiltInRegistries.BLOCK.get(new ResourceLocation(blockId));
+ Block block = BuiltInRegistries.BLOCK.get(ResourceLocation.parse(blockId));
+ if (block == Blocks.AIR) { PurpurConfig.log(Level.SEVERE, "Invalid block for `tools.axe.strippables`: " + blockId); return; }
+ if (!(obj instanceof Map<?, ?> map)) { PurpurConfig.log(Level.SEVERE, "Invalid yaml for `tools.axe.strippables." + blockId + "`"); return; }
+ String intoId = (String) map.get("into");
+ Block into = BuiltInRegistries.BLOCK.get(new ResourceLocation(intoId));
+ Block into = BuiltInRegistries.BLOCK.get(ResourceLocation.parse(intoId));
+ if (into == Blocks.AIR) { PurpurConfig.log(Level.SEVERE, "Invalid block for `tools.axe.strippables." + blockId + ".into`: " + intoId); return; }
+ Object dropsObj = map.get("drops");
+ if (!(dropsObj instanceof Map<?, ?> dropsMap)) { PurpurConfig.log(Level.SEVERE, "Invalid yaml for `tools.axe.strippables." + blockId + ".drops`"); return; }
+ Map<Item, Double> drops = new HashMap<>();
+ dropsMap.forEach((itemId, chance) -> {
+ Item item = BuiltInRegistries.ITEM.get(new ResourceLocation(itemId.toString()));
+ Item item = BuiltInRegistries.ITEM.get(ResourceLocation.parse(itemId.toString()));
+ if (item == Items.AIR) { PurpurConfig.log(Level.SEVERE, "Invalid item for `tools.axe.strippables." + blockId + ".drops`: " + itemId); return; }
+ drops.put(item, (double) chance);
+ });
@@ -325,17 +325,17 @@ index a08b58f67684f20a0eb5b65c7e201c60ee079c39..49243adbc25e5d1141c9cf8b4118d600
+ Map.entry("minecraft:waxed_weathered_copper_bulb", Map.of("into", "minecraft:weathered_copper_bulb", "drops", new HashMap<String, Double>())),
+ Map.entry("minecraft:waxed_oxidized_copper_bulb", Map.of("into", "minecraft:oxidized_copper_bulb", "drops", new HashMap<String, Double>())))
+ ).forEach((blockId, obj) -> {
+ Block block = BuiltInRegistries.BLOCK.get(new ResourceLocation(blockId));
+ Block block = BuiltInRegistries.BLOCK.get(ResourceLocation.parse(blockId));
+ if (block == Blocks.AIR) { PurpurConfig.log(Level.SEVERE, "Invalid block for `tools.axe.waxables`: " + blockId); return; }
+ if (!(obj instanceof Map<?, ?> map)) { PurpurConfig.log(Level.SEVERE, "Invalid yaml for `tools.axe.waxables." + blockId + "`"); return; }
+ String intoId = (String) map.get("into");
+ Block into = BuiltInRegistries.BLOCK.get(new ResourceLocation(intoId));
+ Block into = BuiltInRegistries.BLOCK.get(ResourceLocation.parse(intoId));
+ if (into == Blocks.AIR) { PurpurConfig.log(Level.SEVERE, "Invalid block for `tools.axe.waxables." + blockId + ".into`: " + intoId); return; }
+ Object dropsObj = map.get("drops");
+ if (!(dropsObj instanceof Map<?, ?> dropsMap)) { PurpurConfig.log(Level.SEVERE, "Invalid yaml for `tools.axe.waxables." + blockId + ".drops`"); return; }
+ Map<Item, Double> drops = new HashMap<>();
+ dropsMap.forEach((itemId, chance) -> {
+ Item item = BuiltInRegistries.ITEM.get(new ResourceLocation(itemId.toString()));
+ Item item = BuiltInRegistries.ITEM.get(ResourceLocation.parse(itemId.toString()));
+ if (item == Items.AIR) { PurpurConfig.log(Level.SEVERE, "Invalid item for `tools.axe.waxables." + blockId + ".drops`: " + itemId); return; }
+ drops.put(item, (double) chance);
+ });
@@ -370,17 +370,17 @@ index a08b58f67684f20a0eb5b65c7e201c60ee079c39..49243adbc25e5d1141c9cf8b4118d600
+ Map.entry("minecraft:weathered_copper_bulb", Map.of("into", "minecraft:exposed_copper_bulb", "drops", new HashMap<String, Double>())),
+ Map.entry("minecraft:oxidized_copper_bulb", Map.of("into", "minecraft:weathered_copper_bulb", "drops", new HashMap<String, Double>())))
+ ).forEach((blockId, obj) -> {
+ Block block = BuiltInRegistries.BLOCK.get(new ResourceLocation(blockId));
+ Block block = BuiltInRegistries.BLOCK.get(ResourceLocation.parse(blockId));
+ if (block == Blocks.AIR) { PurpurConfig.log(Level.SEVERE, "Invalid block for `tools.axe.weatherables`: " + blockId); return; }
+ if (!(obj instanceof Map<?, ?> map)) { PurpurConfig.log(Level.SEVERE, "Invalid yaml for `tools.axe.weatherables." + blockId + "`"); return; }
+ String intoId = (String) map.get("into");
+ Block into = BuiltInRegistries.BLOCK.get(new ResourceLocation(intoId));
+ Block into = BuiltInRegistries.BLOCK.get(ResourceLocation.parse(intoId));
+ if (into == Blocks.AIR) { PurpurConfig.log(Level.SEVERE, "Invalid block for `tools.axe.weatherables." + blockId + ".into`: " + intoId); return; }
+ Object dropsObj = map.get("drops");
+ if (!(dropsObj instanceof Map<?, ?> dropsMap)) { PurpurConfig.log(Level.SEVERE, "Invalid yaml for `tools.axe.weatherables." + blockId + ".drops`"); return; }
+ Map<Item, Double> drops = new HashMap<>();
+ dropsMap.forEach((itemId, chance) -> {
+ Item item = BuiltInRegistries.ITEM.get(new ResourceLocation(itemId.toString()));
+ Item item = BuiltInRegistries.ITEM.get(ResourceLocation.parse(itemId.toString()));
+ if (item == Items.AIR) { PurpurConfig.log(Level.SEVERE, "Invalid item for `tools.axe.weatherables." + blockId + ".drops`: " + itemId); return; }
+ drops.put(item, (double) chance);
+ });
@@ -393,20 +393,20 @@ index a08b58f67684f20a0eb5b65c7e201c60ee079c39..49243adbc25e5d1141c9cf8b4118d600
+ Map.entry("minecraft:coarse_dirt", Map.of("condition", "air_above", "into", "minecraft:dirt", "drops", new HashMap<String, Double>())),
+ Map.entry("minecraft:rooted_dirt", Map.of("condition", "always", "into", "minecraft:dirt", "drops", Map.of("minecraft:hanging_roots", 1.0D))))
+ ).forEach((blockId, obj) -> {
+ Block block = BuiltInRegistries.BLOCK.get(new ResourceLocation(blockId));
+ Block block = BuiltInRegistries.BLOCK.get(ResourceLocation.parse(blockId));
+ if (block == Blocks.AIR) { PurpurConfig.log(Level.SEVERE, "Invalid block for `tools.hoe.tillables`: " + blockId); return; }
+ if (!(obj instanceof Map<?, ?> map)) { PurpurConfig.log(Level.SEVERE, "Invalid yaml for `tools.hoe.tillables." + blockId + "`"); return; }
+ String conditionId = (String) map.get("condition");
+ Tillable.Condition condition = Tillable.Condition.get(conditionId);
+ if (condition == null) { PurpurConfig.log(Level.SEVERE, "Invalid condition for `tools.hoe.tillables." + blockId + ".condition`: " + conditionId); return; }
+ String intoId = (String) map.get("into");
+ Block into = BuiltInRegistries.BLOCK.get(new ResourceLocation(intoId));
+ Block into = BuiltInRegistries.BLOCK.get(ResourceLocation.parse(intoId));
+ if (into == Blocks.AIR) { PurpurConfig.log(Level.SEVERE, "Invalid block for `tools.hoe.tillables." + blockId + ".into`: " + intoId); return; }
+ Object dropsObj = map.get("drops");
+ if (!(dropsObj instanceof Map<?, ?> dropsMap)) { PurpurConfig.log(Level.SEVERE, "Invalid yaml for `tools.hoe.tillables." + blockId + ".drops`"); return; }
+ Map<Item, Double> drops = new HashMap<>();
+ dropsMap.forEach((itemId, chance) -> {
+ Item item = BuiltInRegistries.ITEM.get(new ResourceLocation(itemId.toString()));
+ Item item = BuiltInRegistries.ITEM.get(ResourceLocation.parse(itemId.toString()));
+ if (item == Items.AIR) { PurpurConfig.log(Level.SEVERE, "Invalid item for `tools.hoe.tillables." + blockId + ".drops`: " + itemId); return; }
+ drops.put(item, (double) chance);
+ });
@@ -420,17 +420,17 @@ index a08b58f67684f20a0eb5b65c7e201c60ee079c39..49243adbc25e5d1141c9cf8b4118d600
+ Map.entry("minecraft:mycelium", Map.of("into", "minecraft:dirt_path", "drops", new HashMap<String, Double>())),
+ Map.entry("minecraft:rooted_dirt", Map.of("into", "minecraft:dirt_path", "drops", new HashMap<String, Double>())))
+ ).forEach((blockId, obj) -> {
+ Block block = BuiltInRegistries.BLOCK.get(new ResourceLocation(blockId));
+ Block block = BuiltInRegistries.BLOCK.get(ResourceLocation.parse(blockId));
+ if (block == Blocks.AIR) { PurpurConfig.log(Level.SEVERE, "Invalid block for `tools.shovel.flattenables`: " + blockId); return; }
+ if (!(obj instanceof Map<?, ?> map)) { PurpurConfig.log(Level.SEVERE, "Invalid yaml for `tools.shovel.flattenables." + blockId + "`"); return; }
+ String intoId = (String) map.get("into");
+ Block into = BuiltInRegistries.BLOCK.get(new ResourceLocation(intoId));
+ Block into = BuiltInRegistries.BLOCK.get(ResourceLocation.parse(intoId));
+ if (into == Blocks.AIR) { PurpurConfig.log(Level.SEVERE, "Invalid block for `tools.shovel.flattenables." + blockId + ".into`: " + intoId); return; }
+ Object dropsObj = map.get("drops");
+ if (!(dropsObj instanceof Map<?, ?> dropsMap)) { PurpurConfig.log(Level.SEVERE, "Invalid yaml for `tools.shovel.flattenables." + blockId + ".drops`"); return; }
+ Map<Item, Double> drops = new HashMap<>();
+ dropsMap.forEach((itemId, chance) -> {
+ Item item = BuiltInRegistries.ITEM.get(new ResourceLocation(itemId.toString()));
+ Item item = BuiltInRegistries.ITEM.get(ResourceLocation.parse(itemId.toString()));
+ if (item == Items.AIR) { PurpurConfig.log(Level.SEVERE, "Invalid item for `tools.shovel.flattenables." + blockId + ".drops`: " + itemId); return; }
+ drops.put(item, (double) chance);
+ });