From 757926377d532e06fd2d77eea605feacb8b16635 Mon Sep 17 00:00:00 2001 From: serenibyss <10861407+serenibyss@users.noreply.github.com> Date: Tue, 12 Dec 2023 21:15:53 -0600 Subject: [PATCH 1/4] Chisel module --- dependencies.gradle | 1 + src/main/java/gregtech/api/GTValues.java | 3 +- .../integration/chisel/ChiselModule.java | 98 +++++++++++++++++++ .../gregtech/loaders/OreDictionaryLoader.java | 2 + .../gregtech/modules/GregTechModules.java | 1 + 5 files changed, 104 insertions(+), 1 deletion(-) create mode 100644 src/main/java/gregtech/integration/chisel/ChiselModule.java diff --git a/dependencies.gradle b/dependencies.gradle index a1254cf48a9..db9bf2304c2 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -44,6 +44,7 @@ dependencies { compileOnlyApi rfg.deobf("curse.maven:hwyla-253449:2568751") // HWYLA 1.8.26-B41 compileOnlyApi rfg.deobf("curse.maven:baubles-227083:2518667") // Baubles 1.5.2 compileOnlyApi rfg.deobf("curse.maven:forestry-59751:2684780") // Forestry 5.8.2.387 + compileOnlyApi rfg.deobf("curse.maven:chisel-235279:2915375") // Chisel 1.0.2.45 // Mods with Soft compat but which have no need to be in code, such as isModLoaded() checks and getModItem() recipes. // Uncomment any of these to test them in-game. diff --git a/src/main/java/gregtech/api/GTValues.java b/src/main/java/gregtech/api/GTValues.java index ef4a1730829..7a1b5d34f4f 100644 --- a/src/main/java/gregtech/api/GTValues.java +++ b/src/main/java/gregtech/api/GTValues.java @@ -157,7 +157,8 @@ public class GTValues { MODID_BOP = "biomesoplenty", MODID_TCON = "tconstruct", MODID_PROJRED_CORE = "projectred-core", - MODID_RC = "railcraft"; + MODID_RC = "railcraft", + MODID_CHISEL = "chisel"; private static Boolean isClient; diff --git a/src/main/java/gregtech/integration/chisel/ChiselModule.java b/src/main/java/gregtech/integration/chisel/ChiselModule.java new file mode 100644 index 00000000000..508aeb82442 --- /dev/null +++ b/src/main/java/gregtech/integration/chisel/ChiselModule.java @@ -0,0 +1,98 @@ +package gregtech.integration.chisel; + +import gregtech.api.GTValues; +import gregtech.api.block.VariantBlock; +import gregtech.api.modules.GregTechModule; +import gregtech.common.blocks.BlockColored; +import gregtech.common.blocks.BlockWarningSign; +import gregtech.common.blocks.BlockWarningSign1; +import gregtech.common.blocks.MetaBlocks; +import gregtech.common.blocks.StoneVariantBlock; +import gregtech.common.blocks.StoneVariantBlock.StoneType; +import gregtech.common.blocks.StoneVariantBlock.StoneVariant; +import gregtech.common.blocks.wood.BlockGregPlanks; +import gregtech.integration.IntegrationSubmodule; +import gregtech.modules.GregTechModules; + +import net.minecraft.block.Block; +import net.minecraft.item.EnumDyeColor; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.IStringSerializable; +import net.minecraftforge.fml.common.event.FMLInitializationEvent; +import net.minecraftforge.fml.common.event.FMLInterModComms; + +import team.chisel.common.carving.Carving; + +import java.util.Objects; + +@GregTechModule( + moduleID = GregTechModules.MODULE_CHISEL, + containerID = GTValues.MODID, + modDependencies = GTValues.MODID_CHISEL, + name = "GregTech Chisel Integration", + description = "Chisel Integration Module") +public class ChiselModule extends IntegrationSubmodule { + + @Override + public void init(FMLInitializationEvent event) { + // GT custom groups + addVariations("gt_warning_sign", MetaBlocks.WARNING_SIGN, BlockWarningSign.SignType.values()); + addVariations("gt_warning_sign", MetaBlocks.WARNING_SIGN_1, BlockWarningSign1.SignType.values()); + addVariations("gt_studs", MetaBlocks.STUDS); + addVariations("gt_metal_sheet", MetaBlocks.METAL_SHEET); + addVariations("gt_large_metal_sheet", MetaBlocks.LARGE_METAL_SHEET); + + // Chisel shared groups + addVariations("marble", StoneType.MARBLE, false); + addVariations("basalt", StoneType.BASALT, false); + addVariations("black_granite", StoneType.BLACK_GRANITE, false); + addVariations("red_granite", StoneType.RED_GRANITE, false); + addVariations("light_concrete", StoneType.CONCRETE_LIGHT, true); + addVariations("dark_concrete", StoneType.CONCRETE_DARK, true); + + // Mod-dependent groups + if (doesGroupExist("treated_wood")) { // IE Treated Wood group + addVariations("treated_wood", MetaBlocks.PLANKS, BlockGregPlanks.BlockType.TREATED_PLANK); + } + } + + @SafeVarargs + private & IStringSerializable, T extends VariantBlock> void addVariations(String group, + T block, + U... variants) { + if (variants != null) { + for (U variant : variants) { + addVariation(group, block, block.getMetaFromState(block.getState(variant))); + } + } + } + + private void addVariations(String group, BlockColored block) { + for (EnumDyeColor color : EnumDyeColor.values()) { + addVariation(group, block, color.getMetadata()); + } + } + + private void addVariations(String group, StoneType type, boolean enableCobbles) { + for (StoneVariantBlock.StoneVariant variant : StoneVariant.values()) { + if (!enableCobbles && (variant == StoneVariant.COBBLE || variant == StoneVariant.COBBLE_MOSSY)) { + continue; + } + StoneVariantBlock block = MetaBlocks.STONE_BLOCKS.get(variant); + int meta = block.getMetaFromState(block.getState(type)); + addVariation(group, block, meta); + } + } + + private void addVariation(String group, Block block, int meta) { + NBTTagCompound tag = new NBTTagCompound(); + tag.setString("group", group); + tag.setString("block", Objects.requireNonNull(block.getRegistryName()).toString()); + tag.setInteger("meta", meta); + FMLInterModComms.sendMessage(GTValues.MODID_CHISEL, "add_variation", tag); + } + + private boolean doesGroupExist(String group) { + return Carving.chisel.getGroup(group) != null; + } +} diff --git a/src/main/java/gregtech/loaders/OreDictionaryLoader.java b/src/main/java/gregtech/loaders/OreDictionaryLoader.java index b05fba4609b..a902983af39 100644 --- a/src/main/java/gregtech/loaders/OreDictionaryLoader.java +++ b/src/main/java/gregtech/loaders/OreDictionaryLoader.java @@ -25,12 +25,14 @@ public class OreDictionaryLoader { public static final String OREDICT_FUEL_COKE = "fuelCoke"; public static final String OREDICT_BLOCK_FUEL_COKE = "blockFuelCoke"; + public static final String OREDICT_BLOCK_COAL_COKE = "blockCoalCoke"; public static void init() { GTLog.logger.info("Registering OreDict entries."); OreDictionary.registerOre(OREDICT_FUEL_COKE, OreDictUnifier.get(OrePrefix.gem, Materials.Coke)); OreDictionary.registerOre(OREDICT_BLOCK_FUEL_COKE, OreDictUnifier.get(OrePrefix.block, Materials.Coke)); + OreDictionary.registerOre(OREDICT_BLOCK_COAL_COKE, OreDictUnifier.get(OrePrefix.block, Materials.Coke)); OreDictionary.registerOre("crystalCertusQuartz", OreDictUnifier.get(OrePrefix.gem, Materials.CertusQuartz)); OreDictUnifier.registerOre(new ItemStack(Blocks.CLAY), OrePrefix.block, Materials.Clay); diff --git a/src/main/java/gregtech/modules/GregTechModules.java b/src/main/java/gregtech/modules/GregTechModules.java index 9c07e90db26..96ad33664b9 100644 --- a/src/main/java/gregtech/modules/GregTechModules.java +++ b/src/main/java/gregtech/modules/GregTechModules.java @@ -17,6 +17,7 @@ public class GregTechModules implements IModuleContainer { public static final String MODULE_HWYLA = "hwyla_integration"; public static final String MODULE_BAUBLES = "baubles_integration"; public static final String MODULE_FR = "fr_integration"; + public static final String MODULE_CHISEL = "chisel_integration"; @Override public String getID() { From 7a66de77bcd3e681f8317591e7195d1224e7e858 Mon Sep 17 00:00:00 2001 From: serenibyss <10861407+serenibyss@users.noreply.github.com> Date: Tue, 12 Dec 2023 21:40:39 -0600 Subject: [PATCH 2/4] chisel lamps --- .../java/gregtech/integration/chisel/ChiselModule.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main/java/gregtech/integration/chisel/ChiselModule.java b/src/main/java/gregtech/integration/chisel/ChiselModule.java index 508aeb82442..9b9d3dd8e83 100644 --- a/src/main/java/gregtech/integration/chisel/ChiselModule.java +++ b/src/main/java/gregtech/integration/chisel/ChiselModule.java @@ -41,6 +41,15 @@ public void init(FMLInitializationEvent event) { addVariations("gt_studs", MetaBlocks.STUDS); addVariations("gt_metal_sheet", MetaBlocks.METAL_SHEET); addVariations("gt_large_metal_sheet", MetaBlocks.LARGE_METAL_SHEET); + for (EnumDyeColor color : EnumDyeColor.values()) { + Block lamp = MetaBlocks.LAMPS.get(color); + Block lampBorderless = MetaBlocks.BORDERLESS_LAMPS.get(color); + String group = "gt_lamp_" + color.getName().toLowerCase(); + for (int i = 0; i < 8; i++) { + addVariation(group, lamp, i); + addVariation(group, lampBorderless, i); + } + } // Chisel shared groups addVariations("marble", StoneType.MARBLE, false); From d9f25653eeeaabeef5df8568f6ccc9f84d2c83c3 Mon Sep 17 00:00:00 2001 From: serenibyss <10861407+serenibyss@users.noreply.github.com> Date: Tue, 12 Dec 2023 21:41:13 -0600 Subject: [PATCH 3/4] spunchless --- .../java/gregtech/integration/chisel/ChiselModule.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/gregtech/integration/chisel/ChiselModule.java b/src/main/java/gregtech/integration/chisel/ChiselModule.java index 9b9d3dd8e83..c9133912407 100644 --- a/src/main/java/gregtech/integration/chisel/ChiselModule.java +++ b/src/main/java/gregtech/integration/chisel/ChiselModule.java @@ -26,11 +26,11 @@ import java.util.Objects; @GregTechModule( - moduleID = GregTechModules.MODULE_CHISEL, - containerID = GTValues.MODID, - modDependencies = GTValues.MODID_CHISEL, - name = "GregTech Chisel Integration", - description = "Chisel Integration Module") + moduleID = GregTechModules.MODULE_CHISEL, + containerID = GTValues.MODID, + modDependencies = GTValues.MODID_CHISEL, + name = "GregTech Chisel Integration", + description = "Chisel Integration Module") public class ChiselModule extends IntegrationSubmodule { @Override From 275d71cad056c3c79d91453ae8323c26d309a76b Mon Sep 17 00:00:00 2001 From: serenibyss <10861407+serenibyss@users.noreply.github.com> Date: Thu, 14 Dec 2023 21:35:34 -0600 Subject: [PATCH 4/4] certus quartz chiseling and material amount fix --- .../java/gregtech/api/unification/ore/OrePrefix.java | 1 + .../gregtech/integration/chisel/ChiselModule.java | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/src/main/java/gregtech/api/unification/ore/OrePrefix.java b/src/main/java/gregtech/api/unification/ore/OrePrefix.java index 64eb11cd7fa..30239988324 100644 --- a/src/main/java/gregtech/api/unification/ore/OrePrefix.java +++ b/src/main/java/gregtech/api/unification/ore/OrePrefix.java @@ -467,6 +467,7 @@ public static void init() { block.modifyMaterialAmount(Materials.Glowstone, 4); block.modifyMaterialAmount(Materials.NetherQuartz, 4); + block.modifyMaterialAmount(Materials.CertusQuartz, 4); block.modifyMaterialAmount(Materials.Brick, 4); block.modifyMaterialAmount(Materials.Clay, 4); block.modifyMaterialAmount(Materials.Glass, 1); diff --git a/src/main/java/gregtech/integration/chisel/ChiselModule.java b/src/main/java/gregtech/integration/chisel/ChiselModule.java index c9133912407..c6dc3cafe05 100644 --- a/src/main/java/gregtech/integration/chisel/ChiselModule.java +++ b/src/main/java/gregtech/integration/chisel/ChiselModule.java @@ -3,7 +3,10 @@ import gregtech.api.GTValues; import gregtech.api.block.VariantBlock; import gregtech.api.modules.GregTechModule; +import gregtech.api.unification.material.Material; +import gregtech.api.unification.material.Materials; import gregtech.common.blocks.BlockColored; +import gregtech.common.blocks.BlockCompressed; import gregtech.common.blocks.BlockWarningSign; import gregtech.common.blocks.BlockWarningSign1; import gregtech.common.blocks.MetaBlocks; @@ -63,6 +66,9 @@ public void init(FMLInitializationEvent event) { if (doesGroupExist("treated_wood")) { // IE Treated Wood group addVariations("treated_wood", MetaBlocks.PLANKS, BlockGregPlanks.BlockType.TREATED_PLANK); } + if (doesGroupExist("certus")) { // AE2 Certus Quartz group + addVariation("certus", Materials.CertusQuartz); + } } @SafeVarargs @@ -93,6 +99,12 @@ private void addVariations(String group, StoneType type, boolean enableCobbles) } } + private void addVariation(String group, Material material) { + BlockCompressed block = MetaBlocks.COMPRESSED.get(material); + int meta = block.getMetaFromState(block.getBlock(material)); + addVariation(group, block, meta); + } + private void addVariation(String group, Block block, int meta) { NBTTagCompound tag = new NBTTagCompound(); tag.setString("group", group);