Package powercrystals.minefactoryreloaded.farmables.ranchables

Source Code of powercrystals.minefactoryreloaded.farmables.ranchables.RanchableMooshroom

package powercrystals.minefactoryreloaded.farmables.ranchables;

import java.util.LinkedList;
import java.util.List;

import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.passive.EntityMooshroom;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.liquids.LiquidDictionary;
import net.minecraftforge.liquids.LiquidStack;
import powercrystals.core.inventory.IInventoryManager;
import powercrystals.core.inventory.InventoryManager;
import powercrystals.minefactoryreloaded.api.IFactoryRanchable;

public class RanchableMooshroom implements IFactoryRanchable {
 
  @Override
  public Class<?> getRanchableEntity()
  {
    return EntityMooshroom.class;
  }
 
  @Override
  public List<ItemStack> ranch(World world, EntityLiving entity, IInventory rancher)
  {
    List<ItemStack> drops = new LinkedList<ItemStack>();
   
    IInventoryManager manager = InventoryManager.create(rancher, ForgeDirection.UP);
    int bowlIndex = manager.findItem(new ItemStack(Item.bowlEmpty));
    if(bowlIndex >= 0)
    {
      drops.add(new ItemStack(Item.bowlSoup));
      rancher.decrStackSize(bowlIndex, 1);
    }
   
    int bucketIndex = manager.findItem(new ItemStack(Item.bucketEmpty));
    if(bucketIndex >= 0)
    {
      drops.add(new ItemStack(Item.bucketMilk));
      rancher.setInventorySlotContents(bucketIndex, null);
    }
    else
    {
      LiquidStack soup = LiquidDictionary.getLiquid("mushroomsoup", 1000);
      drops.add(new ItemStack(soup.itemID, 1, soup.itemMeta));
    }
   
    return drops;
  }
}
TOP

Related Classes of powercrystals.minefactoryreloaded.farmables.ranchables.RanchableMooshroom

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.