Search in sources :

Example 1 with IAugmentedItem

use of minechem.item.augment.IAugmentedItem in project Minechem by iopleke.

the class AugmentRecipe method getCraftingResult.

@Override
public ItemStack getCraftingResult(InventoryCrafting crafting) {
    ItemStack augment = getAugmentable(crafting);
    if (augment == null) {
        return null;
    }
    ItemStack item = getItem(crafting);
    if (item == null) {
        return null;
    }
    ItemStack result = augment.copy();
    ((IAugmentedItem) result.getItem()).setAugment(result, item);
    return result;
}
Also used : IAugmentedItem(minechem.item.augment.IAugmentedItem) ItemStack(net.minecraft.item.ItemStack)

Example 2 with IAugmentedItem

use of minechem.item.augment.IAugmentedItem in project Minechem by iopleke.

the class AugmentLight method onBlockHarvest.

@SubscribeEvent
public void onBlockHarvest(BlockEvent.HarvestDropsEvent event) {
    if (event.harvester != null) {
        ItemStack stack = event.harvester.getHeldItem();
        if (stack != null && stack.getItem() instanceof IAugmentedItem) {
            IAugmentedItem augmentedItem = (IAugmentedItem) stack.getItem();
            int level = augmentedItem.getAugmentLevel(stack, this);
            if (level > -1 && event.world.getBlockLightValue(event.x, event.y, event.z) < 8) {
                consumeAugment(stack, level);
                event.world.setBlock(event.x, event.y, event.z, BlockRegistry.blockLight, level, 3);
            }
        }
    }
}
Also used : IAugmentedItem(minechem.item.augment.IAugmentedItem) ItemStack(net.minecraft.item.ItemStack) SubscribeEvent(cpw.mods.fml.common.eventhandler.SubscribeEvent)

Example 3 with IAugmentedItem

use of minechem.item.augment.IAugmentedItem in project Minechem by iopleke.

the class AugmentRecipe method matches.

@Override
public boolean matches(InventoryCrafting crafting, World world) {
    ItemStack augmented = getAugmentable(crafting);
    if (augmented == null) {
        return false;
    }
    ItemStack augmentItem = getItem(crafting);
    if (augmentItem == null) {
        return false;
    }
    return ((IAugmentedItem) augmented.getItem()).canHaveAugment(augmented, AugmentRegistry.getAugment(augmentItem));
}
Also used : IAugmentedItem(minechem.item.augment.IAugmentedItem) ItemStack(net.minecraft.item.ItemStack)

Aggregations

IAugmentedItem (minechem.item.augment.IAugmentedItem)3 ItemStack (net.minecraft.item.ItemStack)3 SubscribeEvent (cpw.mods.fml.common.eventhandler.SubscribeEvent)1