use of com.builtbroken.mc.prefab.items.ItemStackWrapper in project Engine by VoltzEngine-Project.
the class ExplosiveRegistryClient method getCornerIconFor.
/**
* Gets the corner icon for the explosive item. Defaults
* to using {@link ITexturedExplosiveHandler} if the explosive
* handler implements the interface. If it doesn't then
* the map will be searched for the item.
*
* @param stack
* @return item or missing icon
*/
public static IIcon getCornerIconFor(final ItemStack stack, int pass) {
ItemStack item = stack;
if (item.getItem() instanceof IExplosiveContainerItem) {
item = ((IExplosiveContainerItem) item.getItem()).getExplosiveStack(stack);
}
if (item != null) {
IExplosiveHandler handler = ExplosiveRegistry.get(item);
if (handler instanceof ITexturedExplosiveHandler) {
IIcon icon = ((ITexturedExplosiveHandler) handler).getBottomLeftCornerIcon(item, pass);
if (icon != null) {
return icon;
}
}
ItemStackWrapper wrapper = new ItemStackWrapper(item);
if (EX_CORNER_ICONS.containsKey(wrapper)) {
return EX_CORNER_ICONS.get(wrapper);
}
}
return missing_corner_icon;
}
use of com.builtbroken.mc.prefab.items.ItemStackWrapper in project Engine by VoltzEngine-Project.
the class MassRegistry method setMass.
@Override
public void setMass(ItemStack stack, double mass) {
if (stack != null) {
ItemStackWrapper wrapper = new ItemStackWrapper(stack);
if (mass < 0) {
Engine.logger().error("Mass is negative, setting to positive", new RuntimeException());
}
stackMass.put(wrapper, Math.abs(mass));
} else {
Engine.logger().error("Item can not be null", new RuntimeException());
}
}
use of com.builtbroken.mc.prefab.items.ItemStackWrapper in project Engine by VoltzEngine-Project.
the class MRItemStack method addInputOption.
public MRItemStack addInputOption(Item input) {
ItemStackWrapper wrapper = new ItemStackWrapper(new ItemStack(input));
wrapper.meta_compare = false;
wrapper.nbt_compare = false;
return (MRItemStack) super.addInputOption(wrapper);
}
use of com.builtbroken.mc.prefab.items.ItemStackWrapper in project Engine by VoltzEngine-Project.
the class MRItemStack method addInputOption.
public MRItemStack addInputOption(Block input) {
ItemStackWrapper wrapper = new ItemStackWrapper(new ItemStack(input));
wrapper.meta_compare = false;
wrapper.nbt_compare = false;
return (MRItemStack) super.addInputOption(wrapper);
}
use of com.builtbroken.mc.prefab.items.ItemStackWrapper in project Engine by VoltzEngine-Project.
the class InventoryUtility method mapRecipes.
/**
* Called to map recipes to items and
* itemstacks. Used for varies purposes,
* such as, quicker filter checks, crafting,
* guis, and commands.
*/
public static void mapRecipes() {
ITEMSTACK_TO_RECIPES.clear();
ITEM_TO_RECIPES.clear();
Engine.logger().info("Mapping basic recipe data...");
Engine.logger().info(" " + CraftingManager.getInstance().getRecipeList().size() + " recipes detected.");
long time = System.nanoTime();
for (Object r : CraftingManager.getInstance().getRecipeList()) {
if (r instanceof IRecipe && ((IRecipe) r).getRecipeOutput() != null) {
ItemStackWrapper wrapper = new ItemStackWrapper(((IRecipe) r).getRecipeOutput());
List<IRecipe> list = ITEMSTACK_TO_RECIPES.get(wrapper);
if (list == null) {
list = new ArrayList();
}
list.add((IRecipe) r);
ITEMSTACK_TO_RECIPES.put(wrapper, list);
ITEM_TO_RECIPES.put(((IRecipe) r).getRecipeOutput().getItem(), list);
}
}
Engine.logger().info(" Done in.. " + StringHelpers.formatNanoTime(System.nanoTime() - time));
}
Aggregations