added in FMP plugin , tested code with and without fmp installed

This commit is contained in:
progwml6 committed 2013-09-30 23:07:14 -04:00
1 parent abdd27c235
commit df6eaf4dfc
4 files changed
+149 -4

No files matched your search

@@ -0,0 +1,50 @@
package tconstruct.plugins.fmp;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import cpw.mods.fml.common.*;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod;
import tconstruct.common.TContent;
import tconstruct.plugins.fmp.register.RegisterWithFMP;
@Mod(modid = "TConstruct|ForgeMuliPart", name = "TConstruct Compat: FMP", version = "0.1", dependencies = "after:ForgeMultipart;after:TConstruct")
@NetworkMod(clientSideRequired = false, serverSideRequired = false)
public class ForgeMultiPart {
@EventHandler
public static void load (FMLInitializationEvent ev)
{
if (!Loader.isModLoaded("ForgeMultipart"))
{
FMLLog.warning("Forgemultipart missing - TConstruct Compat: FMP not loading.");
return;
}
try
{
FMLLog.fine("ForgeMultipart detected. Registering TConstruct decorative blocks with FMP.");
//register blocks without metadata here
RegisterWithFMP.registerBlock(TContent.clearGlass);
RegisterWithFMP.registerBlock(TContent.searedBlock);
//register blocks w/ metadata here
for (int x =0;x<=15;x++)
{
RegisterWithFMP.registerBlock(TContent.stainedGlassClear, x);
RegisterWithFMP.registerBlock(TContent.multiBrick,x);
RegisterWithFMP.registerBlock(TContent.metalBlock ,x);
RegisterWithFMP.registerBlock(TContent.multiBrickFancy, x);
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
@@ -0,0 +1,28 @@
package tconstruct.plugins.fmp.register;
import net.minecraft.block.Block;
import codechicken.microblock.BlockMicroMaterial;
import codechicken.microblock.MicroMaterialRegistry;
public class RegisterWithFMP {
public static void registerBlock (Block block,int meta)
{
// meta = number 0->15
String identifier = new String( block.getUnlocalizedName());
MicroMaterialRegistry.registerMaterial(new BlockMicroMaterial(block, meta), identifier + meta);
// BlockMicroMaterial.createAndRegister(block);
//MicroMaterialRegistry.registerMaterial((IMicroMaterial) block.blockMaterial, "tinkers:" + identifier + meta);
}
public static void registerBlock (Block block )
{
//s = string identifier for meta ex: brick...
//MicroMaterialRegistry.registerMaterial(material, s + meta);
String identifier = new String( block.getUnlocalizedName());
//MicroMaterialRegistry.registerMaterial(new BlockMicroMaterial(block, 0), identifier );
//MicroMaterialRegistry.registerMaterial((IMicroMaterial) block.blockMaterial,"tinkers:" + identifier);
BlockMicroMaterial.createAndRegister(block);
}
}