Search in sources :

Example 1 with ItemSoup

use of net.minecraft.item.ItemSoup in project ClaySoldiersMod by SanAndreasP.

the class UpgradeFood method onAdded.

@Override
public void onAdded(ISoldier<?> soldier, ItemStack stack, ISoldierUpgradeInst upgradeInst) {
    if (!soldier.getEntity().world.isRemote) {
        ItemFood itm = (ItemFood) stack.getItem();
        upgradeInst.getNbtData().setShort("uses", MAX_USES);
        upgradeInst.getNbtData().setFloat("restorePts", itm.getHealAmount(stack) * 0.5F);
        upgradeInst.getNbtData().setBoolean("hasBowl", itm instanceof ItemSoup);
        soldier.getEntity().playSound(SoundEvents.ENTITY_ITEM_PICKUP, 0.2F, ((MiscUtils.RNG.randomFloat() - MiscUtils.RNG.randomFloat()) * 0.7F + 1.0F) * 2.0F);
        stack.shrink(1);
    }
}
Also used : ItemFood(net.minecraft.item.ItemFood) ItemSoup(net.minecraft.item.ItemSoup)

Example 2 with ItemSoup

use of net.minecraft.item.ItemSoup in project ClaySoldiersMod by SanAndreasP.

the class UpgradeFood method onUpdate.

@Override
public boolean onUpdate(EntityClayMan clayMan, SoldierUpgradeInst upgradeInst) {
    if (clayMan.getHealth() < clayMan.getMaxHealth() * 0.25F && !upgradeInst.getNbtTag().getBoolean("killed")) {
        upgradeInst.getNbtTag().setShort(NBT_USES, (short) (upgradeInst.getNbtTag().getShort(NBT_USES) - 1));
        clayMan.heal(upgradeInst.getNbtTag().getFloat("healAmount"));
        this.spawnParticles(clayMan, upgradeInst);
        clayMan.playSound("random.eat", 1.0F, 0.9F + SAPUtils.RNG.nextFloat() * 0.2F);
    }
    if (upgradeInst.getNbtTag().getShort(NBT_USES) == 0) {
        if (upgradeInst.getStoredItem().getItem() instanceof ItemSoup) {
            clayMan.entityDropItem(new ItemStack(Items.bowl, 1), 0.0F);
        }
        return true;
    }
    return false;
}
Also used : ItemSoup(net.minecraft.item.ItemSoup) ItemStack(net.minecraft.item.ItemStack)

Example 3 with ItemSoup

use of net.minecraft.item.ItemSoup in project BiomesOPlenty by Glitchfiend.

the class ModItems method registerItems.

public static void registerItems() {
    jar_filled = registerItem(new ItemJarFilled(), "jar_filled");
    jar_empty = registerItem(new ItemJarEmpty(), "jar_empty");
    boat_sacred_oak = registerItem(new ItemBOPBoat(EntityBOPBoat.Type.SACRED_OAK), "boat_sacred_oak");
    boat_cherry = registerItem(new ItemBOPBoat(EntityBOPBoat.Type.CHERRY), "boat_cherry");
    boat_umbran = registerItem(new ItemBOPBoat(EntityBOPBoat.Type.UMBRAN), "boat_umbran");
    boat_fir = registerItem(new ItemBOPBoat(EntityBOPBoat.Type.FIR), "boat_fir");
    boat_ethereal = registerItem(new ItemBOPBoat(EntityBOPBoat.Type.ETHEREAL), "boat_ethereal");
    boat_magic = registerItem(new ItemBOPBoat(EntityBOPBoat.Type.MAGIC), "boat_magic");
    boat_mangrove = registerItem(new ItemBOPBoat(EntityBOPBoat.Type.MANGROVE), "boat_mangrove");
    boat_palm = registerItem(new ItemBOPBoat(EntityBOPBoat.Type.PALM), "boat_palm");
    boat_redwood = registerItem(new ItemBOPBoat(EntityBOPBoat.Type.REDWOOD), "boat_redwood");
    boat_willow = registerItem(new ItemBOPBoat(EntityBOPBoat.Type.WILLOW), "boat_willow");
    boat_pine = registerItem(new ItemBOPBoat(EntityBOPBoat.Type.PINE), "boat_pine");
    boat_hellbark = registerItem(new ItemBOPBoat(EntityBOPBoat.Type.HELLBARK), "boat_hellbark");
    boat_jacaranda = registerItem(new ItemBOPBoat(EntityBOPBoat.Type.JACARANDA), "boat_jacaranda");
    boat_mahogany = registerItem(new ItemBOPBoat(EntityBOPBoat.Type.MAHOGANY), "boat_mahogany");
    boat_ebony = registerItem(new ItemBOPBoat(EntityBOPBoat.Type.EBONY), "boat_ebony");
    boat_eucalyptus = registerItem(new ItemBOPBoat(EntityBOPBoat.Type.EUCALYPTUS), "boat_eucalyptus");
    biome_finder = registerItem(new ItemBiomeFinder(), "biome_finder");
    flower_basket = registerItem(new ItemFlowerBasket(), "flower_basket");
    record_wanderer = registerItem(new ItemBOPRecord("wanderer", BOPSounds.records_wanderer), "record_wanderer");
    mudball = registerItem(new ItemMudball(), "mudball");
    mud_brick = registerItem(new Item(), "mud_brick");
    ash = registerItem(new Item(), "ash");
    fleshchunk = registerItem(new Item(), "fleshchunk");
    pixie_dust = registerItem(new Item(), "pixie_dust");
    gem = registerItem(new ItemGem(), "gem");
    terrestrial_artifact = registerItem(new Item(), "terrestrial_artifact");
    terrestrial_artifact.setMaxStackSize(1);
    crystal_shard = registerItem(new Item(), "crystal_shard");
    biome_essence = registerItem(new ItemBiomeEssence(), "biome_essence");
    // food
    berries = registerItem(new ItemBOPFood(1, 0.1F, 8), "berries");
    pear = registerItem(new ItemFood(5, 0.3F, false), "pear");
    peach = registerItem(new ItemFood(5, 0.2F, false), "peach");
    persimmon = registerItem(new ItemFood(5, 0.2F, false), "persimmon");
    pinecone = registerItem(new Item(), "pinecone");
    turnip_seeds = registerItem(new ItemSeeds(BOPBlocks.turnip_block, Blocks.FARMLAND), "turnip_seeds");
    turnip = registerItem(new ItemFood(3, 0.4F, false), "turnip");
    honeycomb = registerItem(new Item(), "honeycomb");
    filled_honeycomb = registerItem(new ItemBOPFood(3, 0.4F, 16), "filled_honeycomb");
    shroompowder = registerItem(new ItemFood(1, 0.1F, false), "shroompowder");
    ((ItemFood) shroompowder).setAlwaysEdible();
    ((ItemFood) shroompowder).setPotionEffect(new PotionEffect(MobEffects.NAUSEA, 225, 0), 1.0F);
    saladfruit = registerItem(new ItemSoup(6), "saladfruit");
    ((ItemFood) saladfruit).setPotionEffect(new PotionEffect(MobEffects.HASTE, 775, 1), 0.05F);
    saladveggie = registerItem(new ItemSoup(6), "saladveggie");
    // TODO: Is this the right potion effect for veggie salad?
    ((ItemFood) saladveggie).setPotionEffect(new PotionEffect(MobEffects.NIGHT_VISION, 1100, 1), 0.05F);
    saladshroom = registerItem(new ItemSoup(6), "saladshroom");
    ((ItemFood) saladshroom).setPotionEffect(new PotionEffect(MobEffects.JUMP_BOOST, 550, 1), 0.05F);
    ricebowl = registerItem(new ItemSoup(2), "ricebowl");
    ambrosia = registerItem(new ItemAmbrosia(), "ambrosia");
    // TODO: move dyes to their own class?
    blue_dye = registerItem(new Item(), "blue_dye");
    brown_dye = registerItem(new Item(), "brown_dye");
    green_dye = registerItem(new Item(), "green_dye");
    white_dye = registerItem(new Item(), "white_dye");
    black_dye = registerItem(new Item(), "black_dye");
    earth = registerItem(new Item(), "earth");
    earth.setCreativeTab(null);
}
Also used : ItemJarFilled(biomesoplenty.common.item.ItemJarFilled) ItemSoup(net.minecraft.item.ItemSoup) ItemJarEmpty(biomesoplenty.common.item.ItemJarEmpty) ItemAmbrosia(biomesoplenty.common.item.ItemAmbrosia) PotionEffect(net.minecraft.potion.PotionEffect) ItemGem(biomesoplenty.common.item.ItemGem) ItemBiomeEssence(biomesoplenty.common.item.ItemBiomeEssence) ItemSeeds(net.minecraft.item.ItemSeeds) Item(net.minecraft.item.Item) ItemFood(net.minecraft.item.ItemFood) ItemBiomeFinder(biomesoplenty.common.item.ItemBiomeFinder) ItemFlowerBasket(biomesoplenty.common.item.ItemFlowerBasket) ItemBOPRecord(biomesoplenty.common.item.ItemBOPRecord) ItemMudball(biomesoplenty.common.item.ItemMudball) ItemBOPBoat(biomesoplenty.common.item.ItemBOPBoat) ItemBOPFood(biomesoplenty.common.item.ItemBOPFood)

Aggregations

ItemSoup (net.minecraft.item.ItemSoup)3 ItemFood (net.minecraft.item.ItemFood)2 ItemAmbrosia (biomesoplenty.common.item.ItemAmbrosia)1 ItemBOPBoat (biomesoplenty.common.item.ItemBOPBoat)1 ItemBOPFood (biomesoplenty.common.item.ItemBOPFood)1 ItemBOPRecord (biomesoplenty.common.item.ItemBOPRecord)1 ItemBiomeEssence (biomesoplenty.common.item.ItemBiomeEssence)1 ItemBiomeFinder (biomesoplenty.common.item.ItemBiomeFinder)1 ItemFlowerBasket (biomesoplenty.common.item.ItemFlowerBasket)1 ItemGem (biomesoplenty.common.item.ItemGem)1 ItemJarEmpty (biomesoplenty.common.item.ItemJarEmpty)1 ItemJarFilled (biomesoplenty.common.item.ItemJarFilled)1 ItemMudball (biomesoplenty.common.item.ItemMudball)1 Item (net.minecraft.item.Item)1 ItemSeeds (net.minecraft.item.ItemSeeds)1 ItemStack (net.minecraft.item.ItemStack)1 PotionEffect (net.minecraft.potion.PotionEffect)1