Skip to content

Commit

Permalink
Adds UndergroundBiomes Construct support
Browse files Browse the repository at this point in the history
  • Loading branch information
Glassmaker authored and bonii-xx committed Jan 6, 2015
1 parent b65c2a7 commit 0972d78
Show file tree
Hide file tree
Showing 7 changed files with 123 additions and 1 deletion.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions 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;
}
@@ -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";
}

}
}
6 changes: 5 additions & 1 deletion src/main/java/tconstruct/TConstruct.java
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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}";
Expand Down Expand Up @@ -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());*/

Expand Down
37 changes: 37 additions & 0 deletions 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");
}

}
}

0 comments on commit 0972d78

Please sign in to comment.