From b017398627a02b14ad630d999fdea0b4f9c77fda Mon Sep 17 00:00:00 2001 From: AlexProgrammerDE <40795980+AlexProgrammerDE@users.noreply.github.com> Date: Sun, 28 Apr 2024 19:29:57 +0200 Subject: [PATCH 01/38] Reduce duplicate code --- 1.10.2/build.gradle | 2 + .../dev/u9g/minecraftdatagenerator/Main.java | 13 --- .../generators/BlocksDataGenerator.java | 7 +- .../generators/DataGenerators.java | 81 ------------------- .../generators/IDataGenerator.java | 10 --- .../generators/TintsDataGenerator.java | 4 +- .../mixin/ReadyMixin.java | 17 ++-- .../u9g/minecraftdatagenerator/util/DGU.java | 2 - 1.10.2/src/main/resources/fabric.mod.json | 9 +-- 1.11.2/build.gradle | 2 + .../dev/u9g/minecraftdatagenerator/Main.java | 13 --- .../clientsideannoyances/BiomeColors.java | 2 +- .../generators/BlocksDataGenerator.java | 7 +- .../generators/IDataGenerator.java | 10 --- .../mixin/ReadyMixin.java | 17 ++-- .../u9g/minecraftdatagenerator/util/DGU.java | 2 - 1.11.2/src/main/resources/fabric.mod.json | 9 +-- 1.12.2/build.gradle | 2 + .../dev/u9g/minecraftdatagenerator/Main.java | 13 --- .../generators/BlocksDataGenerator.java | 7 +- .../generators/DataGenerators.java | 81 ------------------- .../mixin/ReadyMixin.java | 17 ++-- .../u9g/minecraftdatagenerator/util/DGU.java | 2 - 1.12.2/src/main/resources/fabric.mod.json | 9 +-- 1.13/build.gradle | 2 + .../dev/u9g/minecraftdatagenerator/Main.java | 13 --- .../generators/BlocksDataGenerator.java | 7 +- .../generators/DataGenerators.java | 80 ------------------ .../generators/IDataGenerator.java | 10 --- .../mixin/ReadyMixin.java | 17 ++-- .../u9g/minecraftdatagenerator/util/DGU.java | 2 - 1.13/src/main/resources/fabric.mod.json | 9 +-- 1.14/build.gradle | 2 + .../dev/u9g/minecraftdatagenerator/Main.java | 14 ---- .../generators/BlocksDataGenerator.java | 7 +- .../generators/DataGenerators.java | 80 ------------------ .../generators/IDataGenerator.java | 10 --- .../mixin/ReadyMixin.java | 17 ++-- .../u9g/minecraftdatagenerator/util/DGU.java | 2 - 1.14/src/main/resources/fabric.mod.json | 9 +-- 1.15/build.gradle | 2 + .../dev/u9g/minecraftdatagenerator/Main.java | 14 ---- .../generators/BlocksDataGenerator.java | 7 +- .../generators/DataGenerators.java | 80 ------------------ .../generators/IDataGenerator.java | 10 --- .../mixin/ReadyMixin.java | 17 ++-- .../u9g/minecraftdatagenerator/util/DGU.java | 2 - 1.15/src/main/resources/fabric.mod.json | 9 +-- 1.16/build.gradle | 2 + .../dev/u9g/minecraftdatagenerator/Main.java | 14 ---- .../generators/BlocksDataGenerator.java | 7 +- .../generators/DataGenerators.java | 80 ------------------ .../generators/IDataGenerator.java | 10 --- .../mixin/ReadyMixin.java | 17 ++-- .../u9g/minecraftdatagenerator/util/DGU.java | 2 - 1.16/src/main/resources/fabric.mod.json | 9 +-- 1.17/build.gradle | 2 + .../dev/u9g/minecraftdatagenerator/Main.java | 14 ---- .../generators/DataGenerators.java | 79 ------------------ .../generators/IDataGenerator.java | 10 --- .../mixin/ReadyMixin.java | 16 ++-- .../u9g/minecraftdatagenerator/util/DGU.java | 2 - 1.17/src/main/resources/fabric.mod.json | 9 +-- 1.18/build.gradle | 2 + .../dev/u9g/minecraftdatagenerator/Main.java | 14 ---- .../generators/DataGenerators.java | 75 ----------------- .../generators/IDataGenerator.java | 10 --- .../mixin/ReadyMixin.java | 16 ++-- .../u9g/minecraftdatagenerator/util/DGU.java | 2 - 1.18/src/main/resources/fabric.mod.json | 9 +-- 1.19.2/build.gradle | 2 + .../dev/u9g/minecraftdatagenerator/Main.java | 14 ---- .../generators/DataGenerators.java | 78 ------------------ .../generators/IDataGenerator.java | 10 --- .../mixin/ReadyMixin.java | 16 ++-- 1.19.2/src/main/resources/fabric.mod.json | 7 +- 1.19/build.gradle | 2 + .../dev/u9g/minecraftdatagenerator/Main.java | 14 ---- .../generators/DataGenerators.java | 78 ------------------ .../generators/IDataGenerator.java | 10 --- .../mixin/ReadyMixin.java | 16 ++-- 1.19/src/main/resources/fabric.mod.json | 7 +- 1.20.4/build.gradle | 2 + .../dev/u9g/minecraftdatagenerator/Main.java | 14 ---- .../generators/BiomesDataGenerator.java | 1 + .../generators/DataGenerators.java | 77 ------------------ .../generators/IDataGenerator.java | 10 --- .../mixin/ReadyMixin.java | 16 ++-- 1.20.4/src/main/resources/fabric.mod.json | 7 +- 1.20/build.gradle | 2 + .../dev/u9g/minecraftdatagenerator/Main.java | 14 ---- .../generators/DataGenerators.java | 78 ------------------ .../generators/IDataGenerator.java | 10 --- .../mixin/ReadyMixin.java | 16 ++-- 1.20/src/main/resources/fabric.mod.json | 7 +- 1.7/build.gradle | 2 + .../dev/u9g/minecraftdatagenerator/Main.java | 13 --- .../generators/BlocksDataGenerator.java | 4 - .../generators/DataGenerators.java | 80 ------------------ .../generators/IDataGenerator.java | 10 --- .../generators/TintsDataGenerator.java | 10 +-- .../mixin/ReadyMixin.java | 18 ++--- .../u9g/minecraftdatagenerator/util/DGU.java | 1 - .../util/Registries.java | 34 ++++---- 1.7/src/main/resources/fabric.mod.json | 9 +-- 1.8.9/build.gradle | 2 + .../dev/u9g/minecraftdatagenerator/Main.java | 13 --- .../generators/BlocksDataGenerator.java | 4 - .../generators/DataGenerators.java | 80 ------------------ .../generators/IDataGenerator.java | 10 --- .../generators/TintsDataGenerator.java | 10 +-- .../mixin/ReadyMixin.java | 17 ++-- .../u9g/minecraftdatagenerator/util/DGU.java | 1 - 1.8.9/src/main/resources/fabric.mod.json | 9 +-- 1.9.4/build.gradle | 2 + .../dev/u9g/minecraftdatagenerator/Main.java | 13 --- .../generators/BlocksDataGenerator.java | 7 +- .../generators/DataGenerators.java | 81 ------------------- .../generators/IDataGenerator.java | 10 --- .../generators/TintsDataGenerator.java | 10 +-- .../mixin/ReadyMixin.java | 17 ++-- .../u9g/minecraftdatagenerator/util/DGU.java | 4 +- 1.9.4/src/main/resources/fabric.mod.json | 9 +-- 22w19a/build.gradle | 2 + .../dev/u9g/minecraftdatagenerator/Main.java | 14 ---- .../generators/DataGenerators.java | 78 ------------------ .../generators/IDataGenerator.java | 10 --- .../mixin/ReadyMixin.java | 16 ++-- .../u9g/minecraftdatagenerator/util/DGU.java | 2 - 22w19a/src/main/resources/fabric.mod.json | 9 +-- common/build.gradle | 18 +++++ .../MinecraftDataGenerator.java | 18 +++++ .../generators/DataGenerators.java | 40 +++++---- .../generators/IDataGenerator.java | 1 - settings.gradle | 10 ++- 135 files changed, 249 insertions(+), 2118 deletions(-) delete mode 100644 1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/Main.java delete mode 100644 1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/DataGenerators.java delete mode 100644 1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/IDataGenerator.java delete mode 100644 1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/Main.java delete mode 100644 1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/IDataGenerator.java delete mode 100644 1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/Main.java delete mode 100644 1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/DataGenerators.java delete mode 100644 1.13/src/main/java/dev/u9g/minecraftdatagenerator/Main.java delete mode 100644 1.13/src/main/java/dev/u9g/minecraftdatagenerator/generators/DataGenerators.java delete mode 100644 1.13/src/main/java/dev/u9g/minecraftdatagenerator/generators/IDataGenerator.java delete mode 100644 1.14/src/main/java/dev/u9g/minecraftdatagenerator/Main.java delete mode 100644 1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/DataGenerators.java delete mode 100644 1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/IDataGenerator.java delete mode 100644 1.15/src/main/java/dev/u9g/minecraftdatagenerator/Main.java delete mode 100644 1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/DataGenerators.java delete mode 100644 1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/IDataGenerator.java delete mode 100644 1.16/src/main/java/dev/u9g/minecraftdatagenerator/Main.java delete mode 100644 1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/DataGenerators.java delete mode 100644 1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/IDataGenerator.java delete mode 100644 1.17/src/main/java/dev/u9g/minecraftdatagenerator/Main.java delete mode 100644 1.17/src/main/java/dev/u9g/minecraftdatagenerator/generators/DataGenerators.java delete mode 100644 1.17/src/main/java/dev/u9g/minecraftdatagenerator/generators/IDataGenerator.java delete mode 100644 1.18/src/main/java/dev/u9g/minecraftdatagenerator/Main.java delete mode 100644 1.18/src/main/java/dev/u9g/minecraftdatagenerator/generators/DataGenerators.java delete mode 100644 1.18/src/main/java/dev/u9g/minecraftdatagenerator/generators/IDataGenerator.java delete mode 100644 1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/Main.java delete mode 100644 1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/DataGenerators.java delete mode 100644 1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/IDataGenerator.java delete mode 100644 1.19/src/main/java/dev/u9g/minecraftdatagenerator/Main.java delete mode 100644 1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/DataGenerators.java delete mode 100644 1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/IDataGenerator.java delete mode 100644 1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/Main.java delete mode 100644 1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/DataGenerators.java delete mode 100644 1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/IDataGenerator.java delete mode 100644 1.20/src/main/java/dev/u9g/minecraftdatagenerator/Main.java delete mode 100644 1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/DataGenerators.java delete mode 100644 1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/IDataGenerator.java delete mode 100644 1.7/src/main/java/dev/u9g/minecraftdatagenerator/Main.java delete mode 100644 1.7/src/main/java/dev/u9g/minecraftdatagenerator/generators/DataGenerators.java delete mode 100644 1.7/src/main/java/dev/u9g/minecraftdatagenerator/generators/IDataGenerator.java delete mode 100644 1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/Main.java delete mode 100644 1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/generators/DataGenerators.java delete mode 100644 1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/generators/IDataGenerator.java delete mode 100644 1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/Main.java delete mode 100644 1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/DataGenerators.java delete mode 100644 1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/IDataGenerator.java delete mode 100644 22w19a/src/main/java/dev/u9g/minecraftdatagenerator/Main.java delete mode 100644 22w19a/src/main/java/dev/u9g/minecraftdatagenerator/generators/DataGenerators.java delete mode 100644 22w19a/src/main/java/dev/u9g/minecraftdatagenerator/generators/IDataGenerator.java create mode 100644 common/build.gradle create mode 100644 common/src/main/java/dev/u9g/minecraftdatagenerator/MinecraftDataGenerator.java rename {1.11.2 => common}/src/main/java/dev/u9g/minecraftdatagenerator/generators/DataGenerators.java (69%) rename {1.12.2 => common}/src/main/java/dev/u9g/minecraftdatagenerator/generators/IDataGenerator.java (99%) diff --git a/1.10.2/build.gradle b/1.10.2/build.gradle index 057916c6..a0489215 100644 --- a/1.10.2/build.gradle +++ b/1.10.2/build.gradle @@ -25,6 +25,8 @@ dependencies { // exclude module: "legacy-fabric-entity-events-v1" // } + implementation(projects.common) + if (System.getProperty("os.name").toLowerCase().contains("mac")) { implementation 'org.lwjgl.lwjgl:lwjgl_util:2.9.4-nightly-20150209' implementation 'org.lwjgl.lwjgl:lwjgl:2.9.4-nightly-20150209' diff --git a/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/Main.java b/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/Main.java deleted file mode 100644 index d23c5ba2..00000000 --- a/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/Main.java +++ /dev/null @@ -1,13 +0,0 @@ -package dev.u9g.minecraftdatagenerator; - -import net.fabricmc.api.ModInitializer; - -import java.util.logging.Logger; - -public class Main implements ModInitializer { - public static final Logger LOGGER = Logger.getLogger("mc-data-gen-serv"); - - @Override - public void onInitialize() { - } -} diff --git a/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java b/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java index 284f566f..7d274722 100644 --- a/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java +++ b/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java @@ -4,7 +4,6 @@ import com.google.gson.JsonArray; import com.google.gson.JsonObject; import com.google.gson.JsonPrimitive; -import dev.u9g.minecraftdatagenerator.Main; import dev.u9g.minecraftdatagenerator.mixin.BlockAccessor; import dev.u9g.minecraftdatagenerator.mixin.MiningToolItemAccessor; import dev.u9g.minecraftdatagenerator.util.DGU; @@ -30,11 +29,7 @@ import java.util.Objects; import java.util.logging.Logger; -public class BlocksDataGenerator implements IDataGenerator { - - private static final Logger logger = Main.LOGGER; - - private static List getItemsEffectiveForBlock(Block block) { +public class BlocksDataGenerator implements IDataGenerator {private static List getItemsEffectiveForBlock(Block block) { List items = new ArrayList<>(); for (Item item : Registries.ITEMS) { if (item instanceof ToolItem && ((MiningToolItemAccessor) item).getEffectiveBlocks().contains(block)) { diff --git a/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/DataGenerators.java b/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/DataGenerators.java deleted file mode 100644 index c89d0777..00000000 --- a/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/DataGenerators.java +++ /dev/null @@ -1,81 +0,0 @@ -package dev.u9g.minecraftdatagenerator.generators; - -import com.google.gson.JsonElement; -import com.google.gson.internal.Streams; -import com.google.gson.stream.JsonWriter; -import dev.u9g.minecraftdatagenerator.Main; - -import java.io.IOException; -import java.io.Writer; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.StandardOpenOption; -import java.text.MessageFormat; -import java.util.ArrayList; -import java.util.List; -import java.util.logging.Level; -import java.util.logging.Logger; - -public class DataGenerators { - - private static final List GENERATORS = new ArrayList<>(); - private static final Logger logger = Main.LOGGER; - - static { - register(new BiomesDataGenerator()); - register(new BlockCollisionShapesDataGenerator()); - register(new BlocksDataGenerator()); - register(new EffectsDataGenerator()); - register(new EnchantmentsDataGenerator()); - register(new EntitiesDataGenerator()); - register(new FoodsDataGenerator()); - register(new ItemsDataGenerator()); - register(new ParticlesDataGenerator()); - register(new TintsDataGenerator()); - register(new LanguageDataGenerator()); - register(new InstrumentsDataGenerator()); - register(new AttributesDataGenerator()); - register(new SoundsDataGenerator()); - } - - public static void register(IDataGenerator generator) { - GENERATORS.add(generator); - } - - public static boolean runDataGenerators(Path outputDirectory) { - try { - Files.createDirectories(outputDirectory); - } catch (IOException exception) { - logger.info("Failed to create data generator output directory at " + outputDirectory); - exception.printStackTrace(); - return false; - } - - int generatorsFailed = 0; - logger.info(MessageFormat.format("Running minecraft data generators, output at {0}", outputDirectory)); - - for (IDataGenerator dataGenerator : GENERATORS) { - logger.info(MessageFormat.format("Running generator {0}", dataGenerator.getDataName())); - try { - String outputFileName = String.format("%s.json", dataGenerator.getDataName()); - JsonElement outputElement = dataGenerator.generateDataJson(); - Path outputFilePath = outputDirectory.resolve(outputFileName); - - try (Writer writer = Files.newBufferedWriter(outputFilePath, StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING)) { - JsonWriter jsonWriter = new JsonWriter(writer); - jsonWriter.setIndent(" "); - Streams.write(outputElement, jsonWriter); - } - logger.info(MessageFormat.format("Generator: {0} -> {1}", dataGenerator.getDataName(), outputFileName)); - - } catch (Throwable exception) { - logger.info(MessageFormat.format("Failed to run data generator {0}", dataGenerator.getDataName())); - exception.printStackTrace(); - generatorsFailed++; - } - } - - logger.info("Finishing running data generators"); - return generatorsFailed == 0; - } -} diff --git a/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/IDataGenerator.java b/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/IDataGenerator.java deleted file mode 100644 index 81fe4e20..00000000 --- a/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/IDataGenerator.java +++ /dev/null @@ -1,10 +0,0 @@ -package dev.u9g.minecraftdatagenerator.generators; - -import com.google.gson.JsonElement; - -public interface IDataGenerator { - - String getDataName(); - - JsonElement generateDataJson(); -} diff --git a/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java b/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java index 8d1b2a84..2d20e81a 100644 --- a/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java +++ b/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java @@ -33,8 +33,8 @@ public Biome getBiome(BlockPos pos) { return biome; } }; - int biomeGrassColor = GrassColors.getGrassColor(bv.getBiome(BlockPos.ORIGIN)); - int biomeFoliageColor = FoliageColors.getFoliageColor(bv.getBiome(BlockPos.ORIGIN)); + int biomeGrassColor = GrassColors.getGrassColor(biome); + int biomeFoliageColor = FoliageColors.getFoliageColor(biome); int biomeWaterColor = ((BiomeAccessor) biome).waterColor(); colors.grassColoursMap.computeIfAbsent(biomeGrassColor, k -> new ArrayList<>()).add(biome); diff --git a/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java b/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java index f5608f0a..c1d96581 100644 --- a/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java +++ b/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java @@ -1,7 +1,6 @@ package dev.u9g.minecraftdatagenerator.mixin; -import dev.u9g.minecraftdatagenerator.Main; -import dev.u9g.minecraftdatagenerator.generators.DataGenerators; +import dev.u9g.minecraftdatagenerator.MinecraftDataGenerator; import dev.u9g.minecraftdatagenerator.util.DGU; import net.minecraft.server.dedicated.MinecraftDedicatedServer; import org.spongepowered.asm.mixin.Mixin; @@ -9,19 +8,13 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -import java.nio.file.Path; -import java.util.logging.Level; - @Mixin(MinecraftDedicatedServer.class) public class ReadyMixin { @Inject(method = "setupServer()Z", at = @At("TAIL")) private void init(CallbackInfoReturnable cir) { - Main.LOGGER.info("Starting data generation!"); - String versionName = DGU.getCurrentlyRunningServer().getVersion(); - Path serverRootDirectory = DGU.getCurrentlyRunningServer().getRunDirectory().toPath().toAbsolutePath(); - Path dataDumpDirectory = serverRootDirectory.resolve("minecraft-data").resolve(versionName); - DataGenerators.runDataGenerators(dataDumpDirectory); - Main.LOGGER.info("Done data generation!"); - Runtime.getRuntime().halt(0); + MinecraftDataGenerator.start( + DGU.getCurrentlyRunningServer().getVersion(), + DGU.getCurrentlyRunningServer().getRunDirectory().toPath() + ); } } diff --git a/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java b/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java index bf7137e6..bef2bf1c 100644 --- a/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java +++ b/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java @@ -38,7 +38,6 @@ public void write(JsonWriter out, Number value) throws IOException { } })).create(); - @Environment(EnvType.CLIENT) private static MinecraftServer getCurrentlyRunningServerClient() { return MinecraftClient.getInstance().getServer(); } @@ -58,7 +57,6 @@ public static MinecraftServer getCurrentlyRunningServer() { throw new UnsupportedOperationException(); } - @Environment(EnvType.CLIENT) private static String translateTextClient(String translationKey) { return I18n.translate(translationKey); } diff --git a/1.10.2/src/main/resources/fabric.mod.json b/1.10.2/src/main/resources/fabric.mod.json index a73252d3..12f9d70e 100644 --- a/1.10.2/src/main/resources/fabric.mod.json +++ b/1.10.2/src/main/resources/fabric.mod.json @@ -11,16 +11,11 @@ "contact": {}, "license": "MIT", "environment": "server", - "entrypoints": { - "main": [ - "dev.u9g.minecraftdatagenerator.Main" - ] - }, "mixins": [ "minecraft-data-generator.mixins.json" ], "depends": { - "fabricloader": ">=0.13.3", - "minecraft": ">=1.10" + "fabricloader": "*", + "minecraft": "*" } } diff --git a/1.11.2/build.gradle b/1.11.2/build.gradle index 057916c6..a0489215 100644 --- a/1.11.2/build.gradle +++ b/1.11.2/build.gradle @@ -25,6 +25,8 @@ dependencies { // exclude module: "legacy-fabric-entity-events-v1" // } + implementation(projects.common) + if (System.getProperty("os.name").toLowerCase().contains("mac")) { implementation 'org.lwjgl.lwjgl:lwjgl_util:2.9.4-nightly-20150209' implementation 'org.lwjgl.lwjgl:lwjgl:2.9.4-nightly-20150209' diff --git a/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/Main.java b/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/Main.java deleted file mode 100644 index d23c5ba2..00000000 --- a/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/Main.java +++ /dev/null @@ -1,13 +0,0 @@ -package dev.u9g.minecraftdatagenerator; - -import net.fabricmc.api.ModInitializer; - -import java.util.logging.Logger; - -public class Main implements ModInitializer { - public static final Logger LOGGER = Logger.getLogger("mc-data-gen-serv"); - - @Override - public void onInitialize() { - } -} diff --git a/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/BiomeColors.java b/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/BiomeColors.java index eb56ce44..4ce9e49a 100644 --- a/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/BiomeColors.java +++ b/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/BiomeColors.java @@ -27,7 +27,7 @@ private static int getColor(EmptyBlockView view, BlockPos pos, ColorProvider pro int l; for (Iterator var6 = BlockPos.mutableIterate(pos.add(-1, 0, -1), pos.add(1, 0, 1)).iterator(); var6.hasNext(); k += l & 255) { - BlockPos.Mutable mutable = (BlockPos.Mutable) var6.next(); + BlockPos.Mutable mutable = var6.next(); l = provider.getColorAtPos(view.getBiome(mutable), mutable); i += (l & 16711680) >> 16; j += (l & '\uff00') >> 8; diff --git a/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java b/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java index 17c00e52..a983defd 100644 --- a/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java +++ b/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java @@ -4,7 +4,6 @@ import com.google.gson.JsonArray; import com.google.gson.JsonObject; import com.google.gson.JsonPrimitive; -import dev.u9g.minecraftdatagenerator.Main; import dev.u9g.minecraftdatagenerator.mixin.BlockAccessor; import dev.u9g.minecraftdatagenerator.mixin.MiningToolItemAccessor; import dev.u9g.minecraftdatagenerator.util.DGU; @@ -30,11 +29,7 @@ import java.util.Objects; import java.util.logging.Logger; -public class BlocksDataGenerator implements IDataGenerator { - - private static final Logger logger = Main.LOGGER; - - private static List getItemsEffectiveForBlock(Block block) { +public class BlocksDataGenerator implements IDataGenerator {private static List getItemsEffectiveForBlock(Block block) { List items = new ArrayList<>(); for (Item item : Registries.ITEMS) { if (item instanceof ToolItem && ((MiningToolItemAccessor) item).getEffectiveBlocks().contains(block)) { diff --git a/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/IDataGenerator.java b/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/IDataGenerator.java deleted file mode 100644 index 81fe4e20..00000000 --- a/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/IDataGenerator.java +++ /dev/null @@ -1,10 +0,0 @@ -package dev.u9g.minecraftdatagenerator.generators; - -import com.google.gson.JsonElement; - -public interface IDataGenerator { - - String getDataName(); - - JsonElement generateDataJson(); -} diff --git a/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java b/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java index f5608f0a..c1d96581 100644 --- a/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java +++ b/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java @@ -1,7 +1,6 @@ package dev.u9g.minecraftdatagenerator.mixin; -import dev.u9g.minecraftdatagenerator.Main; -import dev.u9g.minecraftdatagenerator.generators.DataGenerators; +import dev.u9g.minecraftdatagenerator.MinecraftDataGenerator; import dev.u9g.minecraftdatagenerator.util.DGU; import net.minecraft.server.dedicated.MinecraftDedicatedServer; import org.spongepowered.asm.mixin.Mixin; @@ -9,19 +8,13 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -import java.nio.file.Path; -import java.util.logging.Level; - @Mixin(MinecraftDedicatedServer.class) public class ReadyMixin { @Inject(method = "setupServer()Z", at = @At("TAIL")) private void init(CallbackInfoReturnable cir) { - Main.LOGGER.info("Starting data generation!"); - String versionName = DGU.getCurrentlyRunningServer().getVersion(); - Path serverRootDirectory = DGU.getCurrentlyRunningServer().getRunDirectory().toPath().toAbsolutePath(); - Path dataDumpDirectory = serverRootDirectory.resolve("minecraft-data").resolve(versionName); - DataGenerators.runDataGenerators(dataDumpDirectory); - Main.LOGGER.info("Done data generation!"); - Runtime.getRuntime().halt(0); + MinecraftDataGenerator.start( + DGU.getCurrentlyRunningServer().getVersion(), + DGU.getCurrentlyRunningServer().getRunDirectory().toPath() + ); } } diff --git a/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java b/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java index bf7137e6..bef2bf1c 100644 --- a/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java +++ b/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java @@ -38,7 +38,6 @@ public void write(JsonWriter out, Number value) throws IOException { } })).create(); - @Environment(EnvType.CLIENT) private static MinecraftServer getCurrentlyRunningServerClient() { return MinecraftClient.getInstance().getServer(); } @@ -58,7 +57,6 @@ public static MinecraftServer getCurrentlyRunningServer() { throw new UnsupportedOperationException(); } - @Environment(EnvType.CLIENT) private static String translateTextClient(String translationKey) { return I18n.translate(translationKey); } diff --git a/1.11.2/src/main/resources/fabric.mod.json b/1.11.2/src/main/resources/fabric.mod.json index 03fbafe0..12f9d70e 100644 --- a/1.11.2/src/main/resources/fabric.mod.json +++ b/1.11.2/src/main/resources/fabric.mod.json @@ -11,16 +11,11 @@ "contact": {}, "license": "MIT", "environment": "server", - "entrypoints": { - "main": [ - "dev.u9g.minecraftdatagenerator.Main" - ] - }, "mixins": [ "minecraft-data-generator.mixins.json" ], "depends": { - "fabricloader": ">=0.13.3", - "minecraft": ">=1.11" + "fabricloader": "*", + "minecraft": "*" } } diff --git a/1.12.2/build.gradle b/1.12.2/build.gradle index 057916c6..a0489215 100644 --- a/1.12.2/build.gradle +++ b/1.12.2/build.gradle @@ -25,6 +25,8 @@ dependencies { // exclude module: "legacy-fabric-entity-events-v1" // } + implementation(projects.common) + if (System.getProperty("os.name").toLowerCase().contains("mac")) { implementation 'org.lwjgl.lwjgl:lwjgl_util:2.9.4-nightly-20150209' implementation 'org.lwjgl.lwjgl:lwjgl:2.9.4-nightly-20150209' diff --git a/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/Main.java b/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/Main.java deleted file mode 100644 index d23c5ba2..00000000 --- a/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/Main.java +++ /dev/null @@ -1,13 +0,0 @@ -package dev.u9g.minecraftdatagenerator; - -import net.fabricmc.api.ModInitializer; - -import java.util.logging.Logger; - -public class Main implements ModInitializer { - public static final Logger LOGGER = Logger.getLogger("mc-data-gen-serv"); - - @Override - public void onInitialize() { - } -} diff --git a/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java b/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java index cdc6711d..3034f408 100644 --- a/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java +++ b/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java @@ -3,7 +3,6 @@ import com.google.common.base.CaseFormat; import com.google.gson.JsonArray; import com.google.gson.JsonObject; -import dev.u9g.minecraftdatagenerator.Main; import dev.u9g.minecraftdatagenerator.mixin.BlockAccessor; import dev.u9g.minecraftdatagenerator.mixin.MiningToolItemAccessor; import dev.u9g.minecraftdatagenerator.util.DGU; @@ -29,11 +28,7 @@ import java.util.Objects; import java.util.logging.Logger; -public class BlocksDataGenerator implements IDataGenerator { - - private static final Logger logger = Main.LOGGER; - - private static List getItemsEffectiveForBlock(Block block) { +public class BlocksDataGenerator implements IDataGenerator {private static List getItemsEffectiveForBlock(Block block) { List items = new ArrayList<>(); for (Item item : Registries.ITEMS) { if (item instanceof ToolItem && ((MiningToolItemAccessor) item).getEffectiveBlocks().contains(block)) { diff --git a/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/DataGenerators.java b/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/DataGenerators.java deleted file mode 100644 index c89d0777..00000000 --- a/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/DataGenerators.java +++ /dev/null @@ -1,81 +0,0 @@ -package dev.u9g.minecraftdatagenerator.generators; - -import com.google.gson.JsonElement; -import com.google.gson.internal.Streams; -import com.google.gson.stream.JsonWriter; -import dev.u9g.minecraftdatagenerator.Main; - -import java.io.IOException; -import java.io.Writer; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.StandardOpenOption; -import java.text.MessageFormat; -import java.util.ArrayList; -import java.util.List; -import java.util.logging.Level; -import java.util.logging.Logger; - -public class DataGenerators { - - private static final List GENERATORS = new ArrayList<>(); - private static final Logger logger = Main.LOGGER; - - static { - register(new BiomesDataGenerator()); - register(new BlockCollisionShapesDataGenerator()); - register(new BlocksDataGenerator()); - register(new EffectsDataGenerator()); - register(new EnchantmentsDataGenerator()); - register(new EntitiesDataGenerator()); - register(new FoodsDataGenerator()); - register(new ItemsDataGenerator()); - register(new ParticlesDataGenerator()); - register(new TintsDataGenerator()); - register(new LanguageDataGenerator()); - register(new InstrumentsDataGenerator()); - register(new AttributesDataGenerator()); - register(new SoundsDataGenerator()); - } - - public static void register(IDataGenerator generator) { - GENERATORS.add(generator); - } - - public static boolean runDataGenerators(Path outputDirectory) { - try { - Files.createDirectories(outputDirectory); - } catch (IOException exception) { - logger.info("Failed to create data generator output directory at " + outputDirectory); - exception.printStackTrace(); - return false; - } - - int generatorsFailed = 0; - logger.info(MessageFormat.format("Running minecraft data generators, output at {0}", outputDirectory)); - - for (IDataGenerator dataGenerator : GENERATORS) { - logger.info(MessageFormat.format("Running generator {0}", dataGenerator.getDataName())); - try { - String outputFileName = String.format("%s.json", dataGenerator.getDataName()); - JsonElement outputElement = dataGenerator.generateDataJson(); - Path outputFilePath = outputDirectory.resolve(outputFileName); - - try (Writer writer = Files.newBufferedWriter(outputFilePath, StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING)) { - JsonWriter jsonWriter = new JsonWriter(writer); - jsonWriter.setIndent(" "); - Streams.write(outputElement, jsonWriter); - } - logger.info(MessageFormat.format("Generator: {0} -> {1}", dataGenerator.getDataName(), outputFileName)); - - } catch (Throwable exception) { - logger.info(MessageFormat.format("Failed to run data generator {0}", dataGenerator.getDataName())); - exception.printStackTrace(); - generatorsFailed++; - } - } - - logger.info("Finishing running data generators"); - return generatorsFailed == 0; - } -} diff --git a/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java b/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java index f5608f0a..c1d96581 100644 --- a/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java +++ b/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java @@ -1,7 +1,6 @@ package dev.u9g.minecraftdatagenerator.mixin; -import dev.u9g.minecraftdatagenerator.Main; -import dev.u9g.minecraftdatagenerator.generators.DataGenerators; +import dev.u9g.minecraftdatagenerator.MinecraftDataGenerator; import dev.u9g.minecraftdatagenerator.util.DGU; import net.minecraft.server.dedicated.MinecraftDedicatedServer; import org.spongepowered.asm.mixin.Mixin; @@ -9,19 +8,13 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -import java.nio.file.Path; -import java.util.logging.Level; - @Mixin(MinecraftDedicatedServer.class) public class ReadyMixin { @Inject(method = "setupServer()Z", at = @At("TAIL")) private void init(CallbackInfoReturnable cir) { - Main.LOGGER.info("Starting data generation!"); - String versionName = DGU.getCurrentlyRunningServer().getVersion(); - Path serverRootDirectory = DGU.getCurrentlyRunningServer().getRunDirectory().toPath().toAbsolutePath(); - Path dataDumpDirectory = serverRootDirectory.resolve("minecraft-data").resolve(versionName); - DataGenerators.runDataGenerators(dataDumpDirectory); - Main.LOGGER.info("Done data generation!"); - Runtime.getRuntime().halt(0); + MinecraftDataGenerator.start( + DGU.getCurrentlyRunningServer().getVersion(), + DGU.getCurrentlyRunningServer().getRunDirectory().toPath() + ); } } diff --git a/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java b/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java index bf7137e6..bef2bf1c 100644 --- a/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java +++ b/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java @@ -38,7 +38,6 @@ public void write(JsonWriter out, Number value) throws IOException { } })).create(); - @Environment(EnvType.CLIENT) private static MinecraftServer getCurrentlyRunningServerClient() { return MinecraftClient.getInstance().getServer(); } @@ -58,7 +57,6 @@ public static MinecraftServer getCurrentlyRunningServer() { throw new UnsupportedOperationException(); } - @Environment(EnvType.CLIENT) private static String translateTextClient(String translationKey) { return I18n.translate(translationKey); } diff --git a/1.12.2/src/main/resources/fabric.mod.json b/1.12.2/src/main/resources/fabric.mod.json index 57c11135..12f9d70e 100644 --- a/1.12.2/src/main/resources/fabric.mod.json +++ b/1.12.2/src/main/resources/fabric.mod.json @@ -11,16 +11,11 @@ "contact": {}, "license": "MIT", "environment": "server", - "entrypoints": { - "main": [ - "dev.u9g.minecraftdatagenerator.Main" - ] - }, "mixins": [ "minecraft-data-generator.mixins.json" ], "depends": { - "fabricloader": ">=0.13.3", - "minecraft": ">=1.12" + "fabricloader": "*", + "minecraft": "*" } } diff --git a/1.13/build.gradle b/1.13/build.gradle index 057916c6..a0489215 100644 --- a/1.13/build.gradle +++ b/1.13/build.gradle @@ -25,6 +25,8 @@ dependencies { // exclude module: "legacy-fabric-entity-events-v1" // } + implementation(projects.common) + if (System.getProperty("os.name").toLowerCase().contains("mac")) { implementation 'org.lwjgl.lwjgl:lwjgl_util:2.9.4-nightly-20150209' implementation 'org.lwjgl.lwjgl:lwjgl:2.9.4-nightly-20150209' diff --git a/1.13/src/main/java/dev/u9g/minecraftdatagenerator/Main.java b/1.13/src/main/java/dev/u9g/minecraftdatagenerator/Main.java deleted file mode 100644 index d23c5ba2..00000000 --- a/1.13/src/main/java/dev/u9g/minecraftdatagenerator/Main.java +++ /dev/null @@ -1,13 +0,0 @@ -package dev.u9g.minecraftdatagenerator; - -import net.fabricmc.api.ModInitializer; - -import java.util.logging.Logger; - -public class Main implements ModInitializer { - public static final Logger LOGGER = Logger.getLogger("mc-data-gen-serv"); - - @Override - public void onInitialize() { - } -} diff --git a/1.13/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java b/1.13/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java index d9d29c7a..65f68c75 100644 --- a/1.13/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java +++ b/1.13/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java @@ -3,7 +3,6 @@ import com.google.common.base.CaseFormat; import com.google.gson.JsonArray; import com.google.gson.JsonObject; -import dev.u9g.minecraftdatagenerator.Main; import dev.u9g.minecraftdatagenerator.mixin.MiningToolItemAccessor; import dev.u9g.minecraftdatagenerator.util.DGU; import dev.u9g.minecraftdatagenerator.util.EmptyBlockView; @@ -29,11 +28,7 @@ import java.util.logging.Logger; import java.util.stream.Collectors; -public class BlocksDataGenerator implements IDataGenerator { - - private static final Logger logger = Main.LOGGER; - - private static List getItemsEffectiveForBlock(Block block) { +public class BlocksDataGenerator implements IDataGenerator {private static List getItemsEffectiveForBlock(Block block) { return Registry.ITEM.stream() .filter(item -> item instanceof ToolItem) .filter(item -> ((MiningToolItemAccessor) item).getEffectiveBlocks().contains(block)) diff --git a/1.13/src/main/java/dev/u9g/minecraftdatagenerator/generators/DataGenerators.java b/1.13/src/main/java/dev/u9g/minecraftdatagenerator/generators/DataGenerators.java deleted file mode 100644 index 40660b6c..00000000 --- a/1.13/src/main/java/dev/u9g/minecraftdatagenerator/generators/DataGenerators.java +++ /dev/null @@ -1,80 +0,0 @@ -package dev.u9g.minecraftdatagenerator.generators; - -import com.google.gson.JsonElement; -import com.google.gson.internal.Streams; -import com.google.gson.stream.JsonWriter; -import dev.u9g.minecraftdatagenerator.Main; - -import java.io.IOException; -import java.io.Writer; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.StandardOpenOption; -import java.text.MessageFormat; -import java.util.ArrayList; -import java.util.List; -import java.util.logging.Level; -import java.util.logging.Logger; - -public class DataGenerators { - - private static final List GENERATORS = new ArrayList<>(); - private static final Logger logger = Main.LOGGER; - - static { - register(new BiomesDataGenerator()); - register(new BlockCollisionShapesDataGenerator()); - register(new BlocksDataGenerator()); - register(new EffectsDataGenerator()); - register(new EnchantmentsDataGenerator()); - register(new EntitiesDataGenerator()); - register(new FoodsDataGenerator()); - register(new ItemsDataGenerator()); - register(new ParticlesDataGenerator()); - register(new TintsDataGenerator()); - register(new LanguageDataGenerator()); - register(new InstrumentsDataGenerator()); - register(new SoundsDataGenerator()); - } - - public static void register(IDataGenerator generator) { - GENERATORS.add(generator); - } - - public static boolean runDataGenerators(Path outputDirectory) { - try { - Files.createDirectories(outputDirectory); - } catch (IOException exception) { - logger.info("Failed to create data generator output directory at " + outputDirectory); - exception.printStackTrace(); - return false; - } - - int generatorsFailed = 0; - logger.info(MessageFormat.format("Running minecraft data generators, output at {0}", outputDirectory)); - - for (IDataGenerator dataGenerator : GENERATORS) { - logger.info(MessageFormat.format("Running generator {0}", dataGenerator.getDataName())); - try { - String outputFileName = String.format("%s.json", dataGenerator.getDataName()); - JsonElement outputElement = dataGenerator.generateDataJson(); - Path outputFilePath = outputDirectory.resolve(outputFileName); - - try (Writer writer = Files.newBufferedWriter(outputFilePath, StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING)) { - JsonWriter jsonWriter = new JsonWriter(writer); - jsonWriter.setIndent(" "); - Streams.write(outputElement, jsonWriter); - } - logger.info(MessageFormat.format("Generator: {0} -> {1}", dataGenerator.getDataName(), outputFileName)); - - } catch (Throwable exception) { - logger.info(MessageFormat.format("Failed to run data generator {0}", dataGenerator.getDataName())); - exception.printStackTrace(); - generatorsFailed++; - } - } - - logger.info("Finishing running data generators"); - return generatorsFailed == 0; - } -} diff --git a/1.13/src/main/java/dev/u9g/minecraftdatagenerator/generators/IDataGenerator.java b/1.13/src/main/java/dev/u9g/minecraftdatagenerator/generators/IDataGenerator.java deleted file mode 100644 index 81fe4e20..00000000 --- a/1.13/src/main/java/dev/u9g/minecraftdatagenerator/generators/IDataGenerator.java +++ /dev/null @@ -1,10 +0,0 @@ -package dev.u9g.minecraftdatagenerator.generators; - -import com.google.gson.JsonElement; - -public interface IDataGenerator { - - String getDataName(); - - JsonElement generateDataJson(); -} diff --git a/1.13/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java b/1.13/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java index f5608f0a..c1d96581 100644 --- a/1.13/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java +++ b/1.13/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java @@ -1,7 +1,6 @@ package dev.u9g.minecraftdatagenerator.mixin; -import dev.u9g.minecraftdatagenerator.Main; -import dev.u9g.minecraftdatagenerator.generators.DataGenerators; +import dev.u9g.minecraftdatagenerator.MinecraftDataGenerator; import dev.u9g.minecraftdatagenerator.util.DGU; import net.minecraft.server.dedicated.MinecraftDedicatedServer; import org.spongepowered.asm.mixin.Mixin; @@ -9,19 +8,13 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -import java.nio.file.Path; -import java.util.logging.Level; - @Mixin(MinecraftDedicatedServer.class) public class ReadyMixin { @Inject(method = "setupServer()Z", at = @At("TAIL")) private void init(CallbackInfoReturnable cir) { - Main.LOGGER.info("Starting data generation!"); - String versionName = DGU.getCurrentlyRunningServer().getVersion(); - Path serverRootDirectory = DGU.getCurrentlyRunningServer().getRunDirectory().toPath().toAbsolutePath(); - Path dataDumpDirectory = serverRootDirectory.resolve("minecraft-data").resolve(versionName); - DataGenerators.runDataGenerators(dataDumpDirectory); - Main.LOGGER.info("Done data generation!"); - Runtime.getRuntime().halt(0); + MinecraftDataGenerator.start( + DGU.getCurrentlyRunningServer().getVersion(), + DGU.getCurrentlyRunningServer().getRunDirectory().toPath() + ); } } diff --git a/1.13/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java b/1.13/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java index 4ce9292c..10a2da6a 100644 --- a/1.13/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java +++ b/1.13/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java @@ -17,7 +17,6 @@ public class DGU { private static final Language language = Language.getInstance(); - @Environment(EnvType.CLIENT) private static MinecraftServer getCurrentlyRunningServerClient() { return MinecraftClient.getInstance().getServer(); } @@ -37,7 +36,6 @@ public static MinecraftServer getCurrentlyRunningServer() { throw new UnsupportedOperationException(); } - @Environment(EnvType.CLIENT) private static String translateTextClient(String translationKey) { return I18n.translate(translationKey); } diff --git a/1.13/src/main/resources/fabric.mod.json b/1.13/src/main/resources/fabric.mod.json index 1bd022a0..12f9d70e 100644 --- a/1.13/src/main/resources/fabric.mod.json +++ b/1.13/src/main/resources/fabric.mod.json @@ -11,16 +11,11 @@ "contact": {}, "license": "MIT", "environment": "server", - "entrypoints": { - "main": [ - "dev.u9g.minecraftdatagenerator.Main" - ] - }, "mixins": [ "minecraft-data-generator.mixins.json" ], "depends": { - "fabricloader": ">=0.13.3", - "minecraft": ">=1.13" + "fabricloader": "*", + "minecraft": "*" } } diff --git a/1.14/build.gradle b/1.14/build.gradle index d7f2e703..13f2b0b7 100644 --- a/1.14/build.gradle +++ b/1.14/build.gradle @@ -10,6 +10,8 @@ dependencies { // Fabric API. This is technically optional, but you probably want it anyway. modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" + + implementation(projects.common) } processResources { diff --git a/1.14/src/main/java/dev/u9g/minecraftdatagenerator/Main.java b/1.14/src/main/java/dev/u9g/minecraftdatagenerator/Main.java deleted file mode 100644 index 52a20201..00000000 --- a/1.14/src/main/java/dev/u9g/minecraftdatagenerator/Main.java +++ /dev/null @@ -1,14 +0,0 @@ -package dev.u9g.minecraftdatagenerator; - -import net.fabricmc.api.ModInitializer; - -import java.util.logging.Logger; - -public class Main implements ModInitializer { - public static final Logger LOGGER = Logger.getLogger("mc-data-gen-serv"); - - @Override - public void onInitialize() { - - } -} diff --git a/1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java b/1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java index 6c47c0e2..19e7653e 100644 --- a/1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java +++ b/1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java @@ -3,7 +3,6 @@ import com.google.common.base.CaseFormat; import com.google.gson.JsonArray; import com.google.gson.JsonObject; -import dev.u9g.minecraftdatagenerator.Main; import dev.u9g.minecraftdatagenerator.mixin.MiningToolItemAccessor; import dev.u9g.minecraftdatagenerator.util.DGU; import net.minecraft.block.AirBlock; @@ -32,11 +31,7 @@ import java.util.logging.Logger; import java.util.stream.Collectors; -public class BlocksDataGenerator implements IDataGenerator { - - private static final Logger logger = Main.LOGGER; - - private static List getItemsEffectiveForBlock(Block block) { +public class BlocksDataGenerator implements IDataGenerator {private static List getItemsEffectiveForBlock(Block block) { return Registry.ITEM.stream() .filter(item -> item instanceof MiningToolItem) .filter(item -> ((MiningToolItemAccessor) item).getEffectiveBlocks().contains(block)) diff --git a/1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/DataGenerators.java b/1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/DataGenerators.java deleted file mode 100644 index 40660b6c..00000000 --- a/1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/DataGenerators.java +++ /dev/null @@ -1,80 +0,0 @@ -package dev.u9g.minecraftdatagenerator.generators; - -import com.google.gson.JsonElement; -import com.google.gson.internal.Streams; -import com.google.gson.stream.JsonWriter; -import dev.u9g.minecraftdatagenerator.Main; - -import java.io.IOException; -import java.io.Writer; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.StandardOpenOption; -import java.text.MessageFormat; -import java.util.ArrayList; -import java.util.List; -import java.util.logging.Level; -import java.util.logging.Logger; - -public class DataGenerators { - - private static final List GENERATORS = new ArrayList<>(); - private static final Logger logger = Main.LOGGER; - - static { - register(new BiomesDataGenerator()); - register(new BlockCollisionShapesDataGenerator()); - register(new BlocksDataGenerator()); - register(new EffectsDataGenerator()); - register(new EnchantmentsDataGenerator()); - register(new EntitiesDataGenerator()); - register(new FoodsDataGenerator()); - register(new ItemsDataGenerator()); - register(new ParticlesDataGenerator()); - register(new TintsDataGenerator()); - register(new LanguageDataGenerator()); - register(new InstrumentsDataGenerator()); - register(new SoundsDataGenerator()); - } - - public static void register(IDataGenerator generator) { - GENERATORS.add(generator); - } - - public static boolean runDataGenerators(Path outputDirectory) { - try { - Files.createDirectories(outputDirectory); - } catch (IOException exception) { - logger.info("Failed to create data generator output directory at " + outputDirectory); - exception.printStackTrace(); - return false; - } - - int generatorsFailed = 0; - logger.info(MessageFormat.format("Running minecraft data generators, output at {0}", outputDirectory)); - - for (IDataGenerator dataGenerator : GENERATORS) { - logger.info(MessageFormat.format("Running generator {0}", dataGenerator.getDataName())); - try { - String outputFileName = String.format("%s.json", dataGenerator.getDataName()); - JsonElement outputElement = dataGenerator.generateDataJson(); - Path outputFilePath = outputDirectory.resolve(outputFileName); - - try (Writer writer = Files.newBufferedWriter(outputFilePath, StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING)) { - JsonWriter jsonWriter = new JsonWriter(writer); - jsonWriter.setIndent(" "); - Streams.write(outputElement, jsonWriter); - } - logger.info(MessageFormat.format("Generator: {0} -> {1}", dataGenerator.getDataName(), outputFileName)); - - } catch (Throwable exception) { - logger.info(MessageFormat.format("Failed to run data generator {0}", dataGenerator.getDataName())); - exception.printStackTrace(); - generatorsFailed++; - } - } - - logger.info("Finishing running data generators"); - return generatorsFailed == 0; - } -} diff --git a/1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/IDataGenerator.java b/1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/IDataGenerator.java deleted file mode 100644 index 81fe4e20..00000000 --- a/1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/IDataGenerator.java +++ /dev/null @@ -1,10 +0,0 @@ -package dev.u9g.minecraftdatagenerator.generators; - -import com.google.gson.JsonElement; - -public interface IDataGenerator { - - String getDataName(); - - JsonElement generateDataJson(); -} diff --git a/1.14/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java b/1.14/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java index 53d51123..af7e9c10 100644 --- a/1.14/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java +++ b/1.14/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java @@ -1,7 +1,6 @@ package dev.u9g.minecraftdatagenerator.mixin; -import dev.u9g.minecraftdatagenerator.Main; -import dev.u9g.minecraftdatagenerator.generators.DataGenerators; +import dev.u9g.minecraftdatagenerator.MinecraftDataGenerator; import dev.u9g.minecraftdatagenerator.util.DGU; import net.minecraft.MinecraftVersion; import net.minecraft.server.dedicated.MinecraftDedicatedServer; @@ -10,19 +9,13 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -import java.nio.file.Path; -import java.util.logging.Level; - @Mixin(MinecraftDedicatedServer.class) public class ReadyMixin { @Inject(method = "setupServer()Z", at = @At("TAIL")) private void init(CallbackInfoReturnable cir) { - Main.LOGGER.info("Starting data generation!"); - String versionName = MinecraftVersion.create().getName(); - Path serverRootDirectory = DGU.getCurrentlyRunningServer().getRunDirectory().toPath().toAbsolutePath(); - Path dataDumpDirectory = serverRootDirectory.resolve("minecraft-data").resolve(versionName); - DataGenerators.runDataGenerators(dataDumpDirectory); - Main.LOGGER.info("Done data generation!"); - Runtime.getRuntime().halt(0); + MinecraftDataGenerator.start( + MinecraftVersion.create().getName(), + DGU.getCurrentlyRunningServer().getRunDirectory().toPath() + ); } } diff --git a/1.14/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java b/1.14/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java index d85a31d6..1a416ff1 100644 --- a/1.14/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java +++ b/1.14/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java @@ -17,7 +17,6 @@ public class DGU { private static final Language language = Language.getInstance(); - @Environment(EnvType.CLIENT) private static MinecraftServer getCurrentlyRunningServerClient() { return MinecraftClient.getInstance().getServer(); } @@ -37,7 +36,6 @@ public static MinecraftServer getCurrentlyRunningServer() { throw new UnsupportedOperationException(); } - @Environment(EnvType.CLIENT) private static String translateTextClient(String translationKey) { return I18n.translate(translationKey); } diff --git a/1.14/src/main/resources/fabric.mod.json b/1.14/src/main/resources/fabric.mod.json index 060b2637..dff18a06 100644 --- a/1.14/src/main/resources/fabric.mod.json +++ b/1.14/src/main/resources/fabric.mod.json @@ -11,17 +11,12 @@ "contact": {}, "license": "MIT", "environment": "server", - "entrypoints": { - "main": [ - "dev.u9g.minecraftdatagenerator.Main" - ] - }, "mixins": [ "minecraft-data-generator.mixins.json" ], "depends": { - "fabricloader": ">=0.13.3", + "fabricloader": "*", "fabric": "*", - "minecraft": "1.14" + "minecraft": "*" } } diff --git a/1.15/build.gradle b/1.15/build.gradle index e85de392..73e874d0 100644 --- a/1.15/build.gradle +++ b/1.15/build.gradle @@ -10,6 +10,8 @@ dependencies { // Fabric API. This is technically optional, but you probably want it anyway. modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" + + implementation(projects.common) } processResources { diff --git a/1.15/src/main/java/dev/u9g/minecraftdatagenerator/Main.java b/1.15/src/main/java/dev/u9g/minecraftdatagenerator/Main.java deleted file mode 100644 index 52a20201..00000000 --- a/1.15/src/main/java/dev/u9g/minecraftdatagenerator/Main.java +++ /dev/null @@ -1,14 +0,0 @@ -package dev.u9g.minecraftdatagenerator; - -import net.fabricmc.api.ModInitializer; - -import java.util.logging.Logger; - -public class Main implements ModInitializer { - public static final Logger LOGGER = Logger.getLogger("mc-data-gen-serv"); - - @Override - public void onInitialize() { - - } -} diff --git a/1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java b/1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java index e20bb439..fbcee6fd 100644 --- a/1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java +++ b/1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java @@ -3,7 +3,6 @@ import com.google.common.base.CaseFormat; import com.google.gson.JsonArray; import com.google.gson.JsonObject; -import dev.u9g.minecraftdatagenerator.Main; import dev.u9g.minecraftdatagenerator.mixin.MiningToolItemAccessor; import dev.u9g.minecraftdatagenerator.util.DGU; import net.minecraft.block.AirBlock; @@ -29,11 +28,7 @@ import java.util.logging.Logger; import java.util.stream.Collectors; -public class BlocksDataGenerator implements IDataGenerator { - - private static final Logger logger = Main.LOGGER; - - private static List getItemsEffectiveForBlock(Block block) { +public class BlocksDataGenerator implements IDataGenerator {private static List getItemsEffectiveForBlock(Block block) { return Registry.ITEM.stream() .filter(item -> item instanceof MiningToolItem) .filter(item -> ((MiningToolItemAccessor) item).getEffectiveBlocks().contains(block)) diff --git a/1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/DataGenerators.java b/1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/DataGenerators.java deleted file mode 100644 index 40660b6c..00000000 --- a/1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/DataGenerators.java +++ /dev/null @@ -1,80 +0,0 @@ -package dev.u9g.minecraftdatagenerator.generators; - -import com.google.gson.JsonElement; -import com.google.gson.internal.Streams; -import com.google.gson.stream.JsonWriter; -import dev.u9g.minecraftdatagenerator.Main; - -import java.io.IOException; -import java.io.Writer; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.StandardOpenOption; -import java.text.MessageFormat; -import java.util.ArrayList; -import java.util.List; -import java.util.logging.Level; -import java.util.logging.Logger; - -public class DataGenerators { - - private static final List GENERATORS = new ArrayList<>(); - private static final Logger logger = Main.LOGGER; - - static { - register(new BiomesDataGenerator()); - register(new BlockCollisionShapesDataGenerator()); - register(new BlocksDataGenerator()); - register(new EffectsDataGenerator()); - register(new EnchantmentsDataGenerator()); - register(new EntitiesDataGenerator()); - register(new FoodsDataGenerator()); - register(new ItemsDataGenerator()); - register(new ParticlesDataGenerator()); - register(new TintsDataGenerator()); - register(new LanguageDataGenerator()); - register(new InstrumentsDataGenerator()); - register(new SoundsDataGenerator()); - } - - public static void register(IDataGenerator generator) { - GENERATORS.add(generator); - } - - public static boolean runDataGenerators(Path outputDirectory) { - try { - Files.createDirectories(outputDirectory); - } catch (IOException exception) { - logger.info("Failed to create data generator output directory at " + outputDirectory); - exception.printStackTrace(); - return false; - } - - int generatorsFailed = 0; - logger.info(MessageFormat.format("Running minecraft data generators, output at {0}", outputDirectory)); - - for (IDataGenerator dataGenerator : GENERATORS) { - logger.info(MessageFormat.format("Running generator {0}", dataGenerator.getDataName())); - try { - String outputFileName = String.format("%s.json", dataGenerator.getDataName()); - JsonElement outputElement = dataGenerator.generateDataJson(); - Path outputFilePath = outputDirectory.resolve(outputFileName); - - try (Writer writer = Files.newBufferedWriter(outputFilePath, StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING)) { - JsonWriter jsonWriter = new JsonWriter(writer); - jsonWriter.setIndent(" "); - Streams.write(outputElement, jsonWriter); - } - logger.info(MessageFormat.format("Generator: {0} -> {1}", dataGenerator.getDataName(), outputFileName)); - - } catch (Throwable exception) { - logger.info(MessageFormat.format("Failed to run data generator {0}", dataGenerator.getDataName())); - exception.printStackTrace(); - generatorsFailed++; - } - } - - logger.info("Finishing running data generators"); - return generatorsFailed == 0; - } -} diff --git a/1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/IDataGenerator.java b/1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/IDataGenerator.java deleted file mode 100644 index 81fe4e20..00000000 --- a/1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/IDataGenerator.java +++ /dev/null @@ -1,10 +0,0 @@ -package dev.u9g.minecraftdatagenerator.generators; - -import com.google.gson.JsonElement; - -public interface IDataGenerator { - - String getDataName(); - - JsonElement generateDataJson(); -} diff --git a/1.15/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java b/1.15/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java index 53d51123..af7e9c10 100644 --- a/1.15/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java +++ b/1.15/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java @@ -1,7 +1,6 @@ package dev.u9g.minecraftdatagenerator.mixin; -import dev.u9g.minecraftdatagenerator.Main; -import dev.u9g.minecraftdatagenerator.generators.DataGenerators; +import dev.u9g.minecraftdatagenerator.MinecraftDataGenerator; import dev.u9g.minecraftdatagenerator.util.DGU; import net.minecraft.MinecraftVersion; import net.minecraft.server.dedicated.MinecraftDedicatedServer; @@ -10,19 +9,13 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -import java.nio.file.Path; -import java.util.logging.Level; - @Mixin(MinecraftDedicatedServer.class) public class ReadyMixin { @Inject(method = "setupServer()Z", at = @At("TAIL")) private void init(CallbackInfoReturnable cir) { - Main.LOGGER.info("Starting data generation!"); - String versionName = MinecraftVersion.create().getName(); - Path serverRootDirectory = DGU.getCurrentlyRunningServer().getRunDirectory().toPath().toAbsolutePath(); - Path dataDumpDirectory = serverRootDirectory.resolve("minecraft-data").resolve(versionName); - DataGenerators.runDataGenerators(dataDumpDirectory); - Main.LOGGER.info("Done data generation!"); - Runtime.getRuntime().halt(0); + MinecraftDataGenerator.start( + MinecraftVersion.create().getName(), + DGU.getCurrentlyRunningServer().getRunDirectory().toPath() + ); } } diff --git a/1.15/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java b/1.15/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java index c5cdc360..c91347a8 100644 --- a/1.15/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java +++ b/1.15/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java @@ -17,7 +17,6 @@ public class DGU { private static final Language language = Language.getInstance(); - @Environment(EnvType.CLIENT) private static MinecraftServer getCurrentlyRunningServerClient() { return MinecraftClient.getInstance().getServer(); } @@ -37,7 +36,6 @@ public static MinecraftServer getCurrentlyRunningServer() { throw new UnsupportedOperationException(); } - @Environment(EnvType.CLIENT) private static String translateTextClient(String translationKey) { return I18n.translate(translationKey); } diff --git a/1.15/src/main/resources/fabric.mod.json b/1.15/src/main/resources/fabric.mod.json index 3ee60ac5..dff18a06 100644 --- a/1.15/src/main/resources/fabric.mod.json +++ b/1.15/src/main/resources/fabric.mod.json @@ -11,17 +11,12 @@ "contact": {}, "license": "MIT", "environment": "server", - "entrypoints": { - "main": [ - "dev.u9g.minecraftdatagenerator.Main" - ] - }, "mixins": [ "minecraft-data-generator.mixins.json" ], "depends": { - "fabricloader": ">=0.13.3", + "fabricloader": "*", "fabric": "*", - "minecraft": "1.15" + "minecraft": "*" } } diff --git a/1.16/build.gradle b/1.16/build.gradle index e85de392..73e874d0 100644 --- a/1.16/build.gradle +++ b/1.16/build.gradle @@ -10,6 +10,8 @@ dependencies { // Fabric API. This is technically optional, but you probably want it anyway. modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" + + implementation(projects.common) } processResources { diff --git a/1.16/src/main/java/dev/u9g/minecraftdatagenerator/Main.java b/1.16/src/main/java/dev/u9g/minecraftdatagenerator/Main.java deleted file mode 100644 index 52a20201..00000000 --- a/1.16/src/main/java/dev/u9g/minecraftdatagenerator/Main.java +++ /dev/null @@ -1,14 +0,0 @@ -package dev.u9g.minecraftdatagenerator; - -import net.fabricmc.api.ModInitializer; - -import java.util.logging.Logger; - -public class Main implements ModInitializer { - public static final Logger LOGGER = Logger.getLogger("mc-data-gen-serv"); - - @Override - public void onInitialize() { - - } -} diff --git a/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java b/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java index d5c7ca00..abe26bf3 100644 --- a/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java +++ b/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java @@ -3,7 +3,6 @@ import com.google.common.base.CaseFormat; import com.google.gson.JsonArray; import com.google.gson.JsonObject; -import dev.u9g.minecraftdatagenerator.Main; import dev.u9g.minecraftdatagenerator.mixin.MiningToolItemAccessor; import dev.u9g.minecraftdatagenerator.util.DGU; import net.minecraft.block.AirBlock; @@ -32,11 +31,7 @@ import java.util.logging.Logger; import java.util.stream.Collectors; -public class BlocksDataGenerator implements IDataGenerator { - - private static final Logger logger = Main.LOGGER; - - private static List getItemsEffectiveForBlock(Block block) { +public class BlocksDataGenerator implements IDataGenerator {private static List getItemsEffectiveForBlock(Block block) { return Registry.ITEM.stream() .filter(item -> item instanceof MiningToolItem) .filter(item -> ((MiningToolItemAccessor) item).getEffectiveBlocks().contains(block)) diff --git a/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/DataGenerators.java b/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/DataGenerators.java deleted file mode 100644 index 40660b6c..00000000 --- a/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/DataGenerators.java +++ /dev/null @@ -1,80 +0,0 @@ -package dev.u9g.minecraftdatagenerator.generators; - -import com.google.gson.JsonElement; -import com.google.gson.internal.Streams; -import com.google.gson.stream.JsonWriter; -import dev.u9g.minecraftdatagenerator.Main; - -import java.io.IOException; -import java.io.Writer; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.StandardOpenOption; -import java.text.MessageFormat; -import java.util.ArrayList; -import java.util.List; -import java.util.logging.Level; -import java.util.logging.Logger; - -public class DataGenerators { - - private static final List GENERATORS = new ArrayList<>(); - private static final Logger logger = Main.LOGGER; - - static { - register(new BiomesDataGenerator()); - register(new BlockCollisionShapesDataGenerator()); - register(new BlocksDataGenerator()); - register(new EffectsDataGenerator()); - register(new EnchantmentsDataGenerator()); - register(new EntitiesDataGenerator()); - register(new FoodsDataGenerator()); - register(new ItemsDataGenerator()); - register(new ParticlesDataGenerator()); - register(new TintsDataGenerator()); - register(new LanguageDataGenerator()); - register(new InstrumentsDataGenerator()); - register(new SoundsDataGenerator()); - } - - public static void register(IDataGenerator generator) { - GENERATORS.add(generator); - } - - public static boolean runDataGenerators(Path outputDirectory) { - try { - Files.createDirectories(outputDirectory); - } catch (IOException exception) { - logger.info("Failed to create data generator output directory at " + outputDirectory); - exception.printStackTrace(); - return false; - } - - int generatorsFailed = 0; - logger.info(MessageFormat.format("Running minecraft data generators, output at {0}", outputDirectory)); - - for (IDataGenerator dataGenerator : GENERATORS) { - logger.info(MessageFormat.format("Running generator {0}", dataGenerator.getDataName())); - try { - String outputFileName = String.format("%s.json", dataGenerator.getDataName()); - JsonElement outputElement = dataGenerator.generateDataJson(); - Path outputFilePath = outputDirectory.resolve(outputFileName); - - try (Writer writer = Files.newBufferedWriter(outputFilePath, StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING)) { - JsonWriter jsonWriter = new JsonWriter(writer); - jsonWriter.setIndent(" "); - Streams.write(outputElement, jsonWriter); - } - logger.info(MessageFormat.format("Generator: {0} -> {1}", dataGenerator.getDataName(), outputFileName)); - - } catch (Throwable exception) { - logger.info(MessageFormat.format("Failed to run data generator {0}", dataGenerator.getDataName())); - exception.printStackTrace(); - generatorsFailed++; - } - } - - logger.info("Finishing running data generators"); - return generatorsFailed == 0; - } -} diff --git a/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/IDataGenerator.java b/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/IDataGenerator.java deleted file mode 100644 index 81fe4e20..00000000 --- a/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/IDataGenerator.java +++ /dev/null @@ -1,10 +0,0 @@ -package dev.u9g.minecraftdatagenerator.generators; - -import com.google.gson.JsonElement; - -public interface IDataGenerator { - - String getDataName(); - - JsonElement generateDataJson(); -} diff --git a/1.16/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java b/1.16/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java index 3fe886a3..4ba04e43 100644 --- a/1.16/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java +++ b/1.16/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java @@ -1,7 +1,6 @@ package dev.u9g.minecraftdatagenerator.mixin; -import dev.u9g.minecraftdatagenerator.Main; -import dev.u9g.minecraftdatagenerator.generators.DataGenerators; +import dev.u9g.minecraftdatagenerator.MinecraftDataGenerator; import dev.u9g.minecraftdatagenerator.util.DGU; import net.minecraft.MinecraftVersion; import net.minecraft.server.dedicated.MinecraftDedicatedServer; @@ -10,19 +9,13 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -import java.nio.file.Path; -import java.util.logging.Level; - @Mixin(MinecraftDedicatedServer.class) public class ReadyMixin { @Inject(method = "setupServer()Z", at = @At("TAIL")) private void init(CallbackInfoReturnable cir) { - Main.LOGGER.info("Starting data generation!"); - String versionName = MinecraftVersion.field_25319.getName(); - Path serverRootDirectory = DGU.getCurrentlyRunningServer().getRunDirectory().toPath().toAbsolutePath(); - Path dataDumpDirectory = serverRootDirectory.resolve("minecraft-data").resolve(versionName); - DataGenerators.runDataGenerators(dataDumpDirectory); - Main.LOGGER.info("Done data generation!"); - Runtime.getRuntime().halt(0); + MinecraftDataGenerator.start( + MinecraftVersion.field_25319.getName(), + DGU.getCurrentlyRunningServer().getRunDirectory().toPath() + ); } } diff --git a/1.16/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java b/1.16/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java index 91eed91b..05841318 100644 --- a/1.16/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java +++ b/1.16/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java @@ -14,7 +14,6 @@ public class DGU { private static final Language language = Language.getInstance(); - @Environment(EnvType.CLIENT) private static MinecraftServer getCurrentlyRunningServerClient() { return MinecraftClient.getInstance().getServer(); } @@ -34,7 +33,6 @@ public static MinecraftServer getCurrentlyRunningServer() { throw new UnsupportedOperationException(); } - @Environment(EnvType.CLIENT) private static String translateTextClient(String translationKey) { return I18n.translate(translationKey); } diff --git a/1.16/src/main/resources/fabric.mod.json b/1.16/src/main/resources/fabric.mod.json index 9d668672..dff18a06 100644 --- a/1.16/src/main/resources/fabric.mod.json +++ b/1.16/src/main/resources/fabric.mod.json @@ -11,17 +11,12 @@ "contact": {}, "license": "MIT", "environment": "server", - "entrypoints": { - "main": [ - "dev.u9g.minecraftdatagenerator.Main" - ] - }, "mixins": [ "minecraft-data-generator.mixins.json" ], "depends": { - "fabricloader": ">=0.13.3", + "fabricloader": "*", "fabric": "*", - "minecraft": "1.16" + "minecraft": "*" } } diff --git a/1.17/build.gradle b/1.17/build.gradle index e85de392..73e874d0 100644 --- a/1.17/build.gradle +++ b/1.17/build.gradle @@ -10,6 +10,8 @@ dependencies { // Fabric API. This is technically optional, but you probably want it anyway. modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" + + implementation(projects.common) } processResources { diff --git a/1.17/src/main/java/dev/u9g/minecraftdatagenerator/Main.java b/1.17/src/main/java/dev/u9g/minecraftdatagenerator/Main.java deleted file mode 100644 index f8d17372..00000000 --- a/1.17/src/main/java/dev/u9g/minecraftdatagenerator/Main.java +++ /dev/null @@ -1,14 +0,0 @@ -package dev.u9g.minecraftdatagenerator; - -import net.fabricmc.api.ModInitializer; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class Main implements ModInitializer { - public static final Logger LOGGER = LoggerFactory.getLogger("mc-data-gen-serv"); - - @Override - public void onInitialize() { - - } -} diff --git a/1.17/src/main/java/dev/u9g/minecraftdatagenerator/generators/DataGenerators.java b/1.17/src/main/java/dev/u9g/minecraftdatagenerator/generators/DataGenerators.java deleted file mode 100644 index 04792b72..00000000 --- a/1.17/src/main/java/dev/u9g/minecraftdatagenerator/generators/DataGenerators.java +++ /dev/null @@ -1,79 +0,0 @@ -package dev.u9g.minecraftdatagenerator.generators; - -import com.google.gson.JsonElement; -import com.google.gson.internal.Streams; -import com.google.gson.stream.JsonWriter; -import org.lwjgl.system.CallbackI; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.IOException; -import java.io.Writer; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.StandardOpenOption; -import java.util.ArrayList; -import java.util.List; - -public class DataGenerators { - - private static final Logger logger = LoggerFactory.getLogger(DataGenerators.class); - private static final List GENERATORS = new ArrayList<>(); - - static { - register(new BiomesDataGenerator()); - register(new BlockCollisionShapesDataGenerator()); - register(new BlocksDataGenerator()); - register(new EffectsDataGenerator()); - register(new EnchantmentsDataGenerator()); - register(new EntitiesDataGenerator()); - register(new FoodsDataGenerator()); - register(new ItemsDataGenerator()); - register(new ParticlesDataGenerator()); - register(new TintsDataGenerator()); - register(new MaterialsDataGenerator()); -// register(new RecipeDataGenerator()); - On hold until mcdata supports multiple materials for a recipe - register(new LanguageDataGenerator()); - register(new InstrumentsDataGenerator()); - register(new SoundsDataGenerator()); - } - - public static void register(IDataGenerator generator) { - GENERATORS.add(generator); - } - - public static boolean runDataGenerators(Path outputDirectory) { - try { - Files.createDirectories(outputDirectory); - } catch (IOException exception) { - logger.error("Failed to create data generator output directory at {}", outputDirectory, exception); - return false; - } - - int generatorsFailed = 0; - logger.info("Running minecraft data generators, output at {}", outputDirectory); - - for (IDataGenerator dataGenerator : GENERATORS) { - logger.info("Running generator {}", dataGenerator.getDataName()); - try { - String outputFileName = String.format("%s.json", dataGenerator.getDataName()); - JsonElement outputElement = dataGenerator.generateDataJson(); - Path outputFilePath = outputDirectory.resolve(outputFileName); - - try (Writer writer = Files.newBufferedWriter(outputFilePath, StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING)) { - JsonWriter jsonWriter = new JsonWriter(writer); - jsonWriter.setIndent(" "); - Streams.write(outputElement, jsonWriter); - } - logger.info("Generator: {} -> {}", dataGenerator.getDataName(), outputFileName); - - } catch (Throwable exception) { - logger.error("Failed to run data generator {}", dataGenerator.getDataName(), exception); - generatorsFailed++; - } - } - - logger.info("Finishing running data generators"); - return generatorsFailed == 0; - } -} diff --git a/1.17/src/main/java/dev/u9g/minecraftdatagenerator/generators/IDataGenerator.java b/1.17/src/main/java/dev/u9g/minecraftdatagenerator/generators/IDataGenerator.java deleted file mode 100644 index 81fe4e20..00000000 --- a/1.17/src/main/java/dev/u9g/minecraftdatagenerator/generators/IDataGenerator.java +++ /dev/null @@ -1,10 +0,0 @@ -package dev.u9g.minecraftdatagenerator.generators; - -import com.google.gson.JsonElement; - -public interface IDataGenerator { - - String getDataName(); - - JsonElement generateDataJson(); -} diff --git a/1.17/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java b/1.17/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java index b0b039f7..759563e2 100644 --- a/1.17/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java +++ b/1.17/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java @@ -1,7 +1,6 @@ package dev.u9g.minecraftdatagenerator.mixin; -import dev.u9g.minecraftdatagenerator.Main; -import dev.u9g.minecraftdatagenerator.generators.DataGenerators; +import dev.u9g.minecraftdatagenerator.MinecraftDataGenerator; import dev.u9g.minecraftdatagenerator.util.DGU; import net.minecraft.MinecraftVersion; import net.minecraft.server.dedicated.MinecraftDedicatedServer; @@ -10,18 +9,13 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -import java.nio.file.Path; - @Mixin(MinecraftDedicatedServer.class) public class ReadyMixin { @Inject(method = "setupServer()Z", at = @At("TAIL")) private void init(CallbackInfoReturnable cir) { - Main.LOGGER.info("Starting data generation!"); - String versionName = MinecraftVersion.GAME_VERSION.getName(); - Path serverRootDirectory = DGU.getCurrentlyRunningServer().getRunDirectory().toPath().toAbsolutePath(); - Path dataDumpDirectory = serverRootDirectory.resolve("minecraft-data").resolve(versionName); - DataGenerators.runDataGenerators(dataDumpDirectory); - Main.LOGGER.info("Done data generation!"); - Runtime.getRuntime().halt(0); + MinecraftDataGenerator.start( + MinecraftVersion.GAME_VERSION.getName(), + DGU.getCurrentlyRunningServer().getRunDirectory().toPath() + ); } } diff --git a/1.17/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java b/1.17/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java index 5945fa02..bd5ea21d 100644 --- a/1.17/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java +++ b/1.17/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java @@ -13,7 +13,6 @@ public class DGU { private static final Language language = Language.getInstance(); - @Environment(EnvType.CLIENT) private static MinecraftServer getCurrentlyRunningServerClient() { return MinecraftClient.getInstance().getServer(); } @@ -33,7 +32,6 @@ public static MinecraftServer getCurrentlyRunningServer() { throw new UnsupportedOperationException(); } - @Environment(EnvType.CLIENT) private static String translateTextClient(String translationKey) { return I18n.translate(translationKey); } diff --git a/1.17/src/main/resources/fabric.mod.json b/1.17/src/main/resources/fabric.mod.json index 951064b8..dff18a06 100644 --- a/1.17/src/main/resources/fabric.mod.json +++ b/1.17/src/main/resources/fabric.mod.json @@ -11,17 +11,12 @@ "contact": {}, "license": "MIT", "environment": "server", - "entrypoints": { - "main": [ - "dev.u9g.minecraftdatagenerator.Main" - ] - }, "mixins": [ "minecraft-data-generator.mixins.json" ], "depends": { - "fabricloader": ">=0.13.3", + "fabricloader": "*", "fabric": "*", - "minecraft": "1.17" + "minecraft": "*" } } diff --git a/1.18/build.gradle b/1.18/build.gradle index e85de392..73e874d0 100644 --- a/1.18/build.gradle +++ b/1.18/build.gradle @@ -10,6 +10,8 @@ dependencies { // Fabric API. This is technically optional, but you probably want it anyway. modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" + + implementation(projects.common) } processResources { diff --git a/1.18/src/main/java/dev/u9g/minecraftdatagenerator/Main.java b/1.18/src/main/java/dev/u9g/minecraftdatagenerator/Main.java deleted file mode 100644 index f8d17372..00000000 --- a/1.18/src/main/java/dev/u9g/minecraftdatagenerator/Main.java +++ /dev/null @@ -1,14 +0,0 @@ -package dev.u9g.minecraftdatagenerator; - -import net.fabricmc.api.ModInitializer; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class Main implements ModInitializer { - public static final Logger LOGGER = LoggerFactory.getLogger("mc-data-gen-serv"); - - @Override - public void onInitialize() { - - } -} diff --git a/1.18/src/main/java/dev/u9g/minecraftdatagenerator/generators/DataGenerators.java b/1.18/src/main/java/dev/u9g/minecraftdatagenerator/generators/DataGenerators.java deleted file mode 100644 index 2abb6288..00000000 --- a/1.18/src/main/java/dev/u9g/minecraftdatagenerator/generators/DataGenerators.java +++ /dev/null @@ -1,75 +0,0 @@ -package dev.u9g.minecraftdatagenerator.generators; - -import com.google.gson.JsonElement; -import dev.u9g.minecraftdatagenerator.util.DGU; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.IOException; -import java.io.Writer; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.StandardOpenOption; -import java.util.ArrayList; -import java.util.List; - -public class DataGenerators { - - private static final Logger logger = LoggerFactory.getLogger(DataGenerators.class); - private static final List GENERATORS = new ArrayList<>(); - - static { - register(new BiomesDataGenerator()); - register(new BlockCollisionShapesDataGenerator()); - register(new BlocksDataGenerator()); - register(new EffectsDataGenerator()); - register(new EnchantmentsDataGenerator()); - register(new EntitiesDataGenerator()); - register(new FoodsDataGenerator()); - register(new ItemsDataGenerator()); - register(new ParticlesDataGenerator()); - register(new TintsDataGenerator()); - register(new MaterialsDataGenerator()); -// register(new RecipeDataGenerator()); - On hold until mcdata supports multiple materials for a recipe - register(new LanguageDataGenerator()); - register(new InstrumentsDataGenerator()); - register(new SoundsDataGenerator()); - } - - public static void register(IDataGenerator generator) { - GENERATORS.add(generator); - } - - public static boolean runDataGenerators(Path outputDirectory) { - try { - Files.createDirectories(outputDirectory); - } catch (IOException exception) { - logger.error("Failed to create data generator output directory at {}", outputDirectory, exception); - return false; - } - - int generatorsFailed = 0; - logger.info("Running minecraft data generators, output at {}", outputDirectory); - - for (IDataGenerator dataGenerator : GENERATORS) { - logger.info("Running generator {}", dataGenerator.getDataName()); - try { - String outputFileName = String.format("%s.json", dataGenerator.getDataName()); - JsonElement outputElement = dataGenerator.generateDataJson(); - Path outputFilePath = outputDirectory.resolve(outputFileName); - - try (Writer writer = Files.newBufferedWriter(outputFilePath, StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING)) { - DGU.JSON_ELEMENT.write(DGU.GSON.newJsonWriter(writer), outputElement); - } - logger.info("Generator: {} -> {}", dataGenerator.getDataName(), outputFileName); - - } catch (Throwable exception) { - logger.error("Failed to run data generator {}", dataGenerator.getDataName(), exception); - generatorsFailed++; - } - } - - logger.info("Finishing running data generators"); - return generatorsFailed == 0; - } -} diff --git a/1.18/src/main/java/dev/u9g/minecraftdatagenerator/generators/IDataGenerator.java b/1.18/src/main/java/dev/u9g/minecraftdatagenerator/generators/IDataGenerator.java deleted file mode 100644 index 81fe4e20..00000000 --- a/1.18/src/main/java/dev/u9g/minecraftdatagenerator/generators/IDataGenerator.java +++ /dev/null @@ -1,10 +0,0 @@ -package dev.u9g.minecraftdatagenerator.generators; - -import com.google.gson.JsonElement; - -public interface IDataGenerator { - - String getDataName(); - - JsonElement generateDataJson(); -} diff --git a/1.18/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java b/1.18/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java index ba3b26b4..c904c153 100644 --- a/1.18/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java +++ b/1.18/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java @@ -1,7 +1,6 @@ package dev.u9g.minecraftdatagenerator.mixin; -import dev.u9g.minecraftdatagenerator.Main; -import dev.u9g.minecraftdatagenerator.generators.DataGenerators; +import dev.u9g.minecraftdatagenerator.MinecraftDataGenerator; import dev.u9g.minecraftdatagenerator.util.DGU; import net.minecraft.MinecraftVersion; import net.minecraft.server.dedicated.MinecraftDedicatedServer; @@ -10,18 +9,13 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -import java.nio.file.Path; - @Mixin(MinecraftDedicatedServer.class) public class ReadyMixin { @Inject(method = "setupServer()Z", at = @At("TAIL")) private void init(CallbackInfoReturnable cir) { - Main.LOGGER.info("Starting data generation!"); - String versionName = MinecraftVersion.CURRENT.getName(); - Path serverRootDirectory = DGU.getCurrentlyRunningServer().getRunDirectory().toPath().toAbsolutePath(); - Path dataDumpDirectory = serverRootDirectory.resolve("minecraft-data").resolve(versionName); - DataGenerators.runDataGenerators(dataDumpDirectory); - Main.LOGGER.info("Done data generation!"); - Runtime.getRuntime().halt(0); + MinecraftDataGenerator.start( + MinecraftVersion.CURRENT.getName(), + DGU.getCurrentlyRunningServer().getRunDirectory().toPath() + ); } } diff --git a/1.18/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java b/1.18/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java index dfb640d5..d03fe08a 100644 --- a/1.18/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java +++ b/1.18/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java @@ -99,7 +99,6 @@ public void write(JsonWriter out, JsonElement value) throws IOException { .registerTypeAdapter(JsonElement.class, JSON_ELEMENT).setPrettyPrinting().create(); private static final Language language = Language.getInstance(); - @Environment(EnvType.CLIENT) private static MinecraftServer getCurrentlyRunningServerClient() { return MinecraftClient.getInstance().getServer(); } @@ -119,7 +118,6 @@ public static MinecraftServer getCurrentlyRunningServer() { throw new UnsupportedOperationException(); } - @Environment(EnvType.CLIENT) private static String translateTextClient(String translationKey) { return I18n.translate(translationKey); } diff --git a/1.18/src/main/resources/fabric.mod.json b/1.18/src/main/resources/fabric.mod.json index 4eeec5d2..dff18a06 100644 --- a/1.18/src/main/resources/fabric.mod.json +++ b/1.18/src/main/resources/fabric.mod.json @@ -11,17 +11,12 @@ "contact": {}, "license": "MIT", "environment": "server", - "entrypoints": { - "main": [ - "dev.u9g.minecraftdatagenerator.Main" - ] - }, "mixins": [ "minecraft-data-generator.mixins.json" ], "depends": { - "fabricloader": ">=0.14.4", + "fabricloader": "*", "fabric": "*", - "minecraft": "1.18" + "minecraft": "*" } } diff --git a/1.19.2/build.gradle b/1.19.2/build.gradle index e85de392..73e874d0 100644 --- a/1.19.2/build.gradle +++ b/1.19.2/build.gradle @@ -10,6 +10,8 @@ dependencies { // Fabric API. This is technically optional, but you probably want it anyway. modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" + + implementation(projects.common) } processResources { diff --git a/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/Main.java b/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/Main.java deleted file mode 100644 index f8d17372..00000000 --- a/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/Main.java +++ /dev/null @@ -1,14 +0,0 @@ -package dev.u9g.minecraftdatagenerator; - -import net.fabricmc.api.ModInitializer; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class Main implements ModInitializer { - public static final Logger LOGGER = LoggerFactory.getLogger("mc-data-gen-serv"); - - @Override - public void onInitialize() { - - } -} diff --git a/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/DataGenerators.java b/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/DataGenerators.java deleted file mode 100644 index ebf2ed5f..00000000 --- a/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/DataGenerators.java +++ /dev/null @@ -1,78 +0,0 @@ -package dev.u9g.minecraftdatagenerator.generators; - -import com.google.gson.JsonElement; -import com.google.gson.internal.Streams; -import com.google.gson.stream.JsonWriter; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.IOException; -import java.io.Writer; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.StandardOpenOption; -import java.util.ArrayList; -import java.util.List; - -public class DataGenerators { - - private static final Logger logger = LoggerFactory.getLogger(DataGenerators.class); - private static final List GENERATORS = new ArrayList<>(); - - static { - register(new BiomesDataGenerator()); - register(new BlockCollisionShapesDataGenerator()); - register(new BlocksDataGenerator()); - register(new EffectsDataGenerator()); - register(new EnchantmentsDataGenerator()); - register(new EntitiesDataGenerator()); - register(new FoodsDataGenerator()); - register(new ItemsDataGenerator()); - register(new ParticlesDataGenerator()); - register(new TintsDataGenerator()); - register(new MaterialsDataGenerator()); -// register(new RecipeDataGenerator()); - On hold until mcdata supports multiple materials for a recipe - register(new LanguageDataGenerator()); - register(new InstrumentsDataGenerator()); - register(new SoundsDataGenerator()); - } - - public static void register(IDataGenerator generator) { - GENERATORS.add(generator); - } - - public static boolean runDataGenerators(Path outputDirectory) { - try { - Files.createDirectories(outputDirectory); - } catch (IOException exception) { - logger.error("Failed to create data generator output directory at {}", outputDirectory, exception); - return false; - } - - int generatorsFailed = 0; - logger.info("Running minecraft data generators, output at {}", outputDirectory); - - for (IDataGenerator dataGenerator : GENERATORS) { - logger.info("Running generator {}", dataGenerator.getDataName()); - try { - String outputFileName = String.format("%s.json", dataGenerator.getDataName()); - JsonElement outputElement = dataGenerator.generateDataJson(); - Path outputFilePath = outputDirectory.resolve(outputFileName); - - try (Writer writer = Files.newBufferedWriter(outputFilePath, StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING)) { - JsonWriter jsonWriter = new JsonWriter(writer); - jsonWriter.setIndent(" "); - Streams.write(outputElement, jsonWriter); - } - logger.info("Generator: {} -> {}", dataGenerator.getDataName(), outputFileName); - - } catch (Throwable exception) { - logger.error("Failed to run data generator {}", dataGenerator.getDataName(), exception); - generatorsFailed++; - } - } - - logger.info("Finishing running data generators"); - return generatorsFailed == 0; - } -} diff --git a/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/IDataGenerator.java b/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/IDataGenerator.java deleted file mode 100644 index 81fe4e20..00000000 --- a/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/IDataGenerator.java +++ /dev/null @@ -1,10 +0,0 @@ -package dev.u9g.minecraftdatagenerator.generators; - -import com.google.gson.JsonElement; - -public interface IDataGenerator { - - String getDataName(); - - JsonElement generateDataJson(); -} diff --git a/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java b/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java index ba3b26b4..c904c153 100644 --- a/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java +++ b/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java @@ -1,7 +1,6 @@ package dev.u9g.minecraftdatagenerator.mixin; -import dev.u9g.minecraftdatagenerator.Main; -import dev.u9g.minecraftdatagenerator.generators.DataGenerators; +import dev.u9g.minecraftdatagenerator.MinecraftDataGenerator; import dev.u9g.minecraftdatagenerator.util.DGU; import net.minecraft.MinecraftVersion; import net.minecraft.server.dedicated.MinecraftDedicatedServer; @@ -10,18 +9,13 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -import java.nio.file.Path; - @Mixin(MinecraftDedicatedServer.class) public class ReadyMixin { @Inject(method = "setupServer()Z", at = @At("TAIL")) private void init(CallbackInfoReturnable cir) { - Main.LOGGER.info("Starting data generation!"); - String versionName = MinecraftVersion.CURRENT.getName(); - Path serverRootDirectory = DGU.getCurrentlyRunningServer().getRunDirectory().toPath().toAbsolutePath(); - Path dataDumpDirectory = serverRootDirectory.resolve("minecraft-data").resolve(versionName); - DataGenerators.runDataGenerators(dataDumpDirectory); - Main.LOGGER.info("Done data generation!"); - Runtime.getRuntime().halt(0); + MinecraftDataGenerator.start( + MinecraftVersion.CURRENT.getName(), + DGU.getCurrentlyRunningServer().getRunDirectory().toPath() + ); } } diff --git a/1.19.2/src/main/resources/fabric.mod.json b/1.19.2/src/main/resources/fabric.mod.json index c999d2a8..dff18a06 100644 --- a/1.19.2/src/main/resources/fabric.mod.json +++ b/1.19.2/src/main/resources/fabric.mod.json @@ -11,16 +11,11 @@ "contact": {}, "license": "MIT", "environment": "server", - "entrypoints": { - "main": [ - "dev.u9g.minecraftdatagenerator.Main" - ] - }, "mixins": [ "minecraft-data-generator.mixins.json" ], "depends": { - "fabricloader": ">=0.14.4", + "fabricloader": "*", "fabric": "*", "minecraft": "*" } diff --git a/1.19/build.gradle b/1.19/build.gradle index e85de392..73e874d0 100644 --- a/1.19/build.gradle +++ b/1.19/build.gradle @@ -10,6 +10,8 @@ dependencies { // Fabric API. This is technically optional, but you probably want it anyway. modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" + + implementation(projects.common) } processResources { diff --git a/1.19/src/main/java/dev/u9g/minecraftdatagenerator/Main.java b/1.19/src/main/java/dev/u9g/minecraftdatagenerator/Main.java deleted file mode 100644 index f8d17372..00000000 --- a/1.19/src/main/java/dev/u9g/minecraftdatagenerator/Main.java +++ /dev/null @@ -1,14 +0,0 @@ -package dev.u9g.minecraftdatagenerator; - -import net.fabricmc.api.ModInitializer; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class Main implements ModInitializer { - public static final Logger LOGGER = LoggerFactory.getLogger("mc-data-gen-serv"); - - @Override - public void onInitialize() { - - } -} diff --git a/1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/DataGenerators.java b/1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/DataGenerators.java deleted file mode 100644 index ebf2ed5f..00000000 --- a/1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/DataGenerators.java +++ /dev/null @@ -1,78 +0,0 @@ -package dev.u9g.minecraftdatagenerator.generators; - -import com.google.gson.JsonElement; -import com.google.gson.internal.Streams; -import com.google.gson.stream.JsonWriter; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.IOException; -import java.io.Writer; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.StandardOpenOption; -import java.util.ArrayList; -import java.util.List; - -public class DataGenerators { - - private static final Logger logger = LoggerFactory.getLogger(DataGenerators.class); - private static final List GENERATORS = new ArrayList<>(); - - static { - register(new BiomesDataGenerator()); - register(new BlockCollisionShapesDataGenerator()); - register(new BlocksDataGenerator()); - register(new EffectsDataGenerator()); - register(new EnchantmentsDataGenerator()); - register(new EntitiesDataGenerator()); - register(new FoodsDataGenerator()); - register(new ItemsDataGenerator()); - register(new ParticlesDataGenerator()); - register(new TintsDataGenerator()); - register(new MaterialsDataGenerator()); -// register(new RecipeDataGenerator()); - On hold until mcdata supports multiple materials for a recipe - register(new LanguageDataGenerator()); - register(new InstrumentsDataGenerator()); - register(new SoundsDataGenerator()); - } - - public static void register(IDataGenerator generator) { - GENERATORS.add(generator); - } - - public static boolean runDataGenerators(Path outputDirectory) { - try { - Files.createDirectories(outputDirectory); - } catch (IOException exception) { - logger.error("Failed to create data generator output directory at {}", outputDirectory, exception); - return false; - } - - int generatorsFailed = 0; - logger.info("Running minecraft data generators, output at {}", outputDirectory); - - for (IDataGenerator dataGenerator : GENERATORS) { - logger.info("Running generator {}", dataGenerator.getDataName()); - try { - String outputFileName = String.format("%s.json", dataGenerator.getDataName()); - JsonElement outputElement = dataGenerator.generateDataJson(); - Path outputFilePath = outputDirectory.resolve(outputFileName); - - try (Writer writer = Files.newBufferedWriter(outputFilePath, StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING)) { - JsonWriter jsonWriter = new JsonWriter(writer); - jsonWriter.setIndent(" "); - Streams.write(outputElement, jsonWriter); - } - logger.info("Generator: {} -> {}", dataGenerator.getDataName(), outputFileName); - - } catch (Throwable exception) { - logger.error("Failed to run data generator {}", dataGenerator.getDataName(), exception); - generatorsFailed++; - } - } - - logger.info("Finishing running data generators"); - return generatorsFailed == 0; - } -} diff --git a/1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/IDataGenerator.java b/1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/IDataGenerator.java deleted file mode 100644 index 81fe4e20..00000000 --- a/1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/IDataGenerator.java +++ /dev/null @@ -1,10 +0,0 @@ -package dev.u9g.minecraftdatagenerator.generators; - -import com.google.gson.JsonElement; - -public interface IDataGenerator { - - String getDataName(); - - JsonElement generateDataJson(); -} diff --git a/1.19/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java b/1.19/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java index ba3b26b4..c904c153 100644 --- a/1.19/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java +++ b/1.19/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java @@ -1,7 +1,6 @@ package dev.u9g.minecraftdatagenerator.mixin; -import dev.u9g.minecraftdatagenerator.Main; -import dev.u9g.minecraftdatagenerator.generators.DataGenerators; +import dev.u9g.minecraftdatagenerator.MinecraftDataGenerator; import dev.u9g.minecraftdatagenerator.util.DGU; import net.minecraft.MinecraftVersion; import net.minecraft.server.dedicated.MinecraftDedicatedServer; @@ -10,18 +9,13 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -import java.nio.file.Path; - @Mixin(MinecraftDedicatedServer.class) public class ReadyMixin { @Inject(method = "setupServer()Z", at = @At("TAIL")) private void init(CallbackInfoReturnable cir) { - Main.LOGGER.info("Starting data generation!"); - String versionName = MinecraftVersion.CURRENT.getName(); - Path serverRootDirectory = DGU.getCurrentlyRunningServer().getRunDirectory().toPath().toAbsolutePath(); - Path dataDumpDirectory = serverRootDirectory.resolve("minecraft-data").resolve(versionName); - DataGenerators.runDataGenerators(dataDumpDirectory); - Main.LOGGER.info("Done data generation!"); - Runtime.getRuntime().halt(0); + MinecraftDataGenerator.start( + MinecraftVersion.CURRENT.getName(), + DGU.getCurrentlyRunningServer().getRunDirectory().toPath() + ); } } diff --git a/1.19/src/main/resources/fabric.mod.json b/1.19/src/main/resources/fabric.mod.json index 1d6fbb58..395c025e 100644 --- a/1.19/src/main/resources/fabric.mod.json +++ b/1.19/src/main/resources/fabric.mod.json @@ -11,16 +11,11 @@ "contact": {}, "license": "MIT", "environment": "server", - "entrypoints": { - "main": [ - "dev.u9g.minecraftdatagenerator.Main" - ] - }, "mixins": [ "minecraft-data-generator.mixins.json" ], "depends": { - "fabricloader": ">=0.14.4", + "fabricloader": "*", "fabric": "*", "minecraft": "1.19" } diff --git a/1.20.4/build.gradle b/1.20.4/build.gradle index e85de392..73e874d0 100644 --- a/1.20.4/build.gradle +++ b/1.20.4/build.gradle @@ -10,6 +10,8 @@ dependencies { // Fabric API. This is technically optional, but you probably want it anyway. modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" + + implementation(projects.common) } processResources { diff --git a/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/Main.java b/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/Main.java deleted file mode 100644 index f8d17372..00000000 --- a/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/Main.java +++ /dev/null @@ -1,14 +0,0 @@ -package dev.u9g.minecraftdatagenerator; - -import net.fabricmc.api.ModInitializer; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class Main implements ModInitializer { - public static final Logger LOGGER = LoggerFactory.getLogger("mc-data-gen-serv"); - - @Override - public void onInitialize() { - - } -} diff --git a/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/BiomesDataGenerator.java b/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/BiomesDataGenerator.java index bda5f967..bc47f3bd 100644 --- a/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/BiomesDataGenerator.java +++ b/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/BiomesDataGenerator.java @@ -11,6 +11,7 @@ import net.minecraft.registry.RegistryKeys; import net.minecraft.util.Identifier; import net.minecraft.world.biome.Biome; +import net.minecraft.world.biome.source.BiomeSources; import java.util.HashSet; import java.util.Set; diff --git a/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/DataGenerators.java b/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/DataGenerators.java deleted file mode 100644 index c47684ab..00000000 --- a/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/DataGenerators.java +++ /dev/null @@ -1,77 +0,0 @@ -package dev.u9g.minecraftdatagenerator.generators; - -import com.google.gson.JsonElement; -import com.google.gson.internal.Streams; -import com.google.gson.stream.JsonWriter; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.IOException; -import java.io.Writer; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.StandardOpenOption; -import java.util.ArrayList; -import java.util.List; - -public class DataGenerators { - - private static final Logger logger = LoggerFactory.getLogger(DataGenerators.class); - private static final List GENERATORS = new ArrayList<>(); - - static { - register(new BiomesDataGenerator()); - register(new BlockCollisionShapesDataGenerator()); - register(new BlocksDataGenerator()); - register(new EffectsDataGenerator()); - register(new EnchantmentsDataGenerator()); - register(new EntitiesDataGenerator()); - register(new FoodsDataGenerator()); - register(new ItemsDataGenerator()); - register(new ParticlesDataGenerator()); - register(new TintsDataGenerator()); - register(new MaterialsDataGenerator()); -// register(new RecipeDataGenerator()); - On hold until mcdata supports multiple materials for a recipe - register(new LanguageDataGenerator()); - register(new InstrumentsDataGenerator()); - } - - public static void register(IDataGenerator generator) { - GENERATORS.add(generator); - } - - public static boolean runDataGenerators(Path outputDirectory) { - try { - Files.createDirectories(outputDirectory); - } catch (IOException exception) { - logger.error("Failed to create data generator output directory at {}", outputDirectory, exception); - return false; - } - - int generatorsFailed = 0; - logger.info("Running minecraft data generators, output at {}", outputDirectory); - - for (IDataGenerator dataGenerator : GENERATORS) { - logger.info("Running generator {}", dataGenerator.getDataName()); - try { - String outputFileName = String.format("%s.json", dataGenerator.getDataName()); - JsonElement outputElement = dataGenerator.generateDataJson(); - Path outputFilePath = outputDirectory.resolve(outputFileName); - - try (Writer writer = Files.newBufferedWriter(outputFilePath, StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING)) { - JsonWriter jsonWriter = new JsonWriter(writer); - jsonWriter.setIndent(" "); - Streams.write(outputElement, jsonWriter); - } - logger.info("Generator: {} -> {}", dataGenerator.getDataName(), outputFileName); - - } catch (Throwable exception) { - logger.error("Failed to run data generator {}", dataGenerator.getDataName(), exception); - generatorsFailed++; - } - } - - logger.info("Finishing running data generators"); - return generatorsFailed == 0; - } -} diff --git a/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/IDataGenerator.java b/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/IDataGenerator.java deleted file mode 100644 index 81fe4e20..00000000 --- a/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/IDataGenerator.java +++ /dev/null @@ -1,10 +0,0 @@ -package dev.u9g.minecraftdatagenerator.generators; - -import com.google.gson.JsonElement; - -public interface IDataGenerator { - - String getDataName(); - - JsonElement generateDataJson(); -} diff --git a/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java b/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java index 9cec9cd1..cf8d9ffc 100644 --- a/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java +++ b/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java @@ -1,7 +1,6 @@ package dev.u9g.minecraftdatagenerator.mixin; -import dev.u9g.minecraftdatagenerator.Main; -import dev.u9g.minecraftdatagenerator.generators.DataGenerators; +import dev.u9g.minecraftdatagenerator.MinecraftDataGenerator; import dev.u9g.minecraftdatagenerator.util.DGU; import net.minecraft.MinecraftVersion; import net.minecraft.server.dedicated.MinecraftDedicatedServer; @@ -10,19 +9,14 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -import java.nio.file.Path; - @Mixin(MinecraftDedicatedServer.class) public class ReadyMixin { @Inject(method = "setupServer()Z", at = @At("TAIL")) private void init(CallbackInfoReturnable cir) { - Main.LOGGER.info("Starting data generation!"); - String versionName = MinecraftVersion.CURRENT.getName(); - Path serverRootDirectory = DGU.getCurrentlyRunningServer().getRunDirectory().toPath().toAbsolutePath(); - Path dataDumpDirectory = serverRootDirectory.resolve("minecraft-data").resolve(versionName); - DataGenerators.runDataGenerators(dataDumpDirectory); - Main.LOGGER.info("Done data generation!"); - Runtime.getRuntime().halt(0); + MinecraftDataGenerator.start( + MinecraftVersion.CURRENT.getName(), + DGU.getCurrentlyRunningServer().getRunDirectory().toPath() + ); } } diff --git a/1.20.4/src/main/resources/fabric.mod.json b/1.20.4/src/main/resources/fabric.mod.json index c999d2a8..dff18a06 100644 --- a/1.20.4/src/main/resources/fabric.mod.json +++ b/1.20.4/src/main/resources/fabric.mod.json @@ -11,16 +11,11 @@ "contact": {}, "license": "MIT", "environment": "server", - "entrypoints": { - "main": [ - "dev.u9g.minecraftdatagenerator.Main" - ] - }, "mixins": [ "minecraft-data-generator.mixins.json" ], "depends": { - "fabricloader": ">=0.14.4", + "fabricloader": "*", "fabric": "*", "minecraft": "*" } diff --git a/1.20/build.gradle b/1.20/build.gradle index e85de392..73e874d0 100644 --- a/1.20/build.gradle +++ b/1.20/build.gradle @@ -10,6 +10,8 @@ dependencies { // Fabric API. This is technically optional, but you probably want it anyway. modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" + + implementation(projects.common) } processResources { diff --git a/1.20/src/main/java/dev/u9g/minecraftdatagenerator/Main.java b/1.20/src/main/java/dev/u9g/minecraftdatagenerator/Main.java deleted file mode 100644 index f8d17372..00000000 --- a/1.20/src/main/java/dev/u9g/minecraftdatagenerator/Main.java +++ /dev/null @@ -1,14 +0,0 @@ -package dev.u9g.minecraftdatagenerator; - -import net.fabricmc.api.ModInitializer; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class Main implements ModInitializer { - public static final Logger LOGGER = LoggerFactory.getLogger("mc-data-gen-serv"); - - @Override - public void onInitialize() { - - } -} diff --git a/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/DataGenerators.java b/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/DataGenerators.java deleted file mode 100644 index ebf2ed5f..00000000 --- a/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/DataGenerators.java +++ /dev/null @@ -1,78 +0,0 @@ -package dev.u9g.minecraftdatagenerator.generators; - -import com.google.gson.JsonElement; -import com.google.gson.internal.Streams; -import com.google.gson.stream.JsonWriter; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.IOException; -import java.io.Writer; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.StandardOpenOption; -import java.util.ArrayList; -import java.util.List; - -public class DataGenerators { - - private static final Logger logger = LoggerFactory.getLogger(DataGenerators.class); - private static final List GENERATORS = new ArrayList<>(); - - static { - register(new BiomesDataGenerator()); - register(new BlockCollisionShapesDataGenerator()); - register(new BlocksDataGenerator()); - register(new EffectsDataGenerator()); - register(new EnchantmentsDataGenerator()); - register(new EntitiesDataGenerator()); - register(new FoodsDataGenerator()); - register(new ItemsDataGenerator()); - register(new ParticlesDataGenerator()); - register(new TintsDataGenerator()); - register(new MaterialsDataGenerator()); -// register(new RecipeDataGenerator()); - On hold until mcdata supports multiple materials for a recipe - register(new LanguageDataGenerator()); - register(new InstrumentsDataGenerator()); - register(new SoundsDataGenerator()); - } - - public static void register(IDataGenerator generator) { - GENERATORS.add(generator); - } - - public static boolean runDataGenerators(Path outputDirectory) { - try { - Files.createDirectories(outputDirectory); - } catch (IOException exception) { - logger.error("Failed to create data generator output directory at {}", outputDirectory, exception); - return false; - } - - int generatorsFailed = 0; - logger.info("Running minecraft data generators, output at {}", outputDirectory); - - for (IDataGenerator dataGenerator : GENERATORS) { - logger.info("Running generator {}", dataGenerator.getDataName()); - try { - String outputFileName = String.format("%s.json", dataGenerator.getDataName()); - JsonElement outputElement = dataGenerator.generateDataJson(); - Path outputFilePath = outputDirectory.resolve(outputFileName); - - try (Writer writer = Files.newBufferedWriter(outputFilePath, StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING)) { - JsonWriter jsonWriter = new JsonWriter(writer); - jsonWriter.setIndent(" "); - Streams.write(outputElement, jsonWriter); - } - logger.info("Generator: {} -> {}", dataGenerator.getDataName(), outputFileName); - - } catch (Throwable exception) { - logger.error("Failed to run data generator {}", dataGenerator.getDataName(), exception); - generatorsFailed++; - } - } - - logger.info("Finishing running data generators"); - return generatorsFailed == 0; - } -} diff --git a/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/IDataGenerator.java b/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/IDataGenerator.java deleted file mode 100644 index 81fe4e20..00000000 --- a/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/IDataGenerator.java +++ /dev/null @@ -1,10 +0,0 @@ -package dev.u9g.minecraftdatagenerator.generators; - -import com.google.gson.JsonElement; - -public interface IDataGenerator { - - String getDataName(); - - JsonElement generateDataJson(); -} diff --git a/1.20/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java b/1.20/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java index ba3b26b4..c904c153 100644 --- a/1.20/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java +++ b/1.20/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java @@ -1,7 +1,6 @@ package dev.u9g.minecraftdatagenerator.mixin; -import dev.u9g.minecraftdatagenerator.Main; -import dev.u9g.minecraftdatagenerator.generators.DataGenerators; +import dev.u9g.minecraftdatagenerator.MinecraftDataGenerator; import dev.u9g.minecraftdatagenerator.util.DGU; import net.minecraft.MinecraftVersion; import net.minecraft.server.dedicated.MinecraftDedicatedServer; @@ -10,18 +9,13 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -import java.nio.file.Path; - @Mixin(MinecraftDedicatedServer.class) public class ReadyMixin { @Inject(method = "setupServer()Z", at = @At("TAIL")) private void init(CallbackInfoReturnable cir) { - Main.LOGGER.info("Starting data generation!"); - String versionName = MinecraftVersion.CURRENT.getName(); - Path serverRootDirectory = DGU.getCurrentlyRunningServer().getRunDirectory().toPath().toAbsolutePath(); - Path dataDumpDirectory = serverRootDirectory.resolve("minecraft-data").resolve(versionName); - DataGenerators.runDataGenerators(dataDumpDirectory); - Main.LOGGER.info("Done data generation!"); - Runtime.getRuntime().halt(0); + MinecraftDataGenerator.start( + MinecraftVersion.CURRENT.getName(), + DGU.getCurrentlyRunningServer().getRunDirectory().toPath() + ); } } diff --git a/1.20/src/main/resources/fabric.mod.json b/1.20/src/main/resources/fabric.mod.json index c999d2a8..dff18a06 100644 --- a/1.20/src/main/resources/fabric.mod.json +++ b/1.20/src/main/resources/fabric.mod.json @@ -11,16 +11,11 @@ "contact": {}, "license": "MIT", "environment": "server", - "entrypoints": { - "main": [ - "dev.u9g.minecraftdatagenerator.Main" - ] - }, "mixins": [ "minecraft-data-generator.mixins.json" ], "depends": { - "fabricloader": ">=0.14.4", + "fabricloader": "*", "fabric": "*", "minecraft": "*" } diff --git a/1.7/build.gradle b/1.7/build.gradle index 224e88a1..2b7bfd60 100644 --- a/1.7/build.gradle +++ b/1.7/build.gradle @@ -32,6 +32,8 @@ dependencies { // exclude module: "legacy-fabric-entity-events-v1" // } + implementation(projects.common) + if (System.getProperty("os.name").toLowerCase().contains("mac")) { implementation 'org.lwjgl.lwjgl:lwjgl_util:2.9.4-nightly-20150209' implementation 'org.lwjgl.lwjgl:lwjgl:2.9.4-nightly-20150209' diff --git a/1.7/src/main/java/dev/u9g/minecraftdatagenerator/Main.java b/1.7/src/main/java/dev/u9g/minecraftdatagenerator/Main.java deleted file mode 100644 index d23c5ba2..00000000 --- a/1.7/src/main/java/dev/u9g/minecraftdatagenerator/Main.java +++ /dev/null @@ -1,13 +0,0 @@ -package dev.u9g.minecraftdatagenerator; - -import net.fabricmc.api.ModInitializer; - -import java.util.logging.Logger; - -public class Main implements ModInitializer { - public static final Logger LOGGER = Logger.getLogger("mc-data-gen-serv"); - - @Override - public void onInitialize() { - } -} diff --git a/1.7/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java b/1.7/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java index feaed25b..9a8d7737 100644 --- a/1.7/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java +++ b/1.7/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java @@ -2,7 +2,6 @@ import com.google.gson.JsonArray; import com.google.gson.JsonObject; -import dev.u9g.minecraftdatagenerator.Main; import dev.u9g.minecraftdatagenerator.mixin.accessor.BlockAccessor; import dev.u9g.minecraftdatagenerator.mixin.accessor.MiningToolItemAccessor; import dev.u9g.minecraftdatagenerator.util.DGU; @@ -20,9 +19,6 @@ import java.util.logging.Logger; public class BlocksDataGenerator implements IDataGenerator { - - private static final Logger logger = Main.LOGGER; - private static List getItemsEffectiveForBlock(Block block) { List items = new ArrayList<>(); for (Item item : Registries.ITEMS) { diff --git a/1.7/src/main/java/dev/u9g/minecraftdatagenerator/generators/DataGenerators.java b/1.7/src/main/java/dev/u9g/minecraftdatagenerator/generators/DataGenerators.java deleted file mode 100644 index c2ac739c..00000000 --- a/1.7/src/main/java/dev/u9g/minecraftdatagenerator/generators/DataGenerators.java +++ /dev/null @@ -1,80 +0,0 @@ -package dev.u9g.minecraftdatagenerator.generators; - -import com.google.gson.JsonElement; -import com.google.gson.internal.Streams; -import com.google.gson.stream.JsonWriter; -import dev.u9g.minecraftdatagenerator.Main; - -import java.io.IOException; -import java.io.Writer; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.StandardOpenOption; -import java.text.MessageFormat; -import java.util.ArrayList; -import java.util.List; -import java.util.logging.Level; -import java.util.logging.Logger; - -public class DataGenerators { - - private static final List GENERATORS = new ArrayList<>(); - private static final Logger logger = Main.LOGGER; - - static { - register(new BiomesDataGenerator()); -// register(new BlockCollisionShapesDataGenerator()); - Needs to be finished - register(new BlocksDataGenerator()); - register(new EffectsDataGenerator()); - register(new EnchantmentsDataGenerator()); - register(new EntitiesDataGenerator()); - register(new FoodsDataGenerator()); - register(new ItemsDataGenerator()); -// register(new ParticlesDataGenerator()); - See WorldRenderer#spawnParticle - register(new TintsDataGenerator()); - register(new LanguageDataGenerator()); - register(new InstrumentsDataGenerator()); - register(new AttributesDataGenerator()); - } - - public static void register(IDataGenerator generator) { - GENERATORS.add(generator); - } - - public static boolean runDataGenerators(Path outputDirectory) { - try { - Files.createDirectories(outputDirectory); - } catch (IOException exception) { - logger.info("Failed to create data generator output directory at " + outputDirectory); - exception.printStackTrace(); - return false; - } - - int generatorsFailed = 0; - logger.info(MessageFormat.format("Running minecraft data generators, output at {0}", outputDirectory)); - - for (IDataGenerator dataGenerator : GENERATORS) { - logger.info(MessageFormat.format("Running generator {0}", dataGenerator.getDataName())); - try { - String outputFileName = String.format("%s.json", dataGenerator.getDataName()); - JsonElement outputElement = dataGenerator.generateDataJson(); - Path outputFilePath = outputDirectory.resolve(outputFileName); - - try (Writer writer = Files.newBufferedWriter(outputFilePath, StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING)) { - JsonWriter jsonWriter = new JsonWriter(writer); - jsonWriter.setIndent(" "); - Streams.write(outputElement, jsonWriter); - } - logger.info(MessageFormat.format("Generator: {0} -> {1}", dataGenerator.getDataName(), outputFileName)); - - } catch (Throwable exception) { - logger.info(MessageFormat.format("Failed to run data generator {0}", dataGenerator.getDataName())); - exception.printStackTrace(); - generatorsFailed++; - } - } - - logger.info("Finishing running data generators"); - return generatorsFailed == 0; - } -} diff --git a/1.7/src/main/java/dev/u9g/minecraftdatagenerator/generators/IDataGenerator.java b/1.7/src/main/java/dev/u9g/minecraftdatagenerator/generators/IDataGenerator.java deleted file mode 100644 index 81fe4e20..00000000 --- a/1.7/src/main/java/dev/u9g/minecraftdatagenerator/generators/IDataGenerator.java +++ /dev/null @@ -1,10 +0,0 @@ -package dev.u9g.minecraftdatagenerator.generators; - -import com.google.gson.JsonElement; - -public interface IDataGenerator { - - String getDataName(); - - JsonElement generateDataJson(); -} diff --git a/1.7/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java b/1.7/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java index 414749bb..3fdb1d98 100644 --- a/1.7/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java +++ b/1.7/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java @@ -21,14 +21,8 @@ public static BiomeTintColors generateBiomeTintColors() { BiomeTintColors colors = new BiomeTintColors(); for (Biome biome : Registries.BIOMES) { - EmptyBlockView bv = new EmptyBlockView() { - @Override - public Biome getBiome(int x, int z) { - return biome; - } - }; - int biomeGrassColor = GrassColors.getGrassColor(bv.getBiome(0, 0)); - int biomeFoliageColor = FoliageColors.getColor(bv.getBiome(0, 0)); + int biomeGrassColor = GrassColors.getGrassColor(biome); + int biomeFoliageColor = FoliageColors.getColor(biome); int biomeWaterColor = ((BiomeAccessor) biome).waterColor(); colors.grassColoursMap.computeIfAbsent(biomeGrassColor, k -> new ArrayList<>()).add(biome); diff --git a/1.7/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java b/1.7/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java index 7ea7dcbf..82c7f134 100644 --- a/1.7/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java +++ b/1.7/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java @@ -1,9 +1,7 @@ package dev.u9g.minecraftdatagenerator.mixin; -import dev.u9g.minecraftdatagenerator.Main; -import dev.u9g.minecraftdatagenerator.generators.DataGenerators; +import dev.u9g.minecraftdatagenerator.MinecraftDataGenerator; import dev.u9g.minecraftdatagenerator.util.DGU; -import dev.u9g.minecraftdatagenerator.util.Registries; import net.minecraft.server.dedicated.MinecraftDedicatedServer; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; @@ -11,20 +9,14 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import java.io.File; -import java.nio.file.Path; -import java.util.logging.Level; @Mixin(MinecraftDedicatedServer.class) public class ReadyMixin { @Inject(method = "setupServer()Z", at = @At("TAIL")) private void init(CallbackInfoReturnable cir) { - Registries.init(); - Main.LOGGER.info("Starting data generation!"); - String versionName = DGU.getCurrentlyRunningServer().getVersion(); - Path serverRootDirectory = (new File(".")).toPath().toAbsolutePath(); - Path dataDumpDirectory = serverRootDirectory.resolve("minecraft-data").resolve(versionName); - DataGenerators.runDataGenerators(dataDumpDirectory); - Main.LOGGER.info("Done data generation!"); - Runtime.getRuntime().halt(0); + MinecraftDataGenerator.start( + DGU.getCurrentlyRunningServer().getVersion(), + (new File(".")).toPath() + ); } } diff --git a/1.7/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java b/1.7/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java index 9f1bf0b7..cfe51872 100644 --- a/1.7/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java +++ b/1.7/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java @@ -15,7 +15,6 @@ public static MinecraftServer getCurrentlyRunningServer() { return MinecraftServer.getServer(); } - @Environment(EnvType.CLIENT) private static String translateTextClient(String translationKey) { return I18n.translate(translationKey); } diff --git a/1.7/src/main/java/dev/u9g/minecraftdatagenerator/util/Registries.java b/1.7/src/main/java/dev/u9g/minecraftdatagenerator/util/Registries.java index d345d91e..976e8d11 100644 --- a/1.7/src/main/java/dev/u9g/minecraftdatagenerator/util/Registries.java +++ b/1.7/src/main/java/dev/u9g/minecraftdatagenerator/util/Registries.java @@ -20,13 +20,23 @@ import java.util.Map; public class Registries { - public static Language LANGUAGE; - public static RegistryView BIOMES; - public static RegistryView BLOCKS; - public static RegistryView ITEMS; - public static RegistryView STATUS_EFFECTS; - public static RegistryView ENCHANTMENTS; - public static RegistryView> ENTITY_TYPES; + public static final Language LANGUAGE; + public static final RegistryView BIOMES; + public static final RegistryView BLOCKS; + public static final RegistryView ITEMS; + public static final RegistryView STATUS_EFFECTS; + public static final RegistryView ENCHANTMENTS; + public static final RegistryView> ENTITY_TYPES; + + static { + LANGUAGE = new Language(); + BIOMES = setupBiomeRegistry(); + BLOCKS = new RegistryBackedRegistryView<>(Block.REGISTRY); + ITEMS = new RegistryBackedRegistryView<>(Item.REGISTRY); + STATUS_EFFECTS = setupStatusEffectRegistry(); + ENCHANTMENTS = setupEnchantmentRegistry(); + ENTITY_TYPES = setupEntityTypesRegistry(); + } private static RegistryView> setupEntityTypesRegistry() { TableBackedRegistryView.Builder> registry = new TableBackedRegistryView.Builder<>(); @@ -68,14 +78,4 @@ private static RegistryView setupStatusEffectRegistry() { } return builder.build(); } - - public static void init() { - LANGUAGE = new Language(); - BIOMES = setupBiomeRegistry(); - BLOCKS = new RegistryBackedRegistryView<>(Block.REGISTRY); - ITEMS = new RegistryBackedRegistryView<>(Item.REGISTRY); - STATUS_EFFECTS = setupStatusEffectRegistry(); - ENCHANTMENTS = setupEnchantmentRegistry(); - ENTITY_TYPES = setupEntityTypesRegistry(); - } } diff --git a/1.7/src/main/resources/fabric.mod.json b/1.7/src/main/resources/fabric.mod.json index 2e49539c..12f9d70e 100644 --- a/1.7/src/main/resources/fabric.mod.json +++ b/1.7/src/main/resources/fabric.mod.json @@ -11,16 +11,11 @@ "contact": {}, "license": "MIT", "environment": "server", - "entrypoints": { - "main": [ - "dev.u9g.minecraftdatagenerator.Main" - ] - }, "mixins": [ "minecraft-data-generator.mixins.json" ], "depends": { - "fabricloader": ">=0.13.3", - "minecraft": ">=1.7" + "fabricloader": "*", + "minecraft": "*" } } diff --git a/1.8.9/build.gradle b/1.8.9/build.gradle index 057916c6..a0489215 100644 --- a/1.8.9/build.gradle +++ b/1.8.9/build.gradle @@ -25,6 +25,8 @@ dependencies { // exclude module: "legacy-fabric-entity-events-v1" // } + implementation(projects.common) + if (System.getProperty("os.name").toLowerCase().contains("mac")) { implementation 'org.lwjgl.lwjgl:lwjgl_util:2.9.4-nightly-20150209' implementation 'org.lwjgl.lwjgl:lwjgl:2.9.4-nightly-20150209' diff --git a/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/Main.java b/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/Main.java deleted file mode 100644 index d23c5ba2..00000000 --- a/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/Main.java +++ /dev/null @@ -1,13 +0,0 @@ -package dev.u9g.minecraftdatagenerator; - -import net.fabricmc.api.ModInitializer; - -import java.util.logging.Logger; - -public class Main implements ModInitializer { - public static final Logger LOGGER = Logger.getLogger("mc-data-gen-serv"); - - @Override - public void onInitialize() { - } -} diff --git a/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java b/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java index 5431a483..ffb3a691 100644 --- a/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java +++ b/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java @@ -4,7 +4,6 @@ import com.google.gson.JsonArray; import com.google.gson.JsonObject; import com.google.gson.JsonPrimitive; -import dev.u9g.minecraftdatagenerator.Main; import dev.u9g.minecraftdatagenerator.mixin.BlockAccessor; import dev.u9g.minecraftdatagenerator.mixin.MiningToolItemAccessor; import dev.u9g.minecraftdatagenerator.util.DGU; @@ -30,9 +29,6 @@ import java.util.logging.Logger; public class BlocksDataGenerator implements IDataGenerator { - - private static final Logger logger = Main.LOGGER; - private static List getItemsEffectiveForBlock(Block block) { List items = new ArrayList<>(); for (Item item : Registries.ITEMS) { diff --git a/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/generators/DataGenerators.java b/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/generators/DataGenerators.java deleted file mode 100644 index 249c6308..00000000 --- a/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/generators/DataGenerators.java +++ /dev/null @@ -1,80 +0,0 @@ -package dev.u9g.minecraftdatagenerator.generators; - -import com.google.gson.JsonElement; -import com.google.gson.internal.Streams; -import com.google.gson.stream.JsonWriter; -import dev.u9g.minecraftdatagenerator.Main; - -import java.io.IOException; -import java.io.Writer; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.StandardOpenOption; -import java.text.MessageFormat; -import java.util.ArrayList; -import java.util.List; -import java.util.logging.Level; -import java.util.logging.Logger; - -public class DataGenerators { - - private static final List GENERATORS = new ArrayList<>(); - private static final Logger logger = Main.LOGGER; - - static { - register(new BiomesDataGenerator()); - register(new BlockCollisionShapesDataGenerator()); - register(new BlocksDataGenerator()); - register(new EffectsDataGenerator()); - register(new EnchantmentsDataGenerator()); - register(new EntitiesDataGenerator()); - register(new FoodsDataGenerator()); - register(new ItemsDataGenerator()); - register(new ParticlesDataGenerator()); - register(new TintsDataGenerator()); - register(new LanguageDataGenerator()); - register(new InstrumentsDataGenerator()); - register(new AttributesDataGenerator()); - } - - public static void register(IDataGenerator generator) { - GENERATORS.add(generator); - } - - public static boolean runDataGenerators(Path outputDirectory) { - try { - Files.createDirectories(outputDirectory); - } catch (IOException exception) { - logger.info("Failed to create data generator output directory at " + outputDirectory); - exception.printStackTrace(); - return false; - } - - int generatorsFailed = 0; - logger.info(MessageFormat.format("Running minecraft data generators, output at {0}", outputDirectory)); - - for (IDataGenerator dataGenerator : GENERATORS) { - logger.info(MessageFormat.format("Running generator {0}", dataGenerator.getDataName())); - try { - String outputFileName = String.format("%s.json", dataGenerator.getDataName()); - JsonElement outputElement = dataGenerator.generateDataJson(); - Path outputFilePath = outputDirectory.resolve(outputFileName); - - try (Writer writer = Files.newBufferedWriter(outputFilePath, StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING)) { - JsonWriter jsonWriter = new JsonWriter(writer); - jsonWriter.setIndent(" "); - Streams.write(outputElement, jsonWriter); - } - logger.info(MessageFormat.format("Generator: {0} -> {1}", dataGenerator.getDataName(), outputFileName)); - - } catch (Throwable exception) { - logger.info(MessageFormat.format("Failed to run data generator {0}", dataGenerator.getDataName())); - exception.printStackTrace(); - generatorsFailed++; - } - } - - logger.info("Finishing running data generators"); - return generatorsFailed == 0; - } -} diff --git a/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/generators/IDataGenerator.java b/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/generators/IDataGenerator.java deleted file mode 100644 index 81fe4e20..00000000 --- a/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/generators/IDataGenerator.java +++ /dev/null @@ -1,10 +0,0 @@ -package dev.u9g.minecraftdatagenerator.generators; - -import com.google.gson.JsonElement; - -public interface IDataGenerator { - - String getDataName(); - - JsonElement generateDataJson(); -} diff --git a/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java b/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java index 4412712d..81eaa063 100644 --- a/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java +++ b/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java @@ -25,14 +25,8 @@ public static BiomeTintColors generateBiomeTintColors() { BiomeTintColors colors = new BiomeTintColors(); for (Biome biome : Registries.BIOMES) { - EmptyBlockView bv = new EmptyBlockView() { - @Override - public Biome getBiome(BlockPos pos) { - return biome; - } - }; - int biomeGrassColor = GrassColors.getGrassColor(bv.getBiome(BlockPos.ORIGIN)); - int biomeFoliageColor = FoliageColors.getFoliageColor(bv.getBiome(BlockPos.ORIGIN)); + int biomeGrassColor = GrassColors.getGrassColor(biome); + int biomeFoliageColor = FoliageColors.getFoliageColor(biome); int biomeWaterColor = ((BiomeAccessor) biome).waterColor(); colors.grassColoursMap.computeIfAbsent(biomeGrassColor, k -> new ArrayList<>()).add(biome); diff --git a/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java b/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java index f5608f0a..c1d96581 100644 --- a/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java +++ b/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java @@ -1,7 +1,6 @@ package dev.u9g.minecraftdatagenerator.mixin; -import dev.u9g.minecraftdatagenerator.Main; -import dev.u9g.minecraftdatagenerator.generators.DataGenerators; +import dev.u9g.minecraftdatagenerator.MinecraftDataGenerator; import dev.u9g.minecraftdatagenerator.util.DGU; import net.minecraft.server.dedicated.MinecraftDedicatedServer; import org.spongepowered.asm.mixin.Mixin; @@ -9,19 +8,13 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -import java.nio.file.Path; -import java.util.logging.Level; - @Mixin(MinecraftDedicatedServer.class) public class ReadyMixin { @Inject(method = "setupServer()Z", at = @At("TAIL")) private void init(CallbackInfoReturnable cir) { - Main.LOGGER.info("Starting data generation!"); - String versionName = DGU.getCurrentlyRunningServer().getVersion(); - Path serverRootDirectory = DGU.getCurrentlyRunningServer().getRunDirectory().toPath().toAbsolutePath(); - Path dataDumpDirectory = serverRootDirectory.resolve("minecraft-data").resolve(versionName); - DataGenerators.runDataGenerators(dataDumpDirectory); - Main.LOGGER.info("Done data generation!"); - Runtime.getRuntime().halt(0); + MinecraftDataGenerator.start( + DGU.getCurrentlyRunningServer().getVersion(), + DGU.getCurrentlyRunningServer().getRunDirectory().toPath() + ); } } diff --git a/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java b/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java index 5f77e529..51fbb79e 100644 --- a/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java +++ b/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java @@ -15,7 +15,6 @@ public static MinecraftServer getCurrentlyRunningServer() { return (MinecraftServer) FabricLoader.getInstance().getGameInstance(); } - @Environment(EnvType.CLIENT) private static String translateTextClient(String translationKey) { return I18n.translate(translationKey); } diff --git a/1.8.9/src/main/resources/fabric.mod.json b/1.8.9/src/main/resources/fabric.mod.json index 96b7e403..12f9d70e 100644 --- a/1.8.9/src/main/resources/fabric.mod.json +++ b/1.8.9/src/main/resources/fabric.mod.json @@ -11,16 +11,11 @@ "contact": {}, "license": "MIT", "environment": "server", - "entrypoints": { - "main": [ - "dev.u9g.minecraftdatagenerator.Main" - ] - }, "mixins": [ "minecraft-data-generator.mixins.json" ], "depends": { - "fabricloader": ">=0.13.3", - "minecraft": ">=1.8.9" + "fabricloader": "*", + "minecraft": "*" } } diff --git a/1.9.4/build.gradle b/1.9.4/build.gradle index 057916c6..a0489215 100644 --- a/1.9.4/build.gradle +++ b/1.9.4/build.gradle @@ -25,6 +25,8 @@ dependencies { // exclude module: "legacy-fabric-entity-events-v1" // } + implementation(projects.common) + if (System.getProperty("os.name").toLowerCase().contains("mac")) { implementation 'org.lwjgl.lwjgl:lwjgl_util:2.9.4-nightly-20150209' implementation 'org.lwjgl.lwjgl:lwjgl:2.9.4-nightly-20150209' diff --git a/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/Main.java b/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/Main.java deleted file mode 100644 index d23c5ba2..00000000 --- a/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/Main.java +++ /dev/null @@ -1,13 +0,0 @@ -package dev.u9g.minecraftdatagenerator; - -import net.fabricmc.api.ModInitializer; - -import java.util.logging.Logger; - -public class Main implements ModInitializer { - public static final Logger LOGGER = Logger.getLogger("mc-data-gen-serv"); - - @Override - public void onInitialize() { - } -} diff --git a/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java b/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java index dbea9f6e..e30f6a0c 100644 --- a/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java +++ b/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java @@ -4,7 +4,6 @@ import com.google.gson.JsonArray; import com.google.gson.JsonObject; import com.google.gson.JsonPrimitive; -import dev.u9g.minecraftdatagenerator.Main; import dev.u9g.minecraftdatagenerator.mixin.BlockAccessor; import dev.u9g.minecraftdatagenerator.mixin.MiningToolItemAccessor; import dev.u9g.minecraftdatagenerator.util.DGU; @@ -30,11 +29,7 @@ import java.util.Objects; import java.util.logging.Logger; -public class BlocksDataGenerator implements IDataGenerator { - - private static final Logger logger = Main.LOGGER; - - private static List getItemsEffectiveForBlock(Block block) { +public class BlocksDataGenerator implements IDataGenerator {private static List getItemsEffectiveForBlock(Block block) { List items = new ArrayList<>(); for (Item item : Registries.ITEMS) { if (item instanceof ToolItem && ((MiningToolItemAccessor) item).getEffectiveBlocks().contains(block)) { diff --git a/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/DataGenerators.java b/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/DataGenerators.java deleted file mode 100644 index c89d0777..00000000 --- a/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/DataGenerators.java +++ /dev/null @@ -1,81 +0,0 @@ -package dev.u9g.minecraftdatagenerator.generators; - -import com.google.gson.JsonElement; -import com.google.gson.internal.Streams; -import com.google.gson.stream.JsonWriter; -import dev.u9g.minecraftdatagenerator.Main; - -import java.io.IOException; -import java.io.Writer; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.StandardOpenOption; -import java.text.MessageFormat; -import java.util.ArrayList; -import java.util.List; -import java.util.logging.Level; -import java.util.logging.Logger; - -public class DataGenerators { - - private static final List GENERATORS = new ArrayList<>(); - private static final Logger logger = Main.LOGGER; - - static { - register(new BiomesDataGenerator()); - register(new BlockCollisionShapesDataGenerator()); - register(new BlocksDataGenerator()); - register(new EffectsDataGenerator()); - register(new EnchantmentsDataGenerator()); - register(new EntitiesDataGenerator()); - register(new FoodsDataGenerator()); - register(new ItemsDataGenerator()); - register(new ParticlesDataGenerator()); - register(new TintsDataGenerator()); - register(new LanguageDataGenerator()); - register(new InstrumentsDataGenerator()); - register(new AttributesDataGenerator()); - register(new SoundsDataGenerator()); - } - - public static void register(IDataGenerator generator) { - GENERATORS.add(generator); - } - - public static boolean runDataGenerators(Path outputDirectory) { - try { - Files.createDirectories(outputDirectory); - } catch (IOException exception) { - logger.info("Failed to create data generator output directory at " + outputDirectory); - exception.printStackTrace(); - return false; - } - - int generatorsFailed = 0; - logger.info(MessageFormat.format("Running minecraft data generators, output at {0}", outputDirectory)); - - for (IDataGenerator dataGenerator : GENERATORS) { - logger.info(MessageFormat.format("Running generator {0}", dataGenerator.getDataName())); - try { - String outputFileName = String.format("%s.json", dataGenerator.getDataName()); - JsonElement outputElement = dataGenerator.generateDataJson(); - Path outputFilePath = outputDirectory.resolve(outputFileName); - - try (Writer writer = Files.newBufferedWriter(outputFilePath, StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING)) { - JsonWriter jsonWriter = new JsonWriter(writer); - jsonWriter.setIndent(" "); - Streams.write(outputElement, jsonWriter); - } - logger.info(MessageFormat.format("Generator: {0} -> {1}", dataGenerator.getDataName(), outputFileName)); - - } catch (Throwable exception) { - logger.info(MessageFormat.format("Failed to run data generator {0}", dataGenerator.getDataName())); - exception.printStackTrace(); - generatorsFailed++; - } - } - - logger.info("Finishing running data generators"); - return generatorsFailed == 0; - } -} diff --git a/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/IDataGenerator.java b/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/IDataGenerator.java deleted file mode 100644 index 81fe4e20..00000000 --- a/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/IDataGenerator.java +++ /dev/null @@ -1,10 +0,0 @@ -package dev.u9g.minecraftdatagenerator.generators; - -import com.google.gson.JsonElement; - -public interface IDataGenerator { - - String getDataName(); - - JsonElement generateDataJson(); -} diff --git a/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java b/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java index 8d1b2a84..fb21b763 100644 --- a/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java +++ b/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java @@ -27,14 +27,8 @@ public static BiomeTintColors generateBiomeTintColors() { BiomeTintColors colors = new BiomeTintColors(); for (Biome biome : Registries.BIOMES) { - EmptyBlockView bv = new EmptyBlockView() { - @Override - public Biome getBiome(BlockPos pos) { - return biome; - } - }; - int biomeGrassColor = GrassColors.getGrassColor(bv.getBiome(BlockPos.ORIGIN)); - int biomeFoliageColor = FoliageColors.getFoliageColor(bv.getBiome(BlockPos.ORIGIN)); + int biomeGrassColor = GrassColors.getGrassColor(biome); + int biomeFoliageColor = FoliageColors.getFoliageColor(biome); int biomeWaterColor = ((BiomeAccessor) biome).waterColor(); colors.grassColoursMap.computeIfAbsent(biomeGrassColor, k -> new ArrayList<>()).add(biome); diff --git a/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java b/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java index f5608f0a..c1d96581 100644 --- a/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java +++ b/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java @@ -1,7 +1,6 @@ package dev.u9g.minecraftdatagenerator.mixin; -import dev.u9g.minecraftdatagenerator.Main; -import dev.u9g.minecraftdatagenerator.generators.DataGenerators; +import dev.u9g.minecraftdatagenerator.MinecraftDataGenerator; import dev.u9g.minecraftdatagenerator.util.DGU; import net.minecraft.server.dedicated.MinecraftDedicatedServer; import org.spongepowered.asm.mixin.Mixin; @@ -9,19 +8,13 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -import java.nio.file.Path; -import java.util.logging.Level; - @Mixin(MinecraftDedicatedServer.class) public class ReadyMixin { @Inject(method = "setupServer()Z", at = @At("TAIL")) private void init(CallbackInfoReturnable cir) { - Main.LOGGER.info("Starting data generation!"); - String versionName = DGU.getCurrentlyRunningServer().getVersion(); - Path serverRootDirectory = DGU.getCurrentlyRunningServer().getRunDirectory().toPath().toAbsolutePath(); - Path dataDumpDirectory = serverRootDirectory.resolve("minecraft-data").resolve(versionName); - DataGenerators.runDataGenerators(dataDumpDirectory); - Main.LOGGER.info("Done data generation!"); - Runtime.getRuntime().halt(0); + MinecraftDataGenerator.start( + DGU.getCurrentlyRunningServer().getVersion(), + DGU.getCurrentlyRunningServer().getRunDirectory().toPath() + ); } } diff --git a/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java b/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java index 8edd9a23..72ae2469 100644 --- a/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java +++ b/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java @@ -21,8 +21,7 @@ public class DGU { -// @Environment(EnvType.CLIENT) -// private static MinecraftServer getCurrentlyRunningServerClient() { +//// private static MinecraftServer getCurrentlyRunningServerClient() { // return MinecraftClient.getInstance().getServer(); // } // @@ -51,7 +50,6 @@ public static MinecraftServer getCurrentlyRunningServer() { return (MinecraftServer) FabricLoader.getInstance().getGameInstance(); } - @Environment(EnvType.CLIENT) private static String translateTextClient(String translationKey) { return I18n.translate(translationKey); } diff --git a/1.9.4/src/main/resources/fabric.mod.json b/1.9.4/src/main/resources/fabric.mod.json index ad1562f2..12f9d70e 100644 --- a/1.9.4/src/main/resources/fabric.mod.json +++ b/1.9.4/src/main/resources/fabric.mod.json @@ -11,16 +11,11 @@ "contact": {}, "license": "MIT", "environment": "server", - "entrypoints": { - "main": [ - "dev.u9g.minecraftdatagenerator.Main" - ] - }, "mixins": [ "minecraft-data-generator.mixins.json" ], "depends": { - "fabricloader": ">=0.13.3", - "minecraft": ">=1.9" + "fabricloader": "*", + "minecraft": "*" } } diff --git a/22w19a/build.gradle b/22w19a/build.gradle index e85de392..73e874d0 100644 --- a/22w19a/build.gradle +++ b/22w19a/build.gradle @@ -10,6 +10,8 @@ dependencies { // Fabric API. This is technically optional, but you probably want it anyway. modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" + + implementation(projects.common) } processResources { diff --git a/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/Main.java b/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/Main.java deleted file mode 100644 index f8d17372..00000000 --- a/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/Main.java +++ /dev/null @@ -1,14 +0,0 @@ -package dev.u9g.minecraftdatagenerator; - -import net.fabricmc.api.ModInitializer; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class Main implements ModInitializer { - public static final Logger LOGGER = LoggerFactory.getLogger("mc-data-gen-serv"); - - @Override - public void onInitialize() { - - } -} diff --git a/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/generators/DataGenerators.java b/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/generators/DataGenerators.java deleted file mode 100644 index 1c755d5e..00000000 --- a/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/generators/DataGenerators.java +++ /dev/null @@ -1,78 +0,0 @@ -package dev.u9g.minecraftdatagenerator.generators; - -import com.google.gson.JsonElement; -import com.google.gson.internal.Streams; -import com.google.gson.stream.JsonWriter; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.IOException; -import java.io.Writer; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.StandardOpenOption; -import java.util.ArrayList; -import java.util.List; - -public class DataGenerators { - - private static final Logger logger = LoggerFactory.getLogger(DataGenerators.class); - private static final List GENERATORS = new ArrayList<>(); - - static { - register(new BiomesDataGenerator()); - register(new BlockCollisionShapesDataGenerator()); - register(new BlocksDataGenerator()); - register(new EffectsDataGenerator()); - register(new EnchantmentsDataGenerator()); - register(new EntitiesDataGenerator()); - register(new FoodsDataGenerator()); - register(new ItemsDataGenerator()); - register(new ParticlesDataGenerator()); - register(new TintsDataGenerator()); -// register(new MaterialsDataGenerator()); -// register(new RecipeDataGenerator()); - On hold until mcdata supports multiple materials for a recipe - register(new LanguageDataGenerator()); - register(new InstrumentsDataGenerator()); - register(new SoundsDataGenerator()); - } - - public static void register(IDataGenerator generator) { - GENERATORS.add(generator); - } - - public static boolean runDataGenerators(Path outputDirectory) { - try { - Files.createDirectories(outputDirectory); - } catch (IOException exception) { - logger.error("Failed to create data generator output directory at {}", outputDirectory, exception); - return false; - } - - int generatorsFailed = 0; - logger.info("Running minecraft data generators, output at {}", outputDirectory); - - for (IDataGenerator dataGenerator : GENERATORS) { - logger.info("Running generator {}", dataGenerator.getDataName()); - try { - String outputFileName = String.format("%s.json", dataGenerator.getDataName()); - JsonElement outputElement = dataGenerator.generateDataJson(); - Path outputFilePath = outputDirectory.resolve(outputFileName); - - try (Writer writer = Files.newBufferedWriter(outputFilePath, StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING)) { - JsonWriter jsonWriter = new JsonWriter(writer); - jsonWriter.setIndent(" "); - Streams.write(outputElement, jsonWriter); - } - logger.info("Generator: {} -> {}", dataGenerator.getDataName(), outputFileName); - - } catch (Throwable exception) { - logger.error("Failed to run data generator {}", dataGenerator.getDataName(), exception); - generatorsFailed++; - } - } - - logger.info("Finishing running data generators"); - return generatorsFailed == 0; - } -} diff --git a/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/generators/IDataGenerator.java b/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/generators/IDataGenerator.java deleted file mode 100644 index 81fe4e20..00000000 --- a/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/generators/IDataGenerator.java +++ /dev/null @@ -1,10 +0,0 @@ -package dev.u9g.minecraftdatagenerator.generators; - -import com.google.gson.JsonElement; - -public interface IDataGenerator { - - String getDataName(); - - JsonElement generateDataJson(); -} diff --git a/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java b/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java index ba3b26b4..c904c153 100644 --- a/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java +++ b/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java @@ -1,7 +1,6 @@ package dev.u9g.minecraftdatagenerator.mixin; -import dev.u9g.minecraftdatagenerator.Main; -import dev.u9g.minecraftdatagenerator.generators.DataGenerators; +import dev.u9g.minecraftdatagenerator.MinecraftDataGenerator; import dev.u9g.minecraftdatagenerator.util.DGU; import net.minecraft.MinecraftVersion; import net.minecraft.server.dedicated.MinecraftDedicatedServer; @@ -10,18 +9,13 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -import java.nio.file.Path; - @Mixin(MinecraftDedicatedServer.class) public class ReadyMixin { @Inject(method = "setupServer()Z", at = @At("TAIL")) private void init(CallbackInfoReturnable cir) { - Main.LOGGER.info("Starting data generation!"); - String versionName = MinecraftVersion.CURRENT.getName(); - Path serverRootDirectory = DGU.getCurrentlyRunningServer().getRunDirectory().toPath().toAbsolutePath(); - Path dataDumpDirectory = serverRootDirectory.resolve("minecraft-data").resolve(versionName); - DataGenerators.runDataGenerators(dataDumpDirectory); - Main.LOGGER.info("Done data generation!"); - Runtime.getRuntime().halt(0); + MinecraftDataGenerator.start( + MinecraftVersion.CURRENT.getName(), + DGU.getCurrentlyRunningServer().getRunDirectory().toPath() + ); } } diff --git a/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java b/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java index 5945fa02..bd5ea21d 100644 --- a/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java +++ b/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java @@ -13,7 +13,6 @@ public class DGU { private static final Language language = Language.getInstance(); - @Environment(EnvType.CLIENT) private static MinecraftServer getCurrentlyRunningServerClient() { return MinecraftClient.getInstance().getServer(); } @@ -33,7 +32,6 @@ public static MinecraftServer getCurrentlyRunningServer() { throw new UnsupportedOperationException(); } - @Environment(EnvType.CLIENT) private static String translateTextClient(String translationKey) { return I18n.translate(translationKey); } diff --git a/22w19a/src/main/resources/fabric.mod.json b/22w19a/src/main/resources/fabric.mod.json index 9f6ef321..dff18a06 100644 --- a/22w19a/src/main/resources/fabric.mod.json +++ b/22w19a/src/main/resources/fabric.mod.json @@ -11,17 +11,12 @@ "contact": {}, "license": "MIT", "environment": "server", - "entrypoints": { - "main": [ - "dev.u9g.minecraftdatagenerator.Main" - ] - }, "mixins": [ "minecraft-data-generator.mixins.json" ], "depends": { - "fabricloader": ">=0.14.5", + "fabricloader": "*", "fabric": "*", - "minecraft": ">=1.18" + "minecraft": "*" } } diff --git a/common/build.gradle b/common/build.gradle new file mode 100644 index 00000000..5f359ad0 --- /dev/null +++ b/common/build.gradle @@ -0,0 +1,18 @@ +plugins { + id 'java' +} + +dependencies { + compileOnly 'com.google.code.gson:gson:2.10.1' + implementation 'io.github.classgraph:classgraph:4.8.172' +} + +tasks.withType(JavaCompile).configureEach { + it.options.encoding = "UTF-8" +} + +java { + toolchain { + languageVersion.set(JavaLanguageVersion.of(17)) + } +} diff --git a/common/src/main/java/dev/u9g/minecraftdatagenerator/MinecraftDataGenerator.java b/common/src/main/java/dev/u9g/minecraftdatagenerator/MinecraftDataGenerator.java new file mode 100644 index 00000000..a9ad0e5f --- /dev/null +++ b/common/src/main/java/dev/u9g/minecraftdatagenerator/MinecraftDataGenerator.java @@ -0,0 +1,18 @@ +package dev.u9g.minecraftdatagenerator; + +import dev.u9g.minecraftdatagenerator.generators.DataGenerators; + +import java.nio.file.Path; +import java.util.logging.Logger; + +public class MinecraftDataGenerator { + public static final Logger LOGGER = Logger.getLogger("mc-data-gen-serv"); + + public static void start(String versionName, Path serverRootDirectory) { + MinecraftDataGenerator.LOGGER.info("Starting data generation!"); + Path dataDumpDirectory = serverRootDirectory.resolve("minecraft-data").resolve(versionName); + DataGenerators.runDataGenerators(dataDumpDirectory); + MinecraftDataGenerator.LOGGER.info("Done data generation!"); + Runtime.getRuntime().halt(0); + } +} diff --git a/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/DataGenerators.java b/common/src/main/java/dev/u9g/minecraftdatagenerator/generators/DataGenerators.java similarity index 69% rename from 1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/DataGenerators.java rename to common/src/main/java/dev/u9g/minecraftdatagenerator/generators/DataGenerators.java index c89d0777..e5026a9a 100644 --- a/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/DataGenerators.java +++ b/common/src/main/java/dev/u9g/minecraftdatagenerator/generators/DataGenerators.java @@ -3,7 +3,9 @@ import com.google.gson.JsonElement; import com.google.gson.internal.Streams; import com.google.gson.stream.JsonWriter; -import dev.u9g.minecraftdatagenerator.Main; +import dev.u9g.minecraftdatagenerator.MinecraftDataGenerator; +import io.github.classgraph.ClassGraph; +import io.github.classgraph.ScanResult; import java.io.IOException; import java.io.Writer; @@ -13,33 +15,29 @@ import java.text.MessageFormat; import java.util.ArrayList; import java.util.List; -import java.util.logging.Level; import java.util.logging.Logger; public class DataGenerators { - private static final List GENERATORS = new ArrayList<>(); - private static final Logger logger = Main.LOGGER; + private static final Logger logger = MinecraftDataGenerator.LOGGER; static { - register(new BiomesDataGenerator()); - register(new BlockCollisionShapesDataGenerator()); - register(new BlocksDataGenerator()); - register(new EffectsDataGenerator()); - register(new EnchantmentsDataGenerator()); - register(new EntitiesDataGenerator()); - register(new FoodsDataGenerator()); - register(new ItemsDataGenerator()); - register(new ParticlesDataGenerator()); - register(new TintsDataGenerator()); - register(new LanguageDataGenerator()); - register(new InstrumentsDataGenerator()); - register(new AttributesDataGenerator()); - register(new SoundsDataGenerator()); - } + List> generators; + try (ScanResult scanResult = new ClassGraph().acceptPackages("dev.u9g.minecraftdatagenerator.generators") + .enableClassInfo().scan()) { + generators = scanResult + .getSubclasses(IDataGenerator.class.getName()) + .loadClasses(IDataGenerator.class); + } - public static void register(IDataGenerator generator) { - GENERATORS.add(generator); + for (Class generatorClass : generators) { + try { + GENERATORS.add(generatorClass.getDeclaredConstructor().newInstance()); + } catch (ReflectiveOperationException exception) { + logger.info(MessageFormat.format("Failed to instantiate data generator {0}", generatorClass.getName())); + exception.printStackTrace(); + } + } } public static boolean runDataGenerators(Path outputDirectory) { diff --git a/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/IDataGenerator.java b/common/src/main/java/dev/u9g/minecraftdatagenerator/generators/IDataGenerator.java similarity index 99% rename from 1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/IDataGenerator.java rename to common/src/main/java/dev/u9g/minecraftdatagenerator/generators/IDataGenerator.java index 81fe4e20..39276f49 100644 --- a/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/IDataGenerator.java +++ b/common/src/main/java/dev/u9g/minecraftdatagenerator/generators/IDataGenerator.java @@ -3,7 +3,6 @@ import com.google.gson.JsonElement; public interface IDataGenerator { - String getDataName(); JsonElement generateDataJson(); diff --git a/settings.gradle b/settings.gradle index ab5a1968..28c1c9f1 100644 --- a/settings.gradle +++ b/settings.gradle @@ -11,6 +11,8 @@ pluginManagement { } } +enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS") + dependencyResolutionManagement { repositories { maven { @@ -29,6 +31,8 @@ dependencyResolutionManagement { } } +include "common" + [ "1.7", "1.8.9", @@ -47,4 +51,8 @@ dependencyResolutionManagement { "1.19.2", "1.20", "1.20.4", -].forEach { include it } +].forEach { + var projectName = "mc-" + it.replace(".", "-") + include(projectName) + project(":$projectName").projectDir = file(it) +} From b88dce4bf581ce6d6baba9abaf7f00387152c61e Mon Sep 17 00:00:00 2001 From: AlexProgrammerDE <40795980+AlexProgrammerDE@users.noreply.github.com> Date: Sun, 28 Apr 2024 19:32:54 +0200 Subject: [PATCH 02/38] Fix gradle task name --- .github/workflows/build.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c1bb07f4..c6069d8a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -25,16 +25,16 @@ jobs: - name: Validate Gradle wrapper uses: gradle/wrapper-validation-action@v1 - - name: Set up JDK 17 + - name: Set up JDK 21 uses: actions/setup-java@v4 with: - java-version: '17' + java-version: '21' distribution: 'temurin' - name: Generate ${{ matrix.version }} uses: gradle/gradle-build-action@v2 with: - arguments: :${{ matrix.version }}:runServer + arguments: :mc-${{ matrix.version }}:runServer - name: Upload artifact uses: actions/upload-artifact@v4 From 370a5616e5f1d1df800a9c6e50435791ab9c26db Mon Sep 17 00:00:00 2001 From: AlexProgrammerDE <40795980+AlexProgrammerDE@users.noreply.github.com> Date: Sun, 28 Apr 2024 19:37:29 +0200 Subject: [PATCH 03/38] Revert name changes --- 1.10.2/build.gradle | 2 +- 1.11.2/build.gradle | 2 +- 1.12.2/build.gradle | 2 +- 1.13/build.gradle | 2 +- 1.14/build.gradle | 2 +- 1.15/build.gradle | 2 +- 1.16/build.gradle | 2 +- 1.17/build.gradle | 2 +- 1.18/build.gradle | 2 +- 1.19.2/build.gradle | 2 +- 1.19/build.gradle | 2 +- 1.20.4/build.gradle | 2 +- 1.20/build.gradle | 2 +- 1.7/build.gradle | 2 +- 1.8.9/build.gradle | 2 +- 1.9.4/build.gradle | 2 +- 22w19a/build.gradle | 2 +- settings.gradle | 8 +------- 18 files changed, 18 insertions(+), 24 deletions(-) diff --git a/1.10.2/build.gradle b/1.10.2/build.gradle index a0489215..35b4361e 100644 --- a/1.10.2/build.gradle +++ b/1.10.2/build.gradle @@ -25,7 +25,7 @@ dependencies { // exclude module: "legacy-fabric-entity-events-v1" // } - implementation(projects.common) + implementation(project(":common")) if (System.getProperty("os.name").toLowerCase().contains("mac")) { implementation 'org.lwjgl.lwjgl:lwjgl_util:2.9.4-nightly-20150209' diff --git a/1.11.2/build.gradle b/1.11.2/build.gradle index a0489215..35b4361e 100644 --- a/1.11.2/build.gradle +++ b/1.11.2/build.gradle @@ -25,7 +25,7 @@ dependencies { // exclude module: "legacy-fabric-entity-events-v1" // } - implementation(projects.common) + implementation(project(":common")) if (System.getProperty("os.name").toLowerCase().contains("mac")) { implementation 'org.lwjgl.lwjgl:lwjgl_util:2.9.4-nightly-20150209' diff --git a/1.12.2/build.gradle b/1.12.2/build.gradle index a0489215..35b4361e 100644 --- a/1.12.2/build.gradle +++ b/1.12.2/build.gradle @@ -25,7 +25,7 @@ dependencies { // exclude module: "legacy-fabric-entity-events-v1" // } - implementation(projects.common) + implementation(project(":common")) if (System.getProperty("os.name").toLowerCase().contains("mac")) { implementation 'org.lwjgl.lwjgl:lwjgl_util:2.9.4-nightly-20150209' diff --git a/1.13/build.gradle b/1.13/build.gradle index a0489215..35b4361e 100644 --- a/1.13/build.gradle +++ b/1.13/build.gradle @@ -25,7 +25,7 @@ dependencies { // exclude module: "legacy-fabric-entity-events-v1" // } - implementation(projects.common) + implementation(project(":common")) if (System.getProperty("os.name").toLowerCase().contains("mac")) { implementation 'org.lwjgl.lwjgl:lwjgl_util:2.9.4-nightly-20150209' diff --git a/1.14/build.gradle b/1.14/build.gradle index 13f2b0b7..09d52347 100644 --- a/1.14/build.gradle +++ b/1.14/build.gradle @@ -11,7 +11,7 @@ dependencies { // Fabric API. This is technically optional, but you probably want it anyway. modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" - implementation(projects.common) + implementation(project(":common")) } processResources { diff --git a/1.15/build.gradle b/1.15/build.gradle index 73e874d0..efe24728 100644 --- a/1.15/build.gradle +++ b/1.15/build.gradle @@ -11,7 +11,7 @@ dependencies { // Fabric API. This is technically optional, but you probably want it anyway. modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" - implementation(projects.common) + implementation(project(":common")) } processResources { diff --git a/1.16/build.gradle b/1.16/build.gradle index 73e874d0..efe24728 100644 --- a/1.16/build.gradle +++ b/1.16/build.gradle @@ -11,7 +11,7 @@ dependencies { // Fabric API. This is technically optional, but you probably want it anyway. modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" - implementation(projects.common) + implementation(project(":common")) } processResources { diff --git a/1.17/build.gradle b/1.17/build.gradle index 73e874d0..efe24728 100644 --- a/1.17/build.gradle +++ b/1.17/build.gradle @@ -11,7 +11,7 @@ dependencies { // Fabric API. This is technically optional, but you probably want it anyway. modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" - implementation(projects.common) + implementation(project(":common")) } processResources { diff --git a/1.18/build.gradle b/1.18/build.gradle index 73e874d0..efe24728 100644 --- a/1.18/build.gradle +++ b/1.18/build.gradle @@ -11,7 +11,7 @@ dependencies { // Fabric API. This is technically optional, but you probably want it anyway. modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" - implementation(projects.common) + implementation(project(":common")) } processResources { diff --git a/1.19.2/build.gradle b/1.19.2/build.gradle index 73e874d0..efe24728 100644 --- a/1.19.2/build.gradle +++ b/1.19.2/build.gradle @@ -11,7 +11,7 @@ dependencies { // Fabric API. This is technically optional, but you probably want it anyway. modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" - implementation(projects.common) + implementation(project(":common")) } processResources { diff --git a/1.19/build.gradle b/1.19/build.gradle index 73e874d0..efe24728 100644 --- a/1.19/build.gradle +++ b/1.19/build.gradle @@ -11,7 +11,7 @@ dependencies { // Fabric API. This is technically optional, but you probably want it anyway. modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" - implementation(projects.common) + implementation(project(":common")) } processResources { diff --git a/1.20.4/build.gradle b/1.20.4/build.gradle index 73e874d0..efe24728 100644 --- a/1.20.4/build.gradle +++ b/1.20.4/build.gradle @@ -11,7 +11,7 @@ dependencies { // Fabric API. This is technically optional, but you probably want it anyway. modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" - implementation(projects.common) + implementation(project(":common")) } processResources { diff --git a/1.20/build.gradle b/1.20/build.gradle index 73e874d0..efe24728 100644 --- a/1.20/build.gradle +++ b/1.20/build.gradle @@ -11,7 +11,7 @@ dependencies { // Fabric API. This is technically optional, but you probably want it anyway. modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" - implementation(projects.common) + implementation(project(":common")) } processResources { diff --git a/1.7/build.gradle b/1.7/build.gradle index 2b7bfd60..68563dd8 100644 --- a/1.7/build.gradle +++ b/1.7/build.gradle @@ -32,7 +32,7 @@ dependencies { // exclude module: "legacy-fabric-entity-events-v1" // } - implementation(projects.common) + implementation(project(":common")) if (System.getProperty("os.name").toLowerCase().contains("mac")) { implementation 'org.lwjgl.lwjgl:lwjgl_util:2.9.4-nightly-20150209' diff --git a/1.8.9/build.gradle b/1.8.9/build.gradle index a0489215..35b4361e 100644 --- a/1.8.9/build.gradle +++ b/1.8.9/build.gradle @@ -25,7 +25,7 @@ dependencies { // exclude module: "legacy-fabric-entity-events-v1" // } - implementation(projects.common) + implementation(project(":common")) if (System.getProperty("os.name").toLowerCase().contains("mac")) { implementation 'org.lwjgl.lwjgl:lwjgl_util:2.9.4-nightly-20150209' diff --git a/1.9.4/build.gradle b/1.9.4/build.gradle index a0489215..35b4361e 100644 --- a/1.9.4/build.gradle +++ b/1.9.4/build.gradle @@ -25,7 +25,7 @@ dependencies { // exclude module: "legacy-fabric-entity-events-v1" // } - implementation(projects.common) + implementation(project(":common")) if (System.getProperty("os.name").toLowerCase().contains("mac")) { implementation 'org.lwjgl.lwjgl:lwjgl_util:2.9.4-nightly-20150209' diff --git a/22w19a/build.gradle b/22w19a/build.gradle index 73e874d0..efe24728 100644 --- a/22w19a/build.gradle +++ b/22w19a/build.gradle @@ -11,7 +11,7 @@ dependencies { // Fabric API. This is technically optional, but you probably want it anyway. modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" - implementation(projects.common) + implementation(project(":common")) } processResources { diff --git a/settings.gradle b/settings.gradle index 28c1c9f1..b76eb22b 100644 --- a/settings.gradle +++ b/settings.gradle @@ -11,8 +11,6 @@ pluginManagement { } } -enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS") - dependencyResolutionManagement { repositories { maven { @@ -51,8 +49,4 @@ include "common" "1.19.2", "1.20", "1.20.4", -].forEach { - var projectName = "mc-" + it.replace(".", "-") - include(projectName) - project(":$projectName").projectDir = file(it) -} +].forEach { include it } From 2b6845fee5ad2653c1a460124bf4fd8282e46391 Mon Sep 17 00:00:00 2001 From: AlexProgrammerDE <40795980+AlexProgrammerDE@users.noreply.github.com> Date: Sun, 28 Apr 2024 19:38:42 +0200 Subject: [PATCH 04/38] Revert action name --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c6069d8a..83f7ddf4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -34,7 +34,7 @@ jobs: - name: Generate ${{ matrix.version }} uses: gradle/gradle-build-action@v2 with: - arguments: :mc-${{ matrix.version }}:runServer + arguments: :${{ matrix.version }}:runServer - name: Upload artifact uses: actions/upload-artifact@v4 From 3cae58863f1a3234efc466033da07e9b4419f79f Mon Sep 17 00:00:00 2001 From: AlexProgrammerDE <40795980+AlexProgrammerDE@users.noreply.github.com> Date: Sun, 28 Apr 2024 19:45:25 +0200 Subject: [PATCH 05/38] Cleanup --- .../BlockCollisionShapesDataGenerator.java | 22 +++++++------- .../generators/BlocksDataGenerator.java | 4 +-- .../u9g/minecraftdatagenerator/util/DGU.java | 1 - .../BlockCollisionShapesDataGenerator.java | 29 ++++++++++--------- .../generators/BlocksDataGenerator.java | 4 +-- .../generators/EnchantmentsDataGenerator.java | 8 +++-- .../generators/EntitiesDataGenerator.java | 10 +++++-- .../u9g/minecraftdatagenerator/util/DGU.java | 1 - .../BlockCollisionShapesDataGenerator.java | 22 +++++++------- .../generators/BlocksDataGenerator.java | 4 +-- .../generators/SoundsDataGenerator.java | 1 - .../u9g/minecraftdatagenerator/util/DGU.java | 1 - .../generators/BlocksDataGenerator.java | 4 +-- .../generators/SoundsDataGenerator.java | 2 +- .../u9g/minecraftdatagenerator/util/DGU.java | 1 - .../generators/BlocksDataGenerator.java | 4 +-- .../generators/SoundsDataGenerator.java | 2 +- .../u9g/minecraftdatagenerator/util/DGU.java | 1 - .../generators/BlocksDataGenerator.java | 4 +-- .../generators/EntitiesDataGenerator.java | 4 +-- .../generators/SoundsDataGenerator.java | 2 +- .../u9g/minecraftdatagenerator/util/DGU.java | 1 - .../generators/BlocksDataGenerator.java | 4 +-- .../generators/EnchantmentsDataGenerator.java | 1 - .../generators/SoundsDataGenerator.java | 2 +- .../u9g/minecraftdatagenerator/util/DGU.java | 1 - .../generators/EnchantmentsDataGenerator.java | 1 - .../generators/SoundsDataGenerator.java | 2 +- .../u9g/minecraftdatagenerator/util/DGU.java | 1 - .../generators/EnchantmentsDataGenerator.java | 1 - .../generators/SoundsDataGenerator.java | 2 +- .../u9g/minecraftdatagenerator/util/DGU.java | 1 - .../generators/EnchantmentsDataGenerator.java | 1 - .../generators/SoundsDataGenerator.java | 2 +- .../generators/EnchantmentsDataGenerator.java | 1 - .../generators/BiomesDataGenerator.java | 1 - .../generators/EnchantmentsDataGenerator.java | 1 - .../generators/EntitiesDataGenerator.java | 4 +-- .../generators/EnchantmentsDataGenerator.java | 1 - .../generators/SoundsDataGenerator.java | 2 +- .../BlockCollisionShapesDataGenerator.java | 22 +++++++------- .../generators/BlocksDataGenerator.java | 1 - .../u9g/minecraftdatagenerator/util/DGU.java | 1 - .../BlockCollisionShapesDataGenerator.java | 22 +++++++------- .../generators/BlocksDataGenerator.java | 1 - .../generators/TintsDataGenerator.java | 2 -- .../u9g/minecraftdatagenerator/util/DGU.java | 1 - .../BlockCollisionShapesDataGenerator.java | 22 +++++++------- .../generators/BlocksDataGenerator.java | 4 +-- .../generators/TintsDataGenerator.java | 2 -- .../u9g/minecraftdatagenerator/util/DGU.java | 1 - .../generators/EnchantmentsDataGenerator.java | 1 - .../u9g/minecraftdatagenerator/util/DGU.java | 1 - 53 files changed, 112 insertions(+), 130 deletions(-) diff --git a/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java b/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java index 2bb5a0be..357bab59 100644 --- a/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java +++ b/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java @@ -99,18 +99,18 @@ public JsonObject toJSON() { private record Shapes(List boxes) { public JsonArray toJSON() { - JsonArray arr = new JsonArray(); - boxes.forEach(box -> arr.add(jsonOf(box))); - return arr; - } + JsonArray arr = new JsonArray(); + boxes.forEach(box -> arr.add(jsonOf(box))); + return arr; + } - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - Shapes shapes = (Shapes) o; - return Objects.equals(boxes, shapes.boxes); - } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + Shapes shapes = (Shapes) o; + return Objects.equals(boxes, shapes.boxes); + } } } diff --git a/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java b/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java index 7d274722..1ec40aea 100644 --- a/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java +++ b/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java @@ -27,9 +27,9 @@ import java.util.Collection; import java.util.List; import java.util.Objects; -import java.util.logging.Logger; -public class BlocksDataGenerator implements IDataGenerator {private static List getItemsEffectiveForBlock(Block block) { +public class BlocksDataGenerator implements IDataGenerator { + private static List getItemsEffectiveForBlock(Block block) { List items = new ArrayList<>(); for (Item item : Registries.ITEMS) { if (item instanceof ToolItem && ((MiningToolItemAccessor) item).getEffectiveBlocks().contains(block)) { diff --git a/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java b/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java index bef2bf1c..4d48d1ed 100644 --- a/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java +++ b/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java @@ -8,7 +8,6 @@ import com.google.gson.stream.JsonToken; import com.google.gson.stream.JsonWriter; import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; import net.fabricmc.loader.api.FabricLoader; import net.minecraft.client.MinecraftClient; import net.minecraft.client.resource.language.I18n; diff --git a/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java b/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java index 47cac43b..d61e8b4c 100644 --- a/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java +++ b/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java @@ -6,11 +6,14 @@ import com.google.gson.JsonPrimitive; import dev.u9g.minecraftdatagenerator.util.DGU; import dev.u9g.minecraftdatagenerator.util.Registries; -import net.minecraft.block.*; +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Box; -import java.util.*; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; public class BlockCollisionShapesDataGenerator implements IDataGenerator { private static final Box ENTITY_BOX = new Box(0.0D, 0.0D, 0.0D, 1.0D, 2.0D, 1.0D); @@ -96,18 +99,18 @@ public JsonObject toJSON() { private record Shapes(List boxes) { public JsonArray toJSON() { - JsonArray arr = new JsonArray(); - boxes.forEach(box -> arr.add(jsonOf(box))); - return arr; - } + JsonArray arr = new JsonArray(); + boxes.forEach(box -> arr.add(jsonOf(box))); + return arr; + } - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - Shapes shapes = (Shapes) o; - return Objects.equals(boxes, shapes.boxes); - } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + Shapes shapes = (Shapes) o; + return Objects.equals(boxes, shapes.boxes); + } } } diff --git a/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java b/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java index a983defd..cb2c36ff 100644 --- a/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java +++ b/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java @@ -27,9 +27,9 @@ import java.util.Collection; import java.util.List; import java.util.Objects; -import java.util.logging.Logger; -public class BlocksDataGenerator implements IDataGenerator {private static List getItemsEffectiveForBlock(Block block) { +public class BlocksDataGenerator implements IDataGenerator { + private static List getItemsEffectiveForBlock(Block block) { List items = new ArrayList<>(); for (Item item : Registries.ITEMS) { if (item instanceof ToolItem && ((MiningToolItemAccessor) item).getEffectiveBlocks().contains(block)) { diff --git a/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java b/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java index cbfff2db..bd6cfcc9 100644 --- a/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java +++ b/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java @@ -6,10 +6,14 @@ import com.google.gson.JsonPrimitive; import dev.u9g.minecraftdatagenerator.util.DGU; import dev.u9g.minecraftdatagenerator.util.Registries; -import net.minecraft.enchantment.*; +import net.minecraft.enchantment.Enchantment; +import net.minecraft.enchantment.EnchantmentTarget; import net.minecraft.util.Identifier; -import java.util.*; +import java.util.ArrayList; +import java.util.List; +import java.util.Locale; +import java.util.Objects; public class EnchantmentsDataGenerator implements IDataGenerator { diff --git a/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java b/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java index b1b24cf8..96d035b5 100644 --- a/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java +++ b/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java @@ -4,8 +4,14 @@ import com.google.gson.JsonObject; import dev.u9g.minecraftdatagenerator.util.DGU; import dev.u9g.minecraftdatagenerator.util.Registries; -import net.minecraft.entity.*; -import net.minecraft.entity.mob.*; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityType; +import net.minecraft.entity.ItemEntity; +import net.minecraft.entity.LivingEntity; +import net.minecraft.entity.mob.AmbientEntity; +import net.minecraft.entity.mob.HostileEntity; +import net.minecraft.entity.mob.MobEntity; +import net.minecraft.entity.mob.WaterCreatureEntity; import net.minecraft.entity.passive.AnimalEntity; import net.minecraft.entity.passive.PassiveEntity; import net.minecraft.entity.player.PlayerEntity; diff --git a/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java b/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java index bef2bf1c..4d48d1ed 100644 --- a/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java +++ b/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java @@ -8,7 +8,6 @@ import com.google.gson.stream.JsonToken; import com.google.gson.stream.JsonWriter; import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; import net.fabricmc.loader.api.FabricLoader; import net.minecraft.client.MinecraftClient; import net.minecraft.client.resource.language.I18n; diff --git a/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java b/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java index f6870455..eb69bf27 100644 --- a/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java +++ b/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java @@ -98,18 +98,18 @@ public JsonObject toJSON() { private record Shapes(List boxes) { public JsonArray toJSON() { - JsonArray arr = new JsonArray(); - boxes.forEach(box -> arr.add(jsonOf(box))); - return arr; - } + JsonArray arr = new JsonArray(); + boxes.forEach(box -> arr.add(jsonOf(box))); + return arr; + } - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - Shapes shapes = (Shapes) o; - return Objects.equals(boxes, shapes.boxes); - } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + Shapes shapes = (Shapes) o; + return Objects.equals(boxes, shapes.boxes); + } } } diff --git a/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java b/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java index 3034f408..ef5406f2 100644 --- a/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java +++ b/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java @@ -26,9 +26,9 @@ import java.util.Collection; import java.util.List; import java.util.Objects; -import java.util.logging.Logger; -public class BlocksDataGenerator implements IDataGenerator {private static List getItemsEffectiveForBlock(Block block) { +public class BlocksDataGenerator implements IDataGenerator { + private static List getItemsEffectiveForBlock(Block block) { List items = new ArrayList<>(); for (Item item : Registries.ITEMS) { if (item instanceof ToolItem && ((MiningToolItemAccessor) item).getEffectiveBlocks().contains(block)) { diff --git a/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java b/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java index 2fced082..9429a29a 100644 --- a/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java +++ b/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java @@ -6,7 +6,6 @@ import net.minecraft.client.sound.SoundEvent; - public class SoundsDataGenerator implements IDataGenerator { public static JsonObject generateSound(SoundEvent soundEvent) { diff --git a/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java b/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java index bef2bf1c..4d48d1ed 100644 --- a/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java +++ b/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java @@ -8,7 +8,6 @@ import com.google.gson.stream.JsonToken; import com.google.gson.stream.JsonWriter; import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; import net.fabricmc.loader.api.FabricLoader; import net.minecraft.client.MinecraftClient; import net.minecraft.client.resource.language.I18n; diff --git a/1.13/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java b/1.13/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java index 65f68c75..4e618110 100644 --- a/1.13/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java +++ b/1.13/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java @@ -25,10 +25,10 @@ import java.util.Collection; import java.util.List; import java.util.Objects; -import java.util.logging.Logger; import java.util.stream.Collectors; -public class BlocksDataGenerator implements IDataGenerator {private static List getItemsEffectiveForBlock(Block block) { +public class BlocksDataGenerator implements IDataGenerator { + private static List getItemsEffectiveForBlock(Block block) { return Registry.ITEM.stream() .filter(item -> item instanceof ToolItem) .filter(item -> ((MiningToolItemAccessor) item).getEffectiveBlocks().contains(block)) diff --git a/1.13/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java b/1.13/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java index a6f36606..d5c57af2 100644 --- a/1.13/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java +++ b/1.13/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java @@ -13,7 +13,7 @@ public static JsonObject generateSound(Registry registry, SoundEvent JsonObject soundDesc = new JsonObject(); soundDesc.addProperty("id", registry.getRawId(soundEvent)); - soundDesc.addProperty("name", ((SoundAccessor)soundEvent).id().getPath()); + soundDesc.addProperty("name", ((SoundAccessor) soundEvent).id().getPath()); return soundDesc; } diff --git a/1.13/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java b/1.13/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java index 10a2da6a..da178342 100644 --- a/1.13/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java +++ b/1.13/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java @@ -1,7 +1,6 @@ package dev.u9g.minecraftdatagenerator.util; import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; import net.fabricmc.loader.api.FabricLoader; import net.minecraft.client.MinecraftClient; import net.minecraft.client.resource.language.I18n; diff --git a/1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java b/1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java index 19e7653e..42ebda2c 100644 --- a/1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java +++ b/1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java @@ -28,10 +28,10 @@ import java.util.Collection; import java.util.List; import java.util.Objects; -import java.util.logging.Logger; import java.util.stream.Collectors; -public class BlocksDataGenerator implements IDataGenerator {private static List getItemsEffectiveForBlock(Block block) { +public class BlocksDataGenerator implements IDataGenerator { + private static List getItemsEffectiveForBlock(Block block) { return Registry.ITEM.stream() .filter(item -> item instanceof MiningToolItem) .filter(item -> ((MiningToolItemAccessor) item).getEffectiveBlocks().contains(block)) diff --git a/1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java b/1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java index 6fdecd68..b3a24c6b 100644 --- a/1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java +++ b/1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java @@ -13,7 +13,7 @@ public static JsonObject generateSound(Registry registry, SoundEvent JsonObject soundDesc = new JsonObject(); soundDesc.addProperty("id", registry.getRawId(soundEvent)); - soundDesc.addProperty("name", ((SoundAccessor)soundEvent).id().getPath()); + soundDesc.addProperty("name", ((SoundAccessor) soundEvent).id().getPath()); return soundDesc; } diff --git a/1.14/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java b/1.14/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java index 1a416ff1..7c00179f 100644 --- a/1.14/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java +++ b/1.14/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java @@ -1,7 +1,6 @@ package dev.u9g.minecraftdatagenerator.util; import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; import net.fabricmc.loader.api.FabricLoader; import net.minecraft.client.MinecraftClient; import net.minecraft.client.resource.language.I18n; diff --git a/1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java b/1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java index fbcee6fd..bc619cdd 100644 --- a/1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java +++ b/1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java @@ -25,10 +25,10 @@ import java.util.Collection; import java.util.List; -import java.util.logging.Logger; import java.util.stream.Collectors; -public class BlocksDataGenerator implements IDataGenerator {private static List getItemsEffectiveForBlock(Block block) { +public class BlocksDataGenerator implements IDataGenerator { + private static List getItemsEffectiveForBlock(Block block) { return Registry.ITEM.stream() .filter(item -> item instanceof MiningToolItem) .filter(item -> ((MiningToolItemAccessor) item).getEffectiveBlocks().contains(block)) diff --git a/1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java b/1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java index e80cded5..7074a656 100644 --- a/1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java +++ b/1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java @@ -61,8 +61,8 @@ private static String getCategoryFrom(@NotNull EntityType entityType) { case "net.minecraft.entity.decoration", "net.minecraft.entity.decoration.painting" -> "Immobile"; case "net.minecraft.entity.boss", "net.minecraft.entity.mob", "net.minecraft.entity.boss.dragon" -> "Hostile mobs"; - case "net.minecraft.entity.projectile", "net.minecraft.entity.projectile.thrown", "net.minecraft.entity.thrown" -> - "Projectiles"; + case "net.minecraft.entity.projectile", "net.minecraft.entity.projectile.thrown", + "net.minecraft.entity.thrown" -> "Projectiles"; case "net.minecraft.entity.passive" -> "Passive mobs"; case "net.minecraft.entity.vehicle" -> "Vehicles"; case "net.minecraft.entity" -> "other"; diff --git a/1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java b/1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java index 6fdecd68..b3a24c6b 100644 --- a/1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java +++ b/1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java @@ -13,7 +13,7 @@ public static JsonObject generateSound(Registry registry, SoundEvent JsonObject soundDesc = new JsonObject(); soundDesc.addProperty("id", registry.getRawId(soundEvent)); - soundDesc.addProperty("name", ((SoundAccessor)soundEvent).id().getPath()); + soundDesc.addProperty("name", ((SoundAccessor) soundEvent).id().getPath()); return soundDesc; } diff --git a/1.15/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java b/1.15/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java index c91347a8..5223a96d 100644 --- a/1.15/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java +++ b/1.15/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java @@ -1,7 +1,6 @@ package dev.u9g.minecraftdatagenerator.util; import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; import net.fabricmc.loader.api.FabricLoader; import net.minecraft.client.MinecraftClient; import net.minecraft.client.resource.language.I18n; diff --git a/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java b/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java index abe26bf3..96e15f7e 100644 --- a/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java +++ b/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java @@ -28,10 +28,10 @@ import java.util.Collection; import java.util.List; -import java.util.logging.Logger; import java.util.stream.Collectors; -public class BlocksDataGenerator implements IDataGenerator {private static List getItemsEffectiveForBlock(Block block) { +public class BlocksDataGenerator implements IDataGenerator { + private static List getItemsEffectiveForBlock(Block block) { return Registry.ITEM.stream() .filter(item -> item instanceof MiningToolItem) .filter(item -> ((MiningToolItemAccessor) item).getEffectiveBlocks().contains(block)) diff --git a/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java b/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java index e27fb68f..71ed7b6f 100644 --- a/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java +++ b/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java @@ -11,7 +11,6 @@ import java.util.List; import java.util.Locale; -import java.util.stream.Collectors; public class EnchantmentsDataGenerator implements IDataGenerator { diff --git a/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java b/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java index 6fdecd68..b3a24c6b 100644 --- a/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java +++ b/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java @@ -13,7 +13,7 @@ public static JsonObject generateSound(Registry registry, SoundEvent JsonObject soundDesc = new JsonObject(); soundDesc.addProperty("id", registry.getRawId(soundEvent)); - soundDesc.addProperty("name", ((SoundAccessor)soundEvent).id().getPath()); + soundDesc.addProperty("name", ((SoundAccessor) soundEvent).id().getPath()); return soundDesc; } diff --git a/1.16/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java b/1.16/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java index 05841318..119373d0 100644 --- a/1.16/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java +++ b/1.16/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java @@ -1,7 +1,6 @@ package dev.u9g.minecraftdatagenerator.util; import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; import net.fabricmc.loader.api.FabricLoader; import net.minecraft.client.MinecraftClient; import net.minecraft.client.resource.language.I18n; diff --git a/1.17/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java b/1.17/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java index e27fb68f..71ed7b6f 100644 --- a/1.17/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java +++ b/1.17/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java @@ -11,7 +11,6 @@ import java.util.List; import java.util.Locale; -import java.util.stream.Collectors; public class EnchantmentsDataGenerator implements IDataGenerator { diff --git a/1.17/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java b/1.17/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java index 6fdecd68..b3a24c6b 100644 --- a/1.17/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java +++ b/1.17/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java @@ -13,7 +13,7 @@ public static JsonObject generateSound(Registry registry, SoundEvent JsonObject soundDesc = new JsonObject(); soundDesc.addProperty("id", registry.getRawId(soundEvent)); - soundDesc.addProperty("name", ((SoundAccessor)soundEvent).id().getPath()); + soundDesc.addProperty("name", ((SoundAccessor) soundEvent).id().getPath()); return soundDesc; } diff --git a/1.17/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java b/1.17/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java index bd5ea21d..ed730ac4 100644 --- a/1.17/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java +++ b/1.17/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java @@ -1,7 +1,6 @@ package dev.u9g.minecraftdatagenerator.util; import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; import net.fabricmc.loader.api.FabricLoader; import net.minecraft.client.MinecraftClient; import net.minecraft.client.resource.language.I18n; diff --git a/1.18/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java b/1.18/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java index e27fb68f..71ed7b6f 100644 --- a/1.18/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java +++ b/1.18/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java @@ -11,7 +11,6 @@ import java.util.List; import java.util.Locale; -import java.util.stream.Collectors; public class EnchantmentsDataGenerator implements IDataGenerator { diff --git a/1.18/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java b/1.18/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java index 6fdecd68..b3a24c6b 100644 --- a/1.18/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java +++ b/1.18/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java @@ -13,7 +13,7 @@ public static JsonObject generateSound(Registry registry, SoundEvent JsonObject soundDesc = new JsonObject(); soundDesc.addProperty("id", registry.getRawId(soundEvent)); - soundDesc.addProperty("name", ((SoundAccessor)soundEvent).id().getPath()); + soundDesc.addProperty("name", ((SoundAccessor) soundEvent).id().getPath()); return soundDesc; } diff --git a/1.18/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java b/1.18/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java index d03fe08a..da18a5e3 100644 --- a/1.18/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java +++ b/1.18/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java @@ -5,7 +5,6 @@ import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; import net.fabricmc.loader.api.FabricLoader; import net.minecraft.client.MinecraftClient; import net.minecraft.client.resource.language.I18n; diff --git a/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java b/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java index e27fb68f..71ed7b6f 100644 --- a/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java +++ b/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java @@ -11,7 +11,6 @@ import java.util.List; import java.util.Locale; -import java.util.stream.Collectors; public class EnchantmentsDataGenerator implements IDataGenerator { diff --git a/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java b/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java index d063f71d..804b0cec 100644 --- a/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java +++ b/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java @@ -11,7 +11,7 @@ public class SoundsDataGenerator implements IDataGenerator { public static JsonObject generateSound(Registry registry, SoundEvent soundEvent) { JsonObject soundDesc = new JsonObject(); - soundDesc.addProperty("id", registry.getRawId(soundEvent)+1); // the plus 1 is required for 1.19.2+ due to Mojang using 0 in the packet to say that you should read a string id instead. + soundDesc.addProperty("id", registry.getRawId(soundEvent) + 1); // the plus 1 is required for 1.19.2+ due to Mojang using 0 in the packet to say that you should read a string id instead. soundDesc.addProperty("name", soundEvent.getId().getPath()); return soundDesc; diff --git a/1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java b/1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java index e27fb68f..71ed7b6f 100644 --- a/1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java +++ b/1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java @@ -11,7 +11,6 @@ import java.util.List; import java.util.Locale; -import java.util.stream.Collectors; public class EnchantmentsDataGenerator implements IDataGenerator { diff --git a/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/BiomesDataGenerator.java b/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/BiomesDataGenerator.java index bc47f3bd..bda5f967 100644 --- a/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/BiomesDataGenerator.java +++ b/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/BiomesDataGenerator.java @@ -11,7 +11,6 @@ import net.minecraft.registry.RegistryKeys; import net.minecraft.util.Identifier; import net.minecraft.world.biome.Biome; -import net.minecraft.world.biome.source.BiomeSources; import java.util.HashSet; import java.util.Set; diff --git a/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java b/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java index 6bd50d74..35d6dc63 100644 --- a/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java +++ b/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java @@ -12,7 +12,6 @@ import java.util.List; import java.util.Locale; -import java.util.stream.Collectors; public class EnchantmentsDataGenerator implements IDataGenerator { diff --git a/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java b/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java index 50e3516d..1a9bea60 100644 --- a/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java +++ b/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java @@ -7,7 +7,6 @@ import net.minecraft.entity.Entity; import net.minecraft.entity.EntityType; import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.SpawnReason; import net.minecraft.entity.mob.AmbientEntity; import net.minecraft.entity.mob.HostileEntity; import net.minecraft.entity.mob.MobEntity; @@ -17,7 +16,6 @@ import net.minecraft.entity.projectile.ProjectileEntity; import net.minecraft.registry.Registry; import net.minecraft.registry.RegistryKeys; -import net.minecraft.registry.tag.TagKey; import net.minecraft.server.MinecraftServer; import net.minecraft.util.Identifier; @@ -43,7 +41,7 @@ public static JsonObject generateEntity(Registry> entityRegistry, Entity entityObject = ((EntityTypeAccessor) entityType).factory().create(entityType, minecraftServer.getOverworld()); entityTypeString = entityObject != null ? getEntityTypeForClass(entityObject.getClass()) : "unknown"; } - if(entityType == EntityType.PLAYER){ + if (entityType == EntityType.PLAYER) { entityTypeString = "player"; } diff --git a/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java b/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java index 6bd50d74..35d6dc63 100644 --- a/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java +++ b/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java @@ -12,7 +12,6 @@ import java.util.List; import java.util.Locale; -import java.util.stream.Collectors; public class EnchantmentsDataGenerator implements IDataGenerator { diff --git a/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java b/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java index 77e54d45..1d8bab2a 100644 --- a/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java +++ b/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java @@ -12,7 +12,7 @@ public class SoundsDataGenerator implements IDataGenerator { public static JsonObject generateSound(Registry registry, SoundEvent soundEvent) { JsonObject soundDesc = new JsonObject(); - soundDesc.addProperty("id", registry.getRawId(soundEvent)+1); // the plus 1 is required for 1.19.2+ due to Mojang using 0 in the packet to say that you should read a string id instead. + soundDesc.addProperty("id", registry.getRawId(soundEvent) + 1); // the plus 1 is required for 1.19.2+ due to Mojang using 0 in the packet to say that you should read a string id instead. soundDesc.addProperty("name", soundEvent.getId().getPath()); return soundDesc; diff --git a/1.7/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java b/1.7/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java index b2d77af7..8ae63031 100644 --- a/1.7/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java +++ b/1.7/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java @@ -114,18 +114,18 @@ public JsonObject toJSON() { private record Shapes(List boxes) { public JsonArray toJSON() { - JsonArray arr = new JsonArray(); - boxes.forEach(box -> arr.add(jsonOf(box))); - return arr; - } + JsonArray arr = new JsonArray(); + boxes.forEach(box -> arr.add(jsonOf(box))); + return arr; + } - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - Shapes shapes = (Shapes) o; - return Objects.equals(boxes, shapes.boxes); - } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + Shapes shapes = (Shapes) o; + return Objects.equals(boxes, shapes.boxes); + } } } diff --git a/1.7/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java b/1.7/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java index 9a8d7737..14a786ad 100644 --- a/1.7/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java +++ b/1.7/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java @@ -16,7 +16,6 @@ import java.util.ArrayList; import java.util.List; import java.util.Objects; -import java.util.logging.Logger; public class BlocksDataGenerator implements IDataGenerator { private static List getItemsEffectiveForBlock(Block block) { diff --git a/1.7/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java b/1.7/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java index cfe51872..1cf7bae3 100644 --- a/1.7/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java +++ b/1.7/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java @@ -1,7 +1,6 @@ package dev.u9g.minecraftdatagenerator.util; import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; import net.fabricmc.loader.api.FabricLoader; import net.minecraft.client.resource.language.I18n; import net.minecraft.item.Item; diff --git a/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java b/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java index 38ec86b6..b0f50107 100644 --- a/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java +++ b/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java @@ -99,18 +99,18 @@ public JsonObject toJSON() { private record Shapes(List boxes) { public JsonArray toJSON() { - JsonArray arr = new JsonArray(); - boxes.forEach(box -> arr.add(jsonOf(box))); - return arr; - } + JsonArray arr = new JsonArray(); + boxes.forEach(box -> arr.add(jsonOf(box))); + return arr; + } - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - Shapes shapes = (Shapes) o; - return Objects.equals(boxes, shapes.boxes); - } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + Shapes shapes = (Shapes) o; + return Objects.equals(boxes, shapes.boxes); + } } } diff --git a/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java b/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java index ffb3a691..1262f5f5 100644 --- a/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java +++ b/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java @@ -26,7 +26,6 @@ import java.util.Collection; import java.util.List; import java.util.Objects; -import java.util.logging.Logger; public class BlocksDataGenerator implements IDataGenerator { private static List getItemsEffectiveForBlock(Block block) { diff --git a/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java b/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java index 81eaa063..477cebc1 100644 --- a/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java +++ b/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java @@ -8,13 +8,11 @@ import dev.u9g.minecraftdatagenerator.clientsideannoyances.GrassColors; import dev.u9g.minecraftdatagenerator.clientsideannoyances.ServerSideRedstoneWireBlock; import dev.u9g.minecraftdatagenerator.mixin.BiomeAccessor; -import dev.u9g.minecraftdatagenerator.util.EmptyBlockView; import dev.u9g.minecraftdatagenerator.util.Registries; import net.minecraft.block.Block; import net.minecraft.block.Blocks; import net.minecraft.block.RedstoneWireBlock; import net.minecraft.util.Identifier; -import net.minecraft.util.math.BlockPos; import net.minecraft.world.biome.Biome; import java.util.*; diff --git a/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java b/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java index 51fbb79e..0af8980c 100644 --- a/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java +++ b/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java @@ -1,7 +1,6 @@ package dev.u9g.minecraftdatagenerator.util; import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; import net.fabricmc.loader.api.FabricLoader; import net.minecraft.client.resource.language.I18n; import net.minecraft.item.Item; diff --git a/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java b/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java index 2bb5a0be..357bab59 100644 --- a/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java +++ b/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java @@ -99,18 +99,18 @@ public JsonObject toJSON() { private record Shapes(List boxes) { public JsonArray toJSON() { - JsonArray arr = new JsonArray(); - boxes.forEach(box -> arr.add(jsonOf(box))); - return arr; - } + JsonArray arr = new JsonArray(); + boxes.forEach(box -> arr.add(jsonOf(box))); + return arr; + } - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - Shapes shapes = (Shapes) o; - return Objects.equals(boxes, shapes.boxes); - } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + Shapes shapes = (Shapes) o; + return Objects.equals(boxes, shapes.boxes); + } } } diff --git a/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java b/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java index e30f6a0c..f61dc62d 100644 --- a/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java +++ b/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java @@ -27,9 +27,9 @@ import java.util.Collection; import java.util.List; import java.util.Objects; -import java.util.logging.Logger; -public class BlocksDataGenerator implements IDataGenerator {private static List getItemsEffectiveForBlock(Block block) { +public class BlocksDataGenerator implements IDataGenerator { + private static List getItemsEffectiveForBlock(Block block) { List items = new ArrayList<>(); for (Item item : Registries.ITEMS) { if (item instanceof ToolItem && ((MiningToolItemAccessor) item).getEffectiveBlocks().contains(block)) { diff --git a/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java b/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java index fb21b763..17a457e1 100644 --- a/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java +++ b/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java @@ -8,13 +8,11 @@ import dev.u9g.minecraftdatagenerator.clientsideannoyances.GrassColors; import dev.u9g.minecraftdatagenerator.clientsideannoyances.ServerSideRedstoneWireBlock; import dev.u9g.minecraftdatagenerator.mixin.BiomeAccessor; -import dev.u9g.minecraftdatagenerator.util.EmptyBlockView; import dev.u9g.minecraftdatagenerator.util.Registries; import net.minecraft.block.Block; import net.minecraft.block.Blocks; import net.minecraft.block.RedstoneWireBlock; import net.minecraft.util.Identifier; -import net.minecraft.util.math.BlockPos; import net.minecraft.world.biome.Biome; import java.util.*; diff --git a/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java b/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java index 72ae2469..e54bd54b 100644 --- a/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java +++ b/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java @@ -8,7 +8,6 @@ import com.google.gson.stream.JsonToken; import com.google.gson.stream.JsonWriter; import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; import net.fabricmc.loader.api.FabricLoader; import net.minecraft.client.resource.language.I18n; import net.minecraft.item.Item; diff --git a/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java b/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java index e27fb68f..71ed7b6f 100644 --- a/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java +++ b/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java @@ -11,7 +11,6 @@ import java.util.List; import java.util.Locale; -import java.util.stream.Collectors; public class EnchantmentsDataGenerator implements IDataGenerator { diff --git a/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java b/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java index bd5ea21d..ed730ac4 100644 --- a/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java +++ b/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java @@ -1,7 +1,6 @@ package dev.u9g.minecraftdatagenerator.util; import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; import net.fabricmc.loader.api.FabricLoader; import net.minecraft.client.MinecraftClient; import net.minecraft.client.resource.language.I18n; From 155de79d5a1933d8b143c1ab1d8733010620da14 Mon Sep 17 00:00:00 2001 From: AlexProgrammerDE <40795980+AlexProgrammerDE@users.noreply.github.com> Date: Sun, 28 Apr 2024 19:52:24 +0200 Subject: [PATCH 06/38] Revert to java 17 --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 83f7ddf4..c1bb07f4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -25,10 +25,10 @@ jobs: - name: Validate Gradle wrapper uses: gradle/wrapper-validation-action@v1 - - name: Set up JDK 21 + - name: Set up JDK 17 uses: actions/setup-java@v4 with: - java-version: '21' + java-version: '17' distribution: 'temurin' - name: Generate ${{ matrix.version }} From c550a394c31e0045390ec2d5daeb93b450b845cf Mon Sep 17 00:00:00 2001 From: AlexProgrammerDE <40795980+AlexProgrammerDE@users.noreply.github.com> Date: Sun, 28 Apr 2024 20:21:13 +0200 Subject: [PATCH 07/38] Fix generation --- .../generators/RecipeDataGenerator.java | 6 +- .../generators/RecipeDataGenerator.java | 6 +- .../generators/RecipeDataGenerator.java | 6 +- .../generators/RecipeDataGenerator.java | 6 +- .../generators/RecipeDataGenerator.java | 6 +- .../generators/RecipeDataGenerator.java | 6 +- .../generators/RecipeDataGenerator.java | 6 +- .../u9g/minecraftdatagenerator/util/DGU.java | 80 ------------------- .../generators/RecipeDataGenerator.java | 6 ++ .../generators/RecipeDataGenerator.java | 6 +- .../generators/RecipeDataGenerator.java | 6 +- .../generators/DataGenerators.java | 13 ++- .../generators/IDataGenerator.java | 4 + 13 files changed, 65 insertions(+), 92 deletions(-) diff --git a/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/RecipeDataGenerator.java b/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/RecipeDataGenerator.java index 32498dfa..233340dc 100644 --- a/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/RecipeDataGenerator.java +++ b/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/RecipeDataGenerator.java @@ -112,7 +112,11 @@ public JsonElement generateDataJson() { // return finalObj; return JsonNull.INSTANCE; } -// + + @Override + public boolean isEnabled() { + return false; // TODO: Implement this + }// // private static int getRawIdFor (Item item) { // return Registry.ITEM.getRawId(item); // } diff --git a/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/RecipeDataGenerator.java b/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/RecipeDataGenerator.java index 32498dfa..233340dc 100644 --- a/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/RecipeDataGenerator.java +++ b/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/RecipeDataGenerator.java @@ -112,7 +112,11 @@ public JsonElement generateDataJson() { // return finalObj; return JsonNull.INSTANCE; } -// + + @Override + public boolean isEnabled() { + return false; // TODO: Implement this + }// // private static int getRawIdFor (Item item) { // return Registry.ITEM.getRawId(item); // } diff --git a/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/RecipeDataGenerator.java b/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/RecipeDataGenerator.java index 32498dfa..233340dc 100644 --- a/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/RecipeDataGenerator.java +++ b/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/RecipeDataGenerator.java @@ -112,7 +112,11 @@ public JsonElement generateDataJson() { // return finalObj; return JsonNull.INSTANCE; } -// + + @Override + public boolean isEnabled() { + return false; // TODO: Implement this + }// // private static int getRawIdFor (Item item) { // return Registry.ITEM.getRawId(item); // } diff --git a/1.13/src/main/java/dev/u9g/minecraftdatagenerator/generators/RecipeDataGenerator.java b/1.13/src/main/java/dev/u9g/minecraftdatagenerator/generators/RecipeDataGenerator.java index 5e4587dd..0b785460 100644 --- a/1.13/src/main/java/dev/u9g/minecraftdatagenerator/generators/RecipeDataGenerator.java +++ b/1.13/src/main/java/dev/u9g/minecraftdatagenerator/generators/RecipeDataGenerator.java @@ -118,4 +118,8 @@ public JsonElement generateDataJson() { // return finalObj; return JsonNull.INSTANCE; } -} + + @Override + public boolean isEnabled() { + return false; // TODO: Implement this + }} diff --git a/1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/RecipeDataGenerator.java b/1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/RecipeDataGenerator.java index 5e4587dd..0b785460 100644 --- a/1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/RecipeDataGenerator.java +++ b/1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/RecipeDataGenerator.java @@ -118,4 +118,8 @@ public JsonElement generateDataJson() { // return finalObj; return JsonNull.INSTANCE; } -} + + @Override + public boolean isEnabled() { + return false; // TODO: Implement this + }} diff --git a/1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/RecipeDataGenerator.java b/1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/RecipeDataGenerator.java index 5e4587dd..0b785460 100644 --- a/1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/RecipeDataGenerator.java +++ b/1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/RecipeDataGenerator.java @@ -118,4 +118,8 @@ public JsonElement generateDataJson() { // return finalObj; return JsonNull.INSTANCE; } -} + + @Override + public boolean isEnabled() { + return false; // TODO: Implement this + }} diff --git a/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/RecipeDataGenerator.java b/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/RecipeDataGenerator.java index 5e4587dd..0b785460 100644 --- a/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/RecipeDataGenerator.java +++ b/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/RecipeDataGenerator.java @@ -118,4 +118,8 @@ public JsonElement generateDataJson() { // return finalObj; return JsonNull.INSTANCE; } -} + + @Override + public boolean isEnabled() { + return false; // TODO: Implement this + }} diff --git a/1.18/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java b/1.18/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java index da18a5e3..873b88b8 100644 --- a/1.18/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java +++ b/1.18/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java @@ -16,86 +16,6 @@ import java.util.Map; public class DGU { - - public static final TypeAdapter JSON_ELEMENT = new TypeAdapter<>() { - @Override - public JsonElement read(JsonReader in) throws IOException { - switch (in.peek()) { - case STRING: - return new JsonPrimitive(in.nextString()); - case NUMBER: - String number = in.nextString(); - return new JsonPrimitive(new LazilyParsedNumber(number)); - case BOOLEAN: - return new JsonPrimitive(in.nextBoolean()); - case NULL: - in.nextNull(); - return JsonNull.INSTANCE; - case BEGIN_ARRAY: - JsonArray array = new JsonArray(); - in.beginArray(); - while (in.hasNext()) { - array.add(read(in)); - } - in.endArray(); - return array; - case BEGIN_OBJECT: - JsonObject object = new JsonObject(); - in.beginObject(); - while (in.hasNext()) { - object.add(in.nextName(), read(in)); - } - in.endObject(); - return object; - case END_DOCUMENT: - case NAME: - case END_OBJECT: - case END_ARRAY: - default: - throw new IllegalArgumentException(); - } - } - - @Override - public void write(JsonWriter out, JsonElement value) throws IOException { - if (value == null || value.isJsonNull()) { - out.nullValue(); - } else if (value.isJsonPrimitive()) { - JsonPrimitive primitive = value.getAsJsonPrimitive(); - if (primitive.isNumber()) { - if (primitive.getAsDouble() == primitive.getAsLong()) { - out.value(primitive.getAsLong()); - } else { - out.value(primitive.getAsNumber()); - } - } else if (primitive.isBoolean()) { - out.value(primitive.getAsBoolean()); - } else { - out.value(primitive.getAsString()); - } - - } else if (value.isJsonArray()) { - out.beginArray(); - for (JsonElement e : value.getAsJsonArray()) { - write(out, e); - } - out.endArray(); - - } else if (value.isJsonObject()) { - out.beginObject(); - for (Map.Entry e : value.getAsJsonObject().entrySet()) { - out.name(e.getKey()); - write(out, e.getValue()); - } - out.endObject(); - - } else { - throw new IllegalArgumentException("Couldn't write " + value.getClass()); - } - } - }; - public static final Gson GSON = new GsonBuilder() - .registerTypeAdapter(JsonElement.class, JSON_ELEMENT).setPrettyPrinting().create(); private static final Language language = Language.getInstance(); private static MinecraftServer getCurrentlyRunningServerClient() { diff --git a/1.7/src/main/java/dev/u9g/minecraftdatagenerator/generators/RecipeDataGenerator.java b/1.7/src/main/java/dev/u9g/minecraftdatagenerator/generators/RecipeDataGenerator.java index 32498dfa..f80891e9 100644 --- a/1.7/src/main/java/dev/u9g/minecraftdatagenerator/generators/RecipeDataGenerator.java +++ b/1.7/src/main/java/dev/u9g/minecraftdatagenerator/generators/RecipeDataGenerator.java @@ -112,6 +112,12 @@ public JsonElement generateDataJson() { // return finalObj; return JsonNull.INSTANCE; } + + @Override + public boolean isEnabled() { + return false; // TODO: Implement this + } + // // private static int getRawIdFor (Item item) { // return Registry.ITEM.getRawId(item); diff --git a/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/generators/RecipeDataGenerator.java b/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/generators/RecipeDataGenerator.java index 32498dfa..233340dc 100644 --- a/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/generators/RecipeDataGenerator.java +++ b/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/generators/RecipeDataGenerator.java @@ -112,7 +112,11 @@ public JsonElement generateDataJson() { // return finalObj; return JsonNull.INSTANCE; } -// + + @Override + public boolean isEnabled() { + return false; // TODO: Implement this + }// // private static int getRawIdFor (Item item) { // return Registry.ITEM.getRawId(item); // } diff --git a/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/RecipeDataGenerator.java b/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/RecipeDataGenerator.java index 32498dfa..233340dc 100644 --- a/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/RecipeDataGenerator.java +++ b/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/RecipeDataGenerator.java @@ -112,7 +112,11 @@ public JsonElement generateDataJson() { // return finalObj; return JsonNull.INSTANCE; } -// + + @Override + public boolean isEnabled() { + return false; // TODO: Implement this + }// // private static int getRawIdFor (Item item) { // return Registry.ITEM.getRawId(item); // } diff --git a/common/src/main/java/dev/u9g/minecraftdatagenerator/generators/DataGenerators.java b/common/src/main/java/dev/u9g/minecraftdatagenerator/generators/DataGenerators.java index e5026a9a..a49514d7 100644 --- a/common/src/main/java/dev/u9g/minecraftdatagenerator/generators/DataGenerators.java +++ b/common/src/main/java/dev/u9g/minecraftdatagenerator/generators/DataGenerators.java @@ -23,10 +23,12 @@ public class DataGenerators { static { List> generators; - try (ScanResult scanResult = new ClassGraph().acceptPackages("dev.u9g.minecraftdatagenerator.generators") + try (ScanResult scanResult = new ClassGraph() + .acceptPackages("dev.u9g.minecraftdatagenerator.generators") + .overrideClassLoaders(IDataGenerator.class.getClassLoader()) .enableClassInfo().scan()) { generators = scanResult - .getSubclasses(IDataGenerator.class.getName()) + .getClassesImplementing(IDataGenerator.class) .loadClasses(IDataGenerator.class); } @@ -53,6 +55,11 @@ public static boolean runDataGenerators(Path outputDirectory) { logger.info(MessageFormat.format("Running minecraft data generators, output at {0}", outputDirectory)); for (IDataGenerator dataGenerator : GENERATORS) { + if (!dataGenerator.isEnabled()) { + logger.info(MessageFormat.format("Skipping disabled generator {0}", dataGenerator.getDataName())); + continue; + } + logger.info(MessageFormat.format("Running generator {0}", dataGenerator.getDataName())); try { String outputFileName = String.format("%s.json", dataGenerator.getDataName()); @@ -64,8 +71,8 @@ public static boolean runDataGenerators(Path outputDirectory) { jsonWriter.setIndent(" "); Streams.write(outputElement, jsonWriter); } - logger.info(MessageFormat.format("Generator: {0} -> {1}", dataGenerator.getDataName(), outputFileName)); + logger.info(MessageFormat.format("Generator: {0} -> {1}", dataGenerator.getDataName(), outputFileName)); } catch (Throwable exception) { logger.info(MessageFormat.format("Failed to run data generator {0}", dataGenerator.getDataName())); exception.printStackTrace(); diff --git a/common/src/main/java/dev/u9g/minecraftdatagenerator/generators/IDataGenerator.java b/common/src/main/java/dev/u9g/minecraftdatagenerator/generators/IDataGenerator.java index 39276f49..faa74f9e 100644 --- a/common/src/main/java/dev/u9g/minecraftdatagenerator/generators/IDataGenerator.java +++ b/common/src/main/java/dev/u9g/minecraftdatagenerator/generators/IDataGenerator.java @@ -6,4 +6,8 @@ public interface IDataGenerator { String getDataName(); JsonElement generateDataJson(); + + default boolean isEnabled() { + return true; + } } From 53630ea353da1731ac004658e4a90c9de58b7bc4 Mon Sep 17 00:00:00 2001 From: AlexProgrammerDE <40795980+AlexProgrammerDE@users.noreply.github.com> Date: Sun, 28 Apr 2024 20:28:55 +0200 Subject: [PATCH 08/38] Cleanup --- .../generators/RecipeDataGenerator.java | 3 ++- .../generators/RecipeDataGenerator.java | 3 ++- .../generators/RecipeDataGenerator.java | 3 ++- .../generators/RecipeDataGenerator.java | 3 ++- .../generators/RecipeDataGenerator.java | 3 ++- .../generators/RecipeDataGenerator.java | 3 ++- .../generators/RecipeDataGenerator.java | 3 ++- .../main/java/dev/u9g/minecraftdatagenerator/util/DGU.java | 7 ------- .../generators/RecipeDataGenerator.java | 3 ++- .../generators/RecipeDataGenerator.java | 3 ++- 10 files changed, 18 insertions(+), 16 deletions(-) diff --git a/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/RecipeDataGenerator.java b/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/RecipeDataGenerator.java index 233340dc..553fbdf6 100644 --- a/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/RecipeDataGenerator.java +++ b/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/RecipeDataGenerator.java @@ -116,7 +116,8 @@ public JsonElement generateDataJson() { @Override public boolean isEnabled() { return false; // TODO: Implement this - }// + } +// // private static int getRawIdFor (Item item) { // return Registry.ITEM.getRawId(item); // } diff --git a/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/RecipeDataGenerator.java b/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/RecipeDataGenerator.java index 233340dc..553fbdf6 100644 --- a/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/RecipeDataGenerator.java +++ b/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/RecipeDataGenerator.java @@ -116,7 +116,8 @@ public JsonElement generateDataJson() { @Override public boolean isEnabled() { return false; // TODO: Implement this - }// + } +// // private static int getRawIdFor (Item item) { // return Registry.ITEM.getRawId(item); // } diff --git a/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/RecipeDataGenerator.java b/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/RecipeDataGenerator.java index 233340dc..553fbdf6 100644 --- a/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/RecipeDataGenerator.java +++ b/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/RecipeDataGenerator.java @@ -116,7 +116,8 @@ public JsonElement generateDataJson() { @Override public boolean isEnabled() { return false; // TODO: Implement this - }// + } +// // private static int getRawIdFor (Item item) { // return Registry.ITEM.getRawId(item); // } diff --git a/1.13/src/main/java/dev/u9g/minecraftdatagenerator/generators/RecipeDataGenerator.java b/1.13/src/main/java/dev/u9g/minecraftdatagenerator/generators/RecipeDataGenerator.java index 0b785460..5017a289 100644 --- a/1.13/src/main/java/dev/u9g/minecraftdatagenerator/generators/RecipeDataGenerator.java +++ b/1.13/src/main/java/dev/u9g/minecraftdatagenerator/generators/RecipeDataGenerator.java @@ -122,4 +122,5 @@ public JsonElement generateDataJson() { @Override public boolean isEnabled() { return false; // TODO: Implement this - }} + } +} diff --git a/1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/RecipeDataGenerator.java b/1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/RecipeDataGenerator.java index 0b785460..5017a289 100644 --- a/1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/RecipeDataGenerator.java +++ b/1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/RecipeDataGenerator.java @@ -122,4 +122,5 @@ public JsonElement generateDataJson() { @Override public boolean isEnabled() { return false; // TODO: Implement this - }} + } +} diff --git a/1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/RecipeDataGenerator.java b/1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/RecipeDataGenerator.java index 0b785460..5017a289 100644 --- a/1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/RecipeDataGenerator.java +++ b/1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/RecipeDataGenerator.java @@ -122,4 +122,5 @@ public JsonElement generateDataJson() { @Override public boolean isEnabled() { return false; // TODO: Implement this - }} + } +} diff --git a/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/RecipeDataGenerator.java b/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/RecipeDataGenerator.java index 0b785460..5017a289 100644 --- a/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/RecipeDataGenerator.java +++ b/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/RecipeDataGenerator.java @@ -122,4 +122,5 @@ public JsonElement generateDataJson() { @Override public boolean isEnabled() { return false; // TODO: Implement this - }} + } +} diff --git a/1.18/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java b/1.18/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java index 873b88b8..e81cdc3d 100644 --- a/1.18/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java +++ b/1.18/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java @@ -1,9 +1,5 @@ package dev.u9g.minecraftdatagenerator.util; -import com.google.gson.*; -import com.google.gson.internal.LazilyParsedNumber; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; import net.fabricmc.api.EnvType; import net.fabricmc.loader.api.FabricLoader; import net.minecraft.client.MinecraftClient; @@ -12,9 +8,6 @@ import net.minecraft.util.Language; import net.minecraft.world.World; -import java.io.IOException; -import java.util.Map; - public class DGU { private static final Language language = Language.getInstance(); diff --git a/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/generators/RecipeDataGenerator.java b/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/generators/RecipeDataGenerator.java index 233340dc..553fbdf6 100644 --- a/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/generators/RecipeDataGenerator.java +++ b/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/generators/RecipeDataGenerator.java @@ -116,7 +116,8 @@ public JsonElement generateDataJson() { @Override public boolean isEnabled() { return false; // TODO: Implement this - }// + } +// // private static int getRawIdFor (Item item) { // return Registry.ITEM.getRawId(item); // } diff --git a/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/RecipeDataGenerator.java b/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/RecipeDataGenerator.java index 233340dc..553fbdf6 100644 --- a/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/RecipeDataGenerator.java +++ b/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/RecipeDataGenerator.java @@ -116,7 +116,8 @@ public JsonElement generateDataJson() { @Override public boolean isEnabled() { return false; // TODO: Implement this - }// + } +// // private static int getRawIdFor (Item item) { // return Registry.ITEM.getRawId(item); // } From 2172eca86d6f98a586c8ac7b379e315c0ef3ee75 Mon Sep 17 00:00:00 2001 From: AlexProgrammerDE <40795980+AlexProgrammerDE@users.noreply.github.com> Date: Sun, 28 Apr 2024 20:39:31 +0200 Subject: [PATCH 09/38] Simplify code of DGU --- .../u9g/minecraftdatagenerator/util/DGU.java | 63 +------------------ .../u9g/minecraftdatagenerator/util/DGU.java | 63 +------------------ .../u9g/minecraftdatagenerator/util/DGU.java | 63 +------------------ .../u9g/minecraftdatagenerator/util/DGU.java | 40 +----------- .../u9g/minecraftdatagenerator/util/DGU.java | 40 +----------- .../util/EmptyRenderBlockView.java | 57 ----------------- .../u9g/minecraftdatagenerator/util/DGU.java | 40 +----------- .../u9g/minecraftdatagenerator/util/DGU.java | 40 +----------- .../u9g/minecraftdatagenerator/util/DGU.java | 40 +----------- .../u9g/minecraftdatagenerator/util/DGU.java | 39 +----------- .../u9g/minecraftdatagenerator/util/DGU.java | 15 +---- .../u9g/minecraftdatagenerator/util/DGU.java | 15 +---- .../u9g/minecraftdatagenerator/util/DGU.java | 15 +---- .../u9g/minecraftdatagenerator/util/DGU.java | 15 +---- .../u9g/minecraftdatagenerator/util/DGU.java | 22 +------ .../u9g/minecraftdatagenerator/util/DGU.java | 23 +------ .../u9g/minecraftdatagenerator/util/DGU.java | 56 +---------------- .../u9g/minecraftdatagenerator/util/DGU.java | 40 +----------- 18 files changed, 33 insertions(+), 653 deletions(-) delete mode 100644 1.14/src/main/java/dev/u9g/minecraftdatagenerator/util/EmptyRenderBlockView.java diff --git a/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java b/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java index 4d48d1ed..95094eea 100644 --- a/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java +++ b/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java @@ -1,79 +1,20 @@ package dev.u9g.minecraftdatagenerator.util; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.TypeAdapter; -import com.google.gson.internal.bind.TypeAdapters; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonToken; -import com.google.gson.stream.JsonWriter; -import net.fabricmc.api.EnvType; import net.fabricmc.loader.api.FabricLoader; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.resource.language.I18n; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.server.MinecraftServer; import net.minecraft.world.World; import org.jetbrains.annotations.NotNull; -import java.io.IOException; - public class DGU { - - public static Gson gson = new GsonBuilder().registerTypeAdapterFactory(TypeAdapters.newFactory(double.class, Double.class, new TypeAdapter() { - @Override - public Number read(JsonReader in) throws IOException { - if (in.peek() == JsonToken.NULL) { - in.nextNull(); - return null; - } - return in.nextDouble(); - } - - @Override - public void write(JsonWriter out, Number value) throws IOException { - out.value(value); - } - })).create(); - - private static MinecraftServer getCurrentlyRunningServerClient() { - return MinecraftClient.getInstance().getServer(); - } - @SuppressWarnings("deprecation") - private static MinecraftServer getCurrentlyRunningServerDedicated() { - return (MinecraftServer) FabricLoader.getInstance().getGameInstance(); - } - public static MinecraftServer getCurrentlyRunningServer() { - EnvType environmentType = FabricLoader.getInstance().getEnvironmentType(); - if (environmentType == EnvType.CLIENT) { - return getCurrentlyRunningServerClient(); - } else if (environmentType == EnvType.SERVER) { - return getCurrentlyRunningServerDedicated(); - } - throw new UnsupportedOperationException(); - } - - private static String translateTextClient(String translationKey) { - return I18n.translate(translationKey); - } - - private static String translateTextFallback(String translationKey) { - try { - return Registries.LANGUAGE.translate(translationKey); - } catch (Exception ignored) { - } - throw new RuntimeException("Failed to translate: '" + translationKey + "'"); + return (MinecraftServer) FabricLoader.getInstance().getGameInstance(); } public static String translateText(String translationKey) { - EnvType environmentType = FabricLoader.getInstance().getEnvironmentType(); - if (environmentType == EnvType.CLIENT) { - return translateTextClient(translationKey); - } - return translateTextFallback(translationKey); + return Registries.LANGUAGE.translate(translationKey); } @NotNull diff --git a/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java b/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java index 4d48d1ed..95094eea 100644 --- a/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java +++ b/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java @@ -1,79 +1,20 @@ package dev.u9g.minecraftdatagenerator.util; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.TypeAdapter; -import com.google.gson.internal.bind.TypeAdapters; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonToken; -import com.google.gson.stream.JsonWriter; -import net.fabricmc.api.EnvType; import net.fabricmc.loader.api.FabricLoader; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.resource.language.I18n; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.server.MinecraftServer; import net.minecraft.world.World; import org.jetbrains.annotations.NotNull; -import java.io.IOException; - public class DGU { - - public static Gson gson = new GsonBuilder().registerTypeAdapterFactory(TypeAdapters.newFactory(double.class, Double.class, new TypeAdapter() { - @Override - public Number read(JsonReader in) throws IOException { - if (in.peek() == JsonToken.NULL) { - in.nextNull(); - return null; - } - return in.nextDouble(); - } - - @Override - public void write(JsonWriter out, Number value) throws IOException { - out.value(value); - } - })).create(); - - private static MinecraftServer getCurrentlyRunningServerClient() { - return MinecraftClient.getInstance().getServer(); - } - @SuppressWarnings("deprecation") - private static MinecraftServer getCurrentlyRunningServerDedicated() { - return (MinecraftServer) FabricLoader.getInstance().getGameInstance(); - } - public static MinecraftServer getCurrentlyRunningServer() { - EnvType environmentType = FabricLoader.getInstance().getEnvironmentType(); - if (environmentType == EnvType.CLIENT) { - return getCurrentlyRunningServerClient(); - } else if (environmentType == EnvType.SERVER) { - return getCurrentlyRunningServerDedicated(); - } - throw new UnsupportedOperationException(); - } - - private static String translateTextClient(String translationKey) { - return I18n.translate(translationKey); - } - - private static String translateTextFallback(String translationKey) { - try { - return Registries.LANGUAGE.translate(translationKey); - } catch (Exception ignored) { - } - throw new RuntimeException("Failed to translate: '" + translationKey + "'"); + return (MinecraftServer) FabricLoader.getInstance().getGameInstance(); } public static String translateText(String translationKey) { - EnvType environmentType = FabricLoader.getInstance().getEnvironmentType(); - if (environmentType == EnvType.CLIENT) { - return translateTextClient(translationKey); - } - return translateTextFallback(translationKey); + return Registries.LANGUAGE.translate(translationKey); } @NotNull diff --git a/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java b/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java index 4d48d1ed..95094eea 100644 --- a/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java +++ b/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java @@ -1,79 +1,20 @@ package dev.u9g.minecraftdatagenerator.util; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.TypeAdapter; -import com.google.gson.internal.bind.TypeAdapters; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonToken; -import com.google.gson.stream.JsonWriter; -import net.fabricmc.api.EnvType; import net.fabricmc.loader.api.FabricLoader; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.resource.language.I18n; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.server.MinecraftServer; import net.minecraft.world.World; import org.jetbrains.annotations.NotNull; -import java.io.IOException; - public class DGU { - - public static Gson gson = new GsonBuilder().registerTypeAdapterFactory(TypeAdapters.newFactory(double.class, Double.class, new TypeAdapter() { - @Override - public Number read(JsonReader in) throws IOException { - if (in.peek() == JsonToken.NULL) { - in.nextNull(); - return null; - } - return in.nextDouble(); - } - - @Override - public void write(JsonWriter out, Number value) throws IOException { - out.value(value); - } - })).create(); - - private static MinecraftServer getCurrentlyRunningServerClient() { - return MinecraftClient.getInstance().getServer(); - } - @SuppressWarnings("deprecation") - private static MinecraftServer getCurrentlyRunningServerDedicated() { - return (MinecraftServer) FabricLoader.getInstance().getGameInstance(); - } - public static MinecraftServer getCurrentlyRunningServer() { - EnvType environmentType = FabricLoader.getInstance().getEnvironmentType(); - if (environmentType == EnvType.CLIENT) { - return getCurrentlyRunningServerClient(); - } else if (environmentType == EnvType.SERVER) { - return getCurrentlyRunningServerDedicated(); - } - throw new UnsupportedOperationException(); - } - - private static String translateTextClient(String translationKey) { - return I18n.translate(translationKey); - } - - private static String translateTextFallback(String translationKey) { - try { - return Registries.LANGUAGE.translate(translationKey); - } catch (Exception ignored) { - } - throw new RuntimeException("Failed to translate: '" + translationKey + "'"); + return (MinecraftServer) FabricLoader.getInstance().getGameInstance(); } public static String translateText(String translationKey) { - EnvType environmentType = FabricLoader.getInstance().getEnvironmentType(); - if (environmentType == EnvType.CLIENT) { - return translateTextClient(translationKey); - } - return translateTextFallback(translationKey); + return Registries.LANGUAGE.translate(translationKey); } @NotNull diff --git a/1.13/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java b/1.13/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java index da178342..96e72af5 100644 --- a/1.13/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java +++ b/1.13/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java @@ -1,9 +1,6 @@ package dev.u9g.minecraftdatagenerator.util; -import net.fabricmc.api.EnvType; import net.fabricmc.loader.api.FabricLoader; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.resource.language.I18n; import net.minecraft.item.ItemStack; import net.minecraft.item.Itemable; import net.minecraft.server.MinecraftServer; @@ -13,46 +10,13 @@ import org.jetbrains.annotations.NotNull; public class DGU { - - private static final Language language = Language.getInstance(); - - private static MinecraftServer getCurrentlyRunningServerClient() { - return MinecraftClient.getInstance().getServer(); - } - @SuppressWarnings("deprecation") - private static MinecraftServer getCurrentlyRunningServerDedicated() { - return (MinecraftServer) FabricLoader.getInstance().getGameInstance(); - } - public static MinecraftServer getCurrentlyRunningServer() { - EnvType environmentType = FabricLoader.getInstance().getEnvironmentType(); - if (environmentType == EnvType.CLIENT) { - return getCurrentlyRunningServerClient(); - } else if (environmentType == EnvType.SERVER) { - return getCurrentlyRunningServerDedicated(); - } - throw new UnsupportedOperationException(); - } - - private static String translateTextClient(String translationKey) { - return I18n.translate(translationKey); - } - - private static String translateTextFallback(String translationKey) { - try { - return language.translate(translationKey); - } catch (Exception ignored) { - } - throw new RuntimeException("Failed to translate: '" + translationKey + "'"); + return (MinecraftServer) FabricLoader.getInstance().getGameInstance(); } public static String translateText(String translationKey) { - EnvType environmentType = FabricLoader.getInstance().getEnvironmentType(); - if (environmentType == EnvType.CLIENT) { - return translateTextClient(translationKey); - } - return translateTextFallback(translationKey); + return Language.getInstance().translate(translationKey); } @NotNull diff --git a/1.14/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java b/1.14/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java index 7c00179f..1ad169d7 100644 --- a/1.14/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java +++ b/1.14/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java @@ -1,9 +1,6 @@ package dev.u9g.minecraftdatagenerator.util; -import net.fabricmc.api.EnvType; import net.fabricmc.loader.api.FabricLoader; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.resource.language.I18n; import net.minecraft.item.ItemConvertible; import net.minecraft.item.ItemStack; import net.minecraft.server.MinecraftServer; @@ -13,46 +10,13 @@ import org.jetbrains.annotations.NotNull; public class DGU { - - private static final Language language = Language.getInstance(); - - private static MinecraftServer getCurrentlyRunningServerClient() { - return MinecraftClient.getInstance().getServer(); - } - @SuppressWarnings("deprecation") - private static MinecraftServer getCurrentlyRunningServerDedicated() { - return (MinecraftServer) FabricLoader.getInstance().getGameInstance(); - } - public static MinecraftServer getCurrentlyRunningServer() { - EnvType environmentType = FabricLoader.getInstance().getEnvironmentType(); - if (environmentType == EnvType.CLIENT) { - return getCurrentlyRunningServerClient(); - } else if (environmentType == EnvType.SERVER) { - return getCurrentlyRunningServerDedicated(); - } - throw new UnsupportedOperationException(); - } - - private static String translateTextClient(String translationKey) { - return I18n.translate(translationKey); - } - - private static String translateTextFallback(String translationKey) { - try { - return language.translate(translationKey); - } catch (Exception ignored) { - } - throw new RuntimeException("Failed to translate: '" + translationKey + "'"); + return (MinecraftServer) FabricLoader.getInstance().getGameInstance(); } public static String translateText(String translationKey) { - EnvType environmentType = FabricLoader.getInstance().getEnvironmentType(); - if (environmentType == EnvType.CLIENT) { - return translateTextClient(translationKey); - } - return translateTextFallback(translationKey); + return Language.getInstance().translate(translationKey); } @NotNull diff --git a/1.14/src/main/java/dev/u9g/minecraftdatagenerator/util/EmptyRenderBlockView.java b/1.14/src/main/java/dev/u9g/minecraftdatagenerator/util/EmptyRenderBlockView.java deleted file mode 100644 index b9d28648..00000000 --- a/1.14/src/main/java/dev/u9g/minecraftdatagenerator/util/EmptyRenderBlockView.java +++ /dev/null @@ -1,57 +0,0 @@ -//package dev.u9g.minecraftdatagenerator.util; -// -//import net.minecraft.block.BlockState; -//import net.minecraft.block.Blocks; -//import net.minecraft.block.entity.BlockEntity; -//import net.minecraft.fluid.FluidState; -//import net.minecraft.fluid.Fluids; -//import net.minecraft.util.math.BlockPos; -//import net.minecraft.world.LightType; -//import net.minecraft.world.biome.Biomes; -//import net.minecraft.world.chunk.light.LightingProvider; -//import org.jetbrains.annotations.Nullable; -// -//public enum EmptyRenderBlockView implements BlockRenderView { -// INSTANCE; -// -// @Nullable -// public BlockEntity getBlockEntity(BlockPos pos) { -// return null; -// } -// -// public BlockState getBlockState(BlockPos pos) { -// return Blocks.AIR.getDefaultState(); -// } -// -// public FluidState getFluidState(BlockPos pos) { -// return Fluids.EMPTY.getDefaultState(); -// } -// -// public int getBottomY() { -// return 0; -// } -// -// public int getHeight() { -// return 0; -// } -// -// @Override -// public LightingProvider getLightingProvider() { -// return null; -// } -// -// @Override -// public int getColor(BlockPos pos, ColorResolver colorResolver) { -// return colorResolver.getColor(Biomes.PLAINS, pos.getX(), pos.getY()); -// } -// -// @Override -// public int getLightLevel(LightType type, BlockPos pos) { -// return type == LightType.SKY ? getMaxLightLevel() : 0; -// } -// -// @Override -// public int getBaseLightLevel(BlockPos pos, int ambientDarkness) { -// return ambientDarkness; -// } -//} diff --git a/1.15/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java b/1.15/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java index 5223a96d..f1ef2772 100644 --- a/1.15/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java +++ b/1.15/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java @@ -1,9 +1,6 @@ package dev.u9g.minecraftdatagenerator.util; -import net.fabricmc.api.EnvType; import net.fabricmc.loader.api.FabricLoader; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.resource.language.I18n; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.server.MinecraftServer; @@ -13,46 +10,13 @@ import org.jetbrains.annotations.NotNull; public class DGU { - - private static final Language language = Language.getInstance(); - - private static MinecraftServer getCurrentlyRunningServerClient() { - return MinecraftClient.getInstance().getServer(); - } - @SuppressWarnings("deprecation") - private static MinecraftServer getCurrentlyRunningServerDedicated() { - return (MinecraftServer) FabricLoader.getInstance().getGameInstance(); - } - public static MinecraftServer getCurrentlyRunningServer() { - EnvType environmentType = FabricLoader.getInstance().getEnvironmentType(); - if (environmentType == EnvType.CLIENT) { - return getCurrentlyRunningServerClient(); - } else if (environmentType == EnvType.SERVER) { - return getCurrentlyRunningServerDedicated(); - } - throw new UnsupportedOperationException(); - } - - private static String translateTextClient(String translationKey) { - return I18n.translate(translationKey); - } - - private static String translateTextFallback(String translationKey) { - try { - return language.translate(translationKey); - } catch (Exception ignored) { - } - throw new RuntimeException("Failed to translate: '" + translationKey + "'"); + return (MinecraftServer) FabricLoader.getInstance().getGameInstance(); } public static String translateText(String translationKey) { - EnvType environmentType = FabricLoader.getInstance().getEnvironmentType(); - if (environmentType == EnvType.CLIENT) { - return translateTextClient(translationKey); - } - return translateTextFallback(translationKey); + return Language.getInstance().translate(translationKey); } @NotNull diff --git a/1.16/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java b/1.16/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java index 119373d0..af2897ad 100644 --- a/1.16/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java +++ b/1.16/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java @@ -1,55 +1,19 @@ package dev.u9g.minecraftdatagenerator.util; -import net.fabricmc.api.EnvType; import net.fabricmc.loader.api.FabricLoader; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.resource.language.I18n; import net.minecraft.server.MinecraftServer; import net.minecraft.util.Language; import net.minecraft.world.World; import org.jetbrains.annotations.NotNull; public class DGU { - - private static final Language language = Language.getInstance(); - - private static MinecraftServer getCurrentlyRunningServerClient() { - return MinecraftClient.getInstance().getServer(); - } - @SuppressWarnings("deprecation") - private static MinecraftServer getCurrentlyRunningServerDedicated() { - return (MinecraftServer) FabricLoader.getInstance().getGameInstance(); - } - public static MinecraftServer getCurrentlyRunningServer() { - EnvType environmentType = FabricLoader.getInstance().getEnvironmentType(); - if (environmentType == EnvType.CLIENT) { - return getCurrentlyRunningServerClient(); - } else if (environmentType == EnvType.SERVER) { - return getCurrentlyRunningServerDedicated(); - } - throw new UnsupportedOperationException(); - } - - private static String translateTextClient(String translationKey) { - return I18n.translate(translationKey); - } - - private static String translateTextFallback(String translationKey) { - try { - return language.get(translationKey); - } catch (Exception ignored) { - } - throw new RuntimeException("Failed to translate: '" + translationKey + "'"); + return (MinecraftServer) FabricLoader.getInstance().getGameInstance(); } public static String translateText(String translationKey) { - EnvType environmentType = FabricLoader.getInstance().getEnvironmentType(); - if (environmentType == EnvType.CLIENT) { - return translateTextClient(translationKey); - } - return translateTextFallback(translationKey); + return Language.getInstance().get(translationKey); } @NotNull diff --git a/1.17/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java b/1.17/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java index ed730ac4..3946c1fe 100644 --- a/1.17/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java +++ b/1.17/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java @@ -1,54 +1,18 @@ package dev.u9g.minecraftdatagenerator.util; -import net.fabricmc.api.EnvType; import net.fabricmc.loader.api.FabricLoader; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.resource.language.I18n; import net.minecraft.server.MinecraftServer; import net.minecraft.util.Language; import net.minecraft.world.World; public class DGU { - - private static final Language language = Language.getInstance(); - - private static MinecraftServer getCurrentlyRunningServerClient() { - return MinecraftClient.getInstance().getServer(); - } - @SuppressWarnings("deprecation") - private static MinecraftServer getCurrentlyRunningServerDedicated() { - return (MinecraftServer) FabricLoader.getInstance().getGameInstance(); - } - public static MinecraftServer getCurrentlyRunningServer() { - EnvType environmentType = FabricLoader.getInstance().getEnvironmentType(); - if (environmentType == EnvType.CLIENT) { - return getCurrentlyRunningServerClient(); - } else if (environmentType == EnvType.SERVER) { - return getCurrentlyRunningServerDedicated(); - } - throw new UnsupportedOperationException(); - } - - private static String translateTextClient(String translationKey) { - return I18n.translate(translationKey); - } - - private static String translateTextFallback(String translationKey) { - try { - return language.get(translationKey); - } catch (Exception ignored) { - } - throw new RuntimeException("Failed to translate: '" + translationKey + "'"); + return (MinecraftServer) FabricLoader.getInstance().getGameInstance(); } public static String translateText(String translationKey) { - EnvType environmentType = FabricLoader.getInstance().getEnvironmentType(); - if (environmentType == EnvType.CLIENT) { - return translateTextClient(translationKey); - } - return translateTextFallback(translationKey); + return Language.getInstance().get(translationKey); } public static World getWorld() { diff --git a/1.18/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java b/1.18/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java index e81cdc3d..3946c1fe 100644 --- a/1.18/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java +++ b/1.18/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java @@ -1,53 +1,18 @@ package dev.u9g.minecraftdatagenerator.util; -import net.fabricmc.api.EnvType; import net.fabricmc.loader.api.FabricLoader; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.resource.language.I18n; import net.minecraft.server.MinecraftServer; import net.minecraft.util.Language; import net.minecraft.world.World; public class DGU { - private static final Language language = Language.getInstance(); - - private static MinecraftServer getCurrentlyRunningServerClient() { - return MinecraftClient.getInstance().getServer(); - } - @SuppressWarnings("deprecation") - private static MinecraftServer getCurrentlyRunningServerDedicated() { - return (MinecraftServer) FabricLoader.getInstance().getGameInstance(); - } - public static MinecraftServer getCurrentlyRunningServer() { - EnvType environmentType = FabricLoader.getInstance().getEnvironmentType(); - if (environmentType == EnvType.CLIENT) { - return getCurrentlyRunningServerClient(); - } else if (environmentType == EnvType.SERVER) { - return getCurrentlyRunningServerDedicated(); - } - throw new UnsupportedOperationException(); - } - - private static String translateTextClient(String translationKey) { - return I18n.translate(translationKey); - } - - private static String translateTextFallback(String translationKey) { - try { - return language.get(translationKey); - } catch (Exception ignored) { - } - throw new RuntimeException("Failed to translate: '" + translationKey + "'"); + return (MinecraftServer) FabricLoader.getInstance().getGameInstance(); } public static String translateText(String translationKey) { - EnvType environmentType = FabricLoader.getInstance().getEnvironmentType(); - if (environmentType == EnvType.CLIENT) { - return translateTextClient(translationKey); - } - return translateTextFallback(translationKey); + return Language.getInstance().get(translationKey); } public static World getWorld() { diff --git a/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java b/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java index 32c2fb65..3946c1fe 100644 --- a/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java +++ b/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java @@ -6,24 +6,13 @@ import net.minecraft.world.World; public class DGU { - - private static final Language language = Language.getInstance(); - @SuppressWarnings("deprecation") - private static MinecraftServer getCurrentlyRunningServerDedicated() { - return (MinecraftServer) FabricLoader.getInstance().getGameInstance(); - } - public static MinecraftServer getCurrentlyRunningServer() { - return getCurrentlyRunningServerDedicated(); - } - - private static String translateTextFallback(String translationKey) { - return language.get(translationKey); + return (MinecraftServer) FabricLoader.getInstance().getGameInstance(); } public static String translateText(String translationKey) { - return translateTextFallback(translationKey); + return Language.getInstance().get(translationKey); } public static World getWorld() { diff --git a/1.19/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java b/1.19/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java index 32c2fb65..3946c1fe 100644 --- a/1.19/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java +++ b/1.19/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java @@ -6,24 +6,13 @@ import net.minecraft.world.World; public class DGU { - - private static final Language language = Language.getInstance(); - @SuppressWarnings("deprecation") - private static MinecraftServer getCurrentlyRunningServerDedicated() { - return (MinecraftServer) FabricLoader.getInstance().getGameInstance(); - } - public static MinecraftServer getCurrentlyRunningServer() { - return getCurrentlyRunningServerDedicated(); - } - - private static String translateTextFallback(String translationKey) { - return language.get(translationKey); + return (MinecraftServer) FabricLoader.getInstance().getGameInstance(); } public static String translateText(String translationKey) { - return translateTextFallback(translationKey); + return Language.getInstance().get(translationKey); } public static World getWorld() { diff --git a/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java b/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java index 32c2fb65..3946c1fe 100644 --- a/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java +++ b/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java @@ -6,24 +6,13 @@ import net.minecraft.world.World; public class DGU { - - private static final Language language = Language.getInstance(); - @SuppressWarnings("deprecation") - private static MinecraftServer getCurrentlyRunningServerDedicated() { - return (MinecraftServer) FabricLoader.getInstance().getGameInstance(); - } - public static MinecraftServer getCurrentlyRunningServer() { - return getCurrentlyRunningServerDedicated(); - } - - private static String translateTextFallback(String translationKey) { - return language.get(translationKey); + return (MinecraftServer) FabricLoader.getInstance().getGameInstance(); } public static String translateText(String translationKey) { - return translateTextFallback(translationKey); + return Language.getInstance().get(translationKey); } public static World getWorld() { diff --git a/1.20/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java b/1.20/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java index 32c2fb65..3946c1fe 100644 --- a/1.20/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java +++ b/1.20/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java @@ -6,24 +6,13 @@ import net.minecraft.world.World; public class DGU { - - private static final Language language = Language.getInstance(); - @SuppressWarnings("deprecation") - private static MinecraftServer getCurrentlyRunningServerDedicated() { - return (MinecraftServer) FabricLoader.getInstance().getGameInstance(); - } - public static MinecraftServer getCurrentlyRunningServer() { - return getCurrentlyRunningServerDedicated(); - } - - private static String translateTextFallback(String translationKey) { - return language.get(translationKey); + return (MinecraftServer) FabricLoader.getInstance().getGameInstance(); } public static String translateText(String translationKey) { - return translateTextFallback(translationKey); + return Language.getInstance().get(translationKey); } public static World getWorld() { diff --git a/1.7/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java b/1.7/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java index 1cf7bae3..eff78862 100644 --- a/1.7/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java +++ b/1.7/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java @@ -1,8 +1,5 @@ package dev.u9g.minecraftdatagenerator.util; -import net.fabricmc.api.EnvType; -import net.fabricmc.loader.api.FabricLoader; -import net.minecraft.client.resource.language.I18n; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.server.MinecraftServer; @@ -14,25 +11,8 @@ public static MinecraftServer getCurrentlyRunningServer() { return MinecraftServer.getServer(); } - private static String translateTextClient(String translationKey) { - return I18n.translate(translationKey); - } - - private static String translateTextFallback(String translationKey) { - try { - return Registries.LANGUAGE.translate(translationKey); - } catch (Exception err) { - err.printStackTrace(); - } - throw new RuntimeException("Failed to translate: '" + translationKey + "'"); - } - public static String translateText(String translationKey) { - EnvType environmentType = FabricLoader.getInstance().getEnvironmentType(); - if (environmentType == EnvType.CLIENT) { - return translateTextClient(translationKey); - } - return translateTextFallback(translationKey); + return Registries.LANGUAGE.translate(translationKey); } @NotNull diff --git a/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java b/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java index 0af8980c..eff78862 100644 --- a/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java +++ b/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java @@ -1,8 +1,5 @@ package dev.u9g.minecraftdatagenerator.util; -import net.fabricmc.api.EnvType; -import net.fabricmc.loader.api.FabricLoader; -import net.minecraft.client.resource.language.I18n; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.server.MinecraftServer; @@ -11,27 +8,11 @@ public class DGU { public static MinecraftServer getCurrentlyRunningServer() { - return (MinecraftServer) FabricLoader.getInstance().getGameInstance(); - } - - private static String translateTextClient(String translationKey) { - return I18n.translate(translationKey); - } - - private static String translateTextFallback(String translationKey) { - try { - return Registries.LANGUAGE.translate(translationKey); - } catch (Exception ignored) { - } - throw new RuntimeException("Failed to translate: '" + translationKey + "'"); + return MinecraftServer.getServer(); } public static String translateText(String translationKey) { - EnvType environmentType = FabricLoader.getInstance().getEnvironmentType(); - if (environmentType == EnvType.CLIENT) { - return translateTextClient(translationKey); - } - return translateTextFallback(translationKey); + return Registries.LANGUAGE.translate(translationKey); } @NotNull diff --git a/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java b/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java index e54bd54b..95094eea 100644 --- a/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java +++ b/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java @@ -1,72 +1,20 @@ package dev.u9g.minecraftdatagenerator.util; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.TypeAdapter; -import com.google.gson.internal.bind.TypeAdapters; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonToken; -import com.google.gson.stream.JsonWriter; -import net.fabricmc.api.EnvType; import net.fabricmc.loader.api.FabricLoader; -import net.minecraft.client.resource.language.I18n; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.server.MinecraftServer; import net.minecraft.world.World; import org.jetbrains.annotations.NotNull; -import java.io.IOException; - public class DGU { - -//// private static MinecraftServer getCurrentlyRunningServerClient() { -// return MinecraftClient.getInstance().getServer(); -// } -// -// @SuppressWarnings("deprecation") -// private static MinecraftServer getCurrentlyRunningServerDedicated() { -// return (MinecraftServer) FabricLoader.getInstance().getGameInstance(); -// } - - public static Gson gson = new GsonBuilder().registerTypeAdapterFactory(TypeAdapters.newFactory(double.class, Double.class, new TypeAdapter() { - @Override - public Number read(JsonReader in) throws IOException { - if (in.peek() == JsonToken.NULL) { - in.nextNull(); - return null; - } - return in.nextDouble(); - } - - @Override - public void write(JsonWriter out, Number value) throws IOException { - out.value(value); - } - })).create(); - + @SuppressWarnings("deprecation") public static MinecraftServer getCurrentlyRunningServer() { return (MinecraftServer) FabricLoader.getInstance().getGameInstance(); } - private static String translateTextClient(String translationKey) { - return I18n.translate(translationKey); - } - - private static String translateTextFallback(String translationKey) { - try { - return Registries.LANGUAGE.translate(translationKey); - } catch (Exception ignored) { - } - throw new RuntimeException("Failed to translate: '" + translationKey + "'"); - } - public static String translateText(String translationKey) { - EnvType environmentType = FabricLoader.getInstance().getEnvironmentType(); - if (environmentType == EnvType.CLIENT) { - return translateTextClient(translationKey); - } - return translateTextFallback(translationKey); + return Registries.LANGUAGE.translate(translationKey); } @NotNull diff --git a/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java b/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java index ed730ac4..3946c1fe 100644 --- a/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java +++ b/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java @@ -1,54 +1,18 @@ package dev.u9g.minecraftdatagenerator.util; -import net.fabricmc.api.EnvType; import net.fabricmc.loader.api.FabricLoader; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.resource.language.I18n; import net.minecraft.server.MinecraftServer; import net.minecraft.util.Language; import net.minecraft.world.World; public class DGU { - - private static final Language language = Language.getInstance(); - - private static MinecraftServer getCurrentlyRunningServerClient() { - return MinecraftClient.getInstance().getServer(); - } - @SuppressWarnings("deprecation") - private static MinecraftServer getCurrentlyRunningServerDedicated() { - return (MinecraftServer) FabricLoader.getInstance().getGameInstance(); - } - public static MinecraftServer getCurrentlyRunningServer() { - EnvType environmentType = FabricLoader.getInstance().getEnvironmentType(); - if (environmentType == EnvType.CLIENT) { - return getCurrentlyRunningServerClient(); - } else if (environmentType == EnvType.SERVER) { - return getCurrentlyRunningServerDedicated(); - } - throw new UnsupportedOperationException(); - } - - private static String translateTextClient(String translationKey) { - return I18n.translate(translationKey); - } - - private static String translateTextFallback(String translationKey) { - try { - return language.get(translationKey); - } catch (Exception ignored) { - } - throw new RuntimeException("Failed to translate: '" + translationKey + "'"); + return (MinecraftServer) FabricLoader.getInstance().getGameInstance(); } public static String translateText(String translationKey) { - EnvType environmentType = FabricLoader.getInstance().getEnvironmentType(); - if (environmentType == EnvType.CLIENT) { - return translateTextClient(translationKey); - } - return translateTextFallback(translationKey); + return Language.getInstance().get(translationKey); } public static World getWorld() { From 7528b37f92c1d9afe885a043fbcf53999c6a9b50 Mon Sep 17 00:00:00 2001 From: AlexProgrammerDE <40795980+AlexProgrammerDE@users.noreply.github.com> Date: Sun, 28 Apr 2024 20:49:10 +0200 Subject: [PATCH 10/38] Remove unnecessary annotations --- .../minecraftdatagenerator/generators/TintsDataGenerator.java | 3 --- .../minecraftdatagenerator/generators/TintsDataGenerator.java | 3 --- .../minecraftdatagenerator/generators/TintsDataGenerator.java | 3 --- .../minecraftdatagenerator/generators/TintsDataGenerator.java | 3 --- .../minecraftdatagenerator/mojangannoyances/BiomeColors.java | 3 --- .../minecraftdatagenerator/mojangannoyances/BiomeColors.java | 3 --- .../minecraftdatagenerator/mojangannoyances/BiomeColors.java | 3 --- .../minecraftdatagenerator/mojangannoyances/BiomeColors.java | 3 --- .../minecraftdatagenerator/generators/TintsDataGenerator.java | 3 --- 9 files changed, 27 deletions(-) diff --git a/1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java b/1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java index 07926410..a182f5e2 100644 --- a/1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java +++ b/1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java @@ -7,7 +7,6 @@ import dev.u9g.minecraftdatagenerator.clientsideannoyances.ServerSideRedstoneWireBlock; import dev.u9g.minecraftdatagenerator.util.EmptyRenderBlockView; import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; import net.fabricmc.loader.api.FabricLoader; import net.minecraft.block.Block; import net.minecraft.block.Blocks; @@ -47,12 +46,10 @@ public static Map generateRedstoneTintColors() { return resultColors; } - @Environment(EnvType.CLIENT) private static int getBlockColor(Block block, BlockColors blockColors) { return blockColors.getColor(block.getDefaultState(), EmptyRenderBlockView.INSTANCE, BlockPos.ORIGIN, 0xFFFFFF); } - @Environment(EnvType.CLIENT) public static Map generateConstantTintColors() { Map resultColors = new HashMap<>(); BlockColors blockColors = BlockColors.create(); diff --git a/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java b/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java index f480e930..9985a58c 100644 --- a/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java +++ b/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java @@ -8,7 +8,6 @@ import dev.u9g.minecraftdatagenerator.mixin.BiomeEffectsAccessor; import dev.u9g.minecraftdatagenerator.util.EmptyRenderBlockView; import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; import net.fabricmc.loader.api.FabricLoader; import net.minecraft.block.Block; import net.minecraft.block.Blocks; @@ -48,12 +47,10 @@ public static Map generateRedstoneTintColors() { return resultColors; } - @Environment(EnvType.CLIENT) private static int getBlockColor(Block block, BlockColors blockColors) { return blockColors.getColor(block.getDefaultState(), EmptyRenderBlockView.INSTANCE, BlockPos.ORIGIN, 0xFFFFFF); } - @Environment(EnvType.CLIENT) public static Map generateConstantTintColors() { Map resultColors = new HashMap<>(); BlockColors blockColors = BlockColors.create(); diff --git a/1.17/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java b/1.17/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java index 3ceef91b..2af2d546 100644 --- a/1.17/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java +++ b/1.17/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java @@ -4,7 +4,6 @@ import com.google.gson.JsonObject; import dev.u9g.minecraftdatagenerator.util.EmptyRenderBlockView; import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; import net.fabricmc.loader.api.FabricLoader; import net.minecraft.block.Block; import net.minecraft.block.Blocks; @@ -46,12 +45,10 @@ public static Map generateRedstoneTintColors() { return resultColors; } - @Environment(EnvType.CLIENT) private static int getBlockColor(Block block, BlockColors blockColors) { return blockColors.getColor(block.getDefaultState(), EmptyRenderBlockView.INSTANCE, BlockPos.ORIGIN, 0xFFFFFF); } - @Environment(EnvType.CLIENT) public static Map generateConstantTintColors() { Map resultColors = new HashMap<>(); BlockColors blockColors = BlockColors.create(); diff --git a/1.18/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java b/1.18/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java index 3ceef91b..2af2d546 100644 --- a/1.18/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java +++ b/1.18/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java @@ -4,7 +4,6 @@ import com.google.gson.JsonObject; import dev.u9g.minecraftdatagenerator.util.EmptyRenderBlockView; import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; import net.fabricmc.loader.api.FabricLoader; import net.minecraft.block.Block; import net.minecraft.block.Blocks; @@ -46,12 +45,10 @@ public static Map generateRedstoneTintColors() { return resultColors; } - @Environment(EnvType.CLIENT) private static int getBlockColor(Block block, BlockColors blockColors) { return blockColors.getColor(block.getDefaultState(), EmptyRenderBlockView.INSTANCE, BlockPos.ORIGIN, 0xFFFFFF); } - @Environment(EnvType.CLIENT) public static Map generateConstantTintColors() { Map resultColors = new HashMap<>(); BlockColors blockColors = BlockColors.create(); diff --git a/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/mojangannoyances/BiomeColors.java b/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/mojangannoyances/BiomeColors.java index bb9ae83f..ed4e9740 100644 --- a/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/mojangannoyances/BiomeColors.java +++ b/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/mojangannoyances/BiomeColors.java @@ -1,13 +1,10 @@ package dev.u9g.minecraftdatagenerator.mojangannoyances; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; import net.minecraft.util.math.BlockPos; import net.minecraft.world.BlockRenderView; import net.minecraft.world.biome.Biome; import net.minecraft.world.level.ColorResolver; -@Environment(EnvType.CLIENT) public class BiomeColors { public static final ColorResolver GRASS_COLOR = Biome::getGrassColorAt; public static final ColorResolver FOLIAGE_COLOR = (biome, x, z) -> biome.getFoliageColor(); diff --git a/1.19/src/main/java/dev/u9g/minecraftdatagenerator/mojangannoyances/BiomeColors.java b/1.19/src/main/java/dev/u9g/minecraftdatagenerator/mojangannoyances/BiomeColors.java index bb9ae83f..ed4e9740 100644 --- a/1.19/src/main/java/dev/u9g/minecraftdatagenerator/mojangannoyances/BiomeColors.java +++ b/1.19/src/main/java/dev/u9g/minecraftdatagenerator/mojangannoyances/BiomeColors.java @@ -1,13 +1,10 @@ package dev.u9g.minecraftdatagenerator.mojangannoyances; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; import net.minecraft.util.math.BlockPos; import net.minecraft.world.BlockRenderView; import net.minecraft.world.biome.Biome; import net.minecraft.world.level.ColorResolver; -@Environment(EnvType.CLIENT) public class BiomeColors { public static final ColorResolver GRASS_COLOR = Biome::getGrassColorAt; public static final ColorResolver FOLIAGE_COLOR = (biome, x, z) -> biome.getFoliageColor(); diff --git a/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/mojangannoyances/BiomeColors.java b/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/mojangannoyances/BiomeColors.java index d374b11a..b5fdebe1 100644 --- a/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/mojangannoyances/BiomeColors.java +++ b/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/mojangannoyances/BiomeColors.java @@ -1,13 +1,10 @@ package dev.u9g.minecraftdatagenerator.mojangannoyances; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; import net.minecraft.util.math.BlockPos; import net.minecraft.world.BlockRenderView; import net.minecraft.world.biome.Biome; import net.minecraft.world.biome.ColorResolver; -@Environment(EnvType.CLIENT) public class BiomeColors { public static final ColorResolver GRASS_COLOR = Biome::getGrassColorAt; public static final ColorResolver FOLIAGE_COLOR = (biome, x, z) -> biome.getFoliageColor(); diff --git a/1.20/src/main/java/dev/u9g/minecraftdatagenerator/mojangannoyances/BiomeColors.java b/1.20/src/main/java/dev/u9g/minecraftdatagenerator/mojangannoyances/BiomeColors.java index d374b11a..b5fdebe1 100644 --- a/1.20/src/main/java/dev/u9g/minecraftdatagenerator/mojangannoyances/BiomeColors.java +++ b/1.20/src/main/java/dev/u9g/minecraftdatagenerator/mojangannoyances/BiomeColors.java @@ -1,13 +1,10 @@ package dev.u9g.minecraftdatagenerator.mojangannoyances; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; import net.minecraft.util.math.BlockPos; import net.minecraft.world.BlockRenderView; import net.minecraft.world.biome.Biome; import net.minecraft.world.biome.ColorResolver; -@Environment(EnvType.CLIENT) public class BiomeColors { public static final ColorResolver GRASS_COLOR = Biome::getGrassColorAt; public static final ColorResolver FOLIAGE_COLOR = (biome, x, z) -> biome.getFoliageColor(); diff --git a/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java b/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java index 283cc437..1b6b8c76 100644 --- a/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java +++ b/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java @@ -4,7 +4,6 @@ import com.google.gson.JsonObject; import dev.u9g.minecraftdatagenerator.util.EmptyRenderBlockView; import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; import net.fabricmc.loader.api.FabricLoader; import net.minecraft.block.Block; import net.minecraft.block.Blocks; @@ -46,12 +45,10 @@ public static Map generateRedstoneTintColors() { return resultColors; } - @Environment(EnvType.CLIENT) private static int getBlockColor(Block block, BlockColors blockColors) { return blockColors.getColor(block.getDefaultState(), EmptyRenderBlockView.INSTANCE, BlockPos.ORIGIN, 0xFFFFFF); } - @Environment(EnvType.CLIENT) public static Map generateConstantTintColors() { Map resultColors = new HashMap<>(); BlockColors blockColors = BlockColors.create(); From 6ce8ba7ee425a31fc3304312b9ca44b52004ced5 Mon Sep 17 00:00:00 2001 From: AlexProgrammerDE <40795980+AlexProgrammerDE@users.noreply.github.com> Date: Sun, 28 Apr 2024 20:59:13 +0200 Subject: [PATCH 11/38] Remove unused var --- .../generators/TintsDataGenerator.java | 6 ------ 1 file changed, 6 deletions(-) diff --git a/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java b/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java index 2d20e81a..fb21b763 100644 --- a/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java +++ b/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java @@ -27,12 +27,6 @@ public static BiomeTintColors generateBiomeTintColors() { BiomeTintColors colors = new BiomeTintColors(); for (Biome biome : Registries.BIOMES) { - EmptyBlockView bv = new EmptyBlockView() { - @Override - public Biome getBiome(BlockPos pos) { - return biome; - } - }; int biomeGrassColor = GrassColors.getGrassColor(biome); int biomeFoliageColor = FoliageColors.getFoliageColor(biome); int biomeWaterColor = ((BiomeAccessor) biome).waterColor(); From 05a18473b167af861442c1e786b66ff9ebbf2a6f Mon Sep 17 00:00:00 2001 From: AlexProgrammerDE <40795980+AlexProgrammerDE@users.noreply.github.com> Date: Mon, 29 Apr 2024 08:39:05 +0200 Subject: [PATCH 12/38] Halt with error on error --- .../MinecraftDataGenerator.java | 4 ++-- .../generators/DataGenerators.java | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/common/src/main/java/dev/u9g/minecraftdatagenerator/MinecraftDataGenerator.java b/common/src/main/java/dev/u9g/minecraftdatagenerator/MinecraftDataGenerator.java index a9ad0e5f..cc98441b 100644 --- a/common/src/main/java/dev/u9g/minecraftdatagenerator/MinecraftDataGenerator.java +++ b/common/src/main/java/dev/u9g/minecraftdatagenerator/MinecraftDataGenerator.java @@ -11,8 +11,8 @@ public class MinecraftDataGenerator { public static void start(String versionName, Path serverRootDirectory) { MinecraftDataGenerator.LOGGER.info("Starting data generation!"); Path dataDumpDirectory = serverRootDirectory.resolve("minecraft-data").resolve(versionName); - DataGenerators.runDataGenerators(dataDumpDirectory); + boolean success = DataGenerators.runDataGenerators(dataDumpDirectory); MinecraftDataGenerator.LOGGER.info("Done data generation!"); - Runtime.getRuntime().halt(0); + Runtime.getRuntime().halt(success ? 0 : 1); } } diff --git a/common/src/main/java/dev/u9g/minecraftdatagenerator/generators/DataGenerators.java b/common/src/main/java/dev/u9g/minecraftdatagenerator/generators/DataGenerators.java index a49514d7..0efd8726 100644 --- a/common/src/main/java/dev/u9g/minecraftdatagenerator/generators/DataGenerators.java +++ b/common/src/main/java/dev/u9g/minecraftdatagenerator/generators/DataGenerators.java @@ -35,9 +35,9 @@ public class DataGenerators { for (Class generatorClass : generators) { try { GENERATORS.add(generatorClass.getDeclaredConstructor().newInstance()); - } catch (ReflectiveOperationException exception) { + } catch (ReflectiveOperationException e) { logger.info(MessageFormat.format("Failed to instantiate data generator {0}", generatorClass.getName())); - exception.printStackTrace(); + e.printStackTrace(); } } } @@ -45,9 +45,9 @@ public class DataGenerators { public static boolean runDataGenerators(Path outputDirectory) { try { Files.createDirectories(outputDirectory); - } catch (IOException exception) { + } catch (IOException e) { logger.info("Failed to create data generator output directory at " + outputDirectory); - exception.printStackTrace(); + e.printStackTrace(); return false; } @@ -73,9 +73,9 @@ public static boolean runDataGenerators(Path outputDirectory) { } logger.info(MessageFormat.format("Generator: {0} -> {1}", dataGenerator.getDataName(), outputFileName)); - } catch (Throwable exception) { + } catch (Throwable e) { logger.info(MessageFormat.format("Failed to run data generator {0}", dataGenerator.getDataName())); - exception.printStackTrace(); + e.printStackTrace(); generatorsFailed++; } } From 8f8762e478acae5383a1393288d741fb7d114b63 Mon Sep 17 00:00:00 2001 From: AlexProgrammerDE <40795980+AlexProgrammerDE@users.noreply.github.com> Date: Mon, 29 Apr 2024 10:11:39 +0200 Subject: [PATCH 13/38] Remove unused mixins --- .../mixin/ReadyMixin.java | 1 + .../mixin/ReadyMixin.java | 1 + .../mixin/ReadyMixin.java | 1 + .../mixin/ReadyMixin.java | 1 + .../mixin/ReadyMixin.java | 1 + .../mixin/ReadyMixin.java | 1 + .../mixin/ReadyMixin.java | 1 + .../ClientPlayerInteractionManagerMixin.java | 57 ------------------- .../mixin/ReadyMixin.java | 1 + .../minecraft-data-generator.mixins.json | 1 - .../ClientPlayerInteractionManagerMixin.java | 57 ------------------- .../mixin/ReadyMixin.java | 1 + .../minecraft-data-generator.mixins.json | 1 - .../mixin/ReadyMixin.java | 1 + .../mixin/ReadyMixin.java | 1 + .../mixin/ReadyMixin.java | 1 + .../mixin/ReadyMixin.java | 1 + .../mixin/ReadyMixin.java | 1 + .../mixin/ReadyMixin.java | 1 + .../ClientPlayerInteractionManagerMixin.java | 57 ------------------- .../mixin/ReadyMixin.java | 1 + .../minecraft-data-generator.mixins.json | 1 - .../MinecraftDataGenerator.java | 2 +- .../generators/DataGenerators.java | 1 + 24 files changed, 18 insertions(+), 175 deletions(-) delete mode 100644 1.17/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ClientPlayerInteractionManagerMixin.java delete mode 100644 1.18/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ClientPlayerInteractionManagerMixin.java delete mode 100644 22w19a/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ClientPlayerInteractionManagerMixin.java diff --git a/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java b/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java index c1d96581..ed5a70fa 100644 --- a/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java +++ b/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java @@ -13,6 +13,7 @@ public class ReadyMixin { @Inject(method = "setupServer()Z", at = @At("TAIL")) private void init(CallbackInfoReturnable cir) { MinecraftDataGenerator.start( + ReadyMixin.class.getClassLoader(), DGU.getCurrentlyRunningServer().getVersion(), DGU.getCurrentlyRunningServer().getRunDirectory().toPath() ); diff --git a/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java b/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java index c1d96581..ed5a70fa 100644 --- a/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java +++ b/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java @@ -13,6 +13,7 @@ public class ReadyMixin { @Inject(method = "setupServer()Z", at = @At("TAIL")) private void init(CallbackInfoReturnable cir) { MinecraftDataGenerator.start( + ReadyMixin.class.getClassLoader(), DGU.getCurrentlyRunningServer().getVersion(), DGU.getCurrentlyRunningServer().getRunDirectory().toPath() ); diff --git a/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java b/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java index c1d96581..ed5a70fa 100644 --- a/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java +++ b/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java @@ -13,6 +13,7 @@ public class ReadyMixin { @Inject(method = "setupServer()Z", at = @At("TAIL")) private void init(CallbackInfoReturnable cir) { MinecraftDataGenerator.start( + ReadyMixin.class.getClassLoader(), DGU.getCurrentlyRunningServer().getVersion(), DGU.getCurrentlyRunningServer().getRunDirectory().toPath() ); diff --git a/1.13/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java b/1.13/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java index c1d96581..ed5a70fa 100644 --- a/1.13/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java +++ b/1.13/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java @@ -13,6 +13,7 @@ public class ReadyMixin { @Inject(method = "setupServer()Z", at = @At("TAIL")) private void init(CallbackInfoReturnable cir) { MinecraftDataGenerator.start( + ReadyMixin.class.getClassLoader(), DGU.getCurrentlyRunningServer().getVersion(), DGU.getCurrentlyRunningServer().getRunDirectory().toPath() ); diff --git a/1.14/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java b/1.14/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java index af7e9c10..89dad496 100644 --- a/1.14/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java +++ b/1.14/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java @@ -14,6 +14,7 @@ public class ReadyMixin { @Inject(method = "setupServer()Z", at = @At("TAIL")) private void init(CallbackInfoReturnable cir) { MinecraftDataGenerator.start( + ReadyMixin.class.getClassLoader(), MinecraftVersion.create().getName(), DGU.getCurrentlyRunningServer().getRunDirectory().toPath() ); diff --git a/1.15/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java b/1.15/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java index af7e9c10..89dad496 100644 --- a/1.15/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java +++ b/1.15/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java @@ -14,6 +14,7 @@ public class ReadyMixin { @Inject(method = "setupServer()Z", at = @At("TAIL")) private void init(CallbackInfoReturnable cir) { MinecraftDataGenerator.start( + ReadyMixin.class.getClassLoader(), MinecraftVersion.create().getName(), DGU.getCurrentlyRunningServer().getRunDirectory().toPath() ); diff --git a/1.16/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java b/1.16/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java index 4ba04e43..07e28285 100644 --- a/1.16/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java +++ b/1.16/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java @@ -14,6 +14,7 @@ public class ReadyMixin { @Inject(method = "setupServer()Z", at = @At("TAIL")) private void init(CallbackInfoReturnable cir) { MinecraftDataGenerator.start( + ReadyMixin.class.getClassLoader(), MinecraftVersion.field_25319.getName(), DGU.getCurrentlyRunningServer().getRunDirectory().toPath() ); diff --git a/1.17/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ClientPlayerInteractionManagerMixin.java b/1.17/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ClientPlayerInteractionManagerMixin.java deleted file mode 100644 index 40e926af..00000000 --- a/1.17/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ClientPlayerInteractionManagerMixin.java +++ /dev/null @@ -1,57 +0,0 @@ -package dev.u9g.minecraftdatagenerator.mixin; - -import com.google.common.base.Preconditions; -import net.minecraft.block.BlockState; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.network.ClientPlayerInteractionManager; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.world.World; -import org.objectweb.asm.Opcodes; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Unique; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; - -@Mixin(ClientPlayerInteractionManager.class) -public abstract class ClientPlayerInteractionManagerMixin { - @Unique - private long blockBreakingStartTicks; - @Unique - private BlockState stateBeingBroken; - - @Inject(method = "attackBlock", at = @At(value = "FIELD", target = "Lnet/minecraft/client/network/ClientPlayerInteractionManager;currentBreakingProgress:F", opcode = Opcodes.PUTFIELD)) - private void onBlockAttacked(BlockPos pos, Direction direction, CallbackInfoReturnable callbackInfo) { - World world = Preconditions.checkNotNull(MinecraftClient.getInstance().world); - this.blockBreakingStartTicks = world.getTime(); - } - - @Inject(method = "cancelBlockBreaking", at = @At("HEAD")) - private void onBlockBreakingCanceled(CallbackInfo callbackInfo) { - this.blockBreakingStartTicks = -1L; - } - - @Inject(method = "breakBlock", at = @At("HEAD")) - private void onBreakBlockHead(BlockPos pos, CallbackInfoReturnable callbackInfo) { - World world = Preconditions.checkNotNull(MinecraftClient.getInstance().world); - this.stateBeingBroken = world.getBlockState(pos); - } - - @Inject(method = "breakBlock", at = @At("RETURN")) - private void onBreakBlockReturn(BlockPos pos, CallbackInfoReturnable callbackInfo) { - World world = Preconditions.checkNotNull(MinecraftClient.getInstance().world); - if (callbackInfo.getReturnValue()) { - Preconditions.checkNotNull(stateBeingBroken); - if (blockBreakingStartTicks != -1L) { - long totalTicksElapsed = world.getTime() - this.blockBreakingStartTicks; - long totalTimeElapsed = totalTicksElapsed * 50L; - System.out.printf("Breaking block %s took %dms%n", stateBeingBroken.getBlock(), totalTimeElapsed); - } else { - System.out.printf("Breaking block %s took 0ms [INSTANT BREAK]%n", stateBeingBroken.getBlock()); - } - } - this.blockBreakingStartTicks = -1L; - } -} diff --git a/1.17/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java b/1.17/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java index 759563e2..a4a1768b 100644 --- a/1.17/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java +++ b/1.17/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java @@ -14,6 +14,7 @@ public class ReadyMixin { @Inject(method = "setupServer()Z", at = @At("TAIL")) private void init(CallbackInfoReturnable cir) { MinecraftDataGenerator.start( + ReadyMixin.class.getClassLoader(), MinecraftVersion.GAME_VERSION.getName(), DGU.getCurrentlyRunningServer().getRunDirectory().toPath() ); diff --git a/1.17/src/main/resources/minecraft-data-generator.mixins.json b/1.17/src/main/resources/minecraft-data-generator.mixins.json index d5bc0ee8..4cd5b4b9 100644 --- a/1.17/src/main/resources/minecraft-data-generator.mixins.json +++ b/1.17/src/main/resources/minecraft-data-generator.mixins.json @@ -4,7 +4,6 @@ "package": "dev.u9g.minecraftdatagenerator.mixin", "compatibilityLevel": "JAVA_17", "mixins": [ - "ClientPlayerInteractionManagerMixin", "MiningToolItemAccessor", "ReadyMixin", "SoundAccessor" diff --git a/1.18/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ClientPlayerInteractionManagerMixin.java b/1.18/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ClientPlayerInteractionManagerMixin.java deleted file mode 100644 index 40e926af..00000000 --- a/1.18/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ClientPlayerInteractionManagerMixin.java +++ /dev/null @@ -1,57 +0,0 @@ -package dev.u9g.minecraftdatagenerator.mixin; - -import com.google.common.base.Preconditions; -import net.minecraft.block.BlockState; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.network.ClientPlayerInteractionManager; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.world.World; -import org.objectweb.asm.Opcodes; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Unique; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; - -@Mixin(ClientPlayerInteractionManager.class) -public abstract class ClientPlayerInteractionManagerMixin { - @Unique - private long blockBreakingStartTicks; - @Unique - private BlockState stateBeingBroken; - - @Inject(method = "attackBlock", at = @At(value = "FIELD", target = "Lnet/minecraft/client/network/ClientPlayerInteractionManager;currentBreakingProgress:F", opcode = Opcodes.PUTFIELD)) - private void onBlockAttacked(BlockPos pos, Direction direction, CallbackInfoReturnable callbackInfo) { - World world = Preconditions.checkNotNull(MinecraftClient.getInstance().world); - this.blockBreakingStartTicks = world.getTime(); - } - - @Inject(method = "cancelBlockBreaking", at = @At("HEAD")) - private void onBlockBreakingCanceled(CallbackInfo callbackInfo) { - this.blockBreakingStartTicks = -1L; - } - - @Inject(method = "breakBlock", at = @At("HEAD")) - private void onBreakBlockHead(BlockPos pos, CallbackInfoReturnable callbackInfo) { - World world = Preconditions.checkNotNull(MinecraftClient.getInstance().world); - this.stateBeingBroken = world.getBlockState(pos); - } - - @Inject(method = "breakBlock", at = @At("RETURN")) - private void onBreakBlockReturn(BlockPos pos, CallbackInfoReturnable callbackInfo) { - World world = Preconditions.checkNotNull(MinecraftClient.getInstance().world); - if (callbackInfo.getReturnValue()) { - Preconditions.checkNotNull(stateBeingBroken); - if (blockBreakingStartTicks != -1L) { - long totalTicksElapsed = world.getTime() - this.blockBreakingStartTicks; - long totalTimeElapsed = totalTicksElapsed * 50L; - System.out.printf("Breaking block %s took %dms%n", stateBeingBroken.getBlock(), totalTimeElapsed); - } else { - System.out.printf("Breaking block %s took 0ms [INSTANT BREAK]%n", stateBeingBroken.getBlock()); - } - } - this.blockBreakingStartTicks = -1L; - } -} diff --git a/1.18/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java b/1.18/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java index c904c153..e1abd95c 100644 --- a/1.18/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java +++ b/1.18/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java @@ -14,6 +14,7 @@ public class ReadyMixin { @Inject(method = "setupServer()Z", at = @At("TAIL")) private void init(CallbackInfoReturnable cir) { MinecraftDataGenerator.start( + ReadyMixin.class.getClassLoader(), MinecraftVersion.CURRENT.getName(), DGU.getCurrentlyRunningServer().getRunDirectory().toPath() ); diff --git a/1.18/src/main/resources/minecraft-data-generator.mixins.json b/1.18/src/main/resources/minecraft-data-generator.mixins.json index 0867f2e4..bbfb664c 100644 --- a/1.18/src/main/resources/minecraft-data-generator.mixins.json +++ b/1.18/src/main/resources/minecraft-data-generator.mixins.json @@ -4,7 +4,6 @@ "package": "dev.u9g.minecraftdatagenerator.mixin", "compatibilityLevel": "JAVA_17", "mixins": [ - "ClientPlayerInteractionManagerMixin", "EULAMixin", "MiningToolItemAccessor", "ReadyMixin", diff --git a/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java b/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java index c904c153..e1abd95c 100644 --- a/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java +++ b/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java @@ -14,6 +14,7 @@ public class ReadyMixin { @Inject(method = "setupServer()Z", at = @At("TAIL")) private void init(CallbackInfoReturnable cir) { MinecraftDataGenerator.start( + ReadyMixin.class.getClassLoader(), MinecraftVersion.CURRENT.getName(), DGU.getCurrentlyRunningServer().getRunDirectory().toPath() ); diff --git a/1.19/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java b/1.19/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java index c904c153..e1abd95c 100644 --- a/1.19/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java +++ b/1.19/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java @@ -14,6 +14,7 @@ public class ReadyMixin { @Inject(method = "setupServer()Z", at = @At("TAIL")) private void init(CallbackInfoReturnable cir) { MinecraftDataGenerator.start( + ReadyMixin.class.getClassLoader(), MinecraftVersion.CURRENT.getName(), DGU.getCurrentlyRunningServer().getRunDirectory().toPath() ); diff --git a/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java b/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java index cf8d9ffc..4790ce2a 100644 --- a/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java +++ b/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java @@ -15,6 +15,7 @@ public class ReadyMixin { @Inject(method = "setupServer()Z", at = @At("TAIL")) private void init(CallbackInfoReturnable cir) { MinecraftDataGenerator.start( + ReadyMixin.class.getClassLoader(), MinecraftVersion.CURRENT.getName(), DGU.getCurrentlyRunningServer().getRunDirectory().toPath() ); diff --git a/1.20/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java b/1.20/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java index c904c153..e1abd95c 100644 --- a/1.20/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java +++ b/1.20/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java @@ -14,6 +14,7 @@ public class ReadyMixin { @Inject(method = "setupServer()Z", at = @At("TAIL")) private void init(CallbackInfoReturnable cir) { MinecraftDataGenerator.start( + ReadyMixin.class.getClassLoader(), MinecraftVersion.CURRENT.getName(), DGU.getCurrentlyRunningServer().getRunDirectory().toPath() ); diff --git a/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java b/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java index c1d96581..ed5a70fa 100644 --- a/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java +++ b/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java @@ -13,6 +13,7 @@ public class ReadyMixin { @Inject(method = "setupServer()Z", at = @At("TAIL")) private void init(CallbackInfoReturnable cir) { MinecraftDataGenerator.start( + ReadyMixin.class.getClassLoader(), DGU.getCurrentlyRunningServer().getVersion(), DGU.getCurrentlyRunningServer().getRunDirectory().toPath() ); diff --git a/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java b/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java index c1d96581..ed5a70fa 100644 --- a/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java +++ b/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java @@ -13,6 +13,7 @@ public class ReadyMixin { @Inject(method = "setupServer()Z", at = @At("TAIL")) private void init(CallbackInfoReturnable cir) { MinecraftDataGenerator.start( + ReadyMixin.class.getClassLoader(), DGU.getCurrentlyRunningServer().getVersion(), DGU.getCurrentlyRunningServer().getRunDirectory().toPath() ); diff --git a/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ClientPlayerInteractionManagerMixin.java b/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ClientPlayerInteractionManagerMixin.java deleted file mode 100644 index 40e926af..00000000 --- a/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ClientPlayerInteractionManagerMixin.java +++ /dev/null @@ -1,57 +0,0 @@ -package dev.u9g.minecraftdatagenerator.mixin; - -import com.google.common.base.Preconditions; -import net.minecraft.block.BlockState; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.network.ClientPlayerInteractionManager; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.world.World; -import org.objectweb.asm.Opcodes; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Unique; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; - -@Mixin(ClientPlayerInteractionManager.class) -public abstract class ClientPlayerInteractionManagerMixin { - @Unique - private long blockBreakingStartTicks; - @Unique - private BlockState stateBeingBroken; - - @Inject(method = "attackBlock", at = @At(value = "FIELD", target = "Lnet/minecraft/client/network/ClientPlayerInteractionManager;currentBreakingProgress:F", opcode = Opcodes.PUTFIELD)) - private void onBlockAttacked(BlockPos pos, Direction direction, CallbackInfoReturnable callbackInfo) { - World world = Preconditions.checkNotNull(MinecraftClient.getInstance().world); - this.blockBreakingStartTicks = world.getTime(); - } - - @Inject(method = "cancelBlockBreaking", at = @At("HEAD")) - private void onBlockBreakingCanceled(CallbackInfo callbackInfo) { - this.blockBreakingStartTicks = -1L; - } - - @Inject(method = "breakBlock", at = @At("HEAD")) - private void onBreakBlockHead(BlockPos pos, CallbackInfoReturnable callbackInfo) { - World world = Preconditions.checkNotNull(MinecraftClient.getInstance().world); - this.stateBeingBroken = world.getBlockState(pos); - } - - @Inject(method = "breakBlock", at = @At("RETURN")) - private void onBreakBlockReturn(BlockPos pos, CallbackInfoReturnable callbackInfo) { - World world = Preconditions.checkNotNull(MinecraftClient.getInstance().world); - if (callbackInfo.getReturnValue()) { - Preconditions.checkNotNull(stateBeingBroken); - if (blockBreakingStartTicks != -1L) { - long totalTicksElapsed = world.getTime() - this.blockBreakingStartTicks; - long totalTimeElapsed = totalTicksElapsed * 50L; - System.out.printf("Breaking block %s took %dms%n", stateBeingBroken.getBlock(), totalTimeElapsed); - } else { - System.out.printf("Breaking block %s took 0ms [INSTANT BREAK]%n", stateBeingBroken.getBlock()); - } - } - this.blockBreakingStartTicks = -1L; - } -} diff --git a/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java b/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java index c904c153..e1abd95c 100644 --- a/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java +++ b/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java @@ -14,6 +14,7 @@ public class ReadyMixin { @Inject(method = "setupServer()Z", at = @At("TAIL")) private void init(CallbackInfoReturnable cir) { MinecraftDataGenerator.start( + ReadyMixin.class.getClassLoader(), MinecraftVersion.CURRENT.getName(), DGU.getCurrentlyRunningServer().getRunDirectory().toPath() ); diff --git a/22w19a/src/main/resources/minecraft-data-generator.mixins.json b/22w19a/src/main/resources/minecraft-data-generator.mixins.json index 9e8d4163..ccdc91d0 100644 --- a/22w19a/src/main/resources/minecraft-data-generator.mixins.json +++ b/22w19a/src/main/resources/minecraft-data-generator.mixins.json @@ -4,7 +4,6 @@ "package": "dev.u9g.minecraftdatagenerator.mixin", "compatibilityLevel": "JAVA_17", "mixins": [ - "ClientPlayerInteractionManagerMixin", "MiningToolItemAccessor", "ReadyMixin", "TheEndBiomeDataAccessor" diff --git a/common/src/main/java/dev/u9g/minecraftdatagenerator/MinecraftDataGenerator.java b/common/src/main/java/dev/u9g/minecraftdatagenerator/MinecraftDataGenerator.java index cc98441b..a8649266 100644 --- a/common/src/main/java/dev/u9g/minecraftdatagenerator/MinecraftDataGenerator.java +++ b/common/src/main/java/dev/u9g/minecraftdatagenerator/MinecraftDataGenerator.java @@ -8,7 +8,7 @@ public class MinecraftDataGenerator { public static final Logger LOGGER = Logger.getLogger("mc-data-gen-serv"); - public static void start(String versionName, Path serverRootDirectory) { + public static void start(ClassLoader classLoader, String versionName, Path serverRootDirectory) { MinecraftDataGenerator.LOGGER.info("Starting data generation!"); Path dataDumpDirectory = serverRootDirectory.resolve("minecraft-data").resolve(versionName); boolean success = DataGenerators.runDataGenerators(dataDumpDirectory); diff --git a/common/src/main/java/dev/u9g/minecraftdatagenerator/generators/DataGenerators.java b/common/src/main/java/dev/u9g/minecraftdatagenerator/generators/DataGenerators.java index 0efd8726..bd193b40 100644 --- a/common/src/main/java/dev/u9g/minecraftdatagenerator/generators/DataGenerators.java +++ b/common/src/main/java/dev/u9g/minecraftdatagenerator/generators/DataGenerators.java @@ -22,6 +22,7 @@ public class DataGenerators { private static final Logger logger = MinecraftDataGenerator.LOGGER; static { + System.out.println(DataGenerators.class.getClassLoader()); List> generators; try (ScanResult scanResult = new ClassGraph() .acceptPackages("dev.u9g.minecraftdatagenerator.generators") From 0dda56625089c014c7c9d9f1dfdc9b00fd62f78e Mon Sep 17 00:00:00 2001 From: AlexProgrammerDE <40795980+AlexProgrammerDE@users.noreply.github.com> Date: Mon, 29 Apr 2024 10:44:47 +0200 Subject: [PATCH 14/38] Update fabric loader --- 1.10.2/build.gradle | 4 ++-- 1.10.2/gradle.properties | 1 - .../dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java | 1 - 1.11.2/build.gradle | 4 ++-- 1.11.2/gradle.properties | 1 - .../dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java | 1 - 1.12.2/build.gradle | 4 ++-- 1.12.2/gradle.properties | 1 - .../dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java | 1 - 1.13/build.gradle | 4 ++-- 1.13/gradle.properties | 1 - .../dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java | 1 - 1.14/build.gradle | 2 +- 1.14/gradle.properties | 1 - .../dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java | 1 - 1.15/build.gradle | 2 +- 1.15/gradle.properties | 1 - .../dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java | 1 - 1.16/build.gradle | 2 +- 1.16/gradle.properties | 1 - .../dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java | 1 - 1.17/build.gradle | 2 +- 1.17/gradle.properties | 1 - .../dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java | 1 - 1.18/build.gradle | 2 +- 1.18/gradle.properties | 1 - .../dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java | 1 - 1.19.2/build.gradle | 2 +- 1.19.2/gradle.properties | 1 - .../dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java | 1 - 1.19/build.gradle | 2 +- 1.19/gradle.properties | 1 - .../dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java | 1 - 1.20.4/build.gradle | 2 +- 1.20.4/gradle.properties | 1 - .../dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java | 1 - 1.20/build.gradle | 2 +- 1.20/gradle.properties | 1 - .../dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java | 1 - 1.7/build.gradle | 4 ++-- 1.7/gradle.properties | 1 - 1.8.9/build.gradle | 4 ++-- 1.8.9/gradle.properties | 1 - .../dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java | 1 - 1.9.4/build.gradle | 4 ++-- 1.9.4/gradle.properties | 1 - .../dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java | 1 - 22w19a/build.gradle | 2 +- 22w19a/gradle.properties | 1 - .../dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java | 1 - common/build.gradle | 1 + .../u9g/minecraftdatagenerator/MinecraftDataGenerator.java | 2 +- settings.gradle | 6 ++++++ 53 files changed, 32 insertions(+), 58 deletions(-) diff --git a/1.10.2/build.gradle b/1.10.2/build.gradle index 35b4361e..3b3ec11c 100644 --- a/1.10.2/build.gradle +++ b/1.10.2/build.gradle @@ -10,14 +10,14 @@ repositories { } loom { - setIntermediaryUrl('https://maven.legacyfabric.net/net/fabricmc/intermediary/%1$s/intermediary-%1$s-v2.jar'); + setIntermediaryUrl('https://maven.legacyfabric.net/net/fabricmc/intermediary/%1$s/intermediary-%1$s-v2.jar') customMinecraftManifest.set("https://meta.legacyfabric.net/v2/manifest/${minecraft_version}") } dependencies { minecraft "com.mojang:minecraft:${project.minecraft_version}" mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" - modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" + modImplementation libs.fabric.loader // Fabric API provides hooks for events, item registration, and more. As most mods will need this, it's included by default. // If you know for a fact you don't, it's not required and can be safely removed. diff --git a/1.10.2/gradle.properties b/1.10.2/gradle.properties index 335785fc..4d32d4dd 100644 --- a/1.10.2/gradle.properties +++ b/1.10.2/gradle.properties @@ -2,6 +2,5 @@ # More versions available at: https://grayray75.github.io/LegacyFabric-Versions/ minecraft_version=1.10.2 yarn_mappings=1.10.2+build.202206020145 -loader_version=0.14.3 # Dependencies # More versions available at: https://grayray75.github.io/LegacyFabric-Versions/ diff --git a/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java b/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java index ed5a70fa..c1d96581 100644 --- a/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java +++ b/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java @@ -13,7 +13,6 @@ public class ReadyMixin { @Inject(method = "setupServer()Z", at = @At("TAIL")) private void init(CallbackInfoReturnable cir) { MinecraftDataGenerator.start( - ReadyMixin.class.getClassLoader(), DGU.getCurrentlyRunningServer().getVersion(), DGU.getCurrentlyRunningServer().getRunDirectory().toPath() ); diff --git a/1.11.2/build.gradle b/1.11.2/build.gradle index 35b4361e..3b3ec11c 100644 --- a/1.11.2/build.gradle +++ b/1.11.2/build.gradle @@ -10,14 +10,14 @@ repositories { } loom { - setIntermediaryUrl('https://maven.legacyfabric.net/net/fabricmc/intermediary/%1$s/intermediary-%1$s-v2.jar'); + setIntermediaryUrl('https://maven.legacyfabric.net/net/fabricmc/intermediary/%1$s/intermediary-%1$s-v2.jar') customMinecraftManifest.set("https://meta.legacyfabric.net/v2/manifest/${minecraft_version}") } dependencies { minecraft "com.mojang:minecraft:${project.minecraft_version}" mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" - modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" + modImplementation libs.fabric.loader // Fabric API provides hooks for events, item registration, and more. As most mods will need this, it's included by default. // If you know for a fact you don't, it's not required and can be safely removed. diff --git a/1.11.2/gradle.properties b/1.11.2/gradle.properties index ff8f56c6..c0a54459 100644 --- a/1.11.2/gradle.properties +++ b/1.11.2/gradle.properties @@ -2,6 +2,5 @@ # More versions available at: https://grayray75.github.io/LegacyFabric-Versions/ minecraft_version=1.11.2 yarn_mappings=1.11.2+build.202206020145 -loader_version=0.14.3 # Dependencies # More versions available at: https://grayray75.github.io/LegacyFabric-Versions/ diff --git a/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java b/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java index ed5a70fa..c1d96581 100644 --- a/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java +++ b/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java @@ -13,7 +13,6 @@ public class ReadyMixin { @Inject(method = "setupServer()Z", at = @At("TAIL")) private void init(CallbackInfoReturnable cir) { MinecraftDataGenerator.start( - ReadyMixin.class.getClassLoader(), DGU.getCurrentlyRunningServer().getVersion(), DGU.getCurrentlyRunningServer().getRunDirectory().toPath() ); diff --git a/1.12.2/build.gradle b/1.12.2/build.gradle index 35b4361e..3b3ec11c 100644 --- a/1.12.2/build.gradle +++ b/1.12.2/build.gradle @@ -10,14 +10,14 @@ repositories { } loom { - setIntermediaryUrl('https://maven.legacyfabric.net/net/fabricmc/intermediary/%1$s/intermediary-%1$s-v2.jar'); + setIntermediaryUrl('https://maven.legacyfabric.net/net/fabricmc/intermediary/%1$s/intermediary-%1$s-v2.jar') customMinecraftManifest.set("https://meta.legacyfabric.net/v2/manifest/${minecraft_version}") } dependencies { minecraft "com.mojang:minecraft:${project.minecraft_version}" mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" - modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" + modImplementation libs.fabric.loader // Fabric API provides hooks for events, item registration, and more. As most mods will need this, it's included by default. // If you know for a fact you don't, it's not required and can be safely removed. diff --git a/1.12.2/gradle.properties b/1.12.2/gradle.properties index bf25787b..c06cf122 100644 --- a/1.12.2/gradle.properties +++ b/1.12.2/gradle.properties @@ -2,6 +2,5 @@ # More versions available at: https://grayray75.github.io/LegacyFabric-Versions/ minecraft_version=1.12.2 yarn_mappings=1.12.2+build.202206020145 -loader_version=0.14.3 # Dependencies # More versions available at: https://grayray75.github.io/LegacyFabric-Versions/ diff --git a/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java b/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java index ed5a70fa..c1d96581 100644 --- a/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java +++ b/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java @@ -13,7 +13,6 @@ public class ReadyMixin { @Inject(method = "setupServer()Z", at = @At("TAIL")) private void init(CallbackInfoReturnable cir) { MinecraftDataGenerator.start( - ReadyMixin.class.getClassLoader(), DGU.getCurrentlyRunningServer().getVersion(), DGU.getCurrentlyRunningServer().getRunDirectory().toPath() ); diff --git a/1.13/build.gradle b/1.13/build.gradle index 35b4361e..3b3ec11c 100644 --- a/1.13/build.gradle +++ b/1.13/build.gradle @@ -10,14 +10,14 @@ repositories { } loom { - setIntermediaryUrl('https://maven.legacyfabric.net/net/fabricmc/intermediary/%1$s/intermediary-%1$s-v2.jar'); + setIntermediaryUrl('https://maven.legacyfabric.net/net/fabricmc/intermediary/%1$s/intermediary-%1$s-v2.jar') customMinecraftManifest.set("https://meta.legacyfabric.net/v2/manifest/${minecraft_version}") } dependencies { minecraft "com.mojang:minecraft:${project.minecraft_version}" mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" - modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" + modImplementation libs.fabric.loader // Fabric API provides hooks for events, item registration, and more. As most mods will need this, it's included by default. // If you know for a fact you don't, it's not required and can be safely removed. diff --git a/1.13/gradle.properties b/1.13/gradle.properties index 495d46f4..ee020d0f 100644 --- a/1.13/gradle.properties +++ b/1.13/gradle.properties @@ -2,7 +2,6 @@ # More versions available at: https://grayray75.github.io/LegacyFabric-Versions/ minecraft_version=1.13.2 yarn_mappings=1.13.2+build.202206020145 -loader_version=0.14.3 # Dependencies # More versions available at: https://grayray75.github.io/LegacyFabric-Versions/ fabric_version = 1.4.2+1.8.9 diff --git a/1.13/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java b/1.13/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java index ed5a70fa..c1d96581 100644 --- a/1.13/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java +++ b/1.13/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java @@ -13,7 +13,6 @@ public class ReadyMixin { @Inject(method = "setupServer()Z", at = @At("TAIL")) private void init(CallbackInfoReturnable cir) { MinecraftDataGenerator.start( - ReadyMixin.class.getClassLoader(), DGU.getCurrentlyRunningServer().getVersion(), DGU.getCurrentlyRunningServer().getRunDirectory().toPath() ); diff --git a/1.14/build.gradle b/1.14/build.gradle index 09d52347..e1e1fdc8 100644 --- a/1.14/build.gradle +++ b/1.14/build.gradle @@ -6,7 +6,7 @@ dependencies { // To change the versions see the gradle.properties file minecraft "com.mojang:minecraft:${project.minecraft_version}" mappings "net.fabricmc:yarn:${project.yarn_mappings}" - modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" + modImplementation libs.fabric.loader // Fabric API. This is technically optional, but you probably want it anyway. modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" diff --git a/1.14/gradle.properties b/1.14/gradle.properties index 8986e709..bcff68f1 100644 --- a/1.14/gradle.properties +++ b/1.14/gradle.properties @@ -2,7 +2,6 @@ # check these on https://modmuss50.me/fabric.html minecraft_version=1.14 yarn_mappings=1.14+build.21 -loader_version=0.13.3 # Dependencies # check this on https://modmuss50.me/fabric.html fabric_version=0.3.0-pre+build.156 diff --git a/1.14/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java b/1.14/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java index 89dad496..af7e9c10 100644 --- a/1.14/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java +++ b/1.14/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java @@ -14,7 +14,6 @@ public class ReadyMixin { @Inject(method = "setupServer()Z", at = @At("TAIL")) private void init(CallbackInfoReturnable cir) { MinecraftDataGenerator.start( - ReadyMixin.class.getClassLoader(), MinecraftVersion.create().getName(), DGU.getCurrentlyRunningServer().getRunDirectory().toPath() ); diff --git a/1.15/build.gradle b/1.15/build.gradle index efe24728..4e06f575 100644 --- a/1.15/build.gradle +++ b/1.15/build.gradle @@ -6,7 +6,7 @@ dependencies { // To change the versions see the gradle.properties file minecraft "com.mojang:minecraft:${project.minecraft_version}" mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" - modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" + modImplementation libs.fabric.loader // Fabric API. This is technically optional, but you probably want it anyway. modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" diff --git a/1.15/gradle.properties b/1.15/gradle.properties index 055fa5cf..9559f8a4 100644 --- a/1.15/gradle.properties +++ b/1.15/gradle.properties @@ -2,7 +2,6 @@ # check these on https://modmuss50.me/fabric.html minecraft_version=1.15 yarn_mappings=1.15+build.2 -loader_version=0.13.3 # Dependencies # check this on https://modmuss50.me/fabric.html fabric_version=0.28.5+1.15 diff --git a/1.15/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java b/1.15/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java index 89dad496..af7e9c10 100644 --- a/1.15/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java +++ b/1.15/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java @@ -14,7 +14,6 @@ public class ReadyMixin { @Inject(method = "setupServer()Z", at = @At("TAIL")) private void init(CallbackInfoReturnable cir) { MinecraftDataGenerator.start( - ReadyMixin.class.getClassLoader(), MinecraftVersion.create().getName(), DGU.getCurrentlyRunningServer().getRunDirectory().toPath() ); diff --git a/1.16/build.gradle b/1.16/build.gradle index efe24728..4e06f575 100644 --- a/1.16/build.gradle +++ b/1.16/build.gradle @@ -6,7 +6,7 @@ dependencies { // To change the versions see the gradle.properties file minecraft "com.mojang:minecraft:${project.minecraft_version}" mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" - modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" + modImplementation libs.fabric.loader // Fabric API. This is technically optional, but you probably want it anyway. modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" diff --git a/1.16/gradle.properties b/1.16/gradle.properties index 3fe3c1b0..79322a12 100644 --- a/1.16/gradle.properties +++ b/1.16/gradle.properties @@ -2,7 +2,6 @@ # check these on https://modmuss50.me/fabric.html minecraft_version=1.16 yarn_mappings=1.16+build.4 -loader_version=0.13.3 # Dependencies # check this on https://modmuss50.me/fabric.html # fabric_version=0.36.0+1.17 diff --git a/1.16/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java b/1.16/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java index 07e28285..4ba04e43 100644 --- a/1.16/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java +++ b/1.16/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java @@ -14,7 +14,6 @@ public class ReadyMixin { @Inject(method = "setupServer()Z", at = @At("TAIL")) private void init(CallbackInfoReturnable cir) { MinecraftDataGenerator.start( - ReadyMixin.class.getClassLoader(), MinecraftVersion.field_25319.getName(), DGU.getCurrentlyRunningServer().getRunDirectory().toPath() ); diff --git a/1.17/build.gradle b/1.17/build.gradle index efe24728..4e06f575 100644 --- a/1.17/build.gradle +++ b/1.17/build.gradle @@ -6,7 +6,7 @@ dependencies { // To change the versions see the gradle.properties file minecraft "com.mojang:minecraft:${project.minecraft_version}" mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" - modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" + modImplementation libs.fabric.loader // Fabric API. This is technically optional, but you probably want it anyway. modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" diff --git a/1.17/gradle.properties b/1.17/gradle.properties index e181bfd6..08f9d5ac 100644 --- a/1.17/gradle.properties +++ b/1.17/gradle.properties @@ -2,7 +2,6 @@ # check these on https://modmuss50.me/fabric.html minecraft_version=1.17 yarn_mappings=1.17+build.13 -loader_version=0.13.3 # Dependencies # check this on https://modmuss50.me/fabric.html fabric_version=0.36.0+1.17 diff --git a/1.17/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java b/1.17/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java index a4a1768b..759563e2 100644 --- a/1.17/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java +++ b/1.17/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java @@ -14,7 +14,6 @@ public class ReadyMixin { @Inject(method = "setupServer()Z", at = @At("TAIL")) private void init(CallbackInfoReturnable cir) { MinecraftDataGenerator.start( - ReadyMixin.class.getClassLoader(), MinecraftVersion.GAME_VERSION.getName(), DGU.getCurrentlyRunningServer().getRunDirectory().toPath() ); diff --git a/1.18/build.gradle b/1.18/build.gradle index efe24728..4e06f575 100644 --- a/1.18/build.gradle +++ b/1.18/build.gradle @@ -6,7 +6,7 @@ dependencies { // To change the versions see the gradle.properties file minecraft "com.mojang:minecraft:${project.minecraft_version}" mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" - modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" + modImplementation libs.fabric.loader // Fabric API. This is technically optional, but you probably want it anyway. modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" diff --git a/1.18/gradle.properties b/1.18/gradle.properties index a13d73ad..33aea2f5 100644 --- a/1.18/gradle.properties +++ b/1.18/gradle.properties @@ -2,7 +2,6 @@ # check these on https://modmuss50.me/fabric.html minecraft_version=1.18 yarn_mappings=1.18+build.1 -loader_version=0.14.4 # Dependencies # check this on https://modmuss50.me/fabric.html fabric_version=0.44.0+1.18 diff --git a/1.18/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java b/1.18/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java index e1abd95c..c904c153 100644 --- a/1.18/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java +++ b/1.18/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java @@ -14,7 +14,6 @@ public class ReadyMixin { @Inject(method = "setupServer()Z", at = @At("TAIL")) private void init(CallbackInfoReturnable cir) { MinecraftDataGenerator.start( - ReadyMixin.class.getClassLoader(), MinecraftVersion.CURRENT.getName(), DGU.getCurrentlyRunningServer().getRunDirectory().toPath() ); diff --git a/1.19.2/build.gradle b/1.19.2/build.gradle index efe24728..4e06f575 100644 --- a/1.19.2/build.gradle +++ b/1.19.2/build.gradle @@ -6,7 +6,7 @@ dependencies { // To change the versions see the gradle.properties file minecraft "com.mojang:minecraft:${project.minecraft_version}" mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" - modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" + modImplementation libs.fabric.loader // Fabric API. This is technically optional, but you probably want it anyway. modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" diff --git a/1.19.2/gradle.properties b/1.19.2/gradle.properties index ff2fb68f..1e749c16 100644 --- a/1.19.2/gradle.properties +++ b/1.19.2/gradle.properties @@ -2,7 +2,6 @@ # check these on https://modmuss50.me/fabric.html minecraft_version=1.19.2 yarn_mappings=1.19.2+build.28 -loader_version=0.14.10 # Dependencies # check this on https://modmuss50.me/fabric.html fabric_version=0.67.0+1.19.2 diff --git a/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java b/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java index e1abd95c..c904c153 100644 --- a/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java +++ b/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java @@ -14,7 +14,6 @@ public class ReadyMixin { @Inject(method = "setupServer()Z", at = @At("TAIL")) private void init(CallbackInfoReturnable cir) { MinecraftDataGenerator.start( - ReadyMixin.class.getClassLoader(), MinecraftVersion.CURRENT.getName(), DGU.getCurrentlyRunningServer().getRunDirectory().toPath() ); diff --git a/1.19/build.gradle b/1.19/build.gradle index efe24728..4e06f575 100644 --- a/1.19/build.gradle +++ b/1.19/build.gradle @@ -6,7 +6,7 @@ dependencies { // To change the versions see the gradle.properties file minecraft "com.mojang:minecraft:${project.minecraft_version}" mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" - modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" + modImplementation libs.fabric.loader // Fabric API. This is technically optional, but you probably want it anyway. modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" diff --git a/1.19/gradle.properties b/1.19/gradle.properties index b4a4ae23..16c8e844 100644 --- a/1.19/gradle.properties +++ b/1.19/gradle.properties @@ -2,7 +2,6 @@ # check these on https://modmuss50.me/fabric.html minecraft_version=1.19 yarn_mappings=1.19+build.1 -loader_version=0.14.6 # Dependencies # check this on https://modmuss50.me/fabric.html fabric_version=0.55.2+1.19 diff --git a/1.19/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java b/1.19/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java index e1abd95c..c904c153 100644 --- a/1.19/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java +++ b/1.19/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java @@ -14,7 +14,6 @@ public class ReadyMixin { @Inject(method = "setupServer()Z", at = @At("TAIL")) private void init(CallbackInfoReturnable cir) { MinecraftDataGenerator.start( - ReadyMixin.class.getClassLoader(), MinecraftVersion.CURRENT.getName(), DGU.getCurrentlyRunningServer().getRunDirectory().toPath() ); diff --git a/1.20.4/build.gradle b/1.20.4/build.gradle index efe24728..4e06f575 100644 --- a/1.20.4/build.gradle +++ b/1.20.4/build.gradle @@ -6,7 +6,7 @@ dependencies { // To change the versions see the gradle.properties file minecraft "com.mojang:minecraft:${project.minecraft_version}" mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" - modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" + modImplementation libs.fabric.loader // Fabric API. This is technically optional, but you probably want it anyway. modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" diff --git a/1.20.4/gradle.properties b/1.20.4/gradle.properties index 7d228ec0..63eca8f1 100644 --- a/1.20.4/gradle.properties +++ b/1.20.4/gradle.properties @@ -2,7 +2,6 @@ # check these on https://modmuss50.me/fabric.html minecraft_version=1.20.4 yarn_mappings=1.20.4+build.3 -loader_version=0.15.3 # Dependencies # check this on https://modmuss50.me/fabric.html fabric_version=0.92.0+1.20.4 diff --git a/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java b/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java index 4790ce2a..cf8d9ffc 100644 --- a/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java +++ b/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java @@ -15,7 +15,6 @@ public class ReadyMixin { @Inject(method = "setupServer()Z", at = @At("TAIL")) private void init(CallbackInfoReturnable cir) { MinecraftDataGenerator.start( - ReadyMixin.class.getClassLoader(), MinecraftVersion.CURRENT.getName(), DGU.getCurrentlyRunningServer().getRunDirectory().toPath() ); diff --git a/1.20/build.gradle b/1.20/build.gradle index efe24728..4e06f575 100644 --- a/1.20/build.gradle +++ b/1.20/build.gradle @@ -6,7 +6,7 @@ dependencies { // To change the versions see the gradle.properties file minecraft "com.mojang:minecraft:${project.minecraft_version}" mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" - modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" + modImplementation libs.fabric.loader // Fabric API. This is technically optional, but you probably want it anyway. modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" diff --git a/1.20/gradle.properties b/1.20/gradle.properties index 1818770d..e2905801 100644 --- a/1.20/gradle.properties +++ b/1.20/gradle.properties @@ -2,7 +2,6 @@ # check these on https://modmuss50.me/fabric.html minecraft_version=1.20.2 yarn_mappings=1.20.2+build.4 -loader_version=0.14.24 # Dependencies # check this on https://modmuss50.me/fabric.html fabric_version=0.90.4+1.20.2 diff --git a/1.20/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java b/1.20/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java index e1abd95c..c904c153 100644 --- a/1.20/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java +++ b/1.20/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java @@ -14,7 +14,6 @@ public class ReadyMixin { @Inject(method = "setupServer()Z", at = @At("TAIL")) private void init(CallbackInfoReturnable cir) { MinecraftDataGenerator.start( - ReadyMixin.class.getClassLoader(), MinecraftVersion.CURRENT.getName(), DGU.getCurrentlyRunningServer().getRunDirectory().toPath() ); diff --git a/1.7/build.gradle b/1.7/build.gradle index 68563dd8..54fcdf22 100644 --- a/1.7/build.gradle +++ b/1.7/build.gradle @@ -10,7 +10,7 @@ repositories { } loom { - setIntermediaryUrl('https://maven.legacyfabric.net/net/fabricmc/intermediary/%1$s/intermediary-%1$s-v2.jar'); + setIntermediaryUrl('https://maven.legacyfabric.net/net/fabricmc/intermediary/%1$s/intermediary-%1$s-v2.jar') customMinecraftManifest.set("https://legacyfabric.u9g.dev/v2/manifest/${minecraft_version}") // Required by 1.7.x @@ -24,7 +24,7 @@ loom { dependencies { minecraft "com.mojang:minecraft:${project.minecraft_version}" mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" - modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" + modImplementation libs.fabric.loader // Fabric API provides hooks for events, item registration, and more. As most mods will need this, it's included by default. // If you know for a fact you don't, it's not required and can be safely removed. diff --git a/1.7/gradle.properties b/1.7/gradle.properties index 8212c17c..e36413c8 100644 --- a/1.7/gradle.properties +++ b/1.7/gradle.properties @@ -2,6 +2,5 @@ # More versions available at: https://grayray75.github.io/LegacyFabric-Versions/ minecraft_version=1.7 yarn_mappings=1.7+build.202206071953 -loader_version=0.14.3 # Dependencies # More versions available at: https://grayray75.github.io/LegacyFabric-Versions/ diff --git a/1.8.9/build.gradle b/1.8.9/build.gradle index 35b4361e..3b3ec11c 100644 --- a/1.8.9/build.gradle +++ b/1.8.9/build.gradle @@ -10,14 +10,14 @@ repositories { } loom { - setIntermediaryUrl('https://maven.legacyfabric.net/net/fabricmc/intermediary/%1$s/intermediary-%1$s-v2.jar'); + setIntermediaryUrl('https://maven.legacyfabric.net/net/fabricmc/intermediary/%1$s/intermediary-%1$s-v2.jar') customMinecraftManifest.set("https://meta.legacyfabric.net/v2/manifest/${minecraft_version}") } dependencies { minecraft "com.mojang:minecraft:${project.minecraft_version}" mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" - modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" + modImplementation libs.fabric.loader // Fabric API provides hooks for events, item registration, and more. As most mods will need this, it's included by default. // If you know for a fact you don't, it's not required and can be safely removed. diff --git a/1.8.9/gradle.properties b/1.8.9/gradle.properties index 7cbf4cd4..fb32dd58 100644 --- a/1.8.9/gradle.properties +++ b/1.8.9/gradle.properties @@ -2,6 +2,5 @@ # More versions available at: https://grayray75.github.io/LegacyFabric-Versions/ minecraft_version=1.8.9 yarn_mappings=1.8.9+build.202206020145 -loader_version=0.14.3 # Dependencies # More versions available at: https://grayray75.github.io/LegacyFabric-Versions/ diff --git a/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java b/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java index ed5a70fa..c1d96581 100644 --- a/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java +++ b/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java @@ -13,7 +13,6 @@ public class ReadyMixin { @Inject(method = "setupServer()Z", at = @At("TAIL")) private void init(CallbackInfoReturnable cir) { MinecraftDataGenerator.start( - ReadyMixin.class.getClassLoader(), DGU.getCurrentlyRunningServer().getVersion(), DGU.getCurrentlyRunningServer().getRunDirectory().toPath() ); diff --git a/1.9.4/build.gradle b/1.9.4/build.gradle index 35b4361e..3b3ec11c 100644 --- a/1.9.4/build.gradle +++ b/1.9.4/build.gradle @@ -10,14 +10,14 @@ repositories { } loom { - setIntermediaryUrl('https://maven.legacyfabric.net/net/fabricmc/intermediary/%1$s/intermediary-%1$s-v2.jar'); + setIntermediaryUrl('https://maven.legacyfabric.net/net/fabricmc/intermediary/%1$s/intermediary-%1$s-v2.jar') customMinecraftManifest.set("https://meta.legacyfabric.net/v2/manifest/${minecraft_version}") } dependencies { minecraft "com.mojang:minecraft:${project.minecraft_version}" mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" - modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" + modImplementation libs.fabric.loader // Fabric API provides hooks for events, item registration, and more. As most mods will need this, it's included by default. // If you know for a fact you don't, it's not required and can be safely removed. diff --git a/1.9.4/gradle.properties b/1.9.4/gradle.properties index fc6b90df..806b6dbc 100644 --- a/1.9.4/gradle.properties +++ b/1.9.4/gradle.properties @@ -2,6 +2,5 @@ # More versions available at: https://grayray75.github.io/LegacyFabric-Versions/ minecraft_version=1.9.4 yarn_mappings=1.9.4+build.202206020145 -loader_version=0.14.3 # Dependencies # More versions available at: https://grayray75.github.io/LegacyFabric-Versions/ diff --git a/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java b/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java index ed5a70fa..c1d96581 100644 --- a/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java +++ b/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java @@ -13,7 +13,6 @@ public class ReadyMixin { @Inject(method = "setupServer()Z", at = @At("TAIL")) private void init(CallbackInfoReturnable cir) { MinecraftDataGenerator.start( - ReadyMixin.class.getClassLoader(), DGU.getCurrentlyRunningServer().getVersion(), DGU.getCurrentlyRunningServer().getRunDirectory().toPath() ); diff --git a/22w19a/build.gradle b/22w19a/build.gradle index efe24728..4e06f575 100644 --- a/22w19a/build.gradle +++ b/22w19a/build.gradle @@ -6,7 +6,7 @@ dependencies { // To change the versions see the gradle.properties file minecraft "com.mojang:minecraft:${project.minecraft_version}" mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" - modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" + modImplementation libs.fabric.loader // Fabric API. This is technically optional, but you probably want it anyway. modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" diff --git a/22w19a/gradle.properties b/22w19a/gradle.properties index d6cfd057..d7edbaff 100644 --- a/22w19a/gradle.properties +++ b/22w19a/gradle.properties @@ -2,7 +2,6 @@ # check these on https://modmuss50.me/fabric.html minecraft_version=22w19a yarn_mappings=22w19a+build.1 -loader_version=0.14.5 # Dependencies # check this on https://modmuss50.me/fabric.html fabric_version=0.52.2+1.19 diff --git a/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java b/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java index e1abd95c..c904c153 100644 --- a/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java +++ b/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java @@ -14,7 +14,6 @@ public class ReadyMixin { @Inject(method = "setupServer()Z", at = @At("TAIL")) private void init(CallbackInfoReturnable cir) { MinecraftDataGenerator.start( - ReadyMixin.class.getClassLoader(), MinecraftVersion.CURRENT.getName(), DGU.getCurrentlyRunningServer().getRunDirectory().toPath() ); diff --git a/common/build.gradle b/common/build.gradle index 5f359ad0..16faa93b 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -5,6 +5,7 @@ plugins { dependencies { compileOnly 'com.google.code.gson:gson:2.10.1' implementation 'io.github.classgraph:classgraph:4.8.172' + implementation "net.lenni0451:Reflect:1.3.3" } tasks.withType(JavaCompile).configureEach { diff --git a/common/src/main/java/dev/u9g/minecraftdatagenerator/MinecraftDataGenerator.java b/common/src/main/java/dev/u9g/minecraftdatagenerator/MinecraftDataGenerator.java index a8649266..cc98441b 100644 --- a/common/src/main/java/dev/u9g/minecraftdatagenerator/MinecraftDataGenerator.java +++ b/common/src/main/java/dev/u9g/minecraftdatagenerator/MinecraftDataGenerator.java @@ -8,7 +8,7 @@ public class MinecraftDataGenerator { public static final Logger LOGGER = Logger.getLogger("mc-data-gen-serv"); - public static void start(ClassLoader classLoader, String versionName, Path serverRootDirectory) { + public static void start(String versionName, Path serverRootDirectory) { MinecraftDataGenerator.LOGGER.info("Starting data generation!"); Path dataDumpDirectory = serverRootDirectory.resolve("minecraft-data").resolve(versionName); boolean success = DataGenerators.runDataGenerators(dataDumpDirectory); diff --git a/settings.gradle b/settings.gradle index b76eb22b..c1a1a775 100644 --- a/settings.gradle +++ b/settings.gradle @@ -27,6 +27,12 @@ dependencyResolutionManagement { } mavenCentral() } + versionCatalogs { + libs { + version('fabric-loader', '0.15.10') + library('fabric-loader', 'net.fabricmc', 'fabric-loader').versionRef('fabric-loader') + } + } } include "common" From f99669f0f9f35b7598665dd64d0c432c1784f60d Mon Sep 17 00:00:00 2001 From: AlexProgrammerDE <40795980+AlexProgrammerDE@users.noreply.github.com> Date: Mon, 29 Apr 2024 10:49:59 +0200 Subject: [PATCH 15/38] Ignore success result --- .../u9g/minecraftdatagenerator/MinecraftDataGenerator.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/src/main/java/dev/u9g/minecraftdatagenerator/MinecraftDataGenerator.java b/common/src/main/java/dev/u9g/minecraftdatagenerator/MinecraftDataGenerator.java index cc98441b..a9ad0e5f 100644 --- a/common/src/main/java/dev/u9g/minecraftdatagenerator/MinecraftDataGenerator.java +++ b/common/src/main/java/dev/u9g/minecraftdatagenerator/MinecraftDataGenerator.java @@ -11,8 +11,8 @@ public class MinecraftDataGenerator { public static void start(String versionName, Path serverRootDirectory) { MinecraftDataGenerator.LOGGER.info("Starting data generation!"); Path dataDumpDirectory = serverRootDirectory.resolve("minecraft-data").resolve(versionName); - boolean success = DataGenerators.runDataGenerators(dataDumpDirectory); + DataGenerators.runDataGenerators(dataDumpDirectory); MinecraftDataGenerator.LOGGER.info("Done data generation!"); - Runtime.getRuntime().halt(success ? 0 : 1); + Runtime.getRuntime().halt(0); } } From 3885a7c8ffbfb73bb549b1edbdb37eae482dd26d Mon Sep 17 00:00:00 2001 From: AlexProgrammerDE <40795980+AlexProgrammerDE@users.noreply.github.com> Date: Mon, 29 Apr 2024 14:39:00 +0200 Subject: [PATCH 16/38] Update gradle and use merged jar --- 1.10.2/build.gradle | 4 +++ 1.11.2/build.gradle | 4 +++ 1.12.2/build.gradle | 4 +++ 1.13/build.gradle | 4 +++ 1.14/build.gradle | 6 ++++ 1.15/build.gradle | 6 ++++ 1.16/build.gradle | 6 ++++ 1.17/build.gradle | 6 ++++ 1.18/build.gradle | 6 ++++ 1.19.2/build.gradle | 6 ++++ 1.19/build.gradle | 6 ++++ 1.20.4/build.gradle | 6 ++++ 1.20/build.gradle | 6 ++++ 1.7/build.gradle | 21 +++++++++---- 1.8.9/build.gradle | 4 +++ 1.9.4/build.gradle | 4 +++ 22w19a/build.gradle | 6 ++++ .../generators/DataGenerators.java | 1 - gradle/wrapper/gradle-wrapper.jar | Bin 61574 -> 43462 bytes gradle/wrapper/gradle-wrapper.properties | 3 +- gradlew | 29 ++++++++++-------- settings.gradle | 3 +- 22 files changed, 120 insertions(+), 21 deletions(-) diff --git a/1.10.2/build.gradle b/1.10.2/build.gradle index 3b3ec11c..735609c5 100644 --- a/1.10.2/build.gradle +++ b/1.10.2/build.gradle @@ -1,3 +1,5 @@ +import net.fabricmc.loom.configuration.providers.minecraft.MinecraftJarConfiguration + plugins { id 'fabric-loom' } @@ -12,6 +14,8 @@ repositories { loom { setIntermediaryUrl('https://maven.legacyfabric.net/net/fabricmc/intermediary/%1$s/intermediary-%1$s-v2.jar') customMinecraftManifest.set("https://meta.legacyfabric.net/v2/manifest/${minecraft_version}") + + minecraftJarConfiguration = MinecraftJarConfiguration.MERGED } dependencies { diff --git a/1.11.2/build.gradle b/1.11.2/build.gradle index 3b3ec11c..735609c5 100644 --- a/1.11.2/build.gradle +++ b/1.11.2/build.gradle @@ -1,3 +1,5 @@ +import net.fabricmc.loom.configuration.providers.minecraft.MinecraftJarConfiguration + plugins { id 'fabric-loom' } @@ -12,6 +14,8 @@ repositories { loom { setIntermediaryUrl('https://maven.legacyfabric.net/net/fabricmc/intermediary/%1$s/intermediary-%1$s-v2.jar') customMinecraftManifest.set("https://meta.legacyfabric.net/v2/manifest/${minecraft_version}") + + minecraftJarConfiguration = MinecraftJarConfiguration.MERGED } dependencies { diff --git a/1.12.2/build.gradle b/1.12.2/build.gradle index 3b3ec11c..735609c5 100644 --- a/1.12.2/build.gradle +++ b/1.12.2/build.gradle @@ -1,3 +1,5 @@ +import net.fabricmc.loom.configuration.providers.minecraft.MinecraftJarConfiguration + plugins { id 'fabric-loom' } @@ -12,6 +14,8 @@ repositories { loom { setIntermediaryUrl('https://maven.legacyfabric.net/net/fabricmc/intermediary/%1$s/intermediary-%1$s-v2.jar') customMinecraftManifest.set("https://meta.legacyfabric.net/v2/manifest/${minecraft_version}") + + minecraftJarConfiguration = MinecraftJarConfiguration.MERGED } dependencies { diff --git a/1.13/build.gradle b/1.13/build.gradle index 3b3ec11c..735609c5 100644 --- a/1.13/build.gradle +++ b/1.13/build.gradle @@ -1,3 +1,5 @@ +import net.fabricmc.loom.configuration.providers.minecraft.MinecraftJarConfiguration + plugins { id 'fabric-loom' } @@ -12,6 +14,8 @@ repositories { loom { setIntermediaryUrl('https://maven.legacyfabric.net/net/fabricmc/intermediary/%1$s/intermediary-%1$s-v2.jar') customMinecraftManifest.set("https://meta.legacyfabric.net/v2/manifest/${minecraft_version}") + + minecraftJarConfiguration = MinecraftJarConfiguration.MERGED } dependencies { diff --git a/1.14/build.gradle b/1.14/build.gradle index e1e1fdc8..87f06fe3 100644 --- a/1.14/build.gradle +++ b/1.14/build.gradle @@ -1,7 +1,13 @@ +import net.fabricmc.loom.configuration.providers.minecraft.MinecraftJarConfiguration + plugins { id 'fabric-loom' } +loom { + minecraftJarConfiguration = MinecraftJarConfiguration.MERGED +} + dependencies { // To change the versions see the gradle.properties file minecraft "com.mojang:minecraft:${project.minecraft_version}" diff --git a/1.15/build.gradle b/1.15/build.gradle index 4e06f575..9dd880c9 100644 --- a/1.15/build.gradle +++ b/1.15/build.gradle @@ -1,7 +1,13 @@ +import net.fabricmc.loom.configuration.providers.minecraft.MinecraftJarConfiguration + plugins { id 'fabric-loom' } +loom { + minecraftJarConfiguration = MinecraftJarConfiguration.MERGED +} + dependencies { // To change the versions see the gradle.properties file minecraft "com.mojang:minecraft:${project.minecraft_version}" diff --git a/1.16/build.gradle b/1.16/build.gradle index 4e06f575..9dd880c9 100644 --- a/1.16/build.gradle +++ b/1.16/build.gradle @@ -1,7 +1,13 @@ +import net.fabricmc.loom.configuration.providers.minecraft.MinecraftJarConfiguration + plugins { id 'fabric-loom' } +loom { + minecraftJarConfiguration = MinecraftJarConfiguration.MERGED +} + dependencies { // To change the versions see the gradle.properties file minecraft "com.mojang:minecraft:${project.minecraft_version}" diff --git a/1.17/build.gradle b/1.17/build.gradle index 4e06f575..9dd880c9 100644 --- a/1.17/build.gradle +++ b/1.17/build.gradle @@ -1,7 +1,13 @@ +import net.fabricmc.loom.configuration.providers.minecraft.MinecraftJarConfiguration + plugins { id 'fabric-loom' } +loom { + minecraftJarConfiguration = MinecraftJarConfiguration.MERGED +} + dependencies { // To change the versions see the gradle.properties file minecraft "com.mojang:minecraft:${project.minecraft_version}" diff --git a/1.18/build.gradle b/1.18/build.gradle index 4e06f575..9dd880c9 100644 --- a/1.18/build.gradle +++ b/1.18/build.gradle @@ -1,7 +1,13 @@ +import net.fabricmc.loom.configuration.providers.minecraft.MinecraftJarConfiguration + plugins { id 'fabric-loom' } +loom { + minecraftJarConfiguration = MinecraftJarConfiguration.MERGED +} + dependencies { // To change the versions see the gradle.properties file minecraft "com.mojang:minecraft:${project.minecraft_version}" diff --git a/1.19.2/build.gradle b/1.19.2/build.gradle index 4e06f575..9dd880c9 100644 --- a/1.19.2/build.gradle +++ b/1.19.2/build.gradle @@ -1,7 +1,13 @@ +import net.fabricmc.loom.configuration.providers.minecraft.MinecraftJarConfiguration + plugins { id 'fabric-loom' } +loom { + minecraftJarConfiguration = MinecraftJarConfiguration.MERGED +} + dependencies { // To change the versions see the gradle.properties file minecraft "com.mojang:minecraft:${project.minecraft_version}" diff --git a/1.19/build.gradle b/1.19/build.gradle index 4e06f575..9dd880c9 100644 --- a/1.19/build.gradle +++ b/1.19/build.gradle @@ -1,7 +1,13 @@ +import net.fabricmc.loom.configuration.providers.minecraft.MinecraftJarConfiguration + plugins { id 'fabric-loom' } +loom { + minecraftJarConfiguration = MinecraftJarConfiguration.MERGED +} + dependencies { // To change the versions see the gradle.properties file minecraft "com.mojang:minecraft:${project.minecraft_version}" diff --git a/1.20.4/build.gradle b/1.20.4/build.gradle index 4e06f575..9dd880c9 100644 --- a/1.20.4/build.gradle +++ b/1.20.4/build.gradle @@ -1,7 +1,13 @@ +import net.fabricmc.loom.configuration.providers.minecraft.MinecraftJarConfiguration + plugins { id 'fabric-loom' } +loom { + minecraftJarConfiguration = MinecraftJarConfiguration.MERGED +} + dependencies { // To change the versions see the gradle.properties file minecraft "com.mojang:minecraft:${project.minecraft_version}" diff --git a/1.20/build.gradle b/1.20/build.gradle index 4e06f575..9dd880c9 100644 --- a/1.20/build.gradle +++ b/1.20/build.gradle @@ -1,7 +1,13 @@ +import net.fabricmc.loom.configuration.providers.minecraft.MinecraftJarConfiguration + plugins { id 'fabric-loom' } +loom { + minecraftJarConfiguration = MinecraftJarConfiguration.MERGED +} + dependencies { // To change the versions see the gradle.properties file minecraft "com.mojang:minecraft:${project.minecraft_version}" diff --git a/1.7/build.gradle b/1.7/build.gradle index 54fcdf22..2f8a84a0 100644 --- a/1.7/build.gradle +++ b/1.7/build.gradle @@ -1,3 +1,5 @@ +import net.fabricmc.loom.configuration.providers.minecraft.MinecraftJarConfiguration + plugins { id 'fabric-loom' } @@ -13,12 +15,19 @@ loom { setIntermediaryUrl('https://maven.legacyfabric.net/net/fabricmc/intermediary/%1$s/intermediary-%1$s-v2.jar') customMinecraftManifest.set("https://legacyfabric.u9g.dev/v2/manifest/${minecraft_version}") - // Required by 1.7.x - runs { - client { - programArgs "--userProperties", "{}" - } - } + splitMinecraftJar() + minecraftJarConfiguration = MinecraftJarConfiguration.MERGED + + runs { + mcData { + server() + + property("fabric.development", "false") + configName = "Generate Minecraft Data" + runDir = "run" + ideConfigGenerated = true + } + } } dependencies { diff --git a/1.8.9/build.gradle b/1.8.9/build.gradle index 3b3ec11c..735609c5 100644 --- a/1.8.9/build.gradle +++ b/1.8.9/build.gradle @@ -1,3 +1,5 @@ +import net.fabricmc.loom.configuration.providers.minecraft.MinecraftJarConfiguration + plugins { id 'fabric-loom' } @@ -12,6 +14,8 @@ repositories { loom { setIntermediaryUrl('https://maven.legacyfabric.net/net/fabricmc/intermediary/%1$s/intermediary-%1$s-v2.jar') customMinecraftManifest.set("https://meta.legacyfabric.net/v2/manifest/${minecraft_version}") + + minecraftJarConfiguration = MinecraftJarConfiguration.MERGED } dependencies { diff --git a/1.9.4/build.gradle b/1.9.4/build.gradle index 3b3ec11c..735609c5 100644 --- a/1.9.4/build.gradle +++ b/1.9.4/build.gradle @@ -1,3 +1,5 @@ +import net.fabricmc.loom.configuration.providers.minecraft.MinecraftJarConfiguration + plugins { id 'fabric-loom' } @@ -12,6 +14,8 @@ repositories { loom { setIntermediaryUrl('https://maven.legacyfabric.net/net/fabricmc/intermediary/%1$s/intermediary-%1$s-v2.jar') customMinecraftManifest.set("https://meta.legacyfabric.net/v2/manifest/${minecraft_version}") + + minecraftJarConfiguration = MinecraftJarConfiguration.MERGED } dependencies { diff --git a/22w19a/build.gradle b/22w19a/build.gradle index 4e06f575..9dd880c9 100644 --- a/22w19a/build.gradle +++ b/22w19a/build.gradle @@ -1,7 +1,13 @@ +import net.fabricmc.loom.configuration.providers.minecraft.MinecraftJarConfiguration + plugins { id 'fabric-loom' } +loom { + minecraftJarConfiguration = MinecraftJarConfiguration.MERGED +} + dependencies { // To change the versions see the gradle.properties file minecraft "com.mojang:minecraft:${project.minecraft_version}" diff --git a/common/src/main/java/dev/u9g/minecraftdatagenerator/generators/DataGenerators.java b/common/src/main/java/dev/u9g/minecraftdatagenerator/generators/DataGenerators.java index bd193b40..0efd8726 100644 --- a/common/src/main/java/dev/u9g/minecraftdatagenerator/generators/DataGenerators.java +++ b/common/src/main/java/dev/u9g/minecraftdatagenerator/generators/DataGenerators.java @@ -22,7 +22,6 @@ public class DataGenerators { private static final Logger logger = MinecraftDataGenerator.LOGGER; static { - System.out.println(DataGenerators.class.getClassLoader()); List> generators; try (ScanResult scanResult = new ClassGraph() .acceptPackages("dev.u9g.minecraftdatagenerator.generators") diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 943f0cbfa754578e88a3dae77fce6e3dea56edbf..d64cd4917707c1f8861d8cb53dd15194d4248596 100644 GIT binary patch literal 43462 zcma&NWl&^owk(X(xVyW%ySuwf;qI=D6|RlDJ2cR^yEKh!@I- zp9QeisK*rlxC>+~7Dk4IxIRsKBHqdR9b3+fyL=ynHmIDe&|>O*VlvO+%z5;9Z$|DJ zb4dO}-R=MKr^6EKJiOrJdLnCJn>np?~vU-1sSFgPu;pthGwf}bG z(1db%xwr#x)r+`4AGu$j7~u2MpVs3VpLp|mx&;>`0p0vH6kF+D2CY0fVdQOZ@h;A` z{infNyvmFUiu*XG}RNMNwXrbec_*a3N=2zJ|Wh5z* z5rAX$JJR{#zP>KY**>xHTuw?|-Rg|o24V)74HcfVT;WtQHXlE+_4iPE8QE#DUm%x0 zEKr75ur~W%w#-My3Tj`hH6EuEW+8K-^5P62$7Sc5OK+22qj&Pd1;)1#4tKihi=~8C zHiQSst0cpri6%OeaR`PY>HH_;CPaRNty%WTm4{wDK8V6gCZlG@U3$~JQZ;HPvDJcT1V{ z?>H@13MJcCNe#5z+MecYNi@VT5|&UiN1D4ATT+%M+h4c$t;C#UAs3O_q=GxK0}8%8 z8J(_M9bayxN}69ex4dzM_P3oh@ZGREjVvn%%r7=xjkqxJP4kj}5tlf;QosR=%4L5y zWhgejO=vao5oX%mOHbhJ8V+SG&K5dABn6!WiKl{|oPkq(9z8l&Mm%(=qGcFzI=eLu zWc_oCLyf;hVlB@dnwY98?75B20=n$>u3b|NB28H0u-6Rpl((%KWEBOf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~fQRWy_ zfA!U9^bUL+z_$VJI=ic;{epla<&J@W-QMPZm^kTQ8a^2TX^TDpza*^tOu!WZ=T!PT z+0lJ*HuRnNGobNk0PbPT?i;^h{&0u+-fejISNv#9&j~Ep2;dYspntgzwR6<$@0dTQ z!qLe3Ztc=Ozy!btCcx!G$U7FlBRe}-L(E|RpH%_gt4m_LJllX3!iRYJEPvxcJ>C76 zfBy0_zKaYn{3yG6@;}S&+BeJk5X}$Kchp<Ea-=>VDg&zi*8xM0-ya!{ zcDN@>%H#vMwugU&1KN9pqA6-?Q8N@Dz?VlJ3IDfz#i#_RxgQS*>K+|Q@bek+s7#Qk z(5NZ-4xs&$j)X=@(1(hLn)vPj&pP>Nyu)emQ1MW6)g0hqXa5oJ_slh@(5MMS4xnG= z{0aK#F@_p=e}FdAa3tEl!|+j?h8h`t0CvCmNU%dOwEq<+jmm-=n|r|G^7QX4N4o(v zPU!%%w(Cet)Zev3QA?;TMm_aEK!5(~Nc6pJlp|sQP@z%JI}f0_`u+rc`1Df^j0G&s ScNgau(U?ep-K_E5zy1%ZQTdPn diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 3499ded5..b82aa23a 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 65dcd68d..1aa94a42 100755 --- a/gradlew +++ b/gradlew @@ -83,10 +83,8 @@ done # This is normally unused # shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -133,10 +131,13 @@ location of your Java installation." fi else JAVACMD=java - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." + fi fi # Increase the maximum file descriptors if we can. @@ -144,7 +145,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC2039,SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac @@ -152,7 +153,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then '' | soft) :;; #( *) # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC2039,SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -197,11 +198,15 @@ if "$cygwin" || "$msys" ; then done fi -# Collect all arguments for the java command; -# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of -# shell script including quotes and variable substitutions, so put them in -# double quotes to make sure that they get re-expanded; and -# * put everything else in single quotes, so that it's not re-expanded. + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ diff --git a/settings.gradle b/settings.gradle index c1a1a775..6b61a764 100644 --- a/settings.gradle +++ b/settings.gradle @@ -4,10 +4,11 @@ pluginManagement { name = 'Fabric' url = 'https://maven.fabricmc.net/' } + mavenCentral() gradlePluginPortal() } plugins { - id 'fabric-loom' version "1.4.5" + id 'fabric-loom' version "1.6-SNAPSHOT" } } From 8cd3e06ca1100157ae16272ab84c2b1f4ca027d3 Mon Sep 17 00:00:00 2001 From: AlexProgrammerDE <40795980+AlexProgrammerDE@users.noreply.github.com> Date: Wed, 1 May 2024 17:16:35 +0200 Subject: [PATCH 17/38] Implement new client and server merged environment for running fabric --- 1.10.2/build.gradle | 65 ++- 1.10.2/gradle.properties | 6 - .../clientsideannoyances/BiomeColors.java | 47 -- .../clientsideannoyances/BlockColorable.java | 10 - .../clientsideannoyances/BlockColors.java | 96 ---- .../clientsideannoyances/FoliageColors.java | 37 -- .../clientsideannoyances/GrassColors.java | 29 -- .../ServerSideRedstoneWireBlock.java | 28 -- .../generators/InstrumentsDataGenerator.java | 4 +- .../generators/SoundsDataGenerator.java | 9 +- .../generators/TintsDataGenerator.java | 25 +- .../mixin/NoteBlockAccessor.java | 4 +- .../mixin/SoundAccessor.java | 4 +- 1.10.2/src/main/resources/fabric.mod.json | 1 - .../minecraft-data-generator.mixins.json | 2 - 1.11.2/build.gradle | 65 ++- 1.11.2/gradle.properties | 6 - .../clientsideannoyances/BiomeColors.java | 55 --- .../clientsideannoyances/BlockColorable.java | 10 - .../clientsideannoyances/BlockColors.java | 95 ---- .../clientsideannoyances/FoliageColors.java | 28 -- .../clientsideannoyances/GrassColors.java | 19 - .../ServerSideRedstoneWireBlock.java | 28 -- .../clientsideannoyances/SkyColor.java | 74 ---- .../generators/BiomesDataGenerator.java | 4 +- .../generators/InstrumentsDataGenerator.java | 4 +- .../generators/SoundsDataGenerator.java | 9 +- .../generators/TintsDataGenerator.java | 30 +- .../mixin/NoteBlockAccessor.java | 4 +- .../mixin/SoundAccessor.java | 4 +- 1.11.2/src/main/resources/fabric.mod.json | 1 - .../minecraft-data-generator.mixins.json | 2 - 1.12.2/build.gradle | 65 ++- 1.12.2/gradle.properties | 6 - .../clientsideannoyances/BiomeColors.java | 46 -- .../clientsideannoyances/BlockColorable.java | 10 - .../clientsideannoyances/BlockColors.java | 98 ----- .../clientsideannoyances/FoliageColors.java | 36 -- .../clientsideannoyances/GrassColors.java | 29 -- .../ServerSideRedstoneWireBlock.java | 25 -- .../generators/InstrumentsDataGenerator.java | 4 +- .../generators/SoundsDataGenerator.java | 9 +- .../generators/TintsDataGenerator.java | 23 +- .../mixin/NoteBlockAccessor.java | 4 +- .../mixin/SoundAccessor.java | 4 +- 1.12.2/src/main/resources/fabric.mod.json | 1 - .../minecraft-data-generator.mixins.json | 2 - 1.13/build.gradle | 65 ++- 1.13/gradle.properties | 7 - .../clientsideannoyances/BiomeColors.java | 49 --- .../clientsideannoyances/BlockColorable.java | 10 - .../clientsideannoyances/BlockColors.java | 65 --- .../clientsideannoyances/FoliageColors.java | 36 -- .../clientsideannoyances/GrassColors.java | 29 -- .../ServerSideRedstoneWireBlock.java | 25 -- .../generators/SoundsDataGenerator.java | 9 +- .../generators/TintsDataGenerator.java | 17 +- .../mixin/SoundAccessor.java | 4 +- 1.13/src/main/resources/fabric.mod.json | 1 - .../minecraft-data-generator.mixins.json | 2 - 1.14/build.gradle | 47 +- 1.14/gradle.properties | 7 - .../clientsideannoyances/FoliageColors.java | 36 -- .../clientsideannoyances/GrassColors.java | 29 -- .../ServerSideRedstoneWireBlock.java | 25 -- .../generators/SoundsDataGenerator.java | 7 +- .../mixin/ReadyMixin.java | 1 + .../mixin/SoundAccessor.java | 5 +- 1.14/src/main/resources/fabric.mod.json | 2 - 1.15/build.gradle | 47 +- 1.15/gradle.properties | 7 - .../generators/SoundsDataGenerator.java | 9 +- .../mixin/SoundAccessor.java | 5 +- 1.15/src/main/resources/fabric.mod.json | 2 - 1.16/build.gradle | 47 +- 1.16/gradle.properties | 8 - .../generators/SoundsDataGenerator.java | 9 +- .../mixin/SoundAccessor.java | 5 +- 1.16/src/main/resources/fabric.mod.json | 2 - 1.17/build.gradle | 47 +- 1.17/gradle.properties | 7 - .../generators/SoundsDataGenerator.java | 9 +- .../mixin/SoundAccessor.java | 5 +- 1.17/src/main/resources/fabric.mod.json | 2 - 1.18/build.gradle | 47 +- 1.18/gradle.properties | 7 - .../generators/SoundsDataGenerator.java | 9 +- .../mixin/SoundAccessor.java | 5 +- 1.18/src/main/resources/fabric.mod.json | 2 - 1.19.2/build.gradle | 47 +- 1.19.2/gradle.properties | 7 - .../generators/BiomesDataGenerator.java | 227 +--------- .../generators/SoundsDataGenerator.java | 9 +- .../mixin/TheEndBiomeDataAccessor.java | 29 -- 1.19.2/src/main/resources/fabric.mod.json | 2 - .../minecraft-data-generator.mixins.json | 3 +- 1.19/build.gradle | 47 +- 1.19/gradle.properties | 7 - .../generators/BiomesDataGenerator.java | 240 +--------- .../generators/SoundsDataGenerator.java | 10 +- .../mixin/TheEndBiomeDataAccessor.java | 29 -- 1.19/src/main/resources/fabric.mod.json | 2 - .../minecraft-data-generator.mixins.json | 3 +- 1.20.4/build.gradle | 47 +- 1.20.4/gradle.properties | 7 - .../generators/BiomesDataGenerator.java | 224 +--------- .../mixin/TheEndBiomeDataAccessor.java | 29 -- 1.20.4/src/main/resources/fabric.mod.json | 2 - .../minecraft-data-generator.mixins.json | 3 +- 1.20/build.gradle | 47 +- 1.20/gradle.properties | 7 - .../generators/BiomesDataGenerator.java | 224 +--------- .../generators/RecipeDataGenerator.java | 15 +- .../generators/SoundsDataGenerator.java | 9 +- .../mixin/TheEndBiomeDataAccessor.java | 29 -- 1.20/src/main/resources/fabric.mod.json | 2 - .../minecraft-data-generator.mixins.json | 3 +- 1.7/build.gradle | 75 +--- 1.7/gradle.properties | 6 - .../BiomeBlockColors.java | 80 ---- .../clientsideannoyances/FoliageColors.java | 38 -- .../clientsideannoyances/GrassColors.java | 27 -- .../ServerSideRedstoneWireBlock.java | 28 -- .../generators/BlocksDataGenerator.java | 4 +- .../generators/EntitiesDataGenerator.java | 2 +- .../generators/InstrumentsDataGenerator.java | 2 +- .../generators/TintsDataGenerator.java | 24 +- .../mixin/ReadyMixin.java | 2 + .../mixin/overwrite/ItemEntityOverwrite.java | 4 +- .../util/EmptyBlockView.java | 61 --- 1.7/src/main/resources/fabric.mod.json | 1 - .../minecraft-data-generator.mixins.json | 2 - 1.8.9/build.gradle | 65 ++- 1.8.9/gradle.properties | 6 - .../BiomeBlockColors.java | 81 ---- .../clientsideannoyances/BiomeColors.java | 46 -- .../clientsideannoyances/FoliageColors.java | 38 -- .../clientsideannoyances/GrassColors.java | 29 -- .../ServerSideRedstoneWireBlock.java | 28 -- .../generators/BiomesDataGenerator.java | 88 +--- .../generators/TintsDataGenerator.java | 39 +- .../mixin/overwrite/CocoaBlockOverwrite.java | 43 -- .../EndPortalFrameBlockOverwrite.java | 34 -- .../mixin/overwrite/ItemEntityOverwrite.java | 24 - .../SkeletonSkullBlockOverwrite.java | 28 -- .../mixin/overwrite/StairBlockOverwrite.java | 153 ------- 1.8.9/src/main/resources/fabric.mod.json | 1 - .../minecraft-data-generator.mixins.json | 9 +- 1.9.4/build.gradle | 65 ++- 1.9.4/gradle.properties | 6 - .../clientsideannoyances/BiomeColors.java | 47 -- .../clientsideannoyances/BlockColorable.java | 10 - .../clientsideannoyances/BlockColors.java | 96 ---- .../clientsideannoyances/FoliageColors.java | 37 -- .../clientsideannoyances/GrassColors.java | 29 -- .../ServerSideRedstoneWireBlock.java | 28 -- .../generators/InstrumentsDataGenerator.java | 4 +- .../generators/SoundsDataGenerator.java | 9 +- .../generators/TintsDataGenerator.java | 25 +- .../mixin/NoteBlockAccessor.java | 4 +- .../mixin/SoundAccessor.java | 4 +- 1.9.4/src/main/resources/fabric.mod.json | 1 - .../minecraft-data-generator.mixins.json | 2 - 22w19a/build.gradle | 47 +- 22w19a/gradle.properties | 7 - .../generators/BiomesDataGenerator.java | 28 +- .../generators/SoundsDataGenerator.java | 9 +- .../mixin/TheEndBiomeDataAccessor.java | 28 -- 22w19a/src/main/resources/fabric.mod.json | 2 - .../minecraft-data-generator.mixins.json | 3 +- buildSrc/build.gradle.kts | 56 +++ .../CustomFabricLikeMinecraftTransformer.kt | 415 ++++++++++++++++++ .../CustomFabricMinecraftTransformer.kt | 85 ++++ .../CustomLegacyFabricMinecraftTransformer.kt | 39 ++ ...ustomOfficialFabricMinecraftTransformer.kt | 34 ++ settings.gradle | 25 +- 176 files changed, 1379 insertions(+), 4070 deletions(-) delete mode 100644 1.10.2/gradle.properties delete mode 100644 1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/BiomeColors.java delete mode 100644 1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/BlockColorable.java delete mode 100644 1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/BlockColors.java delete mode 100644 1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/FoliageColors.java delete mode 100644 1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/GrassColors.java delete mode 100644 1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/ServerSideRedstoneWireBlock.java delete mode 100644 1.11.2/gradle.properties delete mode 100644 1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/BiomeColors.java delete mode 100644 1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/BlockColorable.java delete mode 100644 1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/BlockColors.java delete mode 100644 1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/FoliageColors.java delete mode 100644 1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/GrassColors.java delete mode 100644 1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/ServerSideRedstoneWireBlock.java delete mode 100644 1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/SkyColor.java delete mode 100644 1.12.2/gradle.properties delete mode 100644 1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/BiomeColors.java delete mode 100644 1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/BlockColorable.java delete mode 100644 1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/BlockColors.java delete mode 100644 1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/FoliageColors.java delete mode 100644 1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/GrassColors.java delete mode 100644 1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/ServerSideRedstoneWireBlock.java delete mode 100644 1.13/gradle.properties delete mode 100644 1.13/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/BiomeColors.java delete mode 100644 1.13/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/BlockColorable.java delete mode 100644 1.13/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/BlockColors.java delete mode 100644 1.13/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/FoliageColors.java delete mode 100644 1.13/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/GrassColors.java delete mode 100644 1.13/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/ServerSideRedstoneWireBlock.java delete mode 100644 1.14/gradle.properties delete mode 100644 1.14/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/FoliageColors.java delete mode 100644 1.14/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/GrassColors.java delete mode 100644 1.14/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/ServerSideRedstoneWireBlock.java delete mode 100644 1.15/gradle.properties delete mode 100644 1.16/gradle.properties delete mode 100644 1.17/gradle.properties delete mode 100644 1.18/gradle.properties delete mode 100644 1.19.2/gradle.properties delete mode 100644 1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/mixin/TheEndBiomeDataAccessor.java delete mode 100644 1.19/gradle.properties delete mode 100644 1.19/src/main/java/dev/u9g/minecraftdatagenerator/mixin/TheEndBiomeDataAccessor.java delete mode 100644 1.20.4/gradle.properties delete mode 100644 1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/mixin/TheEndBiomeDataAccessor.java delete mode 100644 1.20/gradle.properties delete mode 100644 1.20/src/main/java/dev/u9g/minecraftdatagenerator/mixin/TheEndBiomeDataAccessor.java delete mode 100644 1.7/gradle.properties delete mode 100644 1.7/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/BiomeBlockColors.java delete mode 100644 1.7/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/FoliageColors.java delete mode 100644 1.7/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/GrassColors.java delete mode 100644 1.7/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/ServerSideRedstoneWireBlock.java delete mode 100644 1.7/src/main/java/dev/u9g/minecraftdatagenerator/util/EmptyBlockView.java delete mode 100644 1.8.9/gradle.properties delete mode 100644 1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/BiomeBlockColors.java delete mode 100644 1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/BiomeColors.java delete mode 100644 1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/FoliageColors.java delete mode 100644 1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/GrassColors.java delete mode 100644 1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/ServerSideRedstoneWireBlock.java delete mode 100644 1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/mixin/overwrite/CocoaBlockOverwrite.java delete mode 100644 1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/mixin/overwrite/EndPortalFrameBlockOverwrite.java delete mode 100644 1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/mixin/overwrite/ItemEntityOverwrite.java delete mode 100644 1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/mixin/overwrite/SkeletonSkullBlockOverwrite.java delete mode 100644 1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/mixin/overwrite/StairBlockOverwrite.java delete mode 100644 1.9.4/gradle.properties delete mode 100644 1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/BiomeColors.java delete mode 100644 1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/BlockColorable.java delete mode 100644 1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/BlockColors.java delete mode 100644 1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/FoliageColors.java delete mode 100644 1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/GrassColors.java delete mode 100644 1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/ServerSideRedstoneWireBlock.java delete mode 100644 22w19a/gradle.properties delete mode 100644 22w19a/src/main/java/dev/u9g/minecraftdatagenerator/mixin/TheEndBiomeDataAccessor.java create mode 100644 buildSrc/build.gradle.kts create mode 100644 buildSrc/src/main/kotlin/CustomFabricLikeMinecraftTransformer.kt create mode 100644 buildSrc/src/main/kotlin/CustomFabricMinecraftTransformer.kt create mode 100644 buildSrc/src/main/kotlin/CustomLegacyFabricMinecraftTransformer.kt create mode 100644 buildSrc/src/main/kotlin/CustomOfficialFabricMinecraftTransformer.kt diff --git a/1.10.2/build.gradle b/1.10.2/build.gradle index 735609c5..84c2eadf 100644 --- a/1.10.2/build.gradle +++ b/1.10.2/build.gradle @@ -1,53 +1,44 @@ -import net.fabricmc.loom.configuration.providers.minecraft.MinecraftJarConfiguration +import xyz.wagyourtail.unimined.internal.minecraft.MinecraftProvider plugins { - id 'fabric-loom' + id 'xyz.wagyourtail.unimined' } repositories { maven { - name = "legacy-fabric" - url = "https://maven.legacyfabric.net" + name = "wagyourtail releases" + url = "https://maven.wagyourtail.xyz/releases" } + maven { + name = "legacyfabric" + url "https://maven.legacyfabric.net/" + } + mavenCentral() } -loom { - setIntermediaryUrl('https://maven.legacyfabric.net/net/fabricmc/intermediary/%1$s/intermediary-%1$s-v2.jar') - customMinecraftManifest.set("https://meta.legacyfabric.net/v2/manifest/${minecraft_version}") +unimined.minecraft { + version "1.10.2" - minecraftJarConfiguration = MinecraftJarConfiguration.MERGED -} + mappings { + legacyIntermediary() + legacyYarn(541) -dependencies { - minecraft "com.mojang:minecraft:${project.minecraft_version}" - mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" - modImplementation libs.fabric.loader - - // Fabric API provides hooks for events, item registration, and more. As most mods will need this, it's included by default. - // If you know for a fact you don't, it's not required and can be safely removed. -// modImplementation ("net.legacyfabric.legacy-fabric-api:legacy-fabric-api:${fabric_version}") { -// exclude module: "legacy-fabric-entity-events-v1" -// } + devFallbackNamespace "intermediary" + } - implementation(project(":common")) + runs.config("server") { + javaVersion = JavaVersion.VERSION_21 + } - if (System.getProperty("os.name").toLowerCase().contains("mac")) { - implementation 'org.lwjgl.lwjgl:lwjgl_util:2.9.4-nightly-20150209' - implementation 'org.lwjgl.lwjgl:lwjgl:2.9.4-nightly-20150209' - implementation 'org.lwjgl.lwjgl:lwjgl-platform:2.9.4-nightly-20150209' + customPatcher(new CustomLegacyFabricMinecraftTransformer(project, delegate as MinecraftProvider)) { + it.loader libs.versions.fabric.loader.get() } + + defaultRemapJar = true } -if (System.getProperty("os.name").toLowerCase().contains("mac")) { - configurations.configureEach { - resolutionStrategy { - dependencySubstitution { - substitute module('org.lwjgl.lwjgl:lwjgl_util:2.9.2-nightly-201408222') with module('org.lwjgl.lwjgl:lwjgl_util:2.9.4-nightly-20150209') - substitute module('org.lwjgl.lwjgl:lwjgl:2.9.2-nightly-201408222') with module('org.lwjgl.lwjgl:lwjgl:2.9.4-nightly-20150209') - } - force 'org.lwjgl.lwjgl:lwjgl-platform:2.9.4-nightly-20150209' - } - } +dependencies { + implementation project(":common") } processResources { @@ -61,9 +52,3 @@ processResources { tasks.withType(JavaCompile).configureEach { it.options.encoding = "UTF-8" } - -java { - toolchain { - languageVersion.set(JavaLanguageVersion.of(17)) - } -} diff --git a/1.10.2/gradle.properties b/1.10.2/gradle.properties deleted file mode 100644 index 4d32d4dd..00000000 --- a/1.10.2/gradle.properties +++ /dev/null @@ -1,6 +0,0 @@ -# Fabric Properties -# More versions available at: https://grayray75.github.io/LegacyFabric-Versions/ -minecraft_version=1.10.2 -yarn_mappings=1.10.2+build.202206020145 -# Dependencies -# More versions available at: https://grayray75.github.io/LegacyFabric-Versions/ diff --git a/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/BiomeColors.java b/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/BiomeColors.java deleted file mode 100644 index f42641fb..00000000 --- a/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/BiomeColors.java +++ /dev/null @@ -1,47 +0,0 @@ -package dev.u9g.minecraftdatagenerator.clientsideannoyances; - -import dev.u9g.minecraftdatagenerator.util.EmptyBlockView; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.biome.Biome; - -import java.util.Iterator; - -public class BiomeColors { - private static final ColorProvider GRASS_COLOR = Biome::getGrassColor; - private static final ColorProvider FOLIAGE_COLOR = Biome::getFoliageColor; - private static final ColorProvider WATER_COLOR = (biome, pos) -> biome.getWaterColor(); - - private static int getColor(EmptyBlockView view, BlockPos pos, ColorProvider provider) { - int i = 0; - int j = 0; - int k = 0; - - int l; - for (Iterator iterator = BlockPos.mutableIterate(pos.add(-1, 0, -1), pos.add(1, 0, 1)).iterator(); iterator.hasNext(); k += l & 255) { - BlockPos.Mutable mutable = (BlockPos.Mutable) iterator.next(); - l = provider.getColorAtPos(view.getBiome(mutable), mutable); - i += (l & 16711680) >> 16; - j += (l & '\uff00') >> 8; - } - - return (i / 9 & 255) << 16 | (j / 9 & 255) << 8 | k / 9 & 255; - } - - public static int getGrassColor(EmptyBlockView view, BlockPos pos) { - return getColor(view, pos, GRASS_COLOR); - } - - public static int getFoliageColor(EmptyBlockView view, BlockPos pos) { - return getColor(view, pos, FOLIAGE_COLOR); - } - - public static int getWaterColor(EmptyBlockView view, BlockPos pos) { - return getColor(view, pos, WATER_COLOR); - } - - interface ColorProvider { - int getColorAtPos(Biome biome, BlockPos pos); - } -} - - diff --git a/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/BlockColorable.java b/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/BlockColorable.java deleted file mode 100644 index b6819227..00000000 --- a/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/BlockColorable.java +++ /dev/null @@ -1,10 +0,0 @@ -package dev.u9g.minecraftdatagenerator.clientsideannoyances; - -import dev.u9g.minecraftdatagenerator.util.EmptyBlockView; -import net.minecraft.block.BlockState; -import net.minecraft.util.math.BlockPos; -import org.jetbrains.annotations.Nullable; - -public interface BlockColorable { - int method_12155(BlockState blockState, @Nullable EmptyBlockView blockView, @Nullable BlockPos blockPos, int i); -} diff --git a/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/BlockColors.java b/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/BlockColors.java deleted file mode 100644 index 2bd090ca..00000000 --- a/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/BlockColors.java +++ /dev/null @@ -1,96 +0,0 @@ -package dev.u9g.minecraftdatagenerator.clientsideannoyances; - -import dev.u9g.minecraftdatagenerator.util.EmptyBlockView; -import net.minecraft.block.*; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.block.entity.FlowerPotBlockEntity; -import net.minecraft.item.BlockItem; -import net.minecraft.item.Item; -import net.minecraft.util.collection.IdList; -import net.minecraft.util.math.BlockPos; -import org.jetbrains.annotations.Nullable; - -public class BlockColors { - private final IdList BlockColor2Id = new IdList<>(32); - - public BlockColors() { - } - - public static BlockColors create() { - final BlockColors blockColors = new BlockColors(); - blockColors.method_12158((blockState, blockView, blockPos, i) -> { - DoublePlantBlock.DoublePlantType doublePlantType = blockState.get(DoublePlantBlock.VARIANT); - return blockView == null || blockPos == null || doublePlantType != DoublePlantBlock.DoublePlantType.GRASS && doublePlantType != DoublePlantBlock.DoublePlantType.FERN ? -1 : BiomeColors.getGrassColor(blockView, blockPos); - }, Blocks.DOUBLE_PLANT); - blockColors.method_12158((blockState, blockView, blockPos, i) -> { - if (blockView != null && blockPos != null) { - BlockEntity blockEntity = blockView.getBlockEntity(blockPos); - if (blockEntity instanceof FlowerPotBlockEntity) { - Item item = ((FlowerPotBlockEntity) blockEntity).getItem(); - if (item instanceof BlockItem) { - BlockState blockState2 = Block.getBlockFromItem(item).getDefaultState(); - return blockColors.method_12157(blockState2, blockView, blockPos, i); - } - } - } - - return -1; - }, Blocks.FLOWER_POT); - blockColors.method_12158((blockState, blockView, blockPos, i) -> blockView != null && blockPos != null ? BiomeColors.getGrassColor(blockView, blockPos) : GrassColors.getColor(0.5D, 1.0D), Blocks.GRASS); - blockColors.method_12158((blockState, blockView, blockPos, i) -> { - PlanksBlock.WoodType woodType = blockState.get(Leaves1Block.VARIANT); - if (woodType == PlanksBlock.WoodType.SPRUCE) { - return FoliageColors.getSpruceColor(); - } else if (woodType == PlanksBlock.WoodType.BIRCH) { - return FoliageColors.getBirchColor(); - } else { - return blockView != null && blockPos != null ? BiomeColors.getFoliageColor(blockView, blockPos) : FoliageColors.getDefaultColor(); - } - }, Blocks.LEAVES); - blockColors.method_12158((blockState, blockView, blockPos, i) -> blockView != null && blockPos != null ? BiomeColors.getFoliageColor(blockView, blockPos) : FoliageColors.getDefaultColor(), Blocks.LEAVES2); - blockColors.method_12158((blockState, blockView, blockPos, i) -> blockView != null && blockPos != null ? BiomeColors.getWaterColor(blockView, blockPos) : -1, Blocks.WATER, Blocks.FLOWING_WATER); - blockColors.method_12158((blockState, blockView, blockPos, i) -> RedstoneWireBlock.method_8877(blockState.get(RedstoneWireBlock.POWER)), Blocks.REDSTONE_WIRE); - blockColors.method_12158((blockState, blockView, blockPos, i) -> blockView != null && blockPos != null ? BiomeColors.getGrassColor(blockView, blockPos) : -1, Blocks.SUGARCANE); - blockColors.method_12158((blockState, blockView, blockPos, i) -> { - int j = blockState.get(AttachedStemBlock.AGE); - int k = j * 32; - int l = 255 - j * 8; - int m = j * 4; - return k << 16 | l << 8 | m; - }, Blocks.MELON_STEM, Blocks.PUMPKIN_STEM); - blockColors.method_12158((blockState, blockView, blockPos, i) -> { - if (blockView != null && blockPos != null) { - return BiomeColors.getGrassColor(blockView, blockPos); - } else { - return blockState.get(TallPlantBlock.TYPE) == TallPlantBlock.GrassType.DEAD_BUSH ? 16777215 : GrassColors.getColor(0.5D, 1.0D); - } - }, Blocks.TALLGRASS); - blockColors.method_12158((blockState, blockView, blockPos, i) -> blockView != null && blockPos != null ? BiomeColors.getFoliageColor(blockView, blockPos) : FoliageColors.getDefaultColor(), Blocks.VINE); - blockColors.method_12158((blockState, blockView, blockPos, i) -> blockView != null && blockPos != null ? 2129968 : 7455580, Blocks.LILY_PAD); - return blockColors; - } - - public int method_13410(BlockState blockState) { - BlockColorable blockColorable = this.BlockColor2Id.fromId(Block.getIdByBlock(blockState.getBlock())); - if (blockColorable != null) { - return blockColorable.method_12155(blockState, null, null, 0); - } else { - MaterialColor materialColor = blockState.getMaterialColor(); - return materialColor != null ? materialColor.color : -1; - } - } - - public int method_12157(BlockState blockState, @Nullable EmptyBlockView blockView, @Nullable BlockPos blockPos, int i) { - BlockColorable blockColorable = this.BlockColor2Id.fromId(Block.getIdByBlock(blockState.getBlock())); - return blockColorable == null ? -1 : blockColorable.method_12155(blockState, blockView, blockPos, i); - } - - public void method_12158(BlockColorable blockColorable, Block... blocks) { - int i = blocks.length; - - for (Block block : blocks) { - this.BlockColor2Id.set(blockColorable, Block.getIdByBlock(block)); - } - - } -} diff --git a/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/FoliageColors.java b/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/FoliageColors.java deleted file mode 100644 index b63e543b..00000000 --- a/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/FoliageColors.java +++ /dev/null @@ -1,37 +0,0 @@ -package dev.u9g.minecraftdatagenerator.clientsideannoyances; - -import net.minecraft.util.math.MathHelper; -import net.minecraft.world.biome.Biome; - -public class FoliageColors { - private static int[] colorMap = new int[65536]; - - public static void setColorMap(int[] pixels) { - colorMap = pixels; - } - - public static int getColor(double temperature, double humidity) { - humidity *= temperature; - int i = (int) ((1.0D - temperature) * 255.0D); - int j = (int) ((1.0D - humidity) * 255.0D); - return colorMap[j << 8 | i]; - } - - public static int getSpruceColor() { - return 6396257; - } - - public static int getBirchColor() { - return 8431445; - } - - public static int getDefaultColor() { - return 4764952; - } - - public static int getFoliageColor(Biome biome) { - double d = MathHelper.clamp(biome.getTemperature(), 0.0F, 1.0F); - double e = MathHelper.clamp(biome.getRainfall(), 0.0F, 1.0F); - return FoliageColors.getColor(d, e); - } -} diff --git a/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/GrassColors.java b/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/GrassColors.java deleted file mode 100644 index afee2b70..00000000 --- a/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/GrassColors.java +++ /dev/null @@ -1,29 +0,0 @@ -package dev.u9g.minecraftdatagenerator.clientsideannoyances; - -import net.minecraft.util.math.MathHelper; -import net.minecraft.world.biome.Biome; - -public class GrassColors { - private static int[] colorMap = new int[65536]; - - public static void setColorMap(int[] map) { - colorMap = map; - } - - public static int getColor(double temperature, double humidity) { - humidity *= temperature; - int i = (int) ((1.0D - temperature) * 255.0D); - int j = (int) ((1.0D - humidity) * 255.0D); - int k = j << 8 | i; - return k > colorMap.length ? -65281 : colorMap[k]; - } - - public static int getGrassColor(Biome biome) { - double d = MathHelper.clamp(biome.getTemperature(), 0.0F, 1.0F); - double e = MathHelper.clamp(biome.getRainfall(), 0.0F, 1.0F); - return GrassColors.getColor(d, e); - } -} - - - diff --git a/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/ServerSideRedstoneWireBlock.java b/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/ServerSideRedstoneWireBlock.java deleted file mode 100644 index 75c9f89c..00000000 --- a/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/ServerSideRedstoneWireBlock.java +++ /dev/null @@ -1,28 +0,0 @@ -package dev.u9g.minecraftdatagenerator.clientsideannoyances; - -import net.minecraft.util.math.MathHelper; - -public class ServerSideRedstoneWireBlock { - public static int getWireColor(int powerLevel) { - float f = (float) powerLevel / 15.0F; - float g = f * 0.6F + 0.4F; - if (powerLevel == 0) { - g = 0.3F; - } - - float h = f * f * 0.7F - 0.5F; - float j = f * f * 0.6F - 0.7F; - if (h < 0.0F) { - h = 0.0F; - } - - if (j < 0.0F) { - j = 0.0F; - } - - int k = MathHelper.clamp((int) (g * 255.0F), 0, 255); - int l = MathHelper.clamp((int) (h * 255.0F), 0, 255); - int m = MathHelper.clamp((int) (j * 255.0F), 0, 255); - return -16777216 | k << 16 | l << 8 | m; - } -} diff --git a/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/InstrumentsDataGenerator.java b/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/InstrumentsDataGenerator.java index 3aa51c41..dc0692d8 100644 --- a/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/InstrumentsDataGenerator.java +++ b/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/InstrumentsDataGenerator.java @@ -5,7 +5,7 @@ import com.google.gson.JsonObject; import dev.u9g.minecraftdatagenerator.mixin.NoteBlockAccessor; import dev.u9g.minecraftdatagenerator.mixin.SoundAccessor; -import net.minecraft.client.sound.SoundEvent; +import net.minecraft.sound.Sound; import java.util.Objects; @@ -19,7 +19,7 @@ public String getDataName() { public JsonElement generateDataJson() { JsonArray array = new JsonArray(); int i = 0; - for (SoundEvent sound : Objects.requireNonNull(NoteBlockAccessor.TUNES())) { + for (Sound sound : Objects.requireNonNull(NoteBlockAccessor.TUNES())) { JsonObject object = new JsonObject(); object.addProperty("id", i++); object.addProperty("name", ((SoundAccessor) sound).id().getPath().split("\\.")[2]); diff --git a/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java b/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java index 9429a29a..471d668b 100644 --- a/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java +++ b/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java @@ -3,15 +3,14 @@ import com.google.gson.JsonArray; import com.google.gson.JsonObject; import dev.u9g.minecraftdatagenerator.mixin.SoundAccessor; -import net.minecraft.client.sound.SoundEvent; - +import net.minecraft.sound.Sound; public class SoundsDataGenerator implements IDataGenerator { - public static JsonObject generateSound(SoundEvent soundEvent) { + public static JsonObject generateSound(Sound soundEvent) { JsonObject soundDesc = new JsonObject(); - soundDesc.addProperty("id", SoundEvent.REGISTRY.getRawId(soundEvent)); + soundDesc.addProperty("id", Sound.REGISTRY.getRawId(soundEvent)); soundDesc.addProperty("name", ((SoundAccessor) soundEvent).id().getPath()); return soundDesc; @@ -25,7 +24,7 @@ public String getDataName() { @Override public JsonArray generateDataJson() { JsonArray resultsArray = new JsonArray(); - SoundEvent.REGISTRY.forEach(sound -> resultsArray.add(generateSound(sound))); + Sound.REGISTRY.forEach(sound -> resultsArray.add(generateSound(sound))); return resultsArray; } } diff --git a/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java b/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java index fb21b763..76cb62c6 100644 --- a/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java +++ b/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java @@ -3,32 +3,30 @@ import com.google.gson.JsonArray; import com.google.gson.JsonObject; import com.google.gson.JsonPrimitive; -import dev.u9g.minecraftdatagenerator.clientsideannoyances.BlockColors; -import dev.u9g.minecraftdatagenerator.clientsideannoyances.FoliageColors; -import dev.u9g.minecraftdatagenerator.clientsideannoyances.GrassColors; -import dev.u9g.minecraftdatagenerator.clientsideannoyances.ServerSideRedstoneWireBlock; import dev.u9g.minecraftdatagenerator.mixin.BiomeAccessor; -import dev.u9g.minecraftdatagenerator.util.EmptyBlockView; import dev.u9g.minecraftdatagenerator.util.Registries; import net.minecraft.block.Block; import net.minecraft.block.Blocks; import net.minecraft.block.RedstoneWireBlock; +import net.minecraft.client.BlockColors; +import net.minecraft.client.color.world.FoliageColors; +import net.minecraft.client.color.world.GrassColors; import net.minecraft.util.Identifier; -import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.MathHelper; import net.minecraft.world.biome.Biome; import java.util.*; public class TintsDataGenerator implements IDataGenerator { - - private static final BlockColors blockColors = BlockColors.create(); - public static BiomeTintColors generateBiomeTintColors() { BiomeTintColors colors = new BiomeTintColors(); for (Biome biome : Registries.BIOMES) { - int biomeGrassColor = GrassColors.getGrassColor(biome); - int biomeFoliageColor = FoliageColors.getFoliageColor(biome); + double d = MathHelper.clamp(biome.getTemperature(), 0.0f, 1.0f); + double e = MathHelper.clamp(biome.getRainfall(), 0.0f, 1.0f); + + int biomeGrassColor = GrassColors.getColor(d, e); + int biomeFoliageColor = FoliageColors.getColor(d, e); int biomeWaterColor = ((BiomeAccessor) biome).waterColor(); colors.grassColoursMap.computeIfAbsent(biomeGrassColor, k -> new ArrayList<>()).add(biome); @@ -42,19 +40,18 @@ public static Map generateRedstoneTintColors() { Map resultColors = new HashMap<>(); for (int redstoneLevel : RedstoneWireBlock.POWER.getValues()) { - int color = ServerSideRedstoneWireBlock.getWireColor(redstoneLevel); + int color = RedstoneWireBlock.getColorIntensity(redstoneLevel); resultColors.put(redstoneLevel, color); } return resultColors; } private static int getBlockColor(Block block) { - return blockColors.method_13410(block.getDefaultState()); + return BlockColors.create().method_13410(block.getDefaultState()); } public static Map generateConstantTintColors() { Map resultColors = new HashMap<>(); - BlockColors blockColors = BlockColors.create(); // FIXME: ? // resultColors.put(Blocks.BIRCH_LEAVES, FoliageColors.getBirchColor()); // resultColors.put(Blocks.SPRUCE_LEAVES, FoliageColors.getSpruceColor()); diff --git a/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/mixin/NoteBlockAccessor.java b/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/mixin/NoteBlockAccessor.java index 4bc3bcb9..688aa1c6 100644 --- a/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/mixin/NoteBlockAccessor.java +++ b/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/mixin/NoteBlockAccessor.java @@ -1,7 +1,7 @@ package dev.u9g.minecraftdatagenerator.mixin; import net.minecraft.block.NoteBlock; -import net.minecraft.client.sound.SoundEvent; +import net.minecraft.sound.Sound; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.gen.Accessor; @@ -10,7 +10,7 @@ @Mixin(NoteBlock.class) public interface NoteBlockAccessor { @Accessor("TUNES") - static List TUNES() { + static List TUNES() { return null; } } diff --git a/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/mixin/SoundAccessor.java b/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/mixin/SoundAccessor.java index fe505910..d39eac0b 100644 --- a/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/mixin/SoundAccessor.java +++ b/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/mixin/SoundAccessor.java @@ -1,11 +1,11 @@ package dev.u9g.minecraftdatagenerator.mixin; -import net.minecraft.client.sound.SoundEvent; +import net.minecraft.sound.Sound; import net.minecraft.util.Identifier; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.gen.Accessor; -@Mixin(SoundEvent.class) +@Mixin(Sound.class) public interface SoundAccessor { @Accessor("id") Identifier id(); diff --git a/1.10.2/src/main/resources/fabric.mod.json b/1.10.2/src/main/resources/fabric.mod.json index 12f9d70e..ffac96b0 100644 --- a/1.10.2/src/main/resources/fabric.mod.json +++ b/1.10.2/src/main/resources/fabric.mod.json @@ -10,7 +10,6 @@ ], "contact": {}, "license": "MIT", - "environment": "server", "mixins": [ "minecraft-data-generator.mixins.json" ], diff --git a/1.10.2/src/main/resources/minecraft-data-generator.mixins.json b/1.10.2/src/main/resources/minecraft-data-generator.mixins.json index 4dd13158..7cb7a2a5 100644 --- a/1.10.2/src/main/resources/minecraft-data-generator.mixins.json +++ b/1.10.2/src/main/resources/minecraft-data-generator.mixins.json @@ -17,8 +17,6 @@ "SoundAccessor", "StatusEffectAccessor" ], - "client": [ - ], "injectors": { "defaultRequire": 1 }, diff --git a/1.11.2/build.gradle b/1.11.2/build.gradle index 735609c5..d0aa3520 100644 --- a/1.11.2/build.gradle +++ b/1.11.2/build.gradle @@ -1,53 +1,44 @@ -import net.fabricmc.loom.configuration.providers.minecraft.MinecraftJarConfiguration +import xyz.wagyourtail.unimined.internal.minecraft.MinecraftProvider plugins { - id 'fabric-loom' + id 'xyz.wagyourtail.unimined' } repositories { maven { - name = "legacy-fabric" - url = "https://maven.legacyfabric.net" + name = "wagyourtail releases" + url = "https://maven.wagyourtail.xyz/releases" } + maven { + name = "legacyfabric" + url "https://maven.legacyfabric.net/" + } + mavenCentral() } -loom { - setIntermediaryUrl('https://maven.legacyfabric.net/net/fabricmc/intermediary/%1$s/intermediary-%1$s-v2.jar') - customMinecraftManifest.set("https://meta.legacyfabric.net/v2/manifest/${minecraft_version}") +unimined.minecraft { + version "1.11.2" - minecraftJarConfiguration = MinecraftJarConfiguration.MERGED -} + mappings { + legacyIntermediary() + legacyYarn(541) -dependencies { - minecraft "com.mojang:minecraft:${project.minecraft_version}" - mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" - modImplementation libs.fabric.loader - - // Fabric API provides hooks for events, item registration, and more. As most mods will need this, it's included by default. - // If you know for a fact you don't, it's not required and can be safely removed. -// modImplementation ("net.legacyfabric.legacy-fabric-api:legacy-fabric-api:${fabric_version}") { -// exclude module: "legacy-fabric-entity-events-v1" -// } + devFallbackNamespace "intermediary" + } - implementation(project(":common")) + runs.config("server") { + javaVersion = JavaVersion.VERSION_21 + } - if (System.getProperty("os.name").toLowerCase().contains("mac")) { - implementation 'org.lwjgl.lwjgl:lwjgl_util:2.9.4-nightly-20150209' - implementation 'org.lwjgl.lwjgl:lwjgl:2.9.4-nightly-20150209' - implementation 'org.lwjgl.lwjgl:lwjgl-platform:2.9.4-nightly-20150209' + customPatcher(new CustomLegacyFabricMinecraftTransformer(project, delegate as MinecraftProvider)) { + it.loader libs.versions.fabric.loader.get() } + + defaultRemapJar = true } -if (System.getProperty("os.name").toLowerCase().contains("mac")) { - configurations.configureEach { - resolutionStrategy { - dependencySubstitution { - substitute module('org.lwjgl.lwjgl:lwjgl_util:2.9.2-nightly-201408222') with module('org.lwjgl.lwjgl:lwjgl_util:2.9.4-nightly-20150209') - substitute module('org.lwjgl.lwjgl:lwjgl:2.9.2-nightly-201408222') with module('org.lwjgl.lwjgl:lwjgl:2.9.4-nightly-20150209') - } - force 'org.lwjgl.lwjgl:lwjgl-platform:2.9.4-nightly-20150209' - } - } +dependencies { + implementation project(":common") } processResources { @@ -61,9 +52,3 @@ processResources { tasks.withType(JavaCompile).configureEach { it.options.encoding = "UTF-8" } - -java { - toolchain { - languageVersion.set(JavaLanguageVersion.of(17)) - } -} diff --git a/1.11.2/gradle.properties b/1.11.2/gradle.properties deleted file mode 100644 index c0a54459..00000000 --- a/1.11.2/gradle.properties +++ /dev/null @@ -1,6 +0,0 @@ -# Fabric Properties -# More versions available at: https://grayray75.github.io/LegacyFabric-Versions/ -minecraft_version=1.11.2 -yarn_mappings=1.11.2+build.202206020145 -# Dependencies -# More versions available at: https://grayray75.github.io/LegacyFabric-Versions/ diff --git a/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/BiomeColors.java b/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/BiomeColors.java deleted file mode 100644 index 4ce9e49a..00000000 --- a/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/BiomeColors.java +++ /dev/null @@ -1,55 +0,0 @@ -package dev.u9g.minecraftdatagenerator.clientsideannoyances; - -import dev.u9g.minecraftdatagenerator.util.EmptyBlockView; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.MathHelper; -import net.minecraft.world.biome.Biome; - -import java.util.Iterator; - -public class BiomeColors { - private static final ColorProvider GRASS_COLOR = (biome, pos) -> { - double d = MathHelper.clamp(biome.getTemperature(pos), 0.0F, 1.0F); - double e = MathHelper.clamp(biome.getRainfall(), 0.0F, 1.0F); - return GrassColors.getColor(d, e); - }; - private static final ColorProvider FOLIAGE_COLOR = (biome, pos) -> { - double d = MathHelper.clamp(biome.getTemperature(pos), 0.0F, 1.0F); - double e = MathHelper.clamp(biome.getRainfall(), 0.0F, 1.0F); - return FoliageColors.getColor(d, e); - }; - private static final ColorProvider WATER_COLOR = (biome, pos) -> biome.getWaterColor(); - - private static int getColor(EmptyBlockView view, BlockPos pos, ColorProvider provider) { - int i = 0; - int j = 0; - int k = 0; - - int l; - for (Iterator var6 = BlockPos.mutableIterate(pos.add(-1, 0, -1), pos.add(1, 0, 1)).iterator(); var6.hasNext(); k += l & 255) { - BlockPos.Mutable mutable = var6.next(); - l = provider.getColorAtPos(view.getBiome(mutable), mutable); - i += (l & 16711680) >> 16; - j += (l & '\uff00') >> 8; - } - - return (i / 9 & 255) << 16 | (j / 9 & 255) << 8 | k / 9 & 255; - } - - public static int getGrassColor(EmptyBlockView view, BlockPos pos) { - return getColor(view, pos, GRASS_COLOR); - } - - public static int getFoliageColor(EmptyBlockView view, BlockPos pos) { - return getColor(view, pos, FOLIAGE_COLOR); - } - - public static int getWaterColor(EmptyBlockView view, BlockPos pos) { - return getColor(view, pos, WATER_COLOR); - } - - interface ColorProvider { - int getColorAtPos(Biome biome, BlockPos pos); - } -} - diff --git a/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/BlockColorable.java b/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/BlockColorable.java deleted file mode 100644 index b6819227..00000000 --- a/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/BlockColorable.java +++ /dev/null @@ -1,10 +0,0 @@ -package dev.u9g.minecraftdatagenerator.clientsideannoyances; - -import dev.u9g.minecraftdatagenerator.util.EmptyBlockView; -import net.minecraft.block.BlockState; -import net.minecraft.util.math.BlockPos; -import org.jetbrains.annotations.Nullable; - -public interface BlockColorable { - int method_12155(BlockState blockState, @Nullable EmptyBlockView blockView, @Nullable BlockPos blockPos, int i); -} diff --git a/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/BlockColors.java b/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/BlockColors.java deleted file mode 100644 index 5053ac73..00000000 --- a/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/BlockColors.java +++ /dev/null @@ -1,95 +0,0 @@ -package dev.u9g.minecraftdatagenerator.clientsideannoyances; - -import dev.u9g.minecraftdatagenerator.util.EmptyBlockView; -import net.minecraft.block.*; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.block.entity.FlowerPotBlockEntity; -import net.minecraft.item.Item; -import net.minecraft.util.collection.IdList; -import net.minecraft.util.math.BlockPos; -import org.jetbrains.annotations.Nullable; - -public class BlockColors { - private final IdList BlockColor2Id = new IdList<>(32); - - public BlockColors() { - } - - public static BlockColors create() { - final BlockColors blockColors = new BlockColors(); - blockColors.method_12158((blockState, blockView, blockPos, i) -> { - DoublePlantBlock.DoublePlantType doublePlantType = blockState.get(DoublePlantBlock.VARIANT); - return blockView != null && blockPos != null && (doublePlantType == DoublePlantBlock.DoublePlantType.GRASS || doublePlantType == DoublePlantBlock.DoublePlantType.FERN) ? BiomeColors.getGrassColor(blockView, blockState.get(DoublePlantBlock.HALF) == DoublePlantBlock.HalfType.UPPER ? blockPos.down() : blockPos) : -1; - }, Blocks.DOUBLE_PLANT); - blockColors.method_12158((blockState, blockView, blockPos, i) -> { - if (blockView != null && blockPos != null) { - BlockEntity blockEntity = blockView.getBlockEntity(blockPos); - if (blockEntity instanceof FlowerPotBlockEntity) { - Item item = ((FlowerPotBlockEntity) blockEntity).getItem(); - BlockState blockState2 = Block.getBlockFromItem(item).getDefaultState(); - return blockColors.method_12157(blockState2, blockView, blockPos, i); - } else { - return -1; - } - } else { - return -1; - } - }, Blocks.FLOWER_POT); - blockColors.method_12158((blockState, blockView, blockPos, i) -> blockView != null && blockPos != null ? BiomeColors.getGrassColor(blockView, blockPos) : GrassColors.getColor(0.5D, 1.0D), Blocks.GRASS); - blockColors.method_12158((blockState, blockView, blockPos, i) -> { - PlanksBlock.WoodType woodType = blockState.get(Leaves1Block.VARIANT); - if (woodType == PlanksBlock.WoodType.SPRUCE) { - return net.minecraft.client.color.world.FoliageColors.getSpruceColor(); - } else if (woodType == PlanksBlock.WoodType.BIRCH) { - return net.minecraft.client.color.world.FoliageColors.getBirchColor(); - } else { - return blockView != null && blockPos != null ? BiomeColors.getFoliageColor(blockView, blockPos) : FoliageColors.getDefaultColor(); - } - }, Blocks.LEAVES); - blockColors.method_12158((blockState, blockView, blockPos, i) -> blockView != null && blockPos != null ? BiomeColors.getFoliageColor(blockView, blockPos) : FoliageColors.getDefaultColor(), Blocks.LEAVES2); - blockColors.method_12158((blockState, blockView, blockPos, i) -> blockView != null && blockPos != null ? BiomeColors.getWaterColor(blockView, blockPos) : -1, Blocks.WATER, Blocks.FLOWING_WATER); - blockColors.method_12158((blockState, blockView, blockPos, i) -> RedstoneWireBlock.method_8877(blockState.get(RedstoneWireBlock.POWER)), Blocks.REDSTONE_WIRE); - blockColors.method_12158((blockState, blockView, blockPos, i) -> blockView != null && blockPos != null ? BiomeColors.getGrassColor(blockView, blockPos) : -1, Blocks.SUGARCANE); - blockColors.method_12158((blockState, blockView, blockPos, i) -> { - int j = blockState.get(AttachedStemBlock.AGE); - int k = j * 32; - int l = 255 - j * 8; - int m = j * 4; - return k << 16 | l << 8 | m; - }, Blocks.MELON_STEM, Blocks.PUMPKIN_STEM); - blockColors.method_12158((blockState, blockView, blockPos, i) -> { - if (blockView != null && blockPos != null) { - return BiomeColors.getGrassColor(blockView, blockPos); - } else { - return blockState.get(TallPlantBlock.TYPE) == TallPlantBlock.GrassType.DEAD_BUSH ? 16777215 : GrassColors.getColor(0.5D, 1.0D); - } - }, Blocks.TALLGRASS); - blockColors.method_12158((blockState, blockView, blockPos, i) -> blockView != null && blockPos != null ? BiomeColors.getFoliageColor(blockView, blockPos) : FoliageColors.getDefaultColor(), Blocks.VINE); - blockColors.method_12158((blockState, blockView, blockPos, i) -> blockView != null && blockPos != null ? 2129968 : 7455580, Blocks.LILY_PAD); - return blockColors; - } - - public int method_13410(BlockState blockState) { - BlockColorable blockColorable = this.BlockColor2Id.fromId(Block.getIdByBlock(blockState.getBlock())); - if (blockColorable != null) { - return blockColorable.method_12155(blockState, null, null, 0); - } else { - MaterialColor materialColor = blockState.getMaterialColor(); - return materialColor != null ? materialColor.color : -1; - } - } - - public int method_12157(BlockState blockState, @Nullable EmptyBlockView blockView, @Nullable BlockPos blockPos, int i) { - BlockColorable blockColorable = this.BlockColor2Id.fromId(Block.getIdByBlock(blockState.getBlock())); - return blockColorable == null ? -1 : blockColorable.method_12155(blockState, blockView, blockPos, i); - } - - public void method_12158(BlockColorable blockColorable, Block... blocks) { - int var4 = blocks.length; - - for (Block block : blocks) { - this.BlockColor2Id.set(blockColorable, Block.getIdByBlock(block)); - } - - } -} diff --git a/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/FoliageColors.java b/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/FoliageColors.java deleted file mode 100644 index f4d20ec2..00000000 --- a/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/FoliageColors.java +++ /dev/null @@ -1,28 +0,0 @@ -package dev.u9g.minecraftdatagenerator.clientsideannoyances; - -public class FoliageColors { - private static int[] colorMap = new int[65536]; - - public static void setColorMap(int[] pixels) { - colorMap = pixels; - } - - public static int getColor(double temperature, double humidity) { - humidity *= temperature; - int i = (int) ((1.0D - temperature) * 255.0D); - int j = (int) ((1.0D - humidity) * 255.0D); - return colorMap[j << 8 | i]; - } - - public static int getSpruceColor() { - return 6396257; - } - - public static int getBirchColor() { - return 8431445; - } - - public static int getDefaultColor() { - return 4764952; - } -} diff --git a/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/GrassColors.java b/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/GrassColors.java deleted file mode 100644 index 0528f394..00000000 --- a/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/GrassColors.java +++ /dev/null @@ -1,19 +0,0 @@ -package dev.u9g.minecraftdatagenerator.clientsideannoyances; - -public class GrassColors { - private static int[] colorMap = new int[65536]; - - public static void setColorMap(int[] map) { - colorMap = map; - } - - public static int getColor(double temperature, double humidity) { - humidity *= temperature; - int i = (int) ((1.0D - temperature) * 255.0D); - int j = (int) ((1.0D - humidity) * 255.0D); - int k = j << 8 | i; - return k > colorMap.length ? -65281 : colorMap[k]; - } -} - - diff --git a/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/ServerSideRedstoneWireBlock.java b/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/ServerSideRedstoneWireBlock.java deleted file mode 100644 index 75c9f89c..00000000 --- a/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/ServerSideRedstoneWireBlock.java +++ /dev/null @@ -1,28 +0,0 @@ -package dev.u9g.minecraftdatagenerator.clientsideannoyances; - -import net.minecraft.util.math.MathHelper; - -public class ServerSideRedstoneWireBlock { - public static int getWireColor(int powerLevel) { - float f = (float) powerLevel / 15.0F; - float g = f * 0.6F + 0.4F; - if (powerLevel == 0) { - g = 0.3F; - } - - float h = f * f * 0.7F - 0.5F; - float j = f * f * 0.6F - 0.7F; - if (h < 0.0F) { - h = 0.0F; - } - - if (j < 0.0F) { - j = 0.0F; - } - - int k = MathHelper.clamp((int) (g * 255.0F), 0, 255); - int l = MathHelper.clamp((int) (h * 255.0F), 0, 255); - int m = MathHelper.clamp((int) (j * 255.0F), 0, 255); - return -16777216 | k << 16 | l << 8 | m; - } -} diff --git a/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/SkyColor.java b/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/SkyColor.java deleted file mode 100644 index fd0b7ae7..00000000 --- a/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/SkyColor.java +++ /dev/null @@ -1,74 +0,0 @@ -package dev.u9g.minecraftdatagenerator.clientsideannoyances; - -import net.minecraft.util.math.MathHelper; -import net.minecraft.world.biome.Biome; - -public class SkyColor { - public static int getSkyColor(Biome biome) { - return realSkyColor(biome.getTemperature()); - } - - private static int realSkyColor(float temperature) { - temperature /= 3.0F; - temperature = MathHelper.clamp(temperature, -1.0F, 1.0F); - return hsvToRgb(0.62222224F - temperature * 0.05F, 0.5F + temperature * 0.1F, 1.0F); - } - - public static int hsvToRgb(float hue, float saturation, float value) { - int i = (int) (hue * 6.0F) % 6; - float f = hue * 6.0F - (float) i; - float g = value * (1.0F - saturation); - float h = value * (1.0F - f * saturation); - float j = value * (1.0F - (1.0F - f) * saturation); - float k; - float l; - float m; - switch (i) { - case 0: - k = value; - l = j; - m = g; - break; - case 1: - k = h; - l = value; - m = g; - break; - case 2: - k = g; - l = value; - m = j; - break; - case 3: - k = g; - l = h; - m = value; - break; - case 4: - k = j; - l = g; - m = value; - break; - case 5: - k = value; - l = g; - m = h; - break; - default: - throw new RuntimeException("Something went wrong when converting from HSV to RGB. Input was " + hue + ", " + saturation + ", " + value); - } - - int n = clamp((int) (k * 255.0F), 0, 255); - int o = clamp((int) (l * 255.0F), 0, 255); - int p = clamp((int) (m * 255.0F), 0, 255); - return n << 16 | o << 8 | p; - } - - public static int clamp(int value, int min, int max) { - if (value < min) { - return min; - } else { - return Math.min(value, max); - } - } -} diff --git a/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/BiomesDataGenerator.java b/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/BiomesDataGenerator.java index 1453aa27..1433d785 100644 --- a/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/BiomesDataGenerator.java +++ b/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/BiomesDataGenerator.java @@ -2,7 +2,6 @@ import com.google.gson.JsonArray; import com.google.gson.JsonObject; -import dev.u9g.minecraftdatagenerator.clientsideannoyances.SkyColor; import dev.u9g.minecraftdatagenerator.mixin.BiomeAccessor; import net.minecraft.util.Identifier; import net.minecraft.util.registry.SimpleRegistry; @@ -23,7 +22,6 @@ private static String guessBiomeDimensionFromCategory(Biome biome) { public static JsonObject generateBiomeInfo(SimpleRegistry registry, Biome biome) { JsonObject biomeDesc = new JsonObject(); - Identifier registryKey = registry.getIdentifier(biome); biomeDesc.addProperty("id", registry.getRawId(biome)); biomeDesc.addProperty("name", String.join("_", ((BiomeAccessor) biome).name().toLowerCase(Locale.ENGLISH).split(" "))); @@ -33,7 +31,7 @@ public static JsonObject generateBiomeInfo(SimpleRegistry reg biomeDesc.addProperty("depth", biome.getDepth()); biomeDesc.addProperty("dimension", guessBiomeDimensionFromCategory(biome)); biomeDesc.addProperty("displayName", ((BiomeAccessor) biome).name()); - biomeDesc.addProperty("color", SkyColor.getSkyColor(biome)); + biomeDesc.addProperty("color", biome.getSkyColor(biome.getTemperature())); biomeDesc.addProperty("rainfall", biome.getRainfall()); return biomeDesc; diff --git a/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/InstrumentsDataGenerator.java b/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/InstrumentsDataGenerator.java index 3aa51c41..dc0692d8 100644 --- a/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/InstrumentsDataGenerator.java +++ b/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/InstrumentsDataGenerator.java @@ -5,7 +5,7 @@ import com.google.gson.JsonObject; import dev.u9g.minecraftdatagenerator.mixin.NoteBlockAccessor; import dev.u9g.minecraftdatagenerator.mixin.SoundAccessor; -import net.minecraft.client.sound.SoundEvent; +import net.minecraft.sound.Sound; import java.util.Objects; @@ -19,7 +19,7 @@ public String getDataName() { public JsonElement generateDataJson() { JsonArray array = new JsonArray(); int i = 0; - for (SoundEvent sound : Objects.requireNonNull(NoteBlockAccessor.TUNES())) { + for (Sound sound : Objects.requireNonNull(NoteBlockAccessor.TUNES())) { JsonObject object = new JsonObject(); object.addProperty("id", i++); object.addProperty("name", ((SoundAccessor) sound).id().getPath().split("\\.")[2]); diff --git a/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java b/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java index 9429a29a..471d668b 100644 --- a/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java +++ b/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java @@ -3,15 +3,14 @@ import com.google.gson.JsonArray; import com.google.gson.JsonObject; import dev.u9g.minecraftdatagenerator.mixin.SoundAccessor; -import net.minecraft.client.sound.SoundEvent; - +import net.minecraft.sound.Sound; public class SoundsDataGenerator implements IDataGenerator { - public static JsonObject generateSound(SoundEvent soundEvent) { + public static JsonObject generateSound(Sound soundEvent) { JsonObject soundDesc = new JsonObject(); - soundDesc.addProperty("id", SoundEvent.REGISTRY.getRawId(soundEvent)); + soundDesc.addProperty("id", Sound.REGISTRY.getRawId(soundEvent)); soundDesc.addProperty("name", ((SoundAccessor) soundEvent).id().getPath()); return soundDesc; @@ -25,7 +24,7 @@ public String getDataName() { @Override public JsonArray generateDataJson() { JsonArray resultsArray = new JsonArray(); - SoundEvent.REGISTRY.forEach(sound -> resultsArray.add(generateSound(sound))); + Sound.REGISTRY.forEach(sound -> resultsArray.add(generateSound(sound))); return resultsArray; } } diff --git a/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java b/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java index 401c2c5a..76cb62c6 100644 --- a/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java +++ b/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java @@ -3,37 +3,30 @@ import com.google.gson.JsonArray; import com.google.gson.JsonObject; import com.google.gson.JsonPrimitive; -import dev.u9g.minecraftdatagenerator.clientsideannoyances.BiomeColors; -import dev.u9g.minecraftdatagenerator.clientsideannoyances.BlockColors; -import dev.u9g.minecraftdatagenerator.clientsideannoyances.ServerSideRedstoneWireBlock; import dev.u9g.minecraftdatagenerator.mixin.BiomeAccessor; -import dev.u9g.minecraftdatagenerator.util.EmptyBlockView; import dev.u9g.minecraftdatagenerator.util.Registries; import net.minecraft.block.Block; import net.minecraft.block.Blocks; import net.minecraft.block.RedstoneWireBlock; +import net.minecraft.client.BlockColors; +import net.minecraft.client.color.world.FoliageColors; +import net.minecraft.client.color.world.GrassColors; import net.minecraft.util.Identifier; -import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.MathHelper; import net.minecraft.world.biome.Biome; import java.util.*; public class TintsDataGenerator implements IDataGenerator { - - private static final BlockColors blockColors = BlockColors.create(); - public static BiomeTintColors generateBiomeTintColors() { BiomeTintColors colors = new BiomeTintColors(); for (Biome biome : Registries.BIOMES) { - EmptyBlockView bv = new EmptyBlockView() { - @Override - public Biome getBiome(BlockPos pos) { - return biome; - } - }; - int biomeGrassColor = BiomeColors.getGrassColor(bv, BlockPos.ORIGIN); - int biomeFoliageColor = BiomeColors.getFoliageColor(bv, BlockPos.ORIGIN); + double d = MathHelper.clamp(biome.getTemperature(), 0.0f, 1.0f); + double e = MathHelper.clamp(biome.getRainfall(), 0.0f, 1.0f); + + int biomeGrassColor = GrassColors.getColor(d, e); + int biomeFoliageColor = FoliageColors.getColor(d, e); int biomeWaterColor = ((BiomeAccessor) biome).waterColor(); colors.grassColoursMap.computeIfAbsent(biomeGrassColor, k -> new ArrayList<>()).add(biome); @@ -47,19 +40,18 @@ public static Map generateRedstoneTintColors() { Map resultColors = new HashMap<>(); for (int redstoneLevel : RedstoneWireBlock.POWER.getValues()) { - int color = ServerSideRedstoneWireBlock.getWireColor(redstoneLevel); + int color = RedstoneWireBlock.getColorIntensity(redstoneLevel); resultColors.put(redstoneLevel, color); } return resultColors; } private static int getBlockColor(Block block) { - return blockColors.method_13410(block.getDefaultState()); + return BlockColors.create().method_13410(block.getDefaultState()); } public static Map generateConstantTintColors() { Map resultColors = new HashMap<>(); - BlockColors blockColors = BlockColors.create(); // FIXME: ? // resultColors.put(Blocks.BIRCH_LEAVES, FoliageColors.getBirchColor()); // resultColors.put(Blocks.SPRUCE_LEAVES, FoliageColors.getSpruceColor()); diff --git a/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/mixin/NoteBlockAccessor.java b/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/mixin/NoteBlockAccessor.java index 4bc3bcb9..688aa1c6 100644 --- a/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/mixin/NoteBlockAccessor.java +++ b/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/mixin/NoteBlockAccessor.java @@ -1,7 +1,7 @@ package dev.u9g.minecraftdatagenerator.mixin; import net.minecraft.block.NoteBlock; -import net.minecraft.client.sound.SoundEvent; +import net.minecraft.sound.Sound; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.gen.Accessor; @@ -10,7 +10,7 @@ @Mixin(NoteBlock.class) public interface NoteBlockAccessor { @Accessor("TUNES") - static List TUNES() { + static List TUNES() { return null; } } diff --git a/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/mixin/SoundAccessor.java b/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/mixin/SoundAccessor.java index fe505910..d39eac0b 100644 --- a/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/mixin/SoundAccessor.java +++ b/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/mixin/SoundAccessor.java @@ -1,11 +1,11 @@ package dev.u9g.minecraftdatagenerator.mixin; -import net.minecraft.client.sound.SoundEvent; +import net.minecraft.sound.Sound; import net.minecraft.util.Identifier; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.gen.Accessor; -@Mixin(SoundEvent.class) +@Mixin(Sound.class) public interface SoundAccessor { @Accessor("id") Identifier id(); diff --git a/1.11.2/src/main/resources/fabric.mod.json b/1.11.2/src/main/resources/fabric.mod.json index 12f9d70e..ffac96b0 100644 --- a/1.11.2/src/main/resources/fabric.mod.json +++ b/1.11.2/src/main/resources/fabric.mod.json @@ -10,7 +10,6 @@ ], "contact": {}, "license": "MIT", - "environment": "server", "mixins": [ "minecraft-data-generator.mixins.json" ], diff --git a/1.11.2/src/main/resources/minecraft-data-generator.mixins.json b/1.11.2/src/main/resources/minecraft-data-generator.mixins.json index fcdcd1a0..86922042 100644 --- a/1.11.2/src/main/resources/minecraft-data-generator.mixins.json +++ b/1.11.2/src/main/resources/minecraft-data-generator.mixins.json @@ -15,8 +15,6 @@ "SoundAccessor", "StatusEffectAccessor" ], - "client": [ - ], "injectors": { "defaultRequire": 1 }, diff --git a/1.12.2/build.gradle b/1.12.2/build.gradle index 735609c5..5739159a 100644 --- a/1.12.2/build.gradle +++ b/1.12.2/build.gradle @@ -1,53 +1,44 @@ -import net.fabricmc.loom.configuration.providers.minecraft.MinecraftJarConfiguration +import xyz.wagyourtail.unimined.internal.minecraft.MinecraftProvider plugins { - id 'fabric-loom' + id 'xyz.wagyourtail.unimined' } repositories { maven { - name = "legacy-fabric" - url = "https://maven.legacyfabric.net" + name = "wagyourtail releases" + url = "https://maven.wagyourtail.xyz/releases" } + maven { + name = "legacyfabric" + url "https://maven.legacyfabric.net/" + } + mavenCentral() } -loom { - setIntermediaryUrl('https://maven.legacyfabric.net/net/fabricmc/intermediary/%1$s/intermediary-%1$s-v2.jar') - customMinecraftManifest.set("https://meta.legacyfabric.net/v2/manifest/${minecraft_version}") +unimined.minecraft { + version "1.12.2" - minecraftJarConfiguration = MinecraftJarConfiguration.MERGED -} + mappings { + legacyIntermediary() + legacyYarn(541) -dependencies { - minecraft "com.mojang:minecraft:${project.minecraft_version}" - mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" - modImplementation libs.fabric.loader - - // Fabric API provides hooks for events, item registration, and more. As most mods will need this, it's included by default. - // If you know for a fact you don't, it's not required and can be safely removed. -// modImplementation ("net.legacyfabric.legacy-fabric-api:legacy-fabric-api:${fabric_version}") { -// exclude module: "legacy-fabric-entity-events-v1" -// } + devFallbackNamespace "intermediary" + } - implementation(project(":common")) + runs.config("server") { + javaVersion = JavaVersion.VERSION_21 + } - if (System.getProperty("os.name").toLowerCase().contains("mac")) { - implementation 'org.lwjgl.lwjgl:lwjgl_util:2.9.4-nightly-20150209' - implementation 'org.lwjgl.lwjgl:lwjgl:2.9.4-nightly-20150209' - implementation 'org.lwjgl.lwjgl:lwjgl-platform:2.9.4-nightly-20150209' + customPatcher(new CustomLegacyFabricMinecraftTransformer(project, delegate as MinecraftProvider)) { + it.loader libs.versions.fabric.loader.get() } + + defaultRemapJar = true } -if (System.getProperty("os.name").toLowerCase().contains("mac")) { - configurations.configureEach { - resolutionStrategy { - dependencySubstitution { - substitute module('org.lwjgl.lwjgl:lwjgl_util:2.9.2-nightly-201408222') with module('org.lwjgl.lwjgl:lwjgl_util:2.9.4-nightly-20150209') - substitute module('org.lwjgl.lwjgl:lwjgl:2.9.2-nightly-201408222') with module('org.lwjgl.lwjgl:lwjgl:2.9.4-nightly-20150209') - } - force 'org.lwjgl.lwjgl:lwjgl-platform:2.9.4-nightly-20150209' - } - } +dependencies { + implementation project(":common") } processResources { @@ -61,9 +52,3 @@ processResources { tasks.withType(JavaCompile).configureEach { it.options.encoding = "UTF-8" } - -java { - toolchain { - languageVersion.set(JavaLanguageVersion.of(17)) - } -} diff --git a/1.12.2/gradle.properties b/1.12.2/gradle.properties deleted file mode 100644 index c06cf122..00000000 --- a/1.12.2/gradle.properties +++ /dev/null @@ -1,6 +0,0 @@ -# Fabric Properties -# More versions available at: https://grayray75.github.io/LegacyFabric-Versions/ -minecraft_version=1.12.2 -yarn_mappings=1.12.2+build.202206020145 -# Dependencies -# More versions available at: https://grayray75.github.io/LegacyFabric-Versions/ diff --git a/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/BiomeColors.java b/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/BiomeColors.java deleted file mode 100644 index 874569b3..00000000 --- a/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/BiomeColors.java +++ /dev/null @@ -1,46 +0,0 @@ -package dev.u9g.minecraftdatagenerator.clientsideannoyances; - -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.BlockView; -import net.minecraft.world.biome.Biome; - -import java.util.Iterator; - -public class BiomeColors { - private static final ColorProvider GRASS_COLOR = Biome::getGrassColor; - private static final ColorProvider FOLIAGE_COLOR = Biome::getFoliageColor; - private static final ColorProvider WATER_COLOR = (biome, pos) -> biome.getWaterColor(); - - private static int getColor(BlockView view, BlockPos pos, ColorProvider provider) { - int i = 0; - int j = 0; - int k = 0; - - int l; - for (Iterator var6 = BlockPos.mutableIterate(pos.add(-1, 0, -1), pos.add(1, 0, 1)).iterator(); var6.hasNext(); k += l & 255) { - BlockPos.Mutable mutable = var6.next(); - l = provider.getColorAtPos(view.getBiome(mutable), mutable); - i += (l & 16711680) >> 16; - j += (l & '\uff00') >> 8; - } - - return (i / 9 & 255) << 16 | (j / 9 & 255) << 8 | k / 9 & 255; - } - - public static int getGrassColor(BlockView view, BlockPos pos) { - return getColor(view, pos, GRASS_COLOR); - } - - public static int getFoliageColor(BlockView view, BlockPos pos) { - return getColor(view, pos, FOLIAGE_COLOR); - } - - public static int getWaterColor(BlockView view, BlockPos pos) { - return getColor(view, pos, WATER_COLOR); - } - - interface ColorProvider { - int getColorAtPos(Biome biome, BlockPos pos); - } -} - diff --git a/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/BlockColorable.java b/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/BlockColorable.java deleted file mode 100644 index 64809900..00000000 --- a/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/BlockColorable.java +++ /dev/null @@ -1,10 +0,0 @@ -package dev.u9g.minecraftdatagenerator.clientsideannoyances; - -import net.minecraft.block.BlockState; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.BlockView; -import org.jetbrains.annotations.Nullable; - -public interface BlockColorable { - int method_12155(BlockState blockState, @Nullable BlockView blockView, @Nullable BlockPos blockPos, int i); -} diff --git a/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/BlockColors.java b/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/BlockColors.java deleted file mode 100644 index 51bf78c8..00000000 --- a/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/BlockColors.java +++ /dev/null @@ -1,98 +0,0 @@ -package dev.u9g.minecraftdatagenerator.clientsideannoyances; - -import net.minecraft.block.*; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.block.entity.FlowerPotBlockEntity; -import net.minecraft.item.Item; -import net.minecraft.util.collection.IdList; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.BlockView; -import net.minecraft.world.World; -import org.jetbrains.annotations.Nullable; - -public class BlockColors { - private final IdList BlockColor2Id = new IdList<>(32); - - public BlockColors() { - } - - public static BlockColors create() { - final BlockColors blockColors = new BlockColors(); - blockColors.method_12158((blockState, blockView, blockPos, i) -> { - DoublePlantBlock.DoublePlantType doublePlantType = blockState.get(DoublePlantBlock.VARIANT); - return blockView != null && blockPos != null && - (doublePlantType == DoublePlantBlock.DoublePlantType.GRASS || doublePlantType == DoublePlantBlock.DoublePlantType.FERN) ? - BiomeColors.getGrassColor(blockView, blockState.get(DoublePlantBlock.HALF) == DoublePlantBlock.HalfType.UPPER ? blockPos.down() : blockPos) : -1; - }, Blocks.DOUBLE_PLANT); - blockColors.method_12158((blockState, blockView, blockPos, i) -> { - if (blockView != null && blockPos != null) { - BlockEntity blockEntity = blockView.getBlockEntity(blockPos); - if (blockEntity instanceof FlowerPotBlockEntity) { - Item item = ((FlowerPotBlockEntity) blockEntity).getItem(); - BlockState blockState2 = Block.getBlockFromItem(item).getDefaultState(); - return blockColors.method_12157(blockState2, blockView, blockPos, i); - } else { - return -1; - } - } else { - return -1; - } - }, Blocks.FLOWER_POT); - blockColors.method_12158((blockState, blockView, blockPos, i) -> blockView != null && blockPos != null ? BiomeColors.getGrassColor(blockView, blockPos) : GrassColors.getColor(0.5D, 1.0D), Blocks.GRASS); - blockColors.method_12158((blockState, blockView, blockPos, i) -> { - PlanksBlock.WoodType woodType = blockState.get(Leaves1Block.VARIANT); - if (woodType == PlanksBlock.WoodType.SPRUCE) { - return FoliageColors.getSpruceColor(); - } else if (woodType == PlanksBlock.WoodType.BIRCH) { - return FoliageColors.getBirchColor(); - } else { - return blockView != null && blockPos != null ? BiomeColors.getFoliageColor(blockView, blockPos) : FoliageColors.getDefaultColor(); - } - }, Blocks.LEAVES); - blockColors.method_12158((blockState, blockView, blockPos, i) -> blockView != null && blockPos != null ? BiomeColors.getFoliageColor(blockView, blockPos) : FoliageColors.getDefaultColor(), Blocks.LEAVES2); - blockColors.method_12158((blockState, blockView, blockPos, i) -> blockView != null && blockPos != null ? BiomeColors.getWaterColor(blockView, blockPos) : -1, Blocks.WATER, Blocks.FLOWING_WATER); - blockColors.method_12158((blockState, blockView, blockPos, i) -> RedstoneWireBlock.method_8877(blockState.get(RedstoneWireBlock.POWER)), Blocks.REDSTONE_WIRE); - blockColors.method_12158((blockState, blockView, blockPos, i) -> blockView != null && blockPos != null ? BiomeColors.getGrassColor(blockView, blockPos) : -1, Blocks.SUGARCANE); - blockColors.method_12158((blockState, blockView, blockPos, i) -> { - int j = blockState.get(AttachedStemBlock.AGE); - int k = j * 32; - int l = 255 - j * 8; - int m = j * 4; - return k << 16 | l << 8 | m; - }, Blocks.MELON_STEM, Blocks.PUMPKIN_STEM); -// blockColors.method_12158((blockState, blockView, blockPos, i) -> { -// if (blockView != null && blockPos != null) { -// return BiomeColors.getGrassColor(blockView, blockPos); -// } else { -// return blockState.get(TallPlantBlock.TYPE) == TallPlantBlock.GrassType.DEAD_BUSH ? 16777215 : GrassColors.getColor(0.5D, 1.0D); -// } -// }, Blocks.TALLGRASS); - blockColors.method_12158((blockState, blockView, blockPos, i) -> blockView != null && blockPos != null ? BiomeColors.getGrassColor(blockView, blockPos) : blockState.get(TallPlantBlock.TYPE) == TallPlantBlock.GrassType.DEAD_BUSH ? 16777215 : GrassColors.getColor(0.5D, 1.0D), Blocks.TALLGRASS); - blockColors.method_12158((blockState, blockView, blockPos, i) -> blockView != null && blockPos != null ? BiomeColors.getFoliageColor(blockView, blockPos) : FoliageColors.getDefaultColor(), Blocks.VINE); - blockColors.method_12158((blockState, blockView, blockPos, i) -> blockView != null && blockPos != null ? 2129968 : 7455580, Blocks.LILY_PAD); - return blockColors; - } - - public int method_13410(BlockState blockState, World world, BlockPos blockPos) { - BlockColorable blockColorable = BlockColor2Id.fromId(Block.getIdByBlock(blockState.getBlock())); - if (blockColorable != null) { - return blockColorable.method_12155(blockState, null, null, 0); - } else { - MaterialColor materialColor = blockState.getMaterialColor(world, blockPos); - return materialColor != null ? materialColor.color : -1; - } - } - - public int method_12157(BlockState blockState, @Nullable BlockView blockView, @Nullable BlockPos blockPos, int i) { - net.minecraft.client.BlockColorable blockColorable = (net.minecraft.client.BlockColorable) this.BlockColor2Id.fromId(Block.getIdByBlock(blockState.getBlock())); - return blockColorable == null ? -1 : blockColorable.method_12155(blockState, blockView, blockPos, i); - } - - public void method_12158(BlockColorable blockColorable, Block... blocks) { - int var4 = blocks.length; - - for (Block block : blocks) { - this.BlockColor2Id.set(blockColorable, Block.getIdByBlock(block)); - } - } -} diff --git a/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/FoliageColors.java b/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/FoliageColors.java deleted file mode 100644 index 1d3f9480..00000000 --- a/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/FoliageColors.java +++ /dev/null @@ -1,36 +0,0 @@ -package dev.u9g.minecraftdatagenerator.clientsideannoyances; - -import net.minecraft.util.math.MathHelper; -import net.minecraft.world.biome.Biome; - -public class FoliageColors { - private static int[] colorMap = new int[65536]; - - public static void setColorMap(int[] pixels) { - colorMap = pixels; - } - - private static int getColor(double temperature, double humidity) { - int i = (int) ((1.0 - temperature) * 255.0); - int j = (int) ((1.0 - (humidity *= temperature)) * 255.0); - return colorMap[j << 8 | i]; - } - - public static int getSpruceColor() { - return 0x619961; - } - - public static int getBirchColor() { - return 8431445; - } - - public static int getDefaultColor() { - return 4764952; - } - - public static int getFoliageColor(Biome biome) { - double d = MathHelper.clamp(biome.getTemperature(), 0.0f, 1.0f); - double e = MathHelper.clamp(biome.getRainfall(), 0.0f, 1.0f); - return getColor(d, e); - } -} diff --git a/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/GrassColors.java b/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/GrassColors.java deleted file mode 100644 index 9d653723..00000000 --- a/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/GrassColors.java +++ /dev/null @@ -1,29 +0,0 @@ -package dev.u9g.minecraftdatagenerator.clientsideannoyances; - -import net.minecraft.util.math.MathHelper; -import net.minecraft.world.biome.Biome; - -public class GrassColors { - private static int[] colorMap = new int[65536]; - - public static void setColorMap(int[] map) { - colorMap = map; - } - - public static int getColor(double temperature, double humidity) { - int j = (int) ((1.0 - (humidity *= temperature)) * 255.0); - int i = (int) ((1.0 - temperature) * 255.0); - int k = j << 8 | i; - if (k > colorMap.length) { - return -65281; - } - return colorMap[k]; - } - - public static int getGrassColor(Biome biome) { - double d = MathHelper.clamp(biome.getTemperature(), 0.0f, 1.0f); - double e = MathHelper.clamp(biome.getRainfall(), 0.0f, 1.0f); - return getColor(d, e); - } -} - diff --git a/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/ServerSideRedstoneWireBlock.java b/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/ServerSideRedstoneWireBlock.java deleted file mode 100644 index f733e90f..00000000 --- a/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/ServerSideRedstoneWireBlock.java +++ /dev/null @@ -1,25 +0,0 @@ -package dev.u9g.minecraftdatagenerator.clientsideannoyances; - -import net.minecraft.util.math.MathHelper; - -public class ServerSideRedstoneWireBlock { - public static int getWireColor(int powerLevel) { - float f = (float) powerLevel / 15.0f; - float g = f * 0.6f + 0.4f; - if (powerLevel == 0) { - g = 0.3f; - } - float h = f * f * 0.7f - 0.5f; - float j = f * f * 0.6f - 0.7f; - if (h < 0.0f) { - h = 0.0f; - } - if (j < 0.0f) { - j = 0.0f; - } - int k = MathHelper.clamp((int) (g * 255.0f), 0, 255); - int l = MathHelper.clamp((int) (h * 255.0f), 0, 255); - int m = MathHelper.clamp((int) (j * 255.0f), 0, 255); - return 0xFF000000 | k << 16 | l << 8 | m; - } -} diff --git a/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/InstrumentsDataGenerator.java b/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/InstrumentsDataGenerator.java index 3aa51c41..dc0692d8 100644 --- a/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/InstrumentsDataGenerator.java +++ b/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/InstrumentsDataGenerator.java @@ -5,7 +5,7 @@ import com.google.gson.JsonObject; import dev.u9g.minecraftdatagenerator.mixin.NoteBlockAccessor; import dev.u9g.minecraftdatagenerator.mixin.SoundAccessor; -import net.minecraft.client.sound.SoundEvent; +import net.minecraft.sound.Sound; import java.util.Objects; @@ -19,7 +19,7 @@ public String getDataName() { public JsonElement generateDataJson() { JsonArray array = new JsonArray(); int i = 0; - for (SoundEvent sound : Objects.requireNonNull(NoteBlockAccessor.TUNES())) { + for (Sound sound : Objects.requireNonNull(NoteBlockAccessor.TUNES())) { JsonObject object = new JsonObject(); object.addProperty("id", i++); object.addProperty("name", ((SoundAccessor) sound).id().getPath().split("\\.")[2]); diff --git a/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java b/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java index 9429a29a..471d668b 100644 --- a/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java +++ b/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java @@ -3,15 +3,14 @@ import com.google.gson.JsonArray; import com.google.gson.JsonObject; import dev.u9g.minecraftdatagenerator.mixin.SoundAccessor; -import net.minecraft.client.sound.SoundEvent; - +import net.minecraft.sound.Sound; public class SoundsDataGenerator implements IDataGenerator { - public static JsonObject generateSound(SoundEvent soundEvent) { + public static JsonObject generateSound(Sound soundEvent) { JsonObject soundDesc = new JsonObject(); - soundDesc.addProperty("id", SoundEvent.REGISTRY.getRawId(soundEvent)); + soundDesc.addProperty("id", Sound.REGISTRY.getRawId(soundEvent)); soundDesc.addProperty("name", ((SoundAccessor) soundEvent).id().getPath()); return soundDesc; @@ -25,7 +24,7 @@ public String getDataName() { @Override public JsonArray generateDataJson() { JsonArray resultsArray = new JsonArray(); - SoundEvent.REGISTRY.forEach(sound -> resultsArray.add(generateSound(sound))); + Sound.REGISTRY.forEach(sound -> resultsArray.add(generateSound(sound))); return resultsArray; } } diff --git a/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java b/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java index 72c79511..e31e41b0 100644 --- a/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java +++ b/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java @@ -2,32 +2,32 @@ import com.google.gson.JsonArray; import com.google.gson.JsonObject; -import dev.u9g.minecraftdatagenerator.clientsideannoyances.BlockColors; -import dev.u9g.minecraftdatagenerator.clientsideannoyances.FoliageColors; -import dev.u9g.minecraftdatagenerator.clientsideannoyances.GrassColors; -import dev.u9g.minecraftdatagenerator.clientsideannoyances.ServerSideRedstoneWireBlock; import dev.u9g.minecraftdatagenerator.mixin.BiomeAccessor; import dev.u9g.minecraftdatagenerator.util.DGU; import dev.u9g.minecraftdatagenerator.util.Registries; import net.minecraft.block.Block; import net.minecraft.block.Blocks; import net.minecraft.block.RedstoneWireBlock; +import net.minecraft.client.BlockColors; +import net.minecraft.client.color.world.FoliageColors; +import net.minecraft.client.color.world.GrassColors; import net.minecraft.util.Identifier; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.MathHelper; import net.minecraft.world.biome.Biome; import java.util.*; public class TintsDataGenerator implements IDataGenerator { - - private static final BlockColors blockColors = BlockColors.create(); - public static BiomeTintColors generateBiomeTintColors() { BiomeTintColors colors = new BiomeTintColors(); for (Biome biome : Registries.BIOMES) { - int biomeGrassColor = GrassColors.getGrassColor(biome); - int biomeFoliageColor = FoliageColors.getFoliageColor(biome); + double d = MathHelper.clamp(biome.getTemperature(), 0.0f, 1.0f); + double e = MathHelper.clamp(biome.getRainfall(), 0.0f, 1.0f); + + int biomeGrassColor = GrassColors.getColor(d, e); + int biomeFoliageColor = FoliageColors.getColor(d, e); int biomeWaterColor = ((BiomeAccessor) biome).waterColor(); colors.grassColoursMap.computeIfAbsent(biomeGrassColor, k -> new ArrayList<>()).add(biome); @@ -41,19 +41,18 @@ public static Map generateRedstoneTintColors() { Map resultColors = new HashMap<>(); for (int redstoneLevel : RedstoneWireBlock.POWER.getValues()) { - int color = ServerSideRedstoneWireBlock.getWireColor(redstoneLevel); + int color = RedstoneWireBlock.getColorIntensity(redstoneLevel); resultColors.put(redstoneLevel, color); } return resultColors; } private static int getBlockColor(Block block) { - return blockColors.method_13410(block.getDefaultState(), DGU.getWorld(), BlockPos.ORIGIN); + return BlockColors.create().method_13410(block.getDefaultState(), DGU.getWorld(), BlockPos.ORIGIN); } public static Map generateConstantTintColors() { Map resultColors = new HashMap<>(); - BlockColors blockColors = BlockColors.create(); // FIXME: ? // resultColors.put(Blocks.BIRCH_LEAVES, FoliageColors.getBirchColor()); // resultColors.put(Blocks.SPRUCE_LEAVES, FoliageColors.getSpruceColor()); diff --git a/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/mixin/NoteBlockAccessor.java b/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/mixin/NoteBlockAccessor.java index 4bc3bcb9..688aa1c6 100644 --- a/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/mixin/NoteBlockAccessor.java +++ b/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/mixin/NoteBlockAccessor.java @@ -1,7 +1,7 @@ package dev.u9g.minecraftdatagenerator.mixin; import net.minecraft.block.NoteBlock; -import net.minecraft.client.sound.SoundEvent; +import net.minecraft.sound.Sound; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.gen.Accessor; @@ -10,7 +10,7 @@ @Mixin(NoteBlock.class) public interface NoteBlockAccessor { @Accessor("TUNES") - static List TUNES() { + static List TUNES() { return null; } } diff --git a/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/mixin/SoundAccessor.java b/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/mixin/SoundAccessor.java index fe505910..d39eac0b 100644 --- a/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/mixin/SoundAccessor.java +++ b/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/mixin/SoundAccessor.java @@ -1,11 +1,11 @@ package dev.u9g.minecraftdatagenerator.mixin; -import net.minecraft.client.sound.SoundEvent; +import net.minecraft.sound.Sound; import net.minecraft.util.Identifier; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.gen.Accessor; -@Mixin(SoundEvent.class) +@Mixin(Sound.class) public interface SoundAccessor { @Accessor("id") Identifier id(); diff --git a/1.12.2/src/main/resources/fabric.mod.json b/1.12.2/src/main/resources/fabric.mod.json index 12f9d70e..ffac96b0 100644 --- a/1.12.2/src/main/resources/fabric.mod.json +++ b/1.12.2/src/main/resources/fabric.mod.json @@ -10,7 +10,6 @@ ], "contact": {}, "license": "MIT", - "environment": "server", "mixins": [ "minecraft-data-generator.mixins.json" ], diff --git a/1.12.2/src/main/resources/minecraft-data-generator.mixins.json b/1.12.2/src/main/resources/minecraft-data-generator.mixins.json index fcdcd1a0..86922042 100644 --- a/1.12.2/src/main/resources/minecraft-data-generator.mixins.json +++ b/1.12.2/src/main/resources/minecraft-data-generator.mixins.json @@ -15,8 +15,6 @@ "SoundAccessor", "StatusEffectAccessor" ], - "client": [ - ], "injectors": { "defaultRequire": 1 }, diff --git a/1.13/build.gradle b/1.13/build.gradle index 735609c5..82aa45ab 100644 --- a/1.13/build.gradle +++ b/1.13/build.gradle @@ -1,53 +1,44 @@ -import net.fabricmc.loom.configuration.providers.minecraft.MinecraftJarConfiguration +import xyz.wagyourtail.unimined.internal.minecraft.MinecraftProvider plugins { - id 'fabric-loom' + id 'xyz.wagyourtail.unimined' } repositories { maven { - name = "legacy-fabric" - url = "https://maven.legacyfabric.net" + name = "wagyourtail releases" + url = "https://maven.wagyourtail.xyz/releases" } + maven { + name = "legacyfabric" + url "https://maven.legacyfabric.net/" + } + mavenCentral() } -loom { - setIntermediaryUrl('https://maven.legacyfabric.net/net/fabricmc/intermediary/%1$s/intermediary-%1$s-v2.jar') - customMinecraftManifest.set("https://meta.legacyfabric.net/v2/manifest/${minecraft_version}") +unimined.minecraft { + version "1.13.2" - minecraftJarConfiguration = MinecraftJarConfiguration.MERGED -} + mappings { + legacyIntermediary() + legacyYarn(541) -dependencies { - minecraft "com.mojang:minecraft:${project.minecraft_version}" - mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" - modImplementation libs.fabric.loader - - // Fabric API provides hooks for events, item registration, and more. As most mods will need this, it's included by default. - // If you know for a fact you don't, it's not required and can be safely removed. -// modImplementation ("net.legacyfabric.legacy-fabric-api:legacy-fabric-api:${fabric_version}") { -// exclude module: "legacy-fabric-entity-events-v1" -// } + devFallbackNamespace "intermediary" + } - implementation(project(":common")) + runs.config("server") { + javaVersion = JavaVersion.VERSION_21 + } - if (System.getProperty("os.name").toLowerCase().contains("mac")) { - implementation 'org.lwjgl.lwjgl:lwjgl_util:2.9.4-nightly-20150209' - implementation 'org.lwjgl.lwjgl:lwjgl:2.9.4-nightly-20150209' - implementation 'org.lwjgl.lwjgl:lwjgl-platform:2.9.4-nightly-20150209' + customPatcher(new CustomLegacyFabricMinecraftTransformer(project, delegate as MinecraftProvider)) { + it.loader libs.versions.fabric.loader.get() } + + defaultRemapJar = true } -if (System.getProperty("os.name").toLowerCase().contains("mac")) { - configurations.configureEach { - resolutionStrategy { - dependencySubstitution { - substitute module('org.lwjgl.lwjgl:lwjgl_util:2.9.2-nightly-201408222') with module('org.lwjgl.lwjgl:lwjgl_util:2.9.4-nightly-20150209') - substitute module('org.lwjgl.lwjgl:lwjgl:2.9.2-nightly-201408222') with module('org.lwjgl.lwjgl:lwjgl:2.9.4-nightly-20150209') - } - force 'org.lwjgl.lwjgl:lwjgl-platform:2.9.4-nightly-20150209' - } - } +dependencies { + implementation project(":common") } processResources { @@ -61,9 +52,3 @@ processResources { tasks.withType(JavaCompile).configureEach { it.options.encoding = "UTF-8" } - -java { - toolchain { - languageVersion.set(JavaLanguageVersion.of(17)) - } -} diff --git a/1.13/gradle.properties b/1.13/gradle.properties deleted file mode 100644 index ee020d0f..00000000 --- a/1.13/gradle.properties +++ /dev/null @@ -1,7 +0,0 @@ -# Fabric Properties -# More versions available at: https://grayray75.github.io/LegacyFabric-Versions/ -minecraft_version=1.13.2 -yarn_mappings=1.13.2+build.202206020145 -# Dependencies -# More versions available at: https://grayray75.github.io/LegacyFabric-Versions/ -fabric_version = 1.4.2+1.8.9 diff --git a/1.13/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/BiomeColors.java b/1.13/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/BiomeColors.java deleted file mode 100644 index a661211e..00000000 --- a/1.13/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/BiomeColors.java +++ /dev/null @@ -1,49 +0,0 @@ -package dev.u9g.minecraftdatagenerator.clientsideannoyances; - -import net.minecraft.client.MinecraftClient; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.RenderBlockView; -import net.minecraft.world.biome.Biome; - -import java.util.Iterator; - -public class BiomeColors { - private static final ColorProvider field_21146 = Biome::getGrassColor; - private static final ColorProvider field_21147 = Biome::getFoliageColor; - private static final ColorProvider field_21148 = (biome, blockPos) -> biome.getWaterColor(); - private static final ColorProvider field_21149 = (biome, blockPos) -> biome.method_16447(); - - private static int method_19682(RenderBlockView renderBlockView, BlockPos blockPos, ColorProvider colorProvider) { - int i = 0; - int j = 0; - int k = 0; - int l = MinecraftClient.getInstance().options.field_19979; - int m = (l * 2 + 1) * (l * 2 + 1); - - int n; - for (Iterator var8 = BlockPos.mutableIterate(blockPos.getX() - l, blockPos.getY(), blockPos.getZ() - l, blockPos.getX() + l, blockPos.getY(), blockPos.getZ() + l).iterator(); var8.hasNext(); k += n & 255) { - BlockPos.Mutable mutable = var8.next(); - n = colorProvider.getColor(renderBlockView.method_8577(mutable), mutable); - i += (n & 16711680) >> 16; - j += (n & '\uff00') >> 8; - } - - return (i / m & 255) << 16 | (j / m & 255) << 8 | k / m & 255; - } - - public static int method_19681(RenderBlockView renderBlockView, BlockPos blockPos) { - return method_19682(renderBlockView, blockPos, field_21146); - } - - public static int method_19684(RenderBlockView renderBlockView, BlockPos blockPos) { - return method_19682(renderBlockView, blockPos, field_21147); - } - - public static int method_19686(RenderBlockView renderBlockView, BlockPos blockPos) { - return method_19682(renderBlockView, blockPos, field_21148); - } - - interface ColorProvider { - int getColor(Biome biome, BlockPos blockPos); - } -} diff --git a/1.13/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/BlockColorable.java b/1.13/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/BlockColorable.java deleted file mode 100644 index f6baf129..00000000 --- a/1.13/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/BlockColorable.java +++ /dev/null @@ -1,10 +0,0 @@ -package dev.u9g.minecraftdatagenerator.clientsideannoyances; - -import net.minecraft.block.BlockState; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.RenderBlockView; -import org.jetbrains.annotations.Nullable; - -public interface BlockColorable { - int getColor(BlockState state, @Nullable RenderBlockView renderView, @Nullable BlockPos pos, int i); -} diff --git a/1.13/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/BlockColors.java b/1.13/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/BlockColors.java deleted file mode 100644 index a372bf64..00000000 --- a/1.13/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/BlockColors.java +++ /dev/null @@ -1,65 +0,0 @@ -package dev.u9g.minecraftdatagenerator.clientsideannoyances; - -import net.minecraft.block.*; -import net.minecraft.class_2181; -import net.minecraft.class_3721; -import net.minecraft.util.collection.IdList; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.registry.Registry; -import net.minecraft.world.RenderBlockView; -import net.minecraft.world.World; -import org.jetbrains.annotations.Nullable; - -public class BlockColors { - private final IdList BlockColor2Id = new IdList<>(32); - - public BlockColors() { - } - - public static BlockColors create() { - BlockColors blockColors = new BlockColors(); - blockColors.method_12158((blockState, renderBlockView, blockPos, i) -> renderBlockView != null && blockPos != null ? BiomeColors.method_19681(renderBlockView, blockState.getProperty(class_3721.field_18472) == class_2181.field_9374 ? blockPos.down() : blockPos) : -1, Blocks.LARGE_FERN, Blocks.TALL_GRASS); - blockColors.method_12158((blockState, renderBlockView, blockPos, i) -> renderBlockView != null && blockPos != null ? BiomeColors.method_19681(renderBlockView, blockPos) : GrassColors.getColor(0.5D, 1.0D), Blocks.GRASS_BLOCK, Blocks.FERN, Blocks.GRASS, Blocks.POTTED_FERN); - blockColors.method_12158((blockState, renderBlockView, blockPos, i) -> net.minecraft.client.color.world.FoliageColors.getSpruceColor(), Blocks.SPRUCE_LEAVES); - blockColors.method_12158((blockState, renderBlockView, blockPos, i) -> net.minecraft.client.color.world.FoliageColors.getBirchColor(), Blocks.BIRCH_LEAVES); - blockColors.method_12158((blockState, renderBlockView, blockPos, i) -> renderBlockView != null && blockPos != null ? BiomeColors.method_19684(renderBlockView, blockPos) : FoliageColors.getDefaultColor(), Blocks.OAK_LEAVES, Blocks.JUNGLE_LEAVES, Blocks.ACACIA_LEAVES, Blocks.DARK_OAK_LEAVES, Blocks.VINE); - blockColors.method_12158((blockState, renderBlockView, blockPos, i) -> renderBlockView != null && blockPos != null ? BiomeColors.method_19686(renderBlockView, blockPos) : -1, Blocks.WATER, Blocks.BUBBLE_COLUMN, Blocks.CAULDRON); - blockColors.method_12158((blockState, renderBlockView, blockPos, i) -> RedstoneWireBlock.method_8877(blockState.getProperty(RedstoneWireBlock.POWER)), Blocks.REDSTONE_WIRE); - blockColors.method_12158((blockState, renderBlockView, blockPos, i) -> renderBlockView != null && blockPos != null ? BiomeColors.method_19681(renderBlockView, blockPos) : -1, Blocks.SUGAR_CANE); - blockColors.method_12158((blockState, renderBlockView, blockPos, i) -> 14731036, Blocks.ATTACHED_MELON_STEM, Blocks.ATTACHED_PUMPKIN_STEM); - blockColors.method_12158((blockState, renderBlockView, blockPos, i) -> { - int j = blockState.getProperty(AttachedStemBlock.field_18518); - int k = j * 32; - int l = 255 - j * 8; - int m = j * 4; - return k << 16 | l << 8 | m; - }, Blocks.MELON_STEM, Blocks.PUMPKIN_STEM); - blockColors.method_12158((blockState, renderBlockView, blockPos, i) -> renderBlockView != null && blockPos != null ? 2129968 : 7455580, Blocks.LILY_PAD); - return blockColors; - } - - public int method_13410(BlockState blockState, World world, BlockPos blockPos) { - BlockColorable blockColorable = this.BlockColor2Id.fromId(Registry.BLOCK.getRawId(blockState.getBlock())); - if (blockColorable != null) { - return blockColorable.getColor(blockState, null, null, 0); - } else { - MaterialColor materialColor = blockState.method_16892(world, blockPos); - return materialColor != null ? materialColor.color : -1; - } - } - - public int method_18332(BlockState blockState, @Nullable RenderBlockView renderBlockView, @Nullable BlockPos blockPos, int i) { - BlockColorable blockColorable = this.BlockColor2Id.fromId(Registry.BLOCK.getRawId(blockState.getBlock())); - return blockColorable == null ? -1 : blockColorable.getColor(blockState, renderBlockView, blockPos, i); - } - - public void method_12158(BlockColorable blockColorable, Block... blocks) { - int var4 = blocks.length; - - for (Block block : blocks) { - this.BlockColor2Id.set(blockColorable, Registry.BLOCK.getRawId(block)); - } - - } -} - diff --git a/1.13/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/FoliageColors.java b/1.13/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/FoliageColors.java deleted file mode 100644 index 1d3f9480..00000000 --- a/1.13/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/FoliageColors.java +++ /dev/null @@ -1,36 +0,0 @@ -package dev.u9g.minecraftdatagenerator.clientsideannoyances; - -import net.minecraft.util.math.MathHelper; -import net.minecraft.world.biome.Biome; - -public class FoliageColors { - private static int[] colorMap = new int[65536]; - - public static void setColorMap(int[] pixels) { - colorMap = pixels; - } - - private static int getColor(double temperature, double humidity) { - int i = (int) ((1.0 - temperature) * 255.0); - int j = (int) ((1.0 - (humidity *= temperature)) * 255.0); - return colorMap[j << 8 | i]; - } - - public static int getSpruceColor() { - return 0x619961; - } - - public static int getBirchColor() { - return 8431445; - } - - public static int getDefaultColor() { - return 4764952; - } - - public static int getFoliageColor(Biome biome) { - double d = MathHelper.clamp(biome.getTemperature(), 0.0f, 1.0f); - double e = MathHelper.clamp(biome.getRainfall(), 0.0f, 1.0f); - return getColor(d, e); - } -} diff --git a/1.13/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/GrassColors.java b/1.13/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/GrassColors.java deleted file mode 100644 index 9d653723..00000000 --- a/1.13/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/GrassColors.java +++ /dev/null @@ -1,29 +0,0 @@ -package dev.u9g.minecraftdatagenerator.clientsideannoyances; - -import net.minecraft.util.math.MathHelper; -import net.minecraft.world.biome.Biome; - -public class GrassColors { - private static int[] colorMap = new int[65536]; - - public static void setColorMap(int[] map) { - colorMap = map; - } - - public static int getColor(double temperature, double humidity) { - int j = (int) ((1.0 - (humidity *= temperature)) * 255.0); - int i = (int) ((1.0 - temperature) * 255.0); - int k = j << 8 | i; - if (k > colorMap.length) { - return -65281; - } - return colorMap[k]; - } - - public static int getGrassColor(Biome biome) { - double d = MathHelper.clamp(biome.getTemperature(), 0.0f, 1.0f); - double e = MathHelper.clamp(biome.getRainfall(), 0.0f, 1.0f); - return getColor(d, e); - } -} - diff --git a/1.13/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/ServerSideRedstoneWireBlock.java b/1.13/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/ServerSideRedstoneWireBlock.java deleted file mode 100644 index f733e90f..00000000 --- a/1.13/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/ServerSideRedstoneWireBlock.java +++ /dev/null @@ -1,25 +0,0 @@ -package dev.u9g.minecraftdatagenerator.clientsideannoyances; - -import net.minecraft.util.math.MathHelper; - -public class ServerSideRedstoneWireBlock { - public static int getWireColor(int powerLevel) { - float f = (float) powerLevel / 15.0f; - float g = f * 0.6f + 0.4f; - if (powerLevel == 0) { - g = 0.3f; - } - float h = f * f * 0.7f - 0.5f; - float j = f * f * 0.6f - 0.7f; - if (h < 0.0f) { - h = 0.0f; - } - if (j < 0.0f) { - j = 0.0f; - } - int k = MathHelper.clamp((int) (g * 255.0f), 0, 255); - int l = MathHelper.clamp((int) (h * 255.0f), 0, 255); - int m = MathHelper.clamp((int) (j * 255.0f), 0, 255); - return 0xFF000000 | k << 16 | l << 8 | m; - } -} diff --git a/1.13/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java b/1.13/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java index d5c57af2..6e98cbf4 100644 --- a/1.13/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java +++ b/1.13/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java @@ -3,13 +3,12 @@ import com.google.gson.JsonArray; import com.google.gson.JsonObject; import dev.u9g.minecraftdatagenerator.mixin.SoundAccessor; -import net.minecraft.client.sound.SoundEvent; +import net.minecraft.sound.Sound; import net.minecraft.util.registry.Registry; - public class SoundsDataGenerator implements IDataGenerator { - public static JsonObject generateSound(Registry registry, SoundEvent soundEvent) { + public static JsonObject generateSound(Registry registry, Sound soundEvent) { JsonObject soundDesc = new JsonObject(); soundDesc.addProperty("id", registry.getRawId(soundEvent)); @@ -26,8 +25,8 @@ public String getDataName() { @Override public JsonArray generateDataJson() { JsonArray resultsArray = new JsonArray(); - Registry soundEventRegistry = Registry.SOUND_EVENT; - soundEventRegistry.forEach(sound -> resultsArray.add(generateSound(soundEventRegistry, (SoundEvent) sound))); + Registry soundEventRegistry = Registry.SOUND_EVENT; + soundEventRegistry.forEach(sound -> resultsArray.add(generateSound(soundEventRegistry, (Sound) sound))); return resultsArray; } } diff --git a/1.13/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java b/1.13/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java index 07935d7f..1664ff87 100644 --- a/1.13/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java +++ b/1.13/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java @@ -2,16 +2,16 @@ import com.google.gson.JsonArray; import com.google.gson.JsonObject; -import dev.u9g.minecraftdatagenerator.clientsideannoyances.BlockColors; -import dev.u9g.minecraftdatagenerator.clientsideannoyances.FoliageColors; -import dev.u9g.minecraftdatagenerator.clientsideannoyances.GrassColors; -import dev.u9g.minecraftdatagenerator.clientsideannoyances.ServerSideRedstoneWireBlock; import dev.u9g.minecraftdatagenerator.util.DGU; import net.minecraft.block.Block; import net.minecraft.block.Blocks; import net.minecraft.block.RedstoneWireBlock; +import net.minecraft.client.BlockColors; +import net.minecraft.client.color.world.FoliageColors; +import net.minecraft.client.color.world.GrassColors; import net.minecraft.util.Identifier; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.MathHelper; import net.minecraft.util.registry.Registry; import net.minecraft.world.biome.Biome; @@ -22,8 +22,11 @@ public class TintsDataGenerator implements IDataGenerator { public static BiomeTintColors generateBiomeTintColors(Registry biomeRegistry) { BiomeTintColors colors = new BiomeTintColors(); for (Biome biome : (Iterable) biomeRegistry) { - int biomeGrassColor = GrassColors.getGrassColor(biome); - int biomeFoliageColor = FoliageColors.getFoliageColor(biome); + double d = MathHelper.clamp(biome.getTemperature(), 0.0f, 1.0f); + double e = MathHelper.clamp(biome.getRainfall(), 0.0f, 1.0f); + + int biomeGrassColor = GrassColors.getColor(d, e); + int biomeFoliageColor = FoliageColors.getColor(d, e); int biomeWaterColor = biome.getWaterColor(); colors.grassColoursMap.computeIfAbsent(biomeGrassColor, k -> new ArrayList<>()).add(biome); @@ -37,7 +40,7 @@ public static Map generateRedstoneTintColors() { Map resultColors = new HashMap<>(); for (int redstoneLevel : RedstoneWireBlock.POWER.getValues()) { - int color = ServerSideRedstoneWireBlock.getWireColor(redstoneLevel); + int color = RedstoneWireBlock.getColorIntensity(redstoneLevel); resultColors.put(redstoneLevel, color); } return resultColors; diff --git a/1.13/src/main/java/dev/u9g/minecraftdatagenerator/mixin/SoundAccessor.java b/1.13/src/main/java/dev/u9g/minecraftdatagenerator/mixin/SoundAccessor.java index fe505910..d39eac0b 100644 --- a/1.13/src/main/java/dev/u9g/minecraftdatagenerator/mixin/SoundAccessor.java +++ b/1.13/src/main/java/dev/u9g/minecraftdatagenerator/mixin/SoundAccessor.java @@ -1,11 +1,11 @@ package dev.u9g.minecraftdatagenerator.mixin; -import net.minecraft.client.sound.SoundEvent; +import net.minecraft.sound.Sound; import net.minecraft.util.Identifier; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.gen.Accessor; -@Mixin(SoundEvent.class) +@Mixin(Sound.class) public interface SoundAccessor { @Accessor("id") Identifier id(); diff --git a/1.13/src/main/resources/fabric.mod.json b/1.13/src/main/resources/fabric.mod.json index 12f9d70e..ffac96b0 100644 --- a/1.13/src/main/resources/fabric.mod.json +++ b/1.13/src/main/resources/fabric.mod.json @@ -10,7 +10,6 @@ ], "contact": {}, "license": "MIT", - "environment": "server", "mixins": [ "minecraft-data-generator.mixins.json" ], diff --git a/1.13/src/main/resources/minecraft-data-generator.mixins.json b/1.13/src/main/resources/minecraft-data-generator.mixins.json index 1024905e..353587a2 100644 --- a/1.13/src/main/resources/minecraft-data-generator.mixins.json +++ b/1.13/src/main/resources/minecraft-data-generator.mixins.json @@ -9,8 +9,6 @@ "SoundAccessor", "StatusEffectAccessor" ], - "client": [ - ], "injectors": { "defaultRequire": 1 }, diff --git a/1.14/build.gradle b/1.14/build.gradle index 87f06fe3..fccfcbc7 100644 --- a/1.14/build.gradle +++ b/1.14/build.gradle @@ -1,23 +1,40 @@ -import net.fabricmc.loom.configuration.providers.minecraft.MinecraftJarConfiguration +import xyz.wagyourtail.unimined.internal.minecraft.MinecraftProvider plugins { - id 'fabric-loom' + id 'xyz.wagyourtail.unimined' } -loom { - minecraftJarConfiguration = MinecraftJarConfiguration.MERGED +repositories { + maven { + name = "wagyourtail releases" + url = "https://maven.wagyourtail.xyz/releases" + } + mavenCentral() } -dependencies { - // To change the versions see the gradle.properties file - minecraft "com.mojang:minecraft:${project.minecraft_version}" - mappings "net.fabricmc:yarn:${project.yarn_mappings}" - modImplementation libs.fabric.loader +unimined.minecraft { + version "1.14" + + mappings { + intermediary() + yarn(1) + + devFallbackNamespace "intermediary" + } + + runs.config("server") { + javaVersion = JavaVersion.VERSION_21 + } - // Fabric API. This is technically optional, but you probably want it anyway. - modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" + customPatcher(new CustomOfficialFabricMinecraftTransformer(project, delegate as MinecraftProvider)) { + it.loader libs.versions.fabric.loader.get() + } + + defaultRemapJar = true +} - implementation(project(":common")) +dependencies { + implementation project(":common") } processResources { @@ -31,9 +48,3 @@ processResources { tasks.withType(JavaCompile).configureEach { it.options.encoding = "UTF-8" } - -java { - toolchain { - languageVersion.set(JavaLanguageVersion.of(17)) - } -} diff --git a/1.14/gradle.properties b/1.14/gradle.properties deleted file mode 100644 index bcff68f1..00000000 --- a/1.14/gradle.properties +++ /dev/null @@ -1,7 +0,0 @@ -# Fabric Properties -# check these on https://modmuss50.me/fabric.html -minecraft_version=1.14 -yarn_mappings=1.14+build.21 -# Dependencies -# check this on https://modmuss50.me/fabric.html -fabric_version=0.3.0-pre+build.156 diff --git a/1.14/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/FoliageColors.java b/1.14/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/FoliageColors.java deleted file mode 100644 index f1068ebd..00000000 --- a/1.14/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/FoliageColors.java +++ /dev/null @@ -1,36 +0,0 @@ -package dev.u9g.minecraftdatagenerator.clientsideannoyances; - -import net.minecraft.util.math.MathHelper; -import net.minecraft.world.biome.Biome; - -public class FoliageColors { - private static int[] colorMap = new int[65536]; - - public static void setColorMap(int[] pixels) { - colorMap = pixels; - } - - public static int getColor(double temperature, double humidity) { - int i = (int) ((1.0 - temperature) * 255.0); - int j = (int) ((1.0 - (humidity *= temperature)) * 255.0); - return colorMap[j << 8 | i]; - } - - public static int getSpruceColor() { - return 0x619961; - } - - public static int getBirchColor() { - return 8431445; - } - - public static int getDefaultColor() { - return 4764952; - } - - public static int getFoliageColor(Biome biome) { - double d = MathHelper.clamp(biome.getTemperature(), 0.0f, 1.0f); - double e = MathHelper.clamp(biome.getRainfall(), 0.0f, 1.0f); - return getColor(d, e); - } -} diff --git a/1.14/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/GrassColors.java b/1.14/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/GrassColors.java deleted file mode 100644 index 91270912..00000000 --- a/1.14/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/GrassColors.java +++ /dev/null @@ -1,29 +0,0 @@ -package dev.u9g.minecraftdatagenerator.clientsideannoyances; - -import net.minecraft.util.math.MathHelper; -import net.minecraft.world.biome.Biome; - -public class GrassColors { - private static int[] colorMap = new int[65536]; - - public static void setColorMap(int[] is) { - colorMap = is; - } - - public static int getColor(double d, double e) { - int j = (int) ((1.0 - (e *= d)) * 255.0); - int i = (int) ((1.0 - d) * 255.0); - int k = j << 8 | i; - if (k > colorMap.length) { - return -65281; - } - return colorMap[k]; - } - - public static int getGrassColorAt(Biome biome) { - double d = MathHelper.clamp(biome.getTemperature(), 0.0f, 1.0f); - double e = MathHelper.clamp(biome.getRainfall(), 0.0f, 1.0f); - return getColor(d, e); - } -} - diff --git a/1.14/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/ServerSideRedstoneWireBlock.java b/1.14/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/ServerSideRedstoneWireBlock.java deleted file mode 100644 index f733e90f..00000000 --- a/1.14/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/ServerSideRedstoneWireBlock.java +++ /dev/null @@ -1,25 +0,0 @@ -package dev.u9g.minecraftdatagenerator.clientsideannoyances; - -import net.minecraft.util.math.MathHelper; - -public class ServerSideRedstoneWireBlock { - public static int getWireColor(int powerLevel) { - float f = (float) powerLevel / 15.0f; - float g = f * 0.6f + 0.4f; - if (powerLevel == 0) { - g = 0.3f; - } - float h = f * f * 0.7f - 0.5f; - float j = f * f * 0.6f - 0.7f; - if (h < 0.0f) { - h = 0.0f; - } - if (j < 0.0f) { - j = 0.0f; - } - int k = MathHelper.clamp((int) (g * 255.0f), 0, 255); - int l = MathHelper.clamp((int) (h * 255.0f), 0, 255); - int m = MathHelper.clamp((int) (j * 255.0f), 0, 255); - return 0xFF000000 | k << 16 | l << 8 | m; - } -} diff --git a/1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java b/1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java index b3a24c6b..b7cafae2 100644 --- a/1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java +++ b/1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java @@ -3,13 +3,12 @@ import com.google.gson.JsonArray; import com.google.gson.JsonObject; import dev.u9g.minecraftdatagenerator.mixin.SoundAccessor; -import net.minecraft.sound.SoundEvent; +import net.minecraft.client.sound.Sound; import net.minecraft.util.registry.Registry; - public class SoundsDataGenerator implements IDataGenerator { - public static JsonObject generateSound(Registry registry, SoundEvent soundEvent) { + public static JsonObject generateSound(Registry registry, Sound soundEvent) { JsonObject soundDesc = new JsonObject(); soundDesc.addProperty("id", registry.getRawId(soundEvent)); @@ -26,7 +25,7 @@ public String getDataName() { @Override public JsonArray generateDataJson() { JsonArray resultsArray = new JsonArray(); - Registry soundEventRegistry = Registry.SOUND_EVENT; + Registry soundEventRegistry = Registry.SOUND_EVENT; soundEventRegistry.forEach(sound -> resultsArray.add(generateSound(soundEventRegistry, sound))); return resultsArray; } diff --git a/1.14/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java b/1.14/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java index af7e9c10..5184c462 100644 --- a/1.14/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java +++ b/1.14/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java @@ -13,6 +13,7 @@ public class ReadyMixin { @Inject(method = "setupServer()Z", at = @At("TAIL")) private void init(CallbackInfoReturnable cir) { + net.minecraft.server. MinecraftDataGenerator.start( MinecraftVersion.create().getName(), DGU.getCurrentlyRunningServer().getRunDirectory().toPath() diff --git a/1.14/src/main/java/dev/u9g/minecraftdatagenerator/mixin/SoundAccessor.java b/1.14/src/main/java/dev/u9g/minecraftdatagenerator/mixin/SoundAccessor.java index 34b44bc5..04755805 100644 --- a/1.14/src/main/java/dev/u9g/minecraftdatagenerator/mixin/SoundAccessor.java +++ b/1.14/src/main/java/dev/u9g/minecraftdatagenerator/mixin/SoundAccessor.java @@ -1,12 +1,11 @@ package dev.u9g.minecraftdatagenerator.mixin; - -import net.minecraft.sound.SoundEvent; +import net.minecraft.client.sound.Sound; import net.minecraft.util.Identifier; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.gen.Accessor; -@Mixin(SoundEvent.class) +@Mixin(Sound.class) public interface SoundAccessor { @Accessor("id") Identifier id(); diff --git a/1.14/src/main/resources/fabric.mod.json b/1.14/src/main/resources/fabric.mod.json index dff18a06..ffac96b0 100644 --- a/1.14/src/main/resources/fabric.mod.json +++ b/1.14/src/main/resources/fabric.mod.json @@ -10,13 +10,11 @@ ], "contact": {}, "license": "MIT", - "environment": "server", "mixins": [ "minecraft-data-generator.mixins.json" ], "depends": { "fabricloader": "*", - "fabric": "*", "minecraft": "*" } } diff --git a/1.15/build.gradle b/1.15/build.gradle index 9dd880c9..97bd892b 100644 --- a/1.15/build.gradle +++ b/1.15/build.gradle @@ -1,23 +1,40 @@ -import net.fabricmc.loom.configuration.providers.minecraft.MinecraftJarConfiguration +import xyz.wagyourtail.unimined.internal.minecraft.MinecraftProvider plugins { - id 'fabric-loom' + id 'xyz.wagyourtail.unimined' } -loom { - minecraftJarConfiguration = MinecraftJarConfiguration.MERGED +repositories { + maven { + name = "wagyourtail releases" + url = "https://maven.wagyourtail.xyz/releases" + } + mavenCentral() } -dependencies { - // To change the versions see the gradle.properties file - minecraft "com.mojang:minecraft:${project.minecraft_version}" - mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" - modImplementation libs.fabric.loader +unimined.minecraft { + version "1.15" + + mappings { + intermediary() + yarn(1) + + devFallbackNamespace "intermediary" + } + + runs.config("server") { + javaVersion = JavaVersion.VERSION_21 + } - // Fabric API. This is technically optional, but you probably want it anyway. - modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" + customPatcher(new CustomOfficialFabricMinecraftTransformer(project, delegate as MinecraftProvider)) { + it.loader libs.versions.fabric.loader.get() + } + + defaultRemapJar = true +} - implementation(project(":common")) +dependencies { + implementation project(":common") } processResources { @@ -31,9 +48,3 @@ processResources { tasks.withType(JavaCompile).configureEach { it.options.encoding = "UTF-8" } - -java { - toolchain { - languageVersion.set(JavaLanguageVersion.of(17)) - } -} diff --git a/1.15/gradle.properties b/1.15/gradle.properties deleted file mode 100644 index 9559f8a4..00000000 --- a/1.15/gradle.properties +++ /dev/null @@ -1,7 +0,0 @@ -# Fabric Properties -# check these on https://modmuss50.me/fabric.html -minecraft_version=1.15 -yarn_mappings=1.15+build.2 -# Dependencies -# check this on https://modmuss50.me/fabric.html -fabric_version=0.28.5+1.15 diff --git a/1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java b/1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java index b3a24c6b..8cc66613 100644 --- a/1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java +++ b/1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java @@ -3,16 +3,16 @@ import com.google.gson.JsonArray; import com.google.gson.JsonObject; import dev.u9g.minecraftdatagenerator.mixin.SoundAccessor; +import net.minecraft.client.sound.Sound; import net.minecraft.sound.SoundEvent; import net.minecraft.util.registry.Registry; - public class SoundsDataGenerator implements IDataGenerator { - public static JsonObject generateSound(Registry registry, SoundEvent soundEvent) { + public static JsonObject generateSound(SoundEvent soundEvent) { JsonObject soundDesc = new JsonObject(); - soundDesc.addProperty("id", registry.getRawId(soundEvent)); + soundDesc.addProperty("id", Registry.SOUND_EVENT.getRawId(soundEvent)); soundDesc.addProperty("name", ((SoundAccessor) soundEvent).id().getPath()); return soundDesc; @@ -26,8 +26,7 @@ public String getDataName() { @Override public JsonArray generateDataJson() { JsonArray resultsArray = new JsonArray(); - Registry soundEventRegistry = Registry.SOUND_EVENT; - soundEventRegistry.forEach(sound -> resultsArray.add(generateSound(soundEventRegistry, sound))); + Registry.SOUND_EVENT.forEach(sound -> resultsArray.add(generateSound(sound))); return resultsArray; } } diff --git a/1.15/src/main/java/dev/u9g/minecraftdatagenerator/mixin/SoundAccessor.java b/1.15/src/main/java/dev/u9g/minecraftdatagenerator/mixin/SoundAccessor.java index 34b44bc5..04755805 100644 --- a/1.15/src/main/java/dev/u9g/minecraftdatagenerator/mixin/SoundAccessor.java +++ b/1.15/src/main/java/dev/u9g/minecraftdatagenerator/mixin/SoundAccessor.java @@ -1,12 +1,11 @@ package dev.u9g.minecraftdatagenerator.mixin; - -import net.minecraft.sound.SoundEvent; +import net.minecraft.client.sound.Sound; import net.minecraft.util.Identifier; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.gen.Accessor; -@Mixin(SoundEvent.class) +@Mixin(Sound.class) public interface SoundAccessor { @Accessor("id") Identifier id(); diff --git a/1.15/src/main/resources/fabric.mod.json b/1.15/src/main/resources/fabric.mod.json index dff18a06..ffac96b0 100644 --- a/1.15/src/main/resources/fabric.mod.json +++ b/1.15/src/main/resources/fabric.mod.json @@ -10,13 +10,11 @@ ], "contact": {}, "license": "MIT", - "environment": "server", "mixins": [ "minecraft-data-generator.mixins.json" ], "depends": { "fabricloader": "*", - "fabric": "*", "minecraft": "*" } } diff --git a/1.16/build.gradle b/1.16/build.gradle index 9dd880c9..85f3a287 100644 --- a/1.16/build.gradle +++ b/1.16/build.gradle @@ -1,23 +1,40 @@ -import net.fabricmc.loom.configuration.providers.minecraft.MinecraftJarConfiguration +import xyz.wagyourtail.unimined.internal.minecraft.MinecraftProvider plugins { - id 'fabric-loom' + id 'xyz.wagyourtail.unimined' } -loom { - minecraftJarConfiguration = MinecraftJarConfiguration.MERGED +repositories { + maven { + name = "wagyourtail releases" + url = "https://maven.wagyourtail.xyz/releases" + } + mavenCentral() } -dependencies { - // To change the versions see the gradle.properties file - minecraft "com.mojang:minecraft:${project.minecraft_version}" - mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" - modImplementation libs.fabric.loader +unimined.minecraft { + version "1.16" + + mappings { + intermediary() + yarn(1) + + devFallbackNamespace "intermediary" + } + + runs.config("server") { + javaVersion = JavaVersion.VERSION_21 + } - // Fabric API. This is technically optional, but you probably want it anyway. - modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" + customPatcher(new CustomOfficialFabricMinecraftTransformer(project, delegate as MinecraftProvider)) { + it.loader libs.versions.fabric.loader.get() + } + + defaultRemapJar = true +} - implementation(project(":common")) +dependencies { + implementation project(":common") } processResources { @@ -31,9 +48,3 @@ processResources { tasks.withType(JavaCompile).configureEach { it.options.encoding = "UTF-8" } - -java { - toolchain { - languageVersion.set(JavaLanguageVersion.of(17)) - } -} diff --git a/1.16/gradle.properties b/1.16/gradle.properties deleted file mode 100644 index 79322a12..00000000 --- a/1.16/gradle.properties +++ /dev/null @@ -1,8 +0,0 @@ -# Fabric Properties -# check these on https://modmuss50.me/fabric.html -minecraft_version=1.16 -yarn_mappings=1.16+build.4 -# Dependencies -# check this on https://modmuss50.me/fabric.html -# fabric_version=0.36.0+1.17 -fabric_version=0.13.1+build.370-1.16 diff --git a/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java b/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java index b3a24c6b..8cc66613 100644 --- a/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java +++ b/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java @@ -3,16 +3,16 @@ import com.google.gson.JsonArray; import com.google.gson.JsonObject; import dev.u9g.minecraftdatagenerator.mixin.SoundAccessor; +import net.minecraft.client.sound.Sound; import net.minecraft.sound.SoundEvent; import net.minecraft.util.registry.Registry; - public class SoundsDataGenerator implements IDataGenerator { - public static JsonObject generateSound(Registry registry, SoundEvent soundEvent) { + public static JsonObject generateSound(SoundEvent soundEvent) { JsonObject soundDesc = new JsonObject(); - soundDesc.addProperty("id", registry.getRawId(soundEvent)); + soundDesc.addProperty("id", Registry.SOUND_EVENT.getRawId(soundEvent)); soundDesc.addProperty("name", ((SoundAccessor) soundEvent).id().getPath()); return soundDesc; @@ -26,8 +26,7 @@ public String getDataName() { @Override public JsonArray generateDataJson() { JsonArray resultsArray = new JsonArray(); - Registry soundEventRegistry = Registry.SOUND_EVENT; - soundEventRegistry.forEach(sound -> resultsArray.add(generateSound(soundEventRegistry, sound))); + Registry.SOUND_EVENT.forEach(sound -> resultsArray.add(generateSound(sound))); return resultsArray; } } diff --git a/1.16/src/main/java/dev/u9g/minecraftdatagenerator/mixin/SoundAccessor.java b/1.16/src/main/java/dev/u9g/minecraftdatagenerator/mixin/SoundAccessor.java index 34b44bc5..04755805 100644 --- a/1.16/src/main/java/dev/u9g/minecraftdatagenerator/mixin/SoundAccessor.java +++ b/1.16/src/main/java/dev/u9g/minecraftdatagenerator/mixin/SoundAccessor.java @@ -1,12 +1,11 @@ package dev.u9g.minecraftdatagenerator.mixin; - -import net.minecraft.sound.SoundEvent; +import net.minecraft.client.sound.Sound; import net.minecraft.util.Identifier; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.gen.Accessor; -@Mixin(SoundEvent.class) +@Mixin(Sound.class) public interface SoundAccessor { @Accessor("id") Identifier id(); diff --git a/1.16/src/main/resources/fabric.mod.json b/1.16/src/main/resources/fabric.mod.json index dff18a06..ffac96b0 100644 --- a/1.16/src/main/resources/fabric.mod.json +++ b/1.16/src/main/resources/fabric.mod.json @@ -10,13 +10,11 @@ ], "contact": {}, "license": "MIT", - "environment": "server", "mixins": [ "minecraft-data-generator.mixins.json" ], "depends": { "fabricloader": "*", - "fabric": "*", "minecraft": "*" } } diff --git a/1.17/build.gradle b/1.17/build.gradle index 9dd880c9..84832c50 100644 --- a/1.17/build.gradle +++ b/1.17/build.gradle @@ -1,23 +1,40 @@ -import net.fabricmc.loom.configuration.providers.minecraft.MinecraftJarConfiguration +import xyz.wagyourtail.unimined.internal.minecraft.MinecraftProvider plugins { - id 'fabric-loom' + id 'xyz.wagyourtail.unimined' } -loom { - minecraftJarConfiguration = MinecraftJarConfiguration.MERGED +repositories { + maven { + name = "wagyourtail releases" + url = "https://maven.wagyourtail.xyz/releases" + } + mavenCentral() } -dependencies { - // To change the versions see the gradle.properties file - minecraft "com.mojang:minecraft:${project.minecraft_version}" - mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" - modImplementation libs.fabric.loader +unimined.minecraft { + version "1.17" + + mappings { + intermediary() + yarn(1) + + devFallbackNamespace "intermediary" + } + + runs.config("server") { + javaVersion = JavaVersion.VERSION_21 + } - // Fabric API. This is technically optional, but you probably want it anyway. - modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" + customPatcher(new CustomOfficialFabricMinecraftTransformer(project, delegate as MinecraftProvider)) { + it.loader libs.versions.fabric.loader.get() + } + + defaultRemapJar = true +} - implementation(project(":common")) +dependencies { + implementation project(":common") } processResources { @@ -31,9 +48,3 @@ processResources { tasks.withType(JavaCompile).configureEach { it.options.encoding = "UTF-8" } - -java { - toolchain { - languageVersion.set(JavaLanguageVersion.of(17)) - } -} diff --git a/1.17/gradle.properties b/1.17/gradle.properties deleted file mode 100644 index 08f9d5ac..00000000 --- a/1.17/gradle.properties +++ /dev/null @@ -1,7 +0,0 @@ -# Fabric Properties -# check these on https://modmuss50.me/fabric.html -minecraft_version=1.17 -yarn_mappings=1.17+build.13 -# Dependencies -# check this on https://modmuss50.me/fabric.html -fabric_version=0.36.0+1.17 diff --git a/1.17/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java b/1.17/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java index b3a24c6b..8cc66613 100644 --- a/1.17/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java +++ b/1.17/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java @@ -3,16 +3,16 @@ import com.google.gson.JsonArray; import com.google.gson.JsonObject; import dev.u9g.minecraftdatagenerator.mixin.SoundAccessor; +import net.minecraft.client.sound.Sound; import net.minecraft.sound.SoundEvent; import net.minecraft.util.registry.Registry; - public class SoundsDataGenerator implements IDataGenerator { - public static JsonObject generateSound(Registry registry, SoundEvent soundEvent) { + public static JsonObject generateSound(SoundEvent soundEvent) { JsonObject soundDesc = new JsonObject(); - soundDesc.addProperty("id", registry.getRawId(soundEvent)); + soundDesc.addProperty("id", Registry.SOUND_EVENT.getRawId(soundEvent)); soundDesc.addProperty("name", ((SoundAccessor) soundEvent).id().getPath()); return soundDesc; @@ -26,8 +26,7 @@ public String getDataName() { @Override public JsonArray generateDataJson() { JsonArray resultsArray = new JsonArray(); - Registry soundEventRegistry = Registry.SOUND_EVENT; - soundEventRegistry.forEach(sound -> resultsArray.add(generateSound(soundEventRegistry, sound))); + Registry.SOUND_EVENT.forEach(sound -> resultsArray.add(generateSound(sound))); return resultsArray; } } diff --git a/1.17/src/main/java/dev/u9g/minecraftdatagenerator/mixin/SoundAccessor.java b/1.17/src/main/java/dev/u9g/minecraftdatagenerator/mixin/SoundAccessor.java index 34b44bc5..04755805 100644 --- a/1.17/src/main/java/dev/u9g/minecraftdatagenerator/mixin/SoundAccessor.java +++ b/1.17/src/main/java/dev/u9g/minecraftdatagenerator/mixin/SoundAccessor.java @@ -1,12 +1,11 @@ package dev.u9g.minecraftdatagenerator.mixin; - -import net.minecraft.sound.SoundEvent; +import net.minecraft.client.sound.Sound; import net.minecraft.util.Identifier; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.gen.Accessor; -@Mixin(SoundEvent.class) +@Mixin(Sound.class) public interface SoundAccessor { @Accessor("id") Identifier id(); diff --git a/1.17/src/main/resources/fabric.mod.json b/1.17/src/main/resources/fabric.mod.json index dff18a06..ffac96b0 100644 --- a/1.17/src/main/resources/fabric.mod.json +++ b/1.17/src/main/resources/fabric.mod.json @@ -10,13 +10,11 @@ ], "contact": {}, "license": "MIT", - "environment": "server", "mixins": [ "minecraft-data-generator.mixins.json" ], "depends": { "fabricloader": "*", - "fabric": "*", "minecraft": "*" } } diff --git a/1.18/build.gradle b/1.18/build.gradle index 9dd880c9..d1a7f67a 100644 --- a/1.18/build.gradle +++ b/1.18/build.gradle @@ -1,23 +1,40 @@ -import net.fabricmc.loom.configuration.providers.minecraft.MinecraftJarConfiguration +import xyz.wagyourtail.unimined.internal.minecraft.MinecraftProvider plugins { - id 'fabric-loom' + id 'xyz.wagyourtail.unimined' } -loom { - minecraftJarConfiguration = MinecraftJarConfiguration.MERGED +repositories { + maven { + name = "wagyourtail releases" + url = "https://maven.wagyourtail.xyz/releases" + } + mavenCentral() } -dependencies { - // To change the versions see the gradle.properties file - minecraft "com.mojang:minecraft:${project.minecraft_version}" - mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" - modImplementation libs.fabric.loader +unimined.minecraft { + version "1.18" + + mappings { + intermediary() + yarn(1) + + devFallbackNamespace "intermediary" + } + + runs.config("server") { + javaVersion = JavaVersion.VERSION_21 + } - // Fabric API. This is technically optional, but you probably want it anyway. - modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" + customPatcher(new CustomOfficialFabricMinecraftTransformer(project, delegate as MinecraftProvider)) { + it.loader libs.versions.fabric.loader.get() + } + + defaultRemapJar = true +} - implementation(project(":common")) +dependencies { + implementation project(":common") } processResources { @@ -31,9 +48,3 @@ processResources { tasks.withType(JavaCompile).configureEach { it.options.encoding = "UTF-8" } - -java { - toolchain { - languageVersion.set(JavaLanguageVersion.of(17)) - } -} diff --git a/1.18/gradle.properties b/1.18/gradle.properties deleted file mode 100644 index 33aea2f5..00000000 --- a/1.18/gradle.properties +++ /dev/null @@ -1,7 +0,0 @@ -# Fabric Properties -# check these on https://modmuss50.me/fabric.html -minecraft_version=1.18 -yarn_mappings=1.18+build.1 -# Dependencies -# check this on https://modmuss50.me/fabric.html -fabric_version=0.44.0+1.18 diff --git a/1.18/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java b/1.18/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java index b3a24c6b..8cc66613 100644 --- a/1.18/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java +++ b/1.18/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java @@ -3,16 +3,16 @@ import com.google.gson.JsonArray; import com.google.gson.JsonObject; import dev.u9g.minecraftdatagenerator.mixin.SoundAccessor; +import net.minecraft.client.sound.Sound; import net.minecraft.sound.SoundEvent; import net.minecraft.util.registry.Registry; - public class SoundsDataGenerator implements IDataGenerator { - public static JsonObject generateSound(Registry registry, SoundEvent soundEvent) { + public static JsonObject generateSound(SoundEvent soundEvent) { JsonObject soundDesc = new JsonObject(); - soundDesc.addProperty("id", registry.getRawId(soundEvent)); + soundDesc.addProperty("id", Registry.SOUND_EVENT.getRawId(soundEvent)); soundDesc.addProperty("name", ((SoundAccessor) soundEvent).id().getPath()); return soundDesc; @@ -26,8 +26,7 @@ public String getDataName() { @Override public JsonArray generateDataJson() { JsonArray resultsArray = new JsonArray(); - Registry soundEventRegistry = Registry.SOUND_EVENT; - soundEventRegistry.forEach(sound -> resultsArray.add(generateSound(soundEventRegistry, sound))); + Registry.SOUND_EVENT.forEach(sound -> resultsArray.add(generateSound(sound))); return resultsArray; } } diff --git a/1.18/src/main/java/dev/u9g/minecraftdatagenerator/mixin/SoundAccessor.java b/1.18/src/main/java/dev/u9g/minecraftdatagenerator/mixin/SoundAccessor.java index 34b44bc5..04755805 100644 --- a/1.18/src/main/java/dev/u9g/minecraftdatagenerator/mixin/SoundAccessor.java +++ b/1.18/src/main/java/dev/u9g/minecraftdatagenerator/mixin/SoundAccessor.java @@ -1,12 +1,11 @@ package dev.u9g.minecraftdatagenerator.mixin; - -import net.minecraft.sound.SoundEvent; +import net.minecraft.client.sound.Sound; import net.minecraft.util.Identifier; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.gen.Accessor; -@Mixin(SoundEvent.class) +@Mixin(Sound.class) public interface SoundAccessor { @Accessor("id") Identifier id(); diff --git a/1.18/src/main/resources/fabric.mod.json b/1.18/src/main/resources/fabric.mod.json index dff18a06..ffac96b0 100644 --- a/1.18/src/main/resources/fabric.mod.json +++ b/1.18/src/main/resources/fabric.mod.json @@ -10,13 +10,11 @@ ], "contact": {}, "license": "MIT", - "environment": "server", "mixins": [ "minecraft-data-generator.mixins.json" ], "depends": { "fabricloader": "*", - "fabric": "*", "minecraft": "*" } } diff --git a/1.19.2/build.gradle b/1.19.2/build.gradle index 9dd880c9..372ee878 100644 --- a/1.19.2/build.gradle +++ b/1.19.2/build.gradle @@ -1,23 +1,40 @@ -import net.fabricmc.loom.configuration.providers.minecraft.MinecraftJarConfiguration +import xyz.wagyourtail.unimined.internal.minecraft.MinecraftProvider plugins { - id 'fabric-loom' + id 'xyz.wagyourtail.unimined' } -loom { - minecraftJarConfiguration = MinecraftJarConfiguration.MERGED +repositories { + maven { + name = "wagyourtail releases" + url = "https://maven.wagyourtail.xyz/releases" + } + mavenCentral() } -dependencies { - // To change the versions see the gradle.properties file - minecraft "com.mojang:minecraft:${project.minecraft_version}" - mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" - modImplementation libs.fabric.loader +unimined.minecraft { + version "1.19.2" + + mappings { + intermediary() + yarn(1) + + devFallbackNamespace "intermediary" + } + + runs.config("server") { + javaVersion = JavaVersion.VERSION_21 + } - // Fabric API. This is technically optional, but you probably want it anyway. - modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" + customPatcher(new CustomOfficialFabricMinecraftTransformer(project, delegate as MinecraftProvider)) { + it.loader libs.versions.fabric.loader.get() + } + + defaultRemapJar = true +} - implementation(project(":common")) +dependencies { + implementation project(":common") } processResources { @@ -31,9 +48,3 @@ processResources { tasks.withType(JavaCompile).configureEach { it.options.encoding = "UTF-8" } - -java { - toolchain { - languageVersion.set(JavaLanguageVersion.of(17)) - } -} diff --git a/1.19.2/gradle.properties b/1.19.2/gradle.properties deleted file mode 100644 index 1e749c16..00000000 --- a/1.19.2/gradle.properties +++ /dev/null @@ -1,7 +0,0 @@ -# Fabric Properties -# check these on https://modmuss50.me/fabric.html -minecraft_version=1.19.2 -yarn_mappings=1.19.2+build.28 -# Dependencies -# check this on https://modmuss50.me/fabric.html -fabric_version=0.67.0+1.19.2 diff --git a/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/BiomesDataGenerator.java b/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/BiomesDataGenerator.java index 88200df7..e53f198b 100644 --- a/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/BiomesDataGenerator.java +++ b/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/BiomesDataGenerator.java @@ -2,35 +2,25 @@ import com.google.gson.JsonArray; import com.google.gson.JsonObject; -import dev.u9g.minecraftdatagenerator.mixin.TheEndBiomeDataAccessor; import dev.u9g.minecraftdatagenerator.util.DGU; -import net.fabricmc.fabric.api.biome.v1.NetherBiomes; +import net.minecraft.tag.BiomeTags; import net.minecraft.util.Identifier; +import net.minecraft.util.registry.BuiltinRegistries; import net.minecraft.util.registry.DynamicRegistryManager; import net.minecraft.util.registry.Registry; import net.minecraft.util.registry.RegistryKey; import net.minecraft.world.biome.Biome; -import java.util.HashSet; -import java.util.Set; - public class BiomesDataGenerator implements IDataGenerator { - private static final Set> END_BIOMES = new HashSet<>(); - - static { - END_BIOMES.addAll(TheEndBiomeDataAccessor.END_BIOMES_MAP().keySet()); - END_BIOMES.addAll(TheEndBiomeDataAccessor.END_BARRENS_MAP().keySet()); - END_BIOMES.addAll(TheEndBiomeDataAccessor.END_MIDLANDS_MAP().keySet()); - } - - private static String guessBiomeDimensionFromCategory(Biome biome, String biomeName) { - var key = DynamicRegistryManager.BUILTIN.get().get(Registry.BIOME_KEY).getKey(biome).orElseThrow(); - if (NetherBiomes.canGenerateInNether(key)) { + private static String guessBiomeDimensionFromCategory(RegistryKey biome) { + var biomeRegistry = BuiltinRegistries.BIOME; + if (biomeRegistry.getEntry(biome).orElseThrow().isIn(BiomeTags.IS_NETHER)) { return "nether"; - } else if (END_BIOMES.contains(key) || biomeName.startsWith("end_")) { + } else if (biomeRegistry.getEntry(biome).orElseThrow().isIn(BiomeTags.IS_END)) { return "end"; + } else { + return "overworld"; } - return "overworld"; } private static String guessCategoryBasedOnName(String name, String dimension) { @@ -86,211 +76,22 @@ private static String guessCategoryBasedOnName(String name, String dimension) { } } - private static int getBiomeColorFor(String biomeName) { - switch (biomeName) { - case "the_void" -> { - return 0; - } - case "plains" -> { - return 9286496; - } - case "sunflower_plains" -> { - return 11918216; - } - case "snowy_plains" -> { - return 16777215; - } - case "ice_spikes" -> { - return 11853020; - } - case "desert" -> { - return 16421912; - } - case "swamp" -> { - return 522674; - } - case "forest" -> { - return 353825; - } - case "flower_forest" -> { - return 2985545; - } - case "birch_forest" -> { - return 3175492; - } - case "dark_forest" -> { - return 4215066; - } - case "old_growth_birch_forest" -> { - return 5807212; - } - case "old_growth_pine_taiga" -> { - return 5858897; - } - case "old_growth_spruce_taiga" -> { - return 8490617; - } - case "taiga" -> { - return 747097; - } - case "snowy_taiga" -> { - return 3233098; - } - case "savanna" -> { - return 12431967; - } - case "savanna_plateau" -> { - return 10984804; - } - case "windswept_hills" -> { - return 6316128; - } - case "windswept_gravelly_hills" -> { - return 8947848; - } - case "windswept_forest" -> { - return 2250012; - } - case "windswept_savanna" -> { - return 15063687; - } - case "jungle" -> { - return 5470985; - } - case "sparse_jungle" -> { - return 6458135; - } - case "bamboo_jungle" -> { - return 7769620; - } - case "badlands" -> { - return 14238997; - } - case "eroded_badlands" -> { - return 16739645; - } - case "wooded_badlands" -> { - return 11573093; - } - case "meadow" -> { - return 9217136; - } - case "grove" -> { - return 14675173; - } - case "snowy_slopes" -> { - return 14348785; - } - case "frozen_peaks" -> { - return 15399931; - } - case "jagged_peaks" -> { - return 14937325; - } - case "stony_peaks" -> { - return 13750737; - } - case "river" -> { - return 255; - } - case "frozen_river" -> { - return 10526975; - } - case "beach" -> { - return 16440917; - } - case "snowy_beach" -> { - return 16445632; - } - case "stony_shore" -> { - return 10658436; - } - case "warm_ocean" -> { - return 172; - } - case "lukewarm_ocean" -> { - return 144; - } - case "deep_lukewarm_ocean" -> { - return 64; - } - case "ocean" -> { - return 112; - } - case "deep_ocean" -> { - return 48; - } - case "cold_ocean" -> { - return 2105456; - } - case "deep_cold_ocean" -> { - return 2105400; - } - case "frozen_ocean" -> { - return 7368918; - } - case "deep_frozen_ocean" -> { - return 4210832; - } - case "mushroom_fields" -> { - return 16711935; - } - case "dripstone_caves" -> { - return 12690831; - } - case "lush_caves" -> { - return 14652980; - } - case "nether_wastes" -> { - return 12532539; - } - case "warped_forest" -> { - return 4821115; - } - case "crimson_forest" -> { - return 14485512; - } - case "soul_sand_valley" -> { - return 6174768; - } - case "basalt_deltas" -> { - return 4208182; - } - case "the_end" -> { - return 8421631; - } - case "end_highlands" -> { - return 12828041; - } - case "end_midlands" -> { - return 15464630; - } - case "small_end_islands" -> { - return 42; - } - case "end_barrens" -> { - return 9474162; - } - } - System.out.println("Don't know the color of biome: '" + biomeName + "'"); - return 0; - } - public static JsonObject generateBiomeInfo(Registry registry, Biome biome) { JsonObject biomeDesc = new JsonObject(); - Identifier registryKey = registry.getKey(biome).orElseThrow().getValue(); - String localizationKey = String.format("biome.%s.%s", registryKey.getNamespace(), registryKey.getPath()); - String name = registryKey.getPath(); + RegistryKey registryKey = registry.getKey(biome).orElseThrow(); + Identifier identifier = registryKey.getValue(); + String localizationKey = String.format("biome.%s.%s", identifier.getNamespace(), identifier.getPath()); + String name = identifier.getPath(); biomeDesc.addProperty("id", registry.getRawId(biome)); biomeDesc.addProperty("name", name); - String dimension = guessBiomeDimensionFromCategory(biome, name); + String dimension = guessBiomeDimensionFromCategory(registryKey); biomeDesc.addProperty("category", guessCategoryBasedOnName(name, dimension)); biomeDesc.addProperty("temperature", biome.getTemperature()); biomeDesc.addProperty("precipitation", biome.getPrecipitation().getName()); //biomeDesc.addProperty("depth", biome.getDepth()); - Doesn't exist anymore in minecraft source biomeDesc.addProperty("dimension", dimension); biomeDesc.addProperty("displayName", DGU.translateText(localizationKey)); - biomeDesc.addProperty("color", getBiomeColorFor(registryKey.getPath())); + biomeDesc.addProperty("color", biome.getSkyColor()); biomeDesc.addProperty("rainfall", biome.getDownfall()); return biomeDesc; diff --git a/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java b/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java index 804b0cec..451faaeb 100644 --- a/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java +++ b/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java @@ -2,16 +2,16 @@ import com.google.gson.JsonArray; import com.google.gson.JsonObject; +import net.minecraft.client.sound.Sound; import net.minecraft.sound.SoundEvent; import net.minecraft.util.registry.Registry; - public class SoundsDataGenerator implements IDataGenerator { - public static JsonObject generateSound(Registry registry, SoundEvent soundEvent) { + public static JsonObject generateSound(SoundEvent soundEvent) { JsonObject soundDesc = new JsonObject(); - soundDesc.addProperty("id", registry.getRawId(soundEvent) + 1); // the plus 1 is required for 1.19.2+ due to Mojang using 0 in the packet to say that you should read a string id instead. + soundDesc.addProperty("id", Registry.SOUND_EVENT.getRawId(soundEvent) + 1); // the plus 1 is required for 1.19.2+ due to Mojang using 0 in the packet to say that you should read a string id instead. soundDesc.addProperty("name", soundEvent.getId().getPath()); return soundDesc; @@ -25,8 +25,7 @@ public String getDataName() { @Override public JsonArray generateDataJson() { JsonArray resultsArray = new JsonArray(); - Registry soundEventRegistry = Registry.SOUND_EVENT; - soundEventRegistry.forEach(sound -> resultsArray.add(generateSound(soundEventRegistry, sound))); + Registry.SOUND_EVENT.forEach(sound -> resultsArray.add(generateSound(sound))); return resultsArray; } } diff --git a/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/mixin/TheEndBiomeDataAccessor.java b/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/mixin/TheEndBiomeDataAccessor.java deleted file mode 100644 index 2796b2a6..00000000 --- a/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/mixin/TheEndBiomeDataAccessor.java +++ /dev/null @@ -1,29 +0,0 @@ -package dev.u9g.minecraftdatagenerator.mixin; - -import net.fabricmc.fabric.impl.biome.TheEndBiomeData; -import net.fabricmc.fabric.impl.biome.WeightedPicker; -import net.minecraft.util.registry.RegistryKey; -import net.minecraft.world.biome.Biome; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.gen.Accessor; - -import java.util.Map; - - -@Mixin(TheEndBiomeData.class) -public interface TheEndBiomeDataAccessor { - @Accessor(value = "END_BIOMES_MAP", remap = false) - static Map, WeightedPicker>> END_BIOMES_MAP() { - throw new IllegalStateException("Should never be called."); - } - - @Accessor(value = "END_MIDLANDS_MAP", remap = false) - static Map, WeightedPicker>> END_MIDLANDS_MAP() { - throw new IllegalStateException("Should never be called."); - } - - @Accessor(value = "END_BARRENS_MAP", remap = false) - static Map, WeightedPicker>> END_BARRENS_MAP() { - throw new IllegalStateException("Should never be called."); - } -} diff --git a/1.19.2/src/main/resources/fabric.mod.json b/1.19.2/src/main/resources/fabric.mod.json index dff18a06..ffac96b0 100644 --- a/1.19.2/src/main/resources/fabric.mod.json +++ b/1.19.2/src/main/resources/fabric.mod.json @@ -10,13 +10,11 @@ ], "contact": {}, "license": "MIT", - "environment": "server", "mixins": [ "minecraft-data-generator.mixins.json" ], "depends": { "fabricloader": "*", - "fabric": "*", "minecraft": "*" } } diff --git a/1.19.2/src/main/resources/minecraft-data-generator.mixins.json b/1.19.2/src/main/resources/minecraft-data-generator.mixins.json index f3afe061..bb73460d 100644 --- a/1.19.2/src/main/resources/minecraft-data-generator.mixins.json +++ b/1.19.2/src/main/resources/minecraft-data-generator.mixins.json @@ -7,8 +7,7 @@ "EntityTypeAccessor", "EULAMixin", "MiningToolItemAccessor", - "ReadyMixin", - "TheEndBiomeDataAccessor" + "ReadyMixin" ], "client": [ ], diff --git a/1.19/build.gradle b/1.19/build.gradle index 9dd880c9..837a6e5d 100644 --- a/1.19/build.gradle +++ b/1.19/build.gradle @@ -1,23 +1,40 @@ -import net.fabricmc.loom.configuration.providers.minecraft.MinecraftJarConfiguration +import xyz.wagyourtail.unimined.internal.minecraft.MinecraftProvider plugins { - id 'fabric-loom' + id 'xyz.wagyourtail.unimined' } -loom { - minecraftJarConfiguration = MinecraftJarConfiguration.MERGED +repositories { + maven { + name = "wagyourtail releases" + url = "https://maven.wagyourtail.xyz/releases" + } + mavenCentral() } -dependencies { - // To change the versions see the gradle.properties file - minecraft "com.mojang:minecraft:${project.minecraft_version}" - mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" - modImplementation libs.fabric.loader +unimined.minecraft { + version "1.19" + + mappings { + intermediary() + yarn(1) + + devFallbackNamespace "intermediary" + } + + runs.config("server") { + javaVersion = JavaVersion.VERSION_21 + } - // Fabric API. This is technically optional, but you probably want it anyway. - modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" + customPatcher(new CustomOfficialFabricMinecraftTransformer(project, delegate as MinecraftProvider)) { + it.loader libs.versions.fabric.loader.get() + } + + defaultRemapJar = true +} - implementation(project(":common")) +dependencies { + implementation project(":common") } processResources { @@ -31,9 +48,3 @@ processResources { tasks.withType(JavaCompile).configureEach { it.options.encoding = "UTF-8" } - -java { - toolchain { - languageVersion.set(JavaLanguageVersion.of(17)) - } -} diff --git a/1.19/gradle.properties b/1.19/gradle.properties deleted file mode 100644 index 16c8e844..00000000 --- a/1.19/gradle.properties +++ /dev/null @@ -1,7 +0,0 @@ -# Fabric Properties -# check these on https://modmuss50.me/fabric.html -minecraft_version=1.19 -yarn_mappings=1.19+build.1 -# Dependencies -# check this on https://modmuss50.me/fabric.html -fabric_version=0.55.2+1.19 diff --git a/1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/BiomesDataGenerator.java b/1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/BiomesDataGenerator.java index 88200df7..32d478f7 100644 --- a/1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/BiomesDataGenerator.java +++ b/1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/BiomesDataGenerator.java @@ -2,35 +2,23 @@ import com.google.gson.JsonArray; import com.google.gson.JsonObject; -import dev.u9g.minecraftdatagenerator.mixin.TheEndBiomeDataAccessor; import dev.u9g.minecraftdatagenerator.util.DGU; -import net.fabricmc.fabric.api.biome.v1.NetherBiomes; +import net.minecraft.tag.BiomeTags; import net.minecraft.util.Identifier; -import net.minecraft.util.registry.DynamicRegistryManager; -import net.minecraft.util.registry.Registry; +import net.minecraft.util.registry.BuiltinRegistries; import net.minecraft.util.registry.RegistryKey; import net.minecraft.world.biome.Biome; -import java.util.HashSet; -import java.util.Set; - public class BiomesDataGenerator implements IDataGenerator { - private static final Set> END_BIOMES = new HashSet<>(); - - static { - END_BIOMES.addAll(TheEndBiomeDataAccessor.END_BIOMES_MAP().keySet()); - END_BIOMES.addAll(TheEndBiomeDataAccessor.END_BARRENS_MAP().keySet()); - END_BIOMES.addAll(TheEndBiomeDataAccessor.END_MIDLANDS_MAP().keySet()); - } - - private static String guessBiomeDimensionFromCategory(Biome biome, String biomeName) { - var key = DynamicRegistryManager.BUILTIN.get().get(Registry.BIOME_KEY).getKey(biome).orElseThrow(); - if (NetherBiomes.canGenerateInNether(key)) { + private static String guessBiomeDimensionFromCategory(RegistryKey biome) { + var biomeRegistry = BuiltinRegistries.BIOME; + if (biomeRegistry.getEntry(biome).orElseThrow().isIn(BiomeTags.IS_NETHER)) { return "nether"; - } else if (END_BIOMES.contains(key) || biomeName.startsWith("end_")) { + } else if (biomeRegistry.getEntry(biome).orElseThrow().isIn(BiomeTags.IS_END)) { return "end"; + } else { + return "overworld"; } - return "overworld"; } private static String guessCategoryBasedOnName(String name, String dimension) { @@ -86,211 +74,22 @@ private static String guessCategoryBasedOnName(String name, String dimension) { } } - private static int getBiomeColorFor(String biomeName) { - switch (biomeName) { - case "the_void" -> { - return 0; - } - case "plains" -> { - return 9286496; - } - case "sunflower_plains" -> { - return 11918216; - } - case "snowy_plains" -> { - return 16777215; - } - case "ice_spikes" -> { - return 11853020; - } - case "desert" -> { - return 16421912; - } - case "swamp" -> { - return 522674; - } - case "forest" -> { - return 353825; - } - case "flower_forest" -> { - return 2985545; - } - case "birch_forest" -> { - return 3175492; - } - case "dark_forest" -> { - return 4215066; - } - case "old_growth_birch_forest" -> { - return 5807212; - } - case "old_growth_pine_taiga" -> { - return 5858897; - } - case "old_growth_spruce_taiga" -> { - return 8490617; - } - case "taiga" -> { - return 747097; - } - case "snowy_taiga" -> { - return 3233098; - } - case "savanna" -> { - return 12431967; - } - case "savanna_plateau" -> { - return 10984804; - } - case "windswept_hills" -> { - return 6316128; - } - case "windswept_gravelly_hills" -> { - return 8947848; - } - case "windswept_forest" -> { - return 2250012; - } - case "windswept_savanna" -> { - return 15063687; - } - case "jungle" -> { - return 5470985; - } - case "sparse_jungle" -> { - return 6458135; - } - case "bamboo_jungle" -> { - return 7769620; - } - case "badlands" -> { - return 14238997; - } - case "eroded_badlands" -> { - return 16739645; - } - case "wooded_badlands" -> { - return 11573093; - } - case "meadow" -> { - return 9217136; - } - case "grove" -> { - return 14675173; - } - case "snowy_slopes" -> { - return 14348785; - } - case "frozen_peaks" -> { - return 15399931; - } - case "jagged_peaks" -> { - return 14937325; - } - case "stony_peaks" -> { - return 13750737; - } - case "river" -> { - return 255; - } - case "frozen_river" -> { - return 10526975; - } - case "beach" -> { - return 16440917; - } - case "snowy_beach" -> { - return 16445632; - } - case "stony_shore" -> { - return 10658436; - } - case "warm_ocean" -> { - return 172; - } - case "lukewarm_ocean" -> { - return 144; - } - case "deep_lukewarm_ocean" -> { - return 64; - } - case "ocean" -> { - return 112; - } - case "deep_ocean" -> { - return 48; - } - case "cold_ocean" -> { - return 2105456; - } - case "deep_cold_ocean" -> { - return 2105400; - } - case "frozen_ocean" -> { - return 7368918; - } - case "deep_frozen_ocean" -> { - return 4210832; - } - case "mushroom_fields" -> { - return 16711935; - } - case "dripstone_caves" -> { - return 12690831; - } - case "lush_caves" -> { - return 14652980; - } - case "nether_wastes" -> { - return 12532539; - } - case "warped_forest" -> { - return 4821115; - } - case "crimson_forest" -> { - return 14485512; - } - case "soul_sand_valley" -> { - return 6174768; - } - case "basalt_deltas" -> { - return 4208182; - } - case "the_end" -> { - return 8421631; - } - case "end_highlands" -> { - return 12828041; - } - case "end_midlands" -> { - return 15464630; - } - case "small_end_islands" -> { - return 42; - } - case "end_barrens" -> { - return 9474162; - } - } - System.out.println("Don't know the color of biome: '" + biomeName + "'"); - return 0; - } - - public static JsonObject generateBiomeInfo(Registry registry, Biome biome) { + public static JsonObject generateBiomeInfo(Biome biome) { JsonObject biomeDesc = new JsonObject(); - Identifier registryKey = registry.getKey(biome).orElseThrow().getValue(); - String localizationKey = String.format("biome.%s.%s", registryKey.getNamespace(), registryKey.getPath()); - String name = registryKey.getPath(); - biomeDesc.addProperty("id", registry.getRawId(biome)); + RegistryKey registryKey = BuiltinRegistries.BIOME.getKey(biome).orElseThrow(); + Identifier identifier = registryKey.getValue(); + String localizationKey = String.format("biome.%s.%s", identifier.getNamespace(), identifier.getPath()); + String name = identifier.getPath(); + biomeDesc.addProperty("id", BuiltinRegistries.BIOME.getRawId(biome)); biomeDesc.addProperty("name", name); - String dimension = guessBiomeDimensionFromCategory(biome, name); + String dimension = guessBiomeDimensionFromCategory(registryKey); biomeDesc.addProperty("category", guessCategoryBasedOnName(name, dimension)); biomeDesc.addProperty("temperature", biome.getTemperature()); biomeDesc.addProperty("precipitation", biome.getPrecipitation().getName()); //biomeDesc.addProperty("depth", biome.getDepth()); - Doesn't exist anymore in minecraft source biomeDesc.addProperty("dimension", dimension); biomeDesc.addProperty("displayName", DGU.translateText(localizationKey)); - biomeDesc.addProperty("color", getBiomeColorFor(registryKey.getPath())); + biomeDesc.addProperty("color", biome.getSkyColor()); biomeDesc.addProperty("rainfall", biome.getDownfall()); return biomeDesc; @@ -304,11 +103,8 @@ public String getDataName() { @Override public JsonArray generateDataJson() { JsonArray biomesArray = new JsonArray(); - DynamicRegistryManager registryManager = DynamicRegistryManager.BUILTIN.get(); - Registry biomeRegistry = registryManager.get(Registry.BIOME_KEY); - - biomeRegistry.stream() - .map(biome -> generateBiomeInfo(biomeRegistry, biome)) + BuiltinRegistries.BIOME.stream() + .map(biome -> generateBiomeInfo(biome)) .forEach(biomesArray::add); return biomesArray; } diff --git a/1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java b/1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java index edbc9869..c6566571 100644 --- a/1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java +++ b/1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java @@ -2,16 +2,17 @@ import com.google.gson.JsonArray; import com.google.gson.JsonObject; +import net.minecraft.client.sound.Sound; +import net.minecraft.client.sound.SoundSystem; import net.minecraft.sound.SoundEvent; import net.minecraft.util.registry.Registry; - public class SoundsDataGenerator implements IDataGenerator { - public static JsonObject generateSound(Registry registry, SoundEvent soundEvent) { + public static JsonObject generateSound(SoundEvent soundEvent) { JsonObject soundDesc = new JsonObject(); - soundDesc.addProperty("id", registry.getRawId(soundEvent)); + soundDesc.addProperty("id", Registry.SOUND_EVENT.getRawId(soundEvent)); soundDesc.addProperty("name", soundEvent.getId().getPath()); return soundDesc; @@ -25,8 +26,7 @@ public String getDataName() { @Override public JsonArray generateDataJson() { JsonArray resultsArray = new JsonArray(); - Registry soundEventRegistry = Registry.SOUND_EVENT; - soundEventRegistry.forEach(sound -> resultsArray.add(generateSound(soundEventRegistry, sound))); + Registry.SOUND_EVENT.forEach(sound -> resultsArray.add(generateSound(sound))); return resultsArray; } } diff --git a/1.19/src/main/java/dev/u9g/minecraftdatagenerator/mixin/TheEndBiomeDataAccessor.java b/1.19/src/main/java/dev/u9g/minecraftdatagenerator/mixin/TheEndBiomeDataAccessor.java deleted file mode 100644 index b50d1a93..00000000 --- a/1.19/src/main/java/dev/u9g/minecraftdatagenerator/mixin/TheEndBiomeDataAccessor.java +++ /dev/null @@ -1,29 +0,0 @@ -package dev.u9g.minecraftdatagenerator.mixin; - -import net.fabricmc.fabric.impl.biome.TheEndBiomeData; -import net.fabricmc.fabric.impl.biome.WeightedPicker; -import net.minecraft.util.registry.RegistryKey; -import net.minecraft.world.biome.Biome; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.gen.Accessor; - -import java.util.Map; - - -@Mixin(TheEndBiomeData.class) -public interface TheEndBiomeDataAccessor { - @Accessor("END_BIOMES_MAP") - static Map, WeightedPicker>> END_BIOMES_MAP() { - throw new IllegalStateException("Should never be called."); - } - - @Accessor("END_MIDLANDS_MAP") - static Map, WeightedPicker>> END_MIDLANDS_MAP() { - throw new IllegalStateException("Should never be called."); - } - - @Accessor("END_BARRENS_MAP") - static Map, WeightedPicker>> END_BARRENS_MAP() { - throw new IllegalStateException("Should never be called."); - } -} diff --git a/1.19/src/main/resources/fabric.mod.json b/1.19/src/main/resources/fabric.mod.json index 395c025e..74a506b1 100644 --- a/1.19/src/main/resources/fabric.mod.json +++ b/1.19/src/main/resources/fabric.mod.json @@ -10,13 +10,11 @@ ], "contact": {}, "license": "MIT", - "environment": "server", "mixins": [ "minecraft-data-generator.mixins.json" ], "depends": { "fabricloader": "*", - "fabric": "*", "minecraft": "1.19" } } diff --git a/1.19/src/main/resources/minecraft-data-generator.mixins.json b/1.19/src/main/resources/minecraft-data-generator.mixins.json index f3afe061..bb73460d 100644 --- a/1.19/src/main/resources/minecraft-data-generator.mixins.json +++ b/1.19/src/main/resources/minecraft-data-generator.mixins.json @@ -7,8 +7,7 @@ "EntityTypeAccessor", "EULAMixin", "MiningToolItemAccessor", - "ReadyMixin", - "TheEndBiomeDataAccessor" + "ReadyMixin" ], "client": [ ], diff --git a/1.20.4/build.gradle b/1.20.4/build.gradle index 9dd880c9..a9bb43bb 100644 --- a/1.20.4/build.gradle +++ b/1.20.4/build.gradle @@ -1,23 +1,40 @@ -import net.fabricmc.loom.configuration.providers.minecraft.MinecraftJarConfiguration +import xyz.wagyourtail.unimined.internal.minecraft.MinecraftProvider plugins { - id 'fabric-loom' + id 'xyz.wagyourtail.unimined' } -loom { - minecraftJarConfiguration = MinecraftJarConfiguration.MERGED +repositories { + maven { + name = "wagyourtail releases" + url = "https://maven.wagyourtail.xyz/releases" + } + mavenCentral() } -dependencies { - // To change the versions see the gradle.properties file - minecraft "com.mojang:minecraft:${project.minecraft_version}" - mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" - modImplementation libs.fabric.loader +unimined.minecraft { + version "1.20.4" + + mappings { + intermediary() + yarn(1) + + devFallbackNamespace "intermediary" + } + + runs.config("server") { + javaVersion = JavaVersion.VERSION_21 + } - // Fabric API. This is technically optional, but you probably want it anyway. - modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" + customPatcher(new CustomOfficialFabricMinecraftTransformer(project, delegate as MinecraftProvider)) { + it.loader libs.versions.fabric.loader.get() + } + + defaultRemapJar = true +} - implementation(project(":common")) +dependencies { + implementation project(":common") } processResources { @@ -31,9 +48,3 @@ processResources { tasks.withType(JavaCompile).configureEach { it.options.encoding = "UTF-8" } - -java { - toolchain { - languageVersion.set(JavaLanguageVersion.of(17)) - } -} diff --git a/1.20.4/gradle.properties b/1.20.4/gradle.properties deleted file mode 100644 index 63eca8f1..00000000 --- a/1.20.4/gradle.properties +++ /dev/null @@ -1,7 +0,0 @@ -# Fabric Properties -# check these on https://modmuss50.me/fabric.html -minecraft_version=1.20.4 -yarn_mappings=1.20.4+build.3 -# Dependencies -# check this on https://modmuss50.me/fabric.html -fabric_version=0.92.0+1.20.4 diff --git a/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/BiomesDataGenerator.java b/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/BiomesDataGenerator.java index bda5f967..e506efff 100644 --- a/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/BiomesDataGenerator.java +++ b/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/BiomesDataGenerator.java @@ -2,36 +2,22 @@ import com.google.gson.JsonArray; import com.google.gson.JsonObject; -import dev.u9g.minecraftdatagenerator.mixin.TheEndBiomeDataAccessor; import dev.u9g.minecraftdatagenerator.util.DGU; -import net.fabricmc.fabric.api.biome.v1.NetherBiomes; -import net.minecraft.registry.DynamicRegistryManager; -import net.minecraft.registry.Registry; -import net.minecraft.registry.RegistryKey; -import net.minecraft.registry.RegistryKeys; +import net.minecraft.registry.*; +import net.minecraft.registry.tag.BiomeTags; import net.minecraft.util.Identifier; import net.minecraft.world.biome.Biome; -import java.util.HashSet; -import java.util.Set; - public class BiomesDataGenerator implements IDataGenerator { - private static final Set> END_BIOMES = new HashSet<>(); - - static { - END_BIOMES.addAll(TheEndBiomeDataAccessor.END_BIOMES_MAP().keySet()); - END_BIOMES.addAll(TheEndBiomeDataAccessor.END_BARRENS_MAP().keySet()); - END_BIOMES.addAll(TheEndBiomeDataAccessor.END_MIDLANDS_MAP().keySet()); - } - - private static String guessBiomeDimensionFromCategory(Biome biome, String biomeName) { - var key = DGU.getWorld().getRegistryManager().get(RegistryKeys.BIOME).getKey(biome).orElseThrow(); - if (NetherBiomes.canGenerateInNether(key)) { + private static String guessBiomeDimensionFromCategory(Biome biome) { + var biomeRegistry = DGU.getWorld().getRegistryManager().get(RegistryKeys.BIOME); + if (biomeRegistry.getEntry(biome).isIn(BiomeTags.IS_NETHER)) { return "nether"; - } else if (END_BIOMES.contains(key) || biomeName.startsWith("end_")) { + } else if (biomeRegistry.getEntry(biome).isIn(BiomeTags.IS_END)) { return "end"; + } else { + return "overworld"; } - return "overworld"; } private static String guessCategoryBasedOnName(String name, String dimension) { @@ -87,196 +73,6 @@ private static String guessCategoryBasedOnName(String name, String dimension) { } } - private static int getBiomeColorFor(String biomeName) { - switch (biomeName) { - case "the_void" -> { - return 0; - } - case "plains" -> { - return 9286496; - } - case "sunflower_plains" -> { - return 11918216; - } - case "snowy_plains" -> { - return 16777215; - } - case "ice_spikes" -> { - return 11853020; - } - case "desert" -> { - return 16421912; - } - case "swamp" -> { - return 522674; - } - case "forest" -> { - return 353825; - } - case "flower_forest" -> { - return 2985545; - } - case "birch_forest" -> { - return 3175492; - } - case "dark_forest" -> { - return 4215066; - } - case "old_growth_birch_forest" -> { - return 5807212; - } - case "old_growth_pine_taiga" -> { - return 5858897; - } - case "old_growth_spruce_taiga" -> { - return 8490617; - } - case "taiga" -> { - return 747097; - } - case "snowy_taiga" -> { - return 3233098; - } - case "savanna" -> { - return 12431967; - } - case "savanna_plateau" -> { - return 10984804; - } - case "windswept_hills" -> { - return 6316128; - } - case "windswept_gravelly_hills" -> { - return 8947848; - } - case "windswept_forest" -> { - return 2250012; - } - case "windswept_savanna" -> { - return 15063687; - } - case "jungle" -> { - return 5470985; - } - case "sparse_jungle" -> { - return 6458135; - } - case "bamboo_jungle" -> { - return 7769620; - } - case "badlands" -> { - return 14238997; - } - case "eroded_badlands" -> { - return 16739645; - } - case "wooded_badlands" -> { - return 11573093; - } - case "meadow" -> { - return 9217136; - } - case "grove" -> { - return 14675173; - } - case "snowy_slopes" -> { - return 14348785; - } - case "frozen_peaks" -> { - return 15399931; - } - case "jagged_peaks" -> { - return 14937325; - } - case "stony_peaks" -> { - return 13750737; - } - case "river" -> { - return 255; - } - case "frozen_river" -> { - return 10526975; - } - case "beach" -> { - return 16440917; - } - case "snowy_beach" -> { - return 16445632; - } - case "stony_shore" -> { - return 10658436; - } - case "warm_ocean" -> { - return 172; - } - case "lukewarm_ocean" -> { - return 144; - } - case "deep_lukewarm_ocean" -> { - return 64; - } - case "ocean" -> { - return 112; - } - case "deep_ocean" -> { - return 48; - } - case "cold_ocean" -> { - return 2105456; - } - case "deep_cold_ocean" -> { - return 2105400; - } - case "frozen_ocean" -> { - return 7368918; - } - case "deep_frozen_ocean" -> { - return 4210832; - } - case "mushroom_fields" -> { - return 16711935; - } - case "dripstone_caves" -> { - return 12690831; - } - case "lush_caves" -> { - return 14652980; - } - case "nether_wastes" -> { - return 12532539; - } - case "warped_forest" -> { - return 4821115; - } - case "crimson_forest" -> { - return 14485512; - } - case "soul_sand_valley" -> { - return 6174768; - } - case "basalt_deltas" -> { - return 4208182; - } - case "the_end" -> { - return 8421631; - } - case "end_highlands" -> { - return 12828041; - } - case "end_midlands" -> { - return 15464630; - } - case "small_end_islands" -> { - return 42; - } - case "end_barrens" -> { - return 9474162; - } - } - System.out.println("Don't know the color of biome: '" + biomeName + "'"); - return 0; - } - public static JsonObject generateBiomeInfo(Registry registry, Biome biome) { JsonObject biomeDesc = new JsonObject(); Identifier registryKey = registry.getKey(biome).orElseThrow().getValue(); @@ -284,7 +80,7 @@ public static JsonObject generateBiomeInfo(Registry registry, Biome biome String name = registryKey.getPath(); biomeDesc.addProperty("id", registry.getRawId(biome)); biomeDesc.addProperty("name", name); - String dimension = guessBiomeDimensionFromCategory(biome, name); + String dimension = guessBiomeDimensionFromCategory(biome); biomeDesc.addProperty("category", guessCategoryBasedOnName(name, dimension)); biomeDesc.addProperty("temperature", biome.getTemperature()); //biomeDesc.addProperty("precipitation", biome.getPrecipitation().getName());// - removed in 1.19.4 @@ -292,7 +88,7 @@ public static JsonObject generateBiomeInfo(Registry registry, Biome biome //biomeDesc.addProperty("depth", biome.getDepth()); - Doesn't exist anymore in minecraft source biomeDesc.addProperty("dimension", dimension); biomeDesc.addProperty("displayName", DGU.translateText(localizationKey)); - biomeDesc.addProperty("color", getBiomeColorFor(registryKey.getPath())); + biomeDesc.addProperty("color", biome.getSkyColor()); //biomeDesc.addProperty("rainfall", biome.getDownfall());// - removed in 1.19.4 return biomeDesc; diff --git a/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/mixin/TheEndBiomeDataAccessor.java b/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/mixin/TheEndBiomeDataAccessor.java deleted file mode 100644 index dc35e0b3..00000000 --- a/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/mixin/TheEndBiomeDataAccessor.java +++ /dev/null @@ -1,29 +0,0 @@ -package dev.u9g.minecraftdatagenerator.mixin; - -import net.fabricmc.fabric.impl.biome.TheEndBiomeData; -import net.fabricmc.fabric.impl.biome.WeightedPicker; -import net.minecraft.registry.RegistryKey; -import net.minecraft.world.biome.Biome; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.gen.Accessor; - -import java.util.Map; - - -@Mixin(TheEndBiomeData.class) -public interface TheEndBiomeDataAccessor { - @Accessor(value = "END_BIOMES_MAP", remap = false) - static Map, WeightedPicker>> END_BIOMES_MAP() { - throw new IllegalStateException("Should never be called."); - } - - @Accessor(value = "END_MIDLANDS_MAP", remap = false) - static Map, WeightedPicker>> END_MIDLANDS_MAP() { - throw new IllegalStateException("Should never be called."); - } - - @Accessor(value = "END_BARRENS_MAP", remap = false) - static Map, WeightedPicker>> END_BARRENS_MAP() { - throw new IllegalStateException("Should never be called."); - } -} diff --git a/1.20.4/src/main/resources/fabric.mod.json b/1.20.4/src/main/resources/fabric.mod.json index dff18a06..ffac96b0 100644 --- a/1.20.4/src/main/resources/fabric.mod.json +++ b/1.20.4/src/main/resources/fabric.mod.json @@ -10,13 +10,11 @@ ], "contact": {}, "license": "MIT", - "environment": "server", "mixins": [ "minecraft-data-generator.mixins.json" ], "depends": { "fabricloader": "*", - "fabric": "*", "minecraft": "*" } } diff --git a/1.20.4/src/main/resources/minecraft-data-generator.mixins.json b/1.20.4/src/main/resources/minecraft-data-generator.mixins.json index f3afe061..bb73460d 100644 --- a/1.20.4/src/main/resources/minecraft-data-generator.mixins.json +++ b/1.20.4/src/main/resources/minecraft-data-generator.mixins.json @@ -7,8 +7,7 @@ "EntityTypeAccessor", "EULAMixin", "MiningToolItemAccessor", - "ReadyMixin", - "TheEndBiomeDataAccessor" + "ReadyMixin" ], "client": [ ], diff --git a/1.20/build.gradle b/1.20/build.gradle index 9dd880c9..7487e722 100644 --- a/1.20/build.gradle +++ b/1.20/build.gradle @@ -1,23 +1,40 @@ -import net.fabricmc.loom.configuration.providers.minecraft.MinecraftJarConfiguration +import xyz.wagyourtail.unimined.internal.minecraft.MinecraftProvider plugins { - id 'fabric-loom' + id 'xyz.wagyourtail.unimined' } -loom { - minecraftJarConfiguration = MinecraftJarConfiguration.MERGED +repositories { + maven { + name = "wagyourtail releases" + url = "https://maven.wagyourtail.xyz/releases" + } + mavenCentral() } -dependencies { - // To change the versions see the gradle.properties file - minecraft "com.mojang:minecraft:${project.minecraft_version}" - mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" - modImplementation libs.fabric.loader +unimined.minecraft { + version "1.20" + + mappings { + intermediary() + yarn(1) + + devFallbackNamespace "intermediary" + } + + runs.config("server") { + javaVersion = JavaVersion.VERSION_21 + } - // Fabric API. This is technically optional, but you probably want it anyway. - modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" + customPatcher(new CustomOfficialFabricMinecraftTransformer(project, delegate as MinecraftProvider)) { + it.loader libs.versions.fabric.loader.get() + } + + defaultRemapJar = true +} - implementation(project(":common")) +dependencies { + implementation project(":common") } processResources { @@ -31,9 +48,3 @@ processResources { tasks.withType(JavaCompile).configureEach { it.options.encoding = "UTF-8" } - -java { - toolchain { - languageVersion.set(JavaLanguageVersion.of(17)) - } -} diff --git a/1.20/gradle.properties b/1.20/gradle.properties deleted file mode 100644 index e2905801..00000000 --- a/1.20/gradle.properties +++ /dev/null @@ -1,7 +0,0 @@ -# Fabric Properties -# check these on https://modmuss50.me/fabric.html -minecraft_version=1.20.2 -yarn_mappings=1.20.2+build.4 -# Dependencies -# check this on https://modmuss50.me/fabric.html -fabric_version=0.90.4+1.20.2 diff --git a/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/BiomesDataGenerator.java b/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/BiomesDataGenerator.java index bda5f967..e506efff 100644 --- a/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/BiomesDataGenerator.java +++ b/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/BiomesDataGenerator.java @@ -2,36 +2,22 @@ import com.google.gson.JsonArray; import com.google.gson.JsonObject; -import dev.u9g.minecraftdatagenerator.mixin.TheEndBiomeDataAccessor; import dev.u9g.minecraftdatagenerator.util.DGU; -import net.fabricmc.fabric.api.biome.v1.NetherBiomes; -import net.minecraft.registry.DynamicRegistryManager; -import net.minecraft.registry.Registry; -import net.minecraft.registry.RegistryKey; -import net.minecraft.registry.RegistryKeys; +import net.minecraft.registry.*; +import net.minecraft.registry.tag.BiomeTags; import net.minecraft.util.Identifier; import net.minecraft.world.biome.Biome; -import java.util.HashSet; -import java.util.Set; - public class BiomesDataGenerator implements IDataGenerator { - private static final Set> END_BIOMES = new HashSet<>(); - - static { - END_BIOMES.addAll(TheEndBiomeDataAccessor.END_BIOMES_MAP().keySet()); - END_BIOMES.addAll(TheEndBiomeDataAccessor.END_BARRENS_MAP().keySet()); - END_BIOMES.addAll(TheEndBiomeDataAccessor.END_MIDLANDS_MAP().keySet()); - } - - private static String guessBiomeDimensionFromCategory(Biome biome, String biomeName) { - var key = DGU.getWorld().getRegistryManager().get(RegistryKeys.BIOME).getKey(biome).orElseThrow(); - if (NetherBiomes.canGenerateInNether(key)) { + private static String guessBiomeDimensionFromCategory(Biome biome) { + var biomeRegistry = DGU.getWorld().getRegistryManager().get(RegistryKeys.BIOME); + if (biomeRegistry.getEntry(biome).isIn(BiomeTags.IS_NETHER)) { return "nether"; - } else if (END_BIOMES.contains(key) || biomeName.startsWith("end_")) { + } else if (biomeRegistry.getEntry(biome).isIn(BiomeTags.IS_END)) { return "end"; + } else { + return "overworld"; } - return "overworld"; } private static String guessCategoryBasedOnName(String name, String dimension) { @@ -87,196 +73,6 @@ private static String guessCategoryBasedOnName(String name, String dimension) { } } - private static int getBiomeColorFor(String biomeName) { - switch (biomeName) { - case "the_void" -> { - return 0; - } - case "plains" -> { - return 9286496; - } - case "sunflower_plains" -> { - return 11918216; - } - case "snowy_plains" -> { - return 16777215; - } - case "ice_spikes" -> { - return 11853020; - } - case "desert" -> { - return 16421912; - } - case "swamp" -> { - return 522674; - } - case "forest" -> { - return 353825; - } - case "flower_forest" -> { - return 2985545; - } - case "birch_forest" -> { - return 3175492; - } - case "dark_forest" -> { - return 4215066; - } - case "old_growth_birch_forest" -> { - return 5807212; - } - case "old_growth_pine_taiga" -> { - return 5858897; - } - case "old_growth_spruce_taiga" -> { - return 8490617; - } - case "taiga" -> { - return 747097; - } - case "snowy_taiga" -> { - return 3233098; - } - case "savanna" -> { - return 12431967; - } - case "savanna_plateau" -> { - return 10984804; - } - case "windswept_hills" -> { - return 6316128; - } - case "windswept_gravelly_hills" -> { - return 8947848; - } - case "windswept_forest" -> { - return 2250012; - } - case "windswept_savanna" -> { - return 15063687; - } - case "jungle" -> { - return 5470985; - } - case "sparse_jungle" -> { - return 6458135; - } - case "bamboo_jungle" -> { - return 7769620; - } - case "badlands" -> { - return 14238997; - } - case "eroded_badlands" -> { - return 16739645; - } - case "wooded_badlands" -> { - return 11573093; - } - case "meadow" -> { - return 9217136; - } - case "grove" -> { - return 14675173; - } - case "snowy_slopes" -> { - return 14348785; - } - case "frozen_peaks" -> { - return 15399931; - } - case "jagged_peaks" -> { - return 14937325; - } - case "stony_peaks" -> { - return 13750737; - } - case "river" -> { - return 255; - } - case "frozen_river" -> { - return 10526975; - } - case "beach" -> { - return 16440917; - } - case "snowy_beach" -> { - return 16445632; - } - case "stony_shore" -> { - return 10658436; - } - case "warm_ocean" -> { - return 172; - } - case "lukewarm_ocean" -> { - return 144; - } - case "deep_lukewarm_ocean" -> { - return 64; - } - case "ocean" -> { - return 112; - } - case "deep_ocean" -> { - return 48; - } - case "cold_ocean" -> { - return 2105456; - } - case "deep_cold_ocean" -> { - return 2105400; - } - case "frozen_ocean" -> { - return 7368918; - } - case "deep_frozen_ocean" -> { - return 4210832; - } - case "mushroom_fields" -> { - return 16711935; - } - case "dripstone_caves" -> { - return 12690831; - } - case "lush_caves" -> { - return 14652980; - } - case "nether_wastes" -> { - return 12532539; - } - case "warped_forest" -> { - return 4821115; - } - case "crimson_forest" -> { - return 14485512; - } - case "soul_sand_valley" -> { - return 6174768; - } - case "basalt_deltas" -> { - return 4208182; - } - case "the_end" -> { - return 8421631; - } - case "end_highlands" -> { - return 12828041; - } - case "end_midlands" -> { - return 15464630; - } - case "small_end_islands" -> { - return 42; - } - case "end_barrens" -> { - return 9474162; - } - } - System.out.println("Don't know the color of biome: '" + biomeName + "'"); - return 0; - } - public static JsonObject generateBiomeInfo(Registry registry, Biome biome) { JsonObject biomeDesc = new JsonObject(); Identifier registryKey = registry.getKey(biome).orElseThrow().getValue(); @@ -284,7 +80,7 @@ public static JsonObject generateBiomeInfo(Registry registry, Biome biome String name = registryKey.getPath(); biomeDesc.addProperty("id", registry.getRawId(biome)); biomeDesc.addProperty("name", name); - String dimension = guessBiomeDimensionFromCategory(biome, name); + String dimension = guessBiomeDimensionFromCategory(biome); biomeDesc.addProperty("category", guessCategoryBasedOnName(name, dimension)); biomeDesc.addProperty("temperature", biome.getTemperature()); //biomeDesc.addProperty("precipitation", biome.getPrecipitation().getName());// - removed in 1.19.4 @@ -292,7 +88,7 @@ public static JsonObject generateBiomeInfo(Registry registry, Biome biome //biomeDesc.addProperty("depth", biome.getDepth()); - Doesn't exist anymore in minecraft source biomeDesc.addProperty("dimension", dimension); biomeDesc.addProperty("displayName", DGU.translateText(localizationKey)); - biomeDesc.addProperty("color", getBiomeColorFor(registryKey.getPath())); + biomeDesc.addProperty("color", biome.getSkyColor()); //biomeDesc.addProperty("rainfall", biome.getDownfall());// - removed in 1.19.4 return biomeDesc; diff --git a/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/RecipeDataGenerator.java b/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/RecipeDataGenerator.java index ea489d11..e7800c01 100644 --- a/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/RecipeDataGenerator.java +++ b/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/RecipeDataGenerator.java @@ -31,8 +31,7 @@ public JsonElement generateDataJson() { DynamicRegistryManager registryManager = DGU.getWorld().getRegistryManager(); JsonObject finalObj = new JsonObject(); Multimap recipes = ArrayListMultimap.create(); - for (RecipeEntry recipeE : Objects.requireNonNull(DGU.getWorld()).getRecipeManager().values()) { - Recipe recipe = recipeE.value(); + for (Recipe recipe : Objects.requireNonNull(DGU.getWorld()).getRecipeManager().values()) { if (recipe instanceof ShapedRecipe sr) { var ingredients = sr.getIngredients(); List ingr = new ArrayList<>(); @@ -67,11 +66,11 @@ public JsonElement generateDataJson() { finalRecipe.add("inShape", inShape); var resultObject = new JsonObject(); - resultObject.addProperty("id", getRawIdFor(sr.getResult(registryManager).getItem())); - resultObject.addProperty("count", sr.getResult(registryManager).getCount()); + resultObject.addProperty("id", getRawIdFor(sr.getOutput(registryManager).getItem())); + resultObject.addProperty("count", sr.getOutput(registryManager).getCount()); finalRecipe.add("result", resultObject); - String id = ((Integer) getRawIdFor(sr.getResult(registryManager).getItem())).toString(); + String id = ((Integer) getRawIdFor(sr.getOutput(registryManager).getItem())).toString(); if (!finalObj.has(id)) { finalObj.add(id, new JsonArray()); @@ -111,10 +110,10 @@ public JsonElement generateDataJson() { var rootRecipeObject = new JsonObject(); rootRecipeObject.add("ingredients", ingredients); var resultObject = new JsonObject(); - resultObject.addProperty("id", getRawIdFor(sl.getResult(registryManager).getItem())); - resultObject.addProperty("count", sl.getResult(registryManager).getCount()); + resultObject.addProperty("id", getRawIdFor(sl.getOutput(registryManager).getItem())); + resultObject.addProperty("count", sl.getOutput(registryManager).getCount()); rootRecipeObject.add("result", resultObject); - recipes.put(getRawIdFor(sl.getResult(registryManager).getItem()), rootRecipeObject); + recipes.put(getRawIdFor(sl.getOutput(registryManager).getItem()), rootRecipeObject); } } recipes.forEach((a, b) -> { diff --git a/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java b/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java index 1d8bab2a..b0f62122 100644 --- a/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java +++ b/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java @@ -3,16 +3,18 @@ import com.google.gson.JsonArray; import com.google.gson.JsonObject; import dev.u9g.minecraftdatagenerator.util.DGU; +import net.minecraft.registry.Registries; import net.minecraft.registry.Registry; import net.minecraft.registry.RegistryKeys; +import net.minecraft.client.sound.Sound; import net.minecraft.sound.SoundEvent; public class SoundsDataGenerator implements IDataGenerator { - public static JsonObject generateSound(Registry registry, SoundEvent soundEvent) { + public static JsonObject generateSound(SoundEvent soundEvent) { JsonObject soundDesc = new JsonObject(); - soundDesc.addProperty("id", registry.getRawId(soundEvent) + 1); // the plus 1 is required for 1.19.2+ due to Mojang using 0 in the packet to say that you should read a string id instead. + soundDesc.addProperty("id", Registries.SOUND_EVENT.getRawId(soundEvent) + 1); // the plus 1 is required for 1.19.2+ due to Mojang using 0 in the packet to say that you should read a string id instead. soundDesc.addProperty("name", soundEvent.getId().getPath()); return soundDesc; @@ -26,8 +28,7 @@ public String getDataName() { @Override public JsonArray generateDataJson() { JsonArray resultsArray = new JsonArray(); - Registry soundEventRegistry = DGU.getWorld().getRegistryManager().get(RegistryKeys.SOUND_EVENT); - soundEventRegistry.forEach(sound -> resultsArray.add(generateSound(soundEventRegistry, sound))); + Registries.SOUND_EVENT.forEach(sound -> resultsArray.add(generateSound(sound))); return resultsArray; } } diff --git a/1.20/src/main/java/dev/u9g/minecraftdatagenerator/mixin/TheEndBiomeDataAccessor.java b/1.20/src/main/java/dev/u9g/minecraftdatagenerator/mixin/TheEndBiomeDataAccessor.java deleted file mode 100644 index dc35e0b3..00000000 --- a/1.20/src/main/java/dev/u9g/minecraftdatagenerator/mixin/TheEndBiomeDataAccessor.java +++ /dev/null @@ -1,29 +0,0 @@ -package dev.u9g.minecraftdatagenerator.mixin; - -import net.fabricmc.fabric.impl.biome.TheEndBiomeData; -import net.fabricmc.fabric.impl.biome.WeightedPicker; -import net.minecraft.registry.RegistryKey; -import net.minecraft.world.biome.Biome; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.gen.Accessor; - -import java.util.Map; - - -@Mixin(TheEndBiomeData.class) -public interface TheEndBiomeDataAccessor { - @Accessor(value = "END_BIOMES_MAP", remap = false) - static Map, WeightedPicker>> END_BIOMES_MAP() { - throw new IllegalStateException("Should never be called."); - } - - @Accessor(value = "END_MIDLANDS_MAP", remap = false) - static Map, WeightedPicker>> END_MIDLANDS_MAP() { - throw new IllegalStateException("Should never be called."); - } - - @Accessor(value = "END_BARRENS_MAP", remap = false) - static Map, WeightedPicker>> END_BARRENS_MAP() { - throw new IllegalStateException("Should never be called."); - } -} diff --git a/1.20/src/main/resources/fabric.mod.json b/1.20/src/main/resources/fabric.mod.json index dff18a06..ffac96b0 100644 --- a/1.20/src/main/resources/fabric.mod.json +++ b/1.20/src/main/resources/fabric.mod.json @@ -10,13 +10,11 @@ ], "contact": {}, "license": "MIT", - "environment": "server", "mixins": [ "minecraft-data-generator.mixins.json" ], "depends": { "fabricloader": "*", - "fabric": "*", "minecraft": "*" } } diff --git a/1.20/src/main/resources/minecraft-data-generator.mixins.json b/1.20/src/main/resources/minecraft-data-generator.mixins.json index f3afe061..bb73460d 100644 --- a/1.20/src/main/resources/minecraft-data-generator.mixins.json +++ b/1.20/src/main/resources/minecraft-data-generator.mixins.json @@ -7,8 +7,7 @@ "EntityTypeAccessor", "EULAMixin", "MiningToolItemAccessor", - "ReadyMixin", - "TheEndBiomeDataAccessor" + "ReadyMixin" ], "client": [ ], diff --git a/1.7/build.gradle b/1.7/build.gradle index 2f8a84a0..bcfbc104 100644 --- a/1.7/build.gradle +++ b/1.7/build.gradle @@ -1,65 +1,44 @@ -import net.fabricmc.loom.configuration.providers.minecraft.MinecraftJarConfiguration +import xyz.wagyourtail.unimined.internal.minecraft.MinecraftProvider plugins { - id 'fabric-loom' + id 'xyz.wagyourtail.unimined' } repositories { maven { - name = "u9g" - url = "https://maven.u9g.dev" + name = "wagyourtail releases" + url = "https://maven.wagyourtail.xyz/releases" } + maven { + name = "legacyfabric" + url "https://maven.legacyfabric.net/" + } + mavenCentral() } -loom { - setIntermediaryUrl('https://maven.legacyfabric.net/net/fabricmc/intermediary/%1$s/intermediary-%1$s-v2.jar') - customMinecraftManifest.set("https://legacyfabric.u9g.dev/v2/manifest/${minecraft_version}") +unimined.minecraft { + version "1.7" - splitMinecraftJar() - minecraftJarConfiguration = MinecraftJarConfiguration.MERGED + mappings { + legacyIntermediary() + legacyYarn(514) - runs { - mcData { - server() - - property("fabric.development", "false") - configName = "Generate Minecraft Data" - runDir = "run" - ideConfigGenerated = true - } + devFallbackNamespace "intermediary" } -} - -dependencies { - minecraft "com.mojang:minecraft:${project.minecraft_version}" - mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" - modImplementation libs.fabric.loader - - // Fabric API provides hooks for events, item registration, and more. As most mods will need this, it's included by default. - // If you know for a fact you don't, it's not required and can be safely removed. -// modImplementation ("net.legacyfabric.legacy-fabric-api:legacy-fabric-api:${fabric_version}") { -// exclude module: "legacy-fabric-entity-events-v1" -// } - implementation(project(":common")) + runs.config("server") { + javaVersion = JavaVersion.VERSION_21 + } - if (System.getProperty("os.name").toLowerCase().contains("mac")) { - implementation 'org.lwjgl.lwjgl:lwjgl_util:2.9.4-nightly-20150209' - implementation 'org.lwjgl.lwjgl:lwjgl:2.9.4-nightly-20150209' - implementation 'org.lwjgl.lwjgl:lwjgl-platform:2.9.4-nightly-20150209' + customPatcher(new CustomLegacyFabricMinecraftTransformer(project, delegate as MinecraftProvider)) { + it.loader libs.versions.fabric.loader.get() } + + defaultRemapJar = true } -if (System.getProperty("os.name").toLowerCase().contains("mac")) { - configurations.configureEach { - resolutionStrategy { - dependencySubstitution { - substitute module('org.lwjgl.lwjgl:lwjgl_util:2.9.2-nightly-201408222') with module('org.lwjgl.lwjgl:lwjgl_util:2.9.4-nightly-20150209') - substitute module('org.lwjgl.lwjgl:lwjgl:2.9.2-nightly-201408222') with module('org.lwjgl.lwjgl:lwjgl:2.9.4-nightly-20150209') - } - force 'org.lwjgl.lwjgl:lwjgl-platform:2.9.4-nightly-20150209' - } - } +dependencies { + implementation project(":common") } processResources { @@ -73,9 +52,3 @@ processResources { tasks.withType(JavaCompile).configureEach { it.options.encoding = "UTF-8" } - -java { - toolchain { - languageVersion.set(JavaLanguageVersion.of(17)) - } -} diff --git a/1.7/gradle.properties b/1.7/gradle.properties deleted file mode 100644 index e36413c8..00000000 --- a/1.7/gradle.properties +++ /dev/null @@ -1,6 +0,0 @@ -# Fabric Properties -# More versions available at: https://grayray75.github.io/LegacyFabric-Versions/ -minecraft_version=1.7 -yarn_mappings=1.7+build.202206071953 -# Dependencies -# More versions available at: https://grayray75.github.io/LegacyFabric-Versions/ diff --git a/1.7/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/BiomeBlockColors.java b/1.7/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/BiomeBlockColors.java deleted file mode 100644 index c032c331..00000000 --- a/1.7/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/BiomeBlockColors.java +++ /dev/null @@ -1,80 +0,0 @@ -package dev.u9g.minecraftdatagenerator.clientsideannoyances; - -import net.minecraft.block.*; -import net.minecraft.world.biome.Biome; - - -public class BiomeBlockColors { - // generated manually from each Biome's Biome#getBlockColor - public static int getBlockColor(Block block, Biome biome, int blockData) { - if (block instanceof LilyPadBlock) { - return 2129968; - } else if (block instanceof AbstractFluidBlock && block.getMaterial() == Material.WATER) { - int n = 0; - int n2 = 0; - int n3 = 0; - for (int i = -1; i <= 1; ++i) { - for (int j = -1; j <= 1; ++j) { - int n4 = biome.waterColor; - n += (n4 & 0xFF0000) >> 16; - n2 += (n4 & 0xFF00) >> 8; - n3 += n4 & 0xFF; - } - } - return (n / 9 & 0xFF) << 16 | (n2 / 9 & 0xFF) << 8 | n3 / 9 & 0xFF; - } else if (block instanceof AttachedStemBlock) { - int n = blockData * 32; - int n2 = 255 - blockData * 8; - int n3 = blockData * 4; - return n << 16 | n2 << 8 | n3; - } else if (block instanceof RedstoneWireBlock) { - return 0x800000; - } else if (block instanceof DoublePlantBlock) { - int n = ((DoublePlantBlock) block).method_6478(null, 0, 0, 0); - if (n == 2 || n == 3) { - return GrassColors.getGrassColor(biome); - } - } else if (block instanceof GrassBlock) { - int n = 0; - int n2 = 0; - int n3 = 0; - for (int i = -1; i <= 1; ++i) { - for (int j = -1; j <= 1; ++j) { - int n4 = GrassColors.getGrassColor(biome); - n += (n4 & 0xFF0000) >> 16; - n2 += (n4 & 0xFF00) >> 8; - n3 += n4 & 0xFF; - } - } - return (n / 9 & 0xFF) << 16 | (n2 / 9 & 0xFF) << 8 | n3 / 9 & 0xFF; - } else if (block instanceof Leaves1Block) { - if ((blockData & 3) == 1) { - return FoliageColors.getSpruceColor(); - } - if ((blockData & 3) == 2) { - return FoliageColors.getBirchColor(); - } - } else if (block instanceof LeavesBlock) { - int n = 0; - int n2 = 0; - int n3 = 0; - for (int i = -1; i <= 1; ++i) { - for (int j = -1; j <= 1; ++j) { - int n4 = FoliageColors.getColor(biome); - n += (n4 & 0xFF0000) >> 16; - n2 += (n4 & 0xFF00) >> 8; - n3 += n4 & 0xFF; - } - } - return (n / 9 & 0xFF) << 16 | (n2 / 9 & 0xFF) << 8 | n3 / 9 & 0xFF; - } else if (block instanceof SugarCaneBlock) { - return GrassColors.getGrassColor(biome); - } else if (block instanceof TallPlantBlock & blockData != 0) { - return GrassColors.getGrassColor(biome); - } else if (block instanceof VineBlock) { - return FoliageColors.getColor(biome); - } - - return 0xFFFFFF; - } -} diff --git a/1.7/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/FoliageColors.java b/1.7/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/FoliageColors.java deleted file mode 100644 index b5538a62..00000000 --- a/1.7/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/FoliageColors.java +++ /dev/null @@ -1,38 +0,0 @@ -package dev.u9g.minecraftdatagenerator.clientsideannoyances; - -import net.minecraft.util.math.MathHelper; -import net.minecraft.world.biome.Biome; - -public class FoliageColors { - private static int[] colorMap = new int[65536]; - - public static void setColorMap(int[] pixels) { - colorMap = pixels; - } - - public static int getColor(double temperature, double humidity) { - humidity *= temperature; - int i = (int) ((1.0D - temperature) * 255.0D); - int j = (int) ((1.0D - humidity) * 255.0D); - return colorMap[j << 8 | i]; - } - - public static int getSpruceColor() { - return 6396257; - } - - public static int getBirchColor() { - return 8431445; - } - - public static int getDefaultColor() { - return 4764952; - } - - public static int getColor(Biome biome) { - double d = MathHelper.clamp(biome.temperature, 0.0f, 1.0f); - double e = MathHelper.clamp(biome.downfall, 0.0f, 1.0f); - return FoliageColors.getColor(d, e); - } -} - diff --git a/1.7/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/GrassColors.java b/1.7/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/GrassColors.java deleted file mode 100644 index 0ca9862a..00000000 --- a/1.7/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/GrassColors.java +++ /dev/null @@ -1,27 +0,0 @@ -package dev.u9g.minecraftdatagenerator.clientsideannoyances; - -import net.minecraft.util.math.MathHelper; -import net.minecraft.world.biome.Biome; - -public class GrassColors { - private static int[] colorMap = new int[65536]; - - public static void setColorMap(int[] map) { - colorMap = map; - } - - public static int getColor(double temperature, double humidity) { - int n = (int) ((1.0 - temperature) * 255.0); - int n2 = (int) ((1.0 - (humidity *= temperature)) * 255.0); - return colorMap[n2 << 8 | n]; - } - - public static int getGrassColor(Biome biome) { - double d = MathHelper.clamp(biome.temperature, 0.0f, 1.0f); - double e = MathHelper.clamp(biome.downfall, 0.0f, 1.0f); - return GrassColors.getColor(d, e); - } -} - - - diff --git a/1.7/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/ServerSideRedstoneWireBlock.java b/1.7/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/ServerSideRedstoneWireBlock.java deleted file mode 100644 index 75c9f89c..00000000 --- a/1.7/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/ServerSideRedstoneWireBlock.java +++ /dev/null @@ -1,28 +0,0 @@ -package dev.u9g.minecraftdatagenerator.clientsideannoyances; - -import net.minecraft.util.math.MathHelper; - -public class ServerSideRedstoneWireBlock { - public static int getWireColor(int powerLevel) { - float f = (float) powerLevel / 15.0F; - float g = f * 0.6F + 0.4F; - if (powerLevel == 0) { - g = 0.3F; - } - - float h = f * f * 0.7F - 0.5F; - float j = f * f * 0.6F - 0.7F; - if (h < 0.0F) { - h = 0.0F; - } - - if (j < 0.0F) { - j = 0.0F; - } - - int k = MathHelper.clamp((int) (g * 255.0F), 0, 255); - int l = MathHelper.clamp((int) (h * 255.0F), 0, 255); - int m = MathHelper.clamp((int) (j * 255.0F), 0, 255); - return -16777216 | k << 16 | l << 8 | m; - } -} diff --git a/1.7/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java b/1.7/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java index 14a786ad..c42ab27c 100644 --- a/1.7/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java +++ b/1.7/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java @@ -44,7 +44,7 @@ public static JsonObject generateBlock(Block block) { blockDesc.addProperty("displayName", block.getTranslatedName()); } - float hardness = block.getHardness(null, 0, 0, 0); + float hardness = block.method_471(null, 0, 0, 0); blockDesc.addProperty("hardness", hardness); blockDesc.addProperty("resistance", ((BlockAccessor) block).getBlastResistance()); @@ -65,7 +65,7 @@ public static JsonObject generateBlock(Block block) { } private static String boundingBox(Block block) { - if (block.getCollisionBox(DGU.getWorld(), 0, 0, 0) == null) { + if (block.getBoundingBox(DGU.getWorld(), 0, 0, 0) == null) { return "empty"; } return "block"; diff --git a/1.7/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java b/1.7/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java index ebfcf936..ec013c69 100644 --- a/1.7/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java +++ b/1.7/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java @@ -31,7 +31,7 @@ public static JsonObject generateEntity(Class entityClass) { entityDesc.addProperty("id", id); entityDesc.addProperty("internalId", id); entityDesc.addProperty("name", Objects.requireNonNull(registryKey)); - String displayName = entity != null ? entity.getTranslatedName() : null; + String displayName = entity != null ? entity.getTranslationKey() : null; if (displayName != null && !displayName.startsWith("entity.")) { entityDesc.addProperty("displayName", displayName); } diff --git a/1.7/src/main/java/dev/u9g/minecraftdatagenerator/generators/InstrumentsDataGenerator.java b/1.7/src/main/java/dev/u9g/minecraftdatagenerator/generators/InstrumentsDataGenerator.java index 1054ac87..e028b7b9 100644 --- a/1.7/src/main/java/dev/u9g/minecraftdatagenerator/generators/InstrumentsDataGenerator.java +++ b/1.7/src/main/java/dev/u9g/minecraftdatagenerator/generators/InstrumentsDataGenerator.java @@ -4,7 +4,7 @@ import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonPrimitive; -import net.minecraft.block.Material; +import net.minecraft.block.material.Material; public class InstrumentsDataGenerator implements IDataGenerator { public static Material currentMaterial = null; diff --git a/1.7/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java b/1.7/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java index 3fdb1d98..dbfd2d9b 100644 --- a/1.7/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java +++ b/1.7/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java @@ -3,14 +3,13 @@ import com.google.gson.JsonArray; import com.google.gson.JsonObject; import com.google.gson.JsonPrimitive; -import dev.u9g.minecraftdatagenerator.clientsideannoyances.BiomeBlockColors; -import dev.u9g.minecraftdatagenerator.clientsideannoyances.FoliageColors; -import dev.u9g.minecraftdatagenerator.clientsideannoyances.GrassColors; import dev.u9g.minecraftdatagenerator.mixin.accessor.BiomeAccessor; -import dev.u9g.minecraftdatagenerator.util.EmptyBlockView; import dev.u9g.minecraftdatagenerator.util.Registries; import net.minecraft.block.Block; import net.minecraft.block.Blocks; +import net.minecraft.client.color.world.FoliageColors; +import net.minecraft.client.color.world.GrassColors; +import net.minecraft.util.math.MathHelper; import net.minecraft.world.biome.Biome; import java.util.*; @@ -21,8 +20,11 @@ public static BiomeTintColors generateBiomeTintColors() { BiomeTintColors colors = new BiomeTintColors(); for (Biome biome : Registries.BIOMES) { - int biomeGrassColor = GrassColors.getGrassColor(biome); - int biomeFoliageColor = FoliageColors.getColor(biome); + double d = MathHelper.clamp(biome.temperature, 0.0f, 1.0f); + double e = MathHelper.clamp(biome.downfall, 0.0f, 1.0f); + + int biomeGrassColor = GrassColors.getColor(d, e); + int biomeFoliageColor = FoliageColors.getColor(d, e); int biomeWaterColor = ((BiomeAccessor) biome).waterColor(); colors.grassColoursMap.computeIfAbsent(biomeGrassColor, k -> new ArrayList<>()).add(biome); @@ -32,24 +34,20 @@ public static BiomeTintColors generateBiomeTintColors() { return colors; } - private static int getBlockColor(Block block) { - return BiomeBlockColors.getBlockColor(block, EmptyBlockView.INSTANCE.getBiome(0, 0), 0); - } - public static Map generateConstantTintColors() { Map resultColors = new HashMap<>(); // FIXME: ? // resultColors.put(Blocks.BIRCH_LEAVES, FoliageColors.getBirchColor()); // resultColors.put(Blocks.SPRUCE_LEAVES, FoliageColors.getSpruceColor()); - resultColors.put(Registries.BLOCKS.get("waterlily"), getBlockColor(Blocks.LILY_PAD)); + resultColors.put(Registries.BLOCKS.get("waterlily"), Blocks.LILY_PAD.getColor()); // FIXME: ? // resultColors.put(Blocks.ATTACHED_MELON_STEM, getBlockColor(Blocks.ATTACHED_MELON_STEM, blockColors)); // resultColors.put(Blocks.ATTACHED_PUMPKIN_STEM, getBlockColor(Blocks.ATTACHED_PUMPKIN_STEM, blockColors)); //not really constant, depend on the block age, but kinda have to be handled since textures are literally white without them - resultColors.put(Registries.BLOCKS.get("melon_stem"), getBlockColor(Blocks.MELON_STEM)); - resultColors.put(Registries.BLOCKS.get("pumpkin_stem"), getBlockColor(Blocks.PUMPKIN_STEM)); + resultColors.put(Registries.BLOCKS.get("melon_stem"), Blocks.MELON_STEM.getColor()); + resultColors.put(Registries.BLOCKS.get("pumpkin_stem"), Blocks.PUMPKIN_STEM.getColor()); return resultColors; } diff --git a/1.7/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java b/1.7/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java index 82c7f134..328e52f0 100644 --- a/1.7/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java +++ b/1.7/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java @@ -2,6 +2,7 @@ import dev.u9g.minecraftdatagenerator.MinecraftDataGenerator; import dev.u9g.minecraftdatagenerator.util.DGU; +import net.fabricmc.loader.impl.util.SystemProperties; import net.minecraft.server.dedicated.MinecraftDedicatedServer; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; @@ -14,6 +15,7 @@ public class ReadyMixin { @Inject(method = "setupServer()Z", at = @At("TAIL")) private void init(CallbackInfoReturnable cir) { + System.setProperty("fabric.development", "false"); MinecraftDataGenerator.start( DGU.getCurrentlyRunningServer().getVersion(), (new File(".")).toPath() diff --git a/1.7/src/main/java/dev/u9g/minecraftdatagenerator/mixin/overwrite/ItemEntityOverwrite.java b/1.7/src/main/java/dev/u9g/minecraftdatagenerator/mixin/overwrite/ItemEntityOverwrite.java index 4aa5ec67..e2f9a197 100644 --- a/1.7/src/main/java/dev/u9g/minecraftdatagenerator/mixin/overwrite/ItemEntityOverwrite.java +++ b/1.7/src/main/java/dev/u9g/minecraftdatagenerator/mixin/overwrite/ItemEntityOverwrite.java @@ -18,7 +18,7 @@ public ItemEntityOverwrite(World world) { * @reason a */ @Overwrite - public String getTranslatedName() { - return super.getTranslatedName(); + public String getTranslationKey() { + return super.getTranslationKey(); } } diff --git a/1.7/src/main/java/dev/u9g/minecraftdatagenerator/util/EmptyBlockView.java b/1.7/src/main/java/dev/u9g/minecraftdatagenerator/util/EmptyBlockView.java deleted file mode 100644 index 6439917b..00000000 --- a/1.7/src/main/java/dev/u9g/minecraftdatagenerator/util/EmptyBlockView.java +++ /dev/null @@ -1,61 +0,0 @@ -package dev.u9g.minecraftdatagenerator.util; - -import net.minecraft.block.Block; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.class_5093; -import net.minecraft.world.BlockView; -import net.minecraft.world.biome.Biome; - -public class EmptyBlockView implements BlockView { - public static final EmptyBlockView INSTANCE = new EmptyBlockView(); - - @Override - public Block getBlock(int x, int y, int z) { - return null; - } - - @Override - public BlockEntity getBlockEntity(int x, int y, int z) { - return null; - } - - @Override - public int getBlockData(int x, int y, int z) { - return 0; - } - - @Override - public boolean isAir(int x, int y, int z) { - return false; - } - - @Override - public Biome getBiome(int x, int z) { - return null; - } - - @Override - public int method_3771() { - return 0; - } - - @Override - public boolean isEmpty() { - return false; - } - - @Override - public class_5093 method_22399() { - return null; - } - - @Override - public int method_3719(int i, int j, int k, int l) { - return 0; - } - - @Override - public int method_3778(int i, int j, int k, int l) { - return 0; - } -} diff --git a/1.7/src/main/resources/fabric.mod.json b/1.7/src/main/resources/fabric.mod.json index 12f9d70e..ffac96b0 100644 --- a/1.7/src/main/resources/fabric.mod.json +++ b/1.7/src/main/resources/fabric.mod.json @@ -10,7 +10,6 @@ ], "contact": {}, "license": "MIT", - "environment": "server", "mixins": [ "minecraft-data-generator.mixins.json" ], diff --git a/1.7/src/main/resources/minecraft-data-generator.mixins.json b/1.7/src/main/resources/minecraft-data-generator.mixins.json index 804329be..85658063 100644 --- a/1.7/src/main/resources/minecraft-data-generator.mixins.json +++ b/1.7/src/main/resources/minecraft-data-generator.mixins.json @@ -17,8 +17,6 @@ "accessor.StatusEffectAccessor", "overwrite.ItemEntityOverwrite" ], - "client": [ - ], "injectors": { "defaultRequire": 1 } diff --git a/1.8.9/build.gradle b/1.8.9/build.gradle index 735609c5..0a36654c 100644 --- a/1.8.9/build.gradle +++ b/1.8.9/build.gradle @@ -1,53 +1,44 @@ -import net.fabricmc.loom.configuration.providers.minecraft.MinecraftJarConfiguration +import xyz.wagyourtail.unimined.internal.minecraft.MinecraftProvider plugins { - id 'fabric-loom' + id 'xyz.wagyourtail.unimined' } repositories { maven { - name = "legacy-fabric" - url = "https://maven.legacyfabric.net" + name = "wagyourtail releases" + url = "https://maven.wagyourtail.xyz/releases" } + maven { + name = "legacyfabric" + url "https://maven.legacyfabric.net/" + } + mavenCentral() } -loom { - setIntermediaryUrl('https://maven.legacyfabric.net/net/fabricmc/intermediary/%1$s/intermediary-%1$s-v2.jar') - customMinecraftManifest.set("https://meta.legacyfabric.net/v2/manifest/${minecraft_version}") +unimined.minecraft { + version "1.8.9" - minecraftJarConfiguration = MinecraftJarConfiguration.MERGED -} + mappings { + legacyIntermediary() + legacyYarn(541) -dependencies { - minecraft "com.mojang:minecraft:${project.minecraft_version}" - mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" - modImplementation libs.fabric.loader - - // Fabric API provides hooks for events, item registration, and more. As most mods will need this, it's included by default. - // If you know for a fact you don't, it's not required and can be safely removed. -// modImplementation ("net.legacyfabric.legacy-fabric-api:legacy-fabric-api:${fabric_version}") { -// exclude module: "legacy-fabric-entity-events-v1" -// } + devFallbackNamespace "intermediary" + } - implementation(project(":common")) + runs.config("server") { + javaVersion = JavaVersion.VERSION_21 + } - if (System.getProperty("os.name").toLowerCase().contains("mac")) { - implementation 'org.lwjgl.lwjgl:lwjgl_util:2.9.4-nightly-20150209' - implementation 'org.lwjgl.lwjgl:lwjgl:2.9.4-nightly-20150209' - implementation 'org.lwjgl.lwjgl:lwjgl-platform:2.9.4-nightly-20150209' + customPatcher(new CustomLegacyFabricMinecraftTransformer(project, delegate as MinecraftProvider)) { + it.loader libs.versions.fabric.loader.get() } + + defaultRemapJar = true } -if (System.getProperty("os.name").toLowerCase().contains("mac")) { - configurations.configureEach { - resolutionStrategy { - dependencySubstitution { - substitute module('org.lwjgl.lwjgl:lwjgl_util:2.9.2-nightly-201408222') with module('org.lwjgl.lwjgl:lwjgl_util:2.9.4-nightly-20150209') - substitute module('org.lwjgl.lwjgl:lwjgl:2.9.2-nightly-201408222') with module('org.lwjgl.lwjgl:lwjgl:2.9.4-nightly-20150209') - } - force 'org.lwjgl.lwjgl:lwjgl-platform:2.9.4-nightly-20150209' - } - } +dependencies { + implementation project(":common") } processResources { @@ -61,9 +52,3 @@ processResources { tasks.withType(JavaCompile).configureEach { it.options.encoding = "UTF-8" } - -java { - toolchain { - languageVersion.set(JavaLanguageVersion.of(17)) - } -} diff --git a/1.8.9/gradle.properties b/1.8.9/gradle.properties deleted file mode 100644 index fb32dd58..00000000 --- a/1.8.9/gradle.properties +++ /dev/null @@ -1,6 +0,0 @@ -# Fabric Properties -# More versions available at: https://grayray75.github.io/LegacyFabric-Versions/ -minecraft_version=1.8.9 -yarn_mappings=1.8.9+build.202206020145 -# Dependencies -# More versions available at: https://grayray75.github.io/LegacyFabric-Versions/ diff --git a/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/BiomeBlockColors.java b/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/BiomeBlockColors.java deleted file mode 100644 index ee0d2201..00000000 --- a/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/BiomeBlockColors.java +++ /dev/null @@ -1,81 +0,0 @@ -package dev.u9g.minecraftdatagenerator.clientsideannoyances; - -import dev.u9g.minecraftdatagenerator.util.EmptyBlockView; -import net.minecraft.block.*; -import net.minecraft.client.color.world.BiomeColors; -import net.minecraft.client.color.world.FoliageColors; -import net.minecraft.util.math.BlockPos; - -import static net.minecraft.block.RedstoneWireBlock.POWER; - -public class BiomeBlockColors { - // generated manually from each Biome's Biome#getBlockColor - public static int getBlockColor(Block block, BlockState state) { - if (block instanceof AbstractFluidBlock) { - return BiomeColors.getWaterColor(EmptyBlockView.INSTANCE, BlockPos.ORIGIN); - } else if (block instanceof AttachedStemBlock) { - return getAttachedStemColor(state, block); - } else if (block instanceof DoublePlantBlock) { - EmptyBlockView bv = new EmptyBlockView() { - @Override - public BlockState getBlockState(BlockPos pos) { - return state; - } - }; - DoublePlantBlock.DoublePlantType doublePlantType = ((DoublePlantBlock) block).getVariant(bv, BlockPos.ORIGIN); - if (doublePlantType == DoublePlantBlock.DoublePlantType.GRASS || doublePlantType == DoublePlantBlock.DoublePlantType.FERN) { - return BiomeColors.getGrassColor(bv, BlockPos.ORIGIN); - } - } else if (block instanceof FlowerPotBlock) { - // FIXME: Yeah, flower pot block's color depends on the block inside of it, since we dont compute that, let's just not do anything -// Item item; -// BlockEntity blockEntity = view.getBlockEntity(pos); -// if (blockEntity instanceof FlowerPotBlockEntity && (item = ((FlowerPotBlockEntity)blockEntity).getItem()) instanceof BlockItem) { -// return Block.getBlockFromItem(item).getBlockColor(view, pos, id); -// } - } else if (block instanceof GrassBlock) { - return BiomeColors.getGrassColor(EmptyBlockView.INSTANCE, BlockPos.ORIGIN); - } else if (block instanceof Leaves1Block) { - return getLeaves1Color(state, block); - } else if (block instanceof LeavesBlock) { - return getLeavesColor(); - } else if (block instanceof RedstoneWireBlock) { - if (state.getBlock() == block) { - return ServerSideRedstoneWireBlock.getWireColor(state.get(POWER)); - } - } else if (block instanceof SugarCaneBlock || block instanceof TallPlantBlock) { - return GrassColors.getGrassColor(EmptyBlockView.INSTANCE.getBiome(BlockPos.ORIGIN)); - } else if (block instanceof VineBlock) { - return dev.u9g.minecraftdatagenerator.clientsideannoyances.FoliageColors.getFoliageColor(EmptyBlockView.INSTANCE.getBiome(BlockPos.ORIGIN)); - } - return 0xFFFFFF; - } - - private static int getLeaves1Color(BlockState blockState, Block block) { - if (blockState.getBlock() == block) { - PlanksBlock.WoodType woodType = blockState.get(Leaves1Block.VARIANT); - if (woodType == PlanksBlock.WoodType.SPRUCE) { - return net.minecraft.client.color.world.FoliageColors.getSpruceColor(); - } - if (woodType == PlanksBlock.WoodType.BIRCH) { - return FoliageColors.getBirchColor(); - } - } - return getLeavesColor(); - } - - private static int getLeavesColor() { - return FoliageColors.getColor(0.5, 1.0); - } - - private static int getAttachedStemColor(BlockState state, Block block) { - if (state.getBlock() != block) { - return 0xFFFFFF; - } - int i = state.get(AttachedStemBlock.AGE); - int j = i * 32; - int k = 255 - i * 8; - int l = i * 4; - return j << 16 | k << 8 | l; - } -} diff --git a/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/BiomeColors.java b/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/BiomeColors.java deleted file mode 100644 index fca5440a..00000000 --- a/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/BiomeColors.java +++ /dev/null @@ -1,46 +0,0 @@ -package dev.u9g.minecraftdatagenerator.clientsideannoyances; - -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.BlockView; -import net.minecraft.world.biome.Biome; - -import java.util.Iterator; - -public class BiomeColors { - private static final ColorProvider GRASS_COLOR = Biome::getGrassColor; - private static final ColorProvider FOLIAGE_COLOR = Biome::getFoliageColor; - private static final ColorProvider WATER_COLOR = (biome, pos) -> biome.waterColor; - - private static int getColor(BlockView view, BlockPos pos, ColorProvider provider) { - int i = 0; - int j = 0; - int k = 0; - - int l; - for (Iterator iterator = BlockPos.mutableIterate(pos.add(-1, 0, -1), pos.add(1, 0, 1)).iterator(); iterator.hasNext(); k += l & 255) { - BlockPos.Mutable mutable = (BlockPos.Mutable) iterator.next(); - l = provider.getColorAtPos(view.getBiome(mutable), mutable); - i += (l & 16711680) >> 16; - j += (l & '\uff00') >> 8; - } - - return (i / 9 & 255) << 16 | (j / 9 & 255) << 8 | k / 9 & 255; - } - - public static int getGrassColor(BlockView view, BlockPos pos) { - return getColor(view, pos, GRASS_COLOR); - } - - public static int getFoliageColor(BlockView view, BlockPos pos) { - return getColor(view, pos, FOLIAGE_COLOR); - } - - public static int getWaterColor(BlockView view, BlockPos pos) { - return getColor(view, pos, WATER_COLOR); - } - - interface ColorProvider { - int getColorAtPos(Biome biome, BlockPos pos); - } -} - diff --git a/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/FoliageColors.java b/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/FoliageColors.java deleted file mode 100644 index 1a55df05..00000000 --- a/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/FoliageColors.java +++ /dev/null @@ -1,38 +0,0 @@ -package dev.u9g.minecraftdatagenerator.clientsideannoyances; - -import net.minecraft.util.math.MathHelper; -import net.minecraft.world.biome.Biome; - -public class FoliageColors { - private static int[] colorMap = new int[65536]; - - public static void setColorMap(int[] pixels) { - colorMap = pixels; - } - - public static int getColor(double temperature, double humidity) { - humidity *= temperature; - int i = (int) ((1.0D - temperature) * 255.0D); - int j = (int) ((1.0D - humidity) * 255.0D); - return colorMap[j << 8 | i]; - } - - public static int getSpruceColor() { - return 6396257; - } - - public static int getBirchColor() { - return 8431445; - } - - public static int getDefaultColor() { - return 4764952; - } - - public static int getFoliageColor(Biome biome) { - double d = MathHelper.clamp(biome.temperature, 0.0f, 1.0f); - double e = MathHelper.clamp(biome.downfall, 0.0f, 1.0f); - return FoliageColors.getColor(d, e); - } -} - diff --git a/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/GrassColors.java b/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/GrassColors.java deleted file mode 100644 index ff015f9a..00000000 --- a/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/GrassColors.java +++ /dev/null @@ -1,29 +0,0 @@ -package dev.u9g.minecraftdatagenerator.clientsideannoyances; - -import net.minecraft.util.math.MathHelper; -import net.minecraft.world.biome.Biome; - -public class GrassColors { - private static int[] colorMap = new int[65536]; - - public static void setColorMap(int[] map) { - colorMap = map; - } - - public static int getColor(double temperature, double humidity) { - humidity *= temperature; - int i = (int) ((1.0D - temperature) * 255.0D); - int j = (int) ((1.0D - humidity) * 255.0D); - int k = j << 8 | i; - return k > colorMap.length ? -65281 : colorMap[k]; - } - - public static int getGrassColor(Biome biome) { - double d = MathHelper.clamp(biome.temperature, 0.0f, 1.0f); - double e = MathHelper.clamp(biome.downfall, 0.0f, 1.0f); - return GrassColors.getColor(d, e); - } -} - - - diff --git a/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/ServerSideRedstoneWireBlock.java b/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/ServerSideRedstoneWireBlock.java deleted file mode 100644 index 75c9f89c..00000000 --- a/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/ServerSideRedstoneWireBlock.java +++ /dev/null @@ -1,28 +0,0 @@ -package dev.u9g.minecraftdatagenerator.clientsideannoyances; - -import net.minecraft.util.math.MathHelper; - -public class ServerSideRedstoneWireBlock { - public static int getWireColor(int powerLevel) { - float f = (float) powerLevel / 15.0F; - float g = f * 0.6F + 0.4F; - if (powerLevel == 0) { - g = 0.3F; - } - - float h = f * f * 0.7F - 0.5F; - float j = f * f * 0.6F - 0.7F; - if (h < 0.0F) { - h = 0.0F; - } - - if (j < 0.0F) { - j = 0.0F; - } - - int k = MathHelper.clamp((int) (g * 255.0F), 0, 255); - int l = MathHelper.clamp((int) (h * 255.0F), 0, 255); - int m = MathHelper.clamp((int) (j * 255.0F), 0, 255); - return -16777216 | k << 16 | l << 8 | m; - } -} diff --git a/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/generators/BiomesDataGenerator.java b/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/generators/BiomesDataGenerator.java index 675e449f..8a7069e8 100644 --- a/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/generators/BiomesDataGenerator.java +++ b/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/generators/BiomesDataGenerator.java @@ -4,6 +4,7 @@ import com.google.gson.JsonObject; import dev.u9g.minecraftdatagenerator.mixin.BiomeAccessor; import dev.u9g.minecraftdatagenerator.util.Registries; +import net.minecraft.client.color.world.BiomeColors; import net.minecraft.world.biome.*; import org.apache.commons.lang3.StringUtils; @@ -20,91 +21,6 @@ private static String guessBiomeDimensionFromCategory(Biome biome) { return "overworld"; } - private static int getBiomeColorFor(String biomeDisplayNamed) { - if (biomeDisplayNamed.equals("Redwood Taiga Hills M")) { - biomeDisplayNamed = "MegaTaigaHills"; - } - String biomeDisplayName = StringUtils.join(biomeDisplayNamed.split(" "), ""); - return switch (biomeDisplayName) { - case "Ocean" -> 112; - case "Plains" -> 9286496; - case "Desert" -> 16421912; - case "ExtremeHills", "Extreme Hills" -> 6316128; - case "Forest" -> 353825; - case "Taiga" -> 747097; - case "Swampland" -> 522674; - case "River" -> 255; - case "Hell" -> 16711680; - case "TheEnd", "The End" -> 8421631; - case "FrozenOcean", "Frozen Ocean" -> 7368918; - case "FrozenRiver", "Frozen River" -> 10526975; - case "IcePlains", "Ice Plains" -> 16777215; - case "IceMountains", "Ice Mountains" -> 10526880; - case "MushroomIsland", "Mushroom Island" -> 16711935; - case "MushroomIslandShore", "Mushroom Island Shore" -> 10486015; - case "Beach" -> 16440917; - case "DesertHills", "Desert Hills" -> 13786898; - case "ForestHills", "Forest Hills" -> 2250012; - case "TaigaHills", "Taiga Hills" -> 1456435; - case "ExtremeHillsEdge", "Extreme Hills Edge" -> 7501978; - case "Jungle" -> 5470985; - case "JungleHills", "Jungle Hills" -> 2900485; - case "JungleEdge", "Jungle Edge" -> 6458135; - case "DeepOcean", "Deep Ocean" -> 48; - case "StoneBeach", "Stone Beach" -> 10658436; - case "ColdBeach", "Cold Beach" -> 16445632; - case "BirchForest", "Birch Forest" -> 3175492; - case "BirchForestHills", "Birch Forest Hills" -> 2055986; - case "RoofedForest", "Roofed Forest" -> 4215066; - case "ColdTaiga", "Cold Taiga" -> 3233098; - case "ColdTaigaHills", "Cold Taiga Hills" -> 2375478; - case "MegaTaiga", "Mega Taiga" -> 5858897; - case "MegaTaigaHills", "Mega Taiga Hills" -> 4542270; - case "ExtremeHills+", "Extreme Hills+" -> 5271632; - case "Savanna" -> 12431967; - case "SavannaPlateau", "Savanna Plateau" -> 10984804; - case "Mesa" -> 14238997; - case "MesaPlateauF", "Mesa Plateau F" -> 11573093; - case "MesaPlateau", "Mesa Plateau" -> 13274213; - case "TheEnd-Floatingislands", "The End - Floating islands" -> 8421631; - case "TheEnd-Mediumisland", "The End - Medium island" -> 8421631; - case "TheEnd-Highisland", "The End - High island" -> 8421631; - case "TheEnd-Barrenisland", "The End - Barren island" -> 8421631; - case "WarmOcean", "Warm Ocean" -> 172; - case "LukewarmOcean", "Lukewarm Ocean" -> 144; - case "ColdOcean", "Cold Ocean" -> 2105456; - case "WarmDeepOcean", "Warm Deep Ocean" -> 80; - case "LukewarmDeepOcean", "Lukewarm Deep Ocean" -> 64; - case "ColdDeepOcean", "Cold Deep Ocean" -> 2105400; - case "FrozenDeepOcean", "Frozen Deep Ocean" -> 4210832; - case "TheVoid", "The Void" -> 0; - case "SunflowerPlains", "Sunflower Plains" -> 11918216; - case "DesertM", "Desert M" -> 16759872; - case "ExtremeHillsM", "Extreme Hills M" -> 8947848; - case "FlowerForest", "Flower Forest" -> 2985545; - case "TaigaM", "Taiga M" -> 3378817; - case "SwamplandM", "Swampland M" -> 3145690; - case "IcePlainsSpikes", "Ice Plains Spikes" -> 11853020; - case "JungleM", "Jungle M" -> 8102705; - case "JungleEdgeM", "Jungle Edge M" -> 9089855; - case "BirchForestM", "Birch Forest M" -> 5807212; - case "BirchForestHillsM", "Birch Forest Hills M" -> 4687706; - case "RoofedForestM", "Roofed Forest M" -> 6846786; - case "ColdTaigaM", "Cold Taiga M" -> 5864818; - case "MegaSpruceTaiga", "Mega Spruce Taiga" -> 8490617; - case "MegaSpruceTaiga(Hills)", "Mega Spruce Taiga (Hills)" -> 7173990; - case "ExtremeHills+M", "Extreme Hills+ M" -> 7903352; - case "SavannaM", "Savanna M" -> 15063687; - case "SavannaPlateauM", "Savanna Plateau M" -> 13616524; - case "Mesa(Bryce)", "Mesa (Bryce)" -> 16739645; - case "MesaPlateauFM", "Mesa Plateau F M" -> 14204813; - case "MesaPlateauM", "Mesa Plateau M" -> 15905933; - case "BambooJungle", "Bamboo Jungle" -> 7769620; - case "BambooJungleHills", "Bamboo Jungle Hills" -> 3884810; - default -> throw new Error("Unexpected biome, with name: '" + biomeDisplayName + "'"); - }; - } - public static JsonObject generateBiomeInfo(Biome biome) { JsonObject biomeDesc = new JsonObject(); // Identifier registryKey = registry.getIdentifier(biome); @@ -117,7 +33,7 @@ public static JsonObject generateBiomeInfo(Biome biome) { biomeDesc.addProperty("depth", biome.depth); biomeDesc.addProperty("dimension", guessBiomeDimensionFromCategory(biome)); biomeDesc.addProperty("displayName", ((BiomeAccessor) biome).name()); - biomeDesc.addProperty("color", getBiomeColorFor(((BiomeAccessor) biome).name())); + biomeDesc.addProperty("color", biome.getSkyColor(biome.temperature)); biomeDesc.addProperty("rainfall", biome.downfall); return biomeDesc; diff --git a/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java b/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java index 477cebc1..55706a66 100644 --- a/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java +++ b/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java @@ -3,18 +3,18 @@ import com.google.gson.JsonArray; import com.google.gson.JsonObject; import com.google.gson.JsonPrimitive; -import dev.u9g.minecraftdatagenerator.clientsideannoyances.BiomeBlockColors; -import dev.u9g.minecraftdatagenerator.clientsideannoyances.FoliageColors; -import dev.u9g.minecraftdatagenerator.clientsideannoyances.GrassColors; -import dev.u9g.minecraftdatagenerator.clientsideannoyances.ServerSideRedstoneWireBlock; import dev.u9g.minecraftdatagenerator.mixin.BiomeAccessor; import dev.u9g.minecraftdatagenerator.util.Registries; import net.minecraft.block.Block; import net.minecraft.block.Blocks; import net.minecraft.block.RedstoneWireBlock; +import net.minecraft.client.color.world.FoliageColors; +import net.minecraft.client.color.world.GrassColors; import net.minecraft.util.Identifier; +import net.minecraft.util.math.MathHelper; import net.minecraft.world.biome.Biome; +import java.lang.reflect.Method; import java.util.*; public class TintsDataGenerator implements IDataGenerator { @@ -23,8 +23,11 @@ public static BiomeTintColors generateBiomeTintColors() { BiomeTintColors colors = new BiomeTintColors(); for (Biome biome : Registries.BIOMES) { - int biomeGrassColor = GrassColors.getGrassColor(biome); - int biomeFoliageColor = FoliageColors.getFoliageColor(biome); + double d = MathHelper.clamp(biome.temperature, 0.0F, 1.0F); + double e = MathHelper.clamp(biome.downfall, 0.0F, 1.0F); + + int biomeGrassColor = GrassColors.getColor(d, e); + int biomeFoliageColor = FoliageColors.getColor(d, e); int biomeWaterColor = ((BiomeAccessor) biome).waterColor(); colors.grassColoursMap.computeIfAbsent(biomeGrassColor, k -> new ArrayList<>()).add(biome); @@ -37,15 +40,19 @@ public static BiomeTintColors generateBiomeTintColors() { public static Map generateRedstoneTintColors() { Map resultColors = new HashMap<>(); - for (int redstoneLevel : RedstoneWireBlock.POWER.getValues()) { - int color = ServerSideRedstoneWireBlock.getWireColor(redstoneLevel); - resultColors.put(redstoneLevel, color); + RedstoneWireBlock redstoneWireBlock = new RedstoneWireBlock(); + try { + Method colorIntensity = RedstoneWireBlock.class.getDeclaredMethod("getColorIntensity", int.class); + colorIntensity.setAccessible(true); + for (int redstoneLevel : RedstoneWireBlock.POWER.getValues()) { + int color = (int) colorIntensity.invoke(redstoneWireBlock, redstoneLevel); + resultColors.put(redstoneLevel, color); + } + } catch (ReflectiveOperationException e) { + throw new RuntimeException(e); } - return resultColors; - } - private static int getBlockColor(Block block) { - return BiomeBlockColors.getBlockColor(block, block.getDefaultState()); + return resultColors; } public static Map generateConstantTintColors() { @@ -54,14 +61,14 @@ public static Map generateConstantTintColors() { // resultColors.put(Blocks.BIRCH_LEAVES, FoliageColors.getBirchColor()); // resultColors.put(Blocks.SPRUCE_LEAVES, FoliageColors.getSpruceColor()); - resultColors.put(Blocks.LILY_PAD, getBlockColor(Blocks.LILY_PAD)); + resultColors.put(Blocks.LILY_PAD, Blocks.LILY_PAD.getColor()); // FIXME: ? // resultColors.put(Blocks.ATTACHED_MELON_STEM, getBlockColor(Blocks.ATTACHED_MELON_STEM, blockColors)); // resultColors.put(Blocks.ATTACHED_PUMPKIN_STEM, getBlockColor(Blocks.ATTACHED_PUMPKIN_STEM, blockColors)); //not really constant, depend on the block age, but kinda have to be handled since textures are literally white without them - resultColors.put(Blocks.MELON_STEM, getBlockColor(Blocks.MELON_STEM)); - resultColors.put(Blocks.PUMPKIN_STEM, getBlockColor(Blocks.PUMPKIN_STEM)); + resultColors.put(Blocks.MELON_STEM, Blocks.MELON_STEM.getColor()); + resultColors.put(Blocks.PUMPKIN_STEM, Blocks.PUMPKIN_STEM.getColor()); return resultColors; } diff --git a/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/mixin/overwrite/CocoaBlockOverwrite.java b/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/mixin/overwrite/CocoaBlockOverwrite.java deleted file mode 100644 index 5158ecd6..00000000 --- a/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/mixin/overwrite/CocoaBlockOverwrite.java +++ /dev/null @@ -1,43 +0,0 @@ -package dev.u9g.minecraftdatagenerator.mixin.overwrite; - -import net.minecraft.block.BlockState; -import net.minecraft.block.CocoaBlock; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Box; -import net.minecraft.util.math.Direction; -import net.minecraft.world.World; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Overwrite; -import org.spongepowered.asm.mixin.Unique; - -@Mixin(CocoaBlock.class) -public class CocoaBlockOverwrite { - @Unique - private static Box collisionBox(BlockState state) { - Direction direction = state.get(CocoaBlock.FACING); - int i = state.get(CocoaBlock.AGE); - int j = 4 + i * 2; - int k = 5 + i * 2; - float f = (float) j / 2.0f; - return switch (direction) { - case SOUTH -> - new Box((8.0f - f) / 16.0f, (12.0f - (float) k) / 16.0f, (15.0f - (float) j) / 16.0f, (8.0f + f) / 16.0f, 0.75f, 0.9375f); - case NORTH -> - new Box((8.0f - f) / 16.0f, (12.0f - (float) k) / 16.0f, 0.0625f, (8.0f + f) / 16.0f, 0.75f, (1.0f + (float) j) / 16.0f); - case WEST -> - new Box(0.0625f, (12.0f - (float) k) / 16.0f, (8.0f - f) / 16.0f, (1.0f + (float) j) / 16.0f, 0.75f, (8.0f + f) / 16.0f); - case EAST -> - new Box((15.0f - (float) j) / 16.0f, (12.0f - (float) k) / 16.0f, (8.0f - f) / 16.0f, 0.9375f, 0.75f, (8.0f + f) / 16.0f); - default -> throw new Error("Should never hit here"); - }; - } - - /** - * @author a - * @reason a - */ - @Overwrite - public Box getCollisionBox(World world, BlockPos pos, BlockState state) { - return collisionBox(state); - } -} diff --git a/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/mixin/overwrite/EndPortalFrameBlockOverwrite.java b/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/mixin/overwrite/EndPortalFrameBlockOverwrite.java deleted file mode 100644 index f4ac01bf..00000000 --- a/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/mixin/overwrite/EndPortalFrameBlockOverwrite.java +++ /dev/null @@ -1,34 +0,0 @@ -package dev.u9g.minecraftdatagenerator.mixin.overwrite; - -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.EndPortalFrameBlock; -import net.minecraft.block.Material; -import net.minecraft.entity.Entity; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Box; -import net.minecraft.world.World; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Overwrite; - -import java.util.List; - -@Mixin(EndPortalFrameBlock.class) -public class EndPortalFrameBlockOverwrite extends Block { - protected EndPortalFrameBlockOverwrite(Material material) { - super(material); - } - - /** - * @author a - * @reason a - */ - @Overwrite() - public void appendCollisionBoxes(World world, BlockPos pos, BlockState state, Box box, List list, Entity entity) { - this.setBoundingBox(0.0F, 0.0F, 0.0F, 1.0F, 0.8125F, 1.0F); - super.appendCollisionBoxes(world, pos, state, box, list, entity); - this.setBoundingBox(0.3125F, 0.8125F, 0.3125F, 0.6875F, 1.0F, 0.6875F); - super.appendCollisionBoxes(world, pos, state, box, list, entity); - this.setBlockItemBounds(); - } -} diff --git a/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/mixin/overwrite/ItemEntityOverwrite.java b/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/mixin/overwrite/ItemEntityOverwrite.java deleted file mode 100644 index e2f9a197..00000000 --- a/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/mixin/overwrite/ItemEntityOverwrite.java +++ /dev/null @@ -1,24 +0,0 @@ -package dev.u9g.minecraftdatagenerator.mixin.overwrite; - -import net.minecraft.entity.Entity; -import net.minecraft.entity.ItemEntity; -import net.minecraft.world.World; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Overwrite; - -@Mixin(ItemEntity.class) -public abstract class ItemEntityOverwrite extends Entity { - - public ItemEntityOverwrite(World world) { - super(world); - } - - /** - * @author a - * @reason a - */ - @Overwrite - public String getTranslationKey() { - return super.getTranslationKey(); - } -} diff --git a/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/mixin/overwrite/SkeletonSkullBlockOverwrite.java b/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/mixin/overwrite/SkeletonSkullBlockOverwrite.java deleted file mode 100644 index c0e76338..00000000 --- a/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/mixin/overwrite/SkeletonSkullBlockOverwrite.java +++ /dev/null @@ -1,28 +0,0 @@ -package dev.u9g.minecraftdatagenerator.mixin.overwrite; - -import net.minecraft.block.BlockState; -import net.minecraft.block.SkeletonSkullBlock; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Box; -import net.minecraft.world.World; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Unique; - -@Mixin(SkeletonSkullBlock.class) -public class SkeletonSkullBlockOverwrite { - @Unique - private static Box boundingBox(BlockState state) { - return switch (state.get(SkeletonSkullBlock.FACING)) { - default -> new Box(0.25f, 0.0f, 0.25f, 0.75f, 0.5f, 0.75f); - case NORTH -> new Box(0.25f, 0.25f, 0.5f, 0.75f, 0.75f, 1.0f); - case SOUTH -> new Box(0.25f, 0.25f, 0.0f, 0.75f, 0.75f, 0.5f); - case WEST -> new Box(0.5f, 0.25f, 0.25f, 1.0f, 0.75f, 0.75f); - case EAST -> new Box(0.0f, 0.25f, 0.25f, 0.5f, 0.75f, 0.75f); - }; - } - - @Unique - public Box getCollisionBox(World world, BlockPos pos, BlockState state) { - return boundingBox(state); - } -} diff --git a/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/mixin/overwrite/StairBlockOverwrite.java b/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/mixin/overwrite/StairBlockOverwrite.java deleted file mode 100644 index 2da77868..00000000 --- a/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/mixin/overwrite/StairBlockOverwrite.java +++ /dev/null @@ -1,153 +0,0 @@ -package dev.u9g.minecraftdatagenerator.mixin.overwrite; - -import dev.u9g.minecraftdatagenerator.util.EmptyBlockView; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.Material; -import net.minecraft.block.StairsBlock; -import net.minecraft.entity.Entity; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Box; -import net.minecraft.util.math.Direction; -import net.minecraft.world.BlockView; -import net.minecraft.world.World; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Overwrite; -import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.Unique; - -import java.util.List; - -import static net.minecraft.block.StairsBlock.HALF; - -@Mixin(StairsBlock.class) -public abstract class StairBlockOverwrite extends Block { - protected StairBlockOverwrite(Material material) { - super(material); - } - - @Shadow - public abstract void setBoundingBox(BlockView view, BlockPos pos); - - @Shadow - public abstract boolean method_8911(BlockView blockView, BlockPos blockPos); - - /** - * @author a - * @reason a - */ - @Overwrite - public void appendCollisionBoxes(World world, BlockPos pos, BlockState state, Box box, List list, Entity entity) { - list.add(someFuncThatIRemade(state)); - super.appendCollisionBoxes(world, pos, state, box, list, entity); - EmptyBlockView bv = new EmptyBlockView() { - @Override - public BlockState getBlockState(BlockPos pos) { - return state; - } - }; - boolean bl = this.method_8911(bv, pos); - list.add(this.getCollisionBox(world, pos, state)); - if (bl && calculateWhichTypeOfStairThisIsButDoesntWorkBecauseWeDontHaveAdjBlocks(state)) { - list.add(this.getCollisionBox(world, pos, state)); - } - this.setBoundingBox(0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f); - } - - @Unique - public Box someFuncThatIRemade(BlockState state) { - if (state.get(HALF) == StairsBlock.Half.TOP) { - return new Box(0.0f, 0.5f, 0.0f, 1.0f, 1.0f, 1.0f); - } else { - return new Box(0.0f, 0.0f, 0.0f, 1.0f, 0.5f, 1.0f); - } - } - - @Unique - public boolean calculateWhichTypeOfStairThisIsButDoesntWorkBecauseWeDontHaveAdjBlocks(BlockState state) { - EmptyBlockView blockView = new EmptyBlockView() { - @Override - public BlockState getBlockState(BlockPos pos) { - return state; - } - }; - BlockState blockState2; - Block block; - BlockState blockState = blockView.getBlockState(BlockPos.ORIGIN); - Direction direction = blockState.get(StairsBlock.FACING); - StairsBlock.Half half = blockState.get(HALF); - boolean bl = half == StairsBlock.Half.TOP; - float f = 0.5f; - float g = 1.0f; - if (bl) { - f = 0.0f; - g = 0.5f; - } - float h = 0.0f; - float i = 0.5f; - float j = 0.5f; - float k = 1.0f; - boolean bl2 = false; - if (direction == Direction.EAST) { - BlockState blockState22 = blockView.getBlockState(BlockPos.ORIGIN); - Block block2 = blockState22.getBlock(); - if (StairsBlock.method_6513(block2) && half == blockState22.get(HALF)) { - Direction direction2 = blockState22.get(StairsBlock.FACING); - if (direction2 == Direction.NORTH && !StairsBlock.method_8907(blockView, BlockPos.ORIGIN, blockState)) { - j = 0.0f; - k = 0.5f; - bl2 = true; - } else if (direction2 == Direction.SOUTH && !StairsBlock.method_8907(blockView, BlockPos.ORIGIN, blockState)) { - j = 0.5f; - k = 1.0f; - bl2 = true; - } - } - } else if (direction == Direction.WEST) { - BlockState blockState23 = blockView.getBlockState(BlockPos.ORIGIN); - Block block3 = blockState23.getBlock(); - if (StairsBlock.method_6513(block3) && half == blockState23.get(HALF)) { - h = 0.5f; - i = 1.0f; - Direction direction2 = blockState23.get(StairsBlock.FACING); - if (direction2 == Direction.NORTH && !StairsBlock.method_8907(blockView, BlockPos.ORIGIN, blockState)) { - j = 0.0f; - k = 0.5f; - bl2 = true; - } else if (direction2 == Direction.SOUTH && !StairsBlock.method_8907(blockView, BlockPos.ORIGIN, blockState)) { - j = 0.5f; - k = 1.0f; - bl2 = true; - } - } - } else if (direction == Direction.SOUTH) { - BlockState blockState24 = blockView.getBlockState(BlockPos.ORIGIN); - Block block4 = blockState24.getBlock(); - if (StairsBlock.method_6513(block4) && half == blockState24.get(HALF)) { - j = 0.0f; - k = 0.5f; - Direction direction2 = blockState24.get(StairsBlock.FACING); - if (direction2 == Direction.WEST && !StairsBlock.method_8907(blockView, BlockPos.ORIGIN, blockState)) { - bl2 = true; - } else if (direction2 == Direction.EAST && !StairsBlock.method_8907(blockView, BlockPos.ORIGIN, blockState)) { - h = 0.5f; - i = 1.0f; - bl2 = true; - } - } - } else if (direction == Direction.NORTH && StairsBlock.method_6513(block = (blockState2 = blockView.getBlockState(BlockPos.ORIGIN)).getBlock()) && half == blockState2.get(HALF)) { - Direction direction2 = blockState2.get(StairsBlock.FACING); - if (direction2 == Direction.WEST && !StairsBlock.method_8907(blockView, BlockPos.ORIGIN, blockState)) { - bl2 = true; - } else if (direction2 == Direction.EAST && !StairsBlock.method_8907(blockView, BlockPos.ORIGIN, blockState)) { - h = 0.5f; - i = 1.0f; - bl2 = true; - } - } - if (bl2) { - this.setBoundingBox(h, f, j, i, g, k); - } - return bl2; - } -} diff --git a/1.8.9/src/main/resources/fabric.mod.json b/1.8.9/src/main/resources/fabric.mod.json index 12f9d70e..ffac96b0 100644 --- a/1.8.9/src/main/resources/fabric.mod.json +++ b/1.8.9/src/main/resources/fabric.mod.json @@ -10,7 +10,6 @@ ], "contact": {}, "license": "MIT", - "environment": "server", "mixins": [ "minecraft-data-generator.mixins.json" ], diff --git a/1.8.9/src/main/resources/minecraft-data-generator.mixins.json b/1.8.9/src/main/resources/minecraft-data-generator.mixins.json index 90389267..7bb04498 100644 --- a/1.8.9/src/main/resources/minecraft-data-generator.mixins.json +++ b/1.8.9/src/main/resources/minecraft-data-generator.mixins.json @@ -12,14 +12,7 @@ "MiningToolItemAccessor", "NoteBlockAccessor", "ReadyMixin", - "StatusEffectAccessor", - "overwrite.CocoaBlockOverwrite", - "overwrite.EndPortalFrameBlockOverwrite", - "overwrite.ItemEntityOverwrite", - "overwrite.SkeletonSkullBlockOverwrite", - "overwrite.StairBlockOverwrite" - ], - "client": [ + "StatusEffectAccessor" ], "injectors": { "defaultRequire": 1 diff --git a/1.9.4/build.gradle b/1.9.4/build.gradle index 735609c5..7506bc0b 100644 --- a/1.9.4/build.gradle +++ b/1.9.4/build.gradle @@ -1,53 +1,44 @@ -import net.fabricmc.loom.configuration.providers.minecraft.MinecraftJarConfiguration +import xyz.wagyourtail.unimined.internal.minecraft.MinecraftProvider plugins { - id 'fabric-loom' + id 'xyz.wagyourtail.unimined' } repositories { maven { - name = "legacy-fabric" - url = "https://maven.legacyfabric.net" + name = "wagyourtail releases" + url = "https://maven.wagyourtail.xyz/releases" } + maven { + name = "legacyfabric" + url "https://maven.legacyfabric.net/" + } + mavenCentral() } -loom { - setIntermediaryUrl('https://maven.legacyfabric.net/net/fabricmc/intermediary/%1$s/intermediary-%1$s-v2.jar') - customMinecraftManifest.set("https://meta.legacyfabric.net/v2/manifest/${minecraft_version}") +unimined.minecraft { + version "1.9.4" - minecraftJarConfiguration = MinecraftJarConfiguration.MERGED -} + mappings { + legacyIntermediary() + legacyYarn(541) -dependencies { - minecraft "com.mojang:minecraft:${project.minecraft_version}" - mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" - modImplementation libs.fabric.loader - - // Fabric API provides hooks for events, item registration, and more. As most mods will need this, it's included by default. - // If you know for a fact you don't, it's not required and can be safely removed. -// modImplementation ("net.legacyfabric.legacy-fabric-api:legacy-fabric-api:${fabric_version}") { -// exclude module: "legacy-fabric-entity-events-v1" -// } + devFallbackNamespace "intermediary" + } - implementation(project(":common")) + runs.config("server") { + javaVersion = JavaVersion.VERSION_21 + } - if (System.getProperty("os.name").toLowerCase().contains("mac")) { - implementation 'org.lwjgl.lwjgl:lwjgl_util:2.9.4-nightly-20150209' - implementation 'org.lwjgl.lwjgl:lwjgl:2.9.4-nightly-20150209' - implementation 'org.lwjgl.lwjgl:lwjgl-platform:2.9.4-nightly-20150209' + customPatcher(new CustomLegacyFabricMinecraftTransformer(project, delegate as MinecraftProvider)) { + it.loader libs.versions.fabric.loader.get() } + + defaultRemapJar = true } -if (System.getProperty("os.name").toLowerCase().contains("mac")) { - configurations.configureEach { - resolutionStrategy { - dependencySubstitution { - substitute module('org.lwjgl.lwjgl:lwjgl_util:2.9.2-nightly-201408222') with module('org.lwjgl.lwjgl:lwjgl_util:2.9.4-nightly-20150209') - substitute module('org.lwjgl.lwjgl:lwjgl:2.9.2-nightly-201408222') with module('org.lwjgl.lwjgl:lwjgl:2.9.4-nightly-20150209') - } - force 'org.lwjgl.lwjgl:lwjgl-platform:2.9.4-nightly-20150209' - } - } +dependencies { + implementation project(":common") } processResources { @@ -61,9 +52,3 @@ processResources { tasks.withType(JavaCompile).configureEach { it.options.encoding = "UTF-8" } - -java { - toolchain { - languageVersion.set(JavaLanguageVersion.of(17)) - } -} diff --git a/1.9.4/gradle.properties b/1.9.4/gradle.properties deleted file mode 100644 index 806b6dbc..00000000 --- a/1.9.4/gradle.properties +++ /dev/null @@ -1,6 +0,0 @@ -# Fabric Properties -# More versions available at: https://grayray75.github.io/LegacyFabric-Versions/ -minecraft_version=1.9.4 -yarn_mappings=1.9.4+build.202206020145 -# Dependencies -# More versions available at: https://grayray75.github.io/LegacyFabric-Versions/ diff --git a/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/BiomeColors.java b/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/BiomeColors.java deleted file mode 100644 index f42641fb..00000000 --- a/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/BiomeColors.java +++ /dev/null @@ -1,47 +0,0 @@ -package dev.u9g.minecraftdatagenerator.clientsideannoyances; - -import dev.u9g.minecraftdatagenerator.util.EmptyBlockView; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.biome.Biome; - -import java.util.Iterator; - -public class BiomeColors { - private static final ColorProvider GRASS_COLOR = Biome::getGrassColor; - private static final ColorProvider FOLIAGE_COLOR = Biome::getFoliageColor; - private static final ColorProvider WATER_COLOR = (biome, pos) -> biome.getWaterColor(); - - private static int getColor(EmptyBlockView view, BlockPos pos, ColorProvider provider) { - int i = 0; - int j = 0; - int k = 0; - - int l; - for (Iterator iterator = BlockPos.mutableIterate(pos.add(-1, 0, -1), pos.add(1, 0, 1)).iterator(); iterator.hasNext(); k += l & 255) { - BlockPos.Mutable mutable = (BlockPos.Mutable) iterator.next(); - l = provider.getColorAtPos(view.getBiome(mutable), mutable); - i += (l & 16711680) >> 16; - j += (l & '\uff00') >> 8; - } - - return (i / 9 & 255) << 16 | (j / 9 & 255) << 8 | k / 9 & 255; - } - - public static int getGrassColor(EmptyBlockView view, BlockPos pos) { - return getColor(view, pos, GRASS_COLOR); - } - - public static int getFoliageColor(EmptyBlockView view, BlockPos pos) { - return getColor(view, pos, FOLIAGE_COLOR); - } - - public static int getWaterColor(EmptyBlockView view, BlockPos pos) { - return getColor(view, pos, WATER_COLOR); - } - - interface ColorProvider { - int getColorAtPos(Biome biome, BlockPos pos); - } -} - - diff --git a/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/BlockColorable.java b/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/BlockColorable.java deleted file mode 100644 index b6819227..00000000 --- a/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/BlockColorable.java +++ /dev/null @@ -1,10 +0,0 @@ -package dev.u9g.minecraftdatagenerator.clientsideannoyances; - -import dev.u9g.minecraftdatagenerator.util.EmptyBlockView; -import net.minecraft.block.BlockState; -import net.minecraft.util.math.BlockPos; -import org.jetbrains.annotations.Nullable; - -public interface BlockColorable { - int method_12155(BlockState blockState, @Nullable EmptyBlockView blockView, @Nullable BlockPos blockPos, int i); -} diff --git a/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/BlockColors.java b/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/BlockColors.java deleted file mode 100644 index 2bd090ca..00000000 --- a/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/BlockColors.java +++ /dev/null @@ -1,96 +0,0 @@ -package dev.u9g.minecraftdatagenerator.clientsideannoyances; - -import dev.u9g.minecraftdatagenerator.util.EmptyBlockView; -import net.minecraft.block.*; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.block.entity.FlowerPotBlockEntity; -import net.minecraft.item.BlockItem; -import net.minecraft.item.Item; -import net.minecraft.util.collection.IdList; -import net.minecraft.util.math.BlockPos; -import org.jetbrains.annotations.Nullable; - -public class BlockColors { - private final IdList BlockColor2Id = new IdList<>(32); - - public BlockColors() { - } - - public static BlockColors create() { - final BlockColors blockColors = new BlockColors(); - blockColors.method_12158((blockState, blockView, blockPos, i) -> { - DoublePlantBlock.DoublePlantType doublePlantType = blockState.get(DoublePlantBlock.VARIANT); - return blockView == null || blockPos == null || doublePlantType != DoublePlantBlock.DoublePlantType.GRASS && doublePlantType != DoublePlantBlock.DoublePlantType.FERN ? -1 : BiomeColors.getGrassColor(blockView, blockPos); - }, Blocks.DOUBLE_PLANT); - blockColors.method_12158((blockState, blockView, blockPos, i) -> { - if (blockView != null && blockPos != null) { - BlockEntity blockEntity = blockView.getBlockEntity(blockPos); - if (blockEntity instanceof FlowerPotBlockEntity) { - Item item = ((FlowerPotBlockEntity) blockEntity).getItem(); - if (item instanceof BlockItem) { - BlockState blockState2 = Block.getBlockFromItem(item).getDefaultState(); - return blockColors.method_12157(blockState2, blockView, blockPos, i); - } - } - } - - return -1; - }, Blocks.FLOWER_POT); - blockColors.method_12158((blockState, blockView, blockPos, i) -> blockView != null && blockPos != null ? BiomeColors.getGrassColor(blockView, blockPos) : GrassColors.getColor(0.5D, 1.0D), Blocks.GRASS); - blockColors.method_12158((blockState, blockView, blockPos, i) -> { - PlanksBlock.WoodType woodType = blockState.get(Leaves1Block.VARIANT); - if (woodType == PlanksBlock.WoodType.SPRUCE) { - return FoliageColors.getSpruceColor(); - } else if (woodType == PlanksBlock.WoodType.BIRCH) { - return FoliageColors.getBirchColor(); - } else { - return blockView != null && blockPos != null ? BiomeColors.getFoliageColor(blockView, blockPos) : FoliageColors.getDefaultColor(); - } - }, Blocks.LEAVES); - blockColors.method_12158((blockState, blockView, blockPos, i) -> blockView != null && blockPos != null ? BiomeColors.getFoliageColor(blockView, blockPos) : FoliageColors.getDefaultColor(), Blocks.LEAVES2); - blockColors.method_12158((blockState, blockView, blockPos, i) -> blockView != null && blockPos != null ? BiomeColors.getWaterColor(blockView, blockPos) : -1, Blocks.WATER, Blocks.FLOWING_WATER); - blockColors.method_12158((blockState, blockView, blockPos, i) -> RedstoneWireBlock.method_8877(blockState.get(RedstoneWireBlock.POWER)), Blocks.REDSTONE_WIRE); - blockColors.method_12158((blockState, blockView, blockPos, i) -> blockView != null && blockPos != null ? BiomeColors.getGrassColor(blockView, blockPos) : -1, Blocks.SUGARCANE); - blockColors.method_12158((blockState, blockView, blockPos, i) -> { - int j = blockState.get(AttachedStemBlock.AGE); - int k = j * 32; - int l = 255 - j * 8; - int m = j * 4; - return k << 16 | l << 8 | m; - }, Blocks.MELON_STEM, Blocks.PUMPKIN_STEM); - blockColors.method_12158((blockState, blockView, blockPos, i) -> { - if (blockView != null && blockPos != null) { - return BiomeColors.getGrassColor(blockView, blockPos); - } else { - return blockState.get(TallPlantBlock.TYPE) == TallPlantBlock.GrassType.DEAD_BUSH ? 16777215 : GrassColors.getColor(0.5D, 1.0D); - } - }, Blocks.TALLGRASS); - blockColors.method_12158((blockState, blockView, blockPos, i) -> blockView != null && blockPos != null ? BiomeColors.getFoliageColor(blockView, blockPos) : FoliageColors.getDefaultColor(), Blocks.VINE); - blockColors.method_12158((blockState, blockView, blockPos, i) -> blockView != null && blockPos != null ? 2129968 : 7455580, Blocks.LILY_PAD); - return blockColors; - } - - public int method_13410(BlockState blockState) { - BlockColorable blockColorable = this.BlockColor2Id.fromId(Block.getIdByBlock(blockState.getBlock())); - if (blockColorable != null) { - return blockColorable.method_12155(blockState, null, null, 0); - } else { - MaterialColor materialColor = blockState.getMaterialColor(); - return materialColor != null ? materialColor.color : -1; - } - } - - public int method_12157(BlockState blockState, @Nullable EmptyBlockView blockView, @Nullable BlockPos blockPos, int i) { - BlockColorable blockColorable = this.BlockColor2Id.fromId(Block.getIdByBlock(blockState.getBlock())); - return blockColorable == null ? -1 : blockColorable.method_12155(blockState, blockView, blockPos, i); - } - - public void method_12158(BlockColorable blockColorable, Block... blocks) { - int i = blocks.length; - - for (Block block : blocks) { - this.BlockColor2Id.set(blockColorable, Block.getIdByBlock(block)); - } - - } -} diff --git a/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/FoliageColors.java b/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/FoliageColors.java deleted file mode 100644 index b63e543b..00000000 --- a/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/FoliageColors.java +++ /dev/null @@ -1,37 +0,0 @@ -package dev.u9g.minecraftdatagenerator.clientsideannoyances; - -import net.minecraft.util.math.MathHelper; -import net.minecraft.world.biome.Biome; - -public class FoliageColors { - private static int[] colorMap = new int[65536]; - - public static void setColorMap(int[] pixels) { - colorMap = pixels; - } - - public static int getColor(double temperature, double humidity) { - humidity *= temperature; - int i = (int) ((1.0D - temperature) * 255.0D); - int j = (int) ((1.0D - humidity) * 255.0D); - return colorMap[j << 8 | i]; - } - - public static int getSpruceColor() { - return 6396257; - } - - public static int getBirchColor() { - return 8431445; - } - - public static int getDefaultColor() { - return 4764952; - } - - public static int getFoliageColor(Biome biome) { - double d = MathHelper.clamp(biome.getTemperature(), 0.0F, 1.0F); - double e = MathHelper.clamp(biome.getRainfall(), 0.0F, 1.0F); - return FoliageColors.getColor(d, e); - } -} diff --git a/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/GrassColors.java b/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/GrassColors.java deleted file mode 100644 index afee2b70..00000000 --- a/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/GrassColors.java +++ /dev/null @@ -1,29 +0,0 @@ -package dev.u9g.minecraftdatagenerator.clientsideannoyances; - -import net.minecraft.util.math.MathHelper; -import net.minecraft.world.biome.Biome; - -public class GrassColors { - private static int[] colorMap = new int[65536]; - - public static void setColorMap(int[] map) { - colorMap = map; - } - - public static int getColor(double temperature, double humidity) { - humidity *= temperature; - int i = (int) ((1.0D - temperature) * 255.0D); - int j = (int) ((1.0D - humidity) * 255.0D); - int k = j << 8 | i; - return k > colorMap.length ? -65281 : colorMap[k]; - } - - public static int getGrassColor(Biome biome) { - double d = MathHelper.clamp(biome.getTemperature(), 0.0F, 1.0F); - double e = MathHelper.clamp(biome.getRainfall(), 0.0F, 1.0F); - return GrassColors.getColor(d, e); - } -} - - - diff --git a/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/ServerSideRedstoneWireBlock.java b/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/ServerSideRedstoneWireBlock.java deleted file mode 100644 index 75c9f89c..00000000 --- a/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/ServerSideRedstoneWireBlock.java +++ /dev/null @@ -1,28 +0,0 @@ -package dev.u9g.minecraftdatagenerator.clientsideannoyances; - -import net.minecraft.util.math.MathHelper; - -public class ServerSideRedstoneWireBlock { - public static int getWireColor(int powerLevel) { - float f = (float) powerLevel / 15.0F; - float g = f * 0.6F + 0.4F; - if (powerLevel == 0) { - g = 0.3F; - } - - float h = f * f * 0.7F - 0.5F; - float j = f * f * 0.6F - 0.7F; - if (h < 0.0F) { - h = 0.0F; - } - - if (j < 0.0F) { - j = 0.0F; - } - - int k = MathHelper.clamp((int) (g * 255.0F), 0, 255); - int l = MathHelper.clamp((int) (h * 255.0F), 0, 255); - int m = MathHelper.clamp((int) (j * 255.0F), 0, 255); - return -16777216 | k << 16 | l << 8 | m; - } -} diff --git a/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/InstrumentsDataGenerator.java b/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/InstrumentsDataGenerator.java index 3aa51c41..dc0692d8 100644 --- a/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/InstrumentsDataGenerator.java +++ b/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/InstrumentsDataGenerator.java @@ -5,7 +5,7 @@ import com.google.gson.JsonObject; import dev.u9g.minecraftdatagenerator.mixin.NoteBlockAccessor; import dev.u9g.minecraftdatagenerator.mixin.SoundAccessor; -import net.minecraft.client.sound.SoundEvent; +import net.minecraft.sound.Sound; import java.util.Objects; @@ -19,7 +19,7 @@ public String getDataName() { public JsonElement generateDataJson() { JsonArray array = new JsonArray(); int i = 0; - for (SoundEvent sound : Objects.requireNonNull(NoteBlockAccessor.TUNES())) { + for (Sound sound : Objects.requireNonNull(NoteBlockAccessor.TUNES())) { JsonObject object = new JsonObject(); object.addProperty("id", i++); object.addProperty("name", ((SoundAccessor) sound).id().getPath().split("\\.")[2]); diff --git a/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java b/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java index 9429a29a..471d668b 100644 --- a/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java +++ b/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java @@ -3,15 +3,14 @@ import com.google.gson.JsonArray; import com.google.gson.JsonObject; import dev.u9g.minecraftdatagenerator.mixin.SoundAccessor; -import net.minecraft.client.sound.SoundEvent; - +import net.minecraft.sound.Sound; public class SoundsDataGenerator implements IDataGenerator { - public static JsonObject generateSound(SoundEvent soundEvent) { + public static JsonObject generateSound(Sound soundEvent) { JsonObject soundDesc = new JsonObject(); - soundDesc.addProperty("id", SoundEvent.REGISTRY.getRawId(soundEvent)); + soundDesc.addProperty("id", Sound.REGISTRY.getRawId(soundEvent)); soundDesc.addProperty("name", ((SoundAccessor) soundEvent).id().getPath()); return soundDesc; @@ -25,7 +24,7 @@ public String getDataName() { @Override public JsonArray generateDataJson() { JsonArray resultsArray = new JsonArray(); - SoundEvent.REGISTRY.forEach(sound -> resultsArray.add(generateSound(sound))); + Sound.REGISTRY.forEach(sound -> resultsArray.add(generateSound(sound))); return resultsArray; } } diff --git a/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java b/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java index 17a457e1..35c25173 100644 --- a/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java +++ b/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java @@ -3,30 +3,32 @@ import com.google.gson.JsonArray; import com.google.gson.JsonObject; import com.google.gson.JsonPrimitive; -import dev.u9g.minecraftdatagenerator.clientsideannoyances.BlockColors; -import dev.u9g.minecraftdatagenerator.clientsideannoyances.FoliageColors; -import dev.u9g.minecraftdatagenerator.clientsideannoyances.GrassColors; -import dev.u9g.minecraftdatagenerator.clientsideannoyances.ServerSideRedstoneWireBlock; import dev.u9g.minecraftdatagenerator.mixin.BiomeAccessor; +import dev.u9g.minecraftdatagenerator.util.DGU; import dev.u9g.minecraftdatagenerator.util.Registries; import net.minecraft.block.Block; import net.minecraft.block.Blocks; import net.minecraft.block.RedstoneWireBlock; +import net.minecraft.client.BlockColors; +import net.minecraft.client.color.world.FoliageColors; +import net.minecraft.client.color.world.GrassColors; import net.minecraft.util.Identifier; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.MathHelper; import net.minecraft.world.biome.Biome; import java.util.*; public class TintsDataGenerator implements IDataGenerator { - - private static final BlockColors blockColors = BlockColors.create(); - public static BiomeTintColors generateBiomeTintColors() { BiomeTintColors colors = new BiomeTintColors(); for (Biome biome : Registries.BIOMES) { - int biomeGrassColor = GrassColors.getGrassColor(biome); - int biomeFoliageColor = FoliageColors.getFoliageColor(biome); + double d = MathHelper.clamp(biome.getTemperature(), 0.0f, 1.0f); + double e = MathHelper.clamp(biome.getRainfall(), 0.0f, 1.0f); + + int biomeGrassColor = GrassColors.getColor(d, e); + int biomeFoliageColor = FoliageColors.getColor(d, e); int biomeWaterColor = ((BiomeAccessor) biome).waterColor(); colors.grassColoursMap.computeIfAbsent(biomeGrassColor, k -> new ArrayList<>()).add(biome); @@ -40,19 +42,18 @@ public static Map generateRedstoneTintColors() { Map resultColors = new HashMap<>(); for (int redstoneLevel : RedstoneWireBlock.POWER.getValues()) { - int color = ServerSideRedstoneWireBlock.getWireColor(redstoneLevel); + int color = RedstoneWireBlock.getColorIntensity(redstoneLevel); resultColors.put(redstoneLevel, color); } return resultColors; } private static int getBlockColor(Block block) { - return blockColors.method_13410(block.getDefaultState()); + return BlockColors.create().method_12157(block.getDefaultState(), DGU.getWorld(), BlockPos.ORIGIN, 0); } public static Map generateConstantTintColors() { Map resultColors = new HashMap<>(); - BlockColors blockColors = BlockColors.create(); // FIXME: ? // resultColors.put(Blocks.BIRCH_LEAVES, FoliageColors.getBirchColor()); // resultColors.put(Blocks.SPRUCE_LEAVES, FoliageColors.getSpruceColor()); diff --git a/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/mixin/NoteBlockAccessor.java b/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/mixin/NoteBlockAccessor.java index 4bc3bcb9..688aa1c6 100644 --- a/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/mixin/NoteBlockAccessor.java +++ b/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/mixin/NoteBlockAccessor.java @@ -1,7 +1,7 @@ package dev.u9g.minecraftdatagenerator.mixin; import net.minecraft.block.NoteBlock; -import net.minecraft.client.sound.SoundEvent; +import net.minecraft.sound.Sound; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.gen.Accessor; @@ -10,7 +10,7 @@ @Mixin(NoteBlock.class) public interface NoteBlockAccessor { @Accessor("TUNES") - static List TUNES() { + static List TUNES() { return null; } } diff --git a/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/mixin/SoundAccessor.java b/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/mixin/SoundAccessor.java index fe505910..d39eac0b 100644 --- a/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/mixin/SoundAccessor.java +++ b/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/mixin/SoundAccessor.java @@ -1,11 +1,11 @@ package dev.u9g.minecraftdatagenerator.mixin; -import net.minecraft.client.sound.SoundEvent; +import net.minecraft.sound.Sound; import net.minecraft.util.Identifier; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.gen.Accessor; -@Mixin(SoundEvent.class) +@Mixin(Sound.class) public interface SoundAccessor { @Accessor("id") Identifier id(); diff --git a/1.9.4/src/main/resources/fabric.mod.json b/1.9.4/src/main/resources/fabric.mod.json index 12f9d70e..ffac96b0 100644 --- a/1.9.4/src/main/resources/fabric.mod.json +++ b/1.9.4/src/main/resources/fabric.mod.json @@ -10,7 +10,6 @@ ], "contact": {}, "license": "MIT", - "environment": "server", "mixins": [ "minecraft-data-generator.mixins.json" ], diff --git a/1.9.4/src/main/resources/minecraft-data-generator.mixins.json b/1.9.4/src/main/resources/minecraft-data-generator.mixins.json index 4dd13158..7cb7a2a5 100644 --- a/1.9.4/src/main/resources/minecraft-data-generator.mixins.json +++ b/1.9.4/src/main/resources/minecraft-data-generator.mixins.json @@ -17,8 +17,6 @@ "SoundAccessor", "StatusEffectAccessor" ], - "client": [ - ], "injectors": { "defaultRequire": 1 }, diff --git a/22w19a/build.gradle b/22w19a/build.gradle index 9dd880c9..112cc7fa 100644 --- a/22w19a/build.gradle +++ b/22w19a/build.gradle @@ -1,23 +1,40 @@ -import net.fabricmc.loom.configuration.providers.minecraft.MinecraftJarConfiguration +import xyz.wagyourtail.unimined.internal.minecraft.MinecraftProvider plugins { - id 'fabric-loom' + id 'xyz.wagyourtail.unimined' } -loom { - minecraftJarConfiguration = MinecraftJarConfiguration.MERGED +repositories { + maven { + name = "wagyourtail releases" + url = "https://maven.wagyourtail.xyz/releases" + } + mavenCentral() } -dependencies { - // To change the versions see the gradle.properties file - minecraft "com.mojang:minecraft:${project.minecraft_version}" - mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" - modImplementation libs.fabric.loader +unimined.minecraft { + version "22w19a" + + mappings { + intermediary() + yarn(1) + + devFallbackNamespace "intermediary" + } + + runs.config("server") { + javaVersion = JavaVersion.VERSION_21 + } - // Fabric API. This is technically optional, but you probably want it anyway. - modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" + customPatcher(new CustomOfficialFabricMinecraftTransformer(project, delegate as MinecraftProvider)) { + it.loader libs.versions.fabric.loader.get() + } + + defaultRemapJar = true +} - implementation(project(":common")) +dependencies { + implementation project(":common") } processResources { @@ -31,9 +48,3 @@ processResources { tasks.withType(JavaCompile).configureEach { it.options.encoding = "UTF-8" } - -java { - toolchain { - languageVersion.set(JavaLanguageVersion.of(17)) - } -} diff --git a/22w19a/gradle.properties b/22w19a/gradle.properties deleted file mode 100644 index d7edbaff..00000000 --- a/22w19a/gradle.properties +++ /dev/null @@ -1,7 +0,0 @@ -# Fabric Properties -# check these on https://modmuss50.me/fabric.html -minecraft_version=22w19a -yarn_mappings=22w19a+build.1 -# Dependencies -# check this on https://modmuss50.me/fabric.html -fabric_version=0.52.2+1.19 diff --git a/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/generators/BiomesDataGenerator.java b/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/generators/BiomesDataGenerator.java index 1d365498..0dca8c4a 100644 --- a/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/generators/BiomesDataGenerator.java +++ b/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/generators/BiomesDataGenerator.java @@ -2,42 +2,42 @@ import com.google.gson.JsonArray; import com.google.gson.JsonObject; -import dev.u9g.minecraftdatagenerator.mixin.TheEndBiomeDataAccessor; import dev.u9g.minecraftdatagenerator.util.DGU; -import net.fabricmc.fabric.api.biome.v1.NetherBiomes; +import net.minecraft.tag.BiomeTags; import net.minecraft.util.Identifier; +import net.minecraft.util.registry.BuiltinRegistries; import net.minecraft.util.registry.DynamicRegistryManager; import net.minecraft.util.registry.Registry; +import net.minecraft.util.registry.RegistryKey; import net.minecraft.world.biome.Biome; public class BiomesDataGenerator implements IDataGenerator { - - private static String guessBiomeDimensionFromCategory(Biome biome) { - // FIND A WAY TO FIND WHAT CATEGORY THE BIOME IS - var key = DynamicRegistryManager.BUILTIN.get().get(Registry.BIOME_KEY).getKey(biome).orElseThrow(); - System.out.println(DynamicRegistryManager.BUILTIN.get().get(Registry.BIOME_KEY).getKey(biome).orElseThrow()); - if (NetherBiomes.canGenerateInNether(key)) { + private static String guessBiomeDimensionFromCategory(RegistryKey biome) { + var biomeRegistry = BuiltinRegistries.BIOME; + if (biomeRegistry.getEntry(biome).orElseThrow().isIn(BiomeTags.IS_NETHER)) { return "nether"; - } else if (TheEndBiomeDataAccessor.END_BARRENS_MAP().containsKey(key) || TheEndBiomeDataAccessor.END_BIOMES_MAP().containsKey(key) || TheEndBiomeDataAccessor.END_MIDLANDS_MAP().containsKey(key)) { + } else if (biomeRegistry.getEntry(biome).orElseThrow().isIn(BiomeTags.IS_END)) { return "end"; + } else { + return "overworld"; } - return "overworld"; } public static JsonObject generateBiomeInfo(Registry registry, Biome biome) { JsonObject biomeDesc = new JsonObject(); - Identifier registryKey = registry.getKey(biome).orElseThrow().getValue(); - String localizationKey = String.format("biome.%s.%s", registryKey.getNamespace(), registryKey.getPath()); + RegistryKey registryKey = registry.getKey(biome).orElseThrow(); + Identifier identifier = registryKey.getValue(); + String localizationKey = String.format("biome.%s.%s", identifier.getNamespace(), identifier.getPath()); biomeDesc.addProperty("id", registry.getRawId(biome)); - biomeDesc.addProperty("name", registryKey.getPath()); + biomeDesc.addProperty("name", identifier.getPath()); //FIXME: this... biomeDesc.addProperty("category", ""); biomeDesc.addProperty("temperature", biome.getTemperature()); biomeDesc.addProperty("precipitation", biome.getPrecipitation().getName()); //biomeDesc.addProperty("depth", biome.getDepth()); - Doesn't exist anymore in minecraft source - biomeDesc.addProperty("dimension", guessBiomeDimensionFromCategory(biome)); + biomeDesc.addProperty("dimension", guessBiomeDimensionFromCategory(registryKey)); biomeDesc.addProperty("displayName", DGU.translateText(localizationKey)); biomeDesc.addProperty("color", biome.getSkyColor()); biomeDesc.addProperty("rainfall", biome.getDownfall()); diff --git a/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java b/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java index edbc9869..a6efaae8 100644 --- a/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java +++ b/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java @@ -2,16 +2,16 @@ import com.google.gson.JsonArray; import com.google.gson.JsonObject; +import net.minecraft.client.sound.Sound; import net.minecraft.sound.SoundEvent; import net.minecraft.util.registry.Registry; - public class SoundsDataGenerator implements IDataGenerator { - public static JsonObject generateSound(Registry registry, SoundEvent soundEvent) { + public static JsonObject generateSound(SoundEvent soundEvent) { JsonObject soundDesc = new JsonObject(); - soundDesc.addProperty("id", registry.getRawId(soundEvent)); + soundDesc.addProperty("id", Registry.SOUND_EVENT.getRawId(soundEvent)); soundDesc.addProperty("name", soundEvent.getId().getPath()); return soundDesc; @@ -25,8 +25,7 @@ public String getDataName() { @Override public JsonArray generateDataJson() { JsonArray resultsArray = new JsonArray(); - Registry soundEventRegistry = Registry.SOUND_EVENT; - soundEventRegistry.forEach(sound -> resultsArray.add(generateSound(soundEventRegistry, sound))); + Registry.SOUND_EVENT.forEach(sound -> resultsArray.add(generateSound(sound))); return resultsArray; } } diff --git a/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/mixin/TheEndBiomeDataAccessor.java b/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/mixin/TheEndBiomeDataAccessor.java deleted file mode 100644 index 4a75ab37..00000000 --- a/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/mixin/TheEndBiomeDataAccessor.java +++ /dev/null @@ -1,28 +0,0 @@ -package dev.u9g.minecraftdatagenerator.mixin; - -import net.fabricmc.fabric.impl.biome.TheEndBiomeData; -import net.fabricmc.fabric.impl.biome.WeightedPicker; -import net.minecraft.util.registry.RegistryKey; -import net.minecraft.world.biome.Biome; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.gen.Accessor; - -import java.util.Map; - -@Mixin(TheEndBiomeData.class) -public interface TheEndBiomeDataAccessor { - @Accessor("END_BIOMES_MAP") - static Map, WeightedPicker>> END_BIOMES_MAP() { - throw new IllegalStateException("Should never be called."); - } - - @Accessor("END_MIDLANDS_MAP") - static Map, WeightedPicker>> END_MIDLANDS_MAP() { - throw new IllegalStateException("Should never be called."); - } - - @Accessor("END_BARRENS_MAP") - static Map, WeightedPicker>> END_BARRENS_MAP() { - throw new IllegalStateException("Should never be called."); - } -} diff --git a/22w19a/src/main/resources/fabric.mod.json b/22w19a/src/main/resources/fabric.mod.json index dff18a06..ffac96b0 100644 --- a/22w19a/src/main/resources/fabric.mod.json +++ b/22w19a/src/main/resources/fabric.mod.json @@ -10,13 +10,11 @@ ], "contact": {}, "license": "MIT", - "environment": "server", "mixins": [ "minecraft-data-generator.mixins.json" ], "depends": { "fabricloader": "*", - "fabric": "*", "minecraft": "*" } } diff --git a/22w19a/src/main/resources/minecraft-data-generator.mixins.json b/22w19a/src/main/resources/minecraft-data-generator.mixins.json index ccdc91d0..b8f9bb32 100644 --- a/22w19a/src/main/resources/minecraft-data-generator.mixins.json +++ b/22w19a/src/main/resources/minecraft-data-generator.mixins.json @@ -5,8 +5,7 @@ "compatibilityLevel": "JAVA_17", "mixins": [ "MiningToolItemAccessor", - "ReadyMixin", - "TheEndBiomeDataAccessor" + "ReadyMixin" ], "client": [ ], diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts new file mode 100644 index 00000000..58f25566 --- /dev/null +++ b/buildSrc/build.gradle.kts @@ -0,0 +1,56 @@ +plugins { + `kotlin-dsl` +} + +repositories { + maven("https://maven.wagyourtail.xyz/releases") { + name = "WagYourReleases" + } + maven("https://maven.wagyourtail.xyz/snapshots") { + name = "WagYourSnapshots" + } + gradlePluginPortal() + mavenCentral() +} + +dependencies { + implementation("xyz.wagyourtail.unimined:xyz.wagyourtail.unimined.gradle.plugin:1.2.3") + + // guava + implementation("com.google.guava:guava:31.1-jre") + + // gson + implementation("com.google.code.gson:gson:2.9.0") + + // asm + implementation("org.ow2.asm:asm:9.5") + implementation("org.ow2.asm:asm-commons:9.5") + implementation("org.ow2.asm:asm-tree:9.5") + implementation("org.ow2.asm:asm-analysis:9.5") + implementation("org.ow2.asm:asm-util:9.5") + + // remapper + implementation("net.fabricmc:tiny-remapper:0.8.7") { + exclude(group = "org.ow2.asm") + } + + // mappings + implementation("net.fabricmc:mapping-io:0.3.0") { + exclude(group = "org.ow2.asm") + } + + // jetbrains annotations + implementation("org.jetbrains:annotations-java5:23.0.0") + + // binpatcher + implementation("net.minecraftforge:binarypatcher:1.1.1") { + exclude(mapOf("group" to "commons-io")) + } + implementation("commons-io:commons-io:2.12.0") + + // pack200 provided by apache commons-compress + implementation("org.apache.commons:commons-compress:1.26.1") + + // aw + implementation("net.fabricmc:access-widener:2.1.0") +} diff --git a/buildSrc/src/main/kotlin/CustomFabricLikeMinecraftTransformer.kt b/buildSrc/src/main/kotlin/CustomFabricLikeMinecraftTransformer.kt new file mode 100644 index 00000000..7e2d9652 --- /dev/null +++ b/buildSrc/src/main/kotlin/CustomFabricLikeMinecraftTransformer.kt @@ -0,0 +1,415 @@ +import com.google.gson.* +import org.gradle.api.Project +import org.gradle.api.artifacts.Configuration +import org.gradle.api.artifacts.Dependency +import org.gradle.api.artifacts.ModuleDependency +import org.jetbrains.annotations.ApiStatus +import xyz.wagyourtail.unimined.api.mapping.MappingNamespaceTree +import xyz.wagyourtail.unimined.api.minecraft.EnvType +import xyz.wagyourtail.unimined.api.minecraft.patch.ataw.AccessWidenerPatcher +import xyz.wagyourtail.unimined.api.minecraft.patch.fabric.FabricLikePatcher +import xyz.wagyourtail.unimined.api.runs.RunConfig +import xyz.wagyourtail.unimined.api.mapping.task.ExportMappingsTask +import xyz.wagyourtail.unimined.api.minecraft.task.RemapJarTask +import xyz.wagyourtail.unimined.api.unimined +import xyz.wagyourtail.unimined.api.uniminedMaybe +import xyz.wagyourtail.unimined.internal.mapping.ii.InterfaceInjectionMinecraftTransformer +import xyz.wagyourtail.unimined.internal.mapping.task.ExportMappingsTaskImpl +import xyz.wagyourtail.unimined.internal.minecraft.MinecraftProvider +import xyz.wagyourtail.unimined.internal.minecraft.patch.AbstractMinecraftTransformer +import xyz.wagyourtail.unimined.api.minecraft.MinecraftJar +import xyz.wagyourtail.unimined.internal.minecraft.patch.access.widener.AccessWidenerMinecraftTransformer +import xyz.wagyourtail.unimined.internal.minecraft.resolver.Library +import xyz.wagyourtail.unimined.internal.minecraft.transform.merge.ClassMerger +import xyz.wagyourtail.unimined.util.* +import java.io.File +import java.io.InputStreamReader +import java.nio.file.Files +import java.nio.file.Path +import java.nio.file.StandardCopyOption +import java.nio.file.StandardOpenOption +import kotlin.io.path.createDirectories +import kotlin.io.path.exists +import kotlin.io.path.writeText + +abstract class CustomFabricLikeMinecraftTransformer( + project: Project, + provider: MinecraftProvider, + providerName: String, + val modJsonName: String, + val accessWidenerJsonKey: String, + private val accessWidenerTransformer: AccessWidenerMinecraftTransformer = AccessWidenerMinecraftTransformer(project, provider, providerName), +): AbstractMinecraftTransformer( + project, + provider, + providerName +), FabricLikePatcher, AccessWidenerPatcher by accessWidenerTransformer { + + companion object { + val GSON: Gson = GsonBuilder().setPrettyPrinting().create() + } + + val fabric: Configuration = project.configurations.maybeCreate(providerName.withSourceSet(provider.sourceSet)).also { + provider.minecraftLibraries.extendsFrom(it) + } + + private val fabricJson: Configuration = project.configurations.detachedConfiguration() + + private val include: Configuration = project.configurations.maybeCreate("include".withSourceSet(provider.sourceSet)) + + override var customIntermediaries: Boolean by FinalizeOnRead(false) + + override var skipInsertAw: Boolean by FinalizeOnRead(false) + + protected abstract val ENVIRONMENT: String + protected abstract val ENV_TYPE: String + + override val merger: ClassMerger = ClassMerger() + + override var prodNamespace by FinalizeOnRead(LazyMutable { provider.mappings.getNamespace("intermediary") }) + + @get:ApiStatus.Internal + @set:ApiStatus.Experimental + override var devMappings: Path? by FinalizeOnRead(LazyMutable { + provider.localCache + .resolve("mappings") + .createDirectories() + .resolve("intermediary2named.jar") + .apply { + val export = ExportMappingsTaskImpl.ExportImpl(provider.mappings).apply { + location = toFile() + type = ExportMappingsTask.MappingExportTypes.TINY_V2 + sourceNamespace = prodNamespace + targetNamespace = setOf(provider.mappings.devNamespace) + renameNs[provider.mappings.devNamespace] = "named" + } + export.validate() + export.exportFunc(provider.mappings.mappingTree) + } + }) + + init { + addMavens() + } + + override fun prodNamespace(namespace: String) { + val delegate: FinalizeOnRead = CustomFabricLikeMinecraftTransformer::class.getField("prodNamespace")!!.getDelegate(this) as FinalizeOnRead + delegate.setValueIntl(LazyMutable { provider.mappings.getNamespace(namespace) }) + } + + @Deprecated("", replaceWith = ReplaceWith("prodNamespace(namespace)")) + override fun setProdNamespace(namespace: String) { + prodNamespace(namespace) + } + + protected abstract fun addMavens() + protected abstract fun addIntermediaryMappings() + + var mainClass: JsonObject? = null + + override fun beforeMappingsResolve() { + if (!customIntermediaries) { + addIntermediaryMappings() + } + } + + val fabricDep by lazy { + val dependencies = fabric.dependencies + + if (dependencies.isEmpty()) { + throw IllegalStateException("No dependencies found for fabric provider") + } + + if (dependencies.size > 1) { + throw IllegalStateException("Multiple dependencies found for fabric provider") + } + + dependencies.first() + } + + override fun apply() { + val client = provider.side == EnvType.CLIENT || provider.side == EnvType.COMBINED + val server = provider.side == EnvType.SERVER || provider.side == EnvType.COMBINED + + var artifactString = "" + if (fabricDep.group != null) { + artifactString += fabricDep.group + ":" + } + artifactString += fabricDep.name + if (fabricDep.version != null) { + artifactString += ":" + fabricDep.version + } + artifactString += "@json" + + if (fabricJson.dependencies.isEmpty()) { + fabricJson.dependencies.add( + project.dependencies.create( + artifactString + ) + ) + } + + val json = InputStreamReader( + fabricJson.files(fabricJson.dependencies.last()) + .last() + .inputStream() + ).use { reader -> + JsonParser.parseReader(reader).asJsonObject + } + + val libraries = json.get("libraries")?.asJsonObject + if (libraries != null) { + libraries.get("common")?.asJsonArray?.forEach { + createFabricLoaderDependency(it) + } + if (client) { + libraries.get("client")?.asJsonArray?.forEach { + createFabricLoaderDependency(it) + } + } + if (server) { + libraries.get("server")?.asJsonArray?.forEach { + createFabricLoaderDependency(it) + } + } + libraries.get("development")?.asJsonArray?.forEach { + createFabricLoaderDependency(it) + } + } + + mainClass = json.get("mainClass")?.asJsonObject + + if (devMappings != null) { + provider.minecraftLibraries.dependencies.add( + project.dependencies.create(project.files(devMappings)) + ) + } + + // mixins get remapped at runtime, so we don't need to on fabric + provider.mods.default { + mixinRemap { + off() + } + } + + super.apply() + } + + private fun createFabricLoaderDependency(it: JsonElement) { + val dep: ModuleDependency = project.dependencies.create( + it.asJsonObject.get("name").asString + ) as ModuleDependency + dep.isTransitive = false + provider.minecraftLibraries.dependencies.add(dep) + } + + override fun afterRemap(baseMinecraft: MinecraftJar): MinecraftJar = applyInterfaceInjection(accessWidenerTransformer.afterRemap(baseMinecraft)) + + private fun applyInterfaceInjection(baseMinecraft: MinecraftJar): MinecraftJar { + val injections = hashMapOf>() + + this.collectInterfaceInjections(baseMinecraft, injections) + + return if (injections.isNotEmpty()) { + val oldSuffix = if (baseMinecraft.awOrAt != null) baseMinecraft.awOrAt + "+" else "" + + val output = MinecraftJar( + baseMinecraft, + parentPath = provider.localCache.resolve("fabric").createDirectories(), + awOrAt = "${oldSuffix}ii+${injections.getShortSha1()}" + ) + + if (!output.path.exists() || project.unimined.forceReload) { + if (InterfaceInjectionMinecraftTransformer.transform( + injections, + baseMinecraft.path, + output.path, + project.logger + ) + ) { + output + } else baseMinecraft + } else output + } else baseMinecraft + } + + abstract fun collectInterfaceInjections(baseMinecraft: MinecraftJar, injections: HashMap>) + fun collectInterfaceInjections(baseMinecraft: MinecraftJar, injections: HashMap>, interfaces: JsonObject) { + injections.putAll(interfaces.entrySet() + .filterNotNull() + .filter { it.key != null && it.value != null && it.value.isJsonArray } + .map { + val element = it.value!! + + Pair(it.key!!, if (element.isJsonArray) { + element.asJsonArray.mapNotNull { name -> name.asString } + } else arrayListOf()) + } + .map { + var target = it.first + + val clazz = provider.mappings.mappingTree.getClass( + target, + provider.mappings.mappingTree.getNamespaceId(prodNamespace.name) + ) + + if (clazz != null) { + var newTarget = clazz.getName(provider.mappings.mappingTree.getNamespaceId(baseMinecraft.mappingNamespace.name)) + + if (newTarget == null) { + newTarget = clazz.getName(provider.mappings.mappingTree.getNamespaceId(baseMinecraft.fallbackNamespace.name)) + } + + if (newTarget != null) { + target = newTarget + } + } + + Pair(target, it.second) + } + ) + } + + val intermediaryClasspath: Path = provider.localCache.resolve("remapClasspath.txt".withSourceSet(provider.sourceSet)) + + override fun afterEvaluate() { + project.logger.lifecycle("[Unimined/Fabric] Generating intermediary classpath.") + // resolve intermediary classpath + val classpath = (provider.mods.getClasspathAs( + prodNamespace, + prodNamespace, + provider.sourceSet.runtimeClasspath.filter { !provider.isMinecraftJar(it.toPath()) }.toSet() + ) + provider.getMinecraft(prodNamespace, prodNamespace).toFile()).filter { it.exists() && !it.isDirectory } + // write to file + intermediaryClasspath.writeText(classpath.joinToString(File.pathSeparator), options = arrayOf(StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING)) + } + + override fun afterRemapJarTask(remapJarTask: RemapJarTask, output: Path) { + insertIncludes(output) + insertAW(output) + } + + private fun insertIncludes(output: Path) { + if (include.dependencies.isEmpty()) { + return + } + output.openZipFileSystem(mapOf("mutable" to true)).use { fs -> + val includeCache = provider.localCache.resolve("includeCache".withSourceSet(provider.sourceSet)) + val jars = fs.getPath("META-INF/jars") + + val mod = fs.getPath(modJsonName) + if (!Files.exists(mod)) { + throw IllegalStateException("$modJsonName not found in jar") + } + val json = JsonParser.parseReader(InputStreamReader(Files.newInputStream(mod))).asJsonObject + + Files.createDirectories(jars) + Files.createDirectories(includeCache) + for (dep in include.dependencies) { + val path = jars.resolve("${dep.name}-${dep.version}.jar") + val cachePath = includeCache.resolve("${dep.name}-${dep.version}.jar") + if (!Files.exists(cachePath)) { + Files.copy( + include.files(dep).first { it.extension == "jar" }.toPath(), + includeCache.resolve("${dep.name}-${dep.version}.jar"), + StandardCopyOption.REPLACE_EXISTING + ) + + cachePath.openZipFileSystem(mapOf("mutable" to true)).use { innerfs -> + val innermod = innerfs.getPath(modJsonName) + if (!Files.exists(innermod)) { + val innerjson = JsonObject() + innerjson.addProperty("schemaVersion", 1) + var artifactString = "" + if (dep.group != null) { + artifactString += dep.group!!.replace(".", "_") + "_" + } + artifactString += dep.name + + innerjson.addProperty("id", artifactString.lowercase()) + innerjson.addProperty("version", dep.version) + innerjson.addProperty("name", dep.name) + val custom = JsonObject() + custom.addProperty("fabric-loom:generated", true) + custom.addProperty("unimined:generated", true) + innerjson.add("custom", custom) + Files.write( + innermod, + innerjson.toString().toByteArray(), + StandardOpenOption.CREATE, + StandardOpenOption.TRUNCATE_EXISTING + ) + } + } + } + + Files.copy(cachePath, path, StandardCopyOption.REPLACE_EXISTING) + + addIncludeToModJson(json, dep, path.toString().removePrefix("/")) + } + Files.write(mod, GSON.toJson(json).toByteArray(), StandardOpenOption.TRUNCATE_EXISTING) + } + } + + protected abstract fun addIncludeToModJson(json: JsonObject, dep: Dependency, path: String) + + private fun insertAW(output: Path) { + if (accessWidener != null && !skipInsertAw) { + output.openZipFileSystem(mapOf("mutable" to true)).use { fs -> + val mod = fs.getPath(modJsonName) + if (!Files.exists(mod)) { + throw IllegalStateException("$modJsonName not found in jar") + } + val aw = accessWidener!!.toPath() + var parent = aw.parent + while (!fs.getPath(parent.relativize(aw).toString()).exists()) { + parent = parent.parent + if (parent.relativize(aw).toString() == aw.toString()) { + throw IllegalStateException("Access widener not found in jar") + } + } + val awPath = fs.getPath(parent.relativize(aw).toString()) + val json = JsonParser.parseReader(InputStreamReader(Files.newInputStream(mod))).asJsonObject + json.addProperty(accessWidenerJsonKey, awPath.toString()) + Files.write(mod, GSON.toJson(json).toByteArray(), StandardOpenOption.TRUNCATE_EXISTING) + } + } + } + + val groups: String by lazy { + val groups = sortProjectSourceSets().mapValues { it.value.toMutableSet() }.toMutableMap() + // detect non-fabric groups + for ((proj, sourceSet) in groups.keys.toSet()) { + if (proj.uniminedMaybe?.minecrafts?.map?.get(sourceSet)?.mcPatcher !is FabricLikePatcher) { + // merge with current + proj.logger.warn("[Unimined/FabricLike] Non-fabric ${(proj to sourceSet).toPath()} found in fabric classpath groups, merging with current (${(project to provider.sourceSet).toPath()}), this should've been manually specified with `combineWith`") + groups[this.project to this.provider.sourceSet]!! += groups[proj to sourceSet]!! + groups.remove(proj to sourceSet) + } + } + project.logger.info("[Unimined/FabricLike] Classpath groups: ${groups.map { it.key.toPath() + " -> " + it.value.joinToString(", ") { it.toPath() } }.joinToString("\n ")}") + groups.map { entry -> entry.value.flatMap { it.second.output }.joinToString(File.pathSeparator) { it.absolutePath } }.joinToString(File.pathSeparator.repeat(2)) + } + + override fun applyClientRunTransform(config: RunConfig) { + config.mainClass = mainClass?.get("client")?.asString ?: config.mainClass + } + + override fun applyServerRunTransform(config: RunConfig) { + config.mainClass = mainClass?.get("server")?.asString ?: config.mainClass + } + + override fun libraryFilter(library: Library): Boolean { + // fabric provides its own asm, exclude asm-all from vanilla minecraftLibraries + return !library.name.startsWith("org.ow2.asm:asm-all") + } + + fun getModJsonPath(): File? { + val json = provider.sourceSet.resources.firstOrNull { it.name.equals(modJsonName) } + if (json == null) { + project.logger.warn("[Unimined/FabricLike] $modJsonName not found in sourceSet ${provider.project.path} ${provider.sourceSet.name}") + return null + } + return json + } +} diff --git a/buildSrc/src/main/kotlin/CustomFabricMinecraftTransformer.kt b/buildSrc/src/main/kotlin/CustomFabricMinecraftTransformer.kt new file mode 100644 index 00000000..0da2dc30 --- /dev/null +++ b/buildSrc/src/main/kotlin/CustomFabricMinecraftTransformer.kt @@ -0,0 +1,85 @@ +import com.google.gson.JsonArray +import com.google.gson.JsonObject +import com.google.gson.JsonParser +import org.gradle.api.Project +import org.gradle.api.artifacts.Dependency +import xyz.wagyourtail.unimined.api.minecraft.EnvType +import xyz.wagyourtail.unimined.api.runs.RunConfig +import xyz.wagyourtail.unimined.api.unimined +import xyz.wagyourtail.unimined.internal.minecraft.MinecraftProvider +import xyz.wagyourtail.unimined.api.minecraft.MinecraftJar +import java.io.InputStreamReader +import java.nio.file.Files + +abstract class CustomFabricMinecraftTransformer( + project: Project, + provider: MinecraftProvider +): CustomFabricLikeMinecraftTransformer( + project, + provider, + "fabric", + "fabric.mod.json", + "accessWidener" +) { + + override val ENVIRONMENT: String = "Lnet/fabricmc/api/Environment;" + override val ENV_TYPE: String = "Lnet/fabricmc/api/EnvType;" + + override fun addMavens() { + project.unimined.fabricMaven() + } + + override fun addIncludeToModJson(json: JsonObject, dep: Dependency, path: String) { + var jars = json.get("jars")?.asJsonArray + if (jars == null) { + jars = JsonArray() + json.add("jars", jars) + } + jars.add(JsonObject().apply { + addProperty("file", path) + }) + } + + override fun applyExtraLaunches() { + super.applyExtraLaunches() + if (provider.side == EnvType.DATAGEN) { + TODO("DATAGEN not supported yet") + } + } + + override fun applyClientRunTransform(config: RunConfig) { + super.applyClientRunTransform(config) + config.jvmArgs += listOf( + "-Dfabric.development=true", + "-Dfabric.remapClasspathFile=${intermediaryClasspath}", + "-Dfabric.classPathGroups=${groups}" + ) + } + + override fun applyServerRunTransform(config: RunConfig) { + super.applyServerRunTransform(config) + config.jvmArgs += listOf( + "-Dfabric.development=true", + "-Dfabric.remapClasspathFile=${intermediaryClasspath}", + "-Dfabric.classPathGroups=${groups}" + ) + } + + override fun collectInterfaceInjections(baseMinecraft: MinecraftJar, injections: HashMap>) { + val modJsonPath = this.getModJsonPath() + + if (modJsonPath != null && modJsonPath.exists()) { + val json = JsonParser.parseReader(InputStreamReader(Files.newInputStream(modJsonPath.toPath()))).asJsonObject + + val custom = json.getAsJsonObject("custom") + + if (custom != null) { + val interfaces = custom.getAsJsonObject("loom:injected_interfaces") + + if (interfaces != null) { + collectInterfaceInjections(baseMinecraft, injections, interfaces) + } + } + } + } +} diff --git a/buildSrc/src/main/kotlin/CustomLegacyFabricMinecraftTransformer.kt b/buildSrc/src/main/kotlin/CustomLegacyFabricMinecraftTransformer.kt new file mode 100644 index 00000000..211ec359 --- /dev/null +++ b/buildSrc/src/main/kotlin/CustomLegacyFabricMinecraftTransformer.kt @@ -0,0 +1,39 @@ +import org.gradle.api.Project +import org.gradle.api.artifacts.Dependency +import xyz.wagyourtail.unimined.api.minecraft.task.RemapJarTask +import xyz.wagyourtail.unimined.api.unimined +import xyz.wagyourtail.unimined.internal.minecraft.MinecraftProvider +import xyz.wagyourtail.unimined.util.SemVerUtils + +class CustomLegacyFabricMinecraftTransformer( + project: Project, + provider: MinecraftProvider +): CustomFabricMinecraftTransformer(project, provider) { + + override fun addIntermediaryMappings() { + provider.mappings { + legacyIntermediary() + } + } + override fun loader(dep: Any, action: Dependency.() -> Unit) { + fabric.dependencies.add( + (if (dep is String && !dep.contains(":")) { + project.dependencies.create("net.fabricmc:fabric-loader:$dep") + } else project.dependencies.create(dep)).apply(action) + ) + } + + override fun addMavens() { + super.addMavens() + project.unimined.legacyFabricMaven() + } + + override fun configureRemapJar(task: RemapJarTask) { + if (fabricDep.version?.let { SemVerUtils.matches(it, ">=0.15.0") } == true) { + project.logger.info("enabling mixin extra") + task.mixinRemap { + enableMixinExtra() + } + } + } +} diff --git a/buildSrc/src/main/kotlin/CustomOfficialFabricMinecraftTransformer.kt b/buildSrc/src/main/kotlin/CustomOfficialFabricMinecraftTransformer.kt new file mode 100644 index 00000000..0904c3dd --- /dev/null +++ b/buildSrc/src/main/kotlin/CustomOfficialFabricMinecraftTransformer.kt @@ -0,0 +1,34 @@ +import org.gradle.api.Project +import org.gradle.api.artifacts.Dependency +import xyz.wagyourtail.unimined.api.minecraft.task.RemapJarTask +import xyz.wagyourtail.unimined.internal.minecraft.MinecraftProvider +import xyz.wagyourtail.unimined.util.SemVerUtils + +class CustomOfficialFabricMinecraftTransformer( + project: Project, + provider: MinecraftProvider +) : CustomFabricMinecraftTransformer(project, provider) { + + override fun addIntermediaryMappings() { + provider.mappings { + intermediary() + } + } + + override fun loader(dep: Any, action: Dependency.() -> Unit) { + fabric.dependencies.add( + (if (dep is String && !dep.contains(":")) { + project.dependencies.create("net.fabricmc:fabric-loader:$dep") + } else project.dependencies.create(dep)).apply(action) + ) + } + + override fun configureRemapJar(task: RemapJarTask) { + if (fabricDep.version?.let { SemVerUtils.matches(it, ">=0.15.0") } == true) { + project.logger.info("enabling mixin extra") + task.mixinRemap { + enableMixinExtra() + } + } + } +} diff --git a/settings.gradle b/settings.gradle index 6b61a764..0d36f27a 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,31 +1,30 @@ pluginManagement { repositories { maven { - name = 'Fabric' - url = 'https://maven.fabricmc.net/' + name = 'WagYourReleases' + url = 'https://maven.wagyourtail.xyz/releases' + } + maven { + name = 'WagYourSnapshots' + url = 'https://maven.wagyourtail.xyz/snapshots' } - mavenCentral() gradlePluginPortal() } plugins { - id 'fabric-loom' version "1.6-SNAPSHOT" + id "xyz.wagyourtail.unimined" version "1.2.3" } } +plugins { + id 'org.gradle.toolchains.foojay-resolver-convention' version '0.8.0' +} + dependencyResolutionManagement { repositories { maven { name = 'Fabric' url = 'https://maven.fabricmc.net/' } - maven { - name = "legacy-fabric" - url = "https://maven.legacyfabric.net" - } - maven { - name = "u9g" - url = "https://maven.u9g.dev" - } mavenCentral() } versionCatalogs { @@ -46,7 +45,7 @@ include "common" "1.11.2", "1.12.2", "1.13", - "1.14", + // "1.14", "1.15", "1.16", "1.17", From 41d19b856d4f3b91cb9aeb268d2fcdc1b0ae2fc8 Mon Sep 17 00:00:00 2001 From: AlexProgrammerDE <40795980+AlexProgrammerDE@users.noreply.github.com> Date: Wed, 1 May 2024 17:34:03 +0200 Subject: [PATCH 18/38] Set server run dir as asset dir --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c1bb07f4..1eea2667 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -40,5 +40,5 @@ jobs: uses: actions/upload-artifact@v4 with: name: data-${{ matrix.version }} - path: ${{ matrix.version }}/run/minecraft-data + path: ${{ matrix.version }}/run/server/minecraft-data if-no-files-found: error From e1861811e82667b181881f3405b934abbc1251b7 Mon Sep 17 00:00:00 2001 From: AlexProgrammerDE <40795980+AlexProgrammerDE@users.noreply.github.com> Date: Wed, 1 May 2024 18:47:57 +0200 Subject: [PATCH 19/38] More cleanup --- 1.10.2/build.gradle | 12 ------- 1.11.2/build.gradle | 12 ------- 1.12.2/build.gradle | 12 ------- 1.13/build.gradle | 12 ------- 1.14/build.gradle | 13 +++---- .../generators/TintsDataGenerator.java | 15 ++++---- .../mixin/ReadyMixin.java | 1 - 1.15/build.gradle | 10 +----- .../clientsideannoyances/FoliageColors.java | 36 ------------------- .../clientsideannoyances/GrassColors.java | 27 -------------- .../ServerSideRedstoneWireBlock.java | 34 ------------------ 1.16/build.gradle | 10 +----- .../clientsideannoyances/FoliageColors.java | 36 ------------------- .../clientsideannoyances/GrassColors.java | 29 --------------- .../ServerSideRedstoneWireBlock.java | 34 ------------------ .../generators/TintsDataGenerator.java | 7 ++-- 1.17/build.gradle | 10 +----- 1.18/build.gradle | 8 ----- 1.19.2/build.gradle | 10 +----- 1.19/build.gradle | 10 +----- 1.20.4/build.gradle | 10 +----- 1.20/build.gradle | 8 ----- 1.7/build.gradle | 12 ------- 1.8.9/build.gradle | 12 ------- 1.9.4/build.gradle | 12 ------- 22w19a/build.gradle | 10 +----- build.gradle | 16 +++++++++ settings.gradle | 10 +----- 28 files changed, 40 insertions(+), 388 deletions(-) delete mode 100644 1.15/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/FoliageColors.java delete mode 100644 1.15/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/GrassColors.java delete mode 100644 1.15/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/ServerSideRedstoneWireBlock.java delete mode 100644 1.16/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/FoliageColors.java delete mode 100644 1.16/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/GrassColors.java delete mode 100644 1.16/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/ServerSideRedstoneWireBlock.java diff --git a/1.10.2/build.gradle b/1.10.2/build.gradle index 84c2eadf..7c617b7b 100644 --- a/1.10.2/build.gradle +++ b/1.10.2/build.gradle @@ -4,18 +4,6 @@ plugins { id 'xyz.wagyourtail.unimined' } -repositories { - maven { - name = "wagyourtail releases" - url = "https://maven.wagyourtail.xyz/releases" - } - maven { - name = "legacyfabric" - url "https://maven.legacyfabric.net/" - } - mavenCentral() -} - unimined.minecraft { version "1.10.2" diff --git a/1.11.2/build.gradle b/1.11.2/build.gradle index d0aa3520..edb53971 100644 --- a/1.11.2/build.gradle +++ b/1.11.2/build.gradle @@ -4,18 +4,6 @@ plugins { id 'xyz.wagyourtail.unimined' } -repositories { - maven { - name = "wagyourtail releases" - url = "https://maven.wagyourtail.xyz/releases" - } - maven { - name = "legacyfabric" - url "https://maven.legacyfabric.net/" - } - mavenCentral() -} - unimined.minecraft { version "1.11.2" diff --git a/1.12.2/build.gradle b/1.12.2/build.gradle index 5739159a..3370f425 100644 --- a/1.12.2/build.gradle +++ b/1.12.2/build.gradle @@ -4,18 +4,6 @@ plugins { id 'xyz.wagyourtail.unimined' } -repositories { - maven { - name = "wagyourtail releases" - url = "https://maven.wagyourtail.xyz/releases" - } - maven { - name = "legacyfabric" - url "https://maven.legacyfabric.net/" - } - mavenCentral() -} - unimined.minecraft { version "1.12.2" diff --git a/1.13/build.gradle b/1.13/build.gradle index 82aa45ab..98b5358a 100644 --- a/1.13/build.gradle +++ b/1.13/build.gradle @@ -4,18 +4,6 @@ plugins { id 'xyz.wagyourtail.unimined' } -repositories { - maven { - name = "wagyourtail releases" - url = "https://maven.wagyourtail.xyz/releases" - } - maven { - name = "legacyfabric" - url "https://maven.legacyfabric.net/" - } - mavenCentral() -} - unimined.minecraft { version "1.13.2" diff --git a/1.14/build.gradle b/1.14/build.gradle index fccfcbc7..87ac7a6d 100644 --- a/1.14/build.gradle +++ b/1.14/build.gradle @@ -4,20 +4,15 @@ plugins { id 'xyz.wagyourtail.unimined' } -repositories { - maven { - name = "wagyourtail releases" - url = "https://maven.wagyourtail.xyz/releases" - } - mavenCentral() -} - unimined.minecraft { version "1.14" mappings { intermediary() - yarn(1) + yarn(21) { + mapNamespace("named", "intermediary") + mapNamespace("intermediary", "yarn") + } devFallbackNamespace "intermediary" } diff --git a/1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java b/1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java index 8ae3fdad..12345aac 100644 --- a/1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java +++ b/1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java @@ -2,9 +2,6 @@ import com.google.gson.JsonArray; import com.google.gson.JsonObject; -import dev.u9g.minecraftdatagenerator.clientsideannoyances.FoliageColors; -import dev.u9g.minecraftdatagenerator.clientsideannoyances.GrassColors; -import dev.u9g.minecraftdatagenerator.clientsideannoyances.ServerSideRedstoneWireBlock; import dev.u9g.minecraftdatagenerator.util.DGU; import net.fabricmc.api.EnvType; import net.fabricmc.loader.api.FabricLoader; @@ -12,8 +9,11 @@ import net.minecraft.block.Blocks; import net.minecraft.block.RedstoneWireBlock; import net.minecraft.client.color.block.BlockColors; +import net.minecraft.client.color.world.FoliageColors; +import net.minecraft.client.color.world.GrassColors; import net.minecraft.util.Identifier; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.MathHelper; import net.minecraft.util.registry.Registry; import net.minecraft.world.biome.Biome; @@ -25,8 +25,11 @@ public static BiomeTintColors generateBiomeTintColors(Registry biomeRegis BiomeTintColors colors = new BiomeTintColors(); biomeRegistry.forEach(biome -> { - int biomeGrassColor = GrassColors.getGrassColorAt(biome); - int biomeFoliageColor = FoliageColors.getFoliageColor(biome); + double d = MathHelper.clamp(biome.getTemperature(), 0.0f, 1.0f); + double e = MathHelper.clamp(biome.getRainfall(), 0.0f, 1.0f); + + int biomeGrassColor = GrassColors.getColor(d, e); + int biomeFoliageColor = FoliageColors.getColor(d, e); int biomeWaterColor = biome.getWaterColor(); colors.grassColoursMap.computeIfAbsent(biomeGrassColor, k -> new ArrayList<>()).add(biome); @@ -40,7 +43,7 @@ public static Map generateRedstoneTintColors() { Map resultColors = new HashMap<>(); for (int redstoneLevel : RedstoneWireBlock.POWER.getValues()) { - int color = ServerSideRedstoneWireBlock.getWireColor(redstoneLevel); + int color = RedstoneWireBlock.getWireColor(redstoneLevel); resultColors.put(redstoneLevel, color); } return resultColors; diff --git a/1.14/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java b/1.14/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java index 5184c462..af7e9c10 100644 --- a/1.14/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java +++ b/1.14/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java @@ -13,7 +13,6 @@ public class ReadyMixin { @Inject(method = "setupServer()Z", at = @At("TAIL")) private void init(CallbackInfoReturnable cir) { - net.minecraft.server. MinecraftDataGenerator.start( MinecraftVersion.create().getName(), DGU.getCurrentlyRunningServer().getRunDirectory().toPath() diff --git a/1.15/build.gradle b/1.15/build.gradle index 97bd892b..916e3e45 100644 --- a/1.15/build.gradle +++ b/1.15/build.gradle @@ -4,20 +4,12 @@ plugins { id 'xyz.wagyourtail.unimined' } -repositories { - maven { - name = "wagyourtail releases" - url = "https://maven.wagyourtail.xyz/releases" - } - mavenCentral() -} - unimined.minecraft { version "1.15" mappings { intermediary() - yarn(1) + yarn(2) devFallbackNamespace "intermediary" } diff --git a/1.15/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/FoliageColors.java b/1.15/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/FoliageColors.java deleted file mode 100644 index f1068ebd..00000000 --- a/1.15/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/FoliageColors.java +++ /dev/null @@ -1,36 +0,0 @@ -package dev.u9g.minecraftdatagenerator.clientsideannoyances; - -import net.minecraft.util.math.MathHelper; -import net.minecraft.world.biome.Biome; - -public class FoliageColors { - private static int[] colorMap = new int[65536]; - - public static void setColorMap(int[] pixels) { - colorMap = pixels; - } - - public static int getColor(double temperature, double humidity) { - int i = (int) ((1.0 - temperature) * 255.0); - int j = (int) ((1.0 - (humidity *= temperature)) * 255.0); - return colorMap[j << 8 | i]; - } - - public static int getSpruceColor() { - return 0x619961; - } - - public static int getBirchColor() { - return 8431445; - } - - public static int getDefaultColor() { - return 4764952; - } - - public static int getFoliageColor(Biome biome) { - double d = MathHelper.clamp(biome.getTemperature(), 0.0f, 1.0f); - double e = MathHelper.clamp(biome.getRainfall(), 0.0f, 1.0f); - return getColor(d, e); - } -} diff --git a/1.15/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/GrassColors.java b/1.15/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/GrassColors.java deleted file mode 100644 index ee6a498a..00000000 --- a/1.15/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/GrassColors.java +++ /dev/null @@ -1,27 +0,0 @@ -package dev.u9g.minecraftdatagenerator.clientsideannoyances; - -import net.minecraft.util.math.MathHelper; -import net.minecraft.world.biome.Biome; - -public class GrassColors { - private static int[] colorMap = new int[65536]; - - public static void setColorMap(int[] map) { - colorMap = map; - } - - public static int getColor(double temperature, double humidity) { - humidity *= temperature; - int i = (int) ((1.0D - temperature) * 255.0D); - int j = (int) ((1.0D - humidity) * 255.0D); - int k = j << 8 | i; - return k > colorMap.length ? -65281 : colorMap[k]; - } - - public static int getGrassColorAt(Biome biome) { - double d = MathHelper.clamp(biome.getTemperature(), 0.0f, 1.0f); - double e = MathHelper.clamp(biome.getRainfall(), 0.0f, 1.0f); - return getColor(d, e); - } -} - diff --git a/1.15/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/ServerSideRedstoneWireBlock.java b/1.15/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/ServerSideRedstoneWireBlock.java deleted file mode 100644 index 5a21ac15..00000000 --- a/1.15/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/ServerSideRedstoneWireBlock.java +++ /dev/null @@ -1,34 +0,0 @@ -package dev.u9g.minecraftdatagenerator.clientsideannoyances; - -import net.minecraft.client.util.math.Vector3f; -import net.minecraft.util.math.MathHelper; - -public class ServerSideRedstoneWireBlock { - private static final Vector3f[] data = new Vector3f[16]; - - static { - for (int i = 0; i <= 15; ++i) { - float f = 0; - float g = f * 0.6f + ((f = (float) i / 15.0f) > 0.0f ? 0.4f : 0.3f); - float h = MathHelper.clamp(f * f * 0.7f - 0.5f, 0.0f, 1.0f); - float j = MathHelper.clamp(f * f * 0.6f - 0.7f, 0.0f, 1.0f); - data[i] = new Vector3f(g, h, j); - } - } - - public static int getWireColor(int powerLevel) { - Vector3f vector3f = data[powerLevel]; - return packRgb(vector3f.getX(), vector3f.getY(), vector3f.getZ()); - } - - private static int packRgb(float r, float g, float b) { - return packRgb(MathHelper.floor(r * 255.0f), MathHelper.floor(g * 255.0f), MathHelper.floor(b * 255.0f)); - } - - private static int packRgb(int r, int g, int b) { - int i = r; - i = (i << 8) + g; - i = (i << 8) + b; - return i; - } -} diff --git a/1.16/build.gradle b/1.16/build.gradle index 85f3a287..a6ec219b 100644 --- a/1.16/build.gradle +++ b/1.16/build.gradle @@ -4,20 +4,12 @@ plugins { id 'xyz.wagyourtail.unimined' } -repositories { - maven { - name = "wagyourtail releases" - url = "https://maven.wagyourtail.xyz/releases" - } - mavenCentral() -} - unimined.minecraft { version "1.16" mappings { intermediary() - yarn(1) + yarn(4) devFallbackNamespace "intermediary" } diff --git a/1.16/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/FoliageColors.java b/1.16/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/FoliageColors.java deleted file mode 100644 index f1068ebd..00000000 --- a/1.16/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/FoliageColors.java +++ /dev/null @@ -1,36 +0,0 @@ -package dev.u9g.minecraftdatagenerator.clientsideannoyances; - -import net.minecraft.util.math.MathHelper; -import net.minecraft.world.biome.Biome; - -public class FoliageColors { - private static int[] colorMap = new int[65536]; - - public static void setColorMap(int[] pixels) { - colorMap = pixels; - } - - public static int getColor(double temperature, double humidity) { - int i = (int) ((1.0 - temperature) * 255.0); - int j = (int) ((1.0 - (humidity *= temperature)) * 255.0); - return colorMap[j << 8 | i]; - } - - public static int getSpruceColor() { - return 0x619961; - } - - public static int getBirchColor() { - return 8431445; - } - - public static int getDefaultColor() { - return 4764952; - } - - public static int getFoliageColor(Biome biome) { - double d = MathHelper.clamp(biome.getTemperature(), 0.0f, 1.0f); - double e = MathHelper.clamp(biome.getRainfall(), 0.0f, 1.0f); - return getColor(d, e); - } -} diff --git a/1.16/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/GrassColors.java b/1.16/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/GrassColors.java deleted file mode 100644 index 9452d37a..00000000 --- a/1.16/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/GrassColors.java +++ /dev/null @@ -1,29 +0,0 @@ -package dev.u9g.minecraftdatagenerator.clientsideannoyances; - -import net.minecraft.util.math.MathHelper; -import net.minecraft.world.biome.Biome; - -public class GrassColors { - private static int[] colorMap = new int[65536]; - - public static void setColorMap(int[] map) { - colorMap = map; - } - - public static int getColor(double temperature, double humidity) { - int j = (int) ((1.0 - (humidity *= temperature)) * 255.0); - int i = (int) ((1.0 - temperature) * 255.0); - int k = j << 8 | i; - if (k > colorMap.length) { - return -65281; - } - return colorMap[k]; - } - - public static int getGrassColorAt(Biome biome) { - double d = MathHelper.clamp(biome.getTemperature(), 0.0f, 1.0f); - double e = MathHelper.clamp(biome.getRainfall(), 0.0f, 1.0f); - return getColor(d, e); - } -} - diff --git a/1.16/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/ServerSideRedstoneWireBlock.java b/1.16/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/ServerSideRedstoneWireBlock.java deleted file mode 100644 index 5a21ac15..00000000 --- a/1.16/src/main/java/dev/u9g/minecraftdatagenerator/clientsideannoyances/ServerSideRedstoneWireBlock.java +++ /dev/null @@ -1,34 +0,0 @@ -package dev.u9g.minecraftdatagenerator.clientsideannoyances; - -import net.minecraft.client.util.math.Vector3f; -import net.minecraft.util.math.MathHelper; - -public class ServerSideRedstoneWireBlock { - private static final Vector3f[] data = new Vector3f[16]; - - static { - for (int i = 0; i <= 15; ++i) { - float f = 0; - float g = f * 0.6f + ((f = (float) i / 15.0f) > 0.0f ? 0.4f : 0.3f); - float h = MathHelper.clamp(f * f * 0.7f - 0.5f, 0.0f, 1.0f); - float j = MathHelper.clamp(f * f * 0.6f - 0.7f, 0.0f, 1.0f); - data[i] = new Vector3f(g, h, j); - } - } - - public static int getWireColor(int powerLevel) { - Vector3f vector3f = data[powerLevel]; - return packRgb(vector3f.getX(), vector3f.getY(), vector3f.getZ()); - } - - private static int packRgb(float r, float g, float b) { - return packRgb(MathHelper.floor(r * 255.0f), MathHelper.floor(g * 255.0f), MathHelper.floor(b * 255.0f)); - } - - private static int packRgb(int r, int g, int b) { - int i = r; - i = (i << 8) + g; - i = (i << 8) + b; - return i; - } -} diff --git a/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java b/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java index 9985a58c..fe4f870f 100644 --- a/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java +++ b/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java @@ -2,9 +2,6 @@ import com.google.gson.JsonArray; import com.google.gson.JsonObject; -import dev.u9g.minecraftdatagenerator.clientsideannoyances.FoliageColors; -import dev.u9g.minecraftdatagenerator.clientsideannoyances.GrassColors; -import dev.u9g.minecraftdatagenerator.clientsideannoyances.ServerSideRedstoneWireBlock; import dev.u9g.minecraftdatagenerator.mixin.BiomeEffectsAccessor; import dev.u9g.minecraftdatagenerator.util.EmptyRenderBlockView; import net.fabricmc.api.EnvType; @@ -13,6 +10,8 @@ import net.minecraft.block.Blocks; import net.minecraft.block.RedstoneWireBlock; import net.minecraft.client.color.block.BlockColors; +import net.minecraft.client.color.world.FoliageColors; +import net.minecraft.client.color.world.GrassColors; import net.minecraft.util.Identifier; import net.minecraft.util.math.BlockPos; import net.minecraft.util.registry.Registry; @@ -41,7 +40,7 @@ public static Map generateRedstoneTintColors() { Map resultColors = new HashMap<>(); for (int redstoneLevel : RedstoneWireBlock.POWER.getValues()) { - int color = ServerSideRedstoneWireBlock.getWireColor(redstoneLevel); + int color = RedstoneWireBlock.getWireColor(redstoneLevel); resultColors.put(redstoneLevel, color); } return resultColors; diff --git a/1.17/build.gradle b/1.17/build.gradle index 84832c50..6ef8e503 100644 --- a/1.17/build.gradle +++ b/1.17/build.gradle @@ -4,20 +4,12 @@ plugins { id 'xyz.wagyourtail.unimined' } -repositories { - maven { - name = "wagyourtail releases" - url = "https://maven.wagyourtail.xyz/releases" - } - mavenCentral() -} - unimined.minecraft { version "1.17" mappings { intermediary() - yarn(1) + yarn(9) devFallbackNamespace "intermediary" } diff --git a/1.18/build.gradle b/1.18/build.gradle index d1a7f67a..0c7c2d96 100644 --- a/1.18/build.gradle +++ b/1.18/build.gradle @@ -4,14 +4,6 @@ plugins { id 'xyz.wagyourtail.unimined' } -repositories { - maven { - name = "wagyourtail releases" - url = "https://maven.wagyourtail.xyz/releases" - } - mavenCentral() -} - unimined.minecraft { version "1.18" diff --git a/1.19.2/build.gradle b/1.19.2/build.gradle index 372ee878..fd0c7620 100644 --- a/1.19.2/build.gradle +++ b/1.19.2/build.gradle @@ -4,20 +4,12 @@ plugins { id 'xyz.wagyourtail.unimined' } -repositories { - maven { - name = "wagyourtail releases" - url = "https://maven.wagyourtail.xyz/releases" - } - mavenCentral() -} - unimined.minecraft { version "1.19.2" mappings { intermediary() - yarn(1) + yarn(9) devFallbackNamespace "intermediary" } diff --git a/1.19/build.gradle b/1.19/build.gradle index 837a6e5d..04b7eaa3 100644 --- a/1.19/build.gradle +++ b/1.19/build.gradle @@ -4,20 +4,12 @@ plugins { id 'xyz.wagyourtail.unimined' } -repositories { - maven { - name = "wagyourtail releases" - url = "https://maven.wagyourtail.xyz/releases" - } - mavenCentral() -} - unimined.minecraft { version "1.19" mappings { intermediary() - yarn(1) + yarn(4) devFallbackNamespace "intermediary" } diff --git a/1.20.4/build.gradle b/1.20.4/build.gradle index a9bb43bb..e914953b 100644 --- a/1.20.4/build.gradle +++ b/1.20.4/build.gradle @@ -4,20 +4,12 @@ plugins { id 'xyz.wagyourtail.unimined' } -repositories { - maven { - name = "wagyourtail releases" - url = "https://maven.wagyourtail.xyz/releases" - } - mavenCentral() -} - unimined.minecraft { version "1.20.4" mappings { intermediary() - yarn(1) + yarn(3) devFallbackNamespace "intermediary" } diff --git a/1.20/build.gradle b/1.20/build.gradle index 7487e722..85e60a1b 100644 --- a/1.20/build.gradle +++ b/1.20/build.gradle @@ -4,14 +4,6 @@ plugins { id 'xyz.wagyourtail.unimined' } -repositories { - maven { - name = "wagyourtail releases" - url = "https://maven.wagyourtail.xyz/releases" - } - mavenCentral() -} - unimined.minecraft { version "1.20" diff --git a/1.7/build.gradle b/1.7/build.gradle index bcfbc104..a8d47703 100644 --- a/1.7/build.gradle +++ b/1.7/build.gradle @@ -4,18 +4,6 @@ plugins { id 'xyz.wagyourtail.unimined' } -repositories { - maven { - name = "wagyourtail releases" - url = "https://maven.wagyourtail.xyz/releases" - } - maven { - name = "legacyfabric" - url "https://maven.legacyfabric.net/" - } - mavenCentral() -} - unimined.minecraft { version "1.7" diff --git a/1.8.9/build.gradle b/1.8.9/build.gradle index 0a36654c..9d67349b 100644 --- a/1.8.9/build.gradle +++ b/1.8.9/build.gradle @@ -4,18 +4,6 @@ plugins { id 'xyz.wagyourtail.unimined' } -repositories { - maven { - name = "wagyourtail releases" - url = "https://maven.wagyourtail.xyz/releases" - } - maven { - name = "legacyfabric" - url "https://maven.legacyfabric.net/" - } - mavenCentral() -} - unimined.minecraft { version "1.8.9" diff --git a/1.9.4/build.gradle b/1.9.4/build.gradle index 7506bc0b..d3b6e822 100644 --- a/1.9.4/build.gradle +++ b/1.9.4/build.gradle @@ -4,18 +4,6 @@ plugins { id 'xyz.wagyourtail.unimined' } -repositories { - maven { - name = "wagyourtail releases" - url = "https://maven.wagyourtail.xyz/releases" - } - maven { - name = "legacyfabric" - url "https://maven.legacyfabric.net/" - } - mavenCentral() -} - unimined.minecraft { version "1.9.4" diff --git a/22w19a/build.gradle b/22w19a/build.gradle index 112cc7fa..c6e3e9cc 100644 --- a/22w19a/build.gradle +++ b/22w19a/build.gradle @@ -4,20 +4,12 @@ plugins { id 'xyz.wagyourtail.unimined' } -repositories { - maven { - name = "wagyourtail releases" - url = "https://maven.wagyourtail.xyz/releases" - } - mavenCentral() -} - unimined.minecraft { version "22w19a" mappings { intermediary() - yarn(1) + yarn(6) devFallbackNamespace "intermediary" } diff --git a/build.gradle b/build.gradle index c638bd14..6b15530c 100644 --- a/build.gradle +++ b/build.gradle @@ -1,4 +1,20 @@ allprojects { version = "1.0.0-SNAPSHOT" group = "dev.u9g" + + repositories { + maven { + name = "wagyourtail releases" + url = "https://maven.wagyourtail.xyz/releases" + } + maven { + name = "legacyfabric" + url = "https://maven.legacyfabric.net/" + } + maven { + name = "fabric" + url = "https://maven.fabricmc.net/" + } + mavenCentral() + } } diff --git a/settings.gradle b/settings.gradle index 0d36f27a..a9043070 100644 --- a/settings.gradle +++ b/settings.gradle @@ -20,17 +20,9 @@ plugins { } dependencyResolutionManagement { - repositories { - maven { - name = 'Fabric' - url = 'https://maven.fabricmc.net/' - } - mavenCentral() - } versionCatalogs { libs { version('fabric-loader', '0.15.10') - library('fabric-loader', 'net.fabricmc', 'fabric-loader').versionRef('fabric-loader') } } } @@ -45,7 +37,7 @@ include "common" "1.11.2", "1.12.2", "1.13", - // "1.14", + "1.14", "1.15", "1.16", "1.17", From 97c1668b43969c31fb3a18a8f09111b8ccd74a69 Mon Sep 17 00:00:00 2001 From: AlexProgrammerDE <40795980+AlexProgrammerDE@users.noreply.github.com> Date: Wed, 1 May 2024 18:57:06 +0200 Subject: [PATCH 20/38] More cleanup 2 --- .../generators/EffectsDataGenerator.java | 1 - .../generators/EntitiesDataGenerator.java | 1 - .../generators/FoodsDataGenerator.java | 1 - .../generators/ParticlesDataGenerator.java | 1 - .../generators/SoundsDataGenerator.java | 1 - .../generators/EffectsDataGenerator.java | 1 - .../generators/EntitiesDataGenerator.java | 1 - .../generators/FoodsDataGenerator.java | 1 - .../generators/ParticlesDataGenerator.java | 1 - .../generators/SoundsDataGenerator.java | 1 - .../generators/EffectsDataGenerator.java | 1 - .../generators/EntitiesDataGenerator.java | 1 - .../generators/FoodsDataGenerator.java | 1 - .../generators/ParticlesDataGenerator.java | 1 - .../generators/SoundsDataGenerator.java | 1 - .../generators/EffectsDataGenerator.java | 1 - .../generators/EntitiesDataGenerator.java | 1 - .../generators/FoodsDataGenerator.java | 1 - .../generators/ParticlesDataGenerator.java | 1 - .../generators/SoundsDataGenerator.java | 1 - .../generators/TintsDataGenerator.java | 1 - .../generators/BiomesDataGenerator.java | 1 - .../generators/EffectsDataGenerator.java | 1 - .../generators/EntitiesDataGenerator.java | 1 - .../generators/FoodsDataGenerator.java | 1 - .../generators/ParticlesDataGenerator.java | 1 - .../generators/SoundsDataGenerator.java | 1 - .../generators/TintsDataGenerator.java | 1 - .../generators/EffectsDataGenerator.java | 1 - .../generators/EntitiesDataGenerator.java | 1 - .../generators/FoodsDataGenerator.java | 1 - .../generators/ParticlesDataGenerator.java | 1 - .../generators/SoundsDataGenerator.java | 1 - .../generators/TintsDataGenerator.java | 16 +++++++++------- .../generators/EffectsDataGenerator.java | 1 - .../generators/EntitiesDataGenerator.java | 1 - .../generators/FoodsDataGenerator.java | 1 - .../generators/ParticlesDataGenerator.java | 1 - .../generators/SoundsDataGenerator.java | 1 - .../generators/TintsDataGenerator.java | 9 ++++++--- .../generators/EffectsDataGenerator.java | 1 - .../generators/EntitiesDataGenerator.java | 1 - .../generators/FoodsDataGenerator.java | 1 - .../generators/ParticlesDataGenerator.java | 1 - .../generators/SoundsDataGenerator.java | 1 - .../generators/TintsDataGenerator.java | 1 - .../generators/EffectsDataGenerator.java | 1 - .../generators/EntitiesDataGenerator.java | 1 - .../generators/FoodsDataGenerator.java | 1 - .../generators/ParticlesDataGenerator.java | 1 - .../generators/SoundsDataGenerator.java | 1 - .../generators/TintsDataGenerator.java | 1 - .../generators/EffectsDataGenerator.java | 1 - .../generators/EntitiesDataGenerator.java | 1 - .../generators/FoodsDataGenerator.java | 1 - .../generators/ParticlesDataGenerator.java | 1 - .../generators/SoundsDataGenerator.java | 1 - .../generators/TintsDataGenerator.java | 1 - .../generators/EffectsDataGenerator.java | 1 - .../generators/EntitiesDataGenerator.java | 1 - .../generators/FoodsDataGenerator.java | 1 - .../generators/ParticlesDataGenerator.java | 1 - .../generators/SoundsDataGenerator.java | 1 - .../generators/TintsDataGenerator.java | 1 - .../generators/EffectsDataGenerator.java | 1 - .../generators/EntitiesDataGenerator.java | 1 - .../generators/FoodsDataGenerator.java | 1 - .../generators/ParticlesDataGenerator.java | 1 - .../generators/TintsDataGenerator.java | 1 - .../generators/EffectsDataGenerator.java | 1 - .../generators/EntitiesDataGenerator.java | 1 - .../generators/FoodsDataGenerator.java | 1 - .../generators/ParticlesDataGenerator.java | 1 - .../generators/SoundsDataGenerator.java | 1 - .../generators/TintsDataGenerator.java | 1 - .../generators/EffectsDataGenerator.java | 1 - .../generators/EntitiesDataGenerator.java | 1 - .../generators/FoodsDataGenerator.java | 1 - .../generators/TintsDataGenerator.java | 1 - .../generators/EffectsDataGenerator.java | 1 - .../generators/EntitiesDataGenerator.java | 1 - .../generators/FoodsDataGenerator.java | 1 - .../generators/ParticlesDataGenerator.java | 1 - .../generators/TintsDataGenerator.java | 1 - .../generators/EffectsDataGenerator.java | 1 - .../generators/EntitiesDataGenerator.java | 1 - .../generators/FoodsDataGenerator.java | 1 - .../generators/ParticlesDataGenerator.java | 1 - .../generators/SoundsDataGenerator.java | 1 - .../generators/EffectsDataGenerator.java | 1 - .../generators/EntitiesDataGenerator.java | 1 - .../generators/FoodsDataGenerator.java | 1 - .../generators/ParticlesDataGenerator.java | 1 - .../generators/SoundsDataGenerator.java | 1 - .../generators/TintsDataGenerator.java | 1 - 95 files changed, 15 insertions(+), 103 deletions(-) diff --git a/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/EffectsDataGenerator.java b/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/EffectsDataGenerator.java index 6aba51e0..ea880e45 100644 --- a/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/EffectsDataGenerator.java +++ b/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/EffectsDataGenerator.java @@ -16,7 +16,6 @@ import java.util.stream.Collectors; public class EffectsDataGenerator implements IDataGenerator { - public static JsonObject generateEffect(StatusEffect statusEffect) { JsonObject effectDesc = new JsonObject(); @NotNull Identifier registryKey = Objects.requireNonNull(Registries.STATUS_EFFECTS.getIdentifier(statusEffect)); diff --git a/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java b/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java index 3703b843..18bbee55 100644 --- a/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java +++ b/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java @@ -21,7 +21,6 @@ import java.util.Objects; public class EntitiesDataGenerator implements IDataGenerator { - public static JsonObject generateEntity(Class entityClass) { JsonObject entityDesc = new JsonObject(); Identifier registryKey = Registries.ENTITY_TYPES.getIdentifier(entityClass); diff --git a/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/FoodsDataGenerator.java b/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/FoodsDataGenerator.java index fd68583a..f2ad50b6 100644 --- a/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/FoodsDataGenerator.java +++ b/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/FoodsDataGenerator.java @@ -11,7 +11,6 @@ import java.util.Objects; public class FoodsDataGenerator implements IDataGenerator { - public static JsonObject generateFoodDescriptor(FoodItem foodItem) { JsonObject foodDesc = new JsonObject(); Identifier registryKey = Registries.ITEMS.getIdentifier(foodItem); diff --git a/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/ParticlesDataGenerator.java b/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/ParticlesDataGenerator.java index 2b1a5085..36025a4d 100644 --- a/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/ParticlesDataGenerator.java +++ b/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/ParticlesDataGenerator.java @@ -5,7 +5,6 @@ import net.minecraft.client.particle.ParticleType; public class ParticlesDataGenerator implements IDataGenerator { - public static JsonObject generateParticleType(int id, ParticleType particleType) { JsonObject effectDesc = new JsonObject(); diff --git a/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java b/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java index 471d668b..5dd1f107 100644 --- a/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java +++ b/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java @@ -6,7 +6,6 @@ import net.minecraft.sound.Sound; public class SoundsDataGenerator implements IDataGenerator { - public static JsonObject generateSound(Sound soundEvent) { JsonObject soundDesc = new JsonObject(); diff --git a/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/EffectsDataGenerator.java b/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/EffectsDataGenerator.java index 6aba51e0..ea880e45 100644 --- a/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/EffectsDataGenerator.java +++ b/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/EffectsDataGenerator.java @@ -16,7 +16,6 @@ import java.util.stream.Collectors; public class EffectsDataGenerator implements IDataGenerator { - public static JsonObject generateEffect(StatusEffect statusEffect) { JsonObject effectDesc = new JsonObject(); @NotNull Identifier registryKey = Objects.requireNonNull(Registries.STATUS_EFFECTS.getIdentifier(statusEffect)); diff --git a/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java b/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java index 96d035b5..419f3246 100644 --- a/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java +++ b/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java @@ -24,7 +24,6 @@ import java.util.Objects; public class EntitiesDataGenerator implements IDataGenerator { - public static JsonObject generateEntity(Class entityClass) { JsonObject entityDesc = new JsonObject(); Identifier registryKey = Registries.ENTITY_TYPES.getIdentifier(entityClass); diff --git a/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/FoodsDataGenerator.java b/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/FoodsDataGenerator.java index 66c53790..a5b65ce6 100644 --- a/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/FoodsDataGenerator.java +++ b/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/FoodsDataGenerator.java @@ -11,7 +11,6 @@ import java.util.Objects; public class FoodsDataGenerator implements IDataGenerator { - public static JsonObject generateFoodDescriptor(FoodItem foodItem) { JsonObject foodDesc = new JsonObject(); Identifier registryKey = Registries.ITEMS.getIdentifier(foodItem); diff --git a/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/ParticlesDataGenerator.java b/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/ParticlesDataGenerator.java index 2b1a5085..36025a4d 100644 --- a/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/ParticlesDataGenerator.java +++ b/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/ParticlesDataGenerator.java @@ -5,7 +5,6 @@ import net.minecraft.client.particle.ParticleType; public class ParticlesDataGenerator implements IDataGenerator { - public static JsonObject generateParticleType(int id, ParticleType particleType) { JsonObject effectDesc = new JsonObject(); diff --git a/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java b/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java index 471d668b..5dd1f107 100644 --- a/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java +++ b/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java @@ -6,7 +6,6 @@ import net.minecraft.sound.Sound; public class SoundsDataGenerator implements IDataGenerator { - public static JsonObject generateSound(Sound soundEvent) { JsonObject soundDesc = new JsonObject(); diff --git a/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/EffectsDataGenerator.java b/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/EffectsDataGenerator.java index 6aba51e0..ea880e45 100644 --- a/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/EffectsDataGenerator.java +++ b/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/EffectsDataGenerator.java @@ -16,7 +16,6 @@ import java.util.stream.Collectors; public class EffectsDataGenerator implements IDataGenerator { - public static JsonObject generateEffect(StatusEffect statusEffect) { JsonObject effectDesc = new JsonObject(); @NotNull Identifier registryKey = Objects.requireNonNull(Registries.STATUS_EFFECTS.getIdentifier(statusEffect)); diff --git a/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java b/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java index 5528e0b7..4c2fd2ea 100644 --- a/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java +++ b/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java @@ -24,7 +24,6 @@ import java.util.Objects; public class EntitiesDataGenerator implements IDataGenerator { - public static JsonObject generateEntity(Class entityClass) { JsonObject entityDesc = new JsonObject(); Identifier registryKey = Registries.ENTITY_TYPES.getIdentifier(entityClass); diff --git a/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/FoodsDataGenerator.java b/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/FoodsDataGenerator.java index 66c53790..a5b65ce6 100644 --- a/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/FoodsDataGenerator.java +++ b/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/FoodsDataGenerator.java @@ -11,7 +11,6 @@ import java.util.Objects; public class FoodsDataGenerator implements IDataGenerator { - public static JsonObject generateFoodDescriptor(FoodItem foodItem) { JsonObject foodDesc = new JsonObject(); Identifier registryKey = Registries.ITEMS.getIdentifier(foodItem); diff --git a/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/ParticlesDataGenerator.java b/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/ParticlesDataGenerator.java index 2b1a5085..36025a4d 100644 --- a/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/ParticlesDataGenerator.java +++ b/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/ParticlesDataGenerator.java @@ -5,7 +5,6 @@ import net.minecraft.client.particle.ParticleType; public class ParticlesDataGenerator implements IDataGenerator { - public static JsonObject generateParticleType(int id, ParticleType particleType) { JsonObject effectDesc = new JsonObject(); diff --git a/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java b/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java index 471d668b..5dd1f107 100644 --- a/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java +++ b/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java @@ -6,7 +6,6 @@ import net.minecraft.sound.Sound; public class SoundsDataGenerator implements IDataGenerator { - public static JsonObject generateSound(Sound soundEvent) { JsonObject soundDesc = new JsonObject(); diff --git a/1.13/src/main/java/dev/u9g/minecraftdatagenerator/generators/EffectsDataGenerator.java b/1.13/src/main/java/dev/u9g/minecraftdatagenerator/generators/EffectsDataGenerator.java index 33d93eb2..3ceb1045 100644 --- a/1.13/src/main/java/dev/u9g/minecraftdatagenerator/generators/EffectsDataGenerator.java +++ b/1.13/src/main/java/dev/u9g/minecraftdatagenerator/generators/EffectsDataGenerator.java @@ -16,7 +16,6 @@ import java.util.stream.Collectors; public class EffectsDataGenerator implements IDataGenerator { - public static JsonObject generateEffect(Registry registry, StatusEffect statusEffect) { JsonObject effectDesc = new JsonObject(); @NotNull Identifier registryKey = Objects.requireNonNull(registry.getId(statusEffect)); diff --git a/1.13/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java b/1.13/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java index d2db88de..b1fc0395 100644 --- a/1.13/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java +++ b/1.13/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java @@ -24,7 +24,6 @@ import java.util.Objects; public class EntitiesDataGenerator implements IDataGenerator { - public static JsonObject generateEntity(Registry> entityRegistry, EntityType entityType) { JsonObject entityDesc = new JsonObject(); Identifier registryKey = entityRegistry.getId(entityType); diff --git a/1.13/src/main/java/dev/u9g/minecraftdatagenerator/generators/FoodsDataGenerator.java b/1.13/src/main/java/dev/u9g/minecraftdatagenerator/generators/FoodsDataGenerator.java index 7ae7adfd..9ae80460 100644 --- a/1.13/src/main/java/dev/u9g/minecraftdatagenerator/generators/FoodsDataGenerator.java +++ b/1.13/src/main/java/dev/u9g/minecraftdatagenerator/generators/FoodsDataGenerator.java @@ -12,7 +12,6 @@ import java.util.Objects; public class FoodsDataGenerator implements IDataGenerator { - public static JsonObject generateFoodDescriptor(Registry registry, FoodItem foodItem) { JsonObject foodDesc = new JsonObject(); Identifier registryKey = registry.getId(foodItem); diff --git a/1.13/src/main/java/dev/u9g/minecraftdatagenerator/generators/ParticlesDataGenerator.java b/1.13/src/main/java/dev/u9g/minecraftdatagenerator/generators/ParticlesDataGenerator.java index 20f0b729..278bd918 100644 --- a/1.13/src/main/java/dev/u9g/minecraftdatagenerator/generators/ParticlesDataGenerator.java +++ b/1.13/src/main/java/dev/u9g/minecraftdatagenerator/generators/ParticlesDataGenerator.java @@ -9,7 +9,6 @@ import java.util.Objects; public class ParticlesDataGenerator implements IDataGenerator { - public static JsonObject generateParticleType(Registry> registry, ParticleType particleType) { JsonObject effectDesc = new JsonObject(); Identifier registryKey = registry.getId(particleType); diff --git a/1.13/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java b/1.13/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java index 6e98cbf4..d8295e8b 100644 --- a/1.13/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java +++ b/1.13/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java @@ -7,7 +7,6 @@ import net.minecraft.util.registry.Registry; public class SoundsDataGenerator implements IDataGenerator { - public static JsonObject generateSound(Registry registry, Sound soundEvent) { JsonObject soundDesc = new JsonObject(); diff --git a/1.13/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java b/1.13/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java index 1664ff87..f8ab9df2 100644 --- a/1.13/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java +++ b/1.13/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java @@ -18,7 +18,6 @@ import java.util.*; public class TintsDataGenerator implements IDataGenerator { - public static BiomeTintColors generateBiomeTintColors(Registry biomeRegistry) { BiomeTintColors colors = new BiomeTintColors(); for (Biome biome : (Iterable) biomeRegistry) { diff --git a/1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/BiomesDataGenerator.java b/1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/BiomesDataGenerator.java index f7c4d666..bbaccfaf 100644 --- a/1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/BiomesDataGenerator.java +++ b/1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/BiomesDataGenerator.java @@ -10,7 +10,6 @@ import java.util.Objects; public class BiomesDataGenerator implements IDataGenerator { - private static String guessBiomeDimensionFromCategory(Biome biome) { return switch (biome.getCategory()) { case NETHER -> "nether"; diff --git a/1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/EffectsDataGenerator.java b/1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/EffectsDataGenerator.java index 87620c01..52382cd3 100644 --- a/1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/EffectsDataGenerator.java +++ b/1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/EffectsDataGenerator.java @@ -15,7 +15,6 @@ import java.util.stream.Collectors; public class EffectsDataGenerator implements IDataGenerator { - public static JsonObject generateEffect(Registry registry, StatusEffect statusEffect) { JsonObject effectDesc = new JsonObject(); Identifier registryKey = registry.getId(statusEffect); diff --git a/1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java b/1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java index 1ab7c94d..73c112a7 100644 --- a/1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java +++ b/1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java @@ -22,7 +22,6 @@ import java.util.Objects; public class EntitiesDataGenerator implements IDataGenerator { - public static JsonObject generateEntity(Registry> entityRegistry, EntityType entityType) { JsonObject entityDesc = new JsonObject(); Identifier registryKey = entityRegistry.getId(entityType); diff --git a/1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/FoodsDataGenerator.java b/1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/FoodsDataGenerator.java index 2a0c137e..4dc099c1 100644 --- a/1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/FoodsDataGenerator.java +++ b/1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/FoodsDataGenerator.java @@ -10,7 +10,6 @@ import java.util.Objects; public class FoodsDataGenerator implements IDataGenerator { - public static JsonObject generateFoodDescriptor(Registry registry, Item foodItem) { JsonObject foodDesc = new JsonObject(); Identifier registryKey = registry.getId(foodItem); diff --git a/1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/ParticlesDataGenerator.java b/1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/ParticlesDataGenerator.java index d537280d..de81a65c 100644 --- a/1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/ParticlesDataGenerator.java +++ b/1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/ParticlesDataGenerator.java @@ -9,7 +9,6 @@ import java.util.Objects; public class ParticlesDataGenerator implements IDataGenerator { - public static JsonObject generateParticleType(Registry> registry, ParticleType particleType) { JsonObject effectDesc = new JsonObject(); Identifier registryKey = registry.getId(particleType); diff --git a/1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java b/1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java index b7cafae2..c29427ee 100644 --- a/1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java +++ b/1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java @@ -7,7 +7,6 @@ import net.minecraft.util.registry.Registry; public class SoundsDataGenerator implements IDataGenerator { - public static JsonObject generateSound(Registry registry, Sound soundEvent) { JsonObject soundDesc = new JsonObject(); diff --git a/1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java b/1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java index 12345aac..240b92a2 100644 --- a/1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java +++ b/1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java @@ -20,7 +20,6 @@ import java.util.*; public class TintsDataGenerator implements IDataGenerator { - public static BiomeTintColors generateBiomeTintColors(Registry biomeRegistry) { BiomeTintColors colors = new BiomeTintColors(); diff --git a/1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/EffectsDataGenerator.java b/1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/EffectsDataGenerator.java index 87620c01..52382cd3 100644 --- a/1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/EffectsDataGenerator.java +++ b/1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/EffectsDataGenerator.java @@ -15,7 +15,6 @@ import java.util.stream.Collectors; public class EffectsDataGenerator implements IDataGenerator { - public static JsonObject generateEffect(Registry registry, StatusEffect statusEffect) { JsonObject effectDesc = new JsonObject(); Identifier registryKey = registry.getId(statusEffect); diff --git a/1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java b/1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java index 7074a656..60b18864 100644 --- a/1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java +++ b/1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java @@ -22,7 +22,6 @@ import java.util.Objects; public class EntitiesDataGenerator implements IDataGenerator { - public static JsonObject generateEntity(Registry> entityRegistry, EntityType entityType) { JsonObject entityDesc = new JsonObject(); Identifier registryKey = entityRegistry.getId(entityType); diff --git a/1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/FoodsDataGenerator.java b/1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/FoodsDataGenerator.java index fc494d1e..d7e163ea 100644 --- a/1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/FoodsDataGenerator.java +++ b/1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/FoodsDataGenerator.java @@ -11,7 +11,6 @@ import java.util.Objects; public class FoodsDataGenerator implements IDataGenerator { - public static JsonObject generateFoodDescriptor(Registry registry, Item foodItem) { JsonObject foodDesc = new JsonObject(); Identifier registryKey = registry.getId(foodItem); diff --git a/1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/ParticlesDataGenerator.java b/1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/ParticlesDataGenerator.java index d537280d..de81a65c 100644 --- a/1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/ParticlesDataGenerator.java +++ b/1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/ParticlesDataGenerator.java @@ -9,7 +9,6 @@ import java.util.Objects; public class ParticlesDataGenerator implements IDataGenerator { - public static JsonObject generateParticleType(Registry> registry, ParticleType particleType) { JsonObject effectDesc = new JsonObject(); Identifier registryKey = registry.getId(particleType); diff --git a/1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java b/1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java index 8cc66613..c9550fad 100644 --- a/1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java +++ b/1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java @@ -8,7 +8,6 @@ import net.minecraft.util.registry.Registry; public class SoundsDataGenerator implements IDataGenerator { - public static JsonObject generateSound(SoundEvent soundEvent) { JsonObject soundDesc = new JsonObject(); diff --git a/1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java b/1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java index a182f5e2..9e34a5d6 100644 --- a/1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java +++ b/1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java @@ -2,9 +2,6 @@ import com.google.gson.JsonArray; import com.google.gson.JsonObject; -import dev.u9g.minecraftdatagenerator.clientsideannoyances.FoliageColors; -import dev.u9g.minecraftdatagenerator.clientsideannoyances.GrassColors; -import dev.u9g.minecraftdatagenerator.clientsideannoyances.ServerSideRedstoneWireBlock; import dev.u9g.minecraftdatagenerator.util.EmptyRenderBlockView; import net.fabricmc.api.EnvType; import net.fabricmc.loader.api.FabricLoader; @@ -12,21 +9,26 @@ import net.minecraft.block.Blocks; import net.minecraft.block.RedstoneWireBlock; import net.minecraft.client.color.block.BlockColors; +import net.minecraft.client.color.world.FoliageColors; +import net.minecraft.client.color.world.GrassColors; import net.minecraft.util.Identifier; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.MathHelper; import net.minecraft.util.registry.Registry; import net.minecraft.world.biome.Biome; import java.util.*; public class TintsDataGenerator implements IDataGenerator { - public static BiomeTintColors generateBiomeTintColors(Registry biomeRegistry) { BiomeTintColors colors = new BiomeTintColors(); biomeRegistry.forEach(biome -> { - int biomeGrassColor = GrassColors.getGrassColorAt(biome); - int biomeFoliageColor = FoliageColors.getFoliageColor(biome); + double d = MathHelper.clamp(biome.getTemperature(), 0.0f, 1.0f); + double e = MathHelper.clamp(biome.getRainfall(), 0.0f, 1.0f); + + int biomeGrassColor = GrassColors.getColor(d, e); + int biomeFoliageColor = FoliageColors.getColor(d, e); int biomeWaterColor = biome.getWaterColor(); colors.grassColoursMap.computeIfAbsent(biomeGrassColor, k -> new ArrayList<>()).add(biome); @@ -40,7 +42,7 @@ public static Map generateRedstoneTintColors() { Map resultColors = new HashMap<>(); for (int redstoneLevel : RedstoneWireBlock.POWER.getValues()) { - int color = ServerSideRedstoneWireBlock.getWireColor(redstoneLevel); + int color = RedstoneWireBlock.getWireColor(redstoneLevel); resultColors.put(redstoneLevel, color); } return resultColors; diff --git a/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/EffectsDataGenerator.java b/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/EffectsDataGenerator.java index 18a9dcdb..3ae99a65 100644 --- a/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/EffectsDataGenerator.java +++ b/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/EffectsDataGenerator.java @@ -15,7 +15,6 @@ import java.util.stream.Collectors; public class EffectsDataGenerator implements IDataGenerator { - public static JsonObject generateEffect(Registry registry, StatusEffect statusEffect) { JsonObject effectDesc = new JsonObject(); Identifier registryKey = registry.getKey(statusEffect).orElseThrow().getValue(); diff --git a/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java b/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java index d0edd6c3..1a6c3ea1 100644 --- a/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java +++ b/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java @@ -22,7 +22,6 @@ import java.lang.reflect.ParameterizedType; public class EntitiesDataGenerator implements IDataGenerator { - public static JsonObject generateEntity(Registry> entityRegistry, EntityType entityType) { JsonObject entityDesc = new JsonObject(); Identifier registryKey = entityRegistry.getKey(entityType).orElseThrow().getValue(); diff --git a/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/FoodsDataGenerator.java b/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/FoodsDataGenerator.java index 45a0b35f..de659be9 100644 --- a/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/FoodsDataGenerator.java +++ b/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/FoodsDataGenerator.java @@ -11,7 +11,6 @@ import java.util.Objects; public class FoodsDataGenerator implements IDataGenerator { - public static JsonObject generateFoodDescriptor(Registry registry, Item foodItem) { JsonObject foodDesc = new JsonObject(); Identifier registryKey = registry.getKey(foodItem).orElseThrow().getValue(); diff --git a/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/ParticlesDataGenerator.java b/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/ParticlesDataGenerator.java index 5a6b1081..80cca516 100644 --- a/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/ParticlesDataGenerator.java +++ b/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/ParticlesDataGenerator.java @@ -7,7 +7,6 @@ import net.minecraft.util.registry.Registry; public class ParticlesDataGenerator implements IDataGenerator { - public static JsonObject generateParticleType(Registry> registry, ParticleType particleType) { JsonObject effectDesc = new JsonObject(); Identifier registryKey = registry.getKey(particleType).orElseThrow().getValue(); diff --git a/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java b/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java index 8cc66613..c9550fad 100644 --- a/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java +++ b/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java @@ -8,7 +8,6 @@ import net.minecraft.util.registry.Registry; public class SoundsDataGenerator implements IDataGenerator { - public static JsonObject generateSound(SoundEvent soundEvent) { JsonObject soundDesc = new JsonObject(); diff --git a/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java b/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java index fe4f870f..ad68cd18 100644 --- a/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java +++ b/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java @@ -14,19 +14,22 @@ import net.minecraft.client.color.world.GrassColors; import net.minecraft.util.Identifier; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.MathHelper; import net.minecraft.util.registry.Registry; import net.minecraft.world.biome.Biome; import java.util.*; public class TintsDataGenerator implements IDataGenerator { - public static BiomeTintColors generateBiomeTintColors(Registry biomeRegistry) { BiomeTintColors colors = new BiomeTintColors(); biomeRegistry.forEach(biome -> { - int biomeGrassColor = GrassColors.getGrassColorAt(biome); - int biomeFoliageColor = FoliageColors.getFoliageColor(biome); + double d = MathHelper.clamp(biome.getTemperature(), 0.0f, 1.0f); + double e = MathHelper.clamp(biome.getRainfall(), 0.0f, 1.0f); + + int biomeGrassColor = GrassColors.getColor(d, e); + int biomeFoliageColor = FoliageColors.getColor(d, e); int biomeWaterColor = ((BiomeEffectsAccessor) biome.getEffects()).waterColor(); colors.grassColoursMap.computeIfAbsent(biomeGrassColor, k -> new ArrayList<>()).add(biome); diff --git a/1.17/src/main/java/dev/u9g/minecraftdatagenerator/generators/EffectsDataGenerator.java b/1.17/src/main/java/dev/u9g/minecraftdatagenerator/generators/EffectsDataGenerator.java index 1c9849e6..9b4beb53 100644 --- a/1.17/src/main/java/dev/u9g/minecraftdatagenerator/generators/EffectsDataGenerator.java +++ b/1.17/src/main/java/dev/u9g/minecraftdatagenerator/generators/EffectsDataGenerator.java @@ -13,7 +13,6 @@ import java.util.stream.Collectors; public class EffectsDataGenerator implements IDataGenerator { - public static JsonObject generateEffect(Registry registry, StatusEffect statusEffect) { JsonObject effectDesc = new JsonObject(); Identifier registryKey = registry.getKey(statusEffect).orElseThrow().getValue(); diff --git a/1.17/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java b/1.17/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java index 8d94a6b7..29e7ee2b 100644 --- a/1.17/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java +++ b/1.17/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java @@ -18,7 +18,6 @@ import net.minecraft.util.registry.Registry; public class EntitiesDataGenerator implements IDataGenerator { - public static JsonObject generateEntity(Registry> entityRegistry, EntityType entityType) { JsonObject entityDesc = new JsonObject(); Identifier registryKey = entityRegistry.getKey(entityType).orElseThrow().getValue(); diff --git a/1.17/src/main/java/dev/u9g/minecraftdatagenerator/generators/FoodsDataGenerator.java b/1.17/src/main/java/dev/u9g/minecraftdatagenerator/generators/FoodsDataGenerator.java index 45a0b35f..de659be9 100644 --- a/1.17/src/main/java/dev/u9g/minecraftdatagenerator/generators/FoodsDataGenerator.java +++ b/1.17/src/main/java/dev/u9g/minecraftdatagenerator/generators/FoodsDataGenerator.java @@ -11,7 +11,6 @@ import java.util.Objects; public class FoodsDataGenerator implements IDataGenerator { - public static JsonObject generateFoodDescriptor(Registry registry, Item foodItem) { JsonObject foodDesc = new JsonObject(); Identifier registryKey = registry.getKey(foodItem).orElseThrow().getValue(); diff --git a/1.17/src/main/java/dev/u9g/minecraftdatagenerator/generators/ParticlesDataGenerator.java b/1.17/src/main/java/dev/u9g/minecraftdatagenerator/generators/ParticlesDataGenerator.java index 5a6b1081..80cca516 100644 --- a/1.17/src/main/java/dev/u9g/minecraftdatagenerator/generators/ParticlesDataGenerator.java +++ b/1.17/src/main/java/dev/u9g/minecraftdatagenerator/generators/ParticlesDataGenerator.java @@ -7,7 +7,6 @@ import net.minecraft.util.registry.Registry; public class ParticlesDataGenerator implements IDataGenerator { - public static JsonObject generateParticleType(Registry> registry, ParticleType particleType) { JsonObject effectDesc = new JsonObject(); Identifier registryKey = registry.getKey(particleType).orElseThrow().getValue(); diff --git a/1.17/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java b/1.17/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java index 8cc66613..c9550fad 100644 --- a/1.17/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java +++ b/1.17/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java @@ -8,7 +8,6 @@ import net.minecraft.util.registry.Registry; public class SoundsDataGenerator implements IDataGenerator { - public static JsonObject generateSound(SoundEvent soundEvent) { JsonObject soundDesc = new JsonObject(); diff --git a/1.17/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java b/1.17/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java index 2af2d546..1f70c481 100644 --- a/1.17/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java +++ b/1.17/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java @@ -19,7 +19,6 @@ import java.util.*; public class TintsDataGenerator implements IDataGenerator { - public static BiomeTintColors generateBiomeTintColors(Registry biomeRegistry) { BiomeTintColors colors = new BiomeTintColors(); diff --git a/1.18/src/main/java/dev/u9g/minecraftdatagenerator/generators/EffectsDataGenerator.java b/1.18/src/main/java/dev/u9g/minecraftdatagenerator/generators/EffectsDataGenerator.java index 1c9849e6..9b4beb53 100644 --- a/1.18/src/main/java/dev/u9g/minecraftdatagenerator/generators/EffectsDataGenerator.java +++ b/1.18/src/main/java/dev/u9g/minecraftdatagenerator/generators/EffectsDataGenerator.java @@ -13,7 +13,6 @@ import java.util.stream.Collectors; public class EffectsDataGenerator implements IDataGenerator { - public static JsonObject generateEffect(Registry registry, StatusEffect statusEffect) { JsonObject effectDesc = new JsonObject(); Identifier registryKey = registry.getKey(statusEffect).orElseThrow().getValue(); diff --git a/1.18/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java b/1.18/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java index 8d94a6b7..29e7ee2b 100644 --- a/1.18/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java +++ b/1.18/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java @@ -18,7 +18,6 @@ import net.minecraft.util.registry.Registry; public class EntitiesDataGenerator implements IDataGenerator { - public static JsonObject generateEntity(Registry> entityRegistry, EntityType entityType) { JsonObject entityDesc = new JsonObject(); Identifier registryKey = entityRegistry.getKey(entityType).orElseThrow().getValue(); diff --git a/1.18/src/main/java/dev/u9g/minecraftdatagenerator/generators/FoodsDataGenerator.java b/1.18/src/main/java/dev/u9g/minecraftdatagenerator/generators/FoodsDataGenerator.java index 45a0b35f..de659be9 100644 --- a/1.18/src/main/java/dev/u9g/minecraftdatagenerator/generators/FoodsDataGenerator.java +++ b/1.18/src/main/java/dev/u9g/minecraftdatagenerator/generators/FoodsDataGenerator.java @@ -11,7 +11,6 @@ import java.util.Objects; public class FoodsDataGenerator implements IDataGenerator { - public static JsonObject generateFoodDescriptor(Registry registry, Item foodItem) { JsonObject foodDesc = new JsonObject(); Identifier registryKey = registry.getKey(foodItem).orElseThrow().getValue(); diff --git a/1.18/src/main/java/dev/u9g/minecraftdatagenerator/generators/ParticlesDataGenerator.java b/1.18/src/main/java/dev/u9g/minecraftdatagenerator/generators/ParticlesDataGenerator.java index 5a6b1081..80cca516 100644 --- a/1.18/src/main/java/dev/u9g/minecraftdatagenerator/generators/ParticlesDataGenerator.java +++ b/1.18/src/main/java/dev/u9g/minecraftdatagenerator/generators/ParticlesDataGenerator.java @@ -7,7 +7,6 @@ import net.minecraft.util.registry.Registry; public class ParticlesDataGenerator implements IDataGenerator { - public static JsonObject generateParticleType(Registry> registry, ParticleType particleType) { JsonObject effectDesc = new JsonObject(); Identifier registryKey = registry.getKey(particleType).orElseThrow().getValue(); diff --git a/1.18/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java b/1.18/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java index 8cc66613..c9550fad 100644 --- a/1.18/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java +++ b/1.18/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java @@ -8,7 +8,6 @@ import net.minecraft.util.registry.Registry; public class SoundsDataGenerator implements IDataGenerator { - public static JsonObject generateSound(SoundEvent soundEvent) { JsonObject soundDesc = new JsonObject(); diff --git a/1.18/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java b/1.18/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java index 2af2d546..1f70c481 100644 --- a/1.18/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java +++ b/1.18/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java @@ -19,7 +19,6 @@ import java.util.*; public class TintsDataGenerator implements IDataGenerator { - public static BiomeTintColors generateBiomeTintColors(Registry biomeRegistry) { BiomeTintColors colors = new BiomeTintColors(); diff --git a/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/EffectsDataGenerator.java b/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/EffectsDataGenerator.java index 1c9849e6..9b4beb53 100644 --- a/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/EffectsDataGenerator.java +++ b/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/EffectsDataGenerator.java @@ -13,7 +13,6 @@ import java.util.stream.Collectors; public class EffectsDataGenerator implements IDataGenerator { - public static JsonObject generateEffect(Registry registry, StatusEffect statusEffect) { JsonObject effectDesc = new JsonObject(); Identifier registryKey = registry.getKey(statusEffect).orElseThrow().getValue(); diff --git a/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java b/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java index 4eacf202..5e0ed0cf 100644 --- a/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java +++ b/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java @@ -19,7 +19,6 @@ import net.minecraft.util.registry.Registry; public class EntitiesDataGenerator implements IDataGenerator { - public static JsonObject generateEntity(Registry> entityRegistry, EntityType entityType) { JsonObject entityDesc = new JsonObject(); Identifier registryKey = entityRegistry.getKey(entityType).orElseThrow().getValue(); diff --git a/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/FoodsDataGenerator.java b/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/FoodsDataGenerator.java index 45a0b35f..de659be9 100644 --- a/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/FoodsDataGenerator.java +++ b/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/FoodsDataGenerator.java @@ -11,7 +11,6 @@ import java.util.Objects; public class FoodsDataGenerator implements IDataGenerator { - public static JsonObject generateFoodDescriptor(Registry registry, Item foodItem) { JsonObject foodDesc = new JsonObject(); Identifier registryKey = registry.getKey(foodItem).orElseThrow().getValue(); diff --git a/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/ParticlesDataGenerator.java b/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/ParticlesDataGenerator.java index 5a6b1081..80cca516 100644 --- a/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/ParticlesDataGenerator.java +++ b/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/ParticlesDataGenerator.java @@ -7,7 +7,6 @@ import net.minecraft.util.registry.Registry; public class ParticlesDataGenerator implements IDataGenerator { - public static JsonObject generateParticleType(Registry> registry, ParticleType particleType) { JsonObject effectDesc = new JsonObject(); Identifier registryKey = registry.getKey(particleType).orElseThrow().getValue(); diff --git a/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java b/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java index 451faaeb..4601db6b 100644 --- a/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java +++ b/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java @@ -7,7 +7,6 @@ import net.minecraft.util.registry.Registry; public class SoundsDataGenerator implements IDataGenerator { - public static JsonObject generateSound(SoundEvent soundEvent) { JsonObject soundDesc = new JsonObject(); diff --git a/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java b/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java index dda76c54..42a27c68 100644 --- a/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java +++ b/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java @@ -20,7 +20,6 @@ import java.util.Map; public class TintsDataGenerator implements IDataGenerator { - public static BiomeTintColors generateBiomeTintColors(Registry biomeRegistry) { BiomeTintColors colors = new BiomeTintColors(); diff --git a/1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/EffectsDataGenerator.java b/1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/EffectsDataGenerator.java index 1c9849e6..9b4beb53 100644 --- a/1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/EffectsDataGenerator.java +++ b/1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/EffectsDataGenerator.java @@ -13,7 +13,6 @@ import java.util.stream.Collectors; public class EffectsDataGenerator implements IDataGenerator { - public static JsonObject generateEffect(Registry registry, StatusEffect statusEffect) { JsonObject effectDesc = new JsonObject(); Identifier registryKey = registry.getKey(statusEffect).orElseThrow().getValue(); diff --git a/1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java b/1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java index 4eacf202..5e0ed0cf 100644 --- a/1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java +++ b/1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java @@ -19,7 +19,6 @@ import net.minecraft.util.registry.Registry; public class EntitiesDataGenerator implements IDataGenerator { - public static JsonObject generateEntity(Registry> entityRegistry, EntityType entityType) { JsonObject entityDesc = new JsonObject(); Identifier registryKey = entityRegistry.getKey(entityType).orElseThrow().getValue(); diff --git a/1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/FoodsDataGenerator.java b/1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/FoodsDataGenerator.java index 45a0b35f..de659be9 100644 --- a/1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/FoodsDataGenerator.java +++ b/1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/FoodsDataGenerator.java @@ -11,7 +11,6 @@ import java.util.Objects; public class FoodsDataGenerator implements IDataGenerator { - public static JsonObject generateFoodDescriptor(Registry registry, Item foodItem) { JsonObject foodDesc = new JsonObject(); Identifier registryKey = registry.getKey(foodItem).orElseThrow().getValue(); diff --git a/1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/ParticlesDataGenerator.java b/1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/ParticlesDataGenerator.java index 5a6b1081..80cca516 100644 --- a/1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/ParticlesDataGenerator.java +++ b/1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/ParticlesDataGenerator.java @@ -7,7 +7,6 @@ import net.minecraft.util.registry.Registry; public class ParticlesDataGenerator implements IDataGenerator { - public static JsonObject generateParticleType(Registry> registry, ParticleType particleType) { JsonObject effectDesc = new JsonObject(); Identifier registryKey = registry.getKey(particleType).orElseThrow().getValue(); diff --git a/1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java b/1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java index c6566571..ea1a6bea 100644 --- a/1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java +++ b/1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java @@ -8,7 +8,6 @@ import net.minecraft.util.registry.Registry; public class SoundsDataGenerator implements IDataGenerator { - public static JsonObject generateSound(SoundEvent soundEvent) { JsonObject soundDesc = new JsonObject(); diff --git a/1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java b/1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java index dda76c54..42a27c68 100644 --- a/1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java +++ b/1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java @@ -20,7 +20,6 @@ import java.util.Map; public class TintsDataGenerator implements IDataGenerator { - public static BiomeTintColors generateBiomeTintColors(Registry biomeRegistry) { BiomeTintColors colors = new BiomeTintColors(); diff --git a/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/EffectsDataGenerator.java b/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/EffectsDataGenerator.java index 3c619c36..dd6dc019 100644 --- a/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/EffectsDataGenerator.java +++ b/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/EffectsDataGenerator.java @@ -14,7 +14,6 @@ import java.util.stream.Collectors; public class EffectsDataGenerator implements IDataGenerator { - public static JsonObject generateEffect(Registry registry, StatusEffect statusEffect) { JsonObject effectDesc = new JsonObject(); Identifier registryKey = registry.getKey(statusEffect).orElseThrow().getValue(); diff --git a/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java b/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java index 1a9bea60..31e5d3b3 100644 --- a/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java +++ b/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java @@ -20,7 +20,6 @@ import net.minecraft.util.Identifier; public class EntitiesDataGenerator implements IDataGenerator { - public static JsonObject generateEntity(Registry> entityRegistry, EntityType entityType) { JsonObject entityDesc = new JsonObject(); Identifier registryKey = entityRegistry.getKey(entityType).orElseThrow().getValue(); diff --git a/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/FoodsDataGenerator.java b/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/FoodsDataGenerator.java index a5b164f1..97a73639 100644 --- a/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/FoodsDataGenerator.java +++ b/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/FoodsDataGenerator.java @@ -12,7 +12,6 @@ import java.util.Objects; public class FoodsDataGenerator implements IDataGenerator { - public static JsonObject generateFoodDescriptor(Registry registry, Item foodItem) { JsonObject foodDesc = new JsonObject(); Identifier registryKey = registry.getKey(foodItem).orElseThrow().getValue(); diff --git a/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/ParticlesDataGenerator.java b/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/ParticlesDataGenerator.java index e446a50b..bc5a9acc 100644 --- a/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/ParticlesDataGenerator.java +++ b/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/ParticlesDataGenerator.java @@ -9,7 +9,6 @@ import net.minecraft.util.Identifier; public class ParticlesDataGenerator implements IDataGenerator { - public static JsonObject generateParticleType(Registry> registry, ParticleType particleType) { JsonObject effectDesc = new JsonObject(); Identifier registryKey = registry.getKey(particleType).orElseThrow().getValue(); diff --git a/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java b/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java index 1f4f96b0..e9e50b9d 100644 --- a/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java +++ b/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java @@ -22,7 +22,6 @@ import java.util.Map; public class TintsDataGenerator implements IDataGenerator { - public static BiomeTintColors generateBiomeTintColors(Registry biomeRegistry) { BiomeTintColors colors = new BiomeTintColors(); diff --git a/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/EffectsDataGenerator.java b/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/EffectsDataGenerator.java index 3c619c36..dd6dc019 100644 --- a/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/EffectsDataGenerator.java +++ b/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/EffectsDataGenerator.java @@ -14,7 +14,6 @@ import java.util.stream.Collectors; public class EffectsDataGenerator implements IDataGenerator { - public static JsonObject generateEffect(Registry registry, StatusEffect statusEffect) { JsonObject effectDesc = new JsonObject(); Identifier registryKey = registry.getKey(statusEffect).orElseThrow().getValue(); diff --git a/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java b/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java index 37d4fb1b..c989ca59 100644 --- a/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java +++ b/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java @@ -20,7 +20,6 @@ import net.minecraft.util.Identifier; public class EntitiesDataGenerator implements IDataGenerator { - public static JsonObject generateEntity(Registry> entityRegistry, EntityType entityType) { JsonObject entityDesc = new JsonObject(); Identifier registryKey = entityRegistry.getKey(entityType).orElseThrow().getValue(); diff --git a/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/FoodsDataGenerator.java b/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/FoodsDataGenerator.java index a5b164f1..97a73639 100644 --- a/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/FoodsDataGenerator.java +++ b/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/FoodsDataGenerator.java @@ -12,7 +12,6 @@ import java.util.Objects; public class FoodsDataGenerator implements IDataGenerator { - public static JsonObject generateFoodDescriptor(Registry registry, Item foodItem) { JsonObject foodDesc = new JsonObject(); Identifier registryKey = registry.getKey(foodItem).orElseThrow().getValue(); diff --git a/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/ParticlesDataGenerator.java b/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/ParticlesDataGenerator.java index e446a50b..bc5a9acc 100644 --- a/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/ParticlesDataGenerator.java +++ b/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/ParticlesDataGenerator.java @@ -9,7 +9,6 @@ import net.minecraft.util.Identifier; public class ParticlesDataGenerator implements IDataGenerator { - public static JsonObject generateParticleType(Registry> registry, ParticleType particleType) { JsonObject effectDesc = new JsonObject(); Identifier registryKey = registry.getKey(particleType).orElseThrow().getValue(); diff --git a/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java b/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java index b0f62122..f98af8ad 100644 --- a/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java +++ b/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java @@ -10,7 +10,6 @@ import net.minecraft.sound.SoundEvent; public class SoundsDataGenerator implements IDataGenerator { - public static JsonObject generateSound(SoundEvent soundEvent) { JsonObject soundDesc = new JsonObject(); diff --git a/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java b/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java index 1f4f96b0..e9e50b9d 100644 --- a/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java +++ b/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java @@ -22,7 +22,6 @@ import java.util.Map; public class TintsDataGenerator implements IDataGenerator { - public static BiomeTintColors generateBiomeTintColors(Registry biomeRegistry) { BiomeTintColors colors = new BiomeTintColors(); diff --git a/1.7/src/main/java/dev/u9g/minecraftdatagenerator/generators/EffectsDataGenerator.java b/1.7/src/main/java/dev/u9g/minecraftdatagenerator/generators/EffectsDataGenerator.java index 66f54d2f..cc622676 100644 --- a/1.7/src/main/java/dev/u9g/minecraftdatagenerator/generators/EffectsDataGenerator.java +++ b/1.7/src/main/java/dev/u9g/minecraftdatagenerator/generators/EffectsDataGenerator.java @@ -11,7 +11,6 @@ import java.util.Objects; public class EffectsDataGenerator implements IDataGenerator { - public static JsonObject generateEffect(StatusEffect statusEffect) { JsonObject effectDesc = new JsonObject(); @NotNull String name = Objects.requireNonNull(Registries.STATUS_EFFECTS.getId(statusEffect)); diff --git a/1.7/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java b/1.7/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java index ec013c69..166b12f1 100644 --- a/1.7/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java +++ b/1.7/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java @@ -20,7 +20,6 @@ import java.util.Objects; public class EntitiesDataGenerator implements IDataGenerator { - public static JsonObject generateEntity(Class entityClass) { JsonObject entityDesc = new JsonObject(); String registryKey = Registries.ENTITY_TYPES.getId(entityClass); diff --git a/1.7/src/main/java/dev/u9g/minecraftdatagenerator/generators/FoodsDataGenerator.java b/1.7/src/main/java/dev/u9g/minecraftdatagenerator/generators/FoodsDataGenerator.java index b93cec8f..695238b7 100644 --- a/1.7/src/main/java/dev/u9g/minecraftdatagenerator/generators/FoodsDataGenerator.java +++ b/1.7/src/main/java/dev/u9g/minecraftdatagenerator/generators/FoodsDataGenerator.java @@ -10,7 +10,6 @@ import java.util.Objects; public class FoodsDataGenerator implements IDataGenerator { - public static JsonObject generateFoodDescriptor(FoodItem foodItem) { JsonObject foodDesc = new JsonObject(); String registryKey = Registries.ITEMS.getId(foodItem); diff --git a/1.7/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java b/1.7/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java index dbfd2d9b..f0895c1b 100644 --- a/1.7/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java +++ b/1.7/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java @@ -15,7 +15,6 @@ import java.util.*; public class TintsDataGenerator implements IDataGenerator { - public static BiomeTintColors generateBiomeTintColors() { BiomeTintColors colors = new BiomeTintColors(); diff --git a/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/generators/EffectsDataGenerator.java b/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/generators/EffectsDataGenerator.java index 08524dc0..3dc768f7 100644 --- a/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/generators/EffectsDataGenerator.java +++ b/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/generators/EffectsDataGenerator.java @@ -15,7 +15,6 @@ import java.util.stream.Collectors; public class EffectsDataGenerator implements IDataGenerator { - public static JsonObject generateEffect(StatusEffect statusEffect) { JsonObject effectDesc = new JsonObject(); @NotNull Identifier registryKey = Objects.requireNonNull(Registries.STATUS_EFFECTS.getIdentifier(statusEffect)); diff --git a/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java b/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java index e0e9e745..a14483d7 100644 --- a/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java +++ b/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java @@ -21,7 +21,6 @@ import java.util.Objects; public class EntitiesDataGenerator implements IDataGenerator { - public static JsonObject generateEntity(Class entityClass) { JsonObject entityDesc = new JsonObject(); Identifier registryKey = Registries.ENTITY_TYPES.getIdentifier(entityClass); diff --git a/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/generators/FoodsDataGenerator.java b/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/generators/FoodsDataGenerator.java index fd68583a..f2ad50b6 100644 --- a/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/generators/FoodsDataGenerator.java +++ b/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/generators/FoodsDataGenerator.java @@ -11,7 +11,6 @@ import java.util.Objects; public class FoodsDataGenerator implements IDataGenerator { - public static JsonObject generateFoodDescriptor(FoodItem foodItem) { JsonObject foodDesc = new JsonObject(); Identifier registryKey = Registries.ITEMS.getIdentifier(foodItem); diff --git a/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/generators/ParticlesDataGenerator.java b/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/generators/ParticlesDataGenerator.java index 2b1a5085..36025a4d 100644 --- a/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/generators/ParticlesDataGenerator.java +++ b/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/generators/ParticlesDataGenerator.java @@ -5,7 +5,6 @@ import net.minecraft.client.particle.ParticleType; public class ParticlesDataGenerator implements IDataGenerator { - public static JsonObject generateParticleType(int id, ParticleType particleType) { JsonObject effectDesc = new JsonObject(); diff --git a/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java b/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java index 55706a66..9dda8f16 100644 --- a/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java +++ b/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java @@ -18,7 +18,6 @@ import java.util.*; public class TintsDataGenerator implements IDataGenerator { - public static BiomeTintColors generateBiomeTintColors() { BiomeTintColors colors = new BiomeTintColors(); diff --git a/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/EffectsDataGenerator.java b/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/EffectsDataGenerator.java index 6aba51e0..ea880e45 100644 --- a/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/EffectsDataGenerator.java +++ b/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/EffectsDataGenerator.java @@ -16,7 +16,6 @@ import java.util.stream.Collectors; public class EffectsDataGenerator implements IDataGenerator { - public static JsonObject generateEffect(StatusEffect statusEffect) { JsonObject effectDesc = new JsonObject(); @NotNull Identifier registryKey = Objects.requireNonNull(Registries.STATUS_EFFECTS.getIdentifier(statusEffect)); diff --git a/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java b/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java index d5ef72ef..2554af41 100644 --- a/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java +++ b/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java @@ -21,7 +21,6 @@ import java.util.Objects; public class EntitiesDataGenerator implements IDataGenerator { - public static JsonObject generateEntity(Class entityClass) { JsonObject entityDesc = new JsonObject(); Identifier registryKey = Registries.ENTITY_TYPES.getIdentifier(entityClass); diff --git a/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/FoodsDataGenerator.java b/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/FoodsDataGenerator.java index fd68583a..f2ad50b6 100644 --- a/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/FoodsDataGenerator.java +++ b/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/FoodsDataGenerator.java @@ -11,7 +11,6 @@ import java.util.Objects; public class FoodsDataGenerator implements IDataGenerator { - public static JsonObject generateFoodDescriptor(FoodItem foodItem) { JsonObject foodDesc = new JsonObject(); Identifier registryKey = Registries.ITEMS.getIdentifier(foodItem); diff --git a/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/ParticlesDataGenerator.java b/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/ParticlesDataGenerator.java index 2b1a5085..36025a4d 100644 --- a/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/ParticlesDataGenerator.java +++ b/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/ParticlesDataGenerator.java @@ -5,7 +5,6 @@ import net.minecraft.client.particle.ParticleType; public class ParticlesDataGenerator implements IDataGenerator { - public static JsonObject generateParticleType(int id, ParticleType particleType) { JsonObject effectDesc = new JsonObject(); diff --git a/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java b/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java index 471d668b..5dd1f107 100644 --- a/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java +++ b/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java @@ -6,7 +6,6 @@ import net.minecraft.sound.Sound; public class SoundsDataGenerator implements IDataGenerator { - public static JsonObject generateSound(Sound soundEvent) { JsonObject soundDesc = new JsonObject(); diff --git a/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/generators/EffectsDataGenerator.java b/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/generators/EffectsDataGenerator.java index 1c9849e6..9b4beb53 100644 --- a/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/generators/EffectsDataGenerator.java +++ b/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/generators/EffectsDataGenerator.java @@ -13,7 +13,6 @@ import java.util.stream.Collectors; public class EffectsDataGenerator implements IDataGenerator { - public static JsonObject generateEffect(Registry registry, StatusEffect statusEffect) { JsonObject effectDesc = new JsonObject(); Identifier registryKey = registry.getKey(statusEffect).orElseThrow().getValue(); diff --git a/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java b/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java index c11cb03c..85592239 100644 --- a/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java +++ b/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java @@ -21,7 +21,6 @@ import java.lang.reflect.ParameterizedType; public class EntitiesDataGenerator implements IDataGenerator { - public static JsonObject generateEntity(Registry> entityRegistry, EntityType entityType) { JsonObject entityDesc = new JsonObject(); Identifier registryKey = entityRegistry.getKey(entityType).orElseThrow().getValue(); diff --git a/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/generators/FoodsDataGenerator.java b/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/generators/FoodsDataGenerator.java index 45a0b35f..de659be9 100644 --- a/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/generators/FoodsDataGenerator.java +++ b/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/generators/FoodsDataGenerator.java @@ -11,7 +11,6 @@ import java.util.Objects; public class FoodsDataGenerator implements IDataGenerator { - public static JsonObject generateFoodDescriptor(Registry registry, Item foodItem) { JsonObject foodDesc = new JsonObject(); Identifier registryKey = registry.getKey(foodItem).orElseThrow().getValue(); diff --git a/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/generators/ParticlesDataGenerator.java b/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/generators/ParticlesDataGenerator.java index 5a6b1081..80cca516 100644 --- a/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/generators/ParticlesDataGenerator.java +++ b/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/generators/ParticlesDataGenerator.java @@ -7,7 +7,6 @@ import net.minecraft.util.registry.Registry; public class ParticlesDataGenerator implements IDataGenerator { - public static JsonObject generateParticleType(Registry> registry, ParticleType particleType) { JsonObject effectDesc = new JsonObject(); Identifier registryKey = registry.getKey(particleType).orElseThrow().getValue(); diff --git a/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java b/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java index a6efaae8..d0a4bacf 100644 --- a/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java +++ b/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java @@ -7,7 +7,6 @@ import net.minecraft.util.registry.Registry; public class SoundsDataGenerator implements IDataGenerator { - public static JsonObject generateSound(SoundEvent soundEvent) { JsonObject soundDesc = new JsonObject(); diff --git a/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java b/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java index 1b6b8c76..3f4c3941 100644 --- a/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java +++ b/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java @@ -19,7 +19,6 @@ import java.util.*; public class TintsDataGenerator implements IDataGenerator { - public static BiomeTintColors generateBiomeTintColors(Registry biomeRegistry) { BiomeTintColors colors = new BiomeTintColors(); From a46cb8fc22e0047db2ae11e3e2cb10ff46234827 Mon Sep 17 00:00:00 2001 From: AlexProgrammerDE <40795980+AlexProgrammerDE@users.noreply.github.com> Date: Wed, 1 May 2024 21:06:41 +0200 Subject: [PATCH 21/38] More improvements --- 1.14/build.gradle | 5 +---- .../generators/SoundsDataGenerator.java | 10 +++++----- buildSrc/build.gradle.kts | 2 +- settings.gradle | 17 ----------------- 4 files changed, 7 insertions(+), 27 deletions(-) diff --git a/1.14/build.gradle b/1.14/build.gradle index 87ac7a6d..91a483aa 100644 --- a/1.14/build.gradle +++ b/1.14/build.gradle @@ -9,10 +9,7 @@ unimined.minecraft { mappings { intermediary() - yarn(21) { - mapNamespace("named", "intermediary") - mapNamespace("intermediary", "yarn") - } + yarnv1(21) devFallbackNamespace "intermediary" } diff --git a/1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java b/1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java index c29427ee..a4840c35 100644 --- a/1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java +++ b/1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java @@ -4,14 +4,15 @@ import com.google.gson.JsonObject; import dev.u9g.minecraftdatagenerator.mixin.SoundAccessor; import net.minecraft.client.sound.Sound; +import net.minecraft.sound.SoundEvent; import net.minecraft.util.registry.Registry; public class SoundsDataGenerator implements IDataGenerator { - public static JsonObject generateSound(Registry registry, Sound soundEvent) { + public static JsonObject generateSound(SoundEvent soundEvent) { JsonObject soundDesc = new JsonObject(); - soundDesc.addProperty("id", registry.getRawId(soundEvent)); - soundDesc.addProperty("name", ((SoundAccessor) soundEvent).id().getPath()); + soundDesc.addProperty("id", Registry.SOUND_EVENT.getRawId(soundEvent)); + soundDesc.addProperty("name", soundEvent.getId().getPath()); return soundDesc; } @@ -24,8 +25,7 @@ public String getDataName() { @Override public JsonArray generateDataJson() { JsonArray resultsArray = new JsonArray(); - Registry soundEventRegistry = Registry.SOUND_EVENT; - soundEventRegistry.forEach(sound -> resultsArray.add(generateSound(soundEventRegistry, sound))); + Registry.SOUND_EVENT.forEach(sound -> resultsArray.add(generateSound(sound))); return resultsArray; } } diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 58f25566..f1786788 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -14,7 +14,7 @@ repositories { } dependencies { - implementation("xyz.wagyourtail.unimined:xyz.wagyourtail.unimined.gradle.plugin:1.2.3") + implementation("xyz.wagyourtail.unimined:xyz.wagyourtail.unimined.gradle.plugin:1.2.5-SNAPSHOT") // guava implementation("com.google.guava:guava:31.1-jre") diff --git a/settings.gradle b/settings.gradle index a9043070..270c0d42 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,20 +1,3 @@ -pluginManagement { - repositories { - maven { - name = 'WagYourReleases' - url = 'https://maven.wagyourtail.xyz/releases' - } - maven { - name = 'WagYourSnapshots' - url = 'https://maven.wagyourtail.xyz/snapshots' - } - gradlePluginPortal() - } - plugins { - id "xyz.wagyourtail.unimined" version "1.2.3" - } -} - plugins { id 'org.gradle.toolchains.foojay-resolver-convention' version '0.8.0' } From bcd97b1d5dfc25eb8f0b602c575b9b7e988f4941 Mon Sep 17 00:00:00 2001 From: AlexProgrammerDE <40795980+AlexProgrammerDE@users.noreply.github.com> Date: Thu, 2 May 2024 07:19:58 +0200 Subject: [PATCH 22/38] Remove more duplicate code --- .../generators/TintsDataGenerator.java | 4 +- .../generators/TintsDataGenerator.java | 4 +- .../generators/TintsDataGenerator.java | 4 +- .../generators/TintsDataGenerator.java | 15 ++- .../generators/TintsDataGenerator.java | 15 ++- .../generators/TintsDataGenerator.java | 15 ++- .../generators/TintsDataGenerator.java | 15 ++- .../generators/TintsDataGenerator.java | 15 ++- .../generators/TintsDataGenerator.java | 15 ++- .../generators/TintsDataGenerator.java | 17 ++-- .../mojangannoyances/BiomeColors.java | 32 ------- .../mojangannoyances/BlockColorProvider.java | 11 --- .../mojangannoyances/BlockColors.java | 93 ------------------ .../generators/TintsDataGenerator.java | 17 ++-- .../mojangannoyances/BiomeColors.java | 32 ------- .../mojangannoyances/BlockColorProvider.java | 11 --- .../mojangannoyances/BlockColors.java | 93 ------------------ .../generators/TintsDataGenerator.java | 17 ++-- .../mojangannoyances/BiomeColors.java | 32 ------- .../mojangannoyances/BlockColorProvider.java | 11 --- .../mojangannoyances/BlockColors.java | 94 ------------------- .../generators/TintsDataGenerator.java | 17 ++-- .../mojangannoyances/BiomeColors.java | 32 ------- .../mojangannoyances/BlockColorProvider.java | 11 --- .../mojangannoyances/BlockColors.java | 94 ------------------- .../generators/TintsDataGenerator.java | 4 +- .../generators/TintsDataGenerator.java | 4 +- .../generators/TintsDataGenerator.java | 4 +- .../generators/TintsDataGenerator.java | 15 ++- 29 files changed, 93 insertions(+), 650 deletions(-) delete mode 100644 1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/mojangannoyances/BiomeColors.java delete mode 100644 1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/mojangannoyances/BlockColorProvider.java delete mode 100644 1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/mojangannoyances/BlockColors.java delete mode 100644 1.19/src/main/java/dev/u9g/minecraftdatagenerator/mojangannoyances/BiomeColors.java delete mode 100644 1.19/src/main/java/dev/u9g/minecraftdatagenerator/mojangannoyances/BlockColorProvider.java delete mode 100644 1.19/src/main/java/dev/u9g/minecraftdatagenerator/mojangannoyances/BlockColors.java delete mode 100644 1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/mojangannoyances/BiomeColors.java delete mode 100644 1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/mojangannoyances/BlockColorProvider.java delete mode 100644 1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/mojangannoyances/BlockColors.java delete mode 100644 1.20/src/main/java/dev/u9g/minecraftdatagenerator/mojangannoyances/BiomeColors.java delete mode 100644 1.20/src/main/java/dev/u9g/minecraftdatagenerator/mojangannoyances/BlockColorProvider.java delete mode 100644 1.20/src/main/java/dev/u9g/minecraftdatagenerator/mojangannoyances/BlockColors.java diff --git a/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java b/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java index 76cb62c6..fe394012 100644 --- a/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java +++ b/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java @@ -58,8 +58,8 @@ public static Map generateConstantTintColors() { resultColors.put(Blocks.LILY_PAD, getBlockColor(Blocks.LILY_PAD)); // FIXME: ? - // resultColors.put(Blocks.ATTACHED_MELON_STEM, getBlockColor(Blocks.ATTACHED_MELON_STEM, blockColors)); - // resultColors.put(Blocks.ATTACHED_PUMPKIN_STEM, getBlockColor(Blocks.ATTACHED_PUMPKIN_STEM, blockColors)); + // resultColors.put(Blocks.ATTACHED_MELON_STEM, getBlockColor(Blocks.ATTACHED_MELON_STEM)); + // resultColors.put(Blocks.ATTACHED_PUMPKIN_STEM, getBlockColor(Blocks.ATTACHED_PUMPKIN_STEM)); //not really constant, depend on the block age, but kinda have to be handled since textures are literally white without them resultColors.put(Blocks.MELON_STEM, getBlockColor(Blocks.MELON_STEM)); diff --git a/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java b/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java index 76cb62c6..fe394012 100644 --- a/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java +++ b/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java @@ -58,8 +58,8 @@ public static Map generateConstantTintColors() { resultColors.put(Blocks.LILY_PAD, getBlockColor(Blocks.LILY_PAD)); // FIXME: ? - // resultColors.put(Blocks.ATTACHED_MELON_STEM, getBlockColor(Blocks.ATTACHED_MELON_STEM, blockColors)); - // resultColors.put(Blocks.ATTACHED_PUMPKIN_STEM, getBlockColor(Blocks.ATTACHED_PUMPKIN_STEM, blockColors)); + // resultColors.put(Blocks.ATTACHED_MELON_STEM, getBlockColor(Blocks.ATTACHED_MELON_STEM)); + // resultColors.put(Blocks.ATTACHED_PUMPKIN_STEM, getBlockColor(Blocks.ATTACHED_PUMPKIN_STEM)); //not really constant, depend on the block age, but kinda have to be handled since textures are literally white without them resultColors.put(Blocks.MELON_STEM, getBlockColor(Blocks.MELON_STEM)); diff --git a/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java b/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java index e31e41b0..25542b6e 100644 --- a/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java +++ b/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java @@ -59,8 +59,8 @@ public static Map generateConstantTintColors() { resultColors.put(Blocks.LILY_PAD, getBlockColor(Blocks.LILY_PAD)); // FIXME: ? - // resultColors.put(Blocks.ATTACHED_MELON_STEM, getBlockColor(Blocks.ATTACHED_MELON_STEM, blockColors)); - // resultColors.put(Blocks.ATTACHED_PUMPKIN_STEM, getBlockColor(Blocks.ATTACHED_PUMPKIN_STEM, blockColors)); + // resultColors.put(Blocks.ATTACHED_MELON_STEM, getBlockColor(Blocks.ATTACHED_MELON_STEM)); + // resultColors.put(Blocks.ATTACHED_PUMPKIN_STEM, getBlockColor(Blocks.ATTACHED_PUMPKIN_STEM)); //not really constant, depend on the block age, but kinda have to be handled since textures are literally white without them resultColors.put(Blocks.MELON_STEM, getBlockColor(Blocks.MELON_STEM)); diff --git a/1.13/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java b/1.13/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java index f8ab9df2..851fd4c6 100644 --- a/1.13/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java +++ b/1.13/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java @@ -45,24 +45,23 @@ public static Map generateRedstoneTintColors() { return resultColors; } - private static int getBlockColor(Block block, BlockColors blockColors) { - return blockColors.method_13410(block.getDefaultState(), DGU.getWorld(), BlockPos.ORIGIN); + private static int getBlockColor(Block block) { + return BlockColors.create().method_13410(block.getDefaultState(), DGU.getWorld(), BlockPos.ORIGIN); } public static Map generateConstantTintColors() { Map resultColors = new HashMap<>(); - BlockColors blockColors = BlockColors.create(); resultColors.put(Blocks.BIRCH_LEAVES, FoliageColors.getBirchColor()); resultColors.put(Blocks.SPRUCE_LEAVES, FoliageColors.getSpruceColor()); - resultColors.put(Blocks.LILY_PAD, getBlockColor(Blocks.LILY_PAD, blockColors)); - resultColors.put(Blocks.ATTACHED_MELON_STEM, getBlockColor(Blocks.ATTACHED_MELON_STEM, blockColors)); - resultColors.put(Blocks.ATTACHED_PUMPKIN_STEM, getBlockColor(Blocks.ATTACHED_PUMPKIN_STEM, blockColors)); + resultColors.put(Blocks.LILY_PAD, getBlockColor(Blocks.LILY_PAD)); + resultColors.put(Blocks.ATTACHED_MELON_STEM, getBlockColor(Blocks.ATTACHED_MELON_STEM)); + resultColors.put(Blocks.ATTACHED_PUMPKIN_STEM, getBlockColor(Blocks.ATTACHED_PUMPKIN_STEM)); //not really constant, depend on the block age, but kinda have to be handled since textures are literally white without them - resultColors.put(Blocks.MELON_STEM, getBlockColor(Blocks.MELON_STEM, blockColors)); - resultColors.put(Blocks.PUMPKIN_STEM, getBlockColor(Blocks.PUMPKIN_STEM, blockColors)); + resultColors.put(Blocks.MELON_STEM, getBlockColor(Blocks.MELON_STEM)); + resultColors.put(Blocks.PUMPKIN_STEM, getBlockColor(Blocks.PUMPKIN_STEM)); return resultColors; } diff --git a/1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java b/1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java index 240b92a2..5c13e80d 100644 --- a/1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java +++ b/1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java @@ -48,24 +48,23 @@ public static Map generateRedstoneTintColors() { return resultColors; } - private static int getBlockColor(Block block, BlockColors blockColors) { - return blockColors.getColor(block.getDefaultState(), DGU.getWorld(), BlockPos.ORIGIN); + private static int getBlockColor(Block block) { + return BlockColors.create().getColor(block.getDefaultState(), DGU.getWorld(), BlockPos.ORIGIN); } public static Map generateConstantTintColors() { Map resultColors = new HashMap<>(); - BlockColors blockColors = BlockColors.create(); resultColors.put(Blocks.BIRCH_LEAVES, FoliageColors.getBirchColor()); resultColors.put(Blocks.SPRUCE_LEAVES, FoliageColors.getSpruceColor()); - resultColors.put(Blocks.LILY_PAD, getBlockColor(Blocks.LILY_PAD, blockColors)); - resultColors.put(Blocks.ATTACHED_MELON_STEM, getBlockColor(Blocks.ATTACHED_MELON_STEM, blockColors)); - resultColors.put(Blocks.ATTACHED_PUMPKIN_STEM, getBlockColor(Blocks.ATTACHED_PUMPKIN_STEM, blockColors)); + resultColors.put(Blocks.LILY_PAD, getBlockColor(Blocks.LILY_PAD)); + resultColors.put(Blocks.ATTACHED_MELON_STEM, getBlockColor(Blocks.ATTACHED_MELON_STEM)); + resultColors.put(Blocks.ATTACHED_PUMPKIN_STEM, getBlockColor(Blocks.ATTACHED_PUMPKIN_STEM)); //not really constant, depend on the block age, but kinda have to be handled since textures are literally white without them - resultColors.put(Blocks.MELON_STEM, getBlockColor(Blocks.MELON_STEM, blockColors)); - resultColors.put(Blocks.PUMPKIN_STEM, getBlockColor(Blocks.PUMPKIN_STEM, blockColors)); + resultColors.put(Blocks.MELON_STEM, getBlockColor(Blocks.MELON_STEM)); + resultColors.put(Blocks.PUMPKIN_STEM, getBlockColor(Blocks.PUMPKIN_STEM)); return resultColors; } diff --git a/1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java b/1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java index 9e34a5d6..9177e2d5 100644 --- a/1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java +++ b/1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java @@ -48,24 +48,23 @@ public static Map generateRedstoneTintColors() { return resultColors; } - private static int getBlockColor(Block block, BlockColors blockColors) { - return blockColors.getColor(block.getDefaultState(), EmptyRenderBlockView.INSTANCE, BlockPos.ORIGIN, 0xFFFFFF); + private static int getBlockColor(Block block) { + return BlockColors.create().getColor(block.getDefaultState(), EmptyRenderBlockView.INSTANCE, BlockPos.ORIGIN, 0xFFFFFF); } public static Map generateConstantTintColors() { Map resultColors = new HashMap<>(); - BlockColors blockColors = BlockColors.create(); resultColors.put(Blocks.BIRCH_LEAVES, FoliageColors.getBirchColor()); resultColors.put(Blocks.SPRUCE_LEAVES, FoliageColors.getSpruceColor()); - resultColors.put(Blocks.LILY_PAD, getBlockColor(Blocks.LILY_PAD, blockColors)); - resultColors.put(Blocks.ATTACHED_MELON_STEM, getBlockColor(Blocks.ATTACHED_MELON_STEM, blockColors)); - resultColors.put(Blocks.ATTACHED_PUMPKIN_STEM, getBlockColor(Blocks.ATTACHED_PUMPKIN_STEM, blockColors)); + resultColors.put(Blocks.LILY_PAD, getBlockColor(Blocks.LILY_PAD)); + resultColors.put(Blocks.ATTACHED_MELON_STEM, getBlockColor(Blocks.ATTACHED_MELON_STEM)); + resultColors.put(Blocks.ATTACHED_PUMPKIN_STEM, getBlockColor(Blocks.ATTACHED_PUMPKIN_STEM)); //not really constant, depend on the block age, but kinda have to be handled since textures are literally white without them - resultColors.put(Blocks.MELON_STEM, getBlockColor(Blocks.MELON_STEM, blockColors)); - resultColors.put(Blocks.PUMPKIN_STEM, getBlockColor(Blocks.PUMPKIN_STEM, blockColors)); + resultColors.put(Blocks.MELON_STEM, getBlockColor(Blocks.MELON_STEM)); + resultColors.put(Blocks.PUMPKIN_STEM, getBlockColor(Blocks.PUMPKIN_STEM)); return resultColors; } diff --git a/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java b/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java index ad68cd18..2d79ca66 100644 --- a/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java +++ b/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java @@ -49,24 +49,23 @@ public static Map generateRedstoneTintColors() { return resultColors; } - private static int getBlockColor(Block block, BlockColors blockColors) { - return blockColors.getColor(block.getDefaultState(), EmptyRenderBlockView.INSTANCE, BlockPos.ORIGIN, 0xFFFFFF); + private static int getBlockColor(Block block) { + return BlockColors.create().getColor(block.getDefaultState(), EmptyRenderBlockView.INSTANCE, BlockPos.ORIGIN, 0xFFFFFF); } public static Map generateConstantTintColors() { Map resultColors = new HashMap<>(); - BlockColors blockColors = BlockColors.create(); resultColors.put(Blocks.BIRCH_LEAVES, FoliageColors.getBirchColor()); resultColors.put(Blocks.SPRUCE_LEAVES, FoliageColors.getSpruceColor()); - resultColors.put(Blocks.LILY_PAD, getBlockColor(Blocks.LILY_PAD, blockColors)); - resultColors.put(Blocks.ATTACHED_MELON_STEM, getBlockColor(Blocks.ATTACHED_MELON_STEM, blockColors)); - resultColors.put(Blocks.ATTACHED_PUMPKIN_STEM, getBlockColor(Blocks.ATTACHED_PUMPKIN_STEM, blockColors)); + resultColors.put(Blocks.LILY_PAD, getBlockColor(Blocks.LILY_PAD)); + resultColors.put(Blocks.ATTACHED_MELON_STEM, getBlockColor(Blocks.ATTACHED_MELON_STEM)); + resultColors.put(Blocks.ATTACHED_PUMPKIN_STEM, getBlockColor(Blocks.ATTACHED_PUMPKIN_STEM)); //not really constant, depend on the block age, but kinda have to be handled since textures are literally white without them - resultColors.put(Blocks.MELON_STEM, getBlockColor(Blocks.MELON_STEM, blockColors)); - resultColors.put(Blocks.PUMPKIN_STEM, getBlockColor(Blocks.PUMPKIN_STEM, blockColors)); + resultColors.put(Blocks.MELON_STEM, getBlockColor(Blocks.MELON_STEM)); + resultColors.put(Blocks.PUMPKIN_STEM, getBlockColor(Blocks.PUMPKIN_STEM)); return resultColors; } diff --git a/1.17/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java b/1.17/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java index 1f70c481..6435ddcb 100644 --- a/1.17/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java +++ b/1.17/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java @@ -44,24 +44,23 @@ public static Map generateRedstoneTintColors() { return resultColors; } - private static int getBlockColor(Block block, BlockColors blockColors) { - return blockColors.getColor(block.getDefaultState(), EmptyRenderBlockView.INSTANCE, BlockPos.ORIGIN, 0xFFFFFF); + private static int getBlockColor(Block block) { + return BlockColors.create().getColor(block.getDefaultState(), EmptyRenderBlockView.INSTANCE, BlockPos.ORIGIN, 0xFFFFFF); } public static Map generateConstantTintColors() { Map resultColors = new HashMap<>(); - BlockColors blockColors = BlockColors.create(); resultColors.put(Blocks.BIRCH_LEAVES, FoliageColors.getBirchColor()); resultColors.put(Blocks.SPRUCE_LEAVES, FoliageColors.getSpruceColor()); - resultColors.put(Blocks.LILY_PAD, getBlockColor(Blocks.LILY_PAD, blockColors)); - resultColors.put(Blocks.ATTACHED_MELON_STEM, getBlockColor(Blocks.ATTACHED_MELON_STEM, blockColors)); - resultColors.put(Blocks.ATTACHED_PUMPKIN_STEM, getBlockColor(Blocks.ATTACHED_PUMPKIN_STEM, blockColors)); + resultColors.put(Blocks.LILY_PAD, getBlockColor(Blocks.LILY_PAD)); + resultColors.put(Blocks.ATTACHED_MELON_STEM, getBlockColor(Blocks.ATTACHED_MELON_STEM)); + resultColors.put(Blocks.ATTACHED_PUMPKIN_STEM, getBlockColor(Blocks.ATTACHED_PUMPKIN_STEM)); //not really constant, depend on the block age, but kinda have to be handled since textures are literally white without them - resultColors.put(Blocks.MELON_STEM, getBlockColor(Blocks.MELON_STEM, blockColors)); - resultColors.put(Blocks.PUMPKIN_STEM, getBlockColor(Blocks.PUMPKIN_STEM, blockColors)); + resultColors.put(Blocks.MELON_STEM, getBlockColor(Blocks.MELON_STEM)); + resultColors.put(Blocks.PUMPKIN_STEM, getBlockColor(Blocks.PUMPKIN_STEM)); return resultColors; } diff --git a/1.18/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java b/1.18/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java index 1f70c481..6435ddcb 100644 --- a/1.18/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java +++ b/1.18/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java @@ -44,24 +44,23 @@ public static Map generateRedstoneTintColors() { return resultColors; } - private static int getBlockColor(Block block, BlockColors blockColors) { - return blockColors.getColor(block.getDefaultState(), EmptyRenderBlockView.INSTANCE, BlockPos.ORIGIN, 0xFFFFFF); + private static int getBlockColor(Block block) { + return BlockColors.create().getColor(block.getDefaultState(), EmptyRenderBlockView.INSTANCE, BlockPos.ORIGIN, 0xFFFFFF); } public static Map generateConstantTintColors() { Map resultColors = new HashMap<>(); - BlockColors blockColors = BlockColors.create(); resultColors.put(Blocks.BIRCH_LEAVES, FoliageColors.getBirchColor()); resultColors.put(Blocks.SPRUCE_LEAVES, FoliageColors.getSpruceColor()); - resultColors.put(Blocks.LILY_PAD, getBlockColor(Blocks.LILY_PAD, blockColors)); - resultColors.put(Blocks.ATTACHED_MELON_STEM, getBlockColor(Blocks.ATTACHED_MELON_STEM, blockColors)); - resultColors.put(Blocks.ATTACHED_PUMPKIN_STEM, getBlockColor(Blocks.ATTACHED_PUMPKIN_STEM, blockColors)); + resultColors.put(Blocks.LILY_PAD, getBlockColor(Blocks.LILY_PAD)); + resultColors.put(Blocks.ATTACHED_MELON_STEM, getBlockColor(Blocks.ATTACHED_MELON_STEM)); + resultColors.put(Blocks.ATTACHED_PUMPKIN_STEM, getBlockColor(Blocks.ATTACHED_PUMPKIN_STEM)); //not really constant, depend on the block age, but kinda have to be handled since textures are literally white without them - resultColors.put(Blocks.MELON_STEM, getBlockColor(Blocks.MELON_STEM, blockColors)); - resultColors.put(Blocks.PUMPKIN_STEM, getBlockColor(Blocks.PUMPKIN_STEM, blockColors)); + resultColors.put(Blocks.MELON_STEM, getBlockColor(Blocks.MELON_STEM)); + resultColors.put(Blocks.PUMPKIN_STEM, getBlockColor(Blocks.PUMPKIN_STEM)); return resultColors; } diff --git a/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java b/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java index 42a27c68..594a9e3e 100644 --- a/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java +++ b/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java @@ -2,11 +2,11 @@ import com.google.gson.JsonArray; import com.google.gson.JsonObject; -import dev.u9g.minecraftdatagenerator.mojangannoyances.BlockColors; import dev.u9g.minecraftdatagenerator.util.EmptyRenderBlockView; import net.minecraft.block.Block; import net.minecraft.block.Blocks; import net.minecraft.block.RedstoneWireBlock; +import net.minecraft.client.color.block.BlockColors; import net.minecraft.client.color.world.FoliageColors; import net.minecraft.util.Identifier; import net.minecraft.util.math.BlockPos; @@ -45,24 +45,23 @@ public static Map generateRedstoneTintColors() { return resultColors; } - private static int getBlockColor(Block block, BlockColors blockColors) { - return blockColors.getColor(block.getDefaultState(), EmptyRenderBlockView.INSTANCE, BlockPos.ORIGIN, 0xFFFFFF); + private static int getBlockColor(Block block) { + return BlockColors.create().getColor(block.getDefaultState(), EmptyRenderBlockView.INSTANCE, BlockPos.ORIGIN, 0xFFFFFF); } public static Map generateConstantTintColors() { Map resultColors = new HashMap<>(); - BlockColors blockColors = BlockColors.create(); resultColors.put(Blocks.BIRCH_LEAVES, FoliageColors.getBirchColor()); resultColors.put(Blocks.SPRUCE_LEAVES, FoliageColors.getSpruceColor()); - resultColors.put(Blocks.LILY_PAD, getBlockColor(Blocks.LILY_PAD, blockColors)); - resultColors.put(Blocks.ATTACHED_MELON_STEM, getBlockColor(Blocks.ATTACHED_MELON_STEM, blockColors)); - resultColors.put(Blocks.ATTACHED_PUMPKIN_STEM, getBlockColor(Blocks.ATTACHED_PUMPKIN_STEM, blockColors)); + resultColors.put(Blocks.LILY_PAD, getBlockColor(Blocks.LILY_PAD)); + resultColors.put(Blocks.ATTACHED_MELON_STEM, getBlockColor(Blocks.ATTACHED_MELON_STEM)); + resultColors.put(Blocks.ATTACHED_PUMPKIN_STEM, getBlockColor(Blocks.ATTACHED_PUMPKIN_STEM)); //not really constant, depend on the block age, but kinda have to be handled since textures are literally white without them - resultColors.put(Blocks.MELON_STEM, getBlockColor(Blocks.MELON_STEM, blockColors)); - resultColors.put(Blocks.PUMPKIN_STEM, getBlockColor(Blocks.PUMPKIN_STEM, blockColors)); + resultColors.put(Blocks.MELON_STEM, getBlockColor(Blocks.MELON_STEM)); + resultColors.put(Blocks.PUMPKIN_STEM, getBlockColor(Blocks.PUMPKIN_STEM)); return resultColors; } diff --git a/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/mojangannoyances/BiomeColors.java b/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/mojangannoyances/BiomeColors.java deleted file mode 100644 index ed4e9740..00000000 --- a/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/mojangannoyances/BiomeColors.java +++ /dev/null @@ -1,32 +0,0 @@ -package dev.u9g.minecraftdatagenerator.mojangannoyances; - -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.BlockRenderView; -import net.minecraft.world.biome.Biome; -import net.minecraft.world.level.ColorResolver; - -public class BiomeColors { - public static final ColorResolver GRASS_COLOR = Biome::getGrassColorAt; - public static final ColorResolver FOLIAGE_COLOR = (biome, x, z) -> biome.getFoliageColor(); - public static final ColorResolver WATER_COLOR = (biome, x, z) -> biome.getWaterColor(); - - public BiomeColors() { - } - - private static int getColor(BlockRenderView world, BlockPos pos, ColorResolver resolver) { - return world.getColor(pos, resolver); - } - - public static int getGrassColor(BlockRenderView world, BlockPos pos) { - return getColor(world, pos, GRASS_COLOR); - } - - public static int getFoliageColor(BlockRenderView world, BlockPos pos) { - return getColor(world, pos, FOLIAGE_COLOR); - } - - public static int getWaterColor(BlockRenderView world, BlockPos pos) { - return getColor(world, pos, WATER_COLOR); - } -} - diff --git a/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/mojangannoyances/BlockColorProvider.java b/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/mojangannoyances/BlockColorProvider.java deleted file mode 100644 index ac5dc572..00000000 --- a/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/mojangannoyances/BlockColorProvider.java +++ /dev/null @@ -1,11 +0,0 @@ -package dev.u9g.minecraftdatagenerator.mojangannoyances; - -import net.minecraft.block.BlockState; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.BlockRenderView; -import org.jetbrains.annotations.Nullable; - -public interface BlockColorProvider { - int getColor(BlockState state, @Nullable BlockRenderView world, @Nullable BlockPos pos, int tintIndex); -} - diff --git a/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/mojangannoyances/BlockColors.java b/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/mojangannoyances/BlockColors.java deleted file mode 100644 index e8430ebe..00000000 --- a/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/mojangannoyances/BlockColors.java +++ /dev/null @@ -1,93 +0,0 @@ -package dev.u9g.minecraftdatagenerator.mojangannoyances; - -import com.google.common.collect.ImmutableSet; -import com.google.common.collect.Maps; -import net.minecraft.block.*; -import net.minecraft.block.enums.DoubleBlockHalf; -import net.minecraft.client.color.world.FoliageColors; -import net.minecraft.client.color.world.GrassColors; -import net.minecraft.state.property.Property; -import net.minecraft.util.collection.IdList; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.registry.Registry; -import net.minecraft.world.BlockRenderView; -import net.minecraft.world.World; -import org.jetbrains.annotations.Nullable; - -import java.util.Map; -import java.util.Set; - -public class BlockColors { - private static final int NO_COLOR = -1; - private final IdList providers = new IdList<>(32); - private final Map>> properties = Maps.newHashMap(); - - public BlockColors() { - } - - public static BlockColors create() { - BlockColors blockColors = new BlockColors(); - blockColors.registerColorProvider((state, world, pos, tintIndex) -> world != null && pos != null ? BiomeColors.getGrassColor(world, state.get(TallPlantBlock.HALF) == DoubleBlockHalf.UPPER ? pos.down() : pos) : -1, Blocks.LARGE_FERN, Blocks.TALL_GRASS); - blockColors.registerColorProperty(TallPlantBlock.HALF, Blocks.LARGE_FERN, Blocks.TALL_GRASS); - blockColors.registerColorProvider((state, world, pos, tintIndex) -> world != null && pos != null ? BiomeColors.getGrassColor(world, pos) : GrassColors.getColor(0.5, 1.0), Blocks.GRASS_BLOCK, Blocks.FERN, Blocks.GRASS, Blocks.POTTED_FERN); - blockColors.registerColorProvider((state, world, pos, tintIndex) -> FoliageColors.getSpruceColor(), Blocks.SPRUCE_LEAVES); - blockColors.registerColorProvider((state, world, pos, tintIndex) -> FoliageColors.getBirchColor(), Blocks.BIRCH_LEAVES); - blockColors.registerColorProvider((state, world, pos, tintIndex) -> world != null && pos != null ? BiomeColors.getFoliageColor(world, pos) : FoliageColors.getDefaultColor(), Blocks.OAK_LEAVES, Blocks.JUNGLE_LEAVES, Blocks.ACACIA_LEAVES, Blocks.DARK_OAK_LEAVES, Blocks.VINE, Blocks.MANGROVE_LEAVES); - blockColors.registerColorProvider((state, world, pos, tintIndex) -> world != null && pos != null ? BiomeColors.getWaterColor(world, pos) : -1, Blocks.WATER, Blocks.BUBBLE_COLUMN, Blocks.WATER_CAULDRON); - blockColors.registerColorProvider((state, world, pos, tintIndex) -> RedstoneWireBlock.getWireColor(state.get(RedstoneWireBlock.POWER)), Blocks.REDSTONE_WIRE); - blockColors.registerColorProperty(RedstoneWireBlock.POWER, Blocks.REDSTONE_WIRE); - blockColors.registerColorProvider((state, world, pos, tintIndex) -> world != null && pos != null ? BiomeColors.getGrassColor(world, pos) : -1, Blocks.SUGAR_CANE); - blockColors.registerColorProvider((state, world, pos, tintIndex) -> 14731036, Blocks.ATTACHED_MELON_STEM, Blocks.ATTACHED_PUMPKIN_STEM); - blockColors.registerColorProvider((state, world, pos, tintIndex) -> { - int i = state.get(StemBlock.AGE); - int j = i * 32; - int k = 255 - i * 8; - int l = i * 4; - return j << 16 | k << 8 | l; - }, Blocks.MELON_STEM, Blocks.PUMPKIN_STEM); - blockColors.registerColorProperty(StemBlock.AGE, Blocks.MELON_STEM, Blocks.PUMPKIN_STEM); - blockColors.registerColorProvider((state, world, pos, tintIndex) -> world != null && pos != null ? 2129968 : 7455580, Blocks.LILY_PAD); - return blockColors; - } - - public int getParticleColor(BlockState state, World world, BlockPos pos) { - BlockColorProvider blockColorProvider = this.providers.get(Registry.BLOCK.getRawId(state.getBlock())); - if (blockColorProvider != null) { - return blockColorProvider.getColor(state, null, null, 0); - } else { - MapColor mapColor = state.getMapColor(world, pos); - return mapColor != null ? mapColor.color : -1; - } - } - - public int getColor(BlockState state, @Nullable BlockRenderView world, @Nullable BlockPos pos, int tintIndex) { - BlockColorProvider blockColorProvider = this.providers.get(Registry.BLOCK.getRawId(state.getBlock())); - return blockColorProvider == null ? -1 : blockColorProvider.getColor(state, world, pos, tintIndex); - } - - public void registerColorProvider(BlockColorProvider provider, Block... blocks) { - int var4 = blocks.length; - - for (Block block : blocks) { - this.providers.set(provider, Registry.BLOCK.getRawId(block)); - } - - } - - private void registerColorProperties(Set> properties, Block... blocks) { - int var4 = blocks.length; - - for (Block block : blocks) { - this.properties.put(block, properties); - } - - } - - private void registerColorProperty(Property property, Block... blocks) { - this.registerColorProperties(ImmutableSet.of(property), blocks); - } - - public Set> getProperties(Block block) { - return this.properties.getOrDefault(block, ImmutableSet.of()); - } -} diff --git a/1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java b/1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java index 42a27c68..594a9e3e 100644 --- a/1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java +++ b/1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java @@ -2,11 +2,11 @@ import com.google.gson.JsonArray; import com.google.gson.JsonObject; -import dev.u9g.minecraftdatagenerator.mojangannoyances.BlockColors; import dev.u9g.minecraftdatagenerator.util.EmptyRenderBlockView; import net.minecraft.block.Block; import net.minecraft.block.Blocks; import net.minecraft.block.RedstoneWireBlock; +import net.minecraft.client.color.block.BlockColors; import net.minecraft.client.color.world.FoliageColors; import net.minecraft.util.Identifier; import net.minecraft.util.math.BlockPos; @@ -45,24 +45,23 @@ public static Map generateRedstoneTintColors() { return resultColors; } - private static int getBlockColor(Block block, BlockColors blockColors) { - return blockColors.getColor(block.getDefaultState(), EmptyRenderBlockView.INSTANCE, BlockPos.ORIGIN, 0xFFFFFF); + private static int getBlockColor(Block block) { + return BlockColors.create().getColor(block.getDefaultState(), EmptyRenderBlockView.INSTANCE, BlockPos.ORIGIN, 0xFFFFFF); } public static Map generateConstantTintColors() { Map resultColors = new HashMap<>(); - BlockColors blockColors = BlockColors.create(); resultColors.put(Blocks.BIRCH_LEAVES, FoliageColors.getBirchColor()); resultColors.put(Blocks.SPRUCE_LEAVES, FoliageColors.getSpruceColor()); - resultColors.put(Blocks.LILY_PAD, getBlockColor(Blocks.LILY_PAD, blockColors)); - resultColors.put(Blocks.ATTACHED_MELON_STEM, getBlockColor(Blocks.ATTACHED_MELON_STEM, blockColors)); - resultColors.put(Blocks.ATTACHED_PUMPKIN_STEM, getBlockColor(Blocks.ATTACHED_PUMPKIN_STEM, blockColors)); + resultColors.put(Blocks.LILY_PAD, getBlockColor(Blocks.LILY_PAD)); + resultColors.put(Blocks.ATTACHED_MELON_STEM, getBlockColor(Blocks.ATTACHED_MELON_STEM)); + resultColors.put(Blocks.ATTACHED_PUMPKIN_STEM, getBlockColor(Blocks.ATTACHED_PUMPKIN_STEM)); //not really constant, depend on the block age, but kinda have to be handled since textures are literally white without them - resultColors.put(Blocks.MELON_STEM, getBlockColor(Blocks.MELON_STEM, blockColors)); - resultColors.put(Blocks.PUMPKIN_STEM, getBlockColor(Blocks.PUMPKIN_STEM, blockColors)); + resultColors.put(Blocks.MELON_STEM, getBlockColor(Blocks.MELON_STEM)); + resultColors.put(Blocks.PUMPKIN_STEM, getBlockColor(Blocks.PUMPKIN_STEM)); return resultColors; } diff --git a/1.19/src/main/java/dev/u9g/minecraftdatagenerator/mojangannoyances/BiomeColors.java b/1.19/src/main/java/dev/u9g/minecraftdatagenerator/mojangannoyances/BiomeColors.java deleted file mode 100644 index ed4e9740..00000000 --- a/1.19/src/main/java/dev/u9g/minecraftdatagenerator/mojangannoyances/BiomeColors.java +++ /dev/null @@ -1,32 +0,0 @@ -package dev.u9g.minecraftdatagenerator.mojangannoyances; - -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.BlockRenderView; -import net.minecraft.world.biome.Biome; -import net.minecraft.world.level.ColorResolver; - -public class BiomeColors { - public static final ColorResolver GRASS_COLOR = Biome::getGrassColorAt; - public static final ColorResolver FOLIAGE_COLOR = (biome, x, z) -> biome.getFoliageColor(); - public static final ColorResolver WATER_COLOR = (biome, x, z) -> biome.getWaterColor(); - - public BiomeColors() { - } - - private static int getColor(BlockRenderView world, BlockPos pos, ColorResolver resolver) { - return world.getColor(pos, resolver); - } - - public static int getGrassColor(BlockRenderView world, BlockPos pos) { - return getColor(world, pos, GRASS_COLOR); - } - - public static int getFoliageColor(BlockRenderView world, BlockPos pos) { - return getColor(world, pos, FOLIAGE_COLOR); - } - - public static int getWaterColor(BlockRenderView world, BlockPos pos) { - return getColor(world, pos, WATER_COLOR); - } -} - diff --git a/1.19/src/main/java/dev/u9g/minecraftdatagenerator/mojangannoyances/BlockColorProvider.java b/1.19/src/main/java/dev/u9g/minecraftdatagenerator/mojangannoyances/BlockColorProvider.java deleted file mode 100644 index ac5dc572..00000000 --- a/1.19/src/main/java/dev/u9g/minecraftdatagenerator/mojangannoyances/BlockColorProvider.java +++ /dev/null @@ -1,11 +0,0 @@ -package dev.u9g.minecraftdatagenerator.mojangannoyances; - -import net.minecraft.block.BlockState; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.BlockRenderView; -import org.jetbrains.annotations.Nullable; - -public interface BlockColorProvider { - int getColor(BlockState state, @Nullable BlockRenderView world, @Nullable BlockPos pos, int tintIndex); -} - diff --git a/1.19/src/main/java/dev/u9g/minecraftdatagenerator/mojangannoyances/BlockColors.java b/1.19/src/main/java/dev/u9g/minecraftdatagenerator/mojangannoyances/BlockColors.java deleted file mode 100644 index e8430ebe..00000000 --- a/1.19/src/main/java/dev/u9g/minecraftdatagenerator/mojangannoyances/BlockColors.java +++ /dev/null @@ -1,93 +0,0 @@ -package dev.u9g.minecraftdatagenerator.mojangannoyances; - -import com.google.common.collect.ImmutableSet; -import com.google.common.collect.Maps; -import net.minecraft.block.*; -import net.minecraft.block.enums.DoubleBlockHalf; -import net.minecraft.client.color.world.FoliageColors; -import net.minecraft.client.color.world.GrassColors; -import net.minecraft.state.property.Property; -import net.minecraft.util.collection.IdList; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.registry.Registry; -import net.minecraft.world.BlockRenderView; -import net.minecraft.world.World; -import org.jetbrains.annotations.Nullable; - -import java.util.Map; -import java.util.Set; - -public class BlockColors { - private static final int NO_COLOR = -1; - private final IdList providers = new IdList<>(32); - private final Map>> properties = Maps.newHashMap(); - - public BlockColors() { - } - - public static BlockColors create() { - BlockColors blockColors = new BlockColors(); - blockColors.registerColorProvider((state, world, pos, tintIndex) -> world != null && pos != null ? BiomeColors.getGrassColor(world, state.get(TallPlantBlock.HALF) == DoubleBlockHalf.UPPER ? pos.down() : pos) : -1, Blocks.LARGE_FERN, Blocks.TALL_GRASS); - blockColors.registerColorProperty(TallPlantBlock.HALF, Blocks.LARGE_FERN, Blocks.TALL_GRASS); - blockColors.registerColorProvider((state, world, pos, tintIndex) -> world != null && pos != null ? BiomeColors.getGrassColor(world, pos) : GrassColors.getColor(0.5, 1.0), Blocks.GRASS_BLOCK, Blocks.FERN, Blocks.GRASS, Blocks.POTTED_FERN); - blockColors.registerColorProvider((state, world, pos, tintIndex) -> FoliageColors.getSpruceColor(), Blocks.SPRUCE_LEAVES); - blockColors.registerColorProvider((state, world, pos, tintIndex) -> FoliageColors.getBirchColor(), Blocks.BIRCH_LEAVES); - blockColors.registerColorProvider((state, world, pos, tintIndex) -> world != null && pos != null ? BiomeColors.getFoliageColor(world, pos) : FoliageColors.getDefaultColor(), Blocks.OAK_LEAVES, Blocks.JUNGLE_LEAVES, Blocks.ACACIA_LEAVES, Blocks.DARK_OAK_LEAVES, Blocks.VINE, Blocks.MANGROVE_LEAVES); - blockColors.registerColorProvider((state, world, pos, tintIndex) -> world != null && pos != null ? BiomeColors.getWaterColor(world, pos) : -1, Blocks.WATER, Blocks.BUBBLE_COLUMN, Blocks.WATER_CAULDRON); - blockColors.registerColorProvider((state, world, pos, tintIndex) -> RedstoneWireBlock.getWireColor(state.get(RedstoneWireBlock.POWER)), Blocks.REDSTONE_WIRE); - blockColors.registerColorProperty(RedstoneWireBlock.POWER, Blocks.REDSTONE_WIRE); - blockColors.registerColorProvider((state, world, pos, tintIndex) -> world != null && pos != null ? BiomeColors.getGrassColor(world, pos) : -1, Blocks.SUGAR_CANE); - blockColors.registerColorProvider((state, world, pos, tintIndex) -> 14731036, Blocks.ATTACHED_MELON_STEM, Blocks.ATTACHED_PUMPKIN_STEM); - blockColors.registerColorProvider((state, world, pos, tintIndex) -> { - int i = state.get(StemBlock.AGE); - int j = i * 32; - int k = 255 - i * 8; - int l = i * 4; - return j << 16 | k << 8 | l; - }, Blocks.MELON_STEM, Blocks.PUMPKIN_STEM); - blockColors.registerColorProperty(StemBlock.AGE, Blocks.MELON_STEM, Blocks.PUMPKIN_STEM); - blockColors.registerColorProvider((state, world, pos, tintIndex) -> world != null && pos != null ? 2129968 : 7455580, Blocks.LILY_PAD); - return blockColors; - } - - public int getParticleColor(BlockState state, World world, BlockPos pos) { - BlockColorProvider blockColorProvider = this.providers.get(Registry.BLOCK.getRawId(state.getBlock())); - if (blockColorProvider != null) { - return blockColorProvider.getColor(state, null, null, 0); - } else { - MapColor mapColor = state.getMapColor(world, pos); - return mapColor != null ? mapColor.color : -1; - } - } - - public int getColor(BlockState state, @Nullable BlockRenderView world, @Nullable BlockPos pos, int tintIndex) { - BlockColorProvider blockColorProvider = this.providers.get(Registry.BLOCK.getRawId(state.getBlock())); - return blockColorProvider == null ? -1 : blockColorProvider.getColor(state, world, pos, tintIndex); - } - - public void registerColorProvider(BlockColorProvider provider, Block... blocks) { - int var4 = blocks.length; - - for (Block block : blocks) { - this.providers.set(provider, Registry.BLOCK.getRawId(block)); - } - - } - - private void registerColorProperties(Set> properties, Block... blocks) { - int var4 = blocks.length; - - for (Block block : blocks) { - this.properties.put(block, properties); - } - - } - - private void registerColorProperty(Property property, Block... blocks) { - this.registerColorProperties(ImmutableSet.of(property), blocks); - } - - public Set> getProperties(Block block) { - return this.properties.getOrDefault(block, ImmutableSet.of()); - } -} diff --git a/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java b/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java index e9e50b9d..5873a305 100644 --- a/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java +++ b/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java @@ -2,12 +2,12 @@ import com.google.gson.JsonArray; import com.google.gson.JsonObject; -import dev.u9g.minecraftdatagenerator.mojangannoyances.BlockColors; import dev.u9g.minecraftdatagenerator.util.DGU; import dev.u9g.minecraftdatagenerator.util.EmptyRenderBlockView; import net.minecraft.block.Block; import net.minecraft.block.Blocks; import net.minecraft.block.RedstoneWireBlock; +import net.minecraft.client.color.block.BlockColors; import net.minecraft.client.color.world.FoliageColors; import net.minecraft.registry.DynamicRegistryManager; import net.minecraft.registry.Registry; @@ -47,24 +47,23 @@ public static Map generateRedstoneTintColors() { return resultColors; } - private static int getBlockColor(Block block, BlockColors blockColors) { - return blockColors.getColor(block.getDefaultState(), EmptyRenderBlockView.INSTANCE, BlockPos.ORIGIN, 0xFFFFFF); + private static int getBlockColor(Block block) { + return BlockColors.create().getColor(block.getDefaultState(), EmptyRenderBlockView.INSTANCE, BlockPos.ORIGIN, 0xFFFFFF); } public static Map generateConstantTintColors() { Map resultColors = new HashMap<>(); - BlockColors blockColors = BlockColors.create(); resultColors.put(Blocks.BIRCH_LEAVES, FoliageColors.getBirchColor()); resultColors.put(Blocks.SPRUCE_LEAVES, FoliageColors.getSpruceColor()); - resultColors.put(Blocks.LILY_PAD, getBlockColor(Blocks.LILY_PAD, blockColors)); - resultColors.put(Blocks.ATTACHED_MELON_STEM, getBlockColor(Blocks.ATTACHED_MELON_STEM, blockColors)); - resultColors.put(Blocks.ATTACHED_PUMPKIN_STEM, getBlockColor(Blocks.ATTACHED_PUMPKIN_STEM, blockColors)); + resultColors.put(Blocks.LILY_PAD, getBlockColor(Blocks.LILY_PAD)); + resultColors.put(Blocks.ATTACHED_MELON_STEM, getBlockColor(Blocks.ATTACHED_MELON_STEM)); + resultColors.put(Blocks.ATTACHED_PUMPKIN_STEM, getBlockColor(Blocks.ATTACHED_PUMPKIN_STEM)); //not really constant, depend on the block age, but kinda have to be handled since textures are literally white without them - resultColors.put(Blocks.MELON_STEM, getBlockColor(Blocks.MELON_STEM, blockColors)); - resultColors.put(Blocks.PUMPKIN_STEM, getBlockColor(Blocks.PUMPKIN_STEM, blockColors)); + resultColors.put(Blocks.MELON_STEM, getBlockColor(Blocks.MELON_STEM)); + resultColors.put(Blocks.PUMPKIN_STEM, getBlockColor(Blocks.PUMPKIN_STEM)); return resultColors; } diff --git a/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/mojangannoyances/BiomeColors.java b/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/mojangannoyances/BiomeColors.java deleted file mode 100644 index b5fdebe1..00000000 --- a/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/mojangannoyances/BiomeColors.java +++ /dev/null @@ -1,32 +0,0 @@ -package dev.u9g.minecraftdatagenerator.mojangannoyances; - -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.BlockRenderView; -import net.minecraft.world.biome.Biome; -import net.minecraft.world.biome.ColorResolver; - -public class BiomeColors { - public static final ColorResolver GRASS_COLOR = Biome::getGrassColorAt; - public static final ColorResolver FOLIAGE_COLOR = (biome, x, z) -> biome.getFoliageColor(); - public static final ColorResolver WATER_COLOR = (biome, x, z) -> biome.getWaterColor(); - - public BiomeColors() { - } - - private static int getColor(BlockRenderView world, BlockPos pos, ColorResolver resolver) { - return world.getColor(pos, resolver); - } - - public static int getGrassColor(BlockRenderView world, BlockPos pos) { - return getColor(world, pos, GRASS_COLOR); - } - - public static int getFoliageColor(BlockRenderView world, BlockPos pos) { - return getColor(world, pos, FOLIAGE_COLOR); - } - - public static int getWaterColor(BlockRenderView world, BlockPos pos) { - return getColor(world, pos, WATER_COLOR); - } -} - diff --git a/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/mojangannoyances/BlockColorProvider.java b/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/mojangannoyances/BlockColorProvider.java deleted file mode 100644 index ac5dc572..00000000 --- a/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/mojangannoyances/BlockColorProvider.java +++ /dev/null @@ -1,11 +0,0 @@ -package dev.u9g.minecraftdatagenerator.mojangannoyances; - -import net.minecraft.block.BlockState; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.BlockRenderView; -import org.jetbrains.annotations.Nullable; - -public interface BlockColorProvider { - int getColor(BlockState state, @Nullable BlockRenderView world, @Nullable BlockPos pos, int tintIndex); -} - diff --git a/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/mojangannoyances/BlockColors.java b/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/mojangannoyances/BlockColors.java deleted file mode 100644 index e48e98a8..00000000 --- a/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/mojangannoyances/BlockColors.java +++ /dev/null @@ -1,94 +0,0 @@ -package dev.u9g.minecraftdatagenerator.mojangannoyances; - -import com.google.common.collect.ImmutableSet; -import com.google.common.collect.Maps; -import dev.u9g.minecraftdatagenerator.util.DGU; -import net.minecraft.block.*; -import net.minecraft.block.enums.DoubleBlockHalf; -import net.minecraft.client.color.world.FoliageColors; -import net.minecraft.client.color.world.GrassColors; -import net.minecraft.registry.RegistryKeys; -import net.minecraft.state.property.Property; -import net.minecraft.util.collection.IdList; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.BlockRenderView; -import net.minecraft.world.World; -import org.jetbrains.annotations.Nullable; - -import java.util.Map; -import java.util.Set; - -public class BlockColors { - private static final int NO_COLOR = -1; - private final IdList providers = new IdList<>(32); - private final Map>> properties = Maps.newHashMap(); - - public BlockColors() { - } - - public static BlockColors create() { - BlockColors blockColors = new BlockColors(); - blockColors.registerColorProvider((state, world, pos, tintIndex) -> world != null && pos != null ? BiomeColors.getGrassColor(world, state.get(TallPlantBlock.HALF) == DoubleBlockHalf.UPPER ? pos.down() : pos) : -1, Blocks.LARGE_FERN, Blocks.TALL_GRASS); - blockColors.registerColorProperty(TallPlantBlock.HALF, Blocks.LARGE_FERN, Blocks.TALL_GRASS); - blockColors.registerColorProvider((state, world, pos, tintIndex) -> world != null && pos != null ? BiomeColors.getGrassColor(world, pos) : GrassColors.getColor(0.5, 1.0), Blocks.GRASS_BLOCK, Blocks.FERN, Blocks.SHORT_GRASS, Blocks.POTTED_FERN); - blockColors.registerColorProvider((state, world, pos, tintIndex) -> FoliageColors.getSpruceColor(), Blocks.SPRUCE_LEAVES); - blockColors.registerColorProvider((state, world, pos, tintIndex) -> FoliageColors.getBirchColor(), Blocks.BIRCH_LEAVES); - blockColors.registerColorProvider((state, world, pos, tintIndex) -> world != null && pos != null ? BiomeColors.getFoliageColor(world, pos) : FoliageColors.getDefaultColor(), Blocks.OAK_LEAVES, Blocks.JUNGLE_LEAVES, Blocks.ACACIA_LEAVES, Blocks.DARK_OAK_LEAVES, Blocks.VINE, Blocks.MANGROVE_LEAVES); - blockColors.registerColorProvider((state, world, pos, tintIndex) -> world != null && pos != null ? BiomeColors.getWaterColor(world, pos) : -1, Blocks.WATER, Blocks.BUBBLE_COLUMN, Blocks.WATER_CAULDRON); - blockColors.registerColorProvider((state, world, pos, tintIndex) -> RedstoneWireBlock.getWireColor(state.get(RedstoneWireBlock.POWER)), Blocks.REDSTONE_WIRE); - blockColors.registerColorProperty(RedstoneWireBlock.POWER, Blocks.REDSTONE_WIRE); - blockColors.registerColorProvider((state, world, pos, tintIndex) -> world != null && pos != null ? BiomeColors.getGrassColor(world, pos) : -1, Blocks.SUGAR_CANE); - blockColors.registerColorProvider((state, world, pos, tintIndex) -> 14731036, Blocks.ATTACHED_MELON_STEM, Blocks.ATTACHED_PUMPKIN_STEM); - blockColors.registerColorProvider((state, world, pos, tintIndex) -> { - int i = state.get(StemBlock.AGE); - int j = i * 32; - int k = 255 - i * 8; - int l = i * 4; - return j << 16 | k << 8 | l; - }, Blocks.MELON_STEM, Blocks.PUMPKIN_STEM); - blockColors.registerColorProperty(StemBlock.AGE, Blocks.MELON_STEM, Blocks.PUMPKIN_STEM); - blockColors.registerColorProvider((state, world, pos, tintIndex) -> world != null && pos != null ? 2129968 : 7455580, Blocks.LILY_PAD); - return blockColors; - } - - public int getParticleColor(BlockState state, World world, BlockPos pos) { - BlockColorProvider blockColorProvider = this.providers.get(DGU.getWorld().getRegistryManager().get(RegistryKeys.BLOCK).getRawId(state.getBlock())); - if (blockColorProvider != null) { - return blockColorProvider.getColor(state, null, null, 0); - } else { - MapColor mapColor = state.getMapColor(world, pos); - return mapColor != null ? mapColor.color : -1; - } - } - - public int getColor(BlockState state, @Nullable BlockRenderView world, @Nullable BlockPos pos, int tintIndex) { - BlockColorProvider blockColorProvider = this.providers.get(DGU.getWorld().getRegistryManager().get(RegistryKeys.BLOCK).getRawId(state.getBlock())); - return blockColorProvider == null ? -1 : blockColorProvider.getColor(state, world, pos, tintIndex); - } - - public void registerColorProvider(BlockColorProvider provider, Block... blocks) { - int var4 = blocks.length; - - for (Block block : blocks) { - this.providers.set(provider, DGU.getWorld().getRegistryManager().get(RegistryKeys.BLOCK).getRawId(block)); - } - - } - - private void registerColorProperties(Set> properties, Block... blocks) { - int var4 = blocks.length; - - for (Block block : blocks) { - this.properties.put(block, properties); - } - - } - - private void registerColorProperty(Property property, Block... blocks) { - this.registerColorProperties(ImmutableSet.of(property), blocks); - } - - public Set> getProperties(Block block) { - return this.properties.getOrDefault(block, ImmutableSet.of()); - } -} diff --git a/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java b/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java index e9e50b9d..5873a305 100644 --- a/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java +++ b/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java @@ -2,12 +2,12 @@ import com.google.gson.JsonArray; import com.google.gson.JsonObject; -import dev.u9g.minecraftdatagenerator.mojangannoyances.BlockColors; import dev.u9g.minecraftdatagenerator.util.DGU; import dev.u9g.minecraftdatagenerator.util.EmptyRenderBlockView; import net.minecraft.block.Block; import net.minecraft.block.Blocks; import net.minecraft.block.RedstoneWireBlock; +import net.minecraft.client.color.block.BlockColors; import net.minecraft.client.color.world.FoliageColors; import net.minecraft.registry.DynamicRegistryManager; import net.minecraft.registry.Registry; @@ -47,24 +47,23 @@ public static Map generateRedstoneTintColors() { return resultColors; } - private static int getBlockColor(Block block, BlockColors blockColors) { - return blockColors.getColor(block.getDefaultState(), EmptyRenderBlockView.INSTANCE, BlockPos.ORIGIN, 0xFFFFFF); + private static int getBlockColor(Block block) { + return BlockColors.create().getColor(block.getDefaultState(), EmptyRenderBlockView.INSTANCE, BlockPos.ORIGIN, 0xFFFFFF); } public static Map generateConstantTintColors() { Map resultColors = new HashMap<>(); - BlockColors blockColors = BlockColors.create(); resultColors.put(Blocks.BIRCH_LEAVES, FoliageColors.getBirchColor()); resultColors.put(Blocks.SPRUCE_LEAVES, FoliageColors.getSpruceColor()); - resultColors.put(Blocks.LILY_PAD, getBlockColor(Blocks.LILY_PAD, blockColors)); - resultColors.put(Blocks.ATTACHED_MELON_STEM, getBlockColor(Blocks.ATTACHED_MELON_STEM, blockColors)); - resultColors.put(Blocks.ATTACHED_PUMPKIN_STEM, getBlockColor(Blocks.ATTACHED_PUMPKIN_STEM, blockColors)); + resultColors.put(Blocks.LILY_PAD, getBlockColor(Blocks.LILY_PAD)); + resultColors.put(Blocks.ATTACHED_MELON_STEM, getBlockColor(Blocks.ATTACHED_MELON_STEM)); + resultColors.put(Blocks.ATTACHED_PUMPKIN_STEM, getBlockColor(Blocks.ATTACHED_PUMPKIN_STEM)); //not really constant, depend on the block age, but kinda have to be handled since textures are literally white without them - resultColors.put(Blocks.MELON_STEM, getBlockColor(Blocks.MELON_STEM, blockColors)); - resultColors.put(Blocks.PUMPKIN_STEM, getBlockColor(Blocks.PUMPKIN_STEM, blockColors)); + resultColors.put(Blocks.MELON_STEM, getBlockColor(Blocks.MELON_STEM)); + resultColors.put(Blocks.PUMPKIN_STEM, getBlockColor(Blocks.PUMPKIN_STEM)); return resultColors; } diff --git a/1.20/src/main/java/dev/u9g/minecraftdatagenerator/mojangannoyances/BiomeColors.java b/1.20/src/main/java/dev/u9g/minecraftdatagenerator/mojangannoyances/BiomeColors.java deleted file mode 100644 index b5fdebe1..00000000 --- a/1.20/src/main/java/dev/u9g/minecraftdatagenerator/mojangannoyances/BiomeColors.java +++ /dev/null @@ -1,32 +0,0 @@ -package dev.u9g.minecraftdatagenerator.mojangannoyances; - -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.BlockRenderView; -import net.minecraft.world.biome.Biome; -import net.minecraft.world.biome.ColorResolver; - -public class BiomeColors { - public static final ColorResolver GRASS_COLOR = Biome::getGrassColorAt; - public static final ColorResolver FOLIAGE_COLOR = (biome, x, z) -> biome.getFoliageColor(); - public static final ColorResolver WATER_COLOR = (biome, x, z) -> biome.getWaterColor(); - - public BiomeColors() { - } - - private static int getColor(BlockRenderView world, BlockPos pos, ColorResolver resolver) { - return world.getColor(pos, resolver); - } - - public static int getGrassColor(BlockRenderView world, BlockPos pos) { - return getColor(world, pos, GRASS_COLOR); - } - - public static int getFoliageColor(BlockRenderView world, BlockPos pos) { - return getColor(world, pos, FOLIAGE_COLOR); - } - - public static int getWaterColor(BlockRenderView world, BlockPos pos) { - return getColor(world, pos, WATER_COLOR); - } -} - diff --git a/1.20/src/main/java/dev/u9g/minecraftdatagenerator/mojangannoyances/BlockColorProvider.java b/1.20/src/main/java/dev/u9g/minecraftdatagenerator/mojangannoyances/BlockColorProvider.java deleted file mode 100644 index ac5dc572..00000000 --- a/1.20/src/main/java/dev/u9g/minecraftdatagenerator/mojangannoyances/BlockColorProvider.java +++ /dev/null @@ -1,11 +0,0 @@ -package dev.u9g.minecraftdatagenerator.mojangannoyances; - -import net.minecraft.block.BlockState; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.BlockRenderView; -import org.jetbrains.annotations.Nullable; - -public interface BlockColorProvider { - int getColor(BlockState state, @Nullable BlockRenderView world, @Nullable BlockPos pos, int tintIndex); -} - diff --git a/1.20/src/main/java/dev/u9g/minecraftdatagenerator/mojangannoyances/BlockColors.java b/1.20/src/main/java/dev/u9g/minecraftdatagenerator/mojangannoyances/BlockColors.java deleted file mode 100644 index a0a3bdf8..00000000 --- a/1.20/src/main/java/dev/u9g/minecraftdatagenerator/mojangannoyances/BlockColors.java +++ /dev/null @@ -1,94 +0,0 @@ -package dev.u9g.minecraftdatagenerator.mojangannoyances; - -import com.google.common.collect.ImmutableSet; -import com.google.common.collect.Maps; -import dev.u9g.minecraftdatagenerator.util.DGU; -import net.minecraft.block.*; -import net.minecraft.block.enums.DoubleBlockHalf; -import net.minecraft.client.color.world.FoliageColors; -import net.minecraft.client.color.world.GrassColors; -import net.minecraft.registry.RegistryKeys; -import net.minecraft.state.property.Property; -import net.minecraft.util.collection.IdList; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.BlockRenderView; -import net.minecraft.world.World; -import org.jetbrains.annotations.Nullable; - -import java.util.Map; -import java.util.Set; - -public class BlockColors { - private static final int NO_COLOR = -1; - private final IdList providers = new IdList<>(32); - private final Map>> properties = Maps.newHashMap(); - - public BlockColors() { - } - - public static BlockColors create() { - BlockColors blockColors = new BlockColors(); - blockColors.registerColorProvider((state, world, pos, tintIndex) -> world != null && pos != null ? BiomeColors.getGrassColor(world, state.get(TallPlantBlock.HALF) == DoubleBlockHalf.UPPER ? pos.down() : pos) : -1, Blocks.LARGE_FERN, Blocks.TALL_GRASS); - blockColors.registerColorProperty(TallPlantBlock.HALF, Blocks.LARGE_FERN, Blocks.TALL_GRASS); - blockColors.registerColorProvider((state, world, pos, tintIndex) -> world != null && pos != null ? BiomeColors.getGrassColor(world, pos) : GrassColors.getColor(0.5, 1.0), Blocks.GRASS_BLOCK, Blocks.FERN, Blocks.GRASS, Blocks.POTTED_FERN); - blockColors.registerColorProvider((state, world, pos, tintIndex) -> FoliageColors.getSpruceColor(), Blocks.SPRUCE_LEAVES); - blockColors.registerColorProvider((state, world, pos, tintIndex) -> FoliageColors.getBirchColor(), Blocks.BIRCH_LEAVES); - blockColors.registerColorProvider((state, world, pos, tintIndex) -> world != null && pos != null ? BiomeColors.getFoliageColor(world, pos) : FoliageColors.getDefaultColor(), Blocks.OAK_LEAVES, Blocks.JUNGLE_LEAVES, Blocks.ACACIA_LEAVES, Blocks.DARK_OAK_LEAVES, Blocks.VINE, Blocks.MANGROVE_LEAVES); - blockColors.registerColorProvider((state, world, pos, tintIndex) -> world != null && pos != null ? BiomeColors.getWaterColor(world, pos) : -1, Blocks.WATER, Blocks.BUBBLE_COLUMN, Blocks.WATER_CAULDRON); - blockColors.registerColorProvider((state, world, pos, tintIndex) -> RedstoneWireBlock.getWireColor(state.get(RedstoneWireBlock.POWER)), Blocks.REDSTONE_WIRE); - blockColors.registerColorProperty(RedstoneWireBlock.POWER, Blocks.REDSTONE_WIRE); - blockColors.registerColorProvider((state, world, pos, tintIndex) -> world != null && pos != null ? BiomeColors.getGrassColor(world, pos) : -1, Blocks.SUGAR_CANE); - blockColors.registerColorProvider((state, world, pos, tintIndex) -> 14731036, Blocks.ATTACHED_MELON_STEM, Blocks.ATTACHED_PUMPKIN_STEM); - blockColors.registerColorProvider((state, world, pos, tintIndex) -> { - int i = state.get(StemBlock.AGE); - int j = i * 32; - int k = 255 - i * 8; - int l = i * 4; - return j << 16 | k << 8 | l; - }, Blocks.MELON_STEM, Blocks.PUMPKIN_STEM); - blockColors.registerColorProperty(StemBlock.AGE, Blocks.MELON_STEM, Blocks.PUMPKIN_STEM); - blockColors.registerColorProvider((state, world, pos, tintIndex) -> world != null && pos != null ? 2129968 : 7455580, Blocks.LILY_PAD); - return blockColors; - } - - public int getParticleColor(BlockState state, World world, BlockPos pos) { - BlockColorProvider blockColorProvider = this.providers.get(DGU.getWorld().getRegistryManager().get(RegistryKeys.BLOCK).getRawId(state.getBlock())); - if (blockColorProvider != null) { - return blockColorProvider.getColor(state, null, null, 0); - } else { - MapColor mapColor = state.getMapColor(world, pos); - return mapColor != null ? mapColor.color : -1; - } - } - - public int getColor(BlockState state, @Nullable BlockRenderView world, @Nullable BlockPos pos, int tintIndex) { - BlockColorProvider blockColorProvider = this.providers.get(DGU.getWorld().getRegistryManager().get(RegistryKeys.BLOCK).getRawId(state.getBlock())); - return blockColorProvider == null ? -1 : blockColorProvider.getColor(state, world, pos, tintIndex); - } - - public void registerColorProvider(BlockColorProvider provider, Block... blocks) { - int var4 = blocks.length; - - for (Block block : blocks) { - this.providers.set(provider, DGU.getWorld().getRegistryManager().get(RegistryKeys.BLOCK).getRawId(block)); - } - - } - - private void registerColorProperties(Set> properties, Block... blocks) { - int var4 = blocks.length; - - for (Block block : blocks) { - this.properties.put(block, properties); - } - - } - - private void registerColorProperty(Property property, Block... blocks) { - this.registerColorProperties(ImmutableSet.of(property), blocks); - } - - public Set> getProperties(Block block) { - return this.properties.getOrDefault(block, ImmutableSet.of()); - } -} diff --git a/1.7/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java b/1.7/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java index f0895c1b..995275fd 100644 --- a/1.7/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java +++ b/1.7/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java @@ -41,8 +41,8 @@ public static Map generateConstantTintColors() { resultColors.put(Registries.BLOCKS.get("waterlily"), Blocks.LILY_PAD.getColor()); // FIXME: ? - // resultColors.put(Blocks.ATTACHED_MELON_STEM, getBlockColor(Blocks.ATTACHED_MELON_STEM, blockColors)); - // resultColors.put(Blocks.ATTACHED_PUMPKIN_STEM, getBlockColor(Blocks.ATTACHED_PUMPKIN_STEM, blockColors)); + // resultColors.put(Blocks.ATTACHED_MELON_STEM, getBlockColor(Blocks.ATTACHED_MELON_STEM)); + // resultColors.put(Blocks.ATTACHED_PUMPKIN_STEM, getBlockColor(Blocks.ATTACHED_PUMPKIN_STEM)); //not really constant, depend on the block age, but kinda have to be handled since textures are literally white without them resultColors.put(Registries.BLOCKS.get("melon_stem"), Blocks.MELON_STEM.getColor()); diff --git a/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java b/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java index 9dda8f16..1c21ddb7 100644 --- a/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java +++ b/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java @@ -62,8 +62,8 @@ public static Map generateConstantTintColors() { resultColors.put(Blocks.LILY_PAD, Blocks.LILY_PAD.getColor()); // FIXME: ? - // resultColors.put(Blocks.ATTACHED_MELON_STEM, getBlockColor(Blocks.ATTACHED_MELON_STEM, blockColors)); - // resultColors.put(Blocks.ATTACHED_PUMPKIN_STEM, getBlockColor(Blocks.ATTACHED_PUMPKIN_STEM, blockColors)); + // resultColors.put(Blocks.ATTACHED_MELON_STEM, getBlockColor(Blocks.ATTACHED_MELON_STEM)); + // resultColors.put(Blocks.ATTACHED_PUMPKIN_STEM, getBlockColor(Blocks.ATTACHED_PUMPKIN_STEM)); //not really constant, depend on the block age, but kinda have to be handled since textures are literally white without them resultColors.put(Blocks.MELON_STEM, Blocks.MELON_STEM.getColor()); diff --git a/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java b/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java index 35c25173..c264f607 100644 --- a/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java +++ b/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java @@ -60,8 +60,8 @@ public static Map generateConstantTintColors() { resultColors.put(Blocks.LILY_PAD, getBlockColor(Blocks.LILY_PAD)); // FIXME: ? - // resultColors.put(Blocks.ATTACHED_MELON_STEM, getBlockColor(Blocks.ATTACHED_MELON_STEM, blockColors)); - // resultColors.put(Blocks.ATTACHED_PUMPKIN_STEM, getBlockColor(Blocks.ATTACHED_PUMPKIN_STEM, blockColors)); + // resultColors.put(Blocks.ATTACHED_MELON_STEM, getBlockColor(Blocks.ATTACHED_MELON_STEM)); + // resultColors.put(Blocks.ATTACHED_PUMPKIN_STEM, getBlockColor(Blocks.ATTACHED_PUMPKIN_STEM)); //not really constant, depend on the block age, but kinda have to be handled since textures are literally white without them resultColors.put(Blocks.MELON_STEM, getBlockColor(Blocks.MELON_STEM)); diff --git a/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java b/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java index 3f4c3941..c57750c9 100644 --- a/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java +++ b/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java @@ -44,24 +44,23 @@ public static Map generateRedstoneTintColors() { return resultColors; } - private static int getBlockColor(Block block, BlockColors blockColors) { - return blockColors.getColor(block.getDefaultState(), EmptyRenderBlockView.INSTANCE, BlockPos.ORIGIN, 0xFFFFFF); + private static int getBlockColor(Block block) { + return BlockColors.create().getColor(block.getDefaultState(), EmptyRenderBlockView.INSTANCE, BlockPos.ORIGIN, 0xFFFFFF); } public static Map generateConstantTintColors() { Map resultColors = new HashMap<>(); - BlockColors blockColors = BlockColors.create(); resultColors.put(Blocks.BIRCH_LEAVES, FoliageColors.getBirchColor()); resultColors.put(Blocks.SPRUCE_LEAVES, FoliageColors.getSpruceColor()); - resultColors.put(Blocks.LILY_PAD, getBlockColor(Blocks.LILY_PAD, blockColors)); - resultColors.put(Blocks.ATTACHED_MELON_STEM, getBlockColor(Blocks.ATTACHED_MELON_STEM, blockColors)); - resultColors.put(Blocks.ATTACHED_PUMPKIN_STEM, getBlockColor(Blocks.ATTACHED_PUMPKIN_STEM, blockColors)); + resultColors.put(Blocks.LILY_PAD, getBlockColor(Blocks.LILY_PAD)); + resultColors.put(Blocks.ATTACHED_MELON_STEM, getBlockColor(Blocks.ATTACHED_MELON_STEM)); + resultColors.put(Blocks.ATTACHED_PUMPKIN_STEM, getBlockColor(Blocks.ATTACHED_PUMPKIN_STEM)); //not really constant, depend on the block age, but kinda have to be handled since textures are literally white without them - resultColors.put(Blocks.MELON_STEM, getBlockColor(Blocks.MELON_STEM, blockColors)); - resultColors.put(Blocks.PUMPKIN_STEM, getBlockColor(Blocks.PUMPKIN_STEM, blockColors)); + resultColors.put(Blocks.MELON_STEM, getBlockColor(Blocks.MELON_STEM)); + resultColors.put(Blocks.PUMPKIN_STEM, getBlockColor(Blocks.PUMPKIN_STEM)); return resultColors; } From 17e631418bcd851cf12164d7741b22930e56b67a Mon Sep 17 00:00:00 2001 From: AlexProgrammerDE <40795980+AlexProgrammerDE@users.noreply.github.com> Date: Thu, 2 May 2024 07:24:35 +0200 Subject: [PATCH 23/38] Use newer java methods --- .../generators/BlockCollisionShapesDataGenerator.java | 2 +- .../generators/BlockCollisionShapesDataGenerator.java | 2 +- .../generators/BlockCollisionShapesDataGenerator.java | 2 +- .../generators/BlockCollisionShapesDataGenerator.java | 2 +- .../generators/BlocksDataGenerator.java | 4 ++-- .../generators/BlockCollisionShapesDataGenerator.java | 2 +- .../generators/BlocksDataGenerator.java | 4 ++-- .../generators/BlockCollisionShapesDataGenerator.java | 2 +- .../generators/BlocksDataGenerator.java | 4 ++-- .../generators/BlockCollisionShapesDataGenerator.java | 2 +- .../generators/BlocksDataGenerator.java | 4 ++-- .../generators/BlockCollisionShapesDataGenerator.java | 2 +- .../generators/BlocksDataGenerator.java | 10 +++++----- .../generators/BlockCollisionShapesDataGenerator.java | 2 +- .../generators/BlocksDataGenerator.java | 10 +++++----- .../generators/BlockCollisionShapesDataGenerator.java | 2 +- .../generators/BlocksDataGenerator.java | 10 +++++----- .../generators/BlockCollisionShapesDataGenerator.java | 2 +- .../generators/BlocksDataGenerator.java | 10 +++++----- .../generators/BlockCollisionShapesDataGenerator.java | 2 +- .../generators/BlocksDataGenerator.java | 10 +++++----- .../generators/BlockCollisionShapesDataGenerator.java | 2 +- .../generators/BlocksDataGenerator.java | 10 +++++----- .../generators/BlockCollisionShapesDataGenerator.java | 2 +- .../generators/BlockCollisionShapesDataGenerator.java | 2 +- .../generators/BlockCollisionShapesDataGenerator.java | 2 +- .../generators/BlockCollisionShapesDataGenerator.java | 2 +- .../generators/BlocksDataGenerator.java | 10 +++++----- 28 files changed, 60 insertions(+), 60 deletions(-) diff --git a/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java b/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java index 357bab59..02fd69a6 100644 --- a/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java +++ b/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java @@ -79,7 +79,7 @@ public Object addShapesFrom(Block block) { } } if (indexesOfBoxesInTheShapesCache.stream().distinct().count() < 2) { - return indexesOfBoxesInTheShapesCache.get(0); + return indexesOfBoxesInTheShapesCache.getFirst(); } else { JsonArray shapeIndexes = new JsonArray(); indexesOfBoxesInTheShapesCache.forEach(shapeIndex -> shapeIndexes.add(new JsonPrimitive(shapeIndex))); diff --git a/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java b/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java index d61e8b4c..df1d5540 100644 --- a/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java +++ b/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java @@ -79,7 +79,7 @@ public Object addShapesFrom(Block block) { } } if (indexesOfBoxesInTheShapesCache.stream().distinct().count() < 2) { - return indexesOfBoxesInTheShapesCache.get(0); + return indexesOfBoxesInTheShapesCache.getFirst(); } else { JsonArray shapeIndexes = new JsonArray(); indexesOfBoxesInTheShapesCache.forEach(shapeIndex -> shapeIndexes.add(new JsonPrimitive(shapeIndex))); diff --git a/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java b/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java index eb69bf27..ba757ead 100644 --- a/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java +++ b/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java @@ -78,7 +78,7 @@ public Object addShapesFrom(Block block) { } } if (indexesOfBoxesInTheShapesCache.stream().distinct().count() < 2) { - return indexesOfBoxesInTheShapesCache.get(0); + return indexesOfBoxesInTheShapesCache.getFirst(); } else { JsonArray shapeIndexes = new JsonArray(); indexesOfBoxesInTheShapesCache.forEach(shapeIndexes::add); diff --git a/1.13/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java b/1.13/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java index 573ffce4..4aa59324 100644 --- a/1.13/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java +++ b/1.13/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java @@ -68,7 +68,7 @@ public JsonObject dumpBlockShapeIndices(Registry blockRegistry) { long distinctShapesCount = blockCollisions.stream().distinct().count(); JsonElement blockCollision; if (distinctShapesCount == 1L) { - blockCollision = new JsonPrimitive(blockCollisions.get(0)); + blockCollision = new JsonPrimitive(blockCollisions.getFirst()); } else { blockCollision = new JsonArray(); for (int collisionId : blockCollisions) { diff --git a/1.13/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java b/1.13/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java index 4e618110..83642819 100644 --- a/1.13/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java +++ b/1.13/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java @@ -107,8 +107,8 @@ public static JsonObject generateBlock(Registry blockRegistry, Block bloc blockDesc.addProperty("filterLight", block.getLightSubtracted(block.getDefaultState(), EmptyBlockView.INSTANCE, BlockPos.ORIGIN)); blockDesc.addProperty("defaultState", Block.getRawIdFromState(defaultState)); - blockDesc.addProperty("minStateId", Block.getRawIdFromState(blockStates.get(0))); - blockDesc.addProperty("maxStateId", Block.getRawIdFromState(blockStates.get(blockStates.size() - 1))); + blockDesc.addProperty("minStateId", Block.getRawIdFromState(blockStates.getFirst())); + blockDesc.addProperty("maxStateId", Block.getRawIdFromState(blockStates.getLast())); JsonArray stateProperties = new JsonArray(); for (Property property : block.getStateManager().getProperties()) { stateProperties.add(generateStateProperty(property)); diff --git a/1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java b/1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java index 6f0d2d43..8e758c4a 100644 --- a/1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java +++ b/1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java @@ -67,7 +67,7 @@ public JsonObject dumpBlockShapeIndices(Registry blockRegistry) { long distinctShapesCount = blockCollisions.stream().distinct().count(); JsonElement blockCollision; if (distinctShapesCount == 1L) { - blockCollision = new JsonPrimitive(blockCollisions.get(0)); + blockCollision = new JsonPrimitive(blockCollisions.getFirst()); } else { blockCollision = new JsonArray(); for (int collisionId : blockCollisions) { diff --git a/1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java b/1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java index 42ebda2c..1c2ac0dc 100644 --- a/1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java +++ b/1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java @@ -116,8 +116,8 @@ public static JsonObject generateBlock(Registry blockRegistry, Block bloc blockDesc.addProperty("filterLight", block.getLightSubtracted(block.getDefaultState(), EmptyBlockView.INSTANCE, BlockPos.ORIGIN)); blockDesc.addProperty("defaultState", Block.getRawIdFromState(defaultState)); - blockDesc.addProperty("minStateId", Block.getRawIdFromState(blockStates.get(0))); - blockDesc.addProperty("maxStateId", Block.getRawIdFromState(blockStates.get(blockStates.size() - 1))); + blockDesc.addProperty("minStateId", Block.getRawIdFromState(blockStates.getFirst())); + blockDesc.addProperty("maxStateId", Block.getRawIdFromState(blockStates.getLast())); JsonArray stateProperties = new JsonArray(); for (Property property : block.getStateFactory().getProperties()) { stateProperties.add(generateStateProperty(property)); diff --git a/1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java b/1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java index 7bd1ec44..b89fb56e 100644 --- a/1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java +++ b/1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java @@ -67,7 +67,7 @@ public JsonObject dumpBlockShapeIndices(Registry blockRegistry) { long distinctShapesCount = blockCollisions.stream().distinct().count(); JsonElement blockCollision; if (distinctShapesCount == 1L) { - blockCollision = new JsonPrimitive(blockCollisions.get(0)); + blockCollision = new JsonPrimitive(blockCollisions.getFirst()); } else { blockCollision = new JsonArray(); for (int collisionId : blockCollisions) { diff --git a/1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java b/1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java index bc619cdd..c48ce6e0 100644 --- a/1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java +++ b/1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java @@ -111,8 +111,8 @@ public static JsonObject generateBlock(Registry blockRegistry, Block bloc blockDesc.addProperty("filterLight", defaultState.getOpacity(EmptyBlockView.INSTANCE, BlockPos.ORIGIN)); blockDesc.addProperty("defaultState", Block.getRawIdFromState(defaultState)); - blockDesc.addProperty("minStateId", Block.getRawIdFromState(blockStates.get(0))); - blockDesc.addProperty("maxStateId", Block.getRawIdFromState(blockStates.get(blockStates.size() - 1))); + blockDesc.addProperty("minStateId", Block.getRawIdFromState(blockStates.getFirst())); + blockDesc.addProperty("maxStateId", Block.getRawIdFromState(blockStates.getLast())); JsonArray stateProperties = new JsonArray(); for (Property property : block.getStateManager().getProperties()) { stateProperties.add(generateStateProperty(property)); diff --git a/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java b/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java index 52c3181d..e85f4931 100644 --- a/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java +++ b/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java @@ -70,7 +70,7 @@ public JsonObject dumpBlockShapeIndices(Registry blockRegistry) { long distinctShapesCount = blockCollisions.stream().distinct().count(); JsonElement blockCollision; if (distinctShapesCount == 1L) { - blockCollision = new JsonPrimitive(blockCollisions.get(0)); + blockCollision = new JsonPrimitive(blockCollisions.getFirst()); } else { blockCollision = new JsonArray(); for (int collisionId : blockCollisions) { diff --git a/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java b/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java index 96e15f7e..f470c0ec 100644 --- a/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java +++ b/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java @@ -118,8 +118,8 @@ public static JsonObject generateBlock(Registry blockRegistry, Block bloc blockDesc.addProperty("filterLight", defaultState.getOpacity(EmptyBlockView.INSTANCE, BlockPos.ORIGIN)); blockDesc.addProperty("defaultState", Block.getRawIdFromState(defaultState)); - blockDesc.addProperty("minStateId", Block.getRawIdFromState(blockStates.get(0))); - blockDesc.addProperty("maxStateId", Block.getRawIdFromState(blockStates.get(blockStates.size() - 1))); + blockDesc.addProperty("minStateId", Block.getRawIdFromState(blockStates.getFirst())); + blockDesc.addProperty("maxStateId", Block.getRawIdFromState(blockStates.getLast())); JsonArray stateProperties = new JsonArray(); for (Property property : block.getStateManager().getProperties()) { stateProperties.add(generateStateProperty(property)); diff --git a/1.17/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java b/1.17/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java index 52c3181d..e85f4931 100644 --- a/1.17/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java +++ b/1.17/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java @@ -70,7 +70,7 @@ public JsonObject dumpBlockShapeIndices(Registry blockRegistry) { long distinctShapesCount = blockCollisions.stream().distinct().count(); JsonElement blockCollision; if (distinctShapesCount == 1L) { - blockCollision = new JsonPrimitive(blockCollisions.get(0)); + blockCollision = new JsonPrimitive(blockCollisions.getFirst()); } else { blockCollision = new JsonArray(); for (int collisionId : blockCollisions) { diff --git a/1.17/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java b/1.17/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java index 51139655..9280f7bf 100644 --- a/1.17/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java +++ b/1.17/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java @@ -105,7 +105,7 @@ private static String findMatchingBlockMaterial(BlockState blockState, List 1) { - var firstMaterial = matchingMaterials.get(0); + var firstMaterial = matchingMaterials.getFirst(); var otherMaterials = matchingMaterials.subList(1, matchingMaterials.size()); if (!otherMaterials.stream().allMatch(firstMaterial::includesMaterial)) { @@ -115,7 +115,7 @@ private static String findMatchingBlockMaterial(BlockState blockState, List blockRegistry, List materials, Block block) { @@ -148,8 +148,8 @@ public static JsonObject generateBlock(Registry blockRegistry, List property : block.getStateManager().getProperties()) { @@ -167,7 +167,7 @@ public static JsonObject generateBlock(Registry blockRegistry, List actualBlockDrops = new ArrayList<>(); - populateDropsIfPossible(defaultState, effectiveTools.isEmpty() ? Items.AIR : effectiveTools.get(0), actualBlockDrops); + populateDropsIfPossible(defaultState, effectiveTools.isEmpty() ? Items.AIR : effectiveTools.getFirst(), actualBlockDrops); JsonArray dropsArray = new JsonArray(); for (ItemStack dropStack : actualBlockDrops) { diff --git a/1.18/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java b/1.18/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java index 52c3181d..e85f4931 100644 --- a/1.18/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java +++ b/1.18/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java @@ -70,7 +70,7 @@ public JsonObject dumpBlockShapeIndices(Registry blockRegistry) { long distinctShapesCount = blockCollisions.stream().distinct().count(); JsonElement blockCollision; if (distinctShapesCount == 1L) { - blockCollision = new JsonPrimitive(blockCollisions.get(0)); + blockCollision = new JsonPrimitive(blockCollisions.getFirst()); } else { blockCollision = new JsonArray(); for (int collisionId : blockCollisions) { diff --git a/1.18/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java b/1.18/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java index 3c082458..43b2b364 100644 --- a/1.18/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java +++ b/1.18/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java @@ -104,7 +104,7 @@ private static String findMatchingBlockMaterial(BlockState blockState, List 1) { - var firstMaterial = matchingMaterials.get(0); + var firstMaterial = matchingMaterials.getFirst(); var otherMaterials = matchingMaterials.subList(1, matchingMaterials.size()); if (!otherMaterials.stream().allMatch(firstMaterial::includesMaterial)) { @@ -114,7 +114,7 @@ private static String findMatchingBlockMaterial(BlockState blockState, List blockRegistry, List materials, Block block) { @@ -131,8 +131,8 @@ public static JsonObject generateBlock(Registry blockRegistry, List property : block.getStateManager().getProperties()) { stateProperties.add(generateStateProperty(property)); @@ -140,7 +140,7 @@ public static JsonObject generateBlock(Registry blockRegistry, List actualBlockDrops = new ArrayList<>(); - // populateDropsIfPossible(defaultState, effectiveTools.isEmpty() ? Items.AIR : effectiveTools.get(0), actualBlockDrops); + // populateDropsIfPossible(defaultState, effectiveTools.isEmpty() ? Items.AIR : effectiveTools.getFirst(), actualBlockDrops); // for (ItemStack dropStack : actualBlockDrops) { // dropsArray.add(Item.getRawId(dropStack.getItem())); diff --git a/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java b/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java index 52c3181d..e85f4931 100644 --- a/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java +++ b/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java @@ -70,7 +70,7 @@ public JsonObject dumpBlockShapeIndices(Registry blockRegistry) { long distinctShapesCount = blockCollisions.stream().distinct().count(); JsonElement blockCollision; if (distinctShapesCount == 1L) { - blockCollision = new JsonPrimitive(blockCollisions.get(0)); + blockCollision = new JsonPrimitive(blockCollisions.getFirst()); } else { blockCollision = new JsonArray(); for (int collisionId : blockCollisions) { diff --git a/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java b/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java index 51139655..9280f7bf 100644 --- a/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java +++ b/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java @@ -105,7 +105,7 @@ private static String findMatchingBlockMaterial(BlockState blockState, List 1) { - var firstMaterial = matchingMaterials.get(0); + var firstMaterial = matchingMaterials.getFirst(); var otherMaterials = matchingMaterials.subList(1, matchingMaterials.size()); if (!otherMaterials.stream().allMatch(firstMaterial::includesMaterial)) { @@ -115,7 +115,7 @@ private static String findMatchingBlockMaterial(BlockState blockState, List blockRegistry, List materials, Block block) { @@ -148,8 +148,8 @@ public static JsonObject generateBlock(Registry blockRegistry, List property : block.getStateManager().getProperties()) { @@ -167,7 +167,7 @@ public static JsonObject generateBlock(Registry blockRegistry, List actualBlockDrops = new ArrayList<>(); - populateDropsIfPossible(defaultState, effectiveTools.isEmpty() ? Items.AIR : effectiveTools.get(0), actualBlockDrops); + populateDropsIfPossible(defaultState, effectiveTools.isEmpty() ? Items.AIR : effectiveTools.getFirst(), actualBlockDrops); JsonArray dropsArray = new JsonArray(); for (ItemStack dropStack : actualBlockDrops) { diff --git a/1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java b/1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java index 52c3181d..e85f4931 100644 --- a/1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java +++ b/1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java @@ -70,7 +70,7 @@ public JsonObject dumpBlockShapeIndices(Registry blockRegistry) { long distinctShapesCount = blockCollisions.stream().distinct().count(); JsonElement blockCollision; if (distinctShapesCount == 1L) { - blockCollision = new JsonPrimitive(blockCollisions.get(0)); + blockCollision = new JsonPrimitive(blockCollisions.getFirst()); } else { blockCollision = new JsonArray(); for (int collisionId : blockCollisions) { diff --git a/1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java b/1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java index 51139655..9280f7bf 100644 --- a/1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java +++ b/1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java @@ -105,7 +105,7 @@ private static String findMatchingBlockMaterial(BlockState blockState, List 1) { - var firstMaterial = matchingMaterials.get(0); + var firstMaterial = matchingMaterials.getFirst(); var otherMaterials = matchingMaterials.subList(1, matchingMaterials.size()); if (!otherMaterials.stream().allMatch(firstMaterial::includesMaterial)) { @@ -115,7 +115,7 @@ private static String findMatchingBlockMaterial(BlockState blockState, List blockRegistry, List materials, Block block) { @@ -148,8 +148,8 @@ public static JsonObject generateBlock(Registry blockRegistry, List property : block.getStateManager().getProperties()) { @@ -167,7 +167,7 @@ public static JsonObject generateBlock(Registry blockRegistry, List actualBlockDrops = new ArrayList<>(); - populateDropsIfPossible(defaultState, effectiveTools.isEmpty() ? Items.AIR : effectiveTools.get(0), actualBlockDrops); + populateDropsIfPossible(defaultState, effectiveTools.isEmpty() ? Items.AIR : effectiveTools.getFirst(), actualBlockDrops); JsonArray dropsArray = new JsonArray(); for (ItemStack dropStack : actualBlockDrops) { diff --git a/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java b/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java index 8b9d0e06..f9f09af5 100644 --- a/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java +++ b/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java @@ -72,7 +72,7 @@ public JsonObject dumpBlockShapeIndices(Registry blockRegistry) { long distinctShapesCount = blockCollisions.stream().distinct().count(); JsonElement blockCollision; if (distinctShapesCount == 1L) { - blockCollision = new JsonPrimitive(blockCollisions.get(0)); + blockCollision = new JsonPrimitive(blockCollisions.getFirst()); } else { blockCollision = new JsonArray(); for (int collisionId : blockCollisions) { diff --git a/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java b/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java index 44e8e29c..c5ec58d1 100644 --- a/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java +++ b/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java @@ -105,7 +105,7 @@ private static String findMatchingBlockMaterial(BlockState blockState, List 1) { - var firstMaterial = matchingMaterials.get(0); + var firstMaterial = matchingMaterials.getFirst(); var otherMaterials = matchingMaterials.subList(1, matchingMaterials.size()); if (!otherMaterials.stream().allMatch(firstMaterial::includesMaterial)) { @@ -115,7 +115,7 @@ private static String findMatchingBlockMaterial(BlockState blockState, List blockRegistry, List materials, Block block) { @@ -148,8 +148,8 @@ public static JsonObject generateBlock(Registry blockRegistry, List property : block.getStateManager().getProperties()) { @@ -167,7 +167,7 @@ public static JsonObject generateBlock(Registry blockRegistry, List actualBlockDrops = new ArrayList<>(); - populateDropsIfPossible(defaultState, effectiveTools.isEmpty() ? Items.AIR : effectiveTools.get(0), actualBlockDrops); + populateDropsIfPossible(defaultState, effectiveTools.isEmpty() ? Items.AIR : effectiveTools.getFirst(), actualBlockDrops); JsonArray dropsArray = new JsonArray(); for (ItemStack dropStack : actualBlockDrops) { diff --git a/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java b/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java index 8b9d0e06..f9f09af5 100644 --- a/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java +++ b/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java @@ -72,7 +72,7 @@ public JsonObject dumpBlockShapeIndices(Registry blockRegistry) { long distinctShapesCount = blockCollisions.stream().distinct().count(); JsonElement blockCollision; if (distinctShapesCount == 1L) { - blockCollision = new JsonPrimitive(blockCollisions.get(0)); + blockCollision = new JsonPrimitive(blockCollisions.getFirst()); } else { blockCollision = new JsonArray(); for (int collisionId : blockCollisions) { diff --git a/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java b/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java index 44e8e29c..c5ec58d1 100644 --- a/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java +++ b/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java @@ -105,7 +105,7 @@ private static String findMatchingBlockMaterial(BlockState blockState, List 1) { - var firstMaterial = matchingMaterials.get(0); + var firstMaterial = matchingMaterials.getFirst(); var otherMaterials = matchingMaterials.subList(1, matchingMaterials.size()); if (!otherMaterials.stream().allMatch(firstMaterial::includesMaterial)) { @@ -115,7 +115,7 @@ private static String findMatchingBlockMaterial(BlockState blockState, List blockRegistry, List materials, Block block) { @@ -148,8 +148,8 @@ public static JsonObject generateBlock(Registry blockRegistry, List property : block.getStateManager().getProperties()) { @@ -167,7 +167,7 @@ public static JsonObject generateBlock(Registry blockRegistry, List actualBlockDrops = new ArrayList<>(); - populateDropsIfPossible(defaultState, effectiveTools.isEmpty() ? Items.AIR : effectiveTools.get(0), actualBlockDrops); + populateDropsIfPossible(defaultState, effectiveTools.isEmpty() ? Items.AIR : effectiveTools.getFirst(), actualBlockDrops); JsonArray dropsArray = new JsonArray(); for (ItemStack dropStack : actualBlockDrops) { diff --git a/1.7/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java b/1.7/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java index 8ae63031..5ba2fbd2 100644 --- a/1.7/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java +++ b/1.7/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java @@ -93,7 +93,7 @@ public Object addShapesFrom(Block block) { // } // } // if (indexesOfBoxesInTheShapesCache.stream().distinct().count() < 2) { -// return indexesOfBoxesInTheShapesCache.get(0); +// return indexesOfBoxesInTheShapesCache.getFirst(); // } else { // JsonArray shapeIndexes = new JsonArray(); // indexesOfBoxesInTheShapesCache.forEach(shapeIndex -> shapeIndexes.add(new JsonPrimitive(shapeIndex))); diff --git a/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java b/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java index b0f50107..411a4666 100644 --- a/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java +++ b/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java @@ -79,7 +79,7 @@ public Object addShapesFrom(Block block) { } } if (indexesOfBoxesInTheShapesCache.stream().distinct().count() < 2) { - return indexesOfBoxesInTheShapesCache.get(0); + return indexesOfBoxesInTheShapesCache.getFirst(); } else { JsonArray shapeIndexes = new JsonArray(); indexesOfBoxesInTheShapesCache.forEach(shapeIndex -> shapeIndexes.add(new JsonPrimitive(shapeIndex))); diff --git a/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java b/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java index 357bab59..02fd69a6 100644 --- a/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java +++ b/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java @@ -79,7 +79,7 @@ public Object addShapesFrom(Block block) { } } if (indexesOfBoxesInTheShapesCache.stream().distinct().count() < 2) { - return indexesOfBoxesInTheShapesCache.get(0); + return indexesOfBoxesInTheShapesCache.getFirst(); } else { JsonArray shapeIndexes = new JsonArray(); indexesOfBoxesInTheShapesCache.forEach(shapeIndex -> shapeIndexes.add(new JsonPrimitive(shapeIndex))); diff --git a/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java b/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java index 52c3181d..e85f4931 100644 --- a/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java +++ b/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java @@ -70,7 +70,7 @@ public JsonObject dumpBlockShapeIndices(Registry blockRegistry) { long distinctShapesCount = blockCollisions.stream().distinct().count(); JsonElement blockCollision; if (distinctShapesCount == 1L) { - blockCollision = new JsonPrimitive(blockCollisions.get(0)); + blockCollision = new JsonPrimitive(blockCollisions.getFirst()); } else { blockCollision = new JsonArray(); for (int collisionId : blockCollisions) { diff --git a/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java b/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java index 51139655..9280f7bf 100644 --- a/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java +++ b/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java @@ -105,7 +105,7 @@ private static String findMatchingBlockMaterial(BlockState blockState, List 1) { - var firstMaterial = matchingMaterials.get(0); + var firstMaterial = matchingMaterials.getFirst(); var otherMaterials = matchingMaterials.subList(1, matchingMaterials.size()); if (!otherMaterials.stream().allMatch(firstMaterial::includesMaterial)) { @@ -115,7 +115,7 @@ private static String findMatchingBlockMaterial(BlockState blockState, List blockRegistry, List materials, Block block) { @@ -148,8 +148,8 @@ public static JsonObject generateBlock(Registry blockRegistry, List property : block.getStateManager().getProperties()) { @@ -167,7 +167,7 @@ public static JsonObject generateBlock(Registry blockRegistry, List actualBlockDrops = new ArrayList<>(); - populateDropsIfPossible(defaultState, effectiveTools.isEmpty() ? Items.AIR : effectiveTools.get(0), actualBlockDrops); + populateDropsIfPossible(defaultState, effectiveTools.isEmpty() ? Items.AIR : effectiveTools.getFirst(), actualBlockDrops); JsonArray dropsArray = new JsonArray(); for (ItemStack dropStack : actualBlockDrops) { From a58d77eb18a5130bcaebf0c31c6d32cfdb6260a7 Mon Sep 17 00:00:00 2001 From: AlexProgrammerDE <40795980+AlexProgrammerDE@users.noreply.github.com> Date: Thu, 2 May 2024 07:37:21 +0200 Subject: [PATCH 24/38] More cleanup --- .../generators/ParticlesDataGenerator.java | 13 ++++++------- .../generators/SoundsDataGenerator.java | 2 -- .../generators/SoundsDataGenerator.java | 1 - .../generators/SoundsDataGenerator.java | 1 - .../generators/MaterialsDataGenerator.java | 2 +- .../generators/SoundsDataGenerator.java | 1 - .../generators/MaterialsDataGenerator.java | 2 +- .../generators/SoundsDataGenerator.java | 1 - .../generators/EntitiesDataGenerator.java | 8 ++------ .../generators/MaterialsDataGenerator.java | 2 +- .../generators/SoundsDataGenerator.java | 1 - .../mixin/EntityTypeAccessor.java | 12 ------------ .../minecraft-data-generator.mixins.json | 1 - .../generators/BiomesDataGenerator.java | 2 +- .../generators/EntitiesDataGenerator.java | 8 ++------ .../generators/MaterialsDataGenerator.java | 2 +- .../generators/SoundsDataGenerator.java | 2 -- .../mixin/EntityTypeAccessor.java | 12 ------------ .../minecraft-data-generator.mixins.json | 1 - .../generators/BiomesDataGenerator.java | 4 +++- .../generators/EntitiesDataGenerator.java | 10 +++------- .../generators/MaterialsDataGenerator.java | 2 +- .../mixin/EntityTypeAccessor.java | 12 ------------ .../minecraft-data-generator.mixins.json | 1 - .../generators/BiomesDataGenerator.java | 4 +++- .../generators/EntitiesDataGenerator.java | 8 ++------ .../generators/MaterialsDataGenerator.java | 2 +- .../generators/RecipeDataGenerator.java | 5 ++++- .../generators/SoundsDataGenerator.java | 4 ---- .../mixin/EntityTypeAccessor.java | 12 ------------ .../minecraft-data-generator.mixins.json | 1 - .../minecraftdatagenerator/mixin/BlocksMixin.java | 15 --------------- .../minecraftdatagenerator/mixin/ReadyMixin.java | 1 - .../minecraft-data-generator.mixins.json | 1 - .../generators/BiomesDataGenerator.java | 2 -- .../generators/MaterialsDataGenerator.java | 2 +- .../generators/SoundsDataGenerator.java | 1 - .../CustomFabricLikeMinecraftTransformer.kt | 6 +++--- .../kotlin/CustomFabricMinecraftTransformer.kt | 2 +- 39 files changed, 37 insertions(+), 132 deletions(-) delete mode 100644 1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/mixin/EntityTypeAccessor.java delete mode 100644 1.19/src/main/java/dev/u9g/minecraftdatagenerator/mixin/EntityTypeAccessor.java delete mode 100644 1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/mixin/EntityTypeAccessor.java delete mode 100644 1.20/src/main/java/dev/u9g/minecraftdatagenerator/mixin/EntityTypeAccessor.java delete mode 100644 1.7/src/main/java/dev/u9g/minecraftdatagenerator/mixin/BlocksMixin.java diff --git a/1.13/src/main/java/dev/u9g/minecraftdatagenerator/generators/ParticlesDataGenerator.java b/1.13/src/main/java/dev/u9g/minecraftdatagenerator/generators/ParticlesDataGenerator.java index 278bd918..9ceabf1d 100644 --- a/1.13/src/main/java/dev/u9g/minecraftdatagenerator/generators/ParticlesDataGenerator.java +++ b/1.13/src/main/java/dev/u9g/minecraftdatagenerator/generators/ParticlesDataGenerator.java @@ -9,11 +9,11 @@ import java.util.Objects; public class ParticlesDataGenerator implements IDataGenerator { - public static JsonObject generateParticleType(Registry> registry, ParticleType particleType) { + public static JsonObject generateParticleType(ParticleType particleType) { JsonObject effectDesc = new JsonObject(); - Identifier registryKey = registry.getId(particleType); + Identifier registryKey = Registry.PARTICLE_TYPE.getId(particleType); - effectDesc.addProperty("id", registry.getRawId(particleType)); + effectDesc.addProperty("id", Registry.PARTICLE_TYPE.getRawId(particleType)); effectDesc.addProperty("name", Objects.requireNonNull(registryKey).getPath()); return effectDesc; } @@ -23,13 +23,12 @@ public String getDataName() { return "particles"; } + @SuppressWarnings("unchecked") @Override public JsonArray generateDataJson() { JsonArray resultsArray = new JsonArray(); - Registry> particleTypeRegistry = Registry.PARTICLE_TYPE; - for (ParticleType particleType : (Iterable) particleTypeRegistry) { - resultsArray.add(generateParticleType(particleTypeRegistry, particleType)); - } + Registry.PARTICLE_TYPE.forEach(particleType -> + resultsArray.add(generateParticleType((ParticleType) particleType))); return resultsArray; } } diff --git a/1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java b/1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java index a4840c35..585eb218 100644 --- a/1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java +++ b/1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java @@ -2,8 +2,6 @@ import com.google.gson.JsonArray; import com.google.gson.JsonObject; -import dev.u9g.minecraftdatagenerator.mixin.SoundAccessor; -import net.minecraft.client.sound.Sound; import net.minecraft.sound.SoundEvent; import net.minecraft.util.registry.Registry; diff --git a/1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java b/1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java index c9550fad..d4209586 100644 --- a/1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java +++ b/1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java @@ -3,7 +3,6 @@ import com.google.gson.JsonArray; import com.google.gson.JsonObject; import dev.u9g.minecraftdatagenerator.mixin.SoundAccessor; -import net.minecraft.client.sound.Sound; import net.minecraft.sound.SoundEvent; import net.minecraft.util.registry.Registry; diff --git a/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java b/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java index c9550fad..d4209586 100644 --- a/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java +++ b/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java @@ -3,7 +3,6 @@ import com.google.gson.JsonArray; import com.google.gson.JsonObject; import dev.u9g.minecraftdatagenerator.mixin.SoundAccessor; -import net.minecraft.client.sound.Sound; import net.minecraft.sound.SoundEvent; import net.minecraft.util.registry.Registry; diff --git a/1.17/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java b/1.17/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java index 3b96085d..825a260e 100644 --- a/1.17/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java +++ b/1.17/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java @@ -53,7 +53,7 @@ private static void createCompositeMaterialInfo(List allMaterials, mappedMaterials.stream().allMatch(it -> it.getPredicate().test(blockState)); MaterialInfo materialInfo = new MaterialInfo(compositeMaterialName, compositePredicate).includes(mappedMaterials); - allMaterials.add(0, materialInfo); + allMaterials.addFirst(materialInfo); } private static void createCompositeMaterial(Map> allMaterials, List combinedMaterials) { diff --git a/1.17/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java b/1.17/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java index c9550fad..d4209586 100644 --- a/1.17/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java +++ b/1.17/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java @@ -3,7 +3,6 @@ import com.google.gson.JsonArray; import com.google.gson.JsonObject; import dev.u9g.minecraftdatagenerator.mixin.SoundAccessor; -import net.minecraft.client.sound.Sound; import net.minecraft.sound.SoundEvent; import net.minecraft.util.registry.Registry; diff --git a/1.18/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java b/1.18/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java index 3b96085d..825a260e 100644 --- a/1.18/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java +++ b/1.18/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java @@ -53,7 +53,7 @@ private static void createCompositeMaterialInfo(List allMaterials, mappedMaterials.stream().allMatch(it -> it.getPredicate().test(blockState)); MaterialInfo materialInfo = new MaterialInfo(compositeMaterialName, compositePredicate).includes(mappedMaterials); - allMaterials.add(0, materialInfo); + allMaterials.addFirst(materialInfo); } private static void createCompositeMaterial(Map> allMaterials, List combinedMaterials) { diff --git a/1.18/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java b/1.18/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java index c9550fad..d4209586 100644 --- a/1.18/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java +++ b/1.18/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java @@ -3,7 +3,6 @@ import com.google.gson.JsonArray; import com.google.gson.JsonObject; import dev.u9g.minecraftdatagenerator.mixin.SoundAccessor; -import net.minecraft.client.sound.Sound; import net.minecraft.sound.SoundEvent; import net.minecraft.util.registry.Registry; diff --git a/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java b/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java index 5e0ed0cf..703aeade 100644 --- a/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java +++ b/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java @@ -2,7 +2,6 @@ import com.google.gson.JsonArray; import com.google.gson.JsonObject; -import dev.u9g.minecraftdatagenerator.mixin.EntityTypeAccessor; import dev.u9g.minecraftdatagenerator.util.DGU; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityType; @@ -46,11 +45,8 @@ public static JsonObject generateEntity(Registry> entityRegistry, } private static String getCategoryFrom(EntityType entityType) { - if (entityType == EntityType.PLAYER) return "UNKNOWN"; // fail early for player entities - /*public T create(World world) { - return this.factory.create(this, world); - }*/ - Entity entity = ((EntityTypeAccessor) entityType).factory().create(entityType, DGU.getWorld()); + if (entityType == EntityType.PLAYER) return "UNKNOWN"; + Entity entity = entityType.create(DGU.getWorld()); if (entity == null) throw new Error("Entity was null after trying to create a: " + DGU.translateText(entityType.getTranslationKey())); entity.discard(); diff --git a/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java b/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java index 4253ae69..5133d9eb 100644 --- a/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java +++ b/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java @@ -52,7 +52,7 @@ private static void createCompositeMaterialInfo(List allMaterials, mappedMaterials.stream().allMatch(it -> it.getPredicate().test(blockState)); MaterialInfo materialInfo = new MaterialInfo(compositeMaterialName, compositePredicate).includes(mappedMaterials); - allMaterials.add(0, materialInfo); + allMaterials.addFirst(materialInfo); } private static void createCompositeMaterial(Map> allMaterials, List combinedMaterials) { diff --git a/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java b/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java index 4601db6b..53afb138 100644 --- a/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java +++ b/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java @@ -2,7 +2,6 @@ import com.google.gson.JsonArray; import com.google.gson.JsonObject; -import net.minecraft.client.sound.Sound; import net.minecraft.sound.SoundEvent; import net.minecraft.util.registry.Registry; diff --git a/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/mixin/EntityTypeAccessor.java b/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/mixin/EntityTypeAccessor.java deleted file mode 100644 index 3e62bf59..00000000 --- a/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/mixin/EntityTypeAccessor.java +++ /dev/null @@ -1,12 +0,0 @@ -package dev.u9g.minecraftdatagenerator.mixin; - -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityType; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.gen.Accessor; - -@Mixin(EntityType.class) -public interface EntityTypeAccessor { - @Accessor("factory") - EntityType.EntityFactory factory(); -} diff --git a/1.19.2/src/main/resources/minecraft-data-generator.mixins.json b/1.19.2/src/main/resources/minecraft-data-generator.mixins.json index bb73460d..d46bf65f 100644 --- a/1.19.2/src/main/resources/minecraft-data-generator.mixins.json +++ b/1.19.2/src/main/resources/minecraft-data-generator.mixins.json @@ -4,7 +4,6 @@ "package": "dev.u9g.minecraftdatagenerator.mixin", "compatibilityLevel": "JAVA_17", "mixins": [ - "EntityTypeAccessor", "EULAMixin", "MiningToolItemAccessor", "ReadyMixin" diff --git a/1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/BiomesDataGenerator.java b/1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/BiomesDataGenerator.java index 32d478f7..d80bf03e 100644 --- a/1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/BiomesDataGenerator.java +++ b/1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/BiomesDataGenerator.java @@ -104,7 +104,7 @@ public String getDataName() { public JsonArray generateDataJson() { JsonArray biomesArray = new JsonArray(); BuiltinRegistries.BIOME.stream() - .map(biome -> generateBiomeInfo(biome)) + .map(BiomesDataGenerator::generateBiomeInfo) .forEach(biomesArray::add); return biomesArray; } diff --git a/1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java b/1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java index 5e0ed0cf..703aeade 100644 --- a/1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java +++ b/1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java @@ -2,7 +2,6 @@ import com.google.gson.JsonArray; import com.google.gson.JsonObject; -import dev.u9g.minecraftdatagenerator.mixin.EntityTypeAccessor; import dev.u9g.minecraftdatagenerator.util.DGU; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityType; @@ -46,11 +45,8 @@ public static JsonObject generateEntity(Registry> entityRegistry, } private static String getCategoryFrom(EntityType entityType) { - if (entityType == EntityType.PLAYER) return "UNKNOWN"; // fail early for player entities - /*public T create(World world) { - return this.factory.create(this, world); - }*/ - Entity entity = ((EntityTypeAccessor) entityType).factory().create(entityType, DGU.getWorld()); + if (entityType == EntityType.PLAYER) return "UNKNOWN"; + Entity entity = entityType.create(DGU.getWorld()); if (entity == null) throw new Error("Entity was null after trying to create a: " + DGU.translateText(entityType.getTranslationKey())); entity.discard(); diff --git a/1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java b/1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java index 4253ae69..5133d9eb 100644 --- a/1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java +++ b/1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java @@ -52,7 +52,7 @@ private static void createCompositeMaterialInfo(List allMaterials, mappedMaterials.stream().allMatch(it -> it.getPredicate().test(blockState)); MaterialInfo materialInfo = new MaterialInfo(compositeMaterialName, compositePredicate).includes(mappedMaterials); - allMaterials.add(0, materialInfo); + allMaterials.addFirst(materialInfo); } private static void createCompositeMaterial(Map> allMaterials, List combinedMaterials) { diff --git a/1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java b/1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java index ea1a6bea..585eb218 100644 --- a/1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java +++ b/1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java @@ -2,8 +2,6 @@ import com.google.gson.JsonArray; import com.google.gson.JsonObject; -import net.minecraft.client.sound.Sound; -import net.minecraft.client.sound.SoundSystem; import net.minecraft.sound.SoundEvent; import net.minecraft.util.registry.Registry; diff --git a/1.19/src/main/java/dev/u9g/minecraftdatagenerator/mixin/EntityTypeAccessor.java b/1.19/src/main/java/dev/u9g/minecraftdatagenerator/mixin/EntityTypeAccessor.java deleted file mode 100644 index 3e62bf59..00000000 --- a/1.19/src/main/java/dev/u9g/minecraftdatagenerator/mixin/EntityTypeAccessor.java +++ /dev/null @@ -1,12 +0,0 @@ -package dev.u9g.minecraftdatagenerator.mixin; - -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityType; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.gen.Accessor; - -@Mixin(EntityType.class) -public interface EntityTypeAccessor { - @Accessor("factory") - EntityType.EntityFactory factory(); -} diff --git a/1.19/src/main/resources/minecraft-data-generator.mixins.json b/1.19/src/main/resources/minecraft-data-generator.mixins.json index bb73460d..d46bf65f 100644 --- a/1.19/src/main/resources/minecraft-data-generator.mixins.json +++ b/1.19/src/main/resources/minecraft-data-generator.mixins.json @@ -4,7 +4,6 @@ "package": "dev.u9g.minecraftdatagenerator.mixin", "compatibilityLevel": "JAVA_17", "mixins": [ - "EntityTypeAccessor", "EULAMixin", "MiningToolItemAccessor", "ReadyMixin" diff --git a/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/BiomesDataGenerator.java b/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/BiomesDataGenerator.java index e506efff..a1b3b732 100644 --- a/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/BiomesDataGenerator.java +++ b/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/BiomesDataGenerator.java @@ -3,7 +3,9 @@ import com.google.gson.JsonArray; import com.google.gson.JsonObject; import dev.u9g.minecraftdatagenerator.util.DGU; -import net.minecraft.registry.*; +import net.minecraft.registry.DynamicRegistryManager; +import net.minecraft.registry.Registry; +import net.minecraft.registry.RegistryKeys; import net.minecraft.registry.tag.BiomeTags; import net.minecraft.util.Identifier; import net.minecraft.world.biome.Biome; diff --git a/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java b/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java index 31e5d3b3..71c5ca7e 100644 --- a/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java +++ b/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java @@ -2,7 +2,6 @@ import com.google.gson.JsonArray; import com.google.gson.JsonObject; -import dev.u9g.minecraftdatagenerator.mixin.EntityTypeAccessor; import dev.u9g.minecraftdatagenerator.util.DGU; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityType; @@ -37,7 +36,7 @@ public static JsonObject generateEntity(Registry> entityRegistry, MinecraftServer minecraftServer = DGU.getCurrentlyRunningServer(); if (minecraftServer != null) { - Entity entityObject = ((EntityTypeAccessor) entityType).factory().create(entityType, minecraftServer.getOverworld()); + Entity entityObject = entityType.create(minecraftServer.getOverworld()); entityTypeString = entityObject != null ? getEntityTypeForClass(entityObject.getClass()) : "unknown"; } if (entityType == EntityType.PLAYER) { @@ -51,11 +50,8 @@ public static JsonObject generateEntity(Registry> entityRegistry, } private static String getCategoryFrom(EntityType entityType) { - if (entityType == EntityType.PLAYER) return "UNKNOWN"; // fail early for player entities - /*public T create(World world) { - return this.factory.create(this, world); - }*/ - Entity entity = ((EntityTypeAccessor) entityType).factory().create(entityType, DGU.getWorld()); + if (entityType == EntityType.PLAYER) return "UNKNOWN"; + Entity entity = entityType.create(DGU.getWorld()); if (entity == null) throw new Error("Entity was null after trying to create a: " + DGU.translateText(entityType.getTranslationKey())); entity.discard(); diff --git a/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java b/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java index 9a5fac15..0de1c866 100644 --- a/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java +++ b/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java @@ -53,7 +53,7 @@ private static void createCompositeMaterialInfo(List allMaterials, mappedMaterials.stream().allMatch(it -> it.getPredicate().test(blockState)); MaterialInfo materialInfo = new MaterialInfo(compositeMaterialName, compositePredicate).includes(mappedMaterials); - allMaterials.add(0, materialInfo); + allMaterials.addFirst(materialInfo); } private static void createCompositeMaterial(Map> allMaterials, List combinedMaterials) { diff --git a/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/mixin/EntityTypeAccessor.java b/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/mixin/EntityTypeAccessor.java deleted file mode 100644 index 3e62bf59..00000000 --- a/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/mixin/EntityTypeAccessor.java +++ /dev/null @@ -1,12 +0,0 @@ -package dev.u9g.minecraftdatagenerator.mixin; - -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityType; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.gen.Accessor; - -@Mixin(EntityType.class) -public interface EntityTypeAccessor { - @Accessor("factory") - EntityType.EntityFactory factory(); -} diff --git a/1.20.4/src/main/resources/minecraft-data-generator.mixins.json b/1.20.4/src/main/resources/minecraft-data-generator.mixins.json index bb73460d..d46bf65f 100644 --- a/1.20.4/src/main/resources/minecraft-data-generator.mixins.json +++ b/1.20.4/src/main/resources/minecraft-data-generator.mixins.json @@ -4,7 +4,6 @@ "package": "dev.u9g.minecraftdatagenerator.mixin", "compatibilityLevel": "JAVA_17", "mixins": [ - "EntityTypeAccessor", "EULAMixin", "MiningToolItemAccessor", "ReadyMixin" diff --git a/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/BiomesDataGenerator.java b/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/BiomesDataGenerator.java index e506efff..a1b3b732 100644 --- a/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/BiomesDataGenerator.java +++ b/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/BiomesDataGenerator.java @@ -3,7 +3,9 @@ import com.google.gson.JsonArray; import com.google.gson.JsonObject; import dev.u9g.minecraftdatagenerator.util.DGU; -import net.minecraft.registry.*; +import net.minecraft.registry.DynamicRegistryManager; +import net.minecraft.registry.Registry; +import net.minecraft.registry.RegistryKeys; import net.minecraft.registry.tag.BiomeTags; import net.minecraft.util.Identifier; import net.minecraft.world.biome.Biome; diff --git a/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java b/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java index c989ca59..94a0ca61 100644 --- a/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java +++ b/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java @@ -2,7 +2,6 @@ import com.google.gson.JsonArray; import com.google.gson.JsonObject; -import dev.u9g.minecraftdatagenerator.mixin.EntityTypeAccessor; import dev.u9g.minecraftdatagenerator.util.DGU; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityType; @@ -47,11 +46,8 @@ public static JsonObject generateEntity(Registry> entityRegistry, } private static String getCategoryFrom(EntityType entityType) { - if (entityType == EntityType.PLAYER) return "UNKNOWN"; // fail early for player entities - /*public T create(World world) { - return this.factory.create(this, world); - }*/ - Entity entity = ((EntityTypeAccessor) entityType).factory().create(entityType, DGU.getWorld()); + if (entityType == EntityType.PLAYER) return "UNKNOWN"; + Entity entity = entityType.create(DGU.getWorld()); if (entity == null) throw new Error("Entity was null after trying to create a: " + DGU.translateText(entityType.getTranslationKey())); entity.discard(); diff --git a/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java b/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java index 9a5fac15..0de1c866 100644 --- a/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java +++ b/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java @@ -53,7 +53,7 @@ private static void createCompositeMaterialInfo(List allMaterials, mappedMaterials.stream().allMatch(it -> it.getPredicate().test(blockState)); MaterialInfo materialInfo = new MaterialInfo(compositeMaterialName, compositePredicate).includes(mappedMaterials); - allMaterials.add(0, materialInfo); + allMaterials.addFirst(materialInfo); } private static void createCompositeMaterial(Map> allMaterials, List combinedMaterials) { diff --git a/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/RecipeDataGenerator.java b/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/RecipeDataGenerator.java index e7800c01..6133772d 100644 --- a/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/RecipeDataGenerator.java +++ b/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/RecipeDataGenerator.java @@ -7,7 +7,10 @@ import com.google.gson.JsonObject; import dev.u9g.minecraftdatagenerator.util.DGU; import net.minecraft.item.Item; -import net.minecraft.recipe.*; +import net.minecraft.recipe.Ingredient; +import net.minecraft.recipe.Recipe; +import net.minecraft.recipe.ShapedRecipe; +import net.minecraft.recipe.ShapelessRecipe; import net.minecraft.registry.DynamicRegistryManager; import net.minecraft.registry.RegistryKeys; diff --git a/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java b/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java index f98af8ad..e3906559 100644 --- a/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java +++ b/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java @@ -2,11 +2,7 @@ import com.google.gson.JsonArray; import com.google.gson.JsonObject; -import dev.u9g.minecraftdatagenerator.util.DGU; import net.minecraft.registry.Registries; -import net.minecraft.registry.Registry; -import net.minecraft.registry.RegistryKeys; -import net.minecraft.client.sound.Sound; import net.minecraft.sound.SoundEvent; public class SoundsDataGenerator implements IDataGenerator { diff --git a/1.20/src/main/java/dev/u9g/minecraftdatagenerator/mixin/EntityTypeAccessor.java b/1.20/src/main/java/dev/u9g/minecraftdatagenerator/mixin/EntityTypeAccessor.java deleted file mode 100644 index 3e62bf59..00000000 --- a/1.20/src/main/java/dev/u9g/minecraftdatagenerator/mixin/EntityTypeAccessor.java +++ /dev/null @@ -1,12 +0,0 @@ -package dev.u9g.minecraftdatagenerator.mixin; - -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityType; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.gen.Accessor; - -@Mixin(EntityType.class) -public interface EntityTypeAccessor { - @Accessor("factory") - EntityType.EntityFactory factory(); -} diff --git a/1.20/src/main/resources/minecraft-data-generator.mixins.json b/1.20/src/main/resources/minecraft-data-generator.mixins.json index bb73460d..d46bf65f 100644 --- a/1.20/src/main/resources/minecraft-data-generator.mixins.json +++ b/1.20/src/main/resources/minecraft-data-generator.mixins.json @@ -4,7 +4,6 @@ "package": "dev.u9g.minecraftdatagenerator.mixin", "compatibilityLevel": "JAVA_17", "mixins": [ - "EntityTypeAccessor", "EULAMixin", "MiningToolItemAccessor", "ReadyMixin" diff --git a/1.7/src/main/java/dev/u9g/minecraftdatagenerator/mixin/BlocksMixin.java b/1.7/src/main/java/dev/u9g/minecraftdatagenerator/mixin/BlocksMixin.java deleted file mode 100644 index 5a032e42..00000000 --- a/1.7/src/main/java/dev/u9g/minecraftdatagenerator/mixin/BlocksMixin.java +++ /dev/null @@ -1,15 +0,0 @@ -package dev.u9g.minecraftdatagenerator.mixin; - -import net.minecraft.block.Blocks; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - -@Mixin(Blocks.class) -public class BlocksMixin { - @Inject(method = "", at = @At("HEAD")) - private static void doBlocksStaticCtor(CallbackInfo ci) { -// Block.setup(); - } -} diff --git a/1.7/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java b/1.7/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java index 328e52f0..d70a0299 100644 --- a/1.7/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java +++ b/1.7/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java @@ -2,7 +2,6 @@ import dev.u9g.minecraftdatagenerator.MinecraftDataGenerator; import dev.u9g.minecraftdatagenerator.util.DGU; -import net.fabricmc.loader.impl.util.SystemProperties; import net.minecraft.server.dedicated.MinecraftDedicatedServer; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; diff --git a/1.7/src/main/resources/minecraft-data-generator.mixins.json b/1.7/src/main/resources/minecraft-data-generator.mixins.json index 85658063..f4b1236d 100644 --- a/1.7/src/main/resources/minecraft-data-generator.mixins.json +++ b/1.7/src/main/resources/minecraft-data-generator.mixins.json @@ -4,7 +4,6 @@ "package": "dev.u9g.minecraftdatagenerator.mixin", "compatibilityLevel": "JAVA_17", "mixins": [ - "BlocksMixin", "ReadyMixin", "VariantBlockItemAccessor", "accessor.BiomeAccessor", diff --git a/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/generators/BiomesDataGenerator.java b/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/generators/BiomesDataGenerator.java index 8a7069e8..24ce0d6f 100644 --- a/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/generators/BiomesDataGenerator.java +++ b/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/generators/BiomesDataGenerator.java @@ -4,9 +4,7 @@ import com.google.gson.JsonObject; import dev.u9g.minecraftdatagenerator.mixin.BiomeAccessor; import dev.u9g.minecraftdatagenerator.util.Registries; -import net.minecraft.client.color.world.BiomeColors; import net.minecraft.world.biome.*; -import org.apache.commons.lang3.StringUtils; import java.util.Locale; diff --git a/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java b/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java index 4253ae69..5133d9eb 100644 --- a/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java +++ b/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java @@ -52,7 +52,7 @@ private static void createCompositeMaterialInfo(List allMaterials, mappedMaterials.stream().allMatch(it -> it.getPredicate().test(blockState)); MaterialInfo materialInfo = new MaterialInfo(compositeMaterialName, compositePredicate).includes(mappedMaterials); - allMaterials.add(0, materialInfo); + allMaterials.addFirst(materialInfo); } private static void createCompositeMaterial(Map> allMaterials, List combinedMaterials) { diff --git a/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java b/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java index d0a4bacf..585eb218 100644 --- a/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java +++ b/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java @@ -2,7 +2,6 @@ import com.google.gson.JsonArray; import com.google.gson.JsonObject; -import net.minecraft.client.sound.Sound; import net.minecraft.sound.SoundEvent; import net.minecraft.util.registry.Registry; diff --git a/buildSrc/src/main/kotlin/CustomFabricLikeMinecraftTransformer.kt b/buildSrc/src/main/kotlin/CustomFabricLikeMinecraftTransformer.kt index 7e2d9652..468b599f 100644 --- a/buildSrc/src/main/kotlin/CustomFabricLikeMinecraftTransformer.kt +++ b/buildSrc/src/main/kotlin/CustomFabricLikeMinecraftTransformer.kt @@ -5,19 +5,19 @@ import org.gradle.api.artifacts.Dependency import org.gradle.api.artifacts.ModuleDependency import org.jetbrains.annotations.ApiStatus import xyz.wagyourtail.unimined.api.mapping.MappingNamespaceTree +import xyz.wagyourtail.unimined.api.mapping.task.ExportMappingsTask import xyz.wagyourtail.unimined.api.minecraft.EnvType +import xyz.wagyourtail.unimined.api.minecraft.MinecraftJar import xyz.wagyourtail.unimined.api.minecraft.patch.ataw.AccessWidenerPatcher import xyz.wagyourtail.unimined.api.minecraft.patch.fabric.FabricLikePatcher -import xyz.wagyourtail.unimined.api.runs.RunConfig -import xyz.wagyourtail.unimined.api.mapping.task.ExportMappingsTask import xyz.wagyourtail.unimined.api.minecraft.task.RemapJarTask +import xyz.wagyourtail.unimined.api.runs.RunConfig import xyz.wagyourtail.unimined.api.unimined import xyz.wagyourtail.unimined.api.uniminedMaybe import xyz.wagyourtail.unimined.internal.mapping.ii.InterfaceInjectionMinecraftTransformer import xyz.wagyourtail.unimined.internal.mapping.task.ExportMappingsTaskImpl import xyz.wagyourtail.unimined.internal.minecraft.MinecraftProvider import xyz.wagyourtail.unimined.internal.minecraft.patch.AbstractMinecraftTransformer -import xyz.wagyourtail.unimined.api.minecraft.MinecraftJar import xyz.wagyourtail.unimined.internal.minecraft.patch.access.widener.AccessWidenerMinecraftTransformer import xyz.wagyourtail.unimined.internal.minecraft.resolver.Library import xyz.wagyourtail.unimined.internal.minecraft.transform.merge.ClassMerger diff --git a/buildSrc/src/main/kotlin/CustomFabricMinecraftTransformer.kt b/buildSrc/src/main/kotlin/CustomFabricMinecraftTransformer.kt index 0da2dc30..1da6db63 100644 --- a/buildSrc/src/main/kotlin/CustomFabricMinecraftTransformer.kt +++ b/buildSrc/src/main/kotlin/CustomFabricMinecraftTransformer.kt @@ -4,10 +4,10 @@ import com.google.gson.JsonParser import org.gradle.api.Project import org.gradle.api.artifacts.Dependency import xyz.wagyourtail.unimined.api.minecraft.EnvType +import xyz.wagyourtail.unimined.api.minecraft.MinecraftJar import xyz.wagyourtail.unimined.api.runs.RunConfig import xyz.wagyourtail.unimined.api.unimined import xyz.wagyourtail.unimined.internal.minecraft.MinecraftProvider -import xyz.wagyourtail.unimined.api.minecraft.MinecraftJar import java.io.InputStreamReader import java.nio.file.Files From 7436a6cd9f97e9000fa6d56bcd3e0b34e7c85327 Mon Sep 17 00:00:00 2001 From: AlexProgrammerDE <40795980+AlexProgrammerDE@users.noreply.github.com> Date: Thu, 2 May 2024 08:12:04 +0200 Subject: [PATCH 25/38] Remove SoundAccessors --- .../generators/InstrumentsDataGenerator.java | 3 +-- .../generators/SoundsDataGenerator.java | 3 +-- .../minecraftdatagenerator/mixin/SoundAccessor.java | 12 ------------ .../resources/minecraft-data-generator.mixins.json | 1 - .../generators/InstrumentsDataGenerator.java | 3 +-- .../generators/SoundsDataGenerator.java | 3 +-- .../minecraftdatagenerator/mixin/SoundAccessor.java | 12 ------------ .../resources/minecraft-data-generator.mixins.json | 1 - .../generators/InstrumentsDataGenerator.java | 3 +-- .../generators/SoundsDataGenerator.java | 3 +-- .../minecraftdatagenerator/mixin/SoundAccessor.java | 12 ------------ .../resources/minecraft-data-generator.mixins.json | 1 - .../generators/SoundsDataGenerator.java | 3 +-- .../minecraftdatagenerator/mixin/SoundAccessor.java | 12 ------------ .../resources/minecraft-data-generator.mixins.json | 1 - .../minecraftdatagenerator/mixin/SoundAccessor.java | 12 ------------ .../resources/minecraft-data-generator.mixins.json | 1 - .../generators/SoundsDataGenerator.java | 3 +-- .../minecraftdatagenerator/mixin/SoundAccessor.java | 12 ------------ .../resources/minecraft-data-generator.mixins.json | 1 - .../generators/SoundsDataGenerator.java | 3 +-- .../minecraftdatagenerator/mixin/SoundAccessor.java | 12 ------------ .../resources/minecraft-data-generator.mixins.json | 1 - .../generators/SoundsDataGenerator.java | 3 +-- .../minecraftdatagenerator/mixin/SoundAccessor.java | 12 ------------ .../resources/minecraft-data-generator.mixins.json | 3 +-- .../generators/SoundsDataGenerator.java | 3 +-- .../minecraftdatagenerator/mixin/SoundAccessor.java | 12 ------------ .../resources/minecraft-data-generator.mixins.json | 3 +-- .../generators/InstrumentsDataGenerator.java | 3 +-- .../generators/SoundsDataGenerator.java | 3 +-- .../minecraftdatagenerator/mixin/SoundAccessor.java | 12 ------------ .../resources/minecraft-data-generator.mixins.json | 1 - 33 files changed, 15 insertions(+), 158 deletions(-) delete mode 100644 1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/mixin/SoundAccessor.java delete mode 100644 1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/mixin/SoundAccessor.java delete mode 100644 1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/mixin/SoundAccessor.java delete mode 100644 1.13/src/main/java/dev/u9g/minecraftdatagenerator/mixin/SoundAccessor.java delete mode 100644 1.14/src/main/java/dev/u9g/minecraftdatagenerator/mixin/SoundAccessor.java delete mode 100644 1.15/src/main/java/dev/u9g/minecraftdatagenerator/mixin/SoundAccessor.java delete mode 100644 1.16/src/main/java/dev/u9g/minecraftdatagenerator/mixin/SoundAccessor.java delete mode 100644 1.17/src/main/java/dev/u9g/minecraftdatagenerator/mixin/SoundAccessor.java delete mode 100644 1.18/src/main/java/dev/u9g/minecraftdatagenerator/mixin/SoundAccessor.java delete mode 100644 1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/mixin/SoundAccessor.java diff --git a/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/InstrumentsDataGenerator.java b/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/InstrumentsDataGenerator.java index dc0692d8..dcb6c5be 100644 --- a/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/InstrumentsDataGenerator.java +++ b/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/InstrumentsDataGenerator.java @@ -4,7 +4,6 @@ import com.google.gson.JsonElement; import com.google.gson.JsonObject; import dev.u9g.minecraftdatagenerator.mixin.NoteBlockAccessor; -import dev.u9g.minecraftdatagenerator.mixin.SoundAccessor; import net.minecraft.sound.Sound; import java.util.Objects; @@ -22,7 +21,7 @@ public JsonElement generateDataJson() { for (Sound sound : Objects.requireNonNull(NoteBlockAccessor.TUNES())) { JsonObject object = new JsonObject(); object.addProperty("id", i++); - object.addProperty("name", ((SoundAccessor) sound).id().getPath().split("\\.")[2]); + object.addProperty("name", sound.getId().getPath().split("\\.")[2]); array.add(object); } return array; diff --git a/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java b/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java index 5dd1f107..88e0e8a8 100644 --- a/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java +++ b/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java @@ -2,7 +2,6 @@ import com.google.gson.JsonArray; import com.google.gson.JsonObject; -import dev.u9g.minecraftdatagenerator.mixin.SoundAccessor; import net.minecraft.sound.Sound; public class SoundsDataGenerator implements IDataGenerator { @@ -10,7 +9,7 @@ public static JsonObject generateSound(Sound soundEvent) { JsonObject soundDesc = new JsonObject(); soundDesc.addProperty("id", Sound.REGISTRY.getRawId(soundEvent)); - soundDesc.addProperty("name", ((SoundAccessor) soundEvent).id().getPath()); + soundDesc.addProperty("name", soundEvent.getId().getPath()); return soundDesc; } diff --git a/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/mixin/SoundAccessor.java b/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/mixin/SoundAccessor.java deleted file mode 100644 index d39eac0b..00000000 --- a/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/mixin/SoundAccessor.java +++ /dev/null @@ -1,12 +0,0 @@ -package dev.u9g.minecraftdatagenerator.mixin; - -import net.minecraft.sound.Sound; -import net.minecraft.util.Identifier; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.gen.Accessor; - -@Mixin(Sound.class) -public interface SoundAccessor { - @Accessor("id") - Identifier id(); -} diff --git a/1.10.2/src/main/resources/minecraft-data-generator.mixins.json b/1.10.2/src/main/resources/minecraft-data-generator.mixins.json index 7cb7a2a5..3ed82340 100644 --- a/1.10.2/src/main/resources/minecraft-data-generator.mixins.json +++ b/1.10.2/src/main/resources/minecraft-data-generator.mixins.json @@ -14,7 +14,6 @@ "MiningToolItemAccessor", "NoteBlockAccessor", "ReadyMixin", - "SoundAccessor", "StatusEffectAccessor" ], "injectors": { diff --git a/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/InstrumentsDataGenerator.java b/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/InstrumentsDataGenerator.java index dc0692d8..dcb6c5be 100644 --- a/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/InstrumentsDataGenerator.java +++ b/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/InstrumentsDataGenerator.java @@ -4,7 +4,6 @@ import com.google.gson.JsonElement; import com.google.gson.JsonObject; import dev.u9g.minecraftdatagenerator.mixin.NoteBlockAccessor; -import dev.u9g.minecraftdatagenerator.mixin.SoundAccessor; import net.minecraft.sound.Sound; import java.util.Objects; @@ -22,7 +21,7 @@ public JsonElement generateDataJson() { for (Sound sound : Objects.requireNonNull(NoteBlockAccessor.TUNES())) { JsonObject object = new JsonObject(); object.addProperty("id", i++); - object.addProperty("name", ((SoundAccessor) sound).id().getPath().split("\\.")[2]); + object.addProperty("name", sound.getId().getPath().split("\\.")[2]); array.add(object); } return array; diff --git a/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java b/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java index 5dd1f107..88e0e8a8 100644 --- a/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java +++ b/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java @@ -2,7 +2,6 @@ import com.google.gson.JsonArray; import com.google.gson.JsonObject; -import dev.u9g.minecraftdatagenerator.mixin.SoundAccessor; import net.minecraft.sound.Sound; public class SoundsDataGenerator implements IDataGenerator { @@ -10,7 +9,7 @@ public static JsonObject generateSound(Sound soundEvent) { JsonObject soundDesc = new JsonObject(); soundDesc.addProperty("id", Sound.REGISTRY.getRawId(soundEvent)); - soundDesc.addProperty("name", ((SoundAccessor) soundEvent).id().getPath()); + soundDesc.addProperty("name", soundEvent.getId().getPath()); return soundDesc; } diff --git a/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/mixin/SoundAccessor.java b/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/mixin/SoundAccessor.java deleted file mode 100644 index d39eac0b..00000000 --- a/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/mixin/SoundAccessor.java +++ /dev/null @@ -1,12 +0,0 @@ -package dev.u9g.minecraftdatagenerator.mixin; - -import net.minecraft.sound.Sound; -import net.minecraft.util.Identifier; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.gen.Accessor; - -@Mixin(Sound.class) -public interface SoundAccessor { - @Accessor("id") - Identifier id(); -} diff --git a/1.11.2/src/main/resources/minecraft-data-generator.mixins.json b/1.11.2/src/main/resources/minecraft-data-generator.mixins.json index 86922042..cd1d518d 100644 --- a/1.11.2/src/main/resources/minecraft-data-generator.mixins.json +++ b/1.11.2/src/main/resources/minecraft-data-generator.mixins.json @@ -12,7 +12,6 @@ "MiningToolItemAccessor", "NoteBlockAccessor", "ReadyMixin", - "SoundAccessor", "StatusEffectAccessor" ], "injectors": { diff --git a/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/InstrumentsDataGenerator.java b/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/InstrumentsDataGenerator.java index dc0692d8..dcb6c5be 100644 --- a/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/InstrumentsDataGenerator.java +++ b/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/InstrumentsDataGenerator.java @@ -4,7 +4,6 @@ import com.google.gson.JsonElement; import com.google.gson.JsonObject; import dev.u9g.minecraftdatagenerator.mixin.NoteBlockAccessor; -import dev.u9g.minecraftdatagenerator.mixin.SoundAccessor; import net.minecraft.sound.Sound; import java.util.Objects; @@ -22,7 +21,7 @@ public JsonElement generateDataJson() { for (Sound sound : Objects.requireNonNull(NoteBlockAccessor.TUNES())) { JsonObject object = new JsonObject(); object.addProperty("id", i++); - object.addProperty("name", ((SoundAccessor) sound).id().getPath().split("\\.")[2]); + object.addProperty("name", sound.getId().getPath().split("\\.")[2]); array.add(object); } return array; diff --git a/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java b/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java index 5dd1f107..88e0e8a8 100644 --- a/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java +++ b/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java @@ -2,7 +2,6 @@ import com.google.gson.JsonArray; import com.google.gson.JsonObject; -import dev.u9g.minecraftdatagenerator.mixin.SoundAccessor; import net.minecraft.sound.Sound; public class SoundsDataGenerator implements IDataGenerator { @@ -10,7 +9,7 @@ public static JsonObject generateSound(Sound soundEvent) { JsonObject soundDesc = new JsonObject(); soundDesc.addProperty("id", Sound.REGISTRY.getRawId(soundEvent)); - soundDesc.addProperty("name", ((SoundAccessor) soundEvent).id().getPath()); + soundDesc.addProperty("name", soundEvent.getId().getPath()); return soundDesc; } diff --git a/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/mixin/SoundAccessor.java b/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/mixin/SoundAccessor.java deleted file mode 100644 index d39eac0b..00000000 --- a/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/mixin/SoundAccessor.java +++ /dev/null @@ -1,12 +0,0 @@ -package dev.u9g.minecraftdatagenerator.mixin; - -import net.minecraft.sound.Sound; -import net.minecraft.util.Identifier; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.gen.Accessor; - -@Mixin(Sound.class) -public interface SoundAccessor { - @Accessor("id") - Identifier id(); -} diff --git a/1.12.2/src/main/resources/minecraft-data-generator.mixins.json b/1.12.2/src/main/resources/minecraft-data-generator.mixins.json index 86922042..cd1d518d 100644 --- a/1.12.2/src/main/resources/minecraft-data-generator.mixins.json +++ b/1.12.2/src/main/resources/minecraft-data-generator.mixins.json @@ -12,7 +12,6 @@ "MiningToolItemAccessor", "NoteBlockAccessor", "ReadyMixin", - "SoundAccessor", "StatusEffectAccessor" ], "injectors": { diff --git a/1.13/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java b/1.13/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java index d8295e8b..9fe0343f 100644 --- a/1.13/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java +++ b/1.13/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java @@ -2,7 +2,6 @@ import com.google.gson.JsonArray; import com.google.gson.JsonObject; -import dev.u9g.minecraftdatagenerator.mixin.SoundAccessor; import net.minecraft.sound.Sound; import net.minecraft.util.registry.Registry; @@ -11,7 +10,7 @@ public static JsonObject generateSound(Registry registry, Sound soundEven JsonObject soundDesc = new JsonObject(); soundDesc.addProperty("id", registry.getRawId(soundEvent)); - soundDesc.addProperty("name", ((SoundAccessor) soundEvent).id().getPath()); + soundDesc.addProperty("name", soundEvent.getId().getPath()); return soundDesc; } diff --git a/1.13/src/main/java/dev/u9g/minecraftdatagenerator/mixin/SoundAccessor.java b/1.13/src/main/java/dev/u9g/minecraftdatagenerator/mixin/SoundAccessor.java deleted file mode 100644 index d39eac0b..00000000 --- a/1.13/src/main/java/dev/u9g/minecraftdatagenerator/mixin/SoundAccessor.java +++ /dev/null @@ -1,12 +0,0 @@ -package dev.u9g.minecraftdatagenerator.mixin; - -import net.minecraft.sound.Sound; -import net.minecraft.util.Identifier; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.gen.Accessor; - -@Mixin(Sound.class) -public interface SoundAccessor { - @Accessor("id") - Identifier id(); -} diff --git a/1.13/src/main/resources/minecraft-data-generator.mixins.json b/1.13/src/main/resources/minecraft-data-generator.mixins.json index 353587a2..12957a17 100644 --- a/1.13/src/main/resources/minecraft-data-generator.mixins.json +++ b/1.13/src/main/resources/minecraft-data-generator.mixins.json @@ -6,7 +6,6 @@ "mixins": [ "MiningToolItemAccessor", "ReadyMixin", - "SoundAccessor", "StatusEffectAccessor" ], "injectors": { diff --git a/1.14/src/main/java/dev/u9g/minecraftdatagenerator/mixin/SoundAccessor.java b/1.14/src/main/java/dev/u9g/minecraftdatagenerator/mixin/SoundAccessor.java deleted file mode 100644 index 04755805..00000000 --- a/1.14/src/main/java/dev/u9g/minecraftdatagenerator/mixin/SoundAccessor.java +++ /dev/null @@ -1,12 +0,0 @@ -package dev.u9g.minecraftdatagenerator.mixin; - -import net.minecraft.client.sound.Sound; -import net.minecraft.util.Identifier; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.gen.Accessor; - -@Mixin(Sound.class) -public interface SoundAccessor { - @Accessor("id") - Identifier id(); -} diff --git a/1.14/src/main/resources/minecraft-data-generator.mixins.json b/1.14/src/main/resources/minecraft-data-generator.mixins.json index 1024905e..ea255f59 100644 --- a/1.14/src/main/resources/minecraft-data-generator.mixins.json +++ b/1.14/src/main/resources/minecraft-data-generator.mixins.json @@ -6,7 +6,6 @@ "mixins": [ "MiningToolItemAccessor", "ReadyMixin", - "SoundAccessor", "StatusEffectAccessor" ], "client": [ diff --git a/1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java b/1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java index d4209586..585eb218 100644 --- a/1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java +++ b/1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java @@ -2,7 +2,6 @@ import com.google.gson.JsonArray; import com.google.gson.JsonObject; -import dev.u9g.minecraftdatagenerator.mixin.SoundAccessor; import net.minecraft.sound.SoundEvent; import net.minecraft.util.registry.Registry; @@ -11,7 +10,7 @@ public static JsonObject generateSound(SoundEvent soundEvent) { JsonObject soundDesc = new JsonObject(); soundDesc.addProperty("id", Registry.SOUND_EVENT.getRawId(soundEvent)); - soundDesc.addProperty("name", ((SoundAccessor) soundEvent).id().getPath()); + soundDesc.addProperty("name", soundEvent.getId().getPath()); return soundDesc; } diff --git a/1.15/src/main/java/dev/u9g/minecraftdatagenerator/mixin/SoundAccessor.java b/1.15/src/main/java/dev/u9g/minecraftdatagenerator/mixin/SoundAccessor.java deleted file mode 100644 index 04755805..00000000 --- a/1.15/src/main/java/dev/u9g/minecraftdatagenerator/mixin/SoundAccessor.java +++ /dev/null @@ -1,12 +0,0 @@ -package dev.u9g.minecraftdatagenerator.mixin; - -import net.minecraft.client.sound.Sound; -import net.minecraft.util.Identifier; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.gen.Accessor; - -@Mixin(Sound.class) -public interface SoundAccessor { - @Accessor("id") - Identifier id(); -} diff --git a/1.15/src/main/resources/minecraft-data-generator.mixins.json b/1.15/src/main/resources/minecraft-data-generator.mixins.json index 1024905e..ea255f59 100644 --- a/1.15/src/main/resources/minecraft-data-generator.mixins.json +++ b/1.15/src/main/resources/minecraft-data-generator.mixins.json @@ -6,7 +6,6 @@ "mixins": [ "MiningToolItemAccessor", "ReadyMixin", - "SoundAccessor", "StatusEffectAccessor" ], "client": [ diff --git a/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java b/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java index d4209586..585eb218 100644 --- a/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java +++ b/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java @@ -2,7 +2,6 @@ import com.google.gson.JsonArray; import com.google.gson.JsonObject; -import dev.u9g.minecraftdatagenerator.mixin.SoundAccessor; import net.minecraft.sound.SoundEvent; import net.minecraft.util.registry.Registry; @@ -11,7 +10,7 @@ public static JsonObject generateSound(SoundEvent soundEvent) { JsonObject soundDesc = new JsonObject(); soundDesc.addProperty("id", Registry.SOUND_EVENT.getRawId(soundEvent)); - soundDesc.addProperty("name", ((SoundAccessor) soundEvent).id().getPath()); + soundDesc.addProperty("name", soundEvent.getId().getPath()); return soundDesc; } diff --git a/1.16/src/main/java/dev/u9g/minecraftdatagenerator/mixin/SoundAccessor.java b/1.16/src/main/java/dev/u9g/minecraftdatagenerator/mixin/SoundAccessor.java deleted file mode 100644 index 04755805..00000000 --- a/1.16/src/main/java/dev/u9g/minecraftdatagenerator/mixin/SoundAccessor.java +++ /dev/null @@ -1,12 +0,0 @@ -package dev.u9g.minecraftdatagenerator.mixin; - -import net.minecraft.client.sound.Sound; -import net.minecraft.util.Identifier; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.gen.Accessor; - -@Mixin(Sound.class) -public interface SoundAccessor { - @Accessor("id") - Identifier id(); -} diff --git a/1.16/src/main/resources/minecraft-data-generator.mixins.json b/1.16/src/main/resources/minecraft-data-generator.mixins.json index 95ede1ce..7154c902 100644 --- a/1.16/src/main/resources/minecraft-data-generator.mixins.json +++ b/1.16/src/main/resources/minecraft-data-generator.mixins.json @@ -8,7 +8,6 @@ "EULAMixin", "MiningToolItemAccessor", "ReadyMixin", - "SoundAccessor", "StatusEffectAccessor" ], "client": [ diff --git a/1.17/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java b/1.17/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java index d4209586..585eb218 100644 --- a/1.17/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java +++ b/1.17/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java @@ -2,7 +2,6 @@ import com.google.gson.JsonArray; import com.google.gson.JsonObject; -import dev.u9g.minecraftdatagenerator.mixin.SoundAccessor; import net.minecraft.sound.SoundEvent; import net.minecraft.util.registry.Registry; @@ -11,7 +10,7 @@ public static JsonObject generateSound(SoundEvent soundEvent) { JsonObject soundDesc = new JsonObject(); soundDesc.addProperty("id", Registry.SOUND_EVENT.getRawId(soundEvent)); - soundDesc.addProperty("name", ((SoundAccessor) soundEvent).id().getPath()); + soundDesc.addProperty("name", soundEvent.getId().getPath()); return soundDesc; } diff --git a/1.17/src/main/java/dev/u9g/minecraftdatagenerator/mixin/SoundAccessor.java b/1.17/src/main/java/dev/u9g/minecraftdatagenerator/mixin/SoundAccessor.java deleted file mode 100644 index 04755805..00000000 --- a/1.17/src/main/java/dev/u9g/minecraftdatagenerator/mixin/SoundAccessor.java +++ /dev/null @@ -1,12 +0,0 @@ -package dev.u9g.minecraftdatagenerator.mixin; - -import net.minecraft.client.sound.Sound; -import net.minecraft.util.Identifier; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.gen.Accessor; - -@Mixin(Sound.class) -public interface SoundAccessor { - @Accessor("id") - Identifier id(); -} diff --git a/1.17/src/main/resources/minecraft-data-generator.mixins.json b/1.17/src/main/resources/minecraft-data-generator.mixins.json index 4cd5b4b9..b8f9bb32 100644 --- a/1.17/src/main/resources/minecraft-data-generator.mixins.json +++ b/1.17/src/main/resources/minecraft-data-generator.mixins.json @@ -5,8 +5,7 @@ "compatibilityLevel": "JAVA_17", "mixins": [ "MiningToolItemAccessor", - "ReadyMixin", - "SoundAccessor" + "ReadyMixin" ], "client": [ ], diff --git a/1.18/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java b/1.18/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java index d4209586..585eb218 100644 --- a/1.18/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java +++ b/1.18/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java @@ -2,7 +2,6 @@ import com.google.gson.JsonArray; import com.google.gson.JsonObject; -import dev.u9g.minecraftdatagenerator.mixin.SoundAccessor; import net.minecraft.sound.SoundEvent; import net.minecraft.util.registry.Registry; @@ -11,7 +10,7 @@ public static JsonObject generateSound(SoundEvent soundEvent) { JsonObject soundDesc = new JsonObject(); soundDesc.addProperty("id", Registry.SOUND_EVENT.getRawId(soundEvent)); - soundDesc.addProperty("name", ((SoundAccessor) soundEvent).id().getPath()); + soundDesc.addProperty("name", soundEvent.getId().getPath()); return soundDesc; } diff --git a/1.18/src/main/java/dev/u9g/minecraftdatagenerator/mixin/SoundAccessor.java b/1.18/src/main/java/dev/u9g/minecraftdatagenerator/mixin/SoundAccessor.java deleted file mode 100644 index 04755805..00000000 --- a/1.18/src/main/java/dev/u9g/minecraftdatagenerator/mixin/SoundAccessor.java +++ /dev/null @@ -1,12 +0,0 @@ -package dev.u9g.minecraftdatagenerator.mixin; - -import net.minecraft.client.sound.Sound; -import net.minecraft.util.Identifier; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.gen.Accessor; - -@Mixin(Sound.class) -public interface SoundAccessor { - @Accessor("id") - Identifier id(); -} diff --git a/1.18/src/main/resources/minecraft-data-generator.mixins.json b/1.18/src/main/resources/minecraft-data-generator.mixins.json index bbfb664c..d46bf65f 100644 --- a/1.18/src/main/resources/minecraft-data-generator.mixins.json +++ b/1.18/src/main/resources/minecraft-data-generator.mixins.json @@ -6,8 +6,7 @@ "mixins": [ "EULAMixin", "MiningToolItemAccessor", - "ReadyMixin", - "SoundAccessor" + "ReadyMixin" ], "client": [ ], diff --git a/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/InstrumentsDataGenerator.java b/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/InstrumentsDataGenerator.java index dc0692d8..dcb6c5be 100644 --- a/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/InstrumentsDataGenerator.java +++ b/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/InstrumentsDataGenerator.java @@ -4,7 +4,6 @@ import com.google.gson.JsonElement; import com.google.gson.JsonObject; import dev.u9g.minecraftdatagenerator.mixin.NoteBlockAccessor; -import dev.u9g.minecraftdatagenerator.mixin.SoundAccessor; import net.minecraft.sound.Sound; import java.util.Objects; @@ -22,7 +21,7 @@ public JsonElement generateDataJson() { for (Sound sound : Objects.requireNonNull(NoteBlockAccessor.TUNES())) { JsonObject object = new JsonObject(); object.addProperty("id", i++); - object.addProperty("name", ((SoundAccessor) sound).id().getPath().split("\\.")[2]); + object.addProperty("name", sound.getId().getPath().split("\\.")[2]); array.add(object); } return array; diff --git a/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java b/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java index 5dd1f107..88e0e8a8 100644 --- a/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java +++ b/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/SoundsDataGenerator.java @@ -2,7 +2,6 @@ import com.google.gson.JsonArray; import com.google.gson.JsonObject; -import dev.u9g.minecraftdatagenerator.mixin.SoundAccessor; import net.minecraft.sound.Sound; public class SoundsDataGenerator implements IDataGenerator { @@ -10,7 +9,7 @@ public static JsonObject generateSound(Sound soundEvent) { JsonObject soundDesc = new JsonObject(); soundDesc.addProperty("id", Sound.REGISTRY.getRawId(soundEvent)); - soundDesc.addProperty("name", ((SoundAccessor) soundEvent).id().getPath()); + soundDesc.addProperty("name", soundEvent.getId().getPath()); return soundDesc; } diff --git a/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/mixin/SoundAccessor.java b/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/mixin/SoundAccessor.java deleted file mode 100644 index d39eac0b..00000000 --- a/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/mixin/SoundAccessor.java +++ /dev/null @@ -1,12 +0,0 @@ -package dev.u9g.minecraftdatagenerator.mixin; - -import net.minecraft.sound.Sound; -import net.minecraft.util.Identifier; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.gen.Accessor; - -@Mixin(Sound.class) -public interface SoundAccessor { - @Accessor("id") - Identifier id(); -} diff --git a/1.9.4/src/main/resources/minecraft-data-generator.mixins.json b/1.9.4/src/main/resources/minecraft-data-generator.mixins.json index 7cb7a2a5..3ed82340 100644 --- a/1.9.4/src/main/resources/minecraft-data-generator.mixins.json +++ b/1.9.4/src/main/resources/minecraft-data-generator.mixins.json @@ -14,7 +14,6 @@ "MiningToolItemAccessor", "NoteBlockAccessor", "ReadyMixin", - "SoundAccessor", "StatusEffectAccessor" ], "injectors": { From e72cea8df7bd4f9cb55dc56ece3ee663e6b5268f Mon Sep 17 00:00:00 2001 From: AlexProgrammerDE <40795980+AlexProgrammerDE@users.noreply.github.com> Date: Thu, 2 May 2024 08:34:50 +0200 Subject: [PATCH 26/38] More cleanup --- .../generators/BlocksDataGenerator.java | 8 +++---- .../generators/BlocksDataGenerator.java | 9 ++++---- .../generators/EntitiesDataGenerator.java | 20 ++++++------------ .../generators/BlocksDataGenerator.java | 9 ++++---- .../generators/EntitiesDataGenerator.java | 20 ++++++------------ .../generators/BlocksDataGenerator.java | 9 ++++---- .../generators/EntitiesDataGenerator.java | 21 ++++++------------- .../generators/BlocksDataGenerator.java | 8 +++---- .../generators/BlocksDataGenerator.java | 8 +++---- .../generators/BlocksDataGenerator.java | 8 +++---- .../generators/BlocksDataGenerator.java | 8 +++---- .../generators/BlocksDataGenerator.java | 11 +++++----- .../generators/BlocksDataGenerator.java | 11 +++++----- .../generators/BlocksDataGenerator.java | 9 ++++---- .../generators/EntitiesDataGenerator.java | 21 ++++++------------- 15 files changed, 70 insertions(+), 110 deletions(-) diff --git a/1.13/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java b/1.13/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java index 83642819..97ed20c7 100644 --- a/1.13/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java +++ b/1.13/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java @@ -76,16 +76,16 @@ private static > JsonObject generateStateProperty(Proper return propertyObject; } - public static JsonObject generateBlock(Registry blockRegistry, Block block) { + public static JsonObject generateBlock(Block block) { JsonObject blockDesc = new JsonObject(); List blockStates = block.getStateManager().getBlockStates(); BlockState defaultState = block.getDefaultState(); - Identifier registryKey = blockRegistry.getId(block); + Identifier registryKey = Registry.BLOCK.getId(block); String localizationKey = block.getTranslationKey(); List effectiveTools = getItemsEffectiveForBlock(block); - blockDesc.addProperty("id", blockRegistry.getRawId(block)); + blockDesc.addProperty("id", Registry.BLOCK.getRawId(block)); blockDesc.addProperty("name", Objects.requireNonNull(registryKey).getPath()); blockDesc.addProperty("displayName", DGU.translateText(localizationKey)); @@ -131,7 +131,7 @@ public JsonArray generateDataJson() { JsonArray resultBlocksArray = new JsonArray(); Registry blockRegistry = Registry.BLOCK; for (Block block : (Iterable) blockRegistry) { - resultBlocksArray.add(generateBlock(blockRegistry, block)); + resultBlocksArray.add(generateBlock(block)); } return resultBlocksArray; } diff --git a/1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java b/1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java index 1c2ac0dc..e30871ec 100644 --- a/1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java +++ b/1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java @@ -85,16 +85,16 @@ private static > JsonObject generateStateProperty(Proper return propertyObject; } - public static JsonObject generateBlock(Registry blockRegistry, Block block) { + public static JsonObject generateBlock(Block block) { JsonObject blockDesc = new JsonObject(); List blockStates = block.getStateFactory().getStates(); BlockState defaultState = block.getDefaultState(); - Identifier registryKey = blockRegistry.getId(block); + Identifier registryKey = Registry.BLOCK.getId(block); String localizationKey = block.getTranslationKey(); List effectiveTools = getItemsEffectiveForBlock(block); - blockDesc.addProperty("id", blockRegistry.getRawId(block)); + blockDesc.addProperty("id", Registry.BLOCK.getRawId(block)); blockDesc.addProperty("name", Objects.requireNonNull(registryKey).getPath()); blockDesc.addProperty("displayName", DGU.translateText(localizationKey)); @@ -144,9 +144,8 @@ public String getDataName() { @Override public JsonArray generateDataJson() { JsonArray resultBlocksArray = new JsonArray(); - Registry blockRegistry = Registry.BLOCK; - blockRegistry.forEach(block -> resultBlocksArray.add(generateBlock(blockRegistry, block))); + Registry.BLOCK.forEach(block -> resultBlocksArray.add(generateBlock(block))); return resultBlocksArray; } } diff --git a/1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java b/1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java index 73c112a7..f14df2c6 100644 --- a/1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java +++ b/1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java @@ -2,7 +2,6 @@ import com.google.gson.JsonArray; import com.google.gson.JsonObject; -import com.google.gson.reflect.TypeToken; import dev.u9g.minecraftdatagenerator.util.DGU; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityType; @@ -18,7 +17,6 @@ import net.minecraft.util.registry.Registry; import org.jetbrains.annotations.NotNull; -import java.lang.reflect.ParameterizedType; import java.util.Objects; public class EntitiesDataGenerator implements IDataGenerator { @@ -46,17 +44,11 @@ public static JsonObject generateEntity(Registry> entityRegistry, private static String getCategoryFrom(@NotNull EntityType entityType) { if (entityType == EntityType.PLAYER) return "other"; // fail early for player entities - Class entityClazz = null; - try { - for (var field : EntityType.class.getFields()) - if (entityType == field.get(EntityType.class)) - entityClazz = (Class) ((ParameterizedType) TypeToken.get(field.getGenericType()).getType()).getActualTypeArguments()[0]; - } catch (Exception e) { - e.printStackTrace(); - throw new RuntimeException(e); - } - if (entityClazz == null) throw new RuntimeException("Shouldn't be null..."); - return switch (entityClazz.getPackageName()) { + Entity entity = entityType.create(DGU.getWorld()); + if (entity == null) + throw new Error("Entity was null after trying to create a: " + DGU.translateText(entityType.getTranslationKey())); + entity.remove(); + return switch (entity.getClass().getPackageName()) { case "net.minecraft.entity.decoration", "net.minecraft.entity.decoration.painting" -> "Immobile"; case "net.minecraft.entity.boss", "net.minecraft.entity.mob", "net.minecraft.entity.boss.dragon" -> "Hostile mobs"; @@ -64,7 +56,7 @@ private static String getCategoryFrom(@NotNull EntityType entityType) { case "net.minecraft.entity.passive" -> "Passive mobs"; case "net.minecraft.entity.vehicle" -> "Vehicles"; case "net.minecraft.entity" -> "other"; - default -> throw new Error("Unexpected entity type: " + entityClazz.getPackageName()); + default -> throw new Error("Unexpected entity type: " + entity.getClass().getPackageName()); }; } diff --git a/1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java b/1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java index c48ce6e0..6d056d75 100644 --- a/1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java +++ b/1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java @@ -80,16 +80,16 @@ private static > JsonObject generateStateProperty(Proper return propertyObject; } - public static JsonObject generateBlock(Registry blockRegistry, Block block) { + public static JsonObject generateBlock(Block block) { JsonObject blockDesc = new JsonObject(); List blockStates = block.getStateManager().getStates(); BlockState defaultState = block.getDefaultState(); - Identifier registryKey = blockRegistry.getId(block); + Identifier registryKey = Registry.BLOCK.getId(block); String localizationKey = block.getTranslationKey(); List effectiveTools = getItemsEffectiveForBlock(block); - blockDesc.addProperty("id", blockRegistry.getRawId(block)); + blockDesc.addProperty("id", Registry.BLOCK.getRawId(block)); blockDesc.addProperty("name", registryKey.getPath()); blockDesc.addProperty("displayName", DGU.translateText(localizationKey)); @@ -139,9 +139,8 @@ public String getDataName() { @Override public JsonArray generateDataJson() { JsonArray resultBlocksArray = new JsonArray(); - Registry blockRegistry = Registry.BLOCK; - blockRegistry.forEach(block -> resultBlocksArray.add(generateBlock(blockRegistry, block))); + Registry.BLOCK.forEach(block -> resultBlocksArray.add(generateBlock(block))); return resultBlocksArray; } } diff --git a/1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java b/1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java index 60b18864..0f052253 100644 --- a/1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java +++ b/1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java @@ -2,7 +2,6 @@ import com.google.gson.JsonArray; import com.google.gson.JsonObject; -import com.google.gson.reflect.TypeToken; import dev.u9g.minecraftdatagenerator.util.DGU; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityType; @@ -18,7 +17,6 @@ import net.minecraft.util.registry.Registry; import org.jetbrains.annotations.NotNull; -import java.lang.reflect.ParameterizedType; import java.util.Objects; public class EntitiesDataGenerator implements IDataGenerator { @@ -46,17 +44,11 @@ public static JsonObject generateEntity(Registry> entityRegistry, private static String getCategoryFrom(@NotNull EntityType entityType) { if (entityType == EntityType.PLAYER) return "other"; // fail early for player entities - Class entityClazz = null; - try { - for (var field : EntityType.class.getFields()) - if (entityType == field.get(EntityType.class)) - entityClazz = (Class) ((ParameterizedType) TypeToken.get(field.getGenericType()).getType()).getActualTypeArguments()[0]; - } catch (Exception e) { - e.printStackTrace(); - throw new RuntimeException(e); - } - if (entityClazz == null) throw new RuntimeException("Shouldn't be null..."); - return switch (entityClazz.getPackageName()) { + Entity entity = entityType.create(DGU.getWorld()); + if (entity == null) + throw new Error("Entity was null after trying to create a: " + DGU.translateText(entityType.getTranslationKey())); + entity.remove(); + return switch (entity.getClass().getPackageName()) { case "net.minecraft.entity.decoration", "net.minecraft.entity.decoration.painting" -> "Immobile"; case "net.minecraft.entity.boss", "net.minecraft.entity.mob", "net.minecraft.entity.boss.dragon" -> "Hostile mobs"; @@ -65,7 +57,7 @@ private static String getCategoryFrom(@NotNull EntityType entityType) { case "net.minecraft.entity.passive" -> "Passive mobs"; case "net.minecraft.entity.vehicle" -> "Vehicles"; case "net.minecraft.entity" -> "other"; - default -> throw new Error("Unexpected entity type: " + entityClazz.getPackageName()); + default -> throw new Error("Unexpected entity type: " + entity.getClass().getPackageName()); }; } diff --git a/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java b/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java index f470c0ec..2eba27c3 100644 --- a/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java +++ b/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java @@ -87,16 +87,16 @@ private static > JsonObject generateStateProperty(Proper return propertyObject; } - public static JsonObject generateBlock(Registry blockRegistry, Block block) { + public static JsonObject generateBlock(Block block) { JsonObject blockDesc = new JsonObject(); List blockStates = block.getStateManager().getStates(); BlockState defaultState = block.getDefaultState(); - Identifier registryKey = blockRegistry.getKey(block).orElseThrow().getValue(); + Identifier registryKey = Registry.BLOCK.getKey(block).orElseThrow().getValue(); String localizationKey = block.getTranslationKey(); List effectiveTools = getItemsEffectiveForBlock(block); - blockDesc.addProperty("id", blockRegistry.getRawId(block)); + blockDesc.addProperty("id", Registry.BLOCK.getRawId(block)); blockDesc.addProperty("name", registryKey.getPath()); blockDesc.addProperty("displayName", DGU.translateText(localizationKey)); @@ -146,9 +146,8 @@ public String getDataName() { @Override public JsonArray generateDataJson() { JsonArray resultBlocksArray = new JsonArray(); - Registry blockRegistry = Registry.BLOCK; - blockRegistry.forEach(block -> resultBlocksArray.add(generateBlock(blockRegistry, block))); + Registry.BLOCK.forEach(block -> resultBlocksArray.add(generateBlock(block))); return resultBlocksArray; } } diff --git a/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java b/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java index 1a6c3ea1..207ee737 100644 --- a/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java +++ b/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java @@ -2,7 +2,6 @@ import com.google.gson.JsonArray; import com.google.gson.JsonObject; -import com.google.gson.reflect.TypeToken; import dev.u9g.minecraftdatagenerator.util.DGU; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityType; @@ -19,8 +18,6 @@ import net.minecraft.util.registry.Registry; import org.jetbrains.annotations.NotNull; -import java.lang.reflect.ParameterizedType; - public class EntitiesDataGenerator implements IDataGenerator { public static JsonObject generateEntity(Registry> entityRegistry, EntityType entityType) { JsonObject entityDesc = new JsonObject(); @@ -47,17 +44,11 @@ public static JsonObject generateEntity(Registry> entityRegistry, private static String getCategoryFrom(@NotNull EntityType entityType) { if (entityType == EntityType.PLAYER) return "other"; // fail early for player entities - Class entityClazz = null; - try { - for (var field : EntityType.class.getFields()) - if (entityType == field.get(EntityType.class)) - entityClazz = (Class) ((ParameterizedType) TypeToken.get(field.getGenericType()).getType()).getActualTypeArguments()[0]; - } catch (Exception e) { - e.printStackTrace(); - throw new RuntimeException(e); - } - if (entityClazz == null) throw new RuntimeException("Shouldn't be null..."); - return switch (entityClazz.getPackageName()) { + Entity entity = entityType.create(DGU.getWorld()); + if (entity == null) + throw new Error("Entity was null after trying to create a: " + DGU.translateText(entityType.getTranslationKey())); + entity.remove(); + return switch (entity.getClass().getPackageName()) { case "net.minecraft.entity.decoration", "net.minecraft.entity.decoration.painting" -> "Immobile"; case "net.minecraft.entity.boss", "net.minecraft.entity.mob", "net.minecraft.entity.boss.dragon" -> "Hostile mobs"; @@ -65,7 +56,7 @@ private static String getCategoryFrom(@NotNull EntityType entityType) { case "net.minecraft.entity.passive" -> "Passive mobs"; case "net.minecraft.entity.vehicle" -> "Vehicles"; case "net.minecraft.entity" -> "other"; - default -> throw new Error("Unexpected entity type: " + entityClazz.getPackageName()); + default -> throw new Error("Unexpected entity type: " + entity.getClass().getPackageName()); }; } diff --git a/1.17/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java b/1.17/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java index 9280f7bf..cb407427 100644 --- a/1.17/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java +++ b/1.17/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java @@ -118,16 +118,16 @@ private static String findMatchingBlockMaterial(BlockState blockState, List blockRegistry, List materials, Block block) { + public static JsonObject generateBlock(List materials, Block block) { JsonObject blockDesc = new JsonObject(); List blockStates = block.getStateManager().getStates(); BlockState defaultState = block.getDefaultState(); - Identifier registryKey = blockRegistry.getKey(block).orElseThrow().getValue(); + Identifier registryKey = Registry.BLOCK.getKey(block).orElseThrow().getValue(); String localizationKey = block.getTranslationKey(); List effectiveTools = getItemsEffectiveForBlock(defaultState); - blockDesc.addProperty("id", blockRegistry.getRawId(block)); + blockDesc.addProperty("id", Registry.BLOCK.getRawId(block)); blockDesc.addProperty("name", registryKey.getPath()); blockDesc.addProperty("displayName", DGU.translateText(localizationKey)); @@ -192,7 +192,7 @@ public JsonArray generateDataJson() { Registry blockRegistry = Registry.BLOCK; List availableMaterials = MaterialsDataGenerator.getGlobalMaterialInfo(); - blockRegistry.forEach(block -> resultBlocksArray.add(generateBlock(blockRegistry, availableMaterials, block))); + blockRegistry.forEach(block -> resultBlocksArray.add(generateBlock(availableMaterials, block))); return resultBlocksArray; } } diff --git a/1.18/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java b/1.18/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java index 43b2b364..077937eb 100644 --- a/1.18/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java +++ b/1.18/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java @@ -117,16 +117,16 @@ private static String findMatchingBlockMaterial(BlockState blockState, List blockRegistry, List materials, Block block) { + public static JsonObject generateBlock(List materials, Block block) { JsonObject blockDesc = new JsonObject(); List blockStates = block.getStateManager().getStates(); BlockState defaultState = block.getDefaultState(); - Identifier registryKey = blockRegistry.getKey(block).orElseThrow().getValue(); + Identifier registryKey = Registry.BLOCK.getKey(block).orElseThrow().getValue(); String localizationKey = block.getTranslationKey(); List effectiveTools = getItemsEffectiveForBlock(defaultState); - blockDesc.addProperty("id", blockRegistry.getRawId(block)); + blockDesc.addProperty("id", Registry.BLOCK.getRawId(block)); blockDesc.addProperty("displayName", DGU.translateText(localizationKey)); blockDesc.addProperty("name", registryKey.getPath()); blockDesc.addProperty("hardness", block.getHardness()); @@ -184,7 +184,7 @@ public JsonArray generateDataJson() { Registry blockRegistry = Registry.BLOCK; List availableMaterials = MaterialsDataGenerator.getGlobalMaterialInfo(); - blockRegistry.forEach(block -> resultBlocksArray.add(generateBlock(blockRegistry, availableMaterials, block))); + blockRegistry.forEach(block -> resultBlocksArray.add(generateBlock(availableMaterials, block))); return resultBlocksArray; } } diff --git a/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java b/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java index 9280f7bf..cb407427 100644 --- a/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java +++ b/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java @@ -118,16 +118,16 @@ private static String findMatchingBlockMaterial(BlockState blockState, List blockRegistry, List materials, Block block) { + public static JsonObject generateBlock(List materials, Block block) { JsonObject blockDesc = new JsonObject(); List blockStates = block.getStateManager().getStates(); BlockState defaultState = block.getDefaultState(); - Identifier registryKey = blockRegistry.getKey(block).orElseThrow().getValue(); + Identifier registryKey = Registry.BLOCK.getKey(block).orElseThrow().getValue(); String localizationKey = block.getTranslationKey(); List effectiveTools = getItemsEffectiveForBlock(defaultState); - blockDesc.addProperty("id", blockRegistry.getRawId(block)); + blockDesc.addProperty("id", Registry.BLOCK.getRawId(block)); blockDesc.addProperty("name", registryKey.getPath()); blockDesc.addProperty("displayName", DGU.translateText(localizationKey)); @@ -192,7 +192,7 @@ public JsonArray generateDataJson() { Registry blockRegistry = Registry.BLOCK; List availableMaterials = MaterialsDataGenerator.getGlobalMaterialInfo(); - blockRegistry.forEach(block -> resultBlocksArray.add(generateBlock(blockRegistry, availableMaterials, block))); + blockRegistry.forEach(block -> resultBlocksArray.add(generateBlock(availableMaterials, block))); return resultBlocksArray; } } diff --git a/1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java b/1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java index 9280f7bf..cb407427 100644 --- a/1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java +++ b/1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java @@ -118,16 +118,16 @@ private static String findMatchingBlockMaterial(BlockState blockState, List blockRegistry, List materials, Block block) { + public static JsonObject generateBlock(List materials, Block block) { JsonObject blockDesc = new JsonObject(); List blockStates = block.getStateManager().getStates(); BlockState defaultState = block.getDefaultState(); - Identifier registryKey = blockRegistry.getKey(block).orElseThrow().getValue(); + Identifier registryKey = Registry.BLOCK.getKey(block).orElseThrow().getValue(); String localizationKey = block.getTranslationKey(); List effectiveTools = getItemsEffectiveForBlock(defaultState); - blockDesc.addProperty("id", blockRegistry.getRawId(block)); + blockDesc.addProperty("id", Registry.BLOCK.getRawId(block)); blockDesc.addProperty("name", registryKey.getPath()); blockDesc.addProperty("displayName", DGU.translateText(localizationKey)); @@ -192,7 +192,7 @@ public JsonArray generateDataJson() { Registry blockRegistry = Registry.BLOCK; List availableMaterials = MaterialsDataGenerator.getGlobalMaterialInfo(); - blockRegistry.forEach(block -> resultBlocksArray.add(generateBlock(blockRegistry, availableMaterials, block))); + blockRegistry.forEach(block -> resultBlocksArray.add(generateBlock(availableMaterials, block))); return resultBlocksArray; } } diff --git a/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java b/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java index c5ec58d1..324b4d90 100644 --- a/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java +++ b/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java @@ -12,7 +12,7 @@ import net.minecraft.item.Items; import net.minecraft.loot.context.LootContextParameterSet; import net.minecraft.loot.context.LootContextParameters; -import net.minecraft.registry.Registry; +import net.minecraft.registry.Registries; import net.minecraft.registry.RegistryKeys; import net.minecraft.server.MinecraftServer; import net.minecraft.server.world.ServerWorld; @@ -118,16 +118,16 @@ private static String findMatchingBlockMaterial(BlockState blockState, List blockRegistry, List materials, Block block) { + public static JsonObject generateBlock(List materials, Block block) { JsonObject blockDesc = new JsonObject(); List blockStates = block.getStateManager().getStates(); BlockState defaultState = block.getDefaultState(); - Identifier registryKey = blockRegistry.getKey(block).orElseThrow().getValue(); + Identifier registryKey = Registries.BLOCK.getKey(block).orElseThrow().getValue(); String localizationKey = block.getTranslationKey(); List effectiveTools = getItemsEffectiveForBlock(defaultState); - blockDesc.addProperty("id", blockRegistry.getRawId(block)); + blockDesc.addProperty("id", Registries.BLOCK.getRawId(block)); blockDesc.addProperty("name", registryKey.getPath()); blockDesc.addProperty("displayName", DGU.translateText(localizationKey)); @@ -189,10 +189,9 @@ public String getDataName() { @Override public JsonArray generateDataJson() { JsonArray resultBlocksArray = new JsonArray(); - Registry blockRegistry = DGU.getWorld().getRegistryManager().get(RegistryKeys.BLOCK); List availableMaterials = MaterialsDataGenerator.getGlobalMaterialInfo(); - blockRegistry.forEach(block -> resultBlocksArray.add(generateBlock(blockRegistry, availableMaterials, block))); + Registries.BLOCK.forEach(block -> resultBlocksArray.add(generateBlock(availableMaterials, block))); return resultBlocksArray; } } diff --git a/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java b/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java index c5ec58d1..324b4d90 100644 --- a/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java +++ b/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java @@ -12,7 +12,7 @@ import net.minecraft.item.Items; import net.minecraft.loot.context.LootContextParameterSet; import net.minecraft.loot.context.LootContextParameters; -import net.minecraft.registry.Registry; +import net.minecraft.registry.Registries; import net.minecraft.registry.RegistryKeys; import net.minecraft.server.MinecraftServer; import net.minecraft.server.world.ServerWorld; @@ -118,16 +118,16 @@ private static String findMatchingBlockMaterial(BlockState blockState, List blockRegistry, List materials, Block block) { + public static JsonObject generateBlock(List materials, Block block) { JsonObject blockDesc = new JsonObject(); List blockStates = block.getStateManager().getStates(); BlockState defaultState = block.getDefaultState(); - Identifier registryKey = blockRegistry.getKey(block).orElseThrow().getValue(); + Identifier registryKey = Registries.BLOCK.getKey(block).orElseThrow().getValue(); String localizationKey = block.getTranslationKey(); List effectiveTools = getItemsEffectiveForBlock(defaultState); - blockDesc.addProperty("id", blockRegistry.getRawId(block)); + blockDesc.addProperty("id", Registries.BLOCK.getRawId(block)); blockDesc.addProperty("name", registryKey.getPath()); blockDesc.addProperty("displayName", DGU.translateText(localizationKey)); @@ -189,10 +189,9 @@ public String getDataName() { @Override public JsonArray generateDataJson() { JsonArray resultBlocksArray = new JsonArray(); - Registry blockRegistry = DGU.getWorld().getRegistryManager().get(RegistryKeys.BLOCK); List availableMaterials = MaterialsDataGenerator.getGlobalMaterialInfo(); - blockRegistry.forEach(block -> resultBlocksArray.add(generateBlock(blockRegistry, availableMaterials, block))); + Registries.BLOCK.forEach(block -> resultBlocksArray.add(generateBlock(availableMaterials, block))); return resultBlocksArray; } } diff --git a/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java b/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java index 9280f7bf..121e6c5f 100644 --- a/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java +++ b/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java @@ -118,16 +118,16 @@ private static String findMatchingBlockMaterial(BlockState blockState, List blockRegistry, List materials, Block block) { + public static JsonObject generateBlock(List materials, Block block) { JsonObject blockDesc = new JsonObject(); List blockStates = block.getStateManager().getStates(); BlockState defaultState = block.getDefaultState(); - Identifier registryKey = blockRegistry.getKey(block).orElseThrow().getValue(); + Identifier registryKey = Registry.BLOCK.getKey(block).orElseThrow().getValue(); String localizationKey = block.getTranslationKey(); List effectiveTools = getItemsEffectiveForBlock(defaultState); - blockDesc.addProperty("id", blockRegistry.getRawId(block)); + blockDesc.addProperty("id", Registry.BLOCK.getRawId(block)); blockDesc.addProperty("name", registryKey.getPath()); blockDesc.addProperty("displayName", DGU.translateText(localizationKey)); @@ -189,10 +189,9 @@ public String getDataName() { @Override public JsonArray generateDataJson() { JsonArray resultBlocksArray = new JsonArray(); - Registry blockRegistry = Registry.BLOCK; List availableMaterials = MaterialsDataGenerator.getGlobalMaterialInfo(); - blockRegistry.forEach(block -> resultBlocksArray.add(generateBlock(blockRegistry, availableMaterials, block))); + Registry.BLOCK.forEach(block -> resultBlocksArray.add(generateBlock(availableMaterials, block))); return resultBlocksArray; } } diff --git a/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java b/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java index 85592239..d1973e75 100644 --- a/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java +++ b/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java @@ -2,7 +2,6 @@ import com.google.gson.JsonArray; import com.google.gson.JsonObject; -import com.google.gson.reflect.TypeToken; import dev.u9g.minecraftdatagenerator.util.DGU; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityType; @@ -18,8 +17,6 @@ import net.minecraft.util.Identifier; import net.minecraft.util.registry.Registry; -import java.lang.reflect.ParameterizedType; - public class EntitiesDataGenerator implements IDataGenerator { public static JsonObject generateEntity(Registry> entityRegistry, EntityType entityType) { JsonObject entityDesc = new JsonObject(); @@ -49,17 +46,11 @@ public static JsonObject generateEntity(Registry> entityRegistry, private static String getCategoryFrom(EntityType entityType) { if (entityType == EntityType.PLAYER) return "other"; // fail early for player entities - Class entityClazz = null; - try { - for (var field : EntityType.class.getFields()) - if (entityType == field.get(EntityType.class)) - entityClazz = (Class) ((ParameterizedType) TypeToken.get(field.getGenericType()).getType()).getActualTypeArguments()[0]; - } catch (Exception e) { - e.printStackTrace(); - throw new RuntimeException(e); - } - if (entityClazz == null) throw new RuntimeException("Shouldn't be null..."); - return switch (entityClazz.getPackageName()) { + Entity entity = entityType.create(DGU.getWorld()); + if (entity == null) + throw new Error("Entity was null after trying to create a: " + DGU.translateText(entityType.getTranslationKey())); + entity.discard(); + return switch (entity.getClass().getPackageName()) { case "net.minecraft.entity.decoration", "net.minecraft.entity.decoration.painting" -> "Immobile"; case "net.minecraft.entity.boss", "net.minecraft.entity.mob", "net.minecraft.entity.boss.dragon" -> "Hostile mobs"; @@ -67,7 +58,7 @@ private static String getCategoryFrom(EntityType entityType) { case "net.minecraft.entity.passive" -> "Passive mobs"; case "net.minecraft.entity.vehicle" -> "Vehicles"; case "net.minecraft.entity" -> "UNKNOWN"; - default -> throw new Error("Unexpected entity type: " + entityClazz.getPackageName()); + default -> throw new Error("Unexpected entity type: " + entity.getClass().getPackageName()); }; } From 82741086e4d352a8fd8c4dbce89cc06269b18a9b Mon Sep 17 00:00:00 2001 From: AlexProgrammerDE <40795980+AlexProgrammerDE@users.noreply.github.com> Date: Thu, 2 May 2024 08:37:02 +0200 Subject: [PATCH 27/38] Use java 21 for build --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1eea2667..ae6c50b0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -25,10 +25,10 @@ jobs: - name: Validate Gradle wrapper uses: gradle/wrapper-validation-action@v1 - - name: Set up JDK 17 + - name: Set up JDK 21 uses: actions/setup-java@v4 with: - java-version: '17' + java-version: '21' distribution: 'temurin' - name: Generate ${{ matrix.version }} From 0aaa23ad32cd0d3806200359cefcdad8d5a8a99d Mon Sep 17 00:00:00 2001 From: AlexProgrammerDE <40795980+AlexProgrammerDE@users.noreply.github.com> Date: Sat, 4 May 2024 07:33:26 +0200 Subject: [PATCH 28/38] Initial work on 1.20.5 --- .github/workflows/build.yml | 21 +- .../generators/EnchantmentsDataGenerator.java | 13 -- .../generators/EnchantmentsDataGenerator.java | 13 -- .../generators/EnchantmentsDataGenerator.java | 20 +- .../generators/EnchantmentsDataGenerator.java | 20 +- .../generators/EnchantmentsDataGenerator.java | 20 +- .../generators/EnchantmentsDataGenerator.java | 20 +- .../generators/EnchantmentsDataGenerator.java | 20 +- .../generators/EnchantmentsDataGenerator.java | 20 +- 1.20.5/build.gradle | 42 ++++ .../generators/BiomesDataGenerator.java | 115 ++++++++++ .../BlockCollisionShapesDataGenerator.java | 113 ++++++++++ .../generators/BlocksDataGenerator.java | 197 +++++++++++++++++ .../generators/EffectsDataGenerator.java | 46 ++++ .../generators/EnchantmentsDataGenerator.java | 90 ++++++++ .../generators/EntitiesDataGenerator.java | 121 +++++++++++ .../generators/FoodsDataGenerator.java | 53 +++++ .../generators/InstrumentsDataGenerator.java | 25 +++ .../generators/ItemsDataGenerator.java | 90 ++++++++ .../generators/LanguageDataGenerator.java | 27 +++ .../generators/MaterialsDataGenerator.java | 203 ++++++++++++++++++ .../generators/ParticlesDataGenerator.java | 33 +++ .../generators/RecipeDataGenerator.java | 128 +++++++++++ .../generators/TintsDataGenerator.java | 161 ++++++++++++++ .../mixin/EULAMixin.java | 15 ++ .../mixin/ReadyMixin.java | 22 ++ .../u9g/minecraftdatagenerator/util/DGU.java | 21 ++ .../util/EmptyRenderBlockView.java | 72 +++++++ 1.20.5/src/main/resources/fabric.mod.json | 20 ++ .../minecraft-data-generator.mixins.json | 15 ++ .../generators/EnchantmentsDataGenerator.java | 20 +- .../generators/EnchantmentsDataGenerator.java | 13 -- settings.gradle | 1 + 33 files changed, 1637 insertions(+), 173 deletions(-) create mode 100644 1.20.5/build.gradle create mode 100644 1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/generators/BiomesDataGenerator.java create mode 100644 1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java create mode 100644 1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java create mode 100644 1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/generators/EffectsDataGenerator.java create mode 100644 1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java create mode 100644 1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java create mode 100644 1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/generators/FoodsDataGenerator.java create mode 100644 1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/generators/InstrumentsDataGenerator.java create mode 100644 1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/generators/ItemsDataGenerator.java create mode 100644 1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/generators/LanguageDataGenerator.java create mode 100644 1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java create mode 100644 1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/generators/ParticlesDataGenerator.java create mode 100644 1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/generators/RecipeDataGenerator.java create mode 100644 1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java create mode 100644 1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/mixin/EULAMixin.java create mode 100644 1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java create mode 100644 1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java create mode 100644 1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/util/EmptyRenderBlockView.java create mode 100644 1.20.5/src/main/resources/fabric.mod.json create mode 100644 1.20.5/src/main/resources/minecraft-data-generator.mixins.json diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ae6c50b0..a6ec2a5b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,7 +11,26 @@ jobs: build: strategy: matrix: - version: ["1.7", "1.8.9", "1.9.4", "1.10.2", "1.11.2", "1.12.2", "1.13", "1.14", "1.15", "1.16", "1.17", "1.18", "22w19a", "1.19", "1.19.2", "1.20", "1.20.4"] + version: [ + "1.7", + "1.8.9", + "1.9.4", + "1.10.2", + "1.11.2", + "1.12.2", + "1.13", + "1.14", + "1.15", + "1.16", + "1.17", + "1.18", + "22w19a", + "1.19", + "1.19.2", + "1.20", + "1.20.4", + "1.20.5" + ] name: Build ${{ matrix.version }} timeout-minutes: 10 diff --git a/1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java b/1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java index 3df0725e..e6158649 100644 --- a/1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java +++ b/1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java @@ -16,19 +16,6 @@ public class EnchantmentsDataGenerator implements IDataGenerator { private static final ImmutableMap ENCHANTMENT_TARGET_NAMES = ImmutableMap.builder() - .put(EnchantmentTarget.ARMOR, "armor") - .put(EnchantmentTarget.ARMOR_FEET, "armor_feet") - .put(EnchantmentTarget.ARMOR_LEGS, "armor_legs") - .put(EnchantmentTarget.ARMOR_CHEST, "armor_chest") - .put(EnchantmentTarget.ARMOR_HEAD, "armor_head") - .put(EnchantmentTarget.WEAPON, "weapon") - .put(EnchantmentTarget.DIGGER, "digger") - .put(EnchantmentTarget.FISHING_ROD, "fishing_rod") - .put(EnchantmentTarget.TRIDENT, "trident") - .put(EnchantmentTarget.BREAKABLE, "breakable") - .put(EnchantmentTarget.BOW, "bow") - .put(EnchantmentTarget.WEARABLE, "wearable") - .put(EnchantmentTarget.CROSSBOW, "crossbow") .put(EnchantmentTarget.ALL, "vanishable") // according to VanishingCurseEnchantment .build(); diff --git a/1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java b/1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java index f4f067b8..eb586c7b 100644 --- a/1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java +++ b/1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java @@ -16,19 +16,6 @@ public class EnchantmentsDataGenerator implements IDataGenerator { private static final ImmutableMap ENCHANTMENT_TARGET_NAMES = ImmutableMap.builder() - .put(EnchantmentTarget.ARMOR, "armor") - .put(EnchantmentTarget.ARMOR_FEET, "armor_feet") - .put(EnchantmentTarget.ARMOR_LEGS, "armor_legs") - .put(EnchantmentTarget.ARMOR_CHEST, "armor_chest") - .put(EnchantmentTarget.ARMOR_HEAD, "armor_head") - .put(EnchantmentTarget.WEAPON, "weapon") - .put(EnchantmentTarget.DIGGER, "digger") - .put(EnchantmentTarget.FISHING_ROD, "fishing_rod") - .put(EnchantmentTarget.TRIDENT, "trident") - .put(EnchantmentTarget.BREAKABLE, "breakable") - .put(EnchantmentTarget.BOW, "bow") - .put(EnchantmentTarget.WEARABLE, "wearable") - .put(EnchantmentTarget.CROSSBOW, "crossbow") .put(EnchantmentTarget.ALL, "vanishable") // according to VanishingCurseEnchantment .build(); diff --git a/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java b/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java index 71ed7b6f..fa5bd235 100644 --- a/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java +++ b/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java @@ -13,26 +13,8 @@ import java.util.Locale; public class EnchantmentsDataGenerator implements IDataGenerator { - - private static final ImmutableMap ENCHANTMENT_TARGET_NAMES = ImmutableMap.builder() - .put(EnchantmentTarget.ARMOR, "armor") - .put(EnchantmentTarget.ARMOR_FEET, "armor_feet") - .put(EnchantmentTarget.ARMOR_LEGS, "armor_legs") - .put(EnchantmentTarget.ARMOR_CHEST, "armor_chest") - .put(EnchantmentTarget.ARMOR_HEAD, "armor_head") - .put(EnchantmentTarget.WEAPON, "weapon") - .put(EnchantmentTarget.DIGGER, "digger") - .put(EnchantmentTarget.FISHING_ROD, "fishing_rod") - .put(EnchantmentTarget.TRIDENT, "trident") - .put(EnchantmentTarget.BREAKABLE, "breakable") - .put(EnchantmentTarget.BOW, "bow") - .put(EnchantmentTarget.WEARABLE, "wearable") - .put(EnchantmentTarget.CROSSBOW, "crossbow") - .put(EnchantmentTarget.VANISHABLE, "vanishable") - .build(); - public static String getEnchantmentTargetName(EnchantmentTarget target) { - return ENCHANTMENT_TARGET_NAMES.getOrDefault(target, target.name().toLowerCase(Locale.ROOT)); + return target.name().toLowerCase(Locale.ROOT); } //Equation enchantment costs follow is a * level + b, so we can easily retrieve a and b by passing zero level diff --git a/1.17/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java b/1.17/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java index 71ed7b6f..fa5bd235 100644 --- a/1.17/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java +++ b/1.17/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java @@ -13,26 +13,8 @@ import java.util.Locale; public class EnchantmentsDataGenerator implements IDataGenerator { - - private static final ImmutableMap ENCHANTMENT_TARGET_NAMES = ImmutableMap.builder() - .put(EnchantmentTarget.ARMOR, "armor") - .put(EnchantmentTarget.ARMOR_FEET, "armor_feet") - .put(EnchantmentTarget.ARMOR_LEGS, "armor_legs") - .put(EnchantmentTarget.ARMOR_CHEST, "armor_chest") - .put(EnchantmentTarget.ARMOR_HEAD, "armor_head") - .put(EnchantmentTarget.WEAPON, "weapon") - .put(EnchantmentTarget.DIGGER, "digger") - .put(EnchantmentTarget.FISHING_ROD, "fishing_rod") - .put(EnchantmentTarget.TRIDENT, "trident") - .put(EnchantmentTarget.BREAKABLE, "breakable") - .put(EnchantmentTarget.BOW, "bow") - .put(EnchantmentTarget.WEARABLE, "wearable") - .put(EnchantmentTarget.CROSSBOW, "crossbow") - .put(EnchantmentTarget.VANISHABLE, "vanishable") - .build(); - public static String getEnchantmentTargetName(EnchantmentTarget target) { - return ENCHANTMENT_TARGET_NAMES.getOrDefault(target, target.name().toLowerCase(Locale.ROOT)); + return target.name().toLowerCase(Locale.ROOT); } //Equation enchantment costs follow is a * level + b, so we can easily retrieve a and b by passing zero level diff --git a/1.18/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java b/1.18/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java index 71ed7b6f..fa5bd235 100644 --- a/1.18/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java +++ b/1.18/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java @@ -13,26 +13,8 @@ import java.util.Locale; public class EnchantmentsDataGenerator implements IDataGenerator { - - private static final ImmutableMap ENCHANTMENT_TARGET_NAMES = ImmutableMap.builder() - .put(EnchantmentTarget.ARMOR, "armor") - .put(EnchantmentTarget.ARMOR_FEET, "armor_feet") - .put(EnchantmentTarget.ARMOR_LEGS, "armor_legs") - .put(EnchantmentTarget.ARMOR_CHEST, "armor_chest") - .put(EnchantmentTarget.ARMOR_HEAD, "armor_head") - .put(EnchantmentTarget.WEAPON, "weapon") - .put(EnchantmentTarget.DIGGER, "digger") - .put(EnchantmentTarget.FISHING_ROD, "fishing_rod") - .put(EnchantmentTarget.TRIDENT, "trident") - .put(EnchantmentTarget.BREAKABLE, "breakable") - .put(EnchantmentTarget.BOW, "bow") - .put(EnchantmentTarget.WEARABLE, "wearable") - .put(EnchantmentTarget.CROSSBOW, "crossbow") - .put(EnchantmentTarget.VANISHABLE, "vanishable") - .build(); - public static String getEnchantmentTargetName(EnchantmentTarget target) { - return ENCHANTMENT_TARGET_NAMES.getOrDefault(target, target.name().toLowerCase(Locale.ROOT)); + return target.name().toLowerCase(Locale.ROOT); } //Equation enchantment costs follow is a * level + b, so we can easily retrieve a and b by passing zero level diff --git a/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java b/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java index 71ed7b6f..fa5bd235 100644 --- a/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java +++ b/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java @@ -13,26 +13,8 @@ import java.util.Locale; public class EnchantmentsDataGenerator implements IDataGenerator { - - private static final ImmutableMap ENCHANTMENT_TARGET_NAMES = ImmutableMap.builder() - .put(EnchantmentTarget.ARMOR, "armor") - .put(EnchantmentTarget.ARMOR_FEET, "armor_feet") - .put(EnchantmentTarget.ARMOR_LEGS, "armor_legs") - .put(EnchantmentTarget.ARMOR_CHEST, "armor_chest") - .put(EnchantmentTarget.ARMOR_HEAD, "armor_head") - .put(EnchantmentTarget.WEAPON, "weapon") - .put(EnchantmentTarget.DIGGER, "digger") - .put(EnchantmentTarget.FISHING_ROD, "fishing_rod") - .put(EnchantmentTarget.TRIDENT, "trident") - .put(EnchantmentTarget.BREAKABLE, "breakable") - .put(EnchantmentTarget.BOW, "bow") - .put(EnchantmentTarget.WEARABLE, "wearable") - .put(EnchantmentTarget.CROSSBOW, "crossbow") - .put(EnchantmentTarget.VANISHABLE, "vanishable") - .build(); - public static String getEnchantmentTargetName(EnchantmentTarget target) { - return ENCHANTMENT_TARGET_NAMES.getOrDefault(target, target.name().toLowerCase(Locale.ROOT)); + return target.name().toLowerCase(Locale.ROOT); } //Equation enchantment costs follow is a * level + b, so we can easily retrieve a and b by passing zero level diff --git a/1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java b/1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java index 71ed7b6f..fa5bd235 100644 --- a/1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java +++ b/1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java @@ -13,26 +13,8 @@ import java.util.Locale; public class EnchantmentsDataGenerator implements IDataGenerator { - - private static final ImmutableMap ENCHANTMENT_TARGET_NAMES = ImmutableMap.builder() - .put(EnchantmentTarget.ARMOR, "armor") - .put(EnchantmentTarget.ARMOR_FEET, "armor_feet") - .put(EnchantmentTarget.ARMOR_LEGS, "armor_legs") - .put(EnchantmentTarget.ARMOR_CHEST, "armor_chest") - .put(EnchantmentTarget.ARMOR_HEAD, "armor_head") - .put(EnchantmentTarget.WEAPON, "weapon") - .put(EnchantmentTarget.DIGGER, "digger") - .put(EnchantmentTarget.FISHING_ROD, "fishing_rod") - .put(EnchantmentTarget.TRIDENT, "trident") - .put(EnchantmentTarget.BREAKABLE, "breakable") - .put(EnchantmentTarget.BOW, "bow") - .put(EnchantmentTarget.WEARABLE, "wearable") - .put(EnchantmentTarget.CROSSBOW, "crossbow") - .put(EnchantmentTarget.VANISHABLE, "vanishable") - .build(); - public static String getEnchantmentTargetName(EnchantmentTarget target) { - return ENCHANTMENT_TARGET_NAMES.getOrDefault(target, target.name().toLowerCase(Locale.ROOT)); + return target.name().toLowerCase(Locale.ROOT); } //Equation enchantment costs follow is a * level + b, so we can easily retrieve a and b by passing zero level diff --git a/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java b/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java index 35d6dc63..38d68ac4 100644 --- a/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java +++ b/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java @@ -1,6 +1,5 @@ package dev.u9g.minecraftdatagenerator.generators; -import com.google.common.collect.ImmutableMap; import com.google.gson.JsonArray; import com.google.gson.JsonObject; import dev.u9g.minecraftdatagenerator.util.DGU; @@ -15,25 +14,8 @@ public class EnchantmentsDataGenerator implements IDataGenerator { - private static final ImmutableMap ENCHANTMENT_TARGET_NAMES = ImmutableMap.builder() - .put(EnchantmentTarget.ARMOR, "armor") - .put(EnchantmentTarget.ARMOR_FEET, "armor_feet") - .put(EnchantmentTarget.ARMOR_LEGS, "armor_legs") - .put(EnchantmentTarget.ARMOR_CHEST, "armor_chest") - .put(EnchantmentTarget.ARMOR_HEAD, "armor_head") - .put(EnchantmentTarget.WEAPON, "weapon") - .put(EnchantmentTarget.DIGGER, "digger") - .put(EnchantmentTarget.FISHING_ROD, "fishing_rod") - .put(EnchantmentTarget.TRIDENT, "trident") - .put(EnchantmentTarget.BREAKABLE, "breakable") - .put(EnchantmentTarget.BOW, "bow") - .put(EnchantmentTarget.WEARABLE, "wearable") - .put(EnchantmentTarget.CROSSBOW, "crossbow") - .put(EnchantmentTarget.VANISHABLE, "vanishable") - .build(); - public static String getEnchantmentTargetName(EnchantmentTarget target) { - return ENCHANTMENT_TARGET_NAMES.getOrDefault(target, target.name().toLowerCase(Locale.ROOT)); + return target.name().toLowerCase(Locale.ROOT); } //Equation enchantment costs follow is a * level + b, so we can easily retrieve a and b by passing zero level diff --git a/1.20.5/build.gradle b/1.20.5/build.gradle new file mode 100644 index 00000000..0158df9e --- /dev/null +++ b/1.20.5/build.gradle @@ -0,0 +1,42 @@ +import xyz.wagyourtail.unimined.internal.minecraft.MinecraftProvider + +plugins { + id 'xyz.wagyourtail.unimined' +} + +unimined.minecraft { + version "1.20.5" + + mappings { + intermediary() + yarn(1) + + devFallbackNamespace "intermediary" + } + + runs.config("server") { + javaVersion = JavaVersion.VERSION_21 + } + + customPatcher(new CustomOfficialFabricMinecraftTransformer(project, delegate as MinecraftProvider)) { + it.loader libs.versions.fabric.loader.get() + } + + defaultRemapJar = true +} + +dependencies { + implementation project(":common") +} + +processResources { + filteringCharset "UTF-8" + + filesMatching("fabric.mod.json") { + expand "version": project.version + } +} + +tasks.withType(JavaCompile).configureEach { + it.options.encoding = "UTF-8" +} diff --git a/1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/generators/BiomesDataGenerator.java b/1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/generators/BiomesDataGenerator.java new file mode 100644 index 00000000..a1b3b732 --- /dev/null +++ b/1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/generators/BiomesDataGenerator.java @@ -0,0 +1,115 @@ +package dev.u9g.minecraftdatagenerator.generators; + +import com.google.gson.JsonArray; +import com.google.gson.JsonObject; +import dev.u9g.minecraftdatagenerator.util.DGU; +import net.minecraft.registry.DynamicRegistryManager; +import net.minecraft.registry.Registry; +import net.minecraft.registry.RegistryKeys; +import net.minecraft.registry.tag.BiomeTags; +import net.minecraft.util.Identifier; +import net.minecraft.world.biome.Biome; + +public class BiomesDataGenerator implements IDataGenerator { + private static String guessBiomeDimensionFromCategory(Biome biome) { + var biomeRegistry = DGU.getWorld().getRegistryManager().get(RegistryKeys.BIOME); + if (biomeRegistry.getEntry(biome).isIn(BiomeTags.IS_NETHER)) { + return "nether"; + } else if (biomeRegistry.getEntry(biome).isIn(BiomeTags.IS_END)) { + return "end"; + } else { + return "overworld"; + } + } + + private static String guessCategoryBasedOnName(String name, String dimension) { + if (dimension.equals("nether")) { + return "nether"; + } else if (dimension.equals("end")) { + return "the_end"; + } + + if (name.contains("end")) { + System.out.println(); + } + + if (name.contains("hills")) { + return "extreme_hills"; + } else if (name.contains("ocean")) { + return "ocean"; + } else if (name.contains("plains")) { + return "plains"; + } else if (name.contains("ice") || name.contains("frozen")) { + return "ice"; + } else if (name.contains("jungle")) { + return "jungle"; + } else if (name.contains("desert")) { + return "desert"; + } else if (name.contains("forest") || name.contains("grove")) { + return "forest"; + } else if (name.contains("taiga")) { + return "taiga"; + } else if (name.contains("swamp")) { + return "swamp"; + } else if (name.contains("river")) { + return "river"; + } else if (name.equals("the_end")) { + return "the_end"; + } else if (name.contains("mushroom")) { + return "mushroom"; + } else if (name.contains("beach") || name.equals("stony_shore")) { + return "beach"; + } else if (name.contains("savanna")) { + return "savanna"; + } else if (name.contains("badlands")) { + return "mesa"; + } else if (name.contains("peaks") || name.equals("snowy_slopes") || name.equals("meadow")) { + return "mountain"; + } else if (name.equals("the_void")) { + return "none"; + } else if (name.contains("cave") || name.equals("deep_dark")) { + return "underground"; + } else { + System.out.println("Unable to find biome category for biome with name: '" + name + "'"); + return "none"; + } + } + + public static JsonObject generateBiomeInfo(Registry registry, Biome biome) { + JsonObject biomeDesc = new JsonObject(); + Identifier registryKey = registry.getKey(biome).orElseThrow().getValue(); + String localizationKey = String.format("biome.%s.%s", registryKey.getNamespace(), registryKey.getPath()); + String name = registryKey.getPath(); + biomeDesc.addProperty("id", registry.getRawId(biome)); + biomeDesc.addProperty("name", name); + String dimension = guessBiomeDimensionFromCategory(biome); + biomeDesc.addProperty("category", guessCategoryBasedOnName(name, dimension)); + biomeDesc.addProperty("temperature", biome.getTemperature()); + //biomeDesc.addProperty("precipitation", biome.getPrecipitation().getName());// - removed in 1.19.4 + biomeDesc.addProperty("has_precipitation", biome.hasPrecipitation()); + //biomeDesc.addProperty("depth", biome.getDepth()); - Doesn't exist anymore in minecraft source + biomeDesc.addProperty("dimension", dimension); + biomeDesc.addProperty("displayName", DGU.translateText(localizationKey)); + biomeDesc.addProperty("color", biome.getSkyColor()); + //biomeDesc.addProperty("rainfall", biome.getDownfall());// - removed in 1.19.4 + + return biomeDesc; + } + + @Override + public String getDataName() { + return "biomes"; + } + + @Override + public JsonArray generateDataJson() { + JsonArray biomesArray = new JsonArray(); + DynamicRegistryManager registryManager = DGU.getWorld().getRegistryManager(); + Registry biomeRegistry = registryManager.get(RegistryKeys.BIOME); + + biomeRegistry.stream() + .map(biome -> generateBiomeInfo(biomeRegistry, biome)) + .forEach(biomesArray::add); + return biomesArray; + } +} diff --git a/1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java b/1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java new file mode 100644 index 00000000..f9f09af5 --- /dev/null +++ b/1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java @@ -0,0 +1,113 @@ +package dev.u9g.minecraftdatagenerator.generators; + +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonPrimitive; +import dev.u9g.minecraftdatagenerator.util.DGU; +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.registry.Registry; +import net.minecraft.registry.RegistryKeys; +import net.minecraft.util.Identifier; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.shape.VoxelShape; +import net.minecraft.world.EmptyBlockView; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class BlockCollisionShapesDataGenerator implements IDataGenerator { + + @Override + public String getDataName() { + return "blockCollisionShapes"; + } + + @Override + public JsonObject generateDataJson() { + Registry blockRegistry = DGU.getWorld().getRegistryManager().get(RegistryKeys.BLOCK); + BlockShapesCache blockShapesCache = new BlockShapesCache(); + + blockRegistry.forEach(blockShapesCache::processBlock); + + JsonObject resultObject = new JsonObject(); + + resultObject.add("blocks", blockShapesCache.dumpBlockShapeIndices(blockRegistry)); + resultObject.add("shapes", blockShapesCache.dumpShapesObject()); + + return resultObject; + } + + private static class BlockShapesCache { + public final Map uniqueBlockShapes = new HashMap<>(); + public final Map> blockCollisionShapes = new HashMap<>(); + private int lastCollisionShapeId = 0; + + public void processBlock(Block block) { + List blockStates = block.getStateManager().getStates(); + List blockCollisionShapes = new ArrayList<>(); + + for (BlockState blockState : blockStates) { + VoxelShape blockShape = blockState.getCollisionShape(EmptyBlockView.INSTANCE, BlockPos.ORIGIN); + Integer blockShapeIndex = uniqueBlockShapes.get(blockShape); + + if (blockShapeIndex == null) { + blockShapeIndex = lastCollisionShapeId++; + uniqueBlockShapes.put(blockShape, blockShapeIndex); + } + blockCollisionShapes.add(blockShapeIndex); + } + + this.blockCollisionShapes.put(block, blockCollisionShapes); + } + + public JsonObject dumpBlockShapeIndices(Registry blockRegistry) { + JsonObject resultObject = new JsonObject(); + + for (var entry : blockCollisionShapes.entrySet()) { + List blockCollisions = entry.getValue(); + long distinctShapesCount = blockCollisions.stream().distinct().count(); + JsonElement blockCollision; + if (distinctShapesCount == 1L) { + blockCollision = new JsonPrimitive(blockCollisions.getFirst()); + } else { + blockCollision = new JsonArray(); + for (int collisionId : blockCollisions) { + ((JsonArray) blockCollision).add(collisionId); + } + } + + Identifier registryKey = blockRegistry.getKey(entry.getKey()).orElseThrow().getValue(); + resultObject.add(registryKey.getPath(), blockCollision); + } + + return resultObject; + } + + public JsonObject dumpShapesObject() { + JsonObject shapesObject = new JsonObject(); + + for (var entry : uniqueBlockShapes.entrySet()) { + JsonArray boxesArray = new JsonArray(); + entry.getKey().forEachBox((x1, y1, z1, x2, y2, z2) -> { + JsonArray oneBoxJsonArray = new JsonArray(); + + oneBoxJsonArray.add(x1); + oneBoxJsonArray.add(y1); + oneBoxJsonArray.add(z1); + + oneBoxJsonArray.add(x2); + oneBoxJsonArray.add(y2); + oneBoxJsonArray.add(z2); + + boxesArray.add(oneBoxJsonArray); + }); + shapesObject.add(Integer.toString(entry.getValue()), boxesArray); + } + return shapesObject; + } + } +} diff --git a/1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java b/1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java new file mode 100644 index 00000000..324b4d90 --- /dev/null +++ b/1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlocksDataGenerator.java @@ -0,0 +1,197 @@ +package dev.u9g.minecraftdatagenerator.generators; + +import com.google.common.base.CaseFormat; +import com.google.gson.JsonArray; +import com.google.gson.JsonObject; +import dev.u9g.minecraftdatagenerator.util.DGU; +import net.minecraft.block.AirBlock; +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.item.Items; +import net.minecraft.loot.context.LootContextParameterSet; +import net.minecraft.loot.context.LootContextParameters; +import net.minecraft.registry.Registries; +import net.minecraft.registry.RegistryKeys; +import net.minecraft.server.MinecraftServer; +import net.minecraft.server.world.ServerWorld; +import net.minecraft.state.property.BooleanProperty; +import net.minecraft.state.property.EnumProperty; +import net.minecraft.state.property.IntProperty; +import net.minecraft.state.property.Property; +import net.minecraft.util.Identifier; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Vec3d; +import net.minecraft.util.shape.VoxelShape; +import net.minecraft.world.EmptyBlockView; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import java.util.stream.Collectors; + +public class BlocksDataGenerator implements IDataGenerator { + + private static final Logger logger = LoggerFactory.getLogger(BlocksDataGenerator.class); + + private static List getItemsEffectiveForBlock(BlockState blockState) { + return DGU.getWorld().getRegistryManager().get(RegistryKeys.ITEM).stream() + .filter(item -> item.getDefaultStack().isSuitableFor(blockState)) + .collect(Collectors.toList()); + } + + private static void populateDropsIfPossible(BlockState blockState, Item firstToolItem, List outDrops) { + MinecraftServer minecraftServer = DGU.getCurrentlyRunningServer(); + if (minecraftServer != null) { + //If we have local world context, we can actually evaluate loot tables and determine actual data + ServerWorld serverWorld = minecraftServer.getOverworld(); + LootContextParameterSet.Builder lootContextParameterSet = new LootContextParameterSet.Builder(serverWorld) + .add(LootContextParameters.BLOCK_STATE, blockState) + .add(LootContextParameters.ORIGIN, Vec3d.ZERO) + .add(LootContextParameters.TOOL, firstToolItem.getDefaultStack()); + outDrops.addAll(blockState.getDroppedStacks(lootContextParameterSet)); + } else { + //If we're lacking world context to correctly determine drops, assume that default drop is ItemBlock stack in quantity of 1 + Item itemBlock = blockState.getBlock().asItem(); + if (itemBlock != Items.AIR) { + outDrops.add(itemBlock.getDefaultStack()); + } + } + } + + private static String getPropertyTypeName(Property property) { + //Explicitly handle default minecraft properties + if (property instanceof BooleanProperty) { + return "bool"; + } + if (property instanceof IntProperty) { + return "int"; + } + if (property instanceof EnumProperty) { + return "enum"; + } + + //Use simple class name as fallback, this code will give something like + //example_type for ExampleTypeProperty class name + String rawPropertyName = property.getClass().getSimpleName().replace("Property", ""); + return CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, rawPropertyName); + } + + private static > JsonObject generateStateProperty(Property property) { + JsonObject propertyObject = new JsonObject(); + Collection propertyValues = property.getValues(); + + propertyObject.addProperty("name", property.getName()); + propertyObject.addProperty("type", getPropertyTypeName(property)); + propertyObject.addProperty("num_values", propertyValues.size()); + + //Do not add values for vanilla boolean properties, they are known by default + if (!(property instanceof BooleanProperty)) { + JsonArray propertyValuesArray = new JsonArray(); + for (T propertyValue : propertyValues) { + propertyValuesArray.add(property.name(propertyValue)); + } + propertyObject.add("values", propertyValuesArray); + } + return propertyObject; + } + + private static String findMatchingBlockMaterial(BlockState blockState, List materials) { + List matchingMaterials = materials.stream() + .filter(material -> material.getPredicate().test(blockState)) + .collect(Collectors.toList()); + + if (matchingMaterials.size() > 1) { + var firstMaterial = matchingMaterials.getFirst(); + var otherMaterials = matchingMaterials.subList(1, matchingMaterials.size()); + + if (!otherMaterials.stream().allMatch(firstMaterial::includesMaterial)) { + logger.error("Block {} matches multiple materials: {}", blockState.getBlock(), matchingMaterials); + } + } + if (matchingMaterials.isEmpty()) { + return "default"; + } + return matchingMaterials.getFirst().getMaterialName(); + } + + public static JsonObject generateBlock(List materials, Block block) { + JsonObject blockDesc = new JsonObject(); + + List blockStates = block.getStateManager().getStates(); + BlockState defaultState = block.getDefaultState(); + Identifier registryKey = Registries.BLOCK.getKey(block).orElseThrow().getValue(); + String localizationKey = block.getTranslationKey(); + List effectiveTools = getItemsEffectiveForBlock(defaultState); + + blockDesc.addProperty("id", Registries.BLOCK.getRawId(block)); + blockDesc.addProperty("name", registryKey.getPath()); + blockDesc.addProperty("displayName", DGU.translateText(localizationKey)); + + blockDesc.addProperty("hardness", block.getHardness()); + blockDesc.addProperty("resistance", block.getBlastResistance()); + blockDesc.addProperty("stackSize", block.asItem().getMaxCount()); + blockDesc.addProperty("diggable", block.getHardness() != -1.0f && !(block instanceof AirBlock)); +// JsonObject effTools = new JsonObject(); +// effectiveTools.forEach(item -> effTools.addProperty( +// String.valueOf(Registry.ITEM.getRawId(item)), // key +// item.getMiningSpeedMultiplier(item.getDefaultStack(), defaultState) // value +// )); +// blockDesc.add("effectiveTools", effTools); + blockDesc.addProperty("material", findMatchingBlockMaterial(defaultState, materials)); + + blockDesc.addProperty("transparent", !defaultState.isOpaque()); + blockDesc.addProperty("emitLight", defaultState.getLuminance()); + blockDesc.addProperty("filterLight", defaultState.getOpacity(EmptyBlockView.INSTANCE, BlockPos.ORIGIN)); + + blockDesc.addProperty("defaultState", Block.getRawIdFromState(defaultState)); + blockDesc.addProperty("minStateId", Block.getRawIdFromState(blockStates.getFirst())); + blockDesc.addProperty("maxStateId", Block.getRawIdFromState(blockStates.getLast())); + + JsonArray stateProperties = new JsonArray(); + for (Property property : block.getStateManager().getProperties()) { + stateProperties.add(generateStateProperty(property)); + } + blockDesc.add("states", stateProperties); + + //Only add harvest tools if tool is required for harvesting this block + if (defaultState.isToolRequired()) { + JsonObject effectiveToolsObject = new JsonObject(); + for (Item effectiveItem : effectiveTools) { + effectiveToolsObject.addProperty(Integer.toString(Item.getRawId(effectiveItem)), true); + } + blockDesc.add("harvestTools", effectiveToolsObject); + } + + List actualBlockDrops = new ArrayList<>(); + populateDropsIfPossible(defaultState, effectiveTools.isEmpty() ? Items.AIR : effectiveTools.getFirst(), actualBlockDrops); + + JsonArray dropsArray = new JsonArray(); + for (ItemStack dropStack : actualBlockDrops) { + dropsArray.add(Item.getRawId(dropStack.getItem())); + } + blockDesc.add("drops", dropsArray); + + VoxelShape blockCollisionShape = defaultState.getCollisionShape(EmptyBlockView.INSTANCE, BlockPos.ORIGIN); + blockDesc.addProperty("boundingBox", blockCollisionShape.isEmpty() ? "empty" : "block"); + + return blockDesc; + } + + @Override + public String getDataName() { + return "blocks"; + } + + @Override + public JsonArray generateDataJson() { + JsonArray resultBlocksArray = new JsonArray(); + List availableMaterials = MaterialsDataGenerator.getGlobalMaterialInfo(); + + Registries.BLOCK.forEach(block -> resultBlocksArray.add(generateBlock(availableMaterials, block))); + return resultBlocksArray; + } +} diff --git a/1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/generators/EffectsDataGenerator.java b/1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/generators/EffectsDataGenerator.java new file mode 100644 index 00000000..dd6dc019 --- /dev/null +++ b/1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/generators/EffectsDataGenerator.java @@ -0,0 +1,46 @@ +package dev.u9g.minecraftdatagenerator.generators; + +import com.google.gson.JsonArray; +import com.google.gson.JsonObject; +import dev.u9g.minecraftdatagenerator.util.DGU; +import net.minecraft.entity.effect.StatusEffect; +import net.minecraft.entity.effect.StatusEffects; +import net.minecraft.registry.Registry; +import net.minecraft.registry.RegistryKeys; +import net.minecraft.util.Identifier; +import org.apache.commons.lang3.StringUtils; + +import java.util.Arrays; +import java.util.stream.Collectors; + +public class EffectsDataGenerator implements IDataGenerator { + public static JsonObject generateEffect(Registry registry, StatusEffect statusEffect) { + JsonObject effectDesc = new JsonObject(); + Identifier registryKey = registry.getKey(statusEffect).orElseThrow().getValue(); + + effectDesc.addProperty("id", registry.getRawId(statusEffect)); + if (statusEffect == StatusEffects.UNLUCK) { + effectDesc.addProperty("name", "BadLuck"); + effectDesc.addProperty("displayName", "Bad Luck"); + } else { + effectDesc.addProperty("name", Arrays.stream(registryKey.getPath().split("_")).map(StringUtils::capitalize).collect(Collectors.joining())); + effectDesc.addProperty("displayName", DGU.translateText(statusEffect.getTranslationKey())); + } + + effectDesc.addProperty("type", statusEffect.isBeneficial() ? "good" : "bad"); + return effectDesc; + } + + @Override + public String getDataName() { + return "effects"; + } + + @Override + public JsonArray generateDataJson() { + JsonArray resultsArray = new JsonArray(); + Registry statusEffectRegistry = DGU.getWorld().getRegistryManager().get(RegistryKeys.STATUS_EFFECT); + statusEffectRegistry.forEach(effect -> resultsArray.add(generateEffect(statusEffectRegistry, effect))); + return resultsArray; + } +} diff --git a/1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java b/1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java new file mode 100644 index 00000000..36064a2b --- /dev/null +++ b/1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java @@ -0,0 +1,90 @@ +package dev.u9g.minecraftdatagenerator.generators; + +import com.google.common.collect.ImmutableMap; +import com.google.gson.JsonArray; +import com.google.gson.JsonObject; +import dev.u9g.minecraftdatagenerator.util.DGU; +import net.minecraft.enchantment.Enchantment; +import net.minecraft.item.Item; +import net.minecraft.registry.Registry; +import net.minecraft.registry.RegistryKeys; +import net.minecraft.registry.tag.TagKey; +import net.minecraft.util.Identifier; + +import java.util.List; + +public class EnchantmentsDataGenerator implements IDataGenerator { + public static String getEnchantmentTargetName(TagKey target) { + return target.id().getPath().split("/")[1]; + } + + //Equation enchantment costs follow is a * level + b, so we can easily retrieve a and b by passing zero level + private static JsonObject generateEnchantmentMinPowerCoefficients(Enchantment enchantment) { + int b = enchantment.getMinPower(0); + int a = enchantment.getMinPower(1) - b; + + JsonObject resultObject = new JsonObject(); + resultObject.addProperty("a", a); + resultObject.addProperty("b", b); + return resultObject; + } + + private static JsonObject generateEnchantmentMaxPowerCoefficients(Enchantment enchantment) { + int b = enchantment.getMaxPower(0); + int a = enchantment.getMaxPower(1) - b; + + JsonObject resultObject = new JsonObject(); + resultObject.addProperty("a", a); + resultObject.addProperty("b", b); + return resultObject; + } + + public static JsonObject generateEnchantment(Registry registry, Enchantment enchantment) { + JsonObject enchantmentDesc = new JsonObject(); + Identifier registryKey = registry.getKey(enchantment).orElseThrow().getValue(); + + enchantmentDesc.addProperty("id", registry.getRawId(enchantment)); + enchantmentDesc.addProperty("name", registryKey.getPath()); + enchantmentDesc.addProperty("displayName", DGU.translateText(enchantment.getTranslationKey())); + + enchantmentDesc.addProperty("maxLevel", enchantment.getMaxLevel()); + enchantmentDesc.add("minCost", generateEnchantmentMinPowerCoefficients(enchantment)); + enchantmentDesc.add("maxCost", generateEnchantmentMaxPowerCoefficients(enchantment)); + + enchantmentDesc.addProperty("treasureOnly", enchantment.isTreasure()); + enchantmentDesc.addProperty("curse", enchantment.isCursed()); + + List incompatibleEnchantments = registry.stream() + .filter(other -> !enchantment.canCombine(other)) + .filter(other -> other != enchantment) + .toList(); + + JsonArray excludes = new JsonArray(); + for (Enchantment excludedEnchantment : incompatibleEnchantments) { + Identifier otherKey = registry.getKey(excludedEnchantment).orElseThrow().getValue(); + excludes.add(otherKey.getPath()); + } + enchantmentDesc.add("exclude", excludes); + + enchantmentDesc.addProperty("category", getEnchantmentTargetName(enchantment.getApplicableItems())); + enchantmentDesc.addProperty("weight", enchantment.getWeight()); + enchantmentDesc.addProperty("tradeable", enchantment.isAvailableForEnchantedBookOffer()); + enchantmentDesc.addProperty("discoverable", enchantment.isAvailableForRandomSelection()); + + return enchantmentDesc; + } + + @Override + public String getDataName() { + return "enchantments"; + } + + @Override + public JsonArray generateDataJson() { + JsonArray resultsArray = new JsonArray(); + Registry enchantmentRegistry = DGU.getWorld().getRegistryManager().get(RegistryKeys.ENCHANTMENT); + enchantmentRegistry.stream() + .forEach(enchantment -> resultsArray.add(generateEnchantment(enchantmentRegistry, enchantment))); + return resultsArray; + } +} diff --git a/1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java b/1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java new file mode 100644 index 00000000..19fd6fa8 --- /dev/null +++ b/1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java @@ -0,0 +1,121 @@ +package dev.u9g.minecraftdatagenerator.generators; + +import com.google.gson.JsonArray; +import com.google.gson.JsonObject; +import dev.u9g.minecraftdatagenerator.util.DGU; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityType; +import net.minecraft.entity.LivingEntity; +import net.minecraft.entity.mob.AmbientEntity; +import net.minecraft.entity.mob.HostileEntity; +import net.minecraft.entity.mob.MobEntity; +import net.minecraft.entity.mob.WaterCreatureEntity; +import net.minecraft.entity.passive.AnimalEntity; +import net.minecraft.entity.passive.PassiveEntity; +import net.minecraft.entity.projectile.ProjectileEntity; +import net.minecraft.registry.Registry; +import net.minecraft.registry.RegistryKeys; +import net.minecraft.resource.featuretoggle.FeatureFlags; +import net.minecraft.resource.featuretoggle.FeatureSet; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.Identifier; + +public class EntitiesDataGenerator implements IDataGenerator { + public static JsonObject generateEntity(Registry> entityRegistry, EntityType entityType) { + JsonObject entityDesc = new JsonObject(); + Identifier registryKey = entityRegistry.getKey(entityType).orElseThrow().getValue(); + int entityRawId = entityRegistry.getRawId(entityType); + + entityDesc.addProperty("id", entityRawId); + entityDesc.addProperty("internalId", entityRawId); + entityDesc.addProperty("name", registryKey.getPath()); + + entityDesc.addProperty("displayName", DGU.translateText(entityType.getTranslationKey())); + entityDesc.addProperty("width", entityType.getDimensions().width()); + entityDesc.addProperty("height", entityType.getDimensions().height()); + + String entityTypeString = "UNKNOWN"; + MinecraftServer minecraftServer = DGU.getCurrentlyRunningServer(); + + if (minecraftServer != null) { + Entity entityObject = entityType.create(minecraftServer.getOverworld()); + entityTypeString = entityObject != null ? getEntityTypeForClass(entityObject.getClass()) : "unknown"; + } + if (entityType == EntityType.PLAYER) { + entityTypeString = "player"; + } + + entityDesc.addProperty("type", entityTypeString); + entityDesc.addProperty("category", getCategoryFrom(entityType)); + + return entityDesc; + } + + private static String getCategoryFrom(EntityType entityType) { + if (entityType == EntityType.PLAYER) return "UNKNOWN"; + Entity entity = entityType.create(DGU.getWorld()); + if (entity == null) + throw new Error("Entity was null after trying to create a: " + DGU.translateText(entityType.getTranslationKey())); + entity.discard(); + return switch (entity.getClass().getPackageName()) { + case "net.minecraft.entity.decoration", "net.minecraft.entity.decoration.painting" -> "Immobile"; + case "net.minecraft.entity.boss", "net.minecraft.entity.mob", "net.minecraft.entity.boss.dragon" -> + "Hostile mobs"; + case "net.minecraft.entity.projectile", "net.minecraft.entity.projectile.thrown" -> "Projectiles"; + case "net.minecraft.entity.passive" -> "Passive mobs"; + case "net.minecraft.entity.vehicle" -> "Vehicles"; + case "net.minecraft.entity" -> "UNKNOWN"; + default -> throw new Error("Unexpected entity type: " + entity.getClass().getPackageName()); + }; + } + + //Honestly, both "type" and "category" fields in the schema and examples do not contain any useful information + //Since category is optional, I will just leave it out, and for type I will assume general entity classification + //by the Entity class hierarchy (which has some weirdness too by the way) + private static String getEntityTypeForClass(Class entityClass) { + //Top-level classifications + if (WaterCreatureEntity.class.isAssignableFrom(entityClass)) { + return "water_creature"; + } + if (AnimalEntity.class.isAssignableFrom(entityClass)) { + return "animal"; + } + if (HostileEntity.class.isAssignableFrom(entityClass)) { + return "hostile"; + } + if (AmbientEntity.class.isAssignableFrom(entityClass)) { + return "ambient"; + } + + //Second level classifications. PathAwareEntity is not included because it + //doesn't really make much sense to categorize by it + if (PassiveEntity.class.isAssignableFrom(entityClass)) { + return "passive"; + } + if (MobEntity.class.isAssignableFrom(entityClass)) { + return "mob"; + } + + //Other classifications only include living entities and projectiles. everything else is categorized as other + if (LivingEntity.class.isAssignableFrom(entityClass)) { + return "living"; + } + if (ProjectileEntity.class.isAssignableFrom(entityClass)) { + return "projectile"; + } + return "other"; + } + + @Override + public String getDataName() { + return "entities"; + } + + @Override + public JsonArray generateDataJson() { + JsonArray resultArray = new JsonArray(); + Registry> entityTypeRegistry = DGU.getWorld().getRegistryManager().get(RegistryKeys.ENTITY_TYPE); + entityTypeRegistry.forEach(entity -> resultArray.add(generateEntity(entityTypeRegistry, entity))); + return resultArray; + } +} diff --git a/1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/generators/FoodsDataGenerator.java b/1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/generators/FoodsDataGenerator.java new file mode 100644 index 00000000..d4204501 --- /dev/null +++ b/1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/generators/FoodsDataGenerator.java @@ -0,0 +1,53 @@ +package dev.u9g.minecraftdatagenerator.generators; + +import com.google.gson.JsonArray; +import com.google.gson.JsonObject; +import dev.u9g.minecraftdatagenerator.util.DGU; +import net.minecraft.component.DataComponentType; +import net.minecraft.component.DataComponentTypes; +import net.minecraft.component.type.FoodComponent; +import net.minecraft.item.Item; +import net.minecraft.registry.Registry; +import net.minecraft.registry.RegistryKeys; +import net.minecraft.util.Identifier; + +import java.util.Objects; + +public class FoodsDataGenerator implements IDataGenerator { + public static JsonObject generateFoodDescriptor(Registry registry, Item foodItem) { + JsonObject foodDesc = new JsonObject(); + Identifier registryKey = registry.getKey(foodItem).orElseThrow().getValue(); + + foodDesc.addProperty("id", registry.getRawId(foodItem)); + foodDesc.addProperty("name", registryKey.getPath()); + + foodDesc.addProperty("stackSize", foodItem.getMaxCount()); + foodDesc.addProperty("displayName", DGU.translateText(foodItem.getTranslationKey())); + + FoodComponent foodComponent = Objects.requireNonNull(foodItem.getComponents().get(DataComponentTypes.FOOD)); + float foodPoints = foodComponent.nutrition(); + float saturationRatio = foodComponent.saturation() * 2.0F; + float saturation = foodPoints * saturationRatio; + + foodDesc.addProperty("foodPoints", foodPoints); + foodDesc.addProperty("saturation", saturation); + + foodDesc.addProperty("effectiveQuality", foodPoints + saturation); + foodDesc.addProperty("saturationRatio", saturationRatio); + return foodDesc; + } + + @Override + public String getDataName() { + return "foods"; + } + + public JsonArray generateDataJson() { + JsonArray resultsArray = new JsonArray(); + Registry itemRegistry = DGU.getWorld().getRegistryManager().get(RegistryKeys.ITEM); + itemRegistry.stream() + .filter(i -> i.getComponents().contains(DataComponentTypes.FOOD)) + .forEach(food -> resultsArray.add(generateFoodDescriptor(itemRegistry, food))); + return resultsArray; + } +} diff --git a/1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/generators/InstrumentsDataGenerator.java b/1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/generators/InstrumentsDataGenerator.java new file mode 100644 index 00000000..e7b9b54f --- /dev/null +++ b/1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/generators/InstrumentsDataGenerator.java @@ -0,0 +1,25 @@ +package dev.u9g.minecraftdatagenerator.generators; + +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import net.minecraft.block.enums.Instrument; + +public class InstrumentsDataGenerator implements IDataGenerator { + @Override + public String getDataName() { + return "instruments"; + } + + @Override + public JsonElement generateDataJson() { + JsonArray array = new JsonArray(); + for (Instrument instrument : Instrument.values()) { + JsonObject object = new JsonObject(); + object.addProperty("id", instrument.ordinal()); + object.addProperty("name", instrument.asString()); + array.add(object); + } + return array; + } +} diff --git a/1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/generators/ItemsDataGenerator.java b/1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/generators/ItemsDataGenerator.java new file mode 100644 index 00000000..f2e57761 --- /dev/null +++ b/1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/generators/ItemsDataGenerator.java @@ -0,0 +1,90 @@ +package dev.u9g.minecraftdatagenerator.generators; + +import com.google.gson.JsonArray; +import com.google.gson.JsonObject; +import dev.u9g.minecraftdatagenerator.util.DGU; +import net.minecraft.component.DataComponentTypes; +import net.minecraft.component.type.ItemEnchantmentsComponent; +import net.minecraft.enchantment.Enchantment; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.registry.Registry; +import net.minecraft.registry.RegistryKeys; +import net.minecraft.registry.entry.RegistryEntry; +import net.minecraft.registry.tag.TagKey; +import net.minecraft.util.Identifier; + +import java.util.Arrays; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +public class ItemsDataGenerator implements IDataGenerator { + + private static List calculateItemsToRepairWith(Registry itemRegistry, Item sourceItem) { + ItemStack sourceItemStack = sourceItem.getDefaultStack(); + return itemRegistry.stream() + .filter(otherItem -> sourceItem.canRepair(sourceItemStack, otherItem.getDefaultStack())) + .collect(Collectors.toList()); + } + + private static List> getApplicableEnchantmentTargets(Item sourceItem) { + return sourceItem.getComponents().get(DataComponentTypes.ENCHANTMENTS) + .getEnchantments() + .stream() + .map(RegistryEntry::value) + .map(Enchantment::getApplicableItems) + .toList(); + } + + public static JsonObject generateItem(Registry itemRegistry, Item item) { + JsonObject itemDesc = new JsonObject(); + Identifier registryKey = itemRegistry.getKey(item).orElseThrow().getValue(); + + itemDesc.addProperty("id", itemRegistry.getRawId(item)); + itemDesc.addProperty("name", registryKey.getPath()); + + itemDesc.addProperty("displayName", DGU.translateText(item.getTranslationKey())); + itemDesc.addProperty("stackSize", item.getMaxCount()); + + List> enchantmentTargets = getApplicableEnchantmentTargets(item); + + JsonArray enchantCategoriesArray = new JsonArray(); + for (TagKey target : enchantmentTargets) { + enchantCategoriesArray.add(EnchantmentsDataGenerator.getEnchantmentTargetName(target)); + } + if (enchantCategoriesArray.size() > 0) { + itemDesc.add("enchantCategories", enchantCategoriesArray); + } + + if (item.getComponents().contains(DataComponentTypes.DAMAGE)) { + List repairWithItems = calculateItemsToRepairWith(itemRegistry, item); + + JsonArray fixedWithArray = new JsonArray(); + for (Item repairWithItem : repairWithItems) { + Identifier repairWithName = itemRegistry.getKey(repairWithItem).orElseThrow().getValue(); + fixedWithArray.add(repairWithName.getPath()); + } + if (fixedWithArray.size() > 0) { + itemDesc.add("repairWith", fixedWithArray); + } + + int maxDurability = Objects.requireNonNull(item.getComponents().get(DataComponentTypes.MAX_DAMAGE)); + itemDesc.addProperty("maxDurability", maxDurability); + } + return itemDesc; + } + + @Override + public String getDataName() { + return "items"; + } + + @Override + public JsonArray generateDataJson() { + JsonArray resultArray = new JsonArray(); + Registry itemRegistry = DGU.getWorld().getRegistryManager().get(RegistryKeys.ITEM); + itemRegistry.stream().forEach(item -> resultArray.add(generateItem(itemRegistry, item))); + return resultArray; + } +} diff --git a/1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/generators/LanguageDataGenerator.java b/1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/generators/LanguageDataGenerator.java new file mode 100644 index 00000000..7a3c6ced --- /dev/null +++ b/1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/generators/LanguageDataGenerator.java @@ -0,0 +1,27 @@ +package dev.u9g.minecraftdatagenerator.generators; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; + +import java.io.InputStream; +import java.io.InputStreamReader; +import java.nio.charset.StandardCharsets; +import java.util.Objects; + +public class LanguageDataGenerator implements IDataGenerator { + @Override + public String getDataName() { + return "language"; + } + + @Override + public JsonElement generateDataJson() { + try { + InputStream inputStream = Objects.requireNonNull(this.getClass().getResourceAsStream("/assets/minecraft/lang/en_us.json")); + return new Gson().fromJson(new InputStreamReader(inputStream, StandardCharsets.UTF_8), JsonObject.class); + } catch (Exception ignored) { + } + throw new RuntimeException("Failed to generate language file"); + } +} diff --git a/1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java b/1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java new file mode 100644 index 00000000..19964248 --- /dev/null +++ b/1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java @@ -0,0 +1,203 @@ +package dev.u9g.minecraftdatagenerator.generators; + +import com.google.common.base.Joiner; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import dev.u9g.minecraftdatagenerator.util.DGU; +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.block.Blocks; +import net.minecraft.component.DataComponentTypes; +import net.minecraft.component.type.ToolComponent; +import net.minecraft.item.Item; +import net.minecraft.item.Items; +import net.minecraft.item.MiningToolItem; +import net.minecraft.item.SwordItem; +import net.minecraft.registry.Registry; +import net.minecraft.registry.RegistryKeys; +import net.minecraft.registry.tag.BlockTags; +import net.minecraft.registry.tag.TagKey; + +import java.util.*; +import java.util.function.Predicate; +import java.util.stream.Collectors; + +//TODO entire idea of linking materials to tool speeds is obsolete and just wrong now, +//TODO but we kinda have to support it to let old code work for computing digging times, +//TODO so for now we will handle materials as "virtual" ones based on which tools can break blocks +public class MaterialsDataGenerator implements IDataGenerator { + + private static final List> COMPOSITE_MATERIALS = ImmutableList.>builder() + .add(ImmutableList.of("plant", makeMaterialNameForTag(BlockTags.AXE_MINEABLE))) + .add(ImmutableList.of("gourd", makeMaterialNameForTag(BlockTags.AXE_MINEABLE))) + .add(ImmutableList.of(makeMaterialNameForTag(BlockTags.LEAVES), makeMaterialNameForTag(BlockTags.HOE_MINEABLE))) + .add(ImmutableList.of(makeMaterialNameForTag(BlockTags.LEAVES), makeMaterialNameForTag(BlockTags.AXE_MINEABLE), makeMaterialNameForTag(BlockTags.HOE_MINEABLE))) + .add(ImmutableList.of("vine_or_glow_lichen", "plant", makeMaterialNameForTag(BlockTags.AXE_MINEABLE) + )).build(); + + private static String makeMaterialNameForTag(TagKey tag) { + return tag.id().getPath(); + } + + private static void createCompositeMaterialInfo(List allMaterials, List combinedMaterials) { + String compositeMaterialName = Joiner.on(';').join(combinedMaterials); + + List mappedMaterials = combinedMaterials.stream() + .map(otherName -> allMaterials.stream() + .filter(other -> other.getMaterialName().equals(otherName)) + .findFirst().orElseThrow(() -> new RuntimeException("Material not found with name " + otherName))) + .collect(Collectors.toList()); + + Predicate compositePredicate = blockState -> + mappedMaterials.stream().allMatch(it -> it.getPredicate().test(blockState)); + + MaterialInfo materialInfo = new MaterialInfo(compositeMaterialName, compositePredicate).includes(mappedMaterials); + allMaterials.addFirst(materialInfo); + } + + private static void createCompositeMaterial(Map> allMaterials, List combinedMaterials) { + String compositeMaterialName = Joiner.on(';').join(combinedMaterials); + + Map resultingToolSpeeds = new HashMap<>(); + combinedMaterials.stream() + .map(allMaterials::get) + .forEach(resultingToolSpeeds::putAll); + allMaterials.put(compositeMaterialName, resultingToolSpeeds); + } + + public static List getGlobalMaterialInfo() { + ArrayList resultList = new ArrayList<>(); + + resultList.add(new MaterialInfo("vine_or_glow_lichen", blockState -> blockState.isOf(Blocks.VINE) || blockState.isOf(Blocks.GLOW_LICHEN))); + resultList.add(new MaterialInfo("coweb", blockState -> blockState.isOf(Blocks.COBWEB))); + + resultList.add(new MaterialInfo("leaves", blockState -> blockState.isIn(BlockTags.LEAVES))); + resultList.add(new MaterialInfo("wool", blockState -> blockState.isIn(BlockTags.WOOL))); + + // Block Materials were removed in 1.20 in favor of block tags + resultList.add(new MaterialInfo("gourd", blockState -> blockState.isOf(Blocks.MELON) || blockState.isOf(Blocks.PUMPKIN) || blockState.isOf(Blocks.JACK_O_LANTERN))); + // 'sword_efficient' tag is for all plants, and includes everything from the old PLANT and REPLACEABLE_PLANT materials (see https://minecraft.fandom.com/wiki/Tag#Blocks) + resultList.add(new MaterialInfo("plant", blockState -> blockState.isIn(BlockTags.SWORD_EFFICIENT))); + + HashSet uniqueMaterialNames = new HashSet<>(); + + Registry itemRegistry = DGU.getWorld().getRegistryManager().get(RegistryKeys.ITEM); + itemRegistry.forEach(item -> { + if (item instanceof MiningToolItem toolItem) { + ToolComponent toolComponent = toolItem.getComponents().get(DataComponentTypes.TOOL); + TagKey effectiveBlocks = toolComponent.rules().getFirst().blocks().getTagKey().orElseThrow(); + String materialName = makeMaterialNameForTag(effectiveBlocks); + + if (!uniqueMaterialNames.contains(materialName)) { + uniqueMaterialNames.add(materialName); + resultList.add(new MaterialInfo(materialName, blockState -> blockState.isIn(effectiveBlocks))); + } + } + }); + + COMPOSITE_MATERIALS.forEach(values -> createCompositeMaterialInfo(resultList, values)); + return resultList; + } + + @Override + public String getDataName() { + return "materials"; + } + + @Override + public JsonElement generateDataJson() { + Registry itemRegistry = DGU.getWorld().getRegistryManager().get(RegistryKeys.ITEM); + + Map> materialMiningSpeeds = new HashMap<>(); + materialMiningSpeeds.put("default", ImmutableMap.of()); + + //Special materials used for shears and swords special mining speed logic + Map leavesMaterialSpeeds = new HashMap<>(); + Map cowebMaterialSpeeds = new HashMap<>(); + Map plantMaterialSpeeds = new HashMap<>(); + Map gourdMaterialSpeeds = new HashMap<>(); + + materialMiningSpeeds.put(makeMaterialNameForTag(BlockTags.LEAVES), leavesMaterialSpeeds); + materialMiningSpeeds.put("coweb", cowebMaterialSpeeds); + materialMiningSpeeds.put("plant", plantMaterialSpeeds); + materialMiningSpeeds.put("gourd", gourdMaterialSpeeds); + + //Shears need special handling because they do not follow normal rules like tools + leavesMaterialSpeeds.put(Items.SHEARS, 15.0f); + cowebMaterialSpeeds.put(Items.SHEARS, 15.0f); + materialMiningSpeeds.put("vine_or_glow_lichen", ImmutableMap.of(Items.SHEARS, 2.0f)); + materialMiningSpeeds.put("wool", ImmutableMap.of(Items.SHEARS, 5.0f)); + + itemRegistry.forEach(item -> { + //Tools are handled rather easily and do not require anything else + if (item instanceof MiningToolItem toolItem) { + ToolComponent toolComponent = toolItem.getComponents().get(DataComponentTypes.TOOL); + TagKey effectiveBlocks = toolComponent.rules().getFirst().blocks().getTagKey().orElseThrow(); + String materialName = makeMaterialNameForTag(effectiveBlocks); + + Map materialSpeeds = materialMiningSpeeds.computeIfAbsent(materialName, k -> new HashMap<>()); + float miningSpeed = toolComponent.defaultMiningSpeed(); + materialSpeeds.put(item, miningSpeed); + } + + //Swords require special treatment + if (item instanceof SwordItem) { + cowebMaterialSpeeds.put(item, 15.0f); + plantMaterialSpeeds.put(item, 1.5f); + leavesMaterialSpeeds.put(item, 1.5f); + gourdMaterialSpeeds.put(item, 1.5f); + } + }); + + COMPOSITE_MATERIALS.forEach(values -> createCompositeMaterial(materialMiningSpeeds, values)); + + JsonObject resultObject = new JsonObject(); + + for (var entry : materialMiningSpeeds.entrySet()) { + JsonObject toolSpeedsObject = new JsonObject(); + + for (var toolEntry : entry.getValue().entrySet()) { + int rawItemId = itemRegistry.getRawId(toolEntry.getKey()); + toolSpeedsObject.addProperty(Integer.toString(rawItemId), toolEntry.getValue()); + } + resultObject.add(entry.getKey(), toolSpeedsObject); + } + + return resultObject; + } + + public static class MaterialInfo { + private final String materialName; + private final Predicate predicate; + private final List includedMaterials = new ArrayList<>(); + + public MaterialInfo(String materialName, Predicate predicate) { + this.materialName = materialName; + this.predicate = predicate; + } + + protected MaterialInfo includes(List otherMaterials) { + this.includedMaterials.addAll(otherMaterials); + return this; + } + + public String getMaterialName() { + return materialName; + } + + public Predicate getPredicate() { + return predicate; + } + + public boolean includesMaterial(MaterialInfo materialInfo) { + return includedMaterials.contains(materialInfo); + } + + @Override + public String toString() { + return materialName; + } + } +} diff --git a/1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/generators/ParticlesDataGenerator.java b/1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/generators/ParticlesDataGenerator.java new file mode 100644 index 00000000..bc5a9acc --- /dev/null +++ b/1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/generators/ParticlesDataGenerator.java @@ -0,0 +1,33 @@ +package dev.u9g.minecraftdatagenerator.generators; + +import com.google.gson.JsonArray; +import com.google.gson.JsonObject; +import dev.u9g.minecraftdatagenerator.util.DGU; +import net.minecraft.particle.ParticleType; +import net.minecraft.registry.Registry; +import net.minecraft.registry.RegistryKeys; +import net.minecraft.util.Identifier; + +public class ParticlesDataGenerator implements IDataGenerator { + public static JsonObject generateParticleType(Registry> registry, ParticleType particleType) { + JsonObject effectDesc = new JsonObject(); + Identifier registryKey = registry.getKey(particleType).orElseThrow().getValue(); + + effectDesc.addProperty("id", registry.getRawId(particleType)); + effectDesc.addProperty("name", registryKey.getPath()); + return effectDesc; + } + + @Override + public String getDataName() { + return "particles"; + } + + @Override + public JsonArray generateDataJson() { + JsonArray resultsArray = new JsonArray(); + Registry> particleTypeRegistry = DGU.getWorld().getRegistryManager().get(RegistryKeys.PARTICLE_TYPE); + particleTypeRegistry.forEach(particleType -> resultsArray.add(generateParticleType(particleTypeRegistry, particleType))); + return resultsArray; + } +} diff --git a/1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/generators/RecipeDataGenerator.java b/1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/generators/RecipeDataGenerator.java new file mode 100644 index 00000000..ea489d11 --- /dev/null +++ b/1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/generators/RecipeDataGenerator.java @@ -0,0 +1,128 @@ +package dev.u9g.minecraftdatagenerator.generators; + +import com.google.common.collect.ArrayListMultimap; +import com.google.common.collect.Multimap; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import dev.u9g.minecraftdatagenerator.util.DGU; +import net.minecraft.item.Item; +import net.minecraft.recipe.*; +import net.minecraft.registry.DynamicRegistryManager; +import net.minecraft.registry.RegistryKeys; + +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +public class RecipeDataGenerator implements IDataGenerator { + + private static int getRawIdFor(Item item) { + return DGU.getWorld().getRegistryManager().get(RegistryKeys.ITEM).getRawId(item); + } + + @Override + public String getDataName() { + return "recipes"; + } + + @Override + public JsonElement generateDataJson() { + DynamicRegistryManager registryManager = DGU.getWorld().getRegistryManager(); + JsonObject finalObj = new JsonObject(); + Multimap recipes = ArrayListMultimap.create(); + for (RecipeEntry recipeE : Objects.requireNonNull(DGU.getWorld()).getRecipeManager().values()) { + Recipe recipe = recipeE.value(); + if (recipe instanceof ShapedRecipe sr) { + var ingredients = sr.getIngredients(); + List ingr = new ArrayList<>(); + for (int i = 0; i < 9; i++) { + if (i >= ingredients.size()) { + ingr.add(-1); + continue; + } + var stacks = ingredients.get(i); + var matching = stacks.getMatchingStacks(); + if (matching.length == 0) { + ingr.add(-1); + } else { + ingr.add(getRawIdFor(matching[0].getItem())); + } + } + //Lists.reverse(ingr); + + JsonArray inShape = new JsonArray(); + + + var iter = ingr.iterator(); + for (int y = 0; y < sr.getHeight(); y++) { + var jsonRow = new JsonArray(); + for (int z = 0; z < sr.getWidth(); z++) { + jsonRow.add(iter.next()); + } + inShape.add(jsonRow); + } + + JsonObject finalRecipe = new JsonObject(); + finalRecipe.add("inShape", inShape); + + var resultObject = new JsonObject(); + resultObject.addProperty("id", getRawIdFor(sr.getResult(registryManager).getItem())); + resultObject.addProperty("count", sr.getResult(registryManager).getCount()); + finalRecipe.add("result", resultObject); + + String id = ((Integer) getRawIdFor(sr.getResult(registryManager).getItem())).toString(); + + if (!finalObj.has(id)) { + finalObj.add(id, new JsonArray()); + } + finalObj.get(id).getAsJsonArray().add(finalRecipe); +// var input = new JsonArray(); +// var ingredients = sr.getIngredients().stream().toList(); +// for (int y = 0; y < sr.getHeight(); y++) { +// var arr = new JsonArray(); +// for (int x = 0; x < sr.getWidth(); x++) { +// if ((y*3)+x >= ingredients.size()) { +// arr.add(JsonNull.INSTANCE); +// continue; +// } +// var ingredient = ingredients.get((y*3)+x).getMatchingStacks(); // FIXME: fix when there are more than one matching stack +// if (ingredient.length == 0) { +// arr.add(JsonNull.INSTANCE); +// } else { +// arr.add(getRawIdFor(ingredient[0].getItem())); +// } +// } +// input.add(arr); +// } +// var rootRecipeObject = new JsonObject(); +// rootRecipeObject.add("inShape", input); +// var resultObject = new JsonObject(); +// resultObject.addProperty("id", getRawIdFor(sr.getOutput().getItem())); +// resultObject.addProperty("count", sr.getOutput().getCount()); +// rootRecipeObject.add("result", resultObject); +// recipes.put(getRawIdFor(sr.getOutput().getItem()), rootRecipeObject); + } else if (recipe instanceof ShapelessRecipe sl) { + var ingredients = new JsonArray(); + for (Ingredient ingredient : sl.getIngredients()) { + if (ingredient.isEmpty()) continue; + ingredients.add(getRawIdFor(ingredient.getMatchingStacks()[0].getItem())); + } + var rootRecipeObject = new JsonObject(); + rootRecipeObject.add("ingredients", ingredients); + var resultObject = new JsonObject(); + resultObject.addProperty("id", getRawIdFor(sl.getResult(registryManager).getItem())); + resultObject.addProperty("count", sl.getResult(registryManager).getCount()); + rootRecipeObject.add("result", resultObject); + recipes.put(getRawIdFor(sl.getResult(registryManager).getItem()), rootRecipeObject); + } + } + recipes.forEach((a, b) -> { + if (!finalObj.has(a.toString())) { + finalObj.add(a.toString(), new JsonArray()); + } + finalObj.get(a.toString()).getAsJsonArray().add(b); + }); + return finalObj; + } +} diff --git a/1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java b/1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java new file mode 100644 index 00000000..5873a305 --- /dev/null +++ b/1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java @@ -0,0 +1,161 @@ +package dev.u9g.minecraftdatagenerator.generators; + +import com.google.gson.JsonArray; +import com.google.gson.JsonObject; +import dev.u9g.minecraftdatagenerator.util.DGU; +import dev.u9g.minecraftdatagenerator.util.EmptyRenderBlockView; +import net.minecraft.block.Block; +import net.minecraft.block.Blocks; +import net.minecraft.block.RedstoneWireBlock; +import net.minecraft.client.color.block.BlockColors; +import net.minecraft.client.color.world.FoliageColors; +import net.minecraft.registry.DynamicRegistryManager; +import net.minecraft.registry.Registry; +import net.minecraft.registry.RegistryKeys; +import net.minecraft.util.Identifier; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.biome.Biome; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class TintsDataGenerator implements IDataGenerator { + public static BiomeTintColors generateBiomeTintColors(Registry biomeRegistry) { + BiomeTintColors colors = new BiomeTintColors(); + + biomeRegistry.forEach(biome -> { + int biomeGrassColor = biome.getGrassColorAt(0.0, 0.0); + int biomeFoliageColor = biome.getFoliageColor(); + int biomeWaterColor = biome.getWaterColor(); + + colors.grassColoursMap.computeIfAbsent(biomeGrassColor, k -> new ArrayList<>()).add(biome); + colors.foliageColoursMap.computeIfAbsent(biomeFoliageColor, k -> new ArrayList<>()).add(biome); + colors.waterColourMap.computeIfAbsent(biomeWaterColor, k -> new ArrayList<>()).add(biome); + }); + return colors; + } + + public static Map generateRedstoneTintColors() { + Map resultColors = new HashMap<>(); + + for (int redstoneLevel : RedstoneWireBlock.POWER.getValues()) { + int color = RedstoneWireBlock.getWireColor(redstoneLevel); + resultColors.put(redstoneLevel, color); + } + return resultColors; + } + + private static int getBlockColor(Block block) { + return BlockColors.create().getColor(block.getDefaultState(), EmptyRenderBlockView.INSTANCE, BlockPos.ORIGIN, 0xFFFFFF); + } + + public static Map generateConstantTintColors() { + Map resultColors = new HashMap<>(); + + resultColors.put(Blocks.BIRCH_LEAVES, FoliageColors.getBirchColor()); + resultColors.put(Blocks.SPRUCE_LEAVES, FoliageColors.getSpruceColor()); + + resultColors.put(Blocks.LILY_PAD, getBlockColor(Blocks.LILY_PAD)); + resultColors.put(Blocks.ATTACHED_MELON_STEM, getBlockColor(Blocks.ATTACHED_MELON_STEM)); + resultColors.put(Blocks.ATTACHED_PUMPKIN_STEM, getBlockColor(Blocks.ATTACHED_PUMPKIN_STEM)); + + //not really constant, depend on the block age, but kinda have to be handled since textures are literally white without them + resultColors.put(Blocks.MELON_STEM, getBlockColor(Blocks.MELON_STEM)); + resultColors.put(Blocks.PUMPKIN_STEM, getBlockColor(Blocks.PUMPKIN_STEM)); + + return resultColors; + } + + private static JsonObject encodeBiomeColorMap(Registry biomeRegistry, Map> colorsMap) { + JsonArray resultColorsArray = new JsonArray(); + for (var entry : colorsMap.entrySet()) { + JsonObject entryObject = new JsonObject(); + + JsonArray keysArray = new JsonArray(); + for (Biome biome : entry.getValue()) { + Identifier registryKey = biomeRegistry.getKey(biome).orElseThrow().getValue(); + keysArray.add(registryKey.getPath()); + } + + entryObject.add("keys", keysArray); + entryObject.addProperty("color", entry.getKey()); + resultColorsArray.add(entryObject); + } + + JsonObject resultObject = new JsonObject(); + resultObject.add("data", resultColorsArray); + return resultObject; + } + + private static JsonObject encodeRedstoneColorMap(Map colorsMap) { + JsonArray resultColorsArray = new JsonArray(); + for (var entry : colorsMap.entrySet()) { + JsonObject entryObject = new JsonObject(); + + JsonArray keysArray = new JsonArray(); + keysArray.add(entry.getKey()); + + entryObject.add("keys", keysArray); + entryObject.addProperty("color", entry.getValue()); + resultColorsArray.add(entryObject); + } + + JsonObject resultObject = new JsonObject(); + resultObject.add("data", resultColorsArray); + return resultObject; + } + + private static JsonObject encodeBlocksColorMap(Registry blockRegistry, Map colorsMap) { + JsonArray resultColorsArray = new JsonArray(); + for (var entry : colorsMap.entrySet()) { + JsonObject entryObject = new JsonObject(); + + JsonArray keysArray = new JsonArray(); + Identifier registryKey = blockRegistry.getKey(entry.getKey()).orElseThrow().getValue(); + keysArray.add(registryKey.getPath()); + + entryObject.add("keys", keysArray); + entryObject.addProperty("color", entry.getValue()); + resultColorsArray.add(entryObject); + } + + JsonObject resultObject = new JsonObject(); + resultObject.add("data", resultColorsArray); + return resultObject; + } + + @Override + public String getDataName() { + return "tints"; + } + + @Override + public JsonObject generateDataJson() { + DynamicRegistryManager registryManager = DGU.getWorld().getRegistryManager(); + Registry biomeRegistry = registryManager.get(RegistryKeys.BIOME); + Registry blockRegistry = registryManager.get(RegistryKeys.BLOCK); + + BiomeTintColors biomeTintColors = generateBiomeTintColors(biomeRegistry); + Map redstoneColors = generateRedstoneTintColors(); + Map constantTintColors = generateConstantTintColors(); + + JsonObject resultObject = new JsonObject(); + + resultObject.add("grass", encodeBiomeColorMap(biomeRegistry, biomeTintColors.grassColoursMap)); + resultObject.add("foliage", encodeBiomeColorMap(biomeRegistry, biomeTintColors.foliageColoursMap)); + resultObject.add("water", encodeBiomeColorMap(biomeRegistry, biomeTintColors.waterColourMap)); + + resultObject.add("redstone", encodeRedstoneColorMap(redstoneColors)); + resultObject.add("constant", encodeBlocksColorMap(blockRegistry, constantTintColors)); + + return resultObject; + } + + public static class BiomeTintColors { + final Map> grassColoursMap = new HashMap<>(); + final Map> foliageColoursMap = new HashMap<>(); + final Map> waterColourMap = new HashMap<>(); + } +} diff --git a/1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/mixin/EULAMixin.java b/1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/mixin/EULAMixin.java new file mode 100644 index 00000000..0d297e7a --- /dev/null +++ b/1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/mixin/EULAMixin.java @@ -0,0 +1,15 @@ +package dev.u9g.minecraftdatagenerator.mixin; + +import net.minecraft.server.dedicated.EulaReader; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +@Mixin(EulaReader.class) +public class EULAMixin { + @Inject(method = "isEulaAgreedTo()Z", at = @At("TAIL"), cancellable = true) + public void init(CallbackInfoReturnable cir) { + cir.setReturnValue(true); + } +} diff --git a/1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java b/1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java new file mode 100644 index 00000000..cf8d9ffc --- /dev/null +++ b/1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java @@ -0,0 +1,22 @@ +package dev.u9g.minecraftdatagenerator.mixin; + +import dev.u9g.minecraftdatagenerator.MinecraftDataGenerator; +import dev.u9g.minecraftdatagenerator.util.DGU; +import net.minecraft.MinecraftVersion; +import net.minecraft.server.dedicated.MinecraftDedicatedServer; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +@Mixin(MinecraftDedicatedServer.class) +public class ReadyMixin { + + @Inject(method = "setupServer()Z", at = @At("TAIL")) + private void init(CallbackInfoReturnable cir) { + MinecraftDataGenerator.start( + MinecraftVersion.CURRENT.getName(), + DGU.getCurrentlyRunningServer().getRunDirectory().toPath() + ); + } +} diff --git a/1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java b/1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java new file mode 100644 index 00000000..3946c1fe --- /dev/null +++ b/1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/util/DGU.java @@ -0,0 +1,21 @@ +package dev.u9g.minecraftdatagenerator.util; + +import net.fabricmc.loader.api.FabricLoader; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.Language; +import net.minecraft.world.World; + +public class DGU { + @SuppressWarnings("deprecation") + public static MinecraftServer getCurrentlyRunningServer() { + return (MinecraftServer) FabricLoader.getInstance().getGameInstance(); + } + + public static String translateText(String translationKey) { + return Language.getInstance().get(translationKey); + } + + public static World getWorld() { + return getCurrentlyRunningServer().getOverworld(); + } +} diff --git a/1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/util/EmptyRenderBlockView.java b/1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/util/EmptyRenderBlockView.java new file mode 100644 index 00000000..460efd82 --- /dev/null +++ b/1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/util/EmptyRenderBlockView.java @@ -0,0 +1,72 @@ +package dev.u9g.minecraftdatagenerator.util; + +import net.minecraft.block.BlockState; +import net.minecraft.block.Blocks; +import net.minecraft.block.entity.BlockEntity; +import net.minecraft.fluid.FluidState; +import net.minecraft.fluid.Fluids; +import net.minecraft.registry.Registry; +import net.minecraft.registry.RegistryKeys; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Direction; +import net.minecraft.world.BlockRenderView; +import net.minecraft.world.LightType; +import net.minecraft.world.biome.Biome; +import net.minecraft.world.biome.BiomeKeys; +import net.minecraft.world.biome.ColorResolver; +import net.minecraft.world.chunk.light.LightingProvider; +import org.jetbrains.annotations.Nullable; + +public enum EmptyRenderBlockView implements BlockRenderView { + INSTANCE; + + @Nullable + public BlockEntity getBlockEntity(BlockPos pos) { + return null; + } + + public BlockState getBlockState(BlockPos pos) { + return Blocks.AIR.getDefaultState(); + } + + public FluidState getFluidState(BlockPos pos) { + return Fluids.EMPTY.getDefaultState(); + } + + public int getBottomY() { + return 0; + } + + public int getHeight() { + return 0; + } + + + @Override + public float getBrightness(Direction direction, boolean shaded) { + return 0.0f; + } + + @Override + public LightingProvider getLightingProvider() { + return null; + } + + @Override + public int getColor(BlockPos pos, ColorResolver colorResolver) { + Registry biomeRegistry = DGU.getWorld().getRegistryManager().get(RegistryKeys.BIOME); + Biome plainsBiome = biomeRegistry.get(BiomeKeys.PLAINS); + + return colorResolver.getColor(plainsBiome, pos.getX(), pos.getY()); + } + + @Override + public int getLightLevel(LightType type, BlockPos pos) { + return type == LightType.SKY ? getMaxLightLevel() : 0; + } + + @Override + public int getBaseLightLevel(BlockPos pos, int ambientDarkness) { + return ambientDarkness; + } +} diff --git a/1.20.5/src/main/resources/fabric.mod.json b/1.20.5/src/main/resources/fabric.mod.json new file mode 100644 index 00000000..ffac96b0 --- /dev/null +++ b/1.20.5/src/main/resources/fabric.mod.json @@ -0,0 +1,20 @@ +{ + "schemaVersion": 1, + "id": "minecraft-data-generator", + "version": "${version}", + "name": "Minecraft Data Generator", + "description": "", + "authors": [ + "Archengius", + "U9G" + ], + "contact": {}, + "license": "MIT", + "mixins": [ + "minecraft-data-generator.mixins.json" + ], + "depends": { + "fabricloader": "*", + "minecraft": "*" + } +} diff --git a/1.20.5/src/main/resources/minecraft-data-generator.mixins.json b/1.20.5/src/main/resources/minecraft-data-generator.mixins.json new file mode 100644 index 00000000..82185961 --- /dev/null +++ b/1.20.5/src/main/resources/minecraft-data-generator.mixins.json @@ -0,0 +1,15 @@ +{ + "required": true, + "minVersion": "0.8", + "package": "dev.u9g.minecraftdatagenerator.mixin", + "compatibilityLevel": "JAVA_17", + "mixins": [ + "EULAMixin", + "ReadyMixin" + ], + "client": [ + ], + "injectors": { + "defaultRequire": 1 + } +} diff --git a/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java b/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java index 35d6dc63..eed51b47 100644 --- a/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java +++ b/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java @@ -14,26 +14,8 @@ import java.util.Locale; public class EnchantmentsDataGenerator implements IDataGenerator { - - private static final ImmutableMap ENCHANTMENT_TARGET_NAMES = ImmutableMap.builder() - .put(EnchantmentTarget.ARMOR, "armor") - .put(EnchantmentTarget.ARMOR_FEET, "armor_feet") - .put(EnchantmentTarget.ARMOR_LEGS, "armor_legs") - .put(EnchantmentTarget.ARMOR_CHEST, "armor_chest") - .put(EnchantmentTarget.ARMOR_HEAD, "armor_head") - .put(EnchantmentTarget.WEAPON, "weapon") - .put(EnchantmentTarget.DIGGER, "digger") - .put(EnchantmentTarget.FISHING_ROD, "fishing_rod") - .put(EnchantmentTarget.TRIDENT, "trident") - .put(EnchantmentTarget.BREAKABLE, "breakable") - .put(EnchantmentTarget.BOW, "bow") - .put(EnchantmentTarget.WEARABLE, "wearable") - .put(EnchantmentTarget.CROSSBOW, "crossbow") - .put(EnchantmentTarget.VANISHABLE, "vanishable") - .build(); - public static String getEnchantmentTargetName(EnchantmentTarget target) { - return ENCHANTMENT_TARGET_NAMES.getOrDefault(target, target.name().toLowerCase(Locale.ROOT)); + return target.name().toLowerCase(Locale.ROOT); } //Equation enchantment costs follow is a * level + b, so we can easily retrieve a and b by passing zero level diff --git a/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java b/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java index 71ed7b6f..dce173a6 100644 --- a/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java +++ b/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java @@ -15,19 +15,6 @@ public class EnchantmentsDataGenerator implements IDataGenerator { private static final ImmutableMap ENCHANTMENT_TARGET_NAMES = ImmutableMap.builder() - .put(EnchantmentTarget.ARMOR, "armor") - .put(EnchantmentTarget.ARMOR_FEET, "armor_feet") - .put(EnchantmentTarget.ARMOR_LEGS, "armor_legs") - .put(EnchantmentTarget.ARMOR_CHEST, "armor_chest") - .put(EnchantmentTarget.ARMOR_HEAD, "armor_head") - .put(EnchantmentTarget.WEAPON, "weapon") - .put(EnchantmentTarget.DIGGER, "digger") - .put(EnchantmentTarget.FISHING_ROD, "fishing_rod") - .put(EnchantmentTarget.TRIDENT, "trident") - .put(EnchantmentTarget.BREAKABLE, "breakable") - .put(EnchantmentTarget.BOW, "bow") - .put(EnchantmentTarget.WEARABLE, "wearable") - .put(EnchantmentTarget.CROSSBOW, "crossbow") .put(EnchantmentTarget.VANISHABLE, "vanishable") .build(); diff --git a/settings.gradle b/settings.gradle index 270c0d42..d1a579b5 100644 --- a/settings.gradle +++ b/settings.gradle @@ -30,4 +30,5 @@ include "common" "1.19.2", "1.20", "1.20.4", + "1.20.5", ].forEach { include it } From 27cb832f226d9802f1b7e6e86616e4cdc27abda6 Mon Sep 17 00:00:00 2001 From: AlexProgrammerDE <40795980+AlexProgrammerDE@users.noreply.github.com> Date: Thu, 16 May 2024 20:48:58 +0200 Subject: [PATCH 29/38] Cleanup a lot of stuff --- .../generators/EnchantmentsDataGenerator.java | 1 - .../generators/EnchantmentsDataGenerator.java | 1 - .../generators/MaterialsDataGenerator.java | 5 +- .../generators/EnchantmentsDataGenerator.java | 1 - .../generators/MaterialsDataGenerator.java | 10 ++-- .../generators/EnchantmentsDataGenerator.java | 1 - .../generators/MaterialsDataGenerator.java | 5 +- .../generators/EnchantmentsDataGenerator.java | 1 - .../generators/MaterialsDataGenerator.java | 5 +- .../generators/MaterialsDataGenerator.java | 5 +- .../generators/EnchantmentsDataGenerator.java | 1 - .../generators/EntitiesDataGenerator.java | 2 - .../generators/FoodsDataGenerator.java | 1 - .../generators/ItemsDataGenerator.java | 2 - .../generators/MaterialsDataGenerator.java | 5 +- .../generators/EnchantmentsDataGenerator.java | 1 - .../generators/MaterialsDataGenerator.java | 5 +- .../generators/MaterialsDataGenerator.java | 5 +- README.md | 2 + .../CustomFabricLikeMinecraftTransformer.kt | 56 ++++++++++++++----- .../CustomFabricMinecraftTransformer.kt | 5 +- .../CustomLegacyFabricMinecraftTransformer.kt | 3 +- common/build.gradle | 2 + .../MinecraftDataGenerator.java | 10 +++- .../generators/DataGenerators.java | 26 ++++----- gradle.properties | 3 - settings.gradle | 2 +- 27 files changed, 91 insertions(+), 75 deletions(-) diff --git a/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java b/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java index fa5bd235..44449345 100644 --- a/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java +++ b/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java @@ -1,6 +1,5 @@ package dev.u9g.minecraftdatagenerator.generators; -import com.google.common.collect.ImmutableMap; import com.google.gson.JsonArray; import com.google.gson.JsonObject; import dev.u9g.minecraftdatagenerator.util.DGU; diff --git a/1.17/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java b/1.17/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java index fa5bd235..44449345 100644 --- a/1.17/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java +++ b/1.17/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java @@ -1,6 +1,5 @@ package dev.u9g.minecraftdatagenerator.generators; -import com.google.common.collect.ImmutableMap; import com.google.gson.JsonArray; import com.google.gson.JsonObject; import dev.u9g.minecraftdatagenerator.util.DGU; diff --git a/1.17/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java b/1.17/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java index 825a260e..b059c6a3 100644 --- a/1.17/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java +++ b/1.17/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java @@ -1,6 +1,5 @@ package dev.u9g.minecraftdatagenerator.generators; -import com.google.common.base.Joiner; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.gson.JsonElement; @@ -41,7 +40,7 @@ private static String makeMaterialNameForTag(Tag tag) { } private static void createCompositeMaterialInfo(List allMaterials, List combinedMaterials) { - String compositeMaterialName = Joiner.on(';').join(combinedMaterials); + String compositeMaterialName = String.join(";", combinedMaterials); List mappedMaterials = combinedMaterials.stream() .map(otherName -> allMaterials.stream() @@ -57,7 +56,7 @@ private static void createCompositeMaterialInfo(List allMaterials, } private static void createCompositeMaterial(Map> allMaterials, List combinedMaterials) { - String compositeMaterialName = Joiner.on(';').join(combinedMaterials); + String compositeMaterialName = String.join(";", combinedMaterials); Map resultingToolSpeeds = new HashMap<>(); combinedMaterials.stream() diff --git a/1.18/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java b/1.18/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java index fa5bd235..44449345 100644 --- a/1.18/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java +++ b/1.18/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java @@ -1,6 +1,5 @@ package dev.u9g.minecraftdatagenerator.generators; -import com.google.common.collect.ImmutableMap; import com.google.gson.JsonArray; import com.google.gson.JsonObject; import dev.u9g.minecraftdatagenerator.util.DGU; diff --git a/1.18/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java b/1.18/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java index 825a260e..1f4dc6cb 100644 --- a/1.18/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java +++ b/1.18/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java @@ -1,6 +1,5 @@ package dev.u9g.minecraftdatagenerator.generators; -import com.google.common.base.Joiner; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.gson.JsonElement; @@ -41,7 +40,7 @@ private static String makeMaterialNameForTag(Tag tag) { } private static void createCompositeMaterialInfo(List allMaterials, List combinedMaterials) { - String compositeMaterialName = Joiner.on(';').join(combinedMaterials); + String compositeMaterialName = String.join(";", combinedMaterials); List mappedMaterials = combinedMaterials.stream() .map(otherName -> allMaterials.stream() @@ -57,12 +56,15 @@ private static void createCompositeMaterialInfo(List allMaterials, } private static void createCompositeMaterial(Map> allMaterials, List combinedMaterials) { - String compositeMaterialName = Joiner.on(';').join(combinedMaterials); + String compositeMaterialName = String.join(";", combinedMaterials); Map resultingToolSpeeds = new HashMap<>(); combinedMaterials.stream() .map(allMaterials::get) - .forEach(resultingToolSpeeds::putAll); + .forEach(v -> { + System.out.println(v); + resultingToolSpeeds.putAll(v); + }); allMaterials.put(compositeMaterialName, resultingToolSpeeds); } diff --git a/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java b/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java index fa5bd235..44449345 100644 --- a/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java +++ b/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java @@ -1,6 +1,5 @@ package dev.u9g.minecraftdatagenerator.generators; -import com.google.common.collect.ImmutableMap; import com.google.gson.JsonArray; import com.google.gson.JsonObject; import dev.u9g.minecraftdatagenerator.util.DGU; diff --git a/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java b/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java index 5133d9eb..e437e5df 100644 --- a/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java +++ b/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java @@ -1,6 +1,5 @@ package dev.u9g.minecraftdatagenerator.generators; -import com.google.common.base.Joiner; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.gson.JsonElement; @@ -40,7 +39,7 @@ private static String makeMaterialNameForTag(TagKey tag) { } private static void createCompositeMaterialInfo(List allMaterials, List combinedMaterials) { - String compositeMaterialName = Joiner.on(';').join(combinedMaterials); + String compositeMaterialName = String.join(";", combinedMaterials); List mappedMaterials = combinedMaterials.stream() .map(otherName -> allMaterials.stream() @@ -56,7 +55,7 @@ private static void createCompositeMaterialInfo(List allMaterials, } private static void createCompositeMaterial(Map> allMaterials, List combinedMaterials) { - String compositeMaterialName = Joiner.on(';').join(combinedMaterials); + String compositeMaterialName = String.join(";", combinedMaterials); Map resultingToolSpeeds = new HashMap<>(); combinedMaterials.stream() diff --git a/1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java b/1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java index fa5bd235..44449345 100644 --- a/1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java +++ b/1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java @@ -1,6 +1,5 @@ package dev.u9g.minecraftdatagenerator.generators; -import com.google.common.collect.ImmutableMap; import com.google.gson.JsonArray; import com.google.gson.JsonObject; import dev.u9g.minecraftdatagenerator.util.DGU; diff --git a/1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java b/1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java index 5133d9eb..e437e5df 100644 --- a/1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java +++ b/1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java @@ -1,6 +1,5 @@ package dev.u9g.minecraftdatagenerator.generators; -import com.google.common.base.Joiner; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.gson.JsonElement; @@ -40,7 +39,7 @@ private static String makeMaterialNameForTag(TagKey tag) { } private static void createCompositeMaterialInfo(List allMaterials, List combinedMaterials) { - String compositeMaterialName = Joiner.on(';').join(combinedMaterials); + String compositeMaterialName = String.join(";", combinedMaterials); List mappedMaterials = combinedMaterials.stream() .map(otherName -> allMaterials.stream() @@ -56,7 +55,7 @@ private static void createCompositeMaterialInfo(List allMaterials, } private static void createCompositeMaterial(Map> allMaterials, List combinedMaterials) { - String compositeMaterialName = Joiner.on(';').join(combinedMaterials); + String compositeMaterialName = String.join(";", combinedMaterials); Map resultingToolSpeeds = new HashMap<>(); combinedMaterials.stream() diff --git a/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java b/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java index 0de1c866..9063d1ea 100644 --- a/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java +++ b/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java @@ -1,6 +1,5 @@ package dev.u9g.minecraftdatagenerator.generators; -import com.google.common.base.Joiner; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.gson.JsonElement; @@ -41,7 +40,7 @@ private static String makeMaterialNameForTag(TagKey tag) { } private static void createCompositeMaterialInfo(List allMaterials, List combinedMaterials) { - String compositeMaterialName = Joiner.on(';').join(combinedMaterials); + String compositeMaterialName = String.join(";", combinedMaterials); List mappedMaterials = combinedMaterials.stream() .map(otherName -> allMaterials.stream() @@ -57,7 +56,7 @@ private static void createCompositeMaterialInfo(List allMaterials, } private static void createCompositeMaterial(Map> allMaterials, List combinedMaterials) { - String compositeMaterialName = Joiner.on(';').join(combinedMaterials); + String compositeMaterialName = String.join(";", combinedMaterials); Map resultingToolSpeeds = new HashMap<>(); combinedMaterials.stream() diff --git a/1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java b/1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java index 36064a2b..5d2ebb96 100644 --- a/1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java +++ b/1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java @@ -1,6 +1,5 @@ package dev.u9g.minecraftdatagenerator.generators; -import com.google.common.collect.ImmutableMap; import com.google.gson.JsonArray; import com.google.gson.JsonObject; import dev.u9g.minecraftdatagenerator.util.DGU; diff --git a/1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java b/1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java index 19fd6fa8..70a88040 100644 --- a/1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java +++ b/1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java @@ -15,8 +15,6 @@ import net.minecraft.entity.projectile.ProjectileEntity; import net.minecraft.registry.Registry; import net.minecraft.registry.RegistryKeys; -import net.minecraft.resource.featuretoggle.FeatureFlags; -import net.minecraft.resource.featuretoggle.FeatureSet; import net.minecraft.server.MinecraftServer; import net.minecraft.util.Identifier; diff --git a/1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/generators/FoodsDataGenerator.java b/1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/generators/FoodsDataGenerator.java index d4204501..ddb61fe9 100644 --- a/1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/generators/FoodsDataGenerator.java +++ b/1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/generators/FoodsDataGenerator.java @@ -3,7 +3,6 @@ import com.google.gson.JsonArray; import com.google.gson.JsonObject; import dev.u9g.minecraftdatagenerator.util.DGU; -import net.minecraft.component.DataComponentType; import net.minecraft.component.DataComponentTypes; import net.minecraft.component.type.FoodComponent; import net.minecraft.item.Item; diff --git a/1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/generators/ItemsDataGenerator.java b/1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/generators/ItemsDataGenerator.java index f2e57761..836cf5a9 100644 --- a/1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/generators/ItemsDataGenerator.java +++ b/1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/generators/ItemsDataGenerator.java @@ -4,7 +4,6 @@ import com.google.gson.JsonObject; import dev.u9g.minecraftdatagenerator.util.DGU; import net.minecraft.component.DataComponentTypes; -import net.minecraft.component.type.ItemEnchantmentsComponent; import net.minecraft.enchantment.Enchantment; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -14,7 +13,6 @@ import net.minecraft.registry.tag.TagKey; import net.minecraft.util.Identifier; -import java.util.Arrays; import java.util.List; import java.util.Objects; import java.util.stream.Collectors; diff --git a/1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java b/1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java index 19964248..f62397a7 100644 --- a/1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java +++ b/1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java @@ -1,6 +1,5 @@ package dev.u9g.minecraftdatagenerator.generators; -import com.google.common.base.Joiner; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.gson.JsonElement; @@ -42,7 +41,7 @@ private static String makeMaterialNameForTag(TagKey tag) { } private static void createCompositeMaterialInfo(List allMaterials, List combinedMaterials) { - String compositeMaterialName = Joiner.on(';').join(combinedMaterials); + String compositeMaterialName = String.join(";", combinedMaterials); List mappedMaterials = combinedMaterials.stream() .map(otherName -> allMaterials.stream() @@ -58,7 +57,7 @@ private static void createCompositeMaterialInfo(List allMaterials, } private static void createCompositeMaterial(Map> allMaterials, List combinedMaterials) { - String compositeMaterialName = Joiner.on(';').join(combinedMaterials); + String compositeMaterialName = String.join(";", combinedMaterials); Map resultingToolSpeeds = new HashMap<>(); combinedMaterials.stream() diff --git a/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java b/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java index eed51b47..d00d886d 100644 --- a/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java +++ b/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/EnchantmentsDataGenerator.java @@ -1,6 +1,5 @@ package dev.u9g.minecraftdatagenerator.generators; -import com.google.common.collect.ImmutableMap; import com.google.gson.JsonArray; import com.google.gson.JsonObject; import dev.u9g.minecraftdatagenerator.util.DGU; diff --git a/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java b/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java index 0de1c866..9063d1ea 100644 --- a/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java +++ b/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java @@ -1,6 +1,5 @@ package dev.u9g.minecraftdatagenerator.generators; -import com.google.common.base.Joiner; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.gson.JsonElement; @@ -41,7 +40,7 @@ private static String makeMaterialNameForTag(TagKey tag) { } private static void createCompositeMaterialInfo(List allMaterials, List combinedMaterials) { - String compositeMaterialName = Joiner.on(';').join(combinedMaterials); + String compositeMaterialName = String.join(";", combinedMaterials); List mappedMaterials = combinedMaterials.stream() .map(otherName -> allMaterials.stream() @@ -57,7 +56,7 @@ private static void createCompositeMaterialInfo(List allMaterials, } private static void createCompositeMaterial(Map> allMaterials, List combinedMaterials) { - String compositeMaterialName = Joiner.on(';').join(combinedMaterials); + String compositeMaterialName = String.join(";", combinedMaterials); Map resultingToolSpeeds = new HashMap<>(); combinedMaterials.stream() diff --git a/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java b/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java index 5133d9eb..e437e5df 100644 --- a/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java +++ b/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java @@ -1,6 +1,5 @@ package dev.u9g.minecraftdatagenerator.generators; -import com.google.common.base.Joiner; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.gson.JsonElement; @@ -40,7 +39,7 @@ private static String makeMaterialNameForTag(TagKey tag) { } private static void createCompositeMaterialInfo(List allMaterials, List combinedMaterials) { - String compositeMaterialName = Joiner.on(';').join(combinedMaterials); + String compositeMaterialName = String.join(";", combinedMaterials); List mappedMaterials = combinedMaterials.stream() .map(otherName -> allMaterials.stream() @@ -56,7 +55,7 @@ private static void createCompositeMaterialInfo(List allMaterials, } private static void createCompositeMaterial(Map> allMaterials, List combinedMaterials) { - String compositeMaterialName = Joiner.on(';').join(combinedMaterials); + String compositeMaterialName = String.join(";", combinedMaterials); Map resultingToolSpeeds = new HashMap<>(); combinedMaterials.stream() diff --git a/README.md b/README.md index a13bc785..209c5f08 100644 --- a/README.md +++ b/README.md @@ -10,11 +10,13 @@ You can put any version that has a directory into the command below. Just replace `` with the version you want to generate. For Linux/Mac OS: + ```bash ./gradlew ::runServer ``` For Windows: + ```bash gradlew.bat ::runServer ``` diff --git a/buildSrc/src/main/kotlin/CustomFabricLikeMinecraftTransformer.kt b/buildSrc/src/main/kotlin/CustomFabricLikeMinecraftTransformer.kt index 468b599f..41724052 100644 --- a/buildSrc/src/main/kotlin/CustomFabricLikeMinecraftTransformer.kt +++ b/buildSrc/src/main/kotlin/CustomFabricLikeMinecraftTransformer.kt @@ -38,8 +38,12 @@ abstract class CustomFabricLikeMinecraftTransformer( providerName: String, val modJsonName: String, val accessWidenerJsonKey: String, - private val accessWidenerTransformer: AccessWidenerMinecraftTransformer = AccessWidenerMinecraftTransformer(project, provider, providerName), -): AbstractMinecraftTransformer( + private val accessWidenerTransformer: AccessWidenerMinecraftTransformer = AccessWidenerMinecraftTransformer( + project, + provider, + providerName + ), +) : AbstractMinecraftTransformer( project, provider, providerName @@ -49,9 +53,10 @@ abstract class CustomFabricLikeMinecraftTransformer( val GSON: Gson = GsonBuilder().setPrettyPrinting().create() } - val fabric: Configuration = project.configurations.maybeCreate(providerName.withSourceSet(provider.sourceSet)).also { - provider.minecraftLibraries.extendsFrom(it) - } + val fabric: Configuration = + project.configurations.maybeCreate(providerName.withSourceSet(provider.sourceSet)).also { + provider.minecraftLibraries.extendsFrom(it) + } private val fabricJson: Configuration = project.configurations.detachedConfiguration() @@ -93,7 +98,9 @@ abstract class CustomFabricLikeMinecraftTransformer( } override fun prodNamespace(namespace: String) { - val delegate: FinalizeOnRead = CustomFabricLikeMinecraftTransformer::class.getField("prodNamespace")!!.getDelegate(this) as FinalizeOnRead + val delegate: FinalizeOnRead = + CustomFabricLikeMinecraftTransformer::class.getField("prodNamespace")!! + .getDelegate(this) as FinalizeOnRead delegate.setValueIntl(LazyMutable { provider.mappings.getNamespace(namespace) }) } @@ -203,7 +210,8 @@ abstract class CustomFabricLikeMinecraftTransformer( provider.minecraftLibraries.dependencies.add(dep) } - override fun afterRemap(baseMinecraft: MinecraftJar): MinecraftJar = applyInterfaceInjection(accessWidenerTransformer.afterRemap(baseMinecraft)) + override fun afterRemap(baseMinecraft: MinecraftJar): MinecraftJar = + applyInterfaceInjection(accessWidenerTransformer.afterRemap(baseMinecraft)) private fun applyInterfaceInjection(baseMinecraft: MinecraftJar): MinecraftJar { val injections = hashMapOf>() @@ -234,7 +242,11 @@ abstract class CustomFabricLikeMinecraftTransformer( } abstract fun collectInterfaceInjections(baseMinecraft: MinecraftJar, injections: HashMap>) - fun collectInterfaceInjections(baseMinecraft: MinecraftJar, injections: HashMap>, interfaces: JsonObject) { + fun collectInterfaceInjections( + baseMinecraft: MinecraftJar, + injections: HashMap>, + interfaces: JsonObject + ) { injections.putAll(interfaces.entrySet() .filterNotNull() .filter { it.key != null && it.value != null && it.value.isJsonArray } @@ -254,10 +266,12 @@ abstract class CustomFabricLikeMinecraftTransformer( ) if (clazz != null) { - var newTarget = clazz.getName(provider.mappings.mappingTree.getNamespaceId(baseMinecraft.mappingNamespace.name)) + var newTarget = + clazz.getName(provider.mappings.mappingTree.getNamespaceId(baseMinecraft.mappingNamespace.name)) if (newTarget == null) { - newTarget = clazz.getName(provider.mappings.mappingTree.getNamespaceId(baseMinecraft.fallbackNamespace.name)) + newTarget = + clazz.getName(provider.mappings.mappingTree.getNamespaceId(baseMinecraft.fallbackNamespace.name)) } if (newTarget != null) { @@ -270,7 +284,8 @@ abstract class CustomFabricLikeMinecraftTransformer( ) } - val intermediaryClasspath: Path = provider.localCache.resolve("remapClasspath.txt".withSourceSet(provider.sourceSet)) + val intermediaryClasspath: Path = + provider.localCache.resolve("remapClasspath.txt".withSourceSet(provider.sourceSet)) override fun afterEvaluate() { project.logger.lifecycle("[Unimined/Fabric] Generating intermediary classpath.") @@ -281,7 +296,10 @@ abstract class CustomFabricLikeMinecraftTransformer( provider.sourceSet.runtimeClasspath.filter { !provider.isMinecraftJar(it.toPath()) }.toSet() ) + provider.getMinecraft(prodNamespace, prodNamespace).toFile()).filter { it.exists() && !it.isDirectory } // write to file - intermediaryClasspath.writeText(classpath.joinToString(File.pathSeparator), options = arrayOf(StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING)) + intermediaryClasspath.writeText( + classpath.joinToString(File.pathSeparator), + options = arrayOf(StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING) + ) } override fun afterRemapJarTask(remapJarTask: RemapJarTask, output: Path) { @@ -387,8 +405,18 @@ abstract class CustomFabricLikeMinecraftTransformer( groups.remove(proj to sourceSet) } } - project.logger.info("[Unimined/FabricLike] Classpath groups: ${groups.map { it.key.toPath() + " -> " + it.value.joinToString(", ") { it.toPath() } }.joinToString("\n ")}") - groups.map { entry -> entry.value.flatMap { it.second.output }.joinToString(File.pathSeparator) { it.absolutePath } }.joinToString(File.pathSeparator.repeat(2)) + project.logger.info( + "[Unimined/FabricLike] Classpath groups: ${ + groups.map { + it.key.toPath() + " -> " + it.value.joinToString( + ", " + ) { it.toPath() } + }.joinToString("\n ") + }" + ) + groups.map { entry -> + entry.value.flatMap { it.second.output }.joinToString(File.pathSeparator) { it.absolutePath } + }.joinToString(File.pathSeparator.repeat(2)) } override fun applyClientRunTransform(config: RunConfig) { diff --git a/buildSrc/src/main/kotlin/CustomFabricMinecraftTransformer.kt b/buildSrc/src/main/kotlin/CustomFabricMinecraftTransformer.kt index 1da6db63..97ce36c0 100644 --- a/buildSrc/src/main/kotlin/CustomFabricMinecraftTransformer.kt +++ b/buildSrc/src/main/kotlin/CustomFabricMinecraftTransformer.kt @@ -14,7 +14,7 @@ import java.nio.file.Files abstract class CustomFabricMinecraftTransformer( project: Project, provider: MinecraftProvider -): CustomFabricLikeMinecraftTransformer( +) : CustomFabricLikeMinecraftTransformer( project, provider, "fabric", @@ -69,7 +69,8 @@ abstract class CustomFabricMinecraftTransformer( val modJsonPath = this.getModJsonPath() if (modJsonPath != null && modJsonPath.exists()) { - val json = JsonParser.parseReader(InputStreamReader(Files.newInputStream(modJsonPath.toPath()))).asJsonObject + val json = + JsonParser.parseReader(InputStreamReader(Files.newInputStream(modJsonPath.toPath()))).asJsonObject val custom = json.getAsJsonObject("custom") diff --git a/buildSrc/src/main/kotlin/CustomLegacyFabricMinecraftTransformer.kt b/buildSrc/src/main/kotlin/CustomLegacyFabricMinecraftTransformer.kt index 211ec359..78a3794a 100644 --- a/buildSrc/src/main/kotlin/CustomLegacyFabricMinecraftTransformer.kt +++ b/buildSrc/src/main/kotlin/CustomLegacyFabricMinecraftTransformer.kt @@ -8,13 +8,14 @@ import xyz.wagyourtail.unimined.util.SemVerUtils class CustomLegacyFabricMinecraftTransformer( project: Project, provider: MinecraftProvider -): CustomFabricMinecraftTransformer(project, provider) { +) : CustomFabricMinecraftTransformer(project, provider) { override fun addIntermediaryMappings() { provider.mappings { legacyIntermediary() } } + override fun loader(dep: Any, action: Dependency.() -> Unit) { fabric.dependencies.add( (if (dep is String && !dep.contains(":")) { diff --git a/common/build.gradle b/common/build.gradle index 16faa93b..8d1503d4 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -6,6 +6,8 @@ dependencies { compileOnly 'com.google.code.gson:gson:2.10.1' implementation 'io.github.classgraph:classgraph:4.8.172' implementation "net.lenni0451:Reflect:1.3.3" + implementation 'org.slf4j:slf4j-api:2.0.13' + implementation "org.slf4j:jul-to-slf4j:2.0.13" } tasks.withType(JavaCompile).configureEach { diff --git a/common/src/main/java/dev/u9g/minecraftdatagenerator/MinecraftDataGenerator.java b/common/src/main/java/dev/u9g/minecraftdatagenerator/MinecraftDataGenerator.java index a9ad0e5f..6671bef3 100644 --- a/common/src/main/java/dev/u9g/minecraftdatagenerator/MinecraftDataGenerator.java +++ b/common/src/main/java/dev/u9g/minecraftdatagenerator/MinecraftDataGenerator.java @@ -1,14 +1,20 @@ package dev.u9g.minecraftdatagenerator; import dev.u9g.minecraftdatagenerator.generators.DataGenerators; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import java.io.FileDescriptor; +import java.io.FileOutputStream; +import java.io.PrintStream; import java.nio.file.Path; -import java.util.logging.Logger; public class MinecraftDataGenerator { - public static final Logger LOGGER = Logger.getLogger("mc-data-gen-serv"); + private static final Logger LOGGER = LoggerFactory.getLogger(MinecraftDataGenerator.class); public static void start(String versionName, Path serverRootDirectory) { + System.setOut(new PrintStream(new FileOutputStream(FileDescriptor.out))); + System.setErr(new PrintStream(new FileOutputStream(FileDescriptor.err))); MinecraftDataGenerator.LOGGER.info("Starting data generation!"); Path dataDumpDirectory = serverRootDirectory.resolve("minecraft-data").resolve(versionName); DataGenerators.runDataGenerators(dataDumpDirectory); diff --git a/common/src/main/java/dev/u9g/minecraftdatagenerator/generators/DataGenerators.java b/common/src/main/java/dev/u9g/minecraftdatagenerator/generators/DataGenerators.java index 0efd8726..ff7a3020 100644 --- a/common/src/main/java/dev/u9g/minecraftdatagenerator/generators/DataGenerators.java +++ b/common/src/main/java/dev/u9g/minecraftdatagenerator/generators/DataGenerators.java @@ -3,23 +3,22 @@ import com.google.gson.JsonElement; import com.google.gson.internal.Streams; import com.google.gson.stream.JsonWriter; -import dev.u9g.minecraftdatagenerator.MinecraftDataGenerator; import io.github.classgraph.ClassGraph; import io.github.classgraph.ScanResult; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.io.IOException; import java.io.Writer; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.StandardOpenOption; -import java.text.MessageFormat; import java.util.ArrayList; import java.util.List; -import java.util.logging.Logger; public class DataGenerators { private static final List GENERATORS = new ArrayList<>(); - private static final Logger logger = MinecraftDataGenerator.LOGGER; + private static final Logger LOGGER = LoggerFactory.getLogger(DataGenerators.class); static { List> generators; @@ -36,8 +35,7 @@ public class DataGenerators { try { GENERATORS.add(generatorClass.getDeclaredConstructor().newInstance()); } catch (ReflectiveOperationException e) { - logger.info(MessageFormat.format("Failed to instantiate data generator {0}", generatorClass.getName())); - e.printStackTrace(); + LOGGER.error("Failed to instantiate data generator {}", generatorClass.getName(), e); } } } @@ -46,21 +44,20 @@ public static boolean runDataGenerators(Path outputDirectory) { try { Files.createDirectories(outputDirectory); } catch (IOException e) { - logger.info("Failed to create data generator output directory at " + outputDirectory); - e.printStackTrace(); + LOGGER.error("Failed to create data generator output directory at {}", outputDirectory, e); return false; } int generatorsFailed = 0; - logger.info(MessageFormat.format("Running minecraft data generators, output at {0}", outputDirectory)); + LOGGER.info("Running minecraft data generators, output at {}", outputDirectory); for (IDataGenerator dataGenerator : GENERATORS) { if (!dataGenerator.isEnabled()) { - logger.info(MessageFormat.format("Skipping disabled generator {0}", dataGenerator.getDataName())); + LOGGER.info("Skipping disabled generator {}", dataGenerator.getDataName()); continue; } - logger.info(MessageFormat.format("Running generator {0}", dataGenerator.getDataName())); + LOGGER.info("Running generator {}", dataGenerator.getDataName()); try { String outputFileName = String.format("%s.json", dataGenerator.getDataName()); JsonElement outputElement = dataGenerator.generateDataJson(); @@ -72,15 +69,14 @@ public static boolean runDataGenerators(Path outputDirectory) { Streams.write(outputElement, jsonWriter); } - logger.info(MessageFormat.format("Generator: {0} -> {1}", dataGenerator.getDataName(), outputFileName)); + LOGGER.info("Generator: {} -> {}", dataGenerator.getDataName(), outputFileName); } catch (Throwable e) { - logger.info(MessageFormat.format("Failed to run data generator {0}", dataGenerator.getDataName())); - e.printStackTrace(); + LOGGER.error("Failed to run data generator {}", dataGenerator.getDataName(), e); generatorsFailed++; } } - logger.info("Finishing running data generators"); + LOGGER.info("Finishing running data generators"); return generatorsFailed == 0; } } diff --git a/gradle.properties b/gradle.properties index bde2fd14..3693d2e5 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,11 +1,8 @@ # Done to increase the memory available to gradle. org.gradle.jvmargs=-Xmx4G -Xms256m -XX:+UseParallelGC -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 - org.gradle.daemon=true - org.gradle.configureondemand=true org.gradle.cache=true org.gradle.caching=true org.gradle.parallel=true - org.gradle.vfs.watch=true diff --git a/settings.gradle b/settings.gradle index d1a579b5..62448b64 100644 --- a/settings.gradle +++ b/settings.gradle @@ -2,7 +2,7 @@ plugins { id 'org.gradle.toolchains.foojay-resolver-convention' version '0.8.0' } -dependencyResolutionManagement { +dependencyResolutionManagement { versionCatalogs { libs { version('fabric-loader', '0.15.10') From f77358c1e2ab863cff20e2dccf3d177af7db8e78 Mon Sep 17 00:00:00 2001 From: AlexProgrammerDE <40795980+AlexProgrammerDE@users.noreply.github.com> Date: Sat, 18 May 2024 13:01:43 +0200 Subject: [PATCH 30/38] Do not generate mod jars to speed up builds --- 1.10.2/build.gradle | 5 +++++ 1.11.2/build.gradle | 5 +++++ 1.12.2/build.gradle | 5 +++++ 1.13/build.gradle | 5 +++++ 1.14/build.gradle | 5 +++++ 1.15/build.gradle | 5 +++++ 1.16/build.gradle | 5 +++++ 1.17/build.gradle | 5 +++++ 1.18/build.gradle | 5 +++++ 1.19.2/build.gradle | 5 +++++ 1.19/build.gradle | 5 +++++ 1.20.4/build.gradle | 5 +++++ 1.20.5/build.gradle | 5 +++++ 1.20/build.gradle | 5 +++++ 1.7/build.gradle | 5 +++++ 1.8.9/build.gradle | 5 +++++ 1.9.4/build.gradle | 5 +++++ 22w19a/build.gradle | 5 +++++ buildSrc/src/main/kotlin/CustomFabricMinecraftTransformer.kt | 1 + 19 files changed, 91 insertions(+) diff --git a/1.10.2/build.gradle b/1.10.2/build.gradle index 7c617b7b..a25cddde 100644 --- a/1.10.2/build.gradle +++ b/1.10.2/build.gradle @@ -1,3 +1,4 @@ +import xyz.wagyourtail.unimined.api.minecraft.task.RemapJarTask import xyz.wagyourtail.unimined.internal.minecraft.MinecraftProvider plugins { @@ -37,6 +38,10 @@ processResources { } } +tasks.withType(RemapJarTask).configureEach { + onlyIf { false} +} + tasks.withType(JavaCompile).configureEach { it.options.encoding = "UTF-8" } diff --git a/1.11.2/build.gradle b/1.11.2/build.gradle index edb53971..87ed5b49 100644 --- a/1.11.2/build.gradle +++ b/1.11.2/build.gradle @@ -1,3 +1,4 @@ +import xyz.wagyourtail.unimined.api.minecraft.task.RemapJarTask import xyz.wagyourtail.unimined.internal.minecraft.MinecraftProvider plugins { @@ -37,6 +38,10 @@ processResources { } } +tasks.withType(RemapJarTask).configureEach { + onlyIf { false} +} + tasks.withType(JavaCompile).configureEach { it.options.encoding = "UTF-8" } diff --git a/1.12.2/build.gradle b/1.12.2/build.gradle index 3370f425..300b1a8e 100644 --- a/1.12.2/build.gradle +++ b/1.12.2/build.gradle @@ -1,3 +1,4 @@ +import xyz.wagyourtail.unimined.api.minecraft.task.RemapJarTask import xyz.wagyourtail.unimined.internal.minecraft.MinecraftProvider plugins { @@ -37,6 +38,10 @@ processResources { } } +tasks.withType(RemapJarTask).configureEach { + onlyIf { false} +} + tasks.withType(JavaCompile).configureEach { it.options.encoding = "UTF-8" } diff --git a/1.13/build.gradle b/1.13/build.gradle index 98b5358a..1048f501 100644 --- a/1.13/build.gradle +++ b/1.13/build.gradle @@ -1,3 +1,4 @@ +import xyz.wagyourtail.unimined.api.minecraft.task.RemapJarTask import xyz.wagyourtail.unimined.internal.minecraft.MinecraftProvider plugins { @@ -37,6 +38,10 @@ processResources { } } +tasks.withType(RemapJarTask).configureEach { + onlyIf { false} +} + tasks.withType(JavaCompile).configureEach { it.options.encoding = "UTF-8" } diff --git a/1.14/build.gradle b/1.14/build.gradle index 91a483aa..6d2f96b7 100644 --- a/1.14/build.gradle +++ b/1.14/build.gradle @@ -1,3 +1,4 @@ +import xyz.wagyourtail.unimined.api.minecraft.task.RemapJarTask import xyz.wagyourtail.unimined.internal.minecraft.MinecraftProvider plugins { @@ -37,6 +38,10 @@ processResources { } } +tasks.withType(RemapJarTask).configureEach { + onlyIf { false} +} + tasks.withType(JavaCompile).configureEach { it.options.encoding = "UTF-8" } diff --git a/1.15/build.gradle b/1.15/build.gradle index 916e3e45..bf10cc6e 100644 --- a/1.15/build.gradle +++ b/1.15/build.gradle @@ -1,3 +1,4 @@ +import xyz.wagyourtail.unimined.api.minecraft.task.RemapJarTask import xyz.wagyourtail.unimined.internal.minecraft.MinecraftProvider plugins { @@ -37,6 +38,10 @@ processResources { } } +tasks.withType(RemapJarTask).configureEach { + onlyIf { false} +} + tasks.withType(JavaCompile).configureEach { it.options.encoding = "UTF-8" } diff --git a/1.16/build.gradle b/1.16/build.gradle index a6ec219b..d97c3a52 100644 --- a/1.16/build.gradle +++ b/1.16/build.gradle @@ -1,3 +1,4 @@ +import xyz.wagyourtail.unimined.api.minecraft.task.RemapJarTask import xyz.wagyourtail.unimined.internal.minecraft.MinecraftProvider plugins { @@ -37,6 +38,10 @@ processResources { } } +tasks.withType(RemapJarTask).configureEach { + onlyIf { false} +} + tasks.withType(JavaCompile).configureEach { it.options.encoding = "UTF-8" } diff --git a/1.17/build.gradle b/1.17/build.gradle index 6ef8e503..71a36438 100644 --- a/1.17/build.gradle +++ b/1.17/build.gradle @@ -1,3 +1,4 @@ +import xyz.wagyourtail.unimined.api.minecraft.task.RemapJarTask import xyz.wagyourtail.unimined.internal.minecraft.MinecraftProvider plugins { @@ -37,6 +38,10 @@ processResources { } } +tasks.withType(RemapJarTask).configureEach { + onlyIf { false} +} + tasks.withType(JavaCompile).configureEach { it.options.encoding = "UTF-8" } diff --git a/1.18/build.gradle b/1.18/build.gradle index 0c7c2d96..ae4095d7 100644 --- a/1.18/build.gradle +++ b/1.18/build.gradle @@ -1,3 +1,4 @@ +import xyz.wagyourtail.unimined.api.minecraft.task.RemapJarTask import xyz.wagyourtail.unimined.internal.minecraft.MinecraftProvider plugins { @@ -37,6 +38,10 @@ processResources { } } +tasks.withType(RemapJarTask).configureEach { + onlyIf { false} +} + tasks.withType(JavaCompile).configureEach { it.options.encoding = "UTF-8" } diff --git a/1.19.2/build.gradle b/1.19.2/build.gradle index fd0c7620..6d565aef 100644 --- a/1.19.2/build.gradle +++ b/1.19.2/build.gradle @@ -1,3 +1,4 @@ +import xyz.wagyourtail.unimined.api.minecraft.task.RemapJarTask import xyz.wagyourtail.unimined.internal.minecraft.MinecraftProvider plugins { @@ -37,6 +38,10 @@ processResources { } } +tasks.withType(RemapJarTask).configureEach { + onlyIf { false} +} + tasks.withType(JavaCompile).configureEach { it.options.encoding = "UTF-8" } diff --git a/1.19/build.gradle b/1.19/build.gradle index 04b7eaa3..054cda38 100644 --- a/1.19/build.gradle +++ b/1.19/build.gradle @@ -1,3 +1,4 @@ +import xyz.wagyourtail.unimined.api.minecraft.task.RemapJarTask import xyz.wagyourtail.unimined.internal.minecraft.MinecraftProvider plugins { @@ -37,6 +38,10 @@ processResources { } } +tasks.withType(RemapJarTask).configureEach { + onlyIf { false} +} + tasks.withType(JavaCompile).configureEach { it.options.encoding = "UTF-8" } diff --git a/1.20.4/build.gradle b/1.20.4/build.gradle index e914953b..aecbdee9 100644 --- a/1.20.4/build.gradle +++ b/1.20.4/build.gradle @@ -1,3 +1,4 @@ +import xyz.wagyourtail.unimined.api.minecraft.task.RemapJarTask import xyz.wagyourtail.unimined.internal.minecraft.MinecraftProvider plugins { @@ -37,6 +38,10 @@ processResources { } } +tasks.withType(RemapJarTask).configureEach { + onlyIf { false} +} + tasks.withType(JavaCompile).configureEach { it.options.encoding = "UTF-8" } diff --git a/1.20.5/build.gradle b/1.20.5/build.gradle index 0158df9e..b062e214 100644 --- a/1.20.5/build.gradle +++ b/1.20.5/build.gradle @@ -1,3 +1,4 @@ +import xyz.wagyourtail.unimined.api.minecraft.task.RemapJarTask import xyz.wagyourtail.unimined.internal.minecraft.MinecraftProvider plugins { @@ -37,6 +38,10 @@ processResources { } } +tasks.withType(RemapJarTask).configureEach { + onlyIf { false} +} + tasks.withType(JavaCompile).configureEach { it.options.encoding = "UTF-8" } diff --git a/1.20/build.gradle b/1.20/build.gradle index 85e60a1b..90cfd957 100644 --- a/1.20/build.gradle +++ b/1.20/build.gradle @@ -1,3 +1,4 @@ +import xyz.wagyourtail.unimined.api.minecraft.task.RemapJarTask import xyz.wagyourtail.unimined.internal.minecraft.MinecraftProvider plugins { @@ -37,6 +38,10 @@ processResources { } } +tasks.withType(RemapJarTask).configureEach { + onlyIf { false} +} + tasks.withType(JavaCompile).configureEach { it.options.encoding = "UTF-8" } diff --git a/1.7/build.gradle b/1.7/build.gradle index a8d47703..1fe04909 100644 --- a/1.7/build.gradle +++ b/1.7/build.gradle @@ -1,3 +1,4 @@ +import xyz.wagyourtail.unimined.api.minecraft.task.RemapJarTask import xyz.wagyourtail.unimined.internal.minecraft.MinecraftProvider plugins { @@ -37,6 +38,10 @@ processResources { } } +tasks.withType(RemapJarTask).configureEach { + onlyIf { false} +} + tasks.withType(JavaCompile).configureEach { it.options.encoding = "UTF-8" } diff --git a/1.8.9/build.gradle b/1.8.9/build.gradle index 9d67349b..5b8c0832 100644 --- a/1.8.9/build.gradle +++ b/1.8.9/build.gradle @@ -1,3 +1,4 @@ +import xyz.wagyourtail.unimined.api.minecraft.task.RemapJarTask import xyz.wagyourtail.unimined.internal.minecraft.MinecraftProvider plugins { @@ -37,6 +38,10 @@ processResources { } } +tasks.withType(RemapJarTask).configureEach { + onlyIf { false} +} + tasks.withType(JavaCompile).configureEach { it.options.encoding = "UTF-8" } diff --git a/1.9.4/build.gradle b/1.9.4/build.gradle index d3b6e822..7846c5eb 100644 --- a/1.9.4/build.gradle +++ b/1.9.4/build.gradle @@ -1,3 +1,4 @@ +import xyz.wagyourtail.unimined.api.minecraft.task.RemapJarTask import xyz.wagyourtail.unimined.internal.minecraft.MinecraftProvider plugins { @@ -37,6 +38,10 @@ processResources { } } +tasks.withType(RemapJarTask).configureEach { + onlyIf { false} +} + tasks.withType(JavaCompile).configureEach { it.options.encoding = "UTF-8" } diff --git a/22w19a/build.gradle b/22w19a/build.gradle index c6e3e9cc..c9d05885 100644 --- a/22w19a/build.gradle +++ b/22w19a/build.gradle @@ -1,3 +1,4 @@ +import xyz.wagyourtail.unimined.api.minecraft.task.RemapJarTask import xyz.wagyourtail.unimined.internal.minecraft.MinecraftProvider plugins { @@ -37,6 +38,10 @@ processResources { } } +tasks.withType(RemapJarTask).configureEach { + onlyIf { false} +} + tasks.withType(JavaCompile).configureEach { it.options.encoding = "UTF-8" } diff --git a/buildSrc/src/main/kotlin/CustomFabricMinecraftTransformer.kt b/buildSrc/src/main/kotlin/CustomFabricMinecraftTransformer.kt index 97ce36c0..afba46c2 100644 --- a/buildSrc/src/main/kotlin/CustomFabricMinecraftTransformer.kt +++ b/buildSrc/src/main/kotlin/CustomFabricMinecraftTransformer.kt @@ -7,6 +7,7 @@ import xyz.wagyourtail.unimined.api.minecraft.EnvType import xyz.wagyourtail.unimined.api.minecraft.MinecraftJar import xyz.wagyourtail.unimined.api.runs.RunConfig import xyz.wagyourtail.unimined.api.unimined +import xyz.wagyourtail.unimined.api.minecraft.task.RemapJarTask import xyz.wagyourtail.unimined.internal.minecraft.MinecraftProvider import java.io.InputStreamReader import java.nio.file.Files From 6b48762808629c37f131804184688bf37fd7604d Mon Sep 17 00:00:00 2001 From: AlexProgrammerDE <40795980+AlexProgrammerDE@users.noreply.github.com> Date: Wed, 3 Jul 2024 09:42:11 +0200 Subject: [PATCH 31/38] Override merger on now open classes directly --- buildSrc/build.gradle.kts | 2 +- .../CustomFabricLikeMinecraftTransformer.kt | 443 ------------------ .../CustomFabricMinecraftTransformer.kt | 87 ---- .../CustomLegacyFabricMinecraftTransformer.kt | 39 +- ...ustomOfficialFabricMinecraftTransformer.kt | 33 +- 5 files changed, 13 insertions(+), 591 deletions(-) delete mode 100644 buildSrc/src/main/kotlin/CustomFabricLikeMinecraftTransformer.kt delete mode 100644 buildSrc/src/main/kotlin/CustomFabricMinecraftTransformer.kt diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index f1786788..5769292b 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -14,7 +14,7 @@ repositories { } dependencies { - implementation("xyz.wagyourtail.unimined:xyz.wagyourtail.unimined.gradle.plugin:1.2.5-SNAPSHOT") + implementation("xyz.wagyourtail.unimined:xyz.wagyourtail.unimined.gradle.plugin:1.2.14") // guava implementation("com.google.guava:guava:31.1-jre") diff --git a/buildSrc/src/main/kotlin/CustomFabricLikeMinecraftTransformer.kt b/buildSrc/src/main/kotlin/CustomFabricLikeMinecraftTransformer.kt deleted file mode 100644 index 41724052..00000000 --- a/buildSrc/src/main/kotlin/CustomFabricLikeMinecraftTransformer.kt +++ /dev/null @@ -1,443 +0,0 @@ -import com.google.gson.* -import org.gradle.api.Project -import org.gradle.api.artifacts.Configuration -import org.gradle.api.artifacts.Dependency -import org.gradle.api.artifacts.ModuleDependency -import org.jetbrains.annotations.ApiStatus -import xyz.wagyourtail.unimined.api.mapping.MappingNamespaceTree -import xyz.wagyourtail.unimined.api.mapping.task.ExportMappingsTask -import xyz.wagyourtail.unimined.api.minecraft.EnvType -import xyz.wagyourtail.unimined.api.minecraft.MinecraftJar -import xyz.wagyourtail.unimined.api.minecraft.patch.ataw.AccessWidenerPatcher -import xyz.wagyourtail.unimined.api.minecraft.patch.fabric.FabricLikePatcher -import xyz.wagyourtail.unimined.api.minecraft.task.RemapJarTask -import xyz.wagyourtail.unimined.api.runs.RunConfig -import xyz.wagyourtail.unimined.api.unimined -import xyz.wagyourtail.unimined.api.uniminedMaybe -import xyz.wagyourtail.unimined.internal.mapping.ii.InterfaceInjectionMinecraftTransformer -import xyz.wagyourtail.unimined.internal.mapping.task.ExportMappingsTaskImpl -import xyz.wagyourtail.unimined.internal.minecraft.MinecraftProvider -import xyz.wagyourtail.unimined.internal.minecraft.patch.AbstractMinecraftTransformer -import xyz.wagyourtail.unimined.internal.minecraft.patch.access.widener.AccessWidenerMinecraftTransformer -import xyz.wagyourtail.unimined.internal.minecraft.resolver.Library -import xyz.wagyourtail.unimined.internal.minecraft.transform.merge.ClassMerger -import xyz.wagyourtail.unimined.util.* -import java.io.File -import java.io.InputStreamReader -import java.nio.file.Files -import java.nio.file.Path -import java.nio.file.StandardCopyOption -import java.nio.file.StandardOpenOption -import kotlin.io.path.createDirectories -import kotlin.io.path.exists -import kotlin.io.path.writeText - -abstract class CustomFabricLikeMinecraftTransformer( - project: Project, - provider: MinecraftProvider, - providerName: String, - val modJsonName: String, - val accessWidenerJsonKey: String, - private val accessWidenerTransformer: AccessWidenerMinecraftTransformer = AccessWidenerMinecraftTransformer( - project, - provider, - providerName - ), -) : AbstractMinecraftTransformer( - project, - provider, - providerName -), FabricLikePatcher, AccessWidenerPatcher by accessWidenerTransformer { - - companion object { - val GSON: Gson = GsonBuilder().setPrettyPrinting().create() - } - - val fabric: Configuration = - project.configurations.maybeCreate(providerName.withSourceSet(provider.sourceSet)).also { - provider.minecraftLibraries.extendsFrom(it) - } - - private val fabricJson: Configuration = project.configurations.detachedConfiguration() - - private val include: Configuration = project.configurations.maybeCreate("include".withSourceSet(provider.sourceSet)) - - override var customIntermediaries: Boolean by FinalizeOnRead(false) - - override var skipInsertAw: Boolean by FinalizeOnRead(false) - - protected abstract val ENVIRONMENT: String - protected abstract val ENV_TYPE: String - - override val merger: ClassMerger = ClassMerger() - - override var prodNamespace by FinalizeOnRead(LazyMutable { provider.mappings.getNamespace("intermediary") }) - - @get:ApiStatus.Internal - @set:ApiStatus.Experimental - override var devMappings: Path? by FinalizeOnRead(LazyMutable { - provider.localCache - .resolve("mappings") - .createDirectories() - .resolve("intermediary2named.jar") - .apply { - val export = ExportMappingsTaskImpl.ExportImpl(provider.mappings).apply { - location = toFile() - type = ExportMappingsTask.MappingExportTypes.TINY_V2 - sourceNamespace = prodNamespace - targetNamespace = setOf(provider.mappings.devNamespace) - renameNs[provider.mappings.devNamespace] = "named" - } - export.validate() - export.exportFunc(provider.mappings.mappingTree) - } - }) - - init { - addMavens() - } - - override fun prodNamespace(namespace: String) { - val delegate: FinalizeOnRead = - CustomFabricLikeMinecraftTransformer::class.getField("prodNamespace")!! - .getDelegate(this) as FinalizeOnRead - delegate.setValueIntl(LazyMutable { provider.mappings.getNamespace(namespace) }) - } - - @Deprecated("", replaceWith = ReplaceWith("prodNamespace(namespace)")) - override fun setProdNamespace(namespace: String) { - prodNamespace(namespace) - } - - protected abstract fun addMavens() - protected abstract fun addIntermediaryMappings() - - var mainClass: JsonObject? = null - - override fun beforeMappingsResolve() { - if (!customIntermediaries) { - addIntermediaryMappings() - } - } - - val fabricDep by lazy { - val dependencies = fabric.dependencies - - if (dependencies.isEmpty()) { - throw IllegalStateException("No dependencies found for fabric provider") - } - - if (dependencies.size > 1) { - throw IllegalStateException("Multiple dependencies found for fabric provider") - } - - dependencies.first() - } - - override fun apply() { - val client = provider.side == EnvType.CLIENT || provider.side == EnvType.COMBINED - val server = provider.side == EnvType.SERVER || provider.side == EnvType.COMBINED - - var artifactString = "" - if (fabricDep.group != null) { - artifactString += fabricDep.group + ":" - } - artifactString += fabricDep.name - if (fabricDep.version != null) { - artifactString += ":" + fabricDep.version - } - artifactString += "@json" - - if (fabricJson.dependencies.isEmpty()) { - fabricJson.dependencies.add( - project.dependencies.create( - artifactString - ) - ) - } - - val json = InputStreamReader( - fabricJson.files(fabricJson.dependencies.last()) - .last() - .inputStream() - ).use { reader -> - JsonParser.parseReader(reader).asJsonObject - } - - val libraries = json.get("libraries")?.asJsonObject - if (libraries != null) { - libraries.get("common")?.asJsonArray?.forEach { - createFabricLoaderDependency(it) - } - if (client) { - libraries.get("client")?.asJsonArray?.forEach { - createFabricLoaderDependency(it) - } - } - if (server) { - libraries.get("server")?.asJsonArray?.forEach { - createFabricLoaderDependency(it) - } - } - libraries.get("development")?.asJsonArray?.forEach { - createFabricLoaderDependency(it) - } - } - - mainClass = json.get("mainClass")?.asJsonObject - - if (devMappings != null) { - provider.minecraftLibraries.dependencies.add( - project.dependencies.create(project.files(devMappings)) - ) - } - - // mixins get remapped at runtime, so we don't need to on fabric - provider.mods.default { - mixinRemap { - off() - } - } - - super.apply() - } - - private fun createFabricLoaderDependency(it: JsonElement) { - val dep: ModuleDependency = project.dependencies.create( - it.asJsonObject.get("name").asString - ) as ModuleDependency - dep.isTransitive = false - provider.minecraftLibraries.dependencies.add(dep) - } - - override fun afterRemap(baseMinecraft: MinecraftJar): MinecraftJar = - applyInterfaceInjection(accessWidenerTransformer.afterRemap(baseMinecraft)) - - private fun applyInterfaceInjection(baseMinecraft: MinecraftJar): MinecraftJar { - val injections = hashMapOf>() - - this.collectInterfaceInjections(baseMinecraft, injections) - - return if (injections.isNotEmpty()) { - val oldSuffix = if (baseMinecraft.awOrAt != null) baseMinecraft.awOrAt + "+" else "" - - val output = MinecraftJar( - baseMinecraft, - parentPath = provider.localCache.resolve("fabric").createDirectories(), - awOrAt = "${oldSuffix}ii+${injections.getShortSha1()}" - ) - - if (!output.path.exists() || project.unimined.forceReload) { - if (InterfaceInjectionMinecraftTransformer.transform( - injections, - baseMinecraft.path, - output.path, - project.logger - ) - ) { - output - } else baseMinecraft - } else output - } else baseMinecraft - } - - abstract fun collectInterfaceInjections(baseMinecraft: MinecraftJar, injections: HashMap>) - fun collectInterfaceInjections( - baseMinecraft: MinecraftJar, - injections: HashMap>, - interfaces: JsonObject - ) { - injections.putAll(interfaces.entrySet() - .filterNotNull() - .filter { it.key != null && it.value != null && it.value.isJsonArray } - .map { - val element = it.value!! - - Pair(it.key!!, if (element.isJsonArray) { - element.asJsonArray.mapNotNull { name -> name.asString } - } else arrayListOf()) - } - .map { - var target = it.first - - val clazz = provider.mappings.mappingTree.getClass( - target, - provider.mappings.mappingTree.getNamespaceId(prodNamespace.name) - ) - - if (clazz != null) { - var newTarget = - clazz.getName(provider.mappings.mappingTree.getNamespaceId(baseMinecraft.mappingNamespace.name)) - - if (newTarget == null) { - newTarget = - clazz.getName(provider.mappings.mappingTree.getNamespaceId(baseMinecraft.fallbackNamespace.name)) - } - - if (newTarget != null) { - target = newTarget - } - } - - Pair(target, it.second) - } - ) - } - - val intermediaryClasspath: Path = - provider.localCache.resolve("remapClasspath.txt".withSourceSet(provider.sourceSet)) - - override fun afterEvaluate() { - project.logger.lifecycle("[Unimined/Fabric] Generating intermediary classpath.") - // resolve intermediary classpath - val classpath = (provider.mods.getClasspathAs( - prodNamespace, - prodNamespace, - provider.sourceSet.runtimeClasspath.filter { !provider.isMinecraftJar(it.toPath()) }.toSet() - ) + provider.getMinecraft(prodNamespace, prodNamespace).toFile()).filter { it.exists() && !it.isDirectory } - // write to file - intermediaryClasspath.writeText( - classpath.joinToString(File.pathSeparator), - options = arrayOf(StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING) - ) - } - - override fun afterRemapJarTask(remapJarTask: RemapJarTask, output: Path) { - insertIncludes(output) - insertAW(output) - } - - private fun insertIncludes(output: Path) { - if (include.dependencies.isEmpty()) { - return - } - output.openZipFileSystem(mapOf("mutable" to true)).use { fs -> - val includeCache = provider.localCache.resolve("includeCache".withSourceSet(provider.sourceSet)) - val jars = fs.getPath("META-INF/jars") - - val mod = fs.getPath(modJsonName) - if (!Files.exists(mod)) { - throw IllegalStateException("$modJsonName not found in jar") - } - val json = JsonParser.parseReader(InputStreamReader(Files.newInputStream(mod))).asJsonObject - - Files.createDirectories(jars) - Files.createDirectories(includeCache) - for (dep in include.dependencies) { - val path = jars.resolve("${dep.name}-${dep.version}.jar") - val cachePath = includeCache.resolve("${dep.name}-${dep.version}.jar") - if (!Files.exists(cachePath)) { - Files.copy( - include.files(dep).first { it.extension == "jar" }.toPath(), - includeCache.resolve("${dep.name}-${dep.version}.jar"), - StandardCopyOption.REPLACE_EXISTING - ) - - cachePath.openZipFileSystem(mapOf("mutable" to true)).use { innerfs -> - val innermod = innerfs.getPath(modJsonName) - if (!Files.exists(innermod)) { - val innerjson = JsonObject() - innerjson.addProperty("schemaVersion", 1) - var artifactString = "" - if (dep.group != null) { - artifactString += dep.group!!.replace(".", "_") + "_" - } - artifactString += dep.name - - innerjson.addProperty("id", artifactString.lowercase()) - innerjson.addProperty("version", dep.version) - innerjson.addProperty("name", dep.name) - val custom = JsonObject() - custom.addProperty("fabric-loom:generated", true) - custom.addProperty("unimined:generated", true) - innerjson.add("custom", custom) - Files.write( - innermod, - innerjson.toString().toByteArray(), - StandardOpenOption.CREATE, - StandardOpenOption.TRUNCATE_EXISTING - ) - } - } - } - - Files.copy(cachePath, path, StandardCopyOption.REPLACE_EXISTING) - - addIncludeToModJson(json, dep, path.toString().removePrefix("/")) - } - Files.write(mod, GSON.toJson(json).toByteArray(), StandardOpenOption.TRUNCATE_EXISTING) - } - } - - protected abstract fun addIncludeToModJson(json: JsonObject, dep: Dependency, path: String) - - private fun insertAW(output: Path) { - if (accessWidener != null && !skipInsertAw) { - output.openZipFileSystem(mapOf("mutable" to true)).use { fs -> - val mod = fs.getPath(modJsonName) - if (!Files.exists(mod)) { - throw IllegalStateException("$modJsonName not found in jar") - } - val aw = accessWidener!!.toPath() - var parent = aw.parent - while (!fs.getPath(parent.relativize(aw).toString()).exists()) { - parent = parent.parent - if (parent.relativize(aw).toString() == aw.toString()) { - throw IllegalStateException("Access widener not found in jar") - } - } - val awPath = fs.getPath(parent.relativize(aw).toString()) - val json = JsonParser.parseReader(InputStreamReader(Files.newInputStream(mod))).asJsonObject - json.addProperty(accessWidenerJsonKey, awPath.toString()) - Files.write(mod, GSON.toJson(json).toByteArray(), StandardOpenOption.TRUNCATE_EXISTING) - } - } - } - - val groups: String by lazy { - val groups = sortProjectSourceSets().mapValues { it.value.toMutableSet() }.toMutableMap() - // detect non-fabric groups - for ((proj, sourceSet) in groups.keys.toSet()) { - if (proj.uniminedMaybe?.minecrafts?.map?.get(sourceSet)?.mcPatcher !is FabricLikePatcher) { - // merge with current - proj.logger.warn("[Unimined/FabricLike] Non-fabric ${(proj to sourceSet).toPath()} found in fabric classpath groups, merging with current (${(project to provider.sourceSet).toPath()}), this should've been manually specified with `combineWith`") - groups[this.project to this.provider.sourceSet]!! += groups[proj to sourceSet]!! - groups.remove(proj to sourceSet) - } - } - project.logger.info( - "[Unimined/FabricLike] Classpath groups: ${ - groups.map { - it.key.toPath() + " -> " + it.value.joinToString( - ", " - ) { it.toPath() } - }.joinToString("\n ") - }" - ) - groups.map { entry -> - entry.value.flatMap { it.second.output }.joinToString(File.pathSeparator) { it.absolutePath } - }.joinToString(File.pathSeparator.repeat(2)) - } - - override fun applyClientRunTransform(config: RunConfig) { - config.mainClass = mainClass?.get("client")?.asString ?: config.mainClass - } - - override fun applyServerRunTransform(config: RunConfig) { - config.mainClass = mainClass?.get("server")?.asString ?: config.mainClass - } - - override fun libraryFilter(library: Library): Boolean { - // fabric provides its own asm, exclude asm-all from vanilla minecraftLibraries - return !library.name.startsWith("org.ow2.asm:asm-all") - } - - fun getModJsonPath(): File? { - val json = provider.sourceSet.resources.firstOrNull { it.name.equals(modJsonName) } - if (json == null) { - project.logger.warn("[Unimined/FabricLike] $modJsonName not found in sourceSet ${provider.project.path} ${provider.sourceSet.name}") - return null - } - return json - } -} diff --git a/buildSrc/src/main/kotlin/CustomFabricMinecraftTransformer.kt b/buildSrc/src/main/kotlin/CustomFabricMinecraftTransformer.kt deleted file mode 100644 index afba46c2..00000000 --- a/buildSrc/src/main/kotlin/CustomFabricMinecraftTransformer.kt +++ /dev/null @@ -1,87 +0,0 @@ -import com.google.gson.JsonArray -import com.google.gson.JsonObject -import com.google.gson.JsonParser -import org.gradle.api.Project -import org.gradle.api.artifacts.Dependency -import xyz.wagyourtail.unimined.api.minecraft.EnvType -import xyz.wagyourtail.unimined.api.minecraft.MinecraftJar -import xyz.wagyourtail.unimined.api.runs.RunConfig -import xyz.wagyourtail.unimined.api.unimined -import xyz.wagyourtail.unimined.api.minecraft.task.RemapJarTask -import xyz.wagyourtail.unimined.internal.minecraft.MinecraftProvider -import java.io.InputStreamReader -import java.nio.file.Files - -abstract class CustomFabricMinecraftTransformer( - project: Project, - provider: MinecraftProvider -) : CustomFabricLikeMinecraftTransformer( - project, - provider, - "fabric", - "fabric.mod.json", - "accessWidener" -) { - - override val ENVIRONMENT: String = "Lnet/fabricmc/api/Environment;" - override val ENV_TYPE: String = "Lnet/fabricmc/api/EnvType;" - - override fun addMavens() { - project.unimined.fabricMaven() - } - - override fun addIncludeToModJson(json: JsonObject, dep: Dependency, path: String) { - var jars = json.get("jars")?.asJsonArray - if (jars == null) { - jars = JsonArray() - json.add("jars", jars) - } - jars.add(JsonObject().apply { - addProperty("file", path) - }) - } - - override fun applyExtraLaunches() { - super.applyExtraLaunches() - if (provider.side == EnvType.DATAGEN) { - TODO("DATAGEN not supported yet") - } - } - - override fun applyClientRunTransform(config: RunConfig) { - super.applyClientRunTransform(config) - config.jvmArgs += listOf( - "-Dfabric.development=true", - "-Dfabric.remapClasspathFile=${intermediaryClasspath}", - "-Dfabric.classPathGroups=${groups}" - ) - } - - override fun applyServerRunTransform(config: RunConfig) { - super.applyServerRunTransform(config) - config.jvmArgs += listOf( - "-Dfabric.development=true", - "-Dfabric.remapClasspathFile=${intermediaryClasspath}", - "-Dfabric.classPathGroups=${groups}" - ) - } - - override fun collectInterfaceInjections(baseMinecraft: MinecraftJar, injections: HashMap>) { - val modJsonPath = this.getModJsonPath() - - if (modJsonPath != null && modJsonPath.exists()) { - val json = - JsonParser.parseReader(InputStreamReader(Files.newInputStream(modJsonPath.toPath()))).asJsonObject - - val custom = json.getAsJsonObject("custom") - - if (custom != null) { - val interfaces = custom.getAsJsonObject("loom:injected_interfaces") - - if (interfaces != null) { - collectInterfaceInjections(baseMinecraft, injections, interfaces) - } - } - } - } -} diff --git a/buildSrc/src/main/kotlin/CustomLegacyFabricMinecraftTransformer.kt b/buildSrc/src/main/kotlin/CustomLegacyFabricMinecraftTransformer.kt index 78a3794a..54d76432 100644 --- a/buildSrc/src/main/kotlin/CustomLegacyFabricMinecraftTransformer.kt +++ b/buildSrc/src/main/kotlin/CustomLegacyFabricMinecraftTransformer.kt @@ -1,40 +1,13 @@ import org.gradle.api.Project -import org.gradle.api.artifacts.Dependency -import xyz.wagyourtail.unimined.api.minecraft.task.RemapJarTask -import xyz.wagyourtail.unimined.api.unimined import xyz.wagyourtail.unimined.internal.minecraft.MinecraftProvider -import xyz.wagyourtail.unimined.util.SemVerUtils +import xyz.wagyourtail.unimined.internal.minecraft.patch.fabric.LegacyFabricMinecraftTransformer +import xyz.wagyourtail.unimined.internal.minecraft.transform.merge.ClassMerger class CustomLegacyFabricMinecraftTransformer( project: Project, provider: MinecraftProvider -) : CustomFabricMinecraftTransformer(project, provider) { - - override fun addIntermediaryMappings() { - provider.mappings { - legacyIntermediary() - } - } - - override fun loader(dep: Any, action: Dependency.() -> Unit) { - fabric.dependencies.add( - (if (dep is String && !dep.contains(":")) { - project.dependencies.create("net.fabricmc:fabric-loader:$dep") - } else project.dependencies.create(dep)).apply(action) - ) - } - - override fun addMavens() { - super.addMavens() - project.unimined.legacyFabricMaven() - } - - override fun configureRemapJar(task: RemapJarTask) { - if (fabricDep.version?.let { SemVerUtils.matches(it, ">=0.15.0") } == true) { - project.logger.info("enabling mixin extra") - task.mixinRemap { - enableMixinExtra() - } - } - } +) : LegacyFabricMinecraftTransformer(project, provider) { + // Strip @Environment annotation from the classes + @Suppress("UnstableApiUsage") + override val merger: ClassMerger = ClassMerger() } diff --git a/buildSrc/src/main/kotlin/CustomOfficialFabricMinecraftTransformer.kt b/buildSrc/src/main/kotlin/CustomOfficialFabricMinecraftTransformer.kt index 0904c3dd..c83a3f39 100644 --- a/buildSrc/src/main/kotlin/CustomOfficialFabricMinecraftTransformer.kt +++ b/buildSrc/src/main/kotlin/CustomOfficialFabricMinecraftTransformer.kt @@ -1,34 +1,13 @@ import org.gradle.api.Project -import org.gradle.api.artifacts.Dependency -import xyz.wagyourtail.unimined.api.minecraft.task.RemapJarTask import xyz.wagyourtail.unimined.internal.minecraft.MinecraftProvider -import xyz.wagyourtail.unimined.util.SemVerUtils +import xyz.wagyourtail.unimined.internal.minecraft.patch.fabric.OfficialFabricMinecraftTransformer +import xyz.wagyourtail.unimined.internal.minecraft.transform.merge.ClassMerger class CustomOfficialFabricMinecraftTransformer( project: Project, provider: MinecraftProvider -) : CustomFabricMinecraftTransformer(project, provider) { - - override fun addIntermediaryMappings() { - provider.mappings { - intermediary() - } - } - - override fun loader(dep: Any, action: Dependency.() -> Unit) { - fabric.dependencies.add( - (if (dep is String && !dep.contains(":")) { - project.dependencies.create("net.fabricmc:fabric-loader:$dep") - } else project.dependencies.create(dep)).apply(action) - ) - } - - override fun configureRemapJar(task: RemapJarTask) { - if (fabricDep.version?.let { SemVerUtils.matches(it, ">=0.15.0") } == true) { - project.logger.info("enabling mixin extra") - task.mixinRemap { - enableMixinExtra() - } - } - } +) : OfficialFabricMinecraftTransformer(project, provider) { + // Strip @Environment annotation from the classes + @Suppress("UnstableApiUsage") + override val merger: ClassMerger = ClassMerger() } From 1c20be3406c178e22c0af531f7b84bce290136e4 Mon Sep 17 00:00:00 2001 From: AlexProgrammerDE <40795980+AlexProgrammerDE@users.noreply.github.com> Date: Wed, 3 Jul 2024 10:00:19 +0200 Subject: [PATCH 32/38] Use recommended approach --- buildSrc/build.gradle.kts | 2 +- .../kotlin/CustomLegacyFabricMinecraftTransformer.kt | 12 +++++++++--- .../CustomOfficialFabricMinecraftTransformer.kt | 12 +++++++++--- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 5769292b..78a17021 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -14,7 +14,7 @@ repositories { } dependencies { - implementation("xyz.wagyourtail.unimined:xyz.wagyourtail.unimined.gradle.plugin:1.2.14") + implementation("xyz.wagyourtail.unimined:xyz.wagyourtail.unimined.gradle.plugin:1.2.15-SNAPSHOT") // guava implementation("com.google.guava:guava:31.1-jre") diff --git a/buildSrc/src/main/kotlin/CustomLegacyFabricMinecraftTransformer.kt b/buildSrc/src/main/kotlin/CustomLegacyFabricMinecraftTransformer.kt index 54d76432..246ad15e 100644 --- a/buildSrc/src/main/kotlin/CustomLegacyFabricMinecraftTransformer.kt +++ b/buildSrc/src/main/kotlin/CustomLegacyFabricMinecraftTransformer.kt @@ -1,13 +1,19 @@ import org.gradle.api.Project +import xyz.wagyourtail.unimined.api.minecraft.EnvType +import xyz.wagyourtail.unimined.api.minecraft.MinecraftJar import xyz.wagyourtail.unimined.internal.minecraft.MinecraftProvider import xyz.wagyourtail.unimined.internal.minecraft.patch.fabric.LegacyFabricMinecraftTransformer -import xyz.wagyourtail.unimined.internal.minecraft.transform.merge.ClassMerger class CustomLegacyFabricMinecraftTransformer( project: Project, provider: MinecraftProvider ) : LegacyFabricMinecraftTransformer(project, provider) { - // Strip @Environment annotation from the classes @Suppress("UnstableApiUsage") - override val merger: ClassMerger = ClassMerger() + override fun mergedJar(clientjar: MinecraftJar, serverjar: MinecraftJar): MinecraftJar { + return MinecraftJar( + clientjar, + envType = EnvType.COMBINED, + patches = listOf("$providerName-merged", "custom-no-environment") + clientjar.patches + serverjar.patches + ) + } } diff --git a/buildSrc/src/main/kotlin/CustomOfficialFabricMinecraftTransformer.kt b/buildSrc/src/main/kotlin/CustomOfficialFabricMinecraftTransformer.kt index c83a3f39..18b2cc52 100644 --- a/buildSrc/src/main/kotlin/CustomOfficialFabricMinecraftTransformer.kt +++ b/buildSrc/src/main/kotlin/CustomOfficialFabricMinecraftTransformer.kt @@ -1,13 +1,19 @@ import org.gradle.api.Project +import xyz.wagyourtail.unimined.api.minecraft.EnvType +import xyz.wagyourtail.unimined.api.minecraft.MinecraftJar import xyz.wagyourtail.unimined.internal.minecraft.MinecraftProvider import xyz.wagyourtail.unimined.internal.minecraft.patch.fabric.OfficialFabricMinecraftTransformer -import xyz.wagyourtail.unimined.internal.minecraft.transform.merge.ClassMerger class CustomOfficialFabricMinecraftTransformer( project: Project, provider: MinecraftProvider ) : OfficialFabricMinecraftTransformer(project, provider) { - // Strip @Environment annotation from the classes @Suppress("UnstableApiUsage") - override val merger: ClassMerger = ClassMerger() + override fun mergedJar(clientjar: MinecraftJar, serverjar: MinecraftJar): MinecraftJar { + return MinecraftJar( + clientjar, + envType = EnvType.COMBINED, + patches = listOf("$providerName-merged", "custom-no-environment") + clientjar.patches + serverjar.patches + ) + } } From 2cc5424067fe0cf5e111559061a24b3316db7f2a Mon Sep 17 00:00:00 2001 From: AlexProgrammerDE <40795980+AlexProgrammerDE@users.noreply.github.com> Date: Wed, 3 Jul 2024 10:03:30 +0200 Subject: [PATCH 33/38] Readd custom merger --- .../main/kotlin/CustomLegacyFabricMinecraftTransformer.kt | 6 +++++- .../main/kotlin/CustomOfficialFabricMinecraftTransformer.kt | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/buildSrc/src/main/kotlin/CustomLegacyFabricMinecraftTransformer.kt b/buildSrc/src/main/kotlin/CustomLegacyFabricMinecraftTransformer.kt index 246ad15e..7bd16a7b 100644 --- a/buildSrc/src/main/kotlin/CustomLegacyFabricMinecraftTransformer.kt +++ b/buildSrc/src/main/kotlin/CustomLegacyFabricMinecraftTransformer.kt @@ -3,12 +3,16 @@ import xyz.wagyourtail.unimined.api.minecraft.EnvType import xyz.wagyourtail.unimined.api.minecraft.MinecraftJar import xyz.wagyourtail.unimined.internal.minecraft.MinecraftProvider import xyz.wagyourtail.unimined.internal.minecraft.patch.fabric.LegacyFabricMinecraftTransformer +import xyz.wagyourtail.unimined.internal.minecraft.transform.merge.ClassMerger +// Prevents adding @Environment annotations to classes +@Suppress("UnstableApiUsage") class CustomLegacyFabricMinecraftTransformer( project: Project, provider: MinecraftProvider ) : LegacyFabricMinecraftTransformer(project, provider) { - @Suppress("UnstableApiUsage") + override val merger: ClassMerger = ClassMerger() + override fun mergedJar(clientjar: MinecraftJar, serverjar: MinecraftJar): MinecraftJar { return MinecraftJar( clientjar, diff --git a/buildSrc/src/main/kotlin/CustomOfficialFabricMinecraftTransformer.kt b/buildSrc/src/main/kotlin/CustomOfficialFabricMinecraftTransformer.kt index 18b2cc52..741d1e63 100644 --- a/buildSrc/src/main/kotlin/CustomOfficialFabricMinecraftTransformer.kt +++ b/buildSrc/src/main/kotlin/CustomOfficialFabricMinecraftTransformer.kt @@ -3,12 +3,16 @@ import xyz.wagyourtail.unimined.api.minecraft.EnvType import xyz.wagyourtail.unimined.api.minecraft.MinecraftJar import xyz.wagyourtail.unimined.internal.minecraft.MinecraftProvider import xyz.wagyourtail.unimined.internal.minecraft.patch.fabric.OfficialFabricMinecraftTransformer +import xyz.wagyourtail.unimined.internal.minecraft.transform.merge.ClassMerger +// Prevents adding @Environment annotations to classes +@Suppress("UnstableApiUsage") class CustomOfficialFabricMinecraftTransformer( project: Project, provider: MinecraftProvider ) : OfficialFabricMinecraftTransformer(project, provider) { - @Suppress("UnstableApiUsage") + override val merger: ClassMerger = ClassMerger() + override fun mergedJar(clientjar: MinecraftJar, serverjar: MinecraftJar): MinecraftJar { return MinecraftJar( clientjar, From 42657e85b7beed685637a575ad5f54ebea8827ce Mon Sep 17 00:00:00 2001 From: AlexProgrammerDE <40795980+AlexProgrammerDE@users.noreply.github.com> Date: Wed, 3 Jul 2024 10:06:54 +0200 Subject: [PATCH 34/38] Working materials data generator --- .../generators/MaterialsDataGenerator.java | 68 +++++++++++-------- 1 file changed, 39 insertions(+), 29 deletions(-) diff --git a/1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java b/1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java index f62397a7..e9ed4167 100644 --- a/1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java +++ b/1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java @@ -1,5 +1,6 @@ package dev.u9g.minecraftdatagenerator.generators; +import com.google.common.base.Joiner; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.gson.JsonElement; @@ -9,7 +10,6 @@ import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; import net.minecraft.component.DataComponentTypes; -import net.minecraft.component.type.ToolComponent; import net.minecraft.item.Item; import net.minecraft.item.Items; import net.minecraft.item.MiningToolItem; @@ -41,7 +41,7 @@ private static String makeMaterialNameForTag(TagKey tag) { } private static void createCompositeMaterialInfo(List allMaterials, List combinedMaterials) { - String compositeMaterialName = String.join(";", combinedMaterials); + String compositeMaterialName = Joiner.on(';').join(combinedMaterials); List mappedMaterials = combinedMaterials.stream() .map(otherName -> allMaterials.stream() @@ -53,11 +53,11 @@ private static void createCompositeMaterialInfo(List allMaterials, mappedMaterials.stream().allMatch(it -> it.getPredicate().test(blockState)); MaterialInfo materialInfo = new MaterialInfo(compositeMaterialName, compositePredicate).includes(mappedMaterials); - allMaterials.addFirst(materialInfo); + allMaterials.add(0, materialInfo); } private static void createCompositeMaterial(Map> allMaterials, List combinedMaterials) { - String compositeMaterialName = String.join(";", combinedMaterials); + String compositeMaterialName = Joiner.on(';').join(combinedMaterials); Map resultingToolSpeeds = new HashMap<>(); combinedMaterials.stream() @@ -85,14 +85,19 @@ public static List getGlobalMaterialInfo() { Registry itemRegistry = DGU.getWorld().getRegistryManager().get(RegistryKeys.ITEM); itemRegistry.forEach(item -> { if (item instanceof MiningToolItem toolItem) { - ToolComponent toolComponent = toolItem.getComponents().get(DataComponentTypes.TOOL); - TagKey effectiveBlocks = toolComponent.rules().getFirst().blocks().getTagKey().orElseThrow(); - String materialName = makeMaterialNameForTag(effectiveBlocks); - - if (!uniqueMaterialNames.contains(materialName)) { - uniqueMaterialNames.add(materialName); - resultList.add(new MaterialInfo(materialName, blockState -> blockState.isIn(effectiveBlocks))); - } + item.getComponents().get(DataComponentTypes.TOOL).rules() + .stream().map(rule -> rule.blocks()) + .forEach(blocks -> { + Optional> tagKey = blocks.getTagKey(); + if (tagKey.isPresent()) { + String materialName = makeMaterialNameForTag((tagKey.get())); + + if (!uniqueMaterialNames.contains(materialName)) { + uniqueMaterialNames.add(materialName); + resultList.add(new MaterialInfo(materialName, blockState -> blockState.isIn(blocks))); + } + } + }); } }); @@ -132,23 +137,28 @@ public JsonElement generateDataJson() { itemRegistry.forEach(item -> { //Tools are handled rather easily and do not require anything else if (item instanceof MiningToolItem toolItem) { - ToolComponent toolComponent = toolItem.getComponents().get(DataComponentTypes.TOOL); - TagKey effectiveBlocks = toolComponent.rules().getFirst().blocks().getTagKey().orElseThrow(); - String materialName = makeMaterialNameForTag(effectiveBlocks); - - Map materialSpeeds = materialMiningSpeeds.computeIfAbsent(materialName, k -> new HashMap<>()); - float miningSpeed = toolComponent.defaultMiningSpeed(); - materialSpeeds.put(item, miningSpeed); - } - - //Swords require special treatment - if (item instanceof SwordItem) { - cowebMaterialSpeeds.put(item, 15.0f); - plantMaterialSpeeds.put(item, 1.5f); - leavesMaterialSpeeds.put(item, 1.5f); - gourdMaterialSpeeds.put(item, 1.5f); - } - }); + item.getComponents().get(DataComponentTypes.TOOL).rules() + .stream().map(rule -> rule.blocks()) + .forEach(blocks -> { + Optional> tagKey = blocks.getTagKey(); + if (tagKey.isPresent()) { + String materialName = makeMaterialNameForTag(tagKey.get()); + + Map materialSpeeds = materialMiningSpeeds.computeIfAbsent(materialName, k -> new HashMap<>()); + float miningSpeed = item.getComponents().get(DataComponentTypes.TOOL).defaultMiningSpeed(); + materialSpeeds.put(item, miningSpeed); + } + } + ); + + //Swords require special treatment + if (item instanceof SwordItem) { + cowebMaterialSpeeds.put(item, 15.0f); + plantMaterialSpeeds.put(item, 1.5f); + leavesMaterialSpeeds.put(item, 1.5f); + gourdMaterialSpeeds.put(item, 1.5f); + } + }}); COMPOSITE_MATERIALS.forEach(values -> createCompositeMaterial(materialMiningSpeeds, values)); From a35dc9f6e8308d5750c499cb2e54e14a26e9905b Mon Sep 17 00:00:00 2001 From: AlexProgrammerDE <40795980+AlexProgrammerDE@users.noreply.github.com> Date: Wed, 3 Jul 2024 10:09:42 +0200 Subject: [PATCH 35/38] Fix inconsistencies --- .../generators/MaterialsDataGenerator.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java b/1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java index e9ed4167..b6bb3f3d 100644 --- a/1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java +++ b/1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java @@ -1,6 +1,5 @@ package dev.u9g.minecraftdatagenerator.generators; -import com.google.common.base.Joiner; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.gson.JsonElement; @@ -41,7 +40,7 @@ private static String makeMaterialNameForTag(TagKey tag) { } private static void createCompositeMaterialInfo(List allMaterials, List combinedMaterials) { - String compositeMaterialName = Joiner.on(';').join(combinedMaterials); + String compositeMaterialName = String.join(";", combinedMaterials); List mappedMaterials = combinedMaterials.stream() .map(otherName -> allMaterials.stream() @@ -53,11 +52,11 @@ private static void createCompositeMaterialInfo(List allMaterials, mappedMaterials.stream().allMatch(it -> it.getPredicate().test(blockState)); MaterialInfo materialInfo = new MaterialInfo(compositeMaterialName, compositePredicate).includes(mappedMaterials); - allMaterials.add(0, materialInfo); + allMaterials.addFirst(materialInfo); } private static void createCompositeMaterial(Map> allMaterials, List combinedMaterials) { - String compositeMaterialName = Joiner.on(';').join(combinedMaterials); + String compositeMaterialName = String.join(";", combinedMaterials); Map resultingToolSpeeds = new HashMap<>(); combinedMaterials.stream() From 39ee8b548a8b6c30aec8b111e37805134bd99206 Mon Sep 17 00:00:00 2001 From: AlexProgrammerDE <40795980+AlexProgrammerDE@users.noreply.github.com> Date: Wed, 3 Jul 2024 10:38:33 +0200 Subject: [PATCH 36/38] Fix collision order to be random --- .../generators/BlockCollisionShapesDataGenerator.java | 4 ++-- .../generators/BlockCollisionShapesDataGenerator.java | 4 ++-- .../generators/BlockCollisionShapesDataGenerator.java | 4 ++-- .../generators/BlockCollisionShapesDataGenerator.java | 9 +++------ .../generators/BlockCollisionShapesDataGenerator.java | 9 +++------ .../generators/BlockCollisionShapesDataGenerator.java | 9 +++------ .../generators/BlockCollisionShapesDataGenerator.java | 9 +++------ .../generators/BlockCollisionShapesDataGenerator.java | 9 +++------ .../generators/BlockCollisionShapesDataGenerator.java | 9 +++------ .../generators/BlockCollisionShapesDataGenerator.java | 9 +++------ .../generators/BlockCollisionShapesDataGenerator.java | 9 +++------ .../generators/BlockCollisionShapesDataGenerator.java | 9 +++------ 12 files changed, 33 insertions(+), 60 deletions(-) diff --git a/1.13/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java b/1.13/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java index 4aa59324..7aa4b763 100644 --- a/1.13/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java +++ b/1.13/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java @@ -38,8 +38,8 @@ public JsonObject generateDataJson() { } private static class BlockShapesCache { - public final Map uniqueBlockShapes = new HashMap<>(); - public final Map> blockCollisionShapes = new HashMap<>(); + public final Map uniqueBlockShapes = new LinkedHashMap<>(); + public final Map> blockCollisionShapes = new LinkedHashMap<>(); private int lastCollisionShapeId = 0; public void processBlock(Block block) { diff --git a/1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java b/1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java index 8e758c4a..8c96da91 100644 --- a/1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java +++ b/1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java @@ -37,8 +37,8 @@ public JsonObject generateDataJson() { } private static class BlockShapesCache { - public final Map uniqueBlockShapes = new HashMap<>(); - public final Map> blockCollisionShapes = new HashMap<>(); + public final Map uniqueBlockShapes = new LinkedHashMap<>(); + public final Map> blockCollisionShapes = new LinkedHashMap<>(); private int lastCollisionShapeId = 0; public void processBlock(Block block) { diff --git a/1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java b/1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java index b89fb56e..49ea2168 100644 --- a/1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java +++ b/1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java @@ -37,8 +37,8 @@ public JsonObject generateDataJson() { } private static class BlockShapesCache { - public final Map uniqueBlockShapes = new HashMap<>(); - public final Map> blockCollisionShapes = new HashMap<>(); + public final Map uniqueBlockShapes = new LinkedHashMap<>(); + public final Map> blockCollisionShapes = new LinkedHashMap<>(); private int lastCollisionShapeId = 0; public void processBlock(Block block) { diff --git a/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java b/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java index e85f4931..61e1b9e6 100644 --- a/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java +++ b/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java @@ -12,10 +12,7 @@ import net.minecraft.util.shape.VoxelShape; import net.minecraft.world.EmptyBlockView; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; public class BlockCollisionShapesDataGenerator implements IDataGenerator { @@ -40,8 +37,8 @@ public JsonObject generateDataJson() { } private static class BlockShapesCache { - public final Map uniqueBlockShapes = new HashMap<>(); - public final Map> blockCollisionShapes = new HashMap<>(); + public final Map uniqueBlockShapes = new LinkedHashMap<>(); + public final Map> blockCollisionShapes = new LinkedHashMap<>(); private int lastCollisionShapeId = 0; public void processBlock(Block block) { diff --git a/1.17/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java b/1.17/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java index e85f4931..61e1b9e6 100644 --- a/1.17/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java +++ b/1.17/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java @@ -12,10 +12,7 @@ import net.minecraft.util.shape.VoxelShape; import net.minecraft.world.EmptyBlockView; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; public class BlockCollisionShapesDataGenerator implements IDataGenerator { @@ -40,8 +37,8 @@ public JsonObject generateDataJson() { } private static class BlockShapesCache { - public final Map uniqueBlockShapes = new HashMap<>(); - public final Map> blockCollisionShapes = new HashMap<>(); + public final Map uniqueBlockShapes = new LinkedHashMap<>(); + public final Map> blockCollisionShapes = new LinkedHashMap<>(); private int lastCollisionShapeId = 0; public void processBlock(Block block) { diff --git a/1.18/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java b/1.18/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java index e85f4931..61e1b9e6 100644 --- a/1.18/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java +++ b/1.18/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java @@ -12,10 +12,7 @@ import net.minecraft.util.shape.VoxelShape; import net.minecraft.world.EmptyBlockView; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; public class BlockCollisionShapesDataGenerator implements IDataGenerator { @@ -40,8 +37,8 @@ public JsonObject generateDataJson() { } private static class BlockShapesCache { - public final Map uniqueBlockShapes = new HashMap<>(); - public final Map> blockCollisionShapes = new HashMap<>(); + public final Map uniqueBlockShapes = new LinkedHashMap<>(); + public final Map> blockCollisionShapes = new LinkedHashMap<>(); private int lastCollisionShapeId = 0; public void processBlock(Block block) { diff --git a/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java b/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java index e85f4931..61e1b9e6 100644 --- a/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java +++ b/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java @@ -12,10 +12,7 @@ import net.minecraft.util.shape.VoxelShape; import net.minecraft.world.EmptyBlockView; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; public class BlockCollisionShapesDataGenerator implements IDataGenerator { @@ -40,8 +37,8 @@ public JsonObject generateDataJson() { } private static class BlockShapesCache { - public final Map uniqueBlockShapes = new HashMap<>(); - public final Map> blockCollisionShapes = new HashMap<>(); + public final Map uniqueBlockShapes = new LinkedHashMap<>(); + public final Map> blockCollisionShapes = new LinkedHashMap<>(); private int lastCollisionShapeId = 0; public void processBlock(Block block) { diff --git a/1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java b/1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java index e85f4931..61e1b9e6 100644 --- a/1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java +++ b/1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java @@ -12,10 +12,7 @@ import net.minecraft.util.shape.VoxelShape; import net.minecraft.world.EmptyBlockView; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; public class BlockCollisionShapesDataGenerator implements IDataGenerator { @@ -40,8 +37,8 @@ public JsonObject generateDataJson() { } private static class BlockShapesCache { - public final Map uniqueBlockShapes = new HashMap<>(); - public final Map> blockCollisionShapes = new HashMap<>(); + public final Map uniqueBlockShapes = new LinkedHashMap<>(); + public final Map> blockCollisionShapes = new LinkedHashMap<>(); private int lastCollisionShapeId = 0; public void processBlock(Block block) { diff --git a/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java b/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java index f9f09af5..68a169cd 100644 --- a/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java +++ b/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java @@ -14,10 +14,7 @@ import net.minecraft.util.shape.VoxelShape; import net.minecraft.world.EmptyBlockView; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; public class BlockCollisionShapesDataGenerator implements IDataGenerator { @@ -42,8 +39,8 @@ public JsonObject generateDataJson() { } private static class BlockShapesCache { - public final Map uniqueBlockShapes = new HashMap<>(); - public final Map> blockCollisionShapes = new HashMap<>(); + public final Map uniqueBlockShapes = new LinkedHashMap<>(); + public final Map> blockCollisionShapes = new LinkedHashMap<>(); private int lastCollisionShapeId = 0; public void processBlock(Block block) { diff --git a/1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java b/1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java index f9f09af5..68a169cd 100644 --- a/1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java +++ b/1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java @@ -14,10 +14,7 @@ import net.minecraft.util.shape.VoxelShape; import net.minecraft.world.EmptyBlockView; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; public class BlockCollisionShapesDataGenerator implements IDataGenerator { @@ -42,8 +39,8 @@ public JsonObject generateDataJson() { } private static class BlockShapesCache { - public final Map uniqueBlockShapes = new HashMap<>(); - public final Map> blockCollisionShapes = new HashMap<>(); + public final Map uniqueBlockShapes = new LinkedHashMap<>(); + public final Map> blockCollisionShapes = new LinkedHashMap<>(); private int lastCollisionShapeId = 0; public void processBlock(Block block) { diff --git a/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java b/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java index f9f09af5..68a169cd 100644 --- a/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java +++ b/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java @@ -14,10 +14,7 @@ import net.minecraft.util.shape.VoxelShape; import net.minecraft.world.EmptyBlockView; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; public class BlockCollisionShapesDataGenerator implements IDataGenerator { @@ -42,8 +39,8 @@ public JsonObject generateDataJson() { } private static class BlockShapesCache { - public final Map uniqueBlockShapes = new HashMap<>(); - public final Map> blockCollisionShapes = new HashMap<>(); + public final Map uniqueBlockShapes = new LinkedHashMap<>(); + public final Map> blockCollisionShapes = new LinkedHashMap<>(); private int lastCollisionShapeId = 0; public void processBlock(Block block) { diff --git a/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java b/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java index e85f4931..61e1b9e6 100644 --- a/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java +++ b/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/generators/BlockCollisionShapesDataGenerator.java @@ -12,10 +12,7 @@ import net.minecraft.util.shape.VoxelShape; import net.minecraft.world.EmptyBlockView; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; public class BlockCollisionShapesDataGenerator implements IDataGenerator { @@ -40,8 +37,8 @@ public JsonObject generateDataJson() { } private static class BlockShapesCache { - public final Map uniqueBlockShapes = new HashMap<>(); - public final Map> blockCollisionShapes = new HashMap<>(); + public final Map uniqueBlockShapes = new LinkedHashMap<>(); + public final Map> blockCollisionShapes = new LinkedHashMap<>(); private int lastCollisionShapeId = 0; public void processBlock(Block block) { From b0bfa3f3ffbfb8bffbe37819b4a47772b5f824a5 Mon Sep 17 00:00:00 2001 From: AlexProgrammerDE <40795980+AlexProgrammerDE@users.noreply.github.com> Date: Wed, 3 Jul 2024 10:46:31 +0200 Subject: [PATCH 37/38] Use LinkedHashMap for more reproducibility --- .../generators/TintsDataGenerator.java | 10 +++++----- .../generators/TintsDataGenerator.java | 10 +++++----- .../generators/TintsDataGenerator.java | 10 +++++----- .../generators/TintsDataGenerator.java | 10 +++++----- .../generators/TintsDataGenerator.java | 10 +++++----- .../generators/TintsDataGenerator.java | 10 +++++----- .../generators/TintsDataGenerator.java | 10 +++++----- .../generators/MaterialsDataGenerator.java | 14 +++++++------- .../generators/TintsDataGenerator.java | 10 +++++----- .../generators/MaterialsDataGenerator.java | 14 +++++++------- .../generators/TintsDataGenerator.java | 10 +++++----- .../generators/MaterialsDataGenerator.java | 14 +++++++------- .../generators/TintsDataGenerator.java | 10 +++++----- .../generators/MaterialsDataGenerator.java | 14 +++++++------- .../generators/TintsDataGenerator.java | 10 +++++----- .../generators/MaterialsDataGenerator.java | 14 +++++++------- .../generators/TintsDataGenerator.java | 10 +++++----- .../generators/MaterialsDataGenerator.java | 14 +++++++------- .../generators/TintsDataGenerator.java | 10 +++++----- .../generators/MaterialsDataGenerator.java | 14 +++++++------- .../generators/TintsDataGenerator.java | 10 +++++----- .../generators/TintsDataGenerator.java | 8 ++++---- .../generators/TintsDataGenerator.java | 10 +++++----- .../generators/TintsDataGenerator.java | 10 +++++----- .../generators/MaterialsDataGenerator.java | 14 +++++++------- .../generators/TintsDataGenerator.java | 10 +++++----- 26 files changed, 145 insertions(+), 145 deletions(-) diff --git a/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java b/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java index fe394012..3923b2e1 100644 --- a/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java +++ b/1.10.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java @@ -37,7 +37,7 @@ public static BiomeTintColors generateBiomeTintColors() { } public static Map generateRedstoneTintColors() { - Map resultColors = new HashMap<>(); + Map resultColors = new LinkedHashMap<>(); for (int redstoneLevel : RedstoneWireBlock.POWER.getValues()) { int color = RedstoneWireBlock.getColorIntensity(redstoneLevel); @@ -51,7 +51,7 @@ private static int getBlockColor(Block block) { } public static Map generateConstantTintColors() { - Map resultColors = new HashMap<>(); + Map resultColors = new LinkedHashMap<>(); // FIXME: ? // resultColors.put(Blocks.BIRCH_LEAVES, FoliageColors.getBirchColor()); // resultColors.put(Blocks.SPRUCE_LEAVES, FoliageColors.getSpruceColor()); @@ -149,8 +149,8 @@ public JsonObject generateDataJson() { } public static class BiomeTintColors { - final Map> grassColoursMap = new HashMap<>(); - final Map> foliageColoursMap = new HashMap<>(); - final Map> waterColourMap = new HashMap<>(); + final Map> grassColoursMap = new LinkedHashMap<>(); + final Map> foliageColoursMap = new LinkedHashMap<>(); + final Map> waterColourMap = new LinkedHashMap<>(); } } diff --git a/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java b/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java index fe394012..3923b2e1 100644 --- a/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java +++ b/1.11.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java @@ -37,7 +37,7 @@ public static BiomeTintColors generateBiomeTintColors() { } public static Map generateRedstoneTintColors() { - Map resultColors = new HashMap<>(); + Map resultColors = new LinkedHashMap<>(); for (int redstoneLevel : RedstoneWireBlock.POWER.getValues()) { int color = RedstoneWireBlock.getColorIntensity(redstoneLevel); @@ -51,7 +51,7 @@ private static int getBlockColor(Block block) { } public static Map generateConstantTintColors() { - Map resultColors = new HashMap<>(); + Map resultColors = new LinkedHashMap<>(); // FIXME: ? // resultColors.put(Blocks.BIRCH_LEAVES, FoliageColors.getBirchColor()); // resultColors.put(Blocks.SPRUCE_LEAVES, FoliageColors.getSpruceColor()); @@ -149,8 +149,8 @@ public JsonObject generateDataJson() { } public static class BiomeTintColors { - final Map> grassColoursMap = new HashMap<>(); - final Map> foliageColoursMap = new HashMap<>(); - final Map> waterColourMap = new HashMap<>(); + final Map> grassColoursMap = new LinkedHashMap<>(); + final Map> foliageColoursMap = new LinkedHashMap<>(); + final Map> waterColourMap = new LinkedHashMap<>(); } } diff --git a/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java b/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java index 25542b6e..72fc3d93 100644 --- a/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java +++ b/1.12.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java @@ -38,7 +38,7 @@ public static BiomeTintColors generateBiomeTintColors() { } public static Map generateRedstoneTintColors() { - Map resultColors = new HashMap<>(); + Map resultColors = new LinkedHashMap<>(); for (int redstoneLevel : RedstoneWireBlock.POWER.getValues()) { int color = RedstoneWireBlock.getColorIntensity(redstoneLevel); @@ -52,7 +52,7 @@ private static int getBlockColor(Block block) { } public static Map generateConstantTintColors() { - Map resultColors = new HashMap<>(); + Map resultColors = new LinkedHashMap<>(); // FIXME: ? // resultColors.put(Blocks.BIRCH_LEAVES, FoliageColors.getBirchColor()); // resultColors.put(Blocks.SPRUCE_LEAVES, FoliageColors.getSpruceColor()); @@ -151,8 +151,8 @@ public JsonObject generateDataJson() { } public static class BiomeTintColors { - final Map> grassColoursMap = new HashMap<>(); - final Map> foliageColoursMap = new HashMap<>(); - final Map> waterColourMap = new HashMap<>(); + final Map> grassColoursMap = new LinkedHashMap<>(); + final Map> foliageColoursMap = new LinkedHashMap<>(); + final Map> waterColourMap = new LinkedHashMap<>(); } } diff --git a/1.13/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java b/1.13/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java index 851fd4c6..f9fb265a 100644 --- a/1.13/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java +++ b/1.13/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java @@ -36,7 +36,7 @@ public static BiomeTintColors generateBiomeTintColors(Registry biomeRegis } public static Map generateRedstoneTintColors() { - Map resultColors = new HashMap<>(); + Map resultColors = new LinkedHashMap<>(); for (int redstoneLevel : RedstoneWireBlock.POWER.getValues()) { int color = RedstoneWireBlock.getColorIntensity(redstoneLevel); @@ -50,7 +50,7 @@ private static int getBlockColor(Block block) { } public static Map generateConstantTintColors() { - Map resultColors = new HashMap<>(); + Map resultColors = new LinkedHashMap<>(); resultColors.put(Blocks.BIRCH_LEAVES, FoliageColors.getBirchColor()); resultColors.put(Blocks.SPRUCE_LEAVES, FoliageColors.getSpruceColor()); @@ -152,8 +152,8 @@ public JsonObject generateDataJson() { } public static class BiomeTintColors { - final Map> grassColoursMap = new HashMap<>(); - final Map> foliageColoursMap = new HashMap<>(); - final Map> waterColourMap = new HashMap<>(); + final Map> grassColoursMap = new LinkedHashMap<>(); + final Map> foliageColoursMap = new LinkedHashMap<>(); + final Map> waterColourMap = new LinkedHashMap<>(); } } diff --git a/1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java b/1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java index 5c13e80d..33fa26b5 100644 --- a/1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java +++ b/1.14/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java @@ -39,7 +39,7 @@ public static BiomeTintColors generateBiomeTintColors(Registry biomeRegis } public static Map generateRedstoneTintColors() { - Map resultColors = new HashMap<>(); + Map resultColors = new LinkedHashMap<>(); for (int redstoneLevel : RedstoneWireBlock.POWER.getValues()) { int color = RedstoneWireBlock.getWireColor(redstoneLevel); @@ -53,7 +53,7 @@ private static int getBlockColor(Block block) { } public static Map generateConstantTintColors() { - Map resultColors = new HashMap<>(); + Map resultColors = new LinkedHashMap<>(); resultColors.put(Blocks.BIRCH_LEAVES, FoliageColors.getBirchColor()); resultColors.put(Blocks.SPRUCE_LEAVES, FoliageColors.getSpruceColor()); @@ -160,8 +160,8 @@ public JsonObject generateDataJson() { } public static class BiomeTintColors { - final Map> grassColoursMap = new HashMap<>(); - final Map> foliageColoursMap = new HashMap<>(); - final Map> waterColourMap = new HashMap<>(); + final Map> grassColoursMap = new LinkedHashMap<>(); + final Map> foliageColoursMap = new LinkedHashMap<>(); + final Map> waterColourMap = new LinkedHashMap<>(); } } diff --git a/1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java b/1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java index 9177e2d5..a489cdbb 100644 --- a/1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java +++ b/1.15/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java @@ -39,7 +39,7 @@ public static BiomeTintColors generateBiomeTintColors(Registry biomeRegis } public static Map generateRedstoneTintColors() { - Map resultColors = new HashMap<>(); + Map resultColors = new LinkedHashMap<>(); for (int redstoneLevel : RedstoneWireBlock.POWER.getValues()) { int color = RedstoneWireBlock.getWireColor(redstoneLevel); @@ -53,7 +53,7 @@ private static int getBlockColor(Block block) { } public static Map generateConstantTintColors() { - Map resultColors = new HashMap<>(); + Map resultColors = new LinkedHashMap<>(); resultColors.put(Blocks.BIRCH_LEAVES, FoliageColors.getBirchColor()); resultColors.put(Blocks.SPRUCE_LEAVES, FoliageColors.getSpruceColor()); @@ -160,8 +160,8 @@ public JsonObject generateDataJson() { } public static class BiomeTintColors { - final Map> grassColoursMap = new HashMap<>(); - final Map> foliageColoursMap = new HashMap<>(); - final Map> waterColourMap = new HashMap<>(); + final Map> grassColoursMap = new LinkedHashMap<>(); + final Map> foliageColoursMap = new LinkedHashMap<>(); + final Map> waterColourMap = new LinkedHashMap<>(); } } diff --git a/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java b/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java index 2d79ca66..689b5ac9 100644 --- a/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java +++ b/1.16/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java @@ -40,7 +40,7 @@ public static BiomeTintColors generateBiomeTintColors(Registry biomeRegis } public static Map generateRedstoneTintColors() { - Map resultColors = new HashMap<>(); + Map resultColors = new LinkedHashMap<>(); for (int redstoneLevel : RedstoneWireBlock.POWER.getValues()) { int color = RedstoneWireBlock.getWireColor(redstoneLevel); @@ -54,7 +54,7 @@ private static int getBlockColor(Block block) { } public static Map generateConstantTintColors() { - Map resultColors = new HashMap<>(); + Map resultColors = new LinkedHashMap<>(); resultColors.put(Blocks.BIRCH_LEAVES, FoliageColors.getBirchColor()); resultColors.put(Blocks.SPRUCE_LEAVES, FoliageColors.getSpruceColor()); @@ -161,8 +161,8 @@ public JsonObject generateDataJson() { } public static class BiomeTintColors { - final Map> grassColoursMap = new HashMap<>(); - final Map> foliageColoursMap = new HashMap<>(); - final Map> waterColourMap = new HashMap<>(); + final Map> grassColoursMap = new LinkedHashMap<>(); + final Map> foliageColoursMap = new LinkedHashMap<>(); + final Map> waterColourMap = new LinkedHashMap<>(); } } diff --git a/1.17/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java b/1.17/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java index b059c6a3..9c5bfd7e 100644 --- a/1.17/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java +++ b/1.17/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java @@ -58,7 +58,7 @@ private static void createCompositeMaterialInfo(List allMaterials, private static void createCompositeMaterial(Map> allMaterials, List combinedMaterials) { String compositeMaterialName = String.join(";", combinedMaterials); - Map resultingToolSpeeds = new HashMap<>(); + Map resultingToolSpeeds = new LinkedHashMap<>(); combinedMaterials.stream() .map(allMaterials::get) .forEach(resultingToolSpeeds::putAll); @@ -105,14 +105,14 @@ public String getDataName() { public JsonElement generateDataJson() { Registry itemRegistry = Registry.ITEM; - Map> materialMiningSpeeds = new HashMap<>(); + Map> materialMiningSpeeds = new LinkedHashMap<>(); materialMiningSpeeds.put("default", ImmutableMap.of()); //Special materials used for shears and swords special mining speed logic - Map leavesMaterialSpeeds = new HashMap<>(); - Map cowebMaterialSpeeds = new HashMap<>(); - Map plantMaterialSpeeds = new HashMap<>(); - Map gourdMaterialSpeeds = new HashMap<>(); + Map leavesMaterialSpeeds = new LinkedHashMap<>(); + Map cowebMaterialSpeeds = new LinkedHashMap<>(); + Map plantMaterialSpeeds = new LinkedHashMap<>(); + Map gourdMaterialSpeeds = new LinkedHashMap<>(); materialMiningSpeeds.put(makeMaterialNameForTag(BlockTags.LEAVES), leavesMaterialSpeeds); materialMiningSpeeds.put("coweb", cowebMaterialSpeeds); @@ -131,7 +131,7 @@ public JsonElement generateDataJson() { Tag effectiveBlocks = ((MiningToolItemAccessor) toolItem).getEffectiveBlocks(); String materialName = makeMaterialNameForTag(effectiveBlocks); - Map materialSpeeds = materialMiningSpeeds.computeIfAbsent(materialName, k -> new HashMap<>()); + Map materialSpeeds = materialMiningSpeeds.computeIfAbsent(materialName, k -> new LinkedHashMap<>()); float miningSpeed = ((MiningToolItemAccessor) toolItem).getMiningSpeed(); materialSpeeds.put(item, miningSpeed); } diff --git a/1.17/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java b/1.17/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java index 6435ddcb..5a287186 100644 --- a/1.17/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java +++ b/1.17/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java @@ -35,7 +35,7 @@ public static BiomeTintColors generateBiomeTintColors(Registry biomeRegis } public static Map generateRedstoneTintColors() { - Map resultColors = new HashMap<>(); + Map resultColors = new LinkedHashMap<>(); for (int redstoneLevel : RedstoneWireBlock.POWER.getValues()) { int color = RedstoneWireBlock.getWireColor(redstoneLevel); @@ -49,7 +49,7 @@ private static int getBlockColor(Block block) { } public static Map generateConstantTintColors() { - Map resultColors = new HashMap<>(); + Map resultColors = new LinkedHashMap<>(); resultColors.put(Blocks.BIRCH_LEAVES, FoliageColors.getBirchColor()); resultColors.put(Blocks.SPRUCE_LEAVES, FoliageColors.getSpruceColor()); @@ -156,8 +156,8 @@ public JsonObject generateDataJson() { } public static class BiomeTintColors { - final Map> grassColoursMap = new HashMap<>(); - final Map> foliageColoursMap = new HashMap<>(); - final Map> waterColourMap = new HashMap<>(); + final Map> grassColoursMap = new LinkedHashMap<>(); + final Map> foliageColoursMap = new LinkedHashMap<>(); + final Map> waterColourMap = new LinkedHashMap<>(); } } diff --git a/1.18/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java b/1.18/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java index 1f4dc6cb..5dcbb062 100644 --- a/1.18/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java +++ b/1.18/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java @@ -58,7 +58,7 @@ private static void createCompositeMaterialInfo(List allMaterials, private static void createCompositeMaterial(Map> allMaterials, List combinedMaterials) { String compositeMaterialName = String.join(";", combinedMaterials); - Map resultingToolSpeeds = new HashMap<>(); + Map resultingToolSpeeds = new LinkedHashMap<>(); combinedMaterials.stream() .map(allMaterials::get) .forEach(v -> { @@ -108,14 +108,14 @@ public String getDataName() { public JsonElement generateDataJson() { Registry itemRegistry = Registry.ITEM; - Map> materialMiningSpeeds = new HashMap<>(); + Map> materialMiningSpeeds = new LinkedHashMap<>(); materialMiningSpeeds.put("default", ImmutableMap.of()); //Special materials used for shears and swords special mining speed logic - Map leavesMaterialSpeeds = new HashMap<>(); - Map cowebMaterialSpeeds = new HashMap<>(); - Map plantMaterialSpeeds = new HashMap<>(); - Map gourdMaterialSpeeds = new HashMap<>(); + Map leavesMaterialSpeeds = new LinkedHashMap<>(); + Map cowebMaterialSpeeds = new LinkedHashMap<>(); + Map plantMaterialSpeeds = new LinkedHashMap<>(); + Map gourdMaterialSpeeds = new LinkedHashMap<>(); materialMiningSpeeds.put(makeMaterialNameForTag(BlockTags.LEAVES), leavesMaterialSpeeds); materialMiningSpeeds.put("coweb", cowebMaterialSpeeds); @@ -134,7 +134,7 @@ public JsonElement generateDataJson() { Tag effectiveBlocks = ((MiningToolItemAccessor) toolItem).getEffectiveBlocks(); String materialName = makeMaterialNameForTag(effectiveBlocks); - Map materialSpeeds = materialMiningSpeeds.computeIfAbsent(materialName, k -> new HashMap<>()); + Map materialSpeeds = materialMiningSpeeds.computeIfAbsent(materialName, k -> new LinkedHashMap<>()); float miningSpeed = ((MiningToolItemAccessor) toolItem).getMiningSpeed(); materialSpeeds.put(item, miningSpeed); } diff --git a/1.18/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java b/1.18/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java index 6435ddcb..5a287186 100644 --- a/1.18/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java +++ b/1.18/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java @@ -35,7 +35,7 @@ public static BiomeTintColors generateBiomeTintColors(Registry biomeRegis } public static Map generateRedstoneTintColors() { - Map resultColors = new HashMap<>(); + Map resultColors = new LinkedHashMap<>(); for (int redstoneLevel : RedstoneWireBlock.POWER.getValues()) { int color = RedstoneWireBlock.getWireColor(redstoneLevel); @@ -49,7 +49,7 @@ private static int getBlockColor(Block block) { } public static Map generateConstantTintColors() { - Map resultColors = new HashMap<>(); + Map resultColors = new LinkedHashMap<>(); resultColors.put(Blocks.BIRCH_LEAVES, FoliageColors.getBirchColor()); resultColors.put(Blocks.SPRUCE_LEAVES, FoliageColors.getSpruceColor()); @@ -156,8 +156,8 @@ public JsonObject generateDataJson() { } public static class BiomeTintColors { - final Map> grassColoursMap = new HashMap<>(); - final Map> foliageColoursMap = new HashMap<>(); - final Map> waterColourMap = new HashMap<>(); + final Map> grassColoursMap = new LinkedHashMap<>(); + final Map> foliageColoursMap = new LinkedHashMap<>(); + final Map> waterColourMap = new LinkedHashMap<>(); } } diff --git a/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java b/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java index e437e5df..1739de21 100644 --- a/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java +++ b/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java @@ -57,7 +57,7 @@ private static void createCompositeMaterialInfo(List allMaterials, private static void createCompositeMaterial(Map> allMaterials, List combinedMaterials) { String compositeMaterialName = String.join(";", combinedMaterials); - Map resultingToolSpeeds = new HashMap<>(); + Map resultingToolSpeeds = new LinkedHashMap<>(); combinedMaterials.stream() .map(allMaterials::get) .forEach(resultingToolSpeeds::putAll); @@ -104,14 +104,14 @@ public String getDataName() { public JsonElement generateDataJson() { Registry itemRegistry = Registry.ITEM; - Map> materialMiningSpeeds = new HashMap<>(); + Map> materialMiningSpeeds = new LinkedHashMap<>(); materialMiningSpeeds.put("default", ImmutableMap.of()); //Special materials used for shears and swords special mining speed logic - Map leavesMaterialSpeeds = new HashMap<>(); - Map cowebMaterialSpeeds = new HashMap<>(); - Map plantMaterialSpeeds = new HashMap<>(); - Map gourdMaterialSpeeds = new HashMap<>(); + Map leavesMaterialSpeeds = new LinkedHashMap<>(); + Map cowebMaterialSpeeds = new LinkedHashMap<>(); + Map plantMaterialSpeeds = new LinkedHashMap<>(); + Map gourdMaterialSpeeds = new LinkedHashMap<>(); materialMiningSpeeds.put(makeMaterialNameForTag(BlockTags.LEAVES), leavesMaterialSpeeds); materialMiningSpeeds.put("coweb", cowebMaterialSpeeds); @@ -130,7 +130,7 @@ public JsonElement generateDataJson() { TagKey effectiveBlocks = ((MiningToolItemAccessor) toolItem).getEffectiveBlocks(); String materialName = makeMaterialNameForTag(effectiveBlocks); - Map materialSpeeds = materialMiningSpeeds.computeIfAbsent(materialName, k -> new HashMap<>()); + Map materialSpeeds = materialMiningSpeeds.computeIfAbsent(materialName, k -> new LinkedHashMap<>()); float miningSpeed = ((MiningToolItemAccessor) toolItem).getMiningSpeed(); materialSpeeds.put(item, miningSpeed); } diff --git a/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java b/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java index 594a9e3e..aa27c3df 100644 --- a/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java +++ b/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java @@ -36,7 +36,7 @@ public static BiomeTintColors generateBiomeTintColors(Registry biomeRegis } public static Map generateRedstoneTintColors() { - Map resultColors = new HashMap<>(); + Map resultColors = new LinkedHashMap<>(); for (int redstoneLevel : RedstoneWireBlock.POWER.getValues()) { int color = RedstoneWireBlock.getWireColor(redstoneLevel); @@ -50,7 +50,7 @@ private static int getBlockColor(Block block) { } public static Map generateConstantTintColors() { - Map resultColors = new HashMap<>(); + Map resultColors = new LinkedHashMap<>(); resultColors.put(Blocks.BIRCH_LEAVES, FoliageColors.getBirchColor()); resultColors.put(Blocks.SPRUCE_LEAVES, FoliageColors.getSpruceColor()); @@ -152,8 +152,8 @@ public JsonObject generateDataJson() { } public static class BiomeTintColors { - final Map> grassColoursMap = new HashMap<>(); - final Map> foliageColoursMap = new HashMap<>(); - final Map> waterColourMap = new HashMap<>(); + final Map> grassColoursMap = new LinkedHashMap<>(); + final Map> foliageColoursMap = new LinkedHashMap<>(); + final Map> waterColourMap = new LinkedHashMap<>(); } } diff --git a/1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java b/1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java index e437e5df..1739de21 100644 --- a/1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java +++ b/1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java @@ -57,7 +57,7 @@ private static void createCompositeMaterialInfo(List allMaterials, private static void createCompositeMaterial(Map> allMaterials, List combinedMaterials) { String compositeMaterialName = String.join(";", combinedMaterials); - Map resultingToolSpeeds = new HashMap<>(); + Map resultingToolSpeeds = new LinkedHashMap<>(); combinedMaterials.stream() .map(allMaterials::get) .forEach(resultingToolSpeeds::putAll); @@ -104,14 +104,14 @@ public String getDataName() { public JsonElement generateDataJson() { Registry itemRegistry = Registry.ITEM; - Map> materialMiningSpeeds = new HashMap<>(); + Map> materialMiningSpeeds = new LinkedHashMap<>(); materialMiningSpeeds.put("default", ImmutableMap.of()); //Special materials used for shears and swords special mining speed logic - Map leavesMaterialSpeeds = new HashMap<>(); - Map cowebMaterialSpeeds = new HashMap<>(); - Map plantMaterialSpeeds = new HashMap<>(); - Map gourdMaterialSpeeds = new HashMap<>(); + Map leavesMaterialSpeeds = new LinkedHashMap<>(); + Map cowebMaterialSpeeds = new LinkedHashMap<>(); + Map plantMaterialSpeeds = new LinkedHashMap<>(); + Map gourdMaterialSpeeds = new LinkedHashMap<>(); materialMiningSpeeds.put(makeMaterialNameForTag(BlockTags.LEAVES), leavesMaterialSpeeds); materialMiningSpeeds.put("coweb", cowebMaterialSpeeds); @@ -130,7 +130,7 @@ public JsonElement generateDataJson() { TagKey effectiveBlocks = ((MiningToolItemAccessor) toolItem).getEffectiveBlocks(); String materialName = makeMaterialNameForTag(effectiveBlocks); - Map materialSpeeds = materialMiningSpeeds.computeIfAbsent(materialName, k -> new HashMap<>()); + Map materialSpeeds = materialMiningSpeeds.computeIfAbsent(materialName, k -> new LinkedHashMap<>()); float miningSpeed = ((MiningToolItemAccessor) toolItem).getMiningSpeed(); materialSpeeds.put(item, miningSpeed); } diff --git a/1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java b/1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java index 594a9e3e..aa27c3df 100644 --- a/1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java +++ b/1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java @@ -36,7 +36,7 @@ public static BiomeTintColors generateBiomeTintColors(Registry biomeRegis } public static Map generateRedstoneTintColors() { - Map resultColors = new HashMap<>(); + Map resultColors = new LinkedHashMap<>(); for (int redstoneLevel : RedstoneWireBlock.POWER.getValues()) { int color = RedstoneWireBlock.getWireColor(redstoneLevel); @@ -50,7 +50,7 @@ private static int getBlockColor(Block block) { } public static Map generateConstantTintColors() { - Map resultColors = new HashMap<>(); + Map resultColors = new LinkedHashMap<>(); resultColors.put(Blocks.BIRCH_LEAVES, FoliageColors.getBirchColor()); resultColors.put(Blocks.SPRUCE_LEAVES, FoliageColors.getSpruceColor()); @@ -152,8 +152,8 @@ public JsonObject generateDataJson() { } public static class BiomeTintColors { - final Map> grassColoursMap = new HashMap<>(); - final Map> foliageColoursMap = new HashMap<>(); - final Map> waterColourMap = new HashMap<>(); + final Map> grassColoursMap = new LinkedHashMap<>(); + final Map> foliageColoursMap = new LinkedHashMap<>(); + final Map> waterColourMap = new LinkedHashMap<>(); } } diff --git a/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java b/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java index 9063d1ea..674dd22a 100644 --- a/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java +++ b/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java @@ -58,7 +58,7 @@ private static void createCompositeMaterialInfo(List allMaterials, private static void createCompositeMaterial(Map> allMaterials, List combinedMaterials) { String compositeMaterialName = String.join(";", combinedMaterials); - Map resultingToolSpeeds = new HashMap<>(); + Map resultingToolSpeeds = new LinkedHashMap<>(); combinedMaterials.stream() .map(allMaterials::get) .forEach(resultingToolSpeeds::putAll); @@ -107,14 +107,14 @@ public String getDataName() { public JsonElement generateDataJson() { Registry itemRegistry = DGU.getWorld().getRegistryManager().get(RegistryKeys.ITEM); - Map> materialMiningSpeeds = new HashMap<>(); + Map> materialMiningSpeeds = new LinkedHashMap<>(); materialMiningSpeeds.put("default", ImmutableMap.of()); //Special materials used for shears and swords special mining speed logic - Map leavesMaterialSpeeds = new HashMap<>(); - Map cowebMaterialSpeeds = new HashMap<>(); - Map plantMaterialSpeeds = new HashMap<>(); - Map gourdMaterialSpeeds = new HashMap<>(); + Map leavesMaterialSpeeds = new LinkedHashMap<>(); + Map cowebMaterialSpeeds = new LinkedHashMap<>(); + Map plantMaterialSpeeds = new LinkedHashMap<>(); + Map gourdMaterialSpeeds = new LinkedHashMap<>(); materialMiningSpeeds.put(makeMaterialNameForTag(BlockTags.LEAVES), leavesMaterialSpeeds); materialMiningSpeeds.put("coweb", cowebMaterialSpeeds); @@ -133,7 +133,7 @@ public JsonElement generateDataJson() { TagKey effectiveBlocks = ((MiningToolItemAccessor) toolItem).getEffectiveBlocks(); String materialName = makeMaterialNameForTag(effectiveBlocks); - Map materialSpeeds = materialMiningSpeeds.computeIfAbsent(materialName, k -> new HashMap<>()); + Map materialSpeeds = materialMiningSpeeds.computeIfAbsent(materialName, k -> new LinkedHashMap<>()); float miningSpeed = ((MiningToolItemAccessor) toolItem).getMiningSpeed(); materialSpeeds.put(item, miningSpeed); } diff --git a/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java b/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java index 5873a305..52c7adc5 100644 --- a/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java +++ b/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java @@ -38,7 +38,7 @@ public static BiomeTintColors generateBiomeTintColors(Registry biomeRegis } public static Map generateRedstoneTintColors() { - Map resultColors = new HashMap<>(); + Map resultColors = new LinkedHashMap<>(); for (int redstoneLevel : RedstoneWireBlock.POWER.getValues()) { int color = RedstoneWireBlock.getWireColor(redstoneLevel); @@ -52,7 +52,7 @@ private static int getBlockColor(Block block) { } public static Map generateConstantTintColors() { - Map resultColors = new HashMap<>(); + Map resultColors = new LinkedHashMap<>(); resultColors.put(Blocks.BIRCH_LEAVES, FoliageColors.getBirchColor()); resultColors.put(Blocks.SPRUCE_LEAVES, FoliageColors.getSpruceColor()); @@ -154,8 +154,8 @@ public JsonObject generateDataJson() { } public static class BiomeTintColors { - final Map> grassColoursMap = new HashMap<>(); - final Map> foliageColoursMap = new HashMap<>(); - final Map> waterColourMap = new HashMap<>(); + final Map> grassColoursMap = new LinkedHashMap<>(); + final Map> foliageColoursMap = new LinkedHashMap<>(); + final Map> waterColourMap = new LinkedHashMap<>(); } } diff --git a/1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java b/1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java index b6bb3f3d..46e42b47 100644 --- a/1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java +++ b/1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java @@ -58,7 +58,7 @@ private static void createCompositeMaterialInfo(List allMaterials, private static void createCompositeMaterial(Map> allMaterials, List combinedMaterials) { String compositeMaterialName = String.join(";", combinedMaterials); - Map resultingToolSpeeds = new HashMap<>(); + Map resultingToolSpeeds = new LinkedHashMap<>(); combinedMaterials.stream() .map(allMaterials::get) .forEach(resultingToolSpeeds::putAll); @@ -113,14 +113,14 @@ public String getDataName() { public JsonElement generateDataJson() { Registry itemRegistry = DGU.getWorld().getRegistryManager().get(RegistryKeys.ITEM); - Map> materialMiningSpeeds = new HashMap<>(); + Map> materialMiningSpeeds = new LinkedHashMap<>(); materialMiningSpeeds.put("default", ImmutableMap.of()); //Special materials used for shears and swords special mining speed logic - Map leavesMaterialSpeeds = new HashMap<>(); - Map cowebMaterialSpeeds = new HashMap<>(); - Map plantMaterialSpeeds = new HashMap<>(); - Map gourdMaterialSpeeds = new HashMap<>(); + Map leavesMaterialSpeeds = new LinkedHashMap<>(); + Map cowebMaterialSpeeds = new LinkedHashMap<>(); + Map plantMaterialSpeeds = new LinkedHashMap<>(); + Map gourdMaterialSpeeds = new LinkedHashMap<>(); materialMiningSpeeds.put(makeMaterialNameForTag(BlockTags.LEAVES), leavesMaterialSpeeds); materialMiningSpeeds.put("coweb", cowebMaterialSpeeds); @@ -143,7 +143,7 @@ public JsonElement generateDataJson() { if (tagKey.isPresent()) { String materialName = makeMaterialNameForTag(tagKey.get()); - Map materialSpeeds = materialMiningSpeeds.computeIfAbsent(materialName, k -> new HashMap<>()); + Map materialSpeeds = materialMiningSpeeds.computeIfAbsent(materialName, k -> new LinkedHashMap<>()); float miningSpeed = item.getComponents().get(DataComponentTypes.TOOL).defaultMiningSpeed(); materialSpeeds.put(item, miningSpeed); } diff --git a/1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java b/1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java index 5873a305..52c7adc5 100644 --- a/1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java +++ b/1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java @@ -38,7 +38,7 @@ public static BiomeTintColors generateBiomeTintColors(Registry biomeRegis } public static Map generateRedstoneTintColors() { - Map resultColors = new HashMap<>(); + Map resultColors = new LinkedHashMap<>(); for (int redstoneLevel : RedstoneWireBlock.POWER.getValues()) { int color = RedstoneWireBlock.getWireColor(redstoneLevel); @@ -52,7 +52,7 @@ private static int getBlockColor(Block block) { } public static Map generateConstantTintColors() { - Map resultColors = new HashMap<>(); + Map resultColors = new LinkedHashMap<>(); resultColors.put(Blocks.BIRCH_LEAVES, FoliageColors.getBirchColor()); resultColors.put(Blocks.SPRUCE_LEAVES, FoliageColors.getSpruceColor()); @@ -154,8 +154,8 @@ public JsonObject generateDataJson() { } public static class BiomeTintColors { - final Map> grassColoursMap = new HashMap<>(); - final Map> foliageColoursMap = new HashMap<>(); - final Map> waterColourMap = new HashMap<>(); + final Map> grassColoursMap = new LinkedHashMap<>(); + final Map> foliageColoursMap = new LinkedHashMap<>(); + final Map> waterColourMap = new LinkedHashMap<>(); } } diff --git a/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java b/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java index 9063d1ea..674dd22a 100644 --- a/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java +++ b/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java @@ -58,7 +58,7 @@ private static void createCompositeMaterialInfo(List allMaterials, private static void createCompositeMaterial(Map> allMaterials, List combinedMaterials) { String compositeMaterialName = String.join(";", combinedMaterials); - Map resultingToolSpeeds = new HashMap<>(); + Map resultingToolSpeeds = new LinkedHashMap<>(); combinedMaterials.stream() .map(allMaterials::get) .forEach(resultingToolSpeeds::putAll); @@ -107,14 +107,14 @@ public String getDataName() { public JsonElement generateDataJson() { Registry itemRegistry = DGU.getWorld().getRegistryManager().get(RegistryKeys.ITEM); - Map> materialMiningSpeeds = new HashMap<>(); + Map> materialMiningSpeeds = new LinkedHashMap<>(); materialMiningSpeeds.put("default", ImmutableMap.of()); //Special materials used for shears and swords special mining speed logic - Map leavesMaterialSpeeds = new HashMap<>(); - Map cowebMaterialSpeeds = new HashMap<>(); - Map plantMaterialSpeeds = new HashMap<>(); - Map gourdMaterialSpeeds = new HashMap<>(); + Map leavesMaterialSpeeds = new LinkedHashMap<>(); + Map cowebMaterialSpeeds = new LinkedHashMap<>(); + Map plantMaterialSpeeds = new LinkedHashMap<>(); + Map gourdMaterialSpeeds = new LinkedHashMap<>(); materialMiningSpeeds.put(makeMaterialNameForTag(BlockTags.LEAVES), leavesMaterialSpeeds); materialMiningSpeeds.put("coweb", cowebMaterialSpeeds); @@ -133,7 +133,7 @@ public JsonElement generateDataJson() { TagKey effectiveBlocks = ((MiningToolItemAccessor) toolItem).getEffectiveBlocks(); String materialName = makeMaterialNameForTag(effectiveBlocks); - Map materialSpeeds = materialMiningSpeeds.computeIfAbsent(materialName, k -> new HashMap<>()); + Map materialSpeeds = materialMiningSpeeds.computeIfAbsent(materialName, k -> new LinkedHashMap<>()); float miningSpeed = ((MiningToolItemAccessor) toolItem).getMiningSpeed(); materialSpeeds.put(item, miningSpeed); } diff --git a/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java b/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java index 5873a305..52c7adc5 100644 --- a/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java +++ b/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java @@ -38,7 +38,7 @@ public static BiomeTintColors generateBiomeTintColors(Registry biomeRegis } public static Map generateRedstoneTintColors() { - Map resultColors = new HashMap<>(); + Map resultColors = new LinkedHashMap<>(); for (int redstoneLevel : RedstoneWireBlock.POWER.getValues()) { int color = RedstoneWireBlock.getWireColor(redstoneLevel); @@ -52,7 +52,7 @@ private static int getBlockColor(Block block) { } public static Map generateConstantTintColors() { - Map resultColors = new HashMap<>(); + Map resultColors = new LinkedHashMap<>(); resultColors.put(Blocks.BIRCH_LEAVES, FoliageColors.getBirchColor()); resultColors.put(Blocks.SPRUCE_LEAVES, FoliageColors.getSpruceColor()); @@ -154,8 +154,8 @@ public JsonObject generateDataJson() { } public static class BiomeTintColors { - final Map> grassColoursMap = new HashMap<>(); - final Map> foliageColoursMap = new HashMap<>(); - final Map> waterColourMap = new HashMap<>(); + final Map> grassColoursMap = new LinkedHashMap<>(); + final Map> foliageColoursMap = new LinkedHashMap<>(); + final Map> waterColourMap = new LinkedHashMap<>(); } } diff --git a/1.7/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java b/1.7/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java index 995275fd..fc1385c9 100644 --- a/1.7/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java +++ b/1.7/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java @@ -34,7 +34,7 @@ public static BiomeTintColors generateBiomeTintColors() { } public static Map generateConstantTintColors() { - Map resultColors = new HashMap<>(); + Map resultColors = new LinkedHashMap<>(); // FIXME: ? // resultColors.put(Blocks.BIRCH_LEAVES, FoliageColors.getBirchColor()); // resultColors.put(Blocks.SPRUCE_LEAVES, FoliageColors.getSpruceColor()); @@ -129,8 +129,8 @@ public JsonObject generateDataJson() { } public static class BiomeTintColors { - final Map> grassColoursMap = new HashMap<>(); - final Map> foliageColoursMap = new HashMap<>(); - final Map> waterColourMap = new HashMap<>(); + final Map> grassColoursMap = new LinkedHashMap<>(); + final Map> foliageColoursMap = new LinkedHashMap<>(); + final Map> waterColourMap = new LinkedHashMap<>(); } } diff --git a/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java b/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java index 1c21ddb7..cddf868a 100644 --- a/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java +++ b/1.8.9/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java @@ -37,7 +37,7 @@ public static BiomeTintColors generateBiomeTintColors() { } public static Map generateRedstoneTintColors() { - Map resultColors = new HashMap<>(); + Map resultColors = new LinkedHashMap<>(); RedstoneWireBlock redstoneWireBlock = new RedstoneWireBlock(); try { @@ -55,7 +55,7 @@ public static Map generateRedstoneTintColors() { } public static Map generateConstantTintColors() { - Map resultColors = new HashMap<>(); + Map resultColors = new LinkedHashMap<>(); // FIXME: ? // resultColors.put(Blocks.BIRCH_LEAVES, FoliageColors.getBirchColor()); // resultColors.put(Blocks.SPRUCE_LEAVES, FoliageColors.getSpruceColor()); @@ -152,8 +152,8 @@ public JsonObject generateDataJson() { } public static class BiomeTintColors { - final Map> grassColoursMap = new HashMap<>(); - final Map> foliageColoursMap = new HashMap<>(); - final Map> waterColourMap = new HashMap<>(); + final Map> grassColoursMap = new LinkedHashMap<>(); + final Map> foliageColoursMap = new LinkedHashMap<>(); + final Map> waterColourMap = new LinkedHashMap<>(); } } diff --git a/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java b/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java index c264f607..1e193129 100644 --- a/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java +++ b/1.9.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java @@ -39,7 +39,7 @@ public static BiomeTintColors generateBiomeTintColors() { } public static Map generateRedstoneTintColors() { - Map resultColors = new HashMap<>(); + Map resultColors = new LinkedHashMap<>(); for (int redstoneLevel : RedstoneWireBlock.POWER.getValues()) { int color = RedstoneWireBlock.getColorIntensity(redstoneLevel); @@ -53,7 +53,7 @@ private static int getBlockColor(Block block) { } public static Map generateConstantTintColors() { - Map resultColors = new HashMap<>(); + Map resultColors = new LinkedHashMap<>(); // FIXME: ? // resultColors.put(Blocks.BIRCH_LEAVES, FoliageColors.getBirchColor()); // resultColors.put(Blocks.SPRUCE_LEAVES, FoliageColors.getSpruceColor()); @@ -151,8 +151,8 @@ public JsonObject generateDataJson() { } public static class BiomeTintColors { - final Map> grassColoursMap = new HashMap<>(); - final Map> foliageColoursMap = new HashMap<>(); - final Map> waterColourMap = new HashMap<>(); + final Map> grassColoursMap = new LinkedHashMap<>(); + final Map> foliageColoursMap = new LinkedHashMap<>(); + final Map> waterColourMap = new LinkedHashMap<>(); } } diff --git a/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java b/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java index e437e5df..1739de21 100644 --- a/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java +++ b/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/generators/MaterialsDataGenerator.java @@ -57,7 +57,7 @@ private static void createCompositeMaterialInfo(List allMaterials, private static void createCompositeMaterial(Map> allMaterials, List combinedMaterials) { String compositeMaterialName = String.join(";", combinedMaterials); - Map resultingToolSpeeds = new HashMap<>(); + Map resultingToolSpeeds = new LinkedHashMap<>(); combinedMaterials.stream() .map(allMaterials::get) .forEach(resultingToolSpeeds::putAll); @@ -104,14 +104,14 @@ public String getDataName() { public JsonElement generateDataJson() { Registry itemRegistry = Registry.ITEM; - Map> materialMiningSpeeds = new HashMap<>(); + Map> materialMiningSpeeds = new LinkedHashMap<>(); materialMiningSpeeds.put("default", ImmutableMap.of()); //Special materials used for shears and swords special mining speed logic - Map leavesMaterialSpeeds = new HashMap<>(); - Map cowebMaterialSpeeds = new HashMap<>(); - Map plantMaterialSpeeds = new HashMap<>(); - Map gourdMaterialSpeeds = new HashMap<>(); + Map leavesMaterialSpeeds = new LinkedHashMap<>(); + Map cowebMaterialSpeeds = new LinkedHashMap<>(); + Map plantMaterialSpeeds = new LinkedHashMap<>(); + Map gourdMaterialSpeeds = new LinkedHashMap<>(); materialMiningSpeeds.put(makeMaterialNameForTag(BlockTags.LEAVES), leavesMaterialSpeeds); materialMiningSpeeds.put("coweb", cowebMaterialSpeeds); @@ -130,7 +130,7 @@ public JsonElement generateDataJson() { TagKey effectiveBlocks = ((MiningToolItemAccessor) toolItem).getEffectiveBlocks(); String materialName = makeMaterialNameForTag(effectiveBlocks); - Map materialSpeeds = materialMiningSpeeds.computeIfAbsent(materialName, k -> new HashMap<>()); + Map materialSpeeds = materialMiningSpeeds.computeIfAbsent(materialName, k -> new LinkedHashMap<>()); float miningSpeed = ((MiningToolItemAccessor) toolItem).getMiningSpeed(); materialSpeeds.put(item, miningSpeed); } diff --git a/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java b/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java index c57750c9..40da4f4e 100644 --- a/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java +++ b/22w19a/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java @@ -35,7 +35,7 @@ public static BiomeTintColors generateBiomeTintColors(Registry biomeRegis } public static Map generateRedstoneTintColors() { - Map resultColors = new HashMap<>(); + Map resultColors = new LinkedHashMap<>(); for (int redstoneLevel : RedstoneWireBlock.POWER.getValues()) { int color = RedstoneWireBlock.getWireColor(redstoneLevel); @@ -49,7 +49,7 @@ private static int getBlockColor(Block block) { } public static Map generateConstantTintColors() { - Map resultColors = new HashMap<>(); + Map resultColors = new LinkedHashMap<>(); resultColors.put(Blocks.BIRCH_LEAVES, FoliageColors.getBirchColor()); resultColors.put(Blocks.SPRUCE_LEAVES, FoliageColors.getSpruceColor()); @@ -156,8 +156,8 @@ public JsonObject generateDataJson() { } public static class BiomeTintColors { - final Map> grassColoursMap = new HashMap<>(); - final Map> foliageColoursMap = new HashMap<>(); - final Map> waterColourMap = new HashMap<>(); + final Map> grassColoursMap = new LinkedHashMap<>(); + final Map> foliageColoursMap = new LinkedHashMap<>(); + final Map> waterColourMap = new LinkedHashMap<>(); } } From a0691b4d8a812e5c95382cb08f70600ba13c15f1 Mon Sep 17 00:00:00 2001 From: AlexProgrammerDE <40795980+AlexProgrammerDE@users.noreply.github.com> Date: Wed, 3 Jul 2024 10:51:52 +0200 Subject: [PATCH 38/38] Fix imports --- .../generators/TintsDataGenerator.java | 5 +---- .../generators/TintsDataGenerator.java | 5 +---- .../generators/TintsDataGenerator.java | 5 +---- .../generators/TintsDataGenerator.java | 5 +---- .../generators/TintsDataGenerator.java | 5 +---- 5 files changed, 5 insertions(+), 20 deletions(-) diff --git a/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java b/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java index aa27c3df..5cd4ad15 100644 --- a/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java +++ b/1.19.2/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java @@ -14,10 +14,7 @@ import net.minecraft.util.registry.Registry; import net.minecraft.world.biome.Biome; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; public class TintsDataGenerator implements IDataGenerator { public static BiomeTintColors generateBiomeTintColors(Registry biomeRegistry) { diff --git a/1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java b/1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java index aa27c3df..5cd4ad15 100644 --- a/1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java +++ b/1.19/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java @@ -14,10 +14,7 @@ import net.minecraft.util.registry.Registry; import net.minecraft.world.biome.Biome; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; public class TintsDataGenerator implements IDataGenerator { public static BiomeTintColors generateBiomeTintColors(Registry biomeRegistry) { diff --git a/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java b/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java index 52c7adc5..5c21246b 100644 --- a/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java +++ b/1.20.4/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java @@ -16,10 +16,7 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.biome.Biome; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; public class TintsDataGenerator implements IDataGenerator { public static BiomeTintColors generateBiomeTintColors(Registry biomeRegistry) { diff --git a/1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java b/1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java index 52c7adc5..5c21246b 100644 --- a/1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java +++ b/1.20.5/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java @@ -16,10 +16,7 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.biome.Biome; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; public class TintsDataGenerator implements IDataGenerator { public static BiomeTintColors generateBiomeTintColors(Registry biomeRegistry) { diff --git a/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java b/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java index 52c7adc5..5c21246b 100644 --- a/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java +++ b/1.20/src/main/java/dev/u9g/minecraftdatagenerator/generators/TintsDataGenerator.java @@ -16,10 +16,7 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.biome.Biome; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; public class TintsDataGenerator implements IDataGenerator { public static BiomeTintColors generateBiomeTintColors(Registry biomeRegistry) {