|
| 1 | +package com.github.peeftube.spiromodnext.core.init; |
| 2 | + |
| 3 | +import com.github.peeftube.spiromodnext.SpiroMod; |
| 4 | +import com.github.peeftube.spiromodnext.core.init.registry.data.OreCollection; |
| 5 | +import com.github.peeftube.spiromodnext.core.init.registry.data.OreMaterial; |
| 6 | +import com.github.peeftube.spiromodnext.util.ore.BaseStone; |
| 7 | +import com.github.peeftube.spiromodnext.util.ore.Coupling; |
| 8 | +import net.minecraft.client.renderer.ItemBlockRenderTypes; |
| 9 | +import net.minecraft.client.renderer.RenderType; |
| 10 | +import net.minecraft.resources.ResourceLocation; |
| 11 | +import net.minecraft.world.level.block.Block; |
| 12 | +import net.minecraft.world.level.block.Blocks; |
| 13 | +import net.neoforged.neoforge.client.ChunkRenderTypeSet; |
| 14 | +import net.neoforged.neoforge.client.model.generators.BlockModelBuilder; |
| 15 | +import net.neoforged.neoforge.client.model.generators.ConfiguredModel; |
| 16 | + |
| 17 | +import java.util.Map; |
| 18 | + |
| 19 | +public class InitializeIBRT |
| 20 | +{ |
| 21 | + public static void go() |
| 22 | + { |
| 23 | + // Ore handling. |
| 24 | + oreSettings(Registry.COAL_ORES); |
| 25 | + oreSettings(Registry.IRON_ORES); |
| 26 | + oreSettings(Registry.COPPER_ORES); |
| 27 | + oreSettings(Registry.GOLD_ORES); |
| 28 | + oreSettings(Registry.LAPIS_ORES); |
| 29 | + oreSettings(Registry.REDSTONE_ORES); |
| 30 | + oreSettings(Registry.EMERALD_ORES); |
| 31 | + oreSettings(Registry.DIAMOND_ORES); |
| 32 | + oreSettings(Registry.QUARTZ_ORES); |
| 33 | + } |
| 34 | + |
| 35 | + protected static void oreSettings(OreCollection set) |
| 36 | + { |
| 37 | + // Flags for whether we should ignore block-model creation. |
| 38 | + boolean ignoreStone = false; // For ignoring default stone, assumes true for deepslate as well |
| 39 | + boolean ignoreNether = false; // For ignoring default Netherrack ore |
| 40 | + // NOTE: these two may be used in an OR statement to determine if this is a vanilla block. If so, |
| 41 | + // code should ignore the raw ore blocks. |
| 42 | + // TODO: add handler for this! |
| 43 | + |
| 44 | + // Prepare set data. |
| 45 | + OreMaterial material = set.getMat(); |
| 46 | + Map<BaseStone, Coupling> bulkData = set.getBulkData(); |
| 47 | + |
| 48 | + if (material == OreMaterial.COAL || material == OreMaterial.IRON || material == OreMaterial.COPPER |
| 49 | + || material == OreMaterial.GOLD || material == OreMaterial.LAPIS || material == OreMaterial.REDSTONE |
| 50 | + || material == OreMaterial.EMERALD || material == OreMaterial.DIAMOND) |
| 51 | + { ignoreStone = true; } |
| 52 | + |
| 53 | + if (material == OreMaterial.GOLD || material == OreMaterial.QUARTZ) |
| 54 | + { ignoreNether = true; } |
| 55 | + |
| 56 | + for (BaseStone s : BaseStone.values()) |
| 57 | + { |
| 58 | + if (((s == BaseStone.STONE || s == BaseStone.DEEPSLATE) && ignoreStone) |
| 59 | + || ((s == BaseStone.NETHERRACK) && ignoreNether)) |
| 60 | + { continue; } // Do nothing, we're using a material which already uses this combination... |
| 61 | + |
| 62 | + // Make this code easier to read, PLEASE.. |
| 63 | + Block b = bulkData.get(s).block().get(); |
| 64 | + |
| 65 | + SpiroMod.LOGGER.info("RUNNING: " + s.get().toUpperCase() + material.get().toUpperCase()); |
| 66 | + |
| 67 | + // Change render type status. |
| 68 | + ItemBlockRenderTypes.setRenderLayer(b, ChunkRenderTypeSet.of(RenderType.solid(), RenderType.translucent())); |
| 69 | + } |
| 70 | + } |
| 71 | +} |
0 commit comments