Skip to content

Commit

Permalink
Smeltery Melting IMC
Browse files Browse the repository at this point in the history
  • Loading branch information
bonii-xx committed Oct 14, 2014
1 parent 80ab942 commit a02db1c
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions src/main/java/tconstruct/util/IMCHandler.java
@@ -1,6 +1,7 @@
package tconstruct.util;

import cpw.mods.fml.common.event.FMLInterModComms;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
Expand All @@ -10,6 +11,7 @@
import tconstruct.library.TConstructRegistry;
import tconstruct.library.crafting.CastingRecipe;
import tconstruct.library.crafting.PatternBuilder;
import tconstruct.library.crafting.Smeltery;
import tconstruct.library.crafting.StencilBuilder;
import tconstruct.library.tools.DynamicToolPart;
import tconstruct.library.tools.ToolMaterial;
Expand Down Expand Up @@ -167,6 +169,33 @@ else if(type.equals("addPartCastingMaterial"))

TConstruct.logger.info("Casting IMC: Added fluid " + tag.getString("FluidName") + " to part casting");
}
else if(type.equals("addSmelteryMelting")) {
if (!message.isNBTMessage()) {
logInvalidMessage(message);
continue;
}
NBTTagCompound tag = message.getNBTValue();

if (!checkRequiredTags("Smeltery", tag, "FluidName", "Temperature", "Item", "Block"))
continue;

FluidStack liquid = FluidStack.loadFluidStackFromNBT(tag);
if(liquid == null) {
TConstruct.logger.error("Smeltery IMC: No fluid found");
continue;
}
if(liquid.amount <= 0) {
TConstruct.logger.error("Smeltery IMC: Liquid has to have an amount greater than zero");
continue;
}

ItemStack item = ItemStack.loadItemStackFromNBT(tag.getCompoundTag("Item"));
ItemStack block = ItemStack.loadItemStackFromNBT(tag.getCompoundTag("Block"));
int temperature = tag.getInteger("Temperature");

Smeltery.addMelting(item, Block.getBlockFromItem(block.getItem()), block.getItemDamage(), temperature, liquid);
TConstruct.logger.info("Smeltery IMC: Added melting: " + item.getDisplayName() + " to " + liquid.amount + "mb " + liquid.getLocalizedName());
}
}
}

Expand Down

0 comments on commit a02db1c

Please sign in to comment.