FMP and Thermal Expansion integration

This commit is contained in:
Adaptivity 2016-01-05 11:02:59 +03:00
parent 31061e09d1
commit 1f8f6f3a68
5 changed files with 140 additions and 0 deletions

Binary file not shown.

Binary file not shown.

View File

@ -44,5 +44,29 @@ public class BOPIntegration
BOPLogger.warning("There was an error while integrating Thaumcraft with Biomes O' Plenty", e);
}
}
if (Loader.isModLoaded("ForgeMultipart"))
{
try
{
ForgeMultipartIntegration.init();
}
catch (Exception e)
{
BOPLogger.warning("There was an error while integrating ForgeMultipart with Biomes O' Plenty", e);
}
}
if (Loader.isModLoaded("ThermalExpansion"))
{
try
{
TEIntegration.init();
}
catch (Exception e)
{
BOPLogger.warning("There was an error while integrating Thermal Expansion with Biomes O' Plenty", e);
}
}
}
}

View File

@ -0,0 +1,62 @@
package biomesoplenty.common.integration;
import net.minecraft.block.Block;
import biomesoplenty.api.content.BOPCBlocks;
import codechicken.microblock.BlockMicroMaterial;
import codechicken.microblock.MicroMaterialRegistry;
public class ForgeMultipartIntegration
{
protected static void init()
{
addMicroblock(BOPCBlocks.mud);
addMicroblock(BOPCBlocks.driedDirt);
addMicroblock(BOPCBlocks.ash);
addMicroblock(BOPCBlocks.ashStone);
addMicroblock(BOPCBlocks.appleLeaves);
addMicroblock(BOPCBlocks.bopGrass, 0, 1);
addMicroblock(BOPCBlocks.colorizedLeaves1, 0, 3);
addMicroblock(BOPCBlocks.colorizedLeaves2, 0, 3);
addMicroblock(BOPCBlocks.persimmonLeaves);
addMicroblock(BOPCBlocks.newBopGrass, 0, 2);
addMicroblock(BOPCBlocks.newBopDirt, 0, 5);
addMicroblock(BOPCBlocks.leaves1, 0, 3);
addMicroblock(BOPCBlocks.leaves2, 0, 3);
addMicroblock(BOPCBlocks.leaves3, 0, 3);
addMicroblock(BOPCBlocks.leaves4, 0, 1);
addMicroblock(BOPCBlocks.mudBricks);
addMicroblock(BOPCBlocks.originGrass);
addMicroblock(BOPCBlocks.longGrass);
addMicroblock(BOPCBlocks.logs1, 0, 3);
addMicroblock(BOPCBlocks.logs2, 0, 3);
addMicroblock(BOPCBlocks.logs3, 0, 3);
addMicroblock(BOPCBlocks.logs4, 0, 3);
addMicroblock(BOPCBlocks.petals, 0, 1);
addMicroblock(BOPCBlocks.hardDirt);
addMicroblock(BOPCBlocks.hardIce);
addMicroblock(BOPCBlocks.hardSand);
addMicroblock(BOPCBlocks.rocks, 0, 5);
addMicroblock(BOPCBlocks.crystal);
addMicroblock(BOPCBlocks.flesh);
addMicroblock(BOPCBlocks.hive, 0, 3);
addMicroblock(BOPCBlocks.honeyBlock);
addMicroblock(BOPCBlocks.gemOre, 0, 15);
addMicroblock(BOPCBlocks.cragRock);
addMicroblock(BOPCBlocks.planks, 0, 14);
}
// Register a microblock.
private static void addMicroblock(Block b)
{
MicroMaterialRegistry.registerMaterial(new BlockMicroMaterial(b, 0), b.getUnlocalizedName());
}
// Register multiple microblocks. Meta range is inclusive.
private static void addMicroblock(Block b, int metaFrom, int metaTo)
{
for(int i = metaFrom; i <= metaTo; i++)
{
MicroMaterialRegistry.registerMaterial(new BlockMicroMaterial(b, i), b.getUnlocalizedName() + "." + i);
}
}
}

View File

@ -0,0 +1,54 @@
package biomesoplenty.common.integration;
import cpw.mods.fml.common.event.FMLInterModComms;
import biomesoplenty.api.content.BOPCBlocks;
import biomesoplenty.api.content.BOPCItems;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
public class TEIntegration
{
protected static void init()
{
addPulverizerRecipes();
}
private static void addPulverizerRecipes()
{
addPulverizerRecipe(160, new ItemStack(BOPCBlocks.bones, 1, 0), new ItemStack(Items.dye, 6, 15));
addPulverizerRecipe(220, new ItemStack(BOPCBlocks.bones, 1, 1), new ItemStack(Items.dye, 12, 15));
addPulverizerRecipe(280, new ItemStack(BOPCBlocks.bones, 1, 2), new ItemStack(Items.dye, 24, 15));
addPulverizerRecipe(80, new ItemStack(BOPCBlocks.mushrooms, 1, 0), new ItemStack(BOPCItems.food, 2, 1));
addPulverizerRecipe(280, new ItemStack(BOPCBlocks.ash, 1), new ItemStack(BOPCItems.misc, 4, 1));
addPulverizerRecipe(280, new ItemStack(BOPCBlocks.flesh, 1), new ItemStack(BOPCItems.misc, 4, 3));
addPulverizerRecipe(280, new ItemStack(BOPCBlocks.crystal, 1), new ItemStack(BOPCItems.misc, 4, 4));
}
private static void addPulverizerRecipe(int energy, ItemStack input, ItemStack primaryOutput)
{
addPulverizerRecipe(energy, input, primaryOutput, null, 0);
}
private static void addPulverizerRecipe(int energy, ItemStack input, ItemStack primaryOutput, ItemStack secondaryOutput)
{
addPulverizerRecipe(energy, input, primaryOutput, secondaryOutput, 0);
}
private static void addPulverizerRecipe(int energy, ItemStack input, ItemStack primaryOutput, ItemStack secondaryOutput, int secondaryChance)
{
NBTTagCompound pulverizerCompound = new NBTTagCompound();
pulverizerCompound.setInteger("energy", energy);
pulverizerCompound.setTag("input", new NBTTagCompound());
pulverizerCompound.setTag("primaryOutput", new NBTTagCompound());
pulverizerCompound.setTag("secondaryOutput", new NBTTagCompound());
input.writeToNBT(pulverizerCompound.getCompoundTag("input"));
primaryOutput.writeToNBT(pulverizerCompound.getCompoundTag("primaryOutput"));
if (secondaryOutput != null) secondaryOutput.writeToNBT(pulverizerCompound.getCompoundTag("secondaryOutput"));
if (secondaryOutput != null && secondaryChance != 0) pulverizerCompound.setInteger("secondaryChance", secondaryChance);
FMLInterModComms.sendMessage("ThermalExpansion", "PulverizerRecipe", pulverizerCompound);
}
}