public override void GetHeldItemInfo(ItemSlot inSlot, StringBuilder dsc, IWorldAccessor world, bool withDebugInfo) { base.GetHeldItemInfo(inSlot, dsc, world, withDebugInfo); CookingRecipe recipe = GetMealRecipe(world, inSlot.Itemstack); float servings = inSlot.Itemstack.Attributes.GetFloat("quantityServings"); ItemStack[] stacks = GetContents(world, inSlot.Itemstack); DummySlot firstContentItemSlot = new DummySlot(stacks != null && stacks.Length > 0 ? stacks[0] : null, inSlot.Inventory); if (recipe != null) { if (servings == 1) { dsc.AppendLine(Lang.Get("{0} serving of {1}", Math.Round(servings, 1), recipe.GetOutputName(world, stacks))); } else { dsc.AppendLine(Lang.Get("{0} servings of {1}", Math.Round(servings, 1), recipe.GetOutputName(world, stacks))); } } BlockMeal mealblock = api.World.GetBlock(new AssetLocation("bowl-meal")) as BlockMeal; string nutriFacts = mealblock.GetContentNutritionFacts(api.World, inSlot, stacks, null); if (nutriFacts != null) { dsc.AppendLine(nutriFacts); } firstContentItemSlot.Itemstack?.Collectible.AppendPerishableInfoText(firstContentItemSlot, dsc, world); }
public override void GetHeldItemInfo(ItemStack stack, StringBuilder dsc, IWorldAccessor world, bool withDebugInfo) { base.GetHeldItemInfo(stack, dsc, world, withDebugInfo); CookingRecipe recipe = GetMealRecipe(world, stack); int servings = stack.Attributes.GetInt("servings"); if (recipe != null) { if (servings == 1) { dsc.AppendLine(Lang.Get("{0} serving of {1}", servings, recipe.GetOutputName(world, GetContents(world, stack)))); } else { dsc.AppendLine(Lang.Get("{0} servings of {1}", servings, recipe.GetOutputName(world, GetContents(world, stack)))); } } BlockMeal mealblock = api.World.GetBlock(new AssetLocation("bowl-meal")) as BlockMeal; string nutriFacts = mealblock.GetContentNutritionFacts(api.World, GetContents(world, stack), null); if (nutriFacts != null) { dsc.AppendLine(nutriFacts); } }
public override string GetBlockInfo(IPlayer forPlayer) { ItemStack[] contentStacks = GetContentStacks(); CookingRecipe recipe = api.World.CookingRecipes.FirstOrDefault(rec => rec.Code == RecipeCode); if (recipe == null) { return(null); } int servings = QuantityServings; int temp = GetTemperature(); string temppretty = Lang.Get("{0}°C", temp); if (temp < 20) { temppretty = "Cold"; } BlockMeal mealblock = api.World.GetBlock(new AssetLocation("bowl-meal")) as BlockMeal; string nutriFacts = mealblock.GetContentNutritionFacts(api.World, contentStacks, forPlayer.Entity); if (servings == 1) { return(Lang.Get("{0} serving of {1}\nTemperature: {2}{3}{4}", servings, recipe.GetOutputName(forPlayer.Entity.World, contentStacks), temppretty, nutriFacts != null ? "\n" : "", nutriFacts)); } else { return(Lang.Get("{0} servings of {1}\nTemperature: {2}{3}{4}", servings, recipe.GetOutputName(forPlayer.Entity.World, contentStacks), temppretty, nutriFacts != null ? "\n" : "", nutriFacts)); } }
public override string GetPlacedBlockInfo(IWorldAccessor world, BlockPos pos, IPlayer forPlayer) { BlockEntityPie bep = world.BlockAccessor.GetBlockEntity(pos) as BlockEntityPie; if (bep?.Inventory == null || bep.Inventory.Count < 1 || bep.Inventory.Empty) { return(""); } BlockMeal mealblock = api.World.GetBlock(new AssetLocation("bowl-meal")) as BlockMeal; ItemStack pieStack = bep.Inventory[0].Itemstack; ItemStack[] stacks = GetContents(api.World, pieStack); StringBuilder sb = new StringBuilder(); TransitionableProperties[] propsm = pieStack.Collectible.GetTransitionableProperties(api.World, pieStack, null); if (propsm != null && propsm.Length > 0) { pieStack.Collectible.AppendPerishableInfoText(bep.Inventory[0], sb, api.World); } float servingsLeft = GetQuantityServings(world, bep.Inventory[0].Itemstack); if (!bep.Inventory[0].Itemstack.Attributes.HasAttribute("quantityServings")) { servingsLeft = bep.SlicesLeft / 4f; } float[] nmul = GetNutritionHealthMul(pos, null, forPlayer.Entity); sb.AppendLine(mealblock.GetContentNutritionFacts(api.World, bep.Inventory[0], stacks, null, true, nmul[0] * servingsLeft, nmul[1] * servingsLeft)); return(sb.ToString()); }
protected override MeshData genMesh(ItemStack stack, int index) { BlockCrock crockblock = stack.Collectible as BlockCrock; BlockMeal mealblock = stack.Collectible as BlockMeal; MeshData mesh; if (crockblock != null) { Vec3f rot = new Vec3f(0, block.Shape.rotateY, 0); mesh = BlockEntityCrock.GetMesh(capi.Tesselator, Api, crockblock, crockblock.GetContents(Api.World, stack), crockblock.GetRecipeCode(Api.World, stack), rot).Clone(); } else if (mealblock != null) { ICoreClientAPI capi = Api as ICoreClientAPI; MealMeshCache meshCache = capi.ModLoader.GetModSystem <MealMeshCache>(); mesh = meshCache.GenMealInContainerMesh(mealblock, mealblock.GetCookingRecipe(capi.World, stack), mealblock.GetNonEmptyContents(capi.World, stack)); } else { ICoreClientAPI capi = Api as ICoreClientAPI; if (stack.Class == EnumItemClass.Block) { mesh = capi.TesselatorManager.GetDefaultBlockMesh(stack.Block).Clone(); } else { nowTesselatingItem = stack.Item; nowTesselatingShape = capi.TesselatorManager.GetCachedShape(stack.Item.Shape.Base); capi.Tesselator.TesselateItem(stack.Item, out mesh, this); mesh.RenderPasses.Fill((short)EnumChunkRenderPass.BlendNoCull); } } if (stack.Collectible.Attributes?["onDisplayTransform"].Exists == true) { ModelTransform transform = stack.Collectible.Attributes?["onDisplayTransform"].AsObject <ModelTransform>(); transform.EnsureDefaultValues(); mesh.ModelTransform(transform); } if (stack.Class == EnumItemClass.Item && (stack.Item.Shape == null || stack.Item.Shape.VoxelizeTexture)) { mesh.Rotate(new Vec3f(0.5f, 0.5f, 0.5f), GameMath.PIHALF, 0, 0); mesh.Scale(new Vec3f(0.5f, 0.5f, 0.5f), 0.33f, 0.5f, 0.33f); mesh.Translate(0, -7.5f / 16f, 0f); } float x = ((index % 4) >= 2) ? 12 / 16f : 4 / 16f; float y = index >= 4 ? 10 / 16f : 2 / 16f; float z = (index % 2 == 0) ? 4 / 16f : 10 / 16f; Vec4f offset = mat.TransformVector(new Vec4f(x - 0.5f, y, z - 0.5f, 0)); mesh.Translate(offset.XYZ); return(mesh); }
public override string GetPlacedBlockInfo(IWorldAccessor world, BlockPos pos, IPlayer forPlayer) { BlockEntityCrock becrock = world.BlockAccessor.GetBlockEntity(pos) as BlockEntityCrock; if (becrock == null) { return(null); } BlockMeal mealblock = world.GetBlock(new AssetLocation("bowl-meal")) as BlockMeal; CookingRecipe recipe = world.CookingRecipes.FirstOrDefault((rec) => becrock.RecipeCode == rec.Code); ItemStack[] stacks = becrock.inventory.Where(slot => !slot.Empty).Select(slot => slot.Itemstack).ToArray(); if (stacks == null || stacks.Length == 0) { return("Empty"); } StringBuilder dsc = new StringBuilder(); if (recipe != null) { DummySlot firstContentItemSlot = new DummySlot(stacks != null && stacks.Length > 0 ? stacks[0] : null, becrock.inventory); if (recipe != null) { dsc.AppendLine(recipe.GetOutputName(world, stacks).UcFirst()); } string facts = mealblock.GetContentNutritionFacts(world, new DummySlot(OnPickBlock(world, pos)), null); if (facts != null) { dsc.Append(facts); } firstContentItemSlot.Itemstack?.Collectible.AppendPerishableInfoText(firstContentItemSlot, dsc, world); } else { dsc.AppendLine("Contents:"); foreach (var stack in stacks) { if (stack == null) { continue; } dsc.AppendLine(stack.StackSize + "x " + stack.GetName()); } becrock.inventory[0].Itemstack.Collectible.AppendPerishableInfoText(becrock.inventory[0], dsc, api.World); } return(dsc.ToString()); }
public override void GetBlockInfo(IPlayer forPlayer, StringBuilder dsc) { ItemStack[] contentStacks = GetNonEmptyContentStacks(); CookingRecipe recipe = Api.GetCookingRecipes().FirstOrDefault(rec => rec.Code == RecipeCode); if (recipe == null) { return; } float servings = QuantityServings; int temp = GetTemperature(); string temppretty = Lang.Get("{0}°C", temp); if (temp < 20) { temppretty = Lang.Get("Cold"); } BlockMeal mealblock = Api.World.GetBlock(new AssetLocation("bowl-meal")) as BlockMeal; string nutriFacts = mealblock.GetContentNutritionFacts(Api.World, inventory[0], contentStacks, forPlayer.Entity); if (servings == 1) { dsc.Append(Lang.Get("cookedcontainer-servingstemp-singular", Math.Round(servings, 1), recipe.GetOutputName(forPlayer.Entity.World, contentStacks), temppretty, nutriFacts != null ? "\n" : "", nutriFacts)); } else { dsc.Append(Lang.Get("cookedcontainer-servingstemp-plural", Math.Round(servings, 1), recipe.GetOutputName(forPlayer.Entity.World, contentStacks), temppretty, nutriFacts != null ? "\n" : "", nutriFacts)); } foreach (var slot in inventory) { if (slot.Empty) { continue; } TransitionableProperties[] propsm = slot.Itemstack.Collectible.GetTransitionableProperties(Api.World, slot.Itemstack, null); if (propsm != null && propsm.Length > 0) { slot.Itemstack.Collectible.AppendPerishableInfoText(slot, dsc, Api.World); break; } } }
public override void Initialize(ICoreAPI api) { base.Initialize(api); ownBlock = api.World.BlockAccessor.GetBlock(pos) as BlockMeal; if (api.Side == EnumAppSide.Client) { RegisterGameTickListener(Every100ms, 200); } if (api.Side == EnumAppSide.Client && currentMesh == null) { currentMesh = GenMesh(); MarkDirty(true); } }
public override string GetBlockInfo(IPlayer forPlayer) { ItemStack[] contentStacks = GetNonEmptyContentStacks(); CookingRecipe recipe = api.World.CookingRecipes.FirstOrDefault(rec => rec.Code == RecipeCode); if (recipe == null) { return(null); } float servings = QuantityServings; int temp = GetTemperature(); string temppretty = Lang.Get("{0}°C", temp); if (temp < 20) { temppretty = "Cold"; } BlockMeal mealblock = api.World.GetBlock(new AssetLocation("bowl-meal")) as BlockMeal; string nutriFacts = mealblock.GetContentNutritionFacts(api.World, inventory[0], contentStacks, forPlayer.Entity); StringBuilder dsc = new StringBuilder(); if (servings == 1) { dsc.Append(Lang.Get("{0} serving of {1}\nTemperature: {2}{3}{4}", Math.Round(servings, 1), recipe.GetOutputName(forPlayer.Entity.World, contentStacks), temppretty, nutriFacts != null ? "\n" : "", nutriFacts)); } else { dsc.Append(Lang.Get("{0} servings of {1}\nTemperature: {2}{3}{4}", Math.Round(servings, 1), recipe.GetOutputName(forPlayer.Entity.World, contentStacks), temppretty, nutriFacts != null ? "\n" : "", nutriFacts)); } inventory[0].Itemstack.Collectible.AppendPerishableInfoText(inventory[0], dsc, api.World); //dsc.AppendLine(base.GetBlockInfo(forPlayer)); return(dsc.ToString()); }
public override void OnBlockPlaced(ItemStack byItemStack = null) { BlockMeal blockmeal = byItemStack?.Block as BlockMeal; if (blockmeal != null) { ItemStack[] stacks = blockmeal.GetContents(api.World, byItemStack); for (int i = 0; i < stacks.Length; i++) { Inventory.GetSlot(i).Itemstack = stacks[i]; } RecipeCode = blockmeal.GetRecipeCode(api.World, byItemStack); } if (api.Side == EnumAppSide.Client) { currentMesh = GenMesh(); MarkDirty(true); } }
public override void GetHeldItemInfo(ItemSlot inSlot, StringBuilder dsc, IWorldAccessor world, bool withDebugInfo) { //base.GetHeldItemInfo(inSlot, dsc, world, withDebugInfo); float temp = GetTemperature(world, inSlot.Itemstack); if (temp > 20) { dsc.AppendLine(Lang.Get("Temperature: {0}°C", (int)temp)); } CookingRecipe recipe = GetMealRecipe(world, inSlot.Itemstack); float servings = inSlot.Itemstack.Attributes.GetFloat("quantityServings"); ItemStack[] stacks = GetNonEmptyContents(world, inSlot.Itemstack); if (recipe != null) { if (servings == 1) { dsc.AppendLine(Lang.Get("{0} serving of {1}", Math.Round(servings, 1), recipe.GetOutputName(world, stacks))); } else { dsc.AppendLine(Lang.Get("{0} servings of {1}", Math.Round(servings, 1), recipe.GetOutputName(world, stacks))); } } BlockMeal mealblock = api.World.GetBlock(new AssetLocation("bowl-meal")) as BlockMeal; string nutriFacts = mealblock.GetContentNutritionFacts(api.World, inSlot, stacks, null); if (nutriFacts != null) { dsc.AppendLine(nutriFacts); } ItemSlot slot = BlockCrock.GetDummySlotForFirstPerishableStack(api.World, stacks, null, inSlot.Inventory); slot.Itemstack?.Collectible.AppendPerishableInfoText(slot, dsc, world); }
public override string GetPlacedBlockInfo(IWorldAccessor world, BlockPos pos, IPlayer forPlayer) { BlockEntityCrock becrock = world.BlockAccessor.GetBlockEntity(pos) as BlockEntityCrock; if (becrock == null) { return(null); } BlockMeal mealblock = world.GetBlock(new AssetLocation("bowl-meal")) as BlockMeal; CookingRecipe recipe = world.CookingRecipes.FirstOrDefault((rec) => becrock.RecipeCode == rec.Code); ItemStack[] stacks = becrock.inventory.Where(slot => !slot.Empty).Select(slot => slot.Itemstack).ToArray(); if (stacks == null || stacks.Length == 0) { return("Empty"); } StringBuilder dsc = new StringBuilder(); if (recipe != null) { ItemSlot slot = GetDummySlotForFirstPerishableStack(api.World, stacks, forPlayer.Entity, becrock.inventory); if (recipe != null) { if (becrock.QuantityServings == 1) { dsc.AppendLine(Lang.Get("{0} serving of {1}", Math.Round(becrock.QuantityServings, 1), recipe.GetOutputName(world, stacks))); } else { dsc.AppendLine(Lang.Get("{0} servings of {1}", Math.Round(becrock.QuantityServings, 1), recipe.GetOutputName(world, stacks))); } } string facts = mealblock.GetContentNutritionFacts(world, new DummySlot(OnPickBlock(world, pos)), null); if (facts != null) { dsc.Append(facts); } slot.Itemstack?.Collectible.AppendPerishableInfoText(slot, dsc, world); } else { dsc.AppendLine("Contents:"); foreach (var stack in stacks) { if (stack == null) { continue; } dsc.AppendLine(stack.StackSize + "x " + stack.GetName()); } becrock.inventory[0].Itemstack?.Collectible.AppendPerishableInfoText(becrock.inventory[0], dsc, api.World); } if (becrock.Sealed) { dsc.AppendLine("<font color=\"lightgreen\">" + Lang.Get("Sealed.") + "</font>"); } return(dsc.ToString()); }
public override void GetHeldItemInfo(ItemSlot inSlot, StringBuilder dsc, IWorldAccessor world, bool withDebugInfo) { base.GetHeldItemInfo(inSlot, dsc, world, withDebugInfo); BlockMeal mealblock = world.GetBlock(new AssetLocation("bowl-meal")) as BlockMeal; CookingRecipe recipe = GetCookingRecipe(world, inSlot.Itemstack); ItemStack[] stacks = GetNonEmptyContents(world, inSlot.Itemstack); if (stacks == null || stacks.Length == 0) { dsc.AppendLine("Empty"); return; } DummyInventory dummyInv = new DummyInventory(api); ItemSlot slot = GetDummySlotForFirstPerishableStack(api.World, stacks, null, dummyInv); dummyInv.OnAcquireTransitionSpeed = (transType, stack, mul) => { float val = mul * GetContainingTransitionModifierContained(world, inSlot, transType); val *= inSlot.Inventory.GetTransitionSpeedMul(transType, inSlot.Itemstack); return(val); }; if (recipe != null) { double servings = inSlot.Itemstack.Attributes.GetDecimal("quantityServings"); if (recipe != null) { if (servings == 1) { dsc.AppendLine(Lang.Get("{0} serving of {1}", servings, recipe.GetOutputName(world, stacks))); } else { dsc.AppendLine(Lang.Get("{0} servings of {1}", servings, recipe.GetOutputName(world, stacks))); } } string facts = mealblock.GetContentNutritionFacts(world, inSlot, null); if (facts != null) { dsc.Append(facts); } } else { dsc.AppendLine("Contents:"); foreach (var stack in stacks) { if (stack == null) { continue; } dsc.AppendLine(stack.StackSize + "x " + stack.GetName()); } } slot.Itemstack?.Collectible.AppendPerishableInfoText(slot, dsc, world); if (inSlot.Itemstack.Attributes.GetBool("sealed")) { dsc.AppendLine("<font color=\"lightgreen\">" + Lang.Get("Sealed.") + "</font>"); } }
public override void Initialize(ICoreAPI api) { base.Initialize(api); ownBlock = Api.World.BlockAccessor.GetBlock(Pos) as BlockMeal; if (Api.Side == EnumAppSide.Client) { RegisterGameTickListener(Every100ms, 200); /*RegisterGameTickListener(Every50ms, 150); * * IWorldAccessor w = Api.World; * rndMeals = new RndMeal[] * { * new RndMeal() * { * recipeCode = "jam", * stacks = new ItemStack[][] { * gs("honeyportion"), * gs("honeyportion"), * anyFruit(), * anyFruitOrNothing(), * } * }, * new RndMeal() * { * recipeCode = "porridge", * stacks = new ItemStack[][] { * gs("grain-spelt"), * gs("grain-spelt"), * anyFruitOrNothing(), * anyFruitOrNothing(), * anyVegetableOrNothing(), * anyVegetableOrNothing(), * honeyOrNothing() * } * }, * new RndMeal() * { * recipeCode = "porridge", * stacks = new ItemStack[][] { * gs("grain-flax"), * gs("grain-flax"), * anyFruitOrNothing(), * anyFruitOrNothing(), * anyVegetableOrNothing(), * anyVegetableOrNothing(), * honeyOrNothing() * } * }, * new RndMeal() * { * recipeCode = "porridge", * stacks = new ItemStack[][] { * gs("grain-rice"), * gs("grain-rice"), * anyFruitOrNothing(), * anyFruitOrNothing(), * anyVegetableOrNothing(), * anyVegetableOrNothing(), * honeyOrNothing() * } * }, * new RndMeal() * { * recipeCode = "soup", * stacks = new ItemStack[][] * { * gs("waterportion"), * anyVegetable(), * anyVegetableOrNothing(), * anyVegetableOrNothing(), * anyMeatOrEggOrNothing() * } * }, * new RndMeal() * { * recipeCode = "vegetablestew", * stacks = new ItemStack[][] * { * anyVegetable(), * anyVegetable(), * anyVegetableOrNothing(), * anyVegetableOrNothing(), * anyMeatOrEggOrNothing() * } * }, * new RndMeal() * { * recipeCode = "meatystew", * stacks = new ItemStack[][] * { * gs("redmeat-raw"), * gs("redmeat-raw"), * eggOrNothing(), * anyMeatOrEggOrNothing(), * anyVegetableOrNothing(), * anyVegetableOrNothing(), * anyFruitOrNothing(), * honeyOrNothing() * } * }, * new RndMeal() * { * recipeCode = "meatystew", * stacks = new ItemStack[][] * { * gs("poultry-raw"), * gs("poultry-raw"), * eggOrNothing(), * anyMeatOrEggOrNothing(), * anyVegetableOrNothing(), * anyVegetableOrNothing(), * anyFruitOrNothing(), * honeyOrNothing() * } * }, * };*/ } }
public string CrockInfoCompact(ItemSlot inSlot) { BlockMeal mealblock = Api.World.GetBlock(new AssetLocation("bowl-meal")) as BlockMeal; BlockCrock crock = inSlot.Itemstack.Collectible as BlockCrock; IWorldAccessor world = Api.World; CookingRecipe recipe = crock.GetCookingRecipe(world, inSlot.Itemstack); ItemStack[] stacks = crock.GetNonEmptyContents(world, inSlot.Itemstack); if (stacks == null || stacks.Length == 0) { return(Lang.Get("Empty Crock") + "\n"); } StringBuilder dsc = new StringBuilder(); if (recipe != null) { double servings = inSlot.Itemstack.Attributes.GetDecimal("quantityServings"); if (recipe != null) { if (servings == 1) { dsc.Append(Lang.Get("{0}x {1}.", servings, recipe.GetOutputName(world, stacks))); } else { dsc.Append(Lang.Get("{0}x {1}.", servings, recipe.GetOutputName(world, stacks))); } } } else { int i = 0; foreach (var stack in stacks) { if (stack == null) { continue; } if (i++ > 0) { dsc.Append(", "); } dsc.Append(stack.StackSize + "x " + stack.GetName()); } dsc.Append("."); } DummyInventory dummyInv = new DummyInventory(Api); ItemSlot contentSlot = BlockCrock.GetDummySlotForFirstPerishableStack(Api.World, stacks, null, dummyInv); dummyInv.OnAcquireTransitionSpeed = (transType, stack, mul) => { return(mul * crock.GetContainingTransitionModifierContained(world, inSlot, transType) * inv.GetTransitionSpeedMul(transType, stack)); }; TransitionState[] transitionStates = contentSlot.Itemstack?.Collectible.UpdateAndGetTransitionStates(Api.World, contentSlot); bool addNewLine = true; if (transitionStates != null) { for (int i = 0; i < transitionStates.Length; i++) { TransitionState state = transitionStates[i]; TransitionableProperties prop = state.Props; float perishRate = contentSlot.Itemstack.Collectible.GetTransitionRateMul(world, contentSlot, prop.Type); if (perishRate <= 0) { continue; } addNewLine = false; float transitionLevel = state.TransitionLevel; float freshHoursLeft = state.FreshHoursLeft / perishRate; switch (prop.Type) { case EnumTransitionType.Perish: if (transitionLevel > 0) { dsc.AppendLine(" " + Lang.Get("{0}% spoiled", (int)Math.Round(transitionLevel * 100))); } else { double hoursPerday = Api.World.Calendar.HoursPerDay; if (freshHoursLeft / hoursPerday >= Api.World.Calendar.DaysPerYear) { dsc.AppendLine(" " + Lang.Get("Fresh for {0} years", Math.Round(freshHoursLeft / hoursPerday / Api.World.Calendar.DaysPerYear, 1))); } /*else if (freshHoursLeft / hoursPerday >= Api.World.Calendar.DaysPerMonth) - confusing. 12 days per months and stuff.. * { * dsc.AppendLine(Lang.Get("<font color=\"orange\">Perishable.</font> Fresh for {0} months", Math.Round(freshHoursLeft / hoursPerday / Api.World.Calendar.DaysPerMonth, 1))); * }*/ else if (freshHoursLeft > hoursPerday) { dsc.AppendLine(" " + Lang.Get("Fresh for {0} days", Math.Round(freshHoursLeft / hoursPerday, 1))); } else { dsc.AppendLine(" " + Lang.Get("Fresh for {0} hours", Math.Round(freshHoursLeft, 1))); } } break; } } } if (addNewLine) { dsc.AppendLine(""); } return(dsc.ToString()); }
public override void GetHeldItemInfo(ItemSlot inSlot, StringBuilder dsc, IWorldAccessor world, bool withDebugInfo) { base.GetHeldItemInfo(inSlot, dsc, world, withDebugInfo); BlockMeal mealblock = world.GetBlock(new AssetLocation("bowl-meal")) as BlockMeal; CookingRecipe recipe = GetCookingRecipe(world, inSlot.Itemstack); ItemStack[] stacks = GetContents(world, inSlot.Itemstack); if (stacks == null || stacks.Length == 0) { dsc.AppendLine("Empty"); return; } DummySlot firstContentItemSlot = new DummySlot(stacks != null && stacks.Length > 0 ? stacks[0] : null); if (recipe != null) { double servings = inSlot.Itemstack.Attributes.GetDecimal("quantityServings"); if (recipe != null) { if (servings == 1) { dsc.AppendLine(Lang.Get("{0} serving of {1}", servings, recipe.GetOutputName(world, stacks))); } else { dsc.AppendLine(Lang.Get("{0} servings of {1}", servings, recipe.GetOutputName(world, stacks))); } } string facts = mealblock.GetContentNutritionFacts(world, inSlot, null); if (facts != null) { dsc.Append(facts); } } else { dsc.AppendLine("Contents:"); foreach (var stack in stacks) { if (stack == null) { continue; } dsc.AppendLine(stack.StackSize + "x " + stack.GetName()); } } firstContentItemSlot.Itemstack?.Collectible.AppendPerishableInfoText(firstContentItemSlot, dsc, world); if (inSlot.Itemstack.Attributes.GetBool("sealed")) { dsc.AppendLine(Lang.Get("Sealed.")); } }