Skip to content

Commit

Permalink
Added IMC message for registering IEnergyContainerItems as a valid Fl…
Browse files Browse the repository at this point in the history
…ux modifier

make sure that the flux modifier is not null
  • Loading branch information
BigXplosion committed Jan 13, 2015
1 parent e61bbd9 commit 1e1e278
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions src/main/java/tconstruct/util/IMCHandler.java
@@ -1,8 +1,8 @@
package tconstruct.util;

import cofh.api.energy.IEnergyContainerItem;
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;
import net.minecraft.nbt.NBTTagCompound;
Expand All @@ -12,14 +12,11 @@
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;
import tconstruct.library.util.IPattern;
import tconstruct.library.util.IToolPart;
import tconstruct.smeltery.TinkerSmeltery;
import tconstruct.tools.TinkerTools;
import tconstruct.tools.items.Pattern;

import java.util.LinkedList;
import java.util.List;
Expand Down Expand Up @@ -246,6 +243,21 @@ else if(type.equals("addSmelteryFuel")) {
Smeltery.addSmelteryFuel(liquid.getFluid(), temperature, duration);

TConstruct.logger.info("Smeltery IMC: Added fuel: " + liquid.getLocalizedName() + " (" + temperature + ", " + duration + ")");
} else if (type.equals("addFluxBattery")) {
if (!message.isItemStackMessage()) {
logInvalidMessage(message);
continue;
}
ItemStack battery = message.getItemStackValue();
battery.stackSize = 1; // avoid getting a stack size of 0 or larger than 1

if(!(battery.getItem() instanceof IEnergyContainerItem)) {
TConstruct.logger.error("Flux Battery IMC: ItemStack is no instance of IEnergyContainerItem");
}

if (TinkerTools.modFlux != null) {
TinkerTools.modFlux.batteries.add(battery);
}
}
}
}
Expand Down

0 comments on commit 1e1e278

Please sign in to comment.