From 3fa2e6ae7d33f5a3fb91ee0b9432620756c82499 Mon Sep 17 00:00:00 2001 From: MartinSVK12 <37455793+MartinSVK12@users.noreply.github.com> Date: Mon, 6 Nov 2023 18:49:20 +0100 Subject: [PATCH] Made the block data exporter class more generic. --- .../signalindustries/SignalIndustries.java | 2 +- .../signalindustries/util/BlockDataExporter.java | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/main/java/sunsetsatellite/signalindustries/SignalIndustries.java b/src/main/java/sunsetsatellite/signalindustries/SignalIndustries.java index 36fb3da8..888286d0 100644 --- a/src/main/java/sunsetsatellite/signalindustries/SignalIndustries.java +++ b/src/main/java/sunsetsatellite/signalindustries/SignalIndustries.java @@ -910,7 +910,7 @@ public SignalIndustries(){ EntityHelper.createEntity(EntityInfernal.class,new MobRenderer(new ModelZombie(), 0.5F),config.getInt("EntityIDs.infernalId"),"Infernal"); //crafting recipes in RecipeHandlerCraftingSI - BlockDataExporter.export(); + BlockDataExporter.export(SignalIndustries.class); } public static Map mapOf(K[] keys, V[] values){ diff --git a/src/main/java/sunsetsatellite/signalindustries/util/BlockDataExporter.java b/src/main/java/sunsetsatellite/signalindustries/util/BlockDataExporter.java index d7d6f9ba..e86d2e1f 100644 --- a/src/main/java/sunsetsatellite/signalindustries/util/BlockDataExporter.java +++ b/src/main/java/sunsetsatellite/signalindustries/util/BlockDataExporter.java @@ -6,7 +6,6 @@ import net.minecraft.core.block.Block; import net.minecraft.core.block.BlockTileEntity; import net.minecraft.core.util.helper.Side; -import sunsetsatellite.signalindustries.SignalIndustries; import turniplabs.halplibe.helper.TextureHelper; import java.io.DataOutputStream; @@ -19,8 +18,8 @@ import java.util.Map; public class BlockDataExporter { - public static void export() { - List fields = new ArrayList<>(Arrays.asList(SignalIndustries.class.getDeclaredFields())); + public static void export(Class clazz) { + List fields = new ArrayList<>(Arrays.asList(clazz.getDeclaredFields())); fields.removeIf((F)->F.getType() != Block.class); CompoundTag data = new CompoundTag(); for (Field field : fields) { @@ -32,7 +31,7 @@ public static void export() { } CompoundTag tag = new CompoundTag(); tag.putString("name",field.getName()); - tag.putString("mod",SignalIndustries.class.getName()); + tag.putString("mod", clazz.getName()); CompoundTag uv = new CompoundTag(); for (Side side : Side.values()) { if(side == Side.NONE) continue; @@ -59,7 +58,6 @@ public static void export() { try { try (DataOutputStream output = new DataOutputStream(Files.newOutputStream(file.toPath()))) { NbtIo.write(data, output); - SignalIndustries.LOGGER.info("exported block data"); } } catch (Exception e){ throw new RuntimeException(e);