Close #441 Add Underground Biomes Constructs integration

This commit is contained in:
mezz committed 2015-01-21 23:36:21 -08:00
1 parent 953a84f346
commit b3b1a6a415
10 files changed
+138 -3

No files matched your search

@@ -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;
}
@@ -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";
}
}
}
+2 -1
View File
@@ -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 {
@@ -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;
@@ -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.");
}
}
}