diff --git a/resources/assets/tinker/textures/blocks/ore_aluminum_overlay.png b/resources/assets/tinker/textures/blocks/ore_aluminum_overlay.png new file mode 100644 index 00000000000..76e6dbeab20 Binary files /dev/null and b/resources/assets/tinker/textures/blocks/ore_aluminum_overlay.png differ diff --git a/resources/assets/tinker/textures/blocks/ore_copper_overlay.png b/resources/assets/tinker/textures/blocks/ore_copper_overlay.png new file mode 100644 index 00000000000..c4431588fe7 Binary files /dev/null and b/resources/assets/tinker/textures/blocks/ore_copper_overlay.png differ diff --git a/resources/assets/tinker/textures/blocks/ore_tin_overlay.png b/resources/assets/tinker/textures/blocks/ore_tin_overlay.png new file mode 100644 index 00000000000..2157ab98ff5 Binary files /dev/null and b/resources/assets/tinker/textures/blocks/ore_tin_overlay.png differ diff --git a/src/api/java/exterminatorJeff/undergroundBiomes/api/UBAPIHook.java b/src/api/java/exterminatorJeff/undergroundBiomes/api/UBAPIHook.java new file mode 100644 index 00000000000..13279ef6428 --- /dev/null +++ b/src/api/java/exterminatorJeff/undergroundBiomes/api/UBAPIHook.java @@ -0,0 +1,11 @@ +package exterminatorJeff.undergroundBiomes.api; + +/** + * Striped down version, get the full API from here: https://github.com/Zeno410/UndergroundBiomes1.7API + * @author Zeno410 + */ +public class UBAPIHook { + public static final UBAPIHook ubAPIHook = new UBAPIHook(); + //public UBDimensionalStrataColumnProvider dimensionalStrataColumnProvider; // set in the main Underground Biomes + public UBOreTexturizer ubOreTexturizer; +} diff --git a/src/api/java/exterminatorJeff/undergroundBiomes/api/UBOreTexturizer.java b/src/api/java/exterminatorJeff/undergroundBiomes/api/UBOreTexturizer.java new file mode 100644 index 00000000000..947b156afbe --- /dev/null +++ b/src/api/java/exterminatorJeff/undergroundBiomes/api/UBOreTexturizer.java @@ -0,0 +1,70 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package exterminatorJeff.undergroundBiomes.api; + +import cpw.mods.fml.common.event.FMLPreInitializationEvent; +import net.minecraft.block.Block; +import net.minecraft.world.World; + +/** + * Striped down version, get the full API from here: https://github.com/Zeno410/UndergroundBiomes1.7API + * This is an interface for the class that can create Underground Biomes versions of arbitary ores + * It creates three new blocks for each texturized ore. + * @author Zeno410 + */ +public interface UBOreTexturizer { + // usage: Block is the ore block. + // Overlay name is the fully qualified name, e.g. modname:overlayName + // that static vars are fully qualified names for all the textures in the UB pack, just pass as is + // the event isn't needed per se, but if this is called anytime else, the blocks will not "stick" + public void setupUBOre(Block oreBlock, String overlayName, FMLPreInitializationEvent event); + public void setupUBOre(Block oreBlock, int metadata, String overlayName, FMLPreInitializationEvent event); + public void setupUBOre(Block oreBlock, int metadata, String overlayName, String blockName, FMLPreInitializationEvent event); + + public void requestUBOreSetup(Block oreBlock, String overlayName) throws BlocksAreAlreadySet; + public void requestUBOreSetup(Block oreBlock, int metadata, String overlayName) throws BlocksAreAlreadySet; + public void requestUBOreSetup(Block oreBlock, int metadata, String overlayName, String blockName) throws BlocksAreAlreadySet; + public void redoOres(int xInBlockCoordinates, int zInBlockCoordinates, World serverSideWorld) ; + + public static String amber_overlay = "undergroundbiomes:amber_overlay"; + public static String cinnabar_overlay = "undergroundbiomes:cinnabar_overlay"; + public static String coal_overlay = "undergroundbiomes:coal_overlay"; + public static String copper_overlay = "undergroundbiomes:copper_overlay"; + public static String diamond_overlay = "undergroundbiomes:diamond_overlay"; + public static String emerald_overlay = "undergroundbiomes:emerald_overlay"; + public static String gold_overlay = "undergroundbiomes:gold_overlay"; + public static String iron_overlay = "undergroundbiomes:iron_overlay"; + public static String lapis_overlay = "undergroundbiomes:lapis_overlay"; + public static String lead_overlay = "undergroundbiomes:lead_overlay"; + public static String olivine_peridot_overlay = "undergroundbiomes:olivine-peridot_overlay"; + public static String redstone_overlay = "undergroundbiomes:redstone_overlay"; + public static String ruby_overlay = "undergroundbiomes:ruby_overlay"; + public static String sapphire_overlay = "undergroundbiomes:sapphire_overlay"; + public static String tin_overlay = "undergroundbiomes:tin_overlay"; + public static String uranium_overlay = "undergroundbiomes:uranium_overlay"; + + public class BlocksAreAlreadySet extends RuntimeException { + // this is thrown if UB has already run its pre-initialization step and can no longer register blocks + public final Block oreBlock; + public final String overlayName; + + public BlocksAreAlreadySet(Block oreBlock, String overlayName) { + this.oreBlock = oreBlock; + this.overlayName = overlayName; + } + + @Override + public String toString() { + String blockDescription = "undefined block"; + String overlayDescription = "undefined overlay"; + if (oreBlock != null) blockDescription = oreBlock.getUnlocalizedName(); + if (overlayName != null) overlayDescription = overlayName; + return "Attempt to create Underground Biomes ore for "+blockDescription+" with "+overlayDescription + + " after blocks have already been defined"; + } + + } +} diff --git a/src/main/java/tconstruct/TConstruct.java b/src/main/java/tconstruct/TConstruct.java index 4b5a81db508..4e73185e2c8 100644 --- a/src/main/java/tconstruct/TConstruct.java +++ b/src/main/java/tconstruct/TConstruct.java @@ -16,8 +16,10 @@ import mantle.pulsar.control.PulseManager; import net.minecraft.world.gen.structure.MapGenStructureIO; import net.minecraftforge.common.MinecraftForge; + import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; + import tconstruct.achievements.AchievementEvents; import tconstruct.achievements.TAchievements; import tconstruct.api.TConstructAPI; @@ -40,6 +42,7 @@ import tconstruct.plugins.TinkerThaumcraft; import tconstruct.plugins.mfr.TinkerMFR; import tconstruct.plugins.te4.TinkerTE4; +import tconstruct.plugins.ubc.TinkerUBC; import tconstruct.plugins.waila.TinkerWaila; import tconstruct.smeltery.TinkerSmeltery; import tconstruct.tools.TinkerTools; @@ -64,7 +67,7 @@ */ @Mod(modid = "TConstruct", name = "TConstruct", version = "${version}", - dependencies = "required-after:Forge@[10.13.1.1217,);required-after:Mantle@[1.7.10-0.3.2,);after:MineFactoryReloaded;after:NotEnoughItems;after:Waila;after:ThermalExpansion;after:ThermalFoundation") + dependencies = "required-after:Forge@[10.13.1.1217,);required-after:Mantle@[1.7.10-0.3.2,);after:MineFactoryReloaded;after:NotEnoughItems;after:Waila;after:ThermalExpansion;after:ThermalFoundation;before:UndergroundBiomes") public class TConstruct { public static final String modVersion = "${version}"; @@ -136,6 +139,7 @@ public void preInit (FMLPreInitializationEvent event) pulsar.registerPulse(new TinkerMFR()); pulsar.registerPulse(new TinkerTE4()); pulsar.registerPulse(new TinkerFMP()); + pulsar.registerPulse(new TinkerUBC()); /*pulsar.registerPulse(new TinkerPrayers()); pulsar.registerPulse(new TinkerCropify());*/ diff --git a/src/main/java/tconstruct/plugins/ubc/TinkerUBC.java b/src/main/java/tconstruct/plugins/ubc/TinkerUBC.java new file mode 100644 index 00000000000..e87b82223d3 --- /dev/null +++ b/src/main/java/tconstruct/plugins/ubc/TinkerUBC.java @@ -0,0 +1,37 @@ +package tconstruct.plugins.ubc; + +import cpw.mods.fml.common.event.FMLPreInitializationEvent; +import cpw.mods.fml.common.registry.GameRegistry.ObjectHolder; +import exterminatorJeff.undergroundBiomes.api.UBAPIHook; +import exterminatorJeff.undergroundBiomes.api.UBOreTexturizer.BlocksAreAlreadySet; +import mantle.pulsar.pulse.Handler; +import mantle.pulsar.pulse.Pulse; +import tconstruct.TConstruct; +import tconstruct.world.TinkerWorld; + +@ObjectHolder(TConstruct.modID) +@Pulse(id = "Tinkers' Underground Biomes Compatiblity", description = "Tinkers' Construct compatibilty for Underground Biomes Construct", modsRequired = "UndergroundBiomes", pulsesRequired = "Tinkers' World", forced = true) +public class TinkerUBC +{ + @Handler + public void preInit (FMLPreInitializationEvent event) + { + registerBlock(3, "Copper"); + registerBlock(4, "Tin"); + registerBlock(5, "Aluminum"); + } + + private void registerBlock (int meta, String blockName) + { + String overlayTexture = blockName.toLowerCase(); + try + { + UBAPIHook.ubAPIHook.ubOreTexturizer.requestUBOreSetup(TinkerWorld.oreSlag, meta, "tinker:ore_" + overlayTexture + "_overlay", "MetalOre." + blockName); + } + catch (BlocksAreAlreadySet exception) + { + TConstruct.logger.error(blockName + " is already registered in UBC"); + } + + } +}