diff --git a/dependencies.gradle b/dependencies.gradle index 3af530e782d..19b3de56f63 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -41,6 +41,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/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 new file mode 100644 index 00000000000..c6dc3cafe05 --- /dev/null +++ b/src/main/java/gregtech/integration/chisel/ChiselModule.java @@ -0,0 +1,119 @@ +package gregtech.integration.chisel; + +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; +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); + 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); + 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); + } + if (doesGroupExist("certus")) { // AE2 Certus Quartz group + addVariation("certus", Materials.CertusQuartz); + } + } + + @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, 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); + 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() {