use of net.minecraft.item.ItemFood in project GregTech by GregTechCE.
the class MachineRecipeLoader method registerOrganicRecyclingRecipes.
private static void registerOrganicRecyclingRecipes() {
RecipeMaps.BREWING_RECIPES.recipeBuilder().duration(800).EUt(3).input("treeSapling", 1).fluidInputs(Materials.Water.getFluid(100)).fluidOutputs(Materials.Biomass.getFluid(100)).buildAndRegister();
RecipeMaps.BREWING_RECIPES.recipeBuilder().duration(160).EUt(3).inputs(new ItemStack(Items.POTATO)).fluidInputs(Materials.Water.getFluid(20)).fluidOutputs(Materials.Biomass.getFluid(20)).buildAndRegister();
RecipeMaps.BREWING_RECIPES.recipeBuilder().duration(160).EUt(3).inputs(new ItemStack(Items.CARROT)).fluidInputs(Materials.Water.getFluid(20)).fluidOutputs(Materials.Biomass.getFluid(20)).buildAndRegister();
RecipeMaps.BREWING_RECIPES.recipeBuilder().duration(160).EUt(3).inputs(new ItemStack(Blocks.CACTUS)).fluidInputs(Materials.Water.getFluid(20)).fluidOutputs(Materials.Biomass.getFluid(20)).buildAndRegister();
RecipeMaps.BREWING_RECIPES.recipeBuilder().duration(160).EUt(3).inputs(new ItemStack(Items.REEDS)).fluidInputs(Materials.Water.getFluid(20)).fluidOutputs(Materials.Biomass.getFluid(20)).buildAndRegister();
RecipeMaps.BREWING_RECIPES.recipeBuilder().duration(160).EUt(3).inputs(new ItemStack(Blocks.BROWN_MUSHROOM)).fluidInputs(Materials.Water.getFluid(20)).fluidOutputs(Materials.Biomass.getFluid(20)).buildAndRegister();
RecipeMaps.BREWING_RECIPES.recipeBuilder().duration(160).EUt(3).inputs(new ItemStack(Blocks.RED_MUSHROOM)).fluidInputs(Materials.Water.getFluid(20)).fluidOutputs(Materials.Biomass.getFluid(20)).buildAndRegister();
RecipeMaps.BREWING_RECIPES.recipeBuilder().duration(160).EUt(3).inputs(new ItemStack(Items.BEETROOT)).fluidInputs(Materials.Water.getFluid(20)).fluidOutputs(Materials.Biomass.getFluid(20)).buildAndRegister();
RecipeMaps.CENTRIFUGE_RECIPES.recipeBuilder().duration(144).EUt(5).inputs(new ItemStack(Items.NETHER_WART)).fluidOutputs(Materials.Methane.getFluid(18)).buildAndRegister();
RecipeMaps.CENTRIFUGE_RECIPES.recipeBuilder().duration(144).EUt(5).inputs(new ItemStack(Blocks.BROWN_MUSHROOM)).fluidOutputs(Materials.Methane.getFluid(18)).buildAndRegister();
RecipeMaps.CENTRIFUGE_RECIPES.recipeBuilder().duration(144).EUt(5).inputs(new ItemStack(Blocks.RED_MUSHROOM)).fluidOutputs(Materials.Methane.getFluid(18)).buildAndRegister();
if (ConfigHolder.addFoodMethaneRecipes) {
for (Item item : ForgeRegistries.ITEMS.getValuesCollection()) {
if (item instanceof ItemFood) {
ItemFood itemFood = (ItemFood) item;
Collection<ItemStack> subItems = ModHandler.getAllSubItems(new ItemStack(item, 1, GTValues.W));
for (ItemStack itemStack : subItems) {
int healAmount = itemFood.getHealAmount(itemStack);
float saturationModifier = itemFood.getSaturationModifier(itemStack);
if (healAmount > 0) {
FluidStack outputStack = Materials.Methane.getFluid(Math.round(9 * healAmount * (1.0f + saturationModifier)));
RecipeMaps.CENTRIFUGE_RECIPES.recipeBuilder().duration(144).EUt(5).inputs(itemStack).fluidOutputs(outputStack).buildAndRegister();
}
}
}
}
}
}
use of net.minecraft.item.ItemFood in project Almura by AlmuraDev.
the class FoodLevelChangeApply method apply0.
@Override
public void apply0(final EntityPlayer entity, final ItemApplyContext context) {
final ItemStack usedStack = context.item();
if (usedStack.getItem() instanceof ItemFood) {
final ItemFood food = (ItemFood) usedStack.getItem();
final int currentFoodLevel = ((FoodStatsAccessor) entity.getFoodStats()).accessor$getFoodLevel();
((FoodStatsAccessor) entity.getFoodStats()).accessor$setFoodLevel(Math.min(currentFoodLevel + food.getHealAmount(usedStack), 20));
}
}
use of net.minecraft.item.ItemFood in project Almura by AlmuraDev.
the class MixinEntityAnimal method isCustomBreedingItem.
private boolean isCustomBreedingItem(ItemStack stack) {
final String itemName = stack.getTranslationKey();
// System.out.println("Breed Item: " + itemName);
final Entity animal = this;
if (animal instanceof EntityCow) {
switch(itemName.toUpperCase()) {
case "ITEM.ALMURA.FOOD.FOOD.CORN":
case "ITEM.ALMURA.FOOD.FOOD.SOYBEAN":
case "ITEM.ALMURA.NORMAL.CROP.ALFALFA_ITEM":
case "ITEM.WHEAT":
return true;
default:
return false;
}
}
if (animal instanceof EntityPig) {
switch(itemName.toUpperCase()) {
case "ITEM.ALMURA.FOOD.FOOD.CORN":
case "ITEM.ALMURA.FOOD.FOOD.SOYBEAN":
case "ITEM.CARROTS":
return true;
default:
return false;
}
}
if (animal instanceof EntitySheep) {
switch(itemName.toUpperCase()) {
case "ITEM.ALMURA.FOOD.FOOD.CORN":
case "ITEM.ALMURA.FOOD.FOOD.SOYBEAN":
case "ITEM.WHEAT":
return true;
default:
return false;
}
}
if (animal instanceof EntityChicken) {
switch(itemName.toUpperCase()) {
case "ITEM.ALMURA.FOOD.FOOD.CORN":
case "ITEM.ALMURA.FOOD.FOOD.SOYBEAN":
case "ITEM.SEEDS":
case "ITEM.SEEDS_MELON":
case "ITEM.BEETROOT_SEEDS":
case "ITEM.SEEDS_PUMPKIN":
return true;
default:
return false;
}
}
if (animal instanceof EntityOcelot) {
switch(itemName.toUpperCase()) {
case "ITEM.FISH":
return true;
default:
return false;
}
}
if (animal instanceof EntityWolf) {
return stack.getItem() instanceof ItemFood && ((ItemFood) stack.getItem()).isWolfsFavoriteMeat();
}
if (animal instanceof EntityRabbit) {
return this.isRabbitBreedingItem(stack.getItem());
}
return false;
}
use of net.minecraft.item.ItemFood in project harvestcraft by MatrexsVigil.
the class ItemRegistry method registerItemVanillaFood.
private static Item registerItemVanillaFood(String registryName, int amount, float saturation, boolean isWolfsFavoriteMeat) {
final Item item = new ItemFood(amount, saturation, isWolfsFavoriteMeat);
allFood.add(item);
return registerItem(item, registryName);
}
use of net.minecraft.item.ItemFood in project BloodMagic by WayofTime.
the class EntityMinorDemonGrunt method interact.
/**
* Called when a player interacts with a mob. e.g. gets milk from a cow, gets into the saddle on a pig.
*/
@Override
public boolean interact(EntityPlayer par1EntityPlayer) {
ItemStack itemstack = par1EntityPlayer.inventory.getCurrentItem();
if (this.isTamed()) {
if (itemstack != null) {
if (itemstack.getItem() instanceof ItemFood) {
ItemFood itemfood = (ItemFood) itemstack.getItem();
if (itemfood.isWolfsFavoriteMeat() && this.dataWatcher.getWatchableObjectFloat(18) < maxTamedHealth) {
if (!par1EntityPlayer.capabilities.isCreativeMode) {
--itemstack.stackSize;
}
this.heal((float) itemfood.func_150905_g(itemstack));
if (itemstack.stackSize <= 0) {
par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, null);
}
return true;
}
}
}
if (this.getOwner() instanceof EntityPlayer && SpellHelper.getUsername(par1EntityPlayer).equalsIgnoreCase(SpellHelper.getUsername((EntityPlayer) this.getOwner())) && !this.isBreedingItem(itemstack)) {
if (!this.worldObj.isRemote) {
this.aiSit.setSitting(!this.isSitting());
this.isJumping = false;
this.setPathToEntity(null);
this.setTarget(null);
this.setAttackTarget(null);
}
this.sendSittingMessageToPlayer(par1EntityPlayer, !this.isSitting());
}
} else if (this.isTameable() && itemstack != null && itemstack.getItem().equals(ModItems.weakBloodOrb) && !this.isAngry()) {
if (!par1EntityPlayer.capabilities.isCreativeMode) {
--itemstack.stackSize;
}
if (itemstack.stackSize <= 0) {
par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, null);
}
if (!this.worldObj.isRemote) {
if (this.rand.nextInt(1) == 0) {
this.setTamed(true);
this.setPathToEntity(null);
this.setAttackTarget(null);
this.aiSit.setSitting(true);
this.setHealth(maxTamedHealth);
this.func_152115_b(par1EntityPlayer.getUniqueID().toString());
this.playTameEffect(true);
this.worldObj.setEntityState(this, (byte) 7);
} else {
this.playTameEffect(false);
this.worldObj.setEntityState(this, (byte) 6);
}
}
return true;
}
return super.interact(par1EntityPlayer);
}
Aggregations