public new void ServeIntoBowlStack(ItemSlot bowlSlot, ItemSlot potslot, IWorldAccessor world) { if (world.Side == EnumAppSide.Client) { return; } string code = bowlSlot.Itemstack.Block.Attributes["mealBlockCode"].AsString(); BlockMeal mealblock = api.World.GetBlock(new AssetLocation(code)) as BlockMeal; ItemStack[] stacks = GetContents(api.World, potslot.Itemstack); int quantityServings = GetServings(world, potslot.Itemstack); int servingsToTransfer = Math.Min(quantityServings, bowlSlot.Itemstack.Block.Attributes["servingCapacity"].AsInt(1)); ItemStack stack = new ItemStack(mealblock); mealblock.SetContents(GetRecipeCode(world, potslot.Itemstack), stack, stacks, servingsToTransfer); SetServings(world, potslot.Itemstack, quantityServings - servingsToTransfer); if (quantityServings - servingsToTransfer <= 0) { potslot.Itemstack = new ItemStack(api.World.GetBlock(new AssetLocation(CodeWithoutParts(1) + "-burned"))); } potslot.MarkDirty(); bowlSlot.Itemstack = stack; bowlSlot.MarkDirty(); }
public override void Initialize(ICoreAPI api) { base.Initialize(api); ownBlock = api.World.BlockAccessor.GetBlock(pos) as BlockMeal; if (api.Side == EnumAppSide.Client && currentMesh == null) { currentMesh = GenMesh(); MarkDirty(true); } }