diff --git a/build.gradle b/build.gradle index d3175fa11..175a988e7 100755 --- a/build.gradle +++ b/build.gradle @@ -197,6 +197,7 @@ task mainJarSigned ( type: Jar, dependsOn: 'reobf' ) { from (zipTree(jar.getArchivePath())) { exclude '**/api/**' exclude '**/codechicken/**' + exclude '**/undergroundBiomes/**' } duplicatesStrategy = DuplicatesStrategy.EXCLUDE @@ -223,6 +224,7 @@ task mainJar ( type: Zip, dependsOn: mainJarSigned ) { from (zipTree(jar.getArchivePath())) { include '**' exclude '**/codechicken/**' + exclude '**/undergroundBiomes/**' } duplicatesStrategy = DuplicatesStrategy.EXCLUDE @@ -235,6 +237,7 @@ task devJarSigned ( type: Jar, dependsOn: 'classes' ) { from(sourceSets.main.output) { exclude '**/api/**' exclude '**/codechicken/**' + exclude '**/undergroundBiomes/**' } destinationDir = file("build/tmp") @@ -260,11 +263,13 @@ task devJar ( type: Zip, dependsOn: devJarSigned ) { from(sourceSets.main.allSource) { include '**' exclude '**/codechicken/**' + exclude '**/undergroundBiomes/**' } from(sourceSets.main.output) { include '**' exclude '**/codechicken/**' + exclude '**/undergroundBiomes/**' } duplicatesStrategy = DuplicatesStrategy.EXCLUDE diff --git a/lang b/lang index 1db950cc2..273421fbf 160000 --- a/lang +++ b/lang @@ -1 +1 @@ -Subproject commit 1db950cc23eb11b5ae14291c1454645328292a7d +Subproject commit 273421fbfc587a8e364608cd16ed9c786e44d902 diff --git a/src/main/java/exterminatorJeff/undergroundBiomes/api/UBAPIHook.java b/src/main/java/exterminatorJeff/undergroundBiomes/api/UBAPIHook.java new file mode 100644 index 000000000..13279ef64 --- /dev/null +++ b/src/main/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/main/java/exterminatorJeff/undergroundBiomes/api/UBOreTexturizer.java b/src/main/java/exterminatorJeff/undergroundBiomes/api/UBOreTexturizer.java new file mode 100644 index 000000000..c036de0a1 --- /dev/null +++ b/src/main/java/exterminatorJeff/undergroundBiomes/api/UBOreTexturizer.java @@ -0,0 +1,65 @@ +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/forestry/Forestry.java b/src/main/java/forestry/Forestry.java index 9d42c573b..229e7d274 100755 --- a/src/main/java/forestry/Forestry.java +++ b/src/main/java/forestry/Forestry.java @@ -58,7 +58,8 @@ import net.minecraft.item.Item; + "after:Buildcraft|Core@[6.1.7,);" + "after:ExtrabiomesXL;" + "after:BiomesOPlenty;" - + "after:IC2@[2.0.140,)") + + "after:IC2@[2.0.140,);" + + "before:UndergroundBiomes") //, certificateFingerprint = Version.FINGERPRINT) public class Forestry { diff --git a/src/main/java/forestry/plugins/PluginManager.java b/src/main/java/forestry/plugins/PluginManager.java index e521a671c..acfa759c5 100755 --- a/src/main/java/forestry/plugins/PluginManager.java +++ b/src/main/java/forestry/plugins/PluginManager.java @@ -82,7 +82,8 @@ public class PluginManager { EQUIVELENT_EXCHANGE(new PluginEE()), FARM_CRAFTORY(new PluginFarmCraftory()), INDUSTRIALCRAFT(new PluginIC2()), - NATURA(new PluginNatura()),; + NATURA(new PluginNatura()), + UNDERGROUND_BIOMES(new PluginUndergroundBiomes()); private final ForestryPlugin instance; private final boolean canBeDisabled; diff --git a/src/main/java/forestry/plugins/PluginUndergroundBiomes.java b/src/main/java/forestry/plugins/PluginUndergroundBiomes.java new file mode 100644 index 000000000..5bc51bc16 --- /dev/null +++ b/src/main/java/forestry/plugins/PluginUndergroundBiomes.java @@ -0,0 +1,52 @@ +/******************************************************************************* + * Copyright (c) 2011-2014 SirSengir. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the GNU Lesser Public License v3 + * which accompanies this distribution, and is available at + * http://www.gnu.org/licenses/lgpl-3.0.txt + * + * Various Contributors including, but not limited to: + * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges + ******************************************************************************/ +package forestry.plugins; + +import cpw.mods.fml.common.Optional; + +import forestry.core.config.Defaults; +import forestry.core.config.ForestryBlock; +import forestry.core.proxy.Proxies; + +import exterminatorJeff.undergroundBiomes.api.UBAPIHook; +import exterminatorJeff.undergroundBiomes.api.UBOreTexturizer; + +@Plugin(pluginID = "UndergroundBiomes", name = "UndergroundBiomes", author = "mezz", url = Defaults.URL, unlocalizedDescription = "for.plugin.undergroundBiomes.description") +public class PluginUndergroundBiomes extends ForestryPlugin { + + public boolean isAvailable() { + return Proxies.common.isModLoaded("UndergroundBiomes"); + } + + public String getFailMessage() { + return "UndergroundBiomes is not found."; + } + + @Optional.Method(modid = "UndergroundBiomes") + @Override + protected void preInit() { + registerBlock(0, "apatite"); + registerBlock(1, "copper"); + registerBlock(2, "tin"); + } + + @Optional.Method(modid = "UndergroundBiomes") + private void registerBlock(int meta, String textureName) { + try { + String blockName = ForestryBlock.resources.getItemStack(1, meta).getUnlocalizedName(); + UBAPIHook.ubAPIHook.ubOreTexturizer.requestUBOreSetup(ForestryBlock.resources.block(), meta, "forestry:ores/" + textureName + "_overlay", blockName); + } catch (UBOreTexturizer.BlocksAreAlreadySet exception) { + Proxies.log.severe(exception.toString()); + } catch (Throwable throwable) { + Proxies.log.severe("Underground Biomes crashed."); + } + } +} diff --git a/src/main/resources/assets/forestry/textures/blocks/ores/apatite_overlay.png b/src/main/resources/assets/forestry/textures/blocks/ores/apatite_overlay.png new file mode 100644 index 000000000..0b9547399 Binary files /dev/null and b/src/main/resources/assets/forestry/textures/blocks/ores/apatite_overlay.png differ diff --git a/src/main/resources/assets/forestry/textures/blocks/ores/copper_overlay.png b/src/main/resources/assets/forestry/textures/blocks/ores/copper_overlay.png new file mode 100644 index 000000000..287f34796 Binary files /dev/null and b/src/main/resources/assets/forestry/textures/blocks/ores/copper_overlay.png differ diff --git a/src/main/resources/assets/forestry/textures/blocks/ores/tin_overlay.png b/src/main/resources/assets/forestry/textures/blocks/ores/tin_overlay.png new file mode 100644 index 000000000..5f1ce5e2a Binary files /dev/null and b/src/main/resources/assets/forestry/textures/blocks/ores/tin_overlay.png differ